Home --> Documentations --> PJNATH Reference
NAT Classification/Detection Tool.
More...
This module provides one function to perform NAT classification and detection. NAT type detection is performed by calling pj_stun_detect_nat_type() function.
◆ pj_stun_nat_detect_cb
Type of callback to be called when the NAT detection function has completed.
◆ pj_stun_nat_type
This enumeration describes the NAT types, as specified by RFC 3489 Section 5, NAT Variations.
Enumerator |
---|
PJ_STUN_NAT_TYPE_UNKNOWN | NAT type is unknown because the detection has not been performed.
|
PJ_STUN_NAT_TYPE_ERR_UNKNOWN | NAT type is unknown because there is failure in the detection process, possibly because server does not support RFC 3489.
|
PJ_STUN_NAT_TYPE_OPEN | This specifies that the client has open access to Internet (or at least, its behind a firewall that behaves like a full-cone NAT, but without the translation)
|
PJ_STUN_NAT_TYPE_BLOCKED | This specifies that communication with server has failed, probably because UDP packets are blocked.
|
PJ_STUN_NAT_TYPE_SYMMETRIC_UDP | Firewall that allows UDP out, and responses have to come back to the source of the request (like a symmetric NAT, but no translation.
|
PJ_STUN_NAT_TYPE_FULL_CONE | A full cone NAT is one where all requests from the same internal IP address and port are mapped to the same external IP address and port. Furthermore, any external host can send a packet to the internal host, by sending a packet to the mapped external address.
|
PJ_STUN_NAT_TYPE_SYMMETRIC | A symmetric NAT is one where all requests from the same internal IP address and port, to a specific destination IP address and port, are mapped to the same external IP address and port. If the same host sends a packet with the same source address and port, but to a different destination, a different mapping is used. Furthermore, only the external host that receives a packet can send a UDP packet back to the internal host.
|
PJ_STUN_NAT_TYPE_RESTRICTED | A restricted cone NAT is one where all requests from the same internal IP address and port are mapped to the same external IP address and port. Unlike a full cone NAT, an external host (with IP address X) can send a packet to the internal host only if the internal host had previously sent a packet to IP address X.
|
PJ_STUN_NAT_TYPE_PORT_RESTRICTED | A port restricted cone NAT is like a restricted cone NAT, but the restriction includes port numbers. Specifically, an external host can send a packet, with source IP address X and source port P, to the internal host only if the internal host had previously sent a packet to IP address X and port P.
|
◆ pj_stun_detect_nat_type()
Perform NAT classification function according to the procedures specified in RFC 3489. Once this function returns successfully, the procedure will run in the "background" and will complete asynchronously. Application can register a callback to be notified when such detection has completed.
See also pj_stun_detect_nat_type2() which supports IPv6.
- Parameters
-
server | STUN server address. |
stun_cfg | A structure containing various STUN configurations, such as the ioqueue and timer heap instance used to receive network I/O and timer events. |
user_data | Application data, which will be returned back in the callback. |
cb | Callback to be registered to receive notification about detection result. |
- Returns
- If this function returns PJ_SUCCESS, the procedure will complete asynchronously and callback will be called when it completes. For other return values, it means that an error has occured and the procedure did not start.
◆ pj_stun_detect_nat_type2()
Variant of pj_stun_detect_nat_type() that supports IPv6.
- Parameters
-
server | STUN server address. |
stun_cfg | A structure containing various STUN configurations, such as the ioqueue and timer heap instance used to receive network I/O and timer events. |
user_data | Application data, which will be returned back in the callback. |
cb | Callback to be registered to receive notification about detection result. |
- Returns
- If this function returns PJ_SUCCESS, the procedure will complete asynchronously and callback will be called when it completes. For other return values, it means that an error has occured and the procedure did not start.
References PJ_END_DECL.
◆ pj_stun_get_nat_name()
Get the NAT name from the specified NAT type.
- Parameters
-
- Returns
- NAT name.
|
PJNATH - Open Source NAT traversal helper library supporting STUN, TURN, and ICE
Copyright (C) 2006-2009 Teluu Inc.
|