Skip to content

Latest commit

 

History

History
115 lines (63 loc) · 5.5 KB

natpmp.md

File metadata and controls

115 lines (63 loc) · 5.5 KB

Module natpmp

Data Types


natpmp_error() = unsupported_version | not_authorized | network_failure | out_of_resource | unsupported_opcode | bad_response

Function Index

add_port_mapping/4add a port mapping with default lifetime.
add_port_mapping/5add a port mapping.
delete_port_mapping/4delete a port mapping.
discover/0discover a Nat gateway.
get_device_address/1
get_external_address/1get external ip.
get_internal_address/1get internal address used for this gateway.

Function Details

add_port_mapping/4


add_port_mapping(Gateway, Protocol, InternalPort, ExternalPortRequest) -> {ok, Since, InternalPort, ExternalPort, MappingLifetime} | {error, Reason}
  • Gateway = inet:ip_address() | inet:hostname()
  • Protocol = tcp | udp
  • InternalPort = non_neg_integer()
  • ExternalPortRequest = non_neg_integer()
  • Since = non_neg_integer()
  • ExternalPort = non_neg_integer()
  • MappingLifetime = non_neg_integer()
  • Reason = natpmp_error()

add a port mapping with default lifetime

add_port_mapping/5


add_port_mapping(Gateway, Protocol, InternalPort, ExternalPortRequest, Lifetime) -> {ok, Since, InternalPort, ExternalPort, MappingLifetime} | {error, Reason}
  • Gateway = inet:ip_address() | inet:hostname()
  • Protocol = tcp | udp
  • InternalPort = non_neg_integer()
  • ExternalPortRequest = non_neg_integer()
  • Lifetime = non_neg_integer()
  • Since = non_neg_integer()
  • ExternalPort = non_neg_integer()
  • MappingLifetime = non_neg_integer()
  • Reason = natpmp_error()

add a port mapping

delete_port_mapping/4


delete_port_mapping(Gateway, Protocol, InternalPort, ExternalPortRequest) -> ok | {error, Reason}

delete a port mapping

discover/0


discover() -> {ok, Gateway} | {error, any()}

discover a Nat gateway

get_device_address/1


get_device_address(Gateway) -> {ok, Ip} | {error, Reason}

get_external_address/1


get_external_address(Gateway) -> {ok, ExternalIp} | {error, Reason}

get external ip

get_internal_address/1


get_internal_address(Gateway) -> {ok, InternalIp}

get internal address used for this gateway