Changeset 1497
- Timestamp:
- Oct 12, 2007 11:29:27 PM (17 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjnath/include/pjnath/nat_detect.h
r1495 r1497 35 35 * @ingroup PJNATH_ICE 36 36 * @{ 37 * 37 38 * This module provides one function to perform NAT classification and 38 * detection. 39 * detection. NAT type detection is performed by calling 40 * #pj_stun_detect_nat_type() function. 39 41 */ 40 42 43 41 44 /** 42 * This enumeration describes the NAT types. 45 * This enumeration describes the NAT types, as specified by RFC 3489 46 * Section 5, NAT Variations. 43 47 */ 44 48 typedef enum pj_stun_nat_type 45 49 { 50 /** 51 * NAT type is unknown, because the detection has failed. 52 */ 46 53 PJ_STUN_NAT_TYPE_UNKNOWN, 54 55 /** 56 * This specifies that the client has open access to Internet (or 57 * at least, its behind a firewall that behaves like a full-cone NAT, 58 * but without the translation) 59 */ 47 60 PJ_STUN_NAT_TYPE_OPEN, 61 62 /** 63 * This specifies that communication with server has failed, probably 64 * because UDP packets are blocked. 65 */ 48 66 PJ_STUN_NAT_TYPE_BLOCKED, 67 68 /** 69 * Firewall that allows UDP out, and responses have to come back to 70 * the source of the request (like a symmetric NAT, but no 71 * translation. 72 */ 49 73 PJ_STUN_NAT_TYPE_SYMMETRIC_UDP, 74 75 /** 76 * A full cone NAT is one where all requests from the same internal 77 * IP address and port are mapped to the same external IP address and 78 * port. Furthermore, any external host can send a packet to the 79 * internal host, by sending a packet to the mapped external address. 80 */ 50 81 PJ_STUN_NAT_TYPE_FULL_CONE, 82 83 /** 84 * A symmetric NAT is one where all requests from the same internal 85 * IP address and port, to a specific destination IP address and port, 86 * are mapped to the same external IP address and port. If the same 87 * host sends a packet with the same source address and port, but to 88 * a different destination, a different mapping is used. Furthermore, 89 * only the external host that receives a packet can send a UDP packet 90 * back to the internal host. 91 */ 51 92 PJ_STUN_NAT_TYPE_SYMMETRIC, 93 94 /** 95 * A restricted cone NAT is one where all requests from the same 96 * internal IP address and port are mapped to the same external IP 97 * address and port. Unlike a full cone NAT, an external host (with 98 * IP address X) can send a packet to the internal host only if the 99 * internal host had previously sent a packet to IP address X. 100 */ 52 101 PJ_STUN_NAT_TYPE_RESTRICTED, 102 103 /** 104 * A port restricted cone NAT is like a restricted cone NAT, but the 105 * restriction includes port numbers. Specifically, an external host 106 * can send a packet, with source IP address X and source port P, 107 * to the internal host only if the internal host had previously sent 108 * a packet to IP address X and port P. 109 */ 53 110 PJ_STUN_NAT_TYPE_PORT_RESTRICTED 111 54 112 } pj_stun_nat_type; 55 113 … … 60 118 typedef struct pj_stun_nat_detect_result 61 119 { 120 /** 121 * Status of the detection process. If this value is not PJ_SUCCESS, 122 * the detection has failed and \a nat_type field will contain 123 * PJ_STUN_NAT_TYPE_UNKNOWN. 124 */ 62 125 pj_status_t status; 126 127 /** 128 * The text describing the status, if the status is not PJ_SUCCESS. 129 */ 63 130 const char *status_text; 131 132 /** 133 * This contains the NAT type as detected by the detection procedure. 134 * This value is only valid when the \a status is PJ_SUCCESS. 135 */ 64 136 pj_stun_nat_type nat_type; 137 138 /** 139 * Text describing that NAT type. 140 */ 65 141 const char *nat_type_name; 142 66 143 } pj_stun_nat_detect_result; 67 144 … … 76 153 77 154 /** 78 * Perform NAT classification function. 155 * Perform NAT classification function according to the procedures 156 * specified in RFC 3489. Once this function returns successfully, 157 * the procedure will run in the "background" and will complete 158 * asynchronously. Application can register a callback to be notified 159 * when such detection has completed. 160 * 161 * @param server STUN server address. 162 * @param stun_cfg A structure containing various STUN configurations, 163 * such as the ioqueue and timer heap instance used 164 * to receive network I/O and timer events. 165 * @param user_data Application data, which will be returned back 166 * in the callback. 167 * @param cb Callback to be registered to receive notification 168 * about detection result. 169 * 170 * @return If this function returns PJ_SUCCESS, the procedure 171 * will complete asynchronously and callback will be 172 * called when it completes. For other return 173 * values, it means that an error has occured and 174 * the procedure did not start. 79 175 */ 80 176 PJ_DECL(pj_status_t) pj_stun_detect_nat_type(const pj_sockaddr_in *server, -
pjproject/trunk/pjnath/src/pjnath/nat_detect.c
r1496 r1497 42 42 43 43 44 //#define CHANGE_PORT (0x01 << 30) 45 //#define CHANGE_ADDR_PORT (0x03 << 29) 46 //#define CHANGE_ADDR_PORT 0xFFFFFFFFU 44 #define CHANGE_ADDR 4 47 45 #define CHANGE_PORT 2 48 #define CHANGE_ADDR_PORT 646 #define CHANGE_ADDR_PORT (CHANGE_ADDR | CHANGE_PORT) 49 47 50 48 -
pjproject/trunk/pjsip-apps/src/pjsua_wince/pjsua_wince.cpp
r1495 r1497 54 54 // 55 55 // STUN server 56 #if 056 #if 1 57 57 // Use this to have the STUN server resolved normally 58 58 # define STUN_DOMAIN NULL 59 # define STUN_SERVER " 192.168.0.2"59 # define STUN_SERVER "stun.fwdnet.net" 60 60 #elif 0 61 61 // Use this to have the STUN server resolved with DNS SRV
Note: See TracChangeset
for help on using the changeset viewer.