Ignore:
Timestamp:
Aug 9, 2012 5:21:25 AM (12 years ago)
Author:
nanang
Message:

Close #1567: Added option to use STUN2 format for resolving mapped address in pjsua_config.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib-util/include/pjlib-util/stun_simple.h

    r3553 r4224  
    200200                                              pj_sockaddr_in mapped_addr[]); 
    201201 
     202 
     203/* 
     204 * This structre describes configurable setting for requesting mapped address. 
     205 */ 
     206typedef struct pjstun_setting 
     207{ 
     208    /** 
     209     * Specifies whether STUN request generated by old STUN library should 
     210     * insert magic cookie (specified in RFC 5389) in the transaction ID. 
     211     */ 
     212    pj_bool_t   use_stun2; 
     213 
     214    /** 
     215     * Host name or IP address string of the first STUN server. 
     216     */ 
     217    pj_str_t srv1; 
     218 
     219    /** 
     220     * The port number of the first STUN server. 
     221     */ 
     222    int port1; 
     223 
     224    /** 
     225     * Host name or IP address string of the second STUN server. 
     226     */ 
     227    pj_str_t srv2; 
     228 
     229    /** 
     230     * The port number of the second STUN server. 
     231     */ 
     232    int port2; 
     233 
     234} pjstun_setting; 
     235 
     236 
     237/** 
     238 * Another version of mapped address resolution of local sockets to multiple 
     239 * STUN servers configured in #pjstun_setting. This function is able to find 
     240 * the mapped addresses of multiple sockets simultaneously, and for each 
     241 * socket, two requests will be sent to two different STUN servers to see if 
     242 * both servers get the same public address for the same socket. (Note that 
     243 * application can specify the same address for the two servers, but still 
     244 * two requests will be sent for each server). 
     245 * 
     246 * This function will perform necessary retransmissions of the requests if 
     247 * response is not received within a predetermined period. When all responses 
     248 * have been received, the function will compare the mapped addresses returned 
     249 * by the servers, and when both are equal, the address will be returned in 
     250 * \a mapped_addr argument. 
     251 * 
     252 * @param pf            The pool factory where memory will be allocated from. 
     253 * @param opt           The STUN settings. 
     254 * @param sock_cnt      Number of sockets in the socket array. 
     255 * @param sock          Array of local UDP sockets which public addresses are 
     256 *                      to be queried from the STUN servers. 
     257 * @param mapped_addr   Array to receive the mapped public address of the local 
     258 *                      UDP sockets, when the function returns PJ_SUCCESS. 
     259 * 
     260 * @return              This functions returns PJ_SUCCESS if responses are 
     261 *                      received from all servers AND all servers returned the 
     262 *                      same mapped public address. Otherwise this function may 
     263 *                      return one of the following error codes: 
     264 *                      - PJLIB_UTIL_ESTUNNOTRESPOND: no respons from servers. 
     265 *                      - PJLIB_UTIL_ESTUNSYMMETRIC: different mapped addresses 
     266 *                        are returned by servers. 
     267 *                      - etc. 
     268 * 
     269 */ 
     270PJ_DECL(pj_status_t) pjstun_get_mapped_addr2( pj_pool_factory *pf, 
     271                                              const pjstun_setting *opt, 
     272                                              int sock_cnt, 
     273                                              pj_sock_t sock[], 
     274                                              pj_sockaddr_in mapped_addr[]); 
     275 
     276 
    202277PJ_END_DECL 
    203278 
Note: See TracChangeset for help on using the changeset viewer.