Changeset 754 for pjproject/trunk/pjlib-util/include/pjlib-util/stun.h
- Timestamp:
- Oct 8, 2006 1:56:07 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib-util/include/pjlib-util/stun.h
r217 r754 20 20 #define __PJ_STUN_H__ 21 21 22 #include <pj/types.h> 22 /** 23 * @file stun.h 24 * @brief STUN client. 25 */ 26 27 #include <pjlib-util/types.h> 23 28 #include <pj/sock.h> 24 29 30 /** 31 * @defgroup PJLIB_UTIL_STUN_CLIENT Mini/Tiny STUN Client 32 * @ingroup PJLIB_UTIL 33 * @{ 34 */ 35 25 36 PJ_BEGIN_DECL 26 37 27 #define PJ_STUN_MAX_ATTR 16 28 38 /** 39 * This enumeration describes STUN message types. 40 */ 29 41 typedef enum pj_stun_msg_type 30 42 { … … 37 49 } pj_stun_msg_type; 38 50 51 52 /** 53 * This enumeration describes STUN attribute types. 54 */ 39 55 typedef enum pj_stun_attr_type 40 56 { … … 52 68 } pj_stun_attr_type; 53 69 70 71 /** 72 * This structre describes STUN message header. 73 */ 54 74 typedef struct pj_stun_msg_hdr 55 75 { … … 59 79 } pj_stun_msg_hdr; 60 80 81 82 /** 83 * This structre describes STUN attribute header. 84 */ 61 85 typedef struct pj_stun_attr_hdr 62 86 { … … 65 89 } pj_stun_attr_hdr; 66 90 91 92 /** 93 * This structre describes STUN MAPPED-ADDR attribute. 94 */ 67 95 typedef struct pj_stun_mapped_addr_attr 68 96 { … … 119 147 PJ_DECL(void*) pj_stun_msg_find_attr( pj_stun_msg *msg, pj_stun_attr_type t); 120 148 149 150 /** 151 * This is the main function to request the mapped address of local sockets 152 * to multiple STUN servers. This function is able to find the mapped 153 * addresses of multiple sockets simultaneously, and for each socket, two 154 * requests will be sent to two different STUN servers to see if both servers 155 * get the same public address for the same socket. (Note that application can 156 * specify the same address for the two servers, but still two requests will 157 * be sent for each server). 158 * 159 * This function will perform necessary retransmissions of the requests if 160 * response is not received within a predetermined period. When all responses 161 * have been received, the function will compare the mapped addresses returned 162 * by the servers, and when both are equal, the address will be returned in 163 * \a mapped_addr argument. 164 * 165 * @param pf The pool factory where memory will be allocated from. 166 * @param sock_cnt Number of sockets in the socket array. 167 * @param sock Array of local UDP sockets which public addresses are 168 * to be queried from the STUN servers. 169 * @param srv1 Host name or IP address string of the first STUN 170 * server. 171 * @param port1 The port number of the first STUN server. 172 * @param srv2 Host name or IP address string of the second STUN 173 * server. 174 * @param port2 The port number of the second STUN server. 175 * @param mapped_addr Array to receive the mapped public address of the local 176 * UDP sockets, when the function returns PJ_SUCCESS. 177 * 178 * @return This functions returns PJ_SUCCESS if responses are 179 * received from all servers AND all servers returned the 180 * same mapped public address. Otherwise this function may 181 * return one of the following error codes: 182 * - PJLIB_UTIL_ESTUNNOTRESPOND: no respons from servers. 183 * - PJLIB_UTIL_ESTUNSYMMETRIC: different mapped addresses 184 * are returned by servers. 185 * - etc. 186 * 187 */ 121 188 PJ_DECL(pj_status_t) pj_stun_get_mapped_addr( pj_pool_factory *pf, 122 189 int sock_cnt, pj_sock_t sock[], … … 127 194 PJ_END_DECL 128 195 196 /** 197 * @} 198 */ 199 129 200 #endif /* __PJ_STUN_H__ */ 130 201
Note: See TracChangeset
for help on using the changeset viewer.