Ignore:
Timestamp:
Apr 22, 2009 5:20:24 PM (15 years ago)
Author:
bennylp
Message:

Part of ticket #780: enhance the PJNATH doxygen documentation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjnath/include/pjnath/stun_session.h

    r2589 r2642  
    3838/* **************************************************************************/ 
    3939/** 
    40  * @defgroup PJNATH_STUN_SESSION STUN Client/Server Session 
    41  * @brief STUN client and server session 
    42  * @ingroup PJNATH_STUN 
     40 * @addtogroup PJNATH_STUN_SESSION 
    4341 * @{ 
     42 * 
     43 * This is is a transport-independent object to manage a client or server  
     44 * STUN session. It has the following features: 
     45 *  
     46 *  - <b>transport independent</b>:\n 
     47 *    the object does not have it's own socket, but rather it provides 
     48 *    functions and callbacks to send and receive packets. This way the 
     49 *    object can be used by different transport types (e.g. UDP, TCP,  
     50 *    TLS, etc.) as well as better integration to application which 
     51 *    already has its own means to send and receive packets. 
     52 *  
     53 *  - <b>authentication management</b>:\n 
     54 *    the object manages STUN authentication throughout the lifetime of 
     55 *    the session. For client sessions, once it's given a credential to 
     56 *    authenticate itself with the server, the object will automatically 
     57 *    add authentication info (the MESSAGE-INTEGRITY) to the request as 
     58 *    well as authenticate the response. It will also handle long-term  
     59 *    authentication challenges, including handling of nonce expiration, 
     60 *    and retry the request automatically. For server sessions, it can  
     61 *    be configured to authenticate incoming requests automatically. 
     62 *   
     63 *  - <b>static or dynamic credential</b>:\n 
     64 *    application may specify static or dynamic credential to be used by 
     65 *    the STUN session. Static credential means a static combination of 
     66 *    username and password (and these cannot change during the session 
     67 *    duration), while dynamic credential provides callback to ask the 
     68 *    application about which username/password to use everytime 
     69 *    authentication is about to be performed. 
     70 *     
     71 *  - <b>client transaction management</b>:\n 
     72 *    outgoing requests may be sent with a STUN transaction for reliability, 
     73 *    and the object will manage the transaction internally (including 
     74 *    performing retransmissions). Application will be notified about the 
     75 *    result of the request when the response arrives (or the transaction 
     76 *    times out). When the request is challenged with authentication, the 
     77 *    object will retry the request with new authentication info, and  
     78 *    application will be notified about the final result of this request. 
     79 *  
     80 *  - <b>server transaction management</b>:\n 
     81 *    application may ask response to incoming requests to be cached by 
     82 *    the object, and in this case the object will check for cached 
     83 *    response everytime request is received. The cached response will be 
     84 *    deleted once a timer expires. 
     85 * 
     86 * \section using_stun_sess_sec Using the STUN session 
     87 * 
     88 * The following steps describes how to use the STUN session: 
     89 * 
     90 *  - <b>create the object configuration</b>:\n 
     91 *    The #pj_stun_config contains the configuration to create the STUN 
     92 *    session, such as the timer heap to register internal timers and 
     93 *    various STUN timeout values. You can initialize this structure by 
     94 *    calling #pj_stun_config_init() 
     95 * 
     96 *  - <b>create the STUN session</b>:\n 
     97 *    by calling #pj_stun_session_create(). Among other things, this 
     98 *    function requires the instance of #pj_stun_config and also  
     99 *    #pj_stun_session_cb structure which stores callbacks to send 
     100 *    outgoing packets as well as to notify application about incoming 
     101 *    STUN requests, responses, and indicates and other events. 
     102 * 
     103 *  - <b>configure credential:</b>\n 
     104 *    if authentication is required for the session, configure the 
     105 *    credential with #pj_stun_session_set_credential() 
     106 * 
     107 *  - <b>configuring other settings:</b>\n 
     108 *    several APIs are provided to configure the behavior of the STUN 
     109 *    session (for example, to set the SOFTWARE attribute value, controls 
     110 *    the logging behavior, fine tune the mutex locking, etc.). Please see 
     111 *    the API reference for more info. 
     112 * 
     113 *  - <b>creating outgoing STUN requests or indications:</b>\n 
     114 *    create the STUN message by using #pj_stun_session_create_req() or 
     115 *    #pj_stun_session_create_ind(). This will create a transmit data 
     116 *    buffer containing a blank STUN request or indication. You will then 
     117 *    typically need to add STUN attributes that are relevant to the 
     118 *    request or indication, but note that some default attributes will 
     119 *    be added by the session later when the message is sent (such as 
     120 *    SOFTWARE attribute and attributes related to authentication). 
     121 *    The message is now ready to be sent. 
     122 * 
     123 *  - <b>sending outgoing message:</b>\n 
     124 *    use #pj_stun_session_send_msg() to send outgoing STUN messages (this 
     125 *    includes STUN requests, indications, and responses). The function has 
     126 *    options whether to retransmit the request (for non reliable transports) 
     127 *    or to cache the response if we're sending response. This function in  
     128 *    turn will call the \a on_send_msg() callback of #pj_stun_session_cb  
     129 *    to request the application to send the packet. 
     130 * 
     131 *  - <b>handling incoming packet:</b>\n 
     132 *    call #pj_stun_session_on_rx_pkt() everytime the application receives 
     133 *    a STUN packet. This function will decode the packet and process the 
     134 *    packet according to the message, and normally this will cause one 
     135 *    of the callback in the #pj_stun_session_cb to be called to notify 
     136 *    the application about the event. 
     137 * 
     138 *  - <b>handling incoming requests:</b>\n 
     139 *    incoming requests are notified to application in the \a on_rx_request 
     140 *    callback of the #pj_stun_session_cb. If authentication is enabled in 
     141 *    the session, the application will only receive this callback after 
     142 *    the incoming request has been authenticated (if the authentication 
     143 *    fails, the session would respond automatically with 401 error and 
     144 *    the callback will not be called). Application now must create and 
     145 *    send response for this request. 
     146 * 
     147 *  - <b>creating and sending response:</b>\n 
     148 *    create the STUN response with #pj_stun_session_create_res(). This will 
     149 *    create a transmit data buffer containing a blank STUN response. You  
     150 *    will then typically need to add STUN attributes that are relevant to 
     151 *    the response, but note that some default attributes will 
     152 *    be added by the session later when the message is sent (such as 
     153 *    SOFTWARE attribute and attributes related to authentication). 
     154 *    The message is now ready to be sent. Use #pj_stun_session_send_msg() 
     155 *    (as explained above) to send the response. 
     156 * 
     157 *  - <b>convenient way to send response:</b>\n 
     158 *    the #pj_stun_session_respond() is provided as a convenient way to 
     159 *    create and send simple STUN responses, such as error responses. 
     160 *     
     161 *  - <b>destroying the session:</b>\n 
     162 *    once the session is done, use #pj_stun_session_destroy() to destroy 
     163 *    the session. 
    44164 */ 
    45165 
Note: See TracChangeset for help on using the changeset viewer.