Ignore:
Timestamp:
Oct 8, 2006 1:56:07 PM (18 years ago)
Author:
bennylp
Message:

Added pjlib-util/config.h and pjlib-util/types.h to put
together common settings, and updated Doxygen documentation
for PJLIB-UTIL.

File:
1 edited

Legend:

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

    r217 r754  
    2020#define __PJ_STUN_H__ 
    2121 
    22 #include <pj/types.h> 
     22/** 
     23 * @file stun.h 
     24 * @brief STUN client. 
     25 */ 
     26 
     27#include <pjlib-util/types.h> 
    2328#include <pj/sock.h> 
    2429 
     30/** 
     31 * @defgroup PJLIB_UTIL_STUN_CLIENT Mini/Tiny STUN Client 
     32 * @ingroup PJLIB_UTIL 
     33 * @{ 
     34 */ 
     35 
    2536PJ_BEGIN_DECL 
    2637 
    27 #define PJ_STUN_MAX_ATTR    16 
    28  
     38/** 
     39 * This enumeration describes STUN message types. 
     40 */ 
    2941typedef enum pj_stun_msg_type 
    3042{ 
     
    3749} pj_stun_msg_type; 
    3850 
     51 
     52/** 
     53 * This enumeration describes STUN attribute types. 
     54 */ 
    3955typedef enum pj_stun_attr_type 
    4056{ 
     
    5268} pj_stun_attr_type; 
    5369 
     70 
     71/** 
     72 * This structre describes STUN message header. 
     73 */ 
    5474typedef struct pj_stun_msg_hdr 
    5575{ 
     
    5979} pj_stun_msg_hdr; 
    6080 
     81 
     82/** 
     83 * This structre describes STUN attribute header. 
     84 */ 
    6185typedef struct pj_stun_attr_hdr 
    6286{ 
     
    6589} pj_stun_attr_hdr; 
    6690 
     91 
     92/** 
     93 * This structre describes STUN MAPPED-ADDR attribute. 
     94 */ 
    6795typedef struct pj_stun_mapped_addr_attr 
    6896{ 
     
    119147PJ_DECL(void*) pj_stun_msg_find_attr( pj_stun_msg *msg, pj_stun_attr_type t); 
    120148 
     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 */ 
    121188PJ_DECL(pj_status_t) pj_stun_get_mapped_addr( pj_pool_factory *pf, 
    122189                                              int sock_cnt, pj_sock_t sock[], 
     
    127194PJ_END_DECL 
    128195 
     196/** 
     197 * @} 
     198 */ 
     199 
    129200#endif  /* __PJ_STUN_H__ */ 
    130201 
Note: See TracChangeset for help on using the changeset viewer.