Changeset 1913 for pjproject/trunk/pjnath/include/pjnath/stun_session.h
- Timestamp:
- Apr 9, 2008 9:38:12 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjnath/include/pjnath/stun_session.h
r1877 r1913 65 65 * 66 66 * @param sess The STUN session. 67 * @param token The token associated with this outgoing message 68 * and was set by the application. This token was 69 * set by application in pj_stun_session_send_msg() 70 * for outgoing messages that are initiated by the 71 * application, or in pj_stun_session_on_rx_pkt() 72 * if this message is a response that was internally 73 * generated by the STUN session (for example, an 74 * 401/Unauthorized response). Application may use 75 * this facility for any purposes. 67 76 * @param pkt Packet to be sent. 68 77 * @param pkt_size Size of the packet to be sent. … … 74 83 */ 75 84 pj_status_t (*on_send_msg)(pj_stun_session *sess, 85 void *token, 76 86 const void *pkt, 77 87 pj_size_t pkt_size, … … 80 90 81 91 /** 82 * Callback to be called on incoming STUN request message. In the 92 * Callback to be called on incoming STUN request message. This function 93 * is called when application calls pj_stun_session_on_rx_pkt() and when 94 * the STUN session has detected that the incoming STUN message is a 95 * STUN request message. In the 83 96 * callback processing, application MUST create a response by calling 84 97 * pj_stun_session_create_response() function and send the response … … 90 103 * @param pkt_len Length of the STUN packet. 91 104 * @param rdata Data containing incoming request message. 105 * @param token The token that was set by the application when 106 * calling pj_stun_session_on_rx_pkt() function. 92 107 * @param src_addr Source address of the packet. 93 108 * @param src_addr_len Length of the source address. … … 101 116 unsigned pkt_len, 102 117 const pj_stun_rx_data *rdata, 118 void *token, 103 119 const pj_sockaddr_t *src_addr, 104 120 unsigned src_addr_len); … … 106 122 /** 107 123 * Callback to be called when response is received or the transaction 108 * has timed out. 124 * has timed out. This callback is called either when application calls 125 * pj_stun_session_on_rx_pkt() with the packet containing a STUN 126 * response for the client transaction, or when the internal timer of 127 * the STUN client transaction has timed-out before a STUN response is 128 * received. 109 129 * 110 130 * @param sess The STUN session. … … 116 136 * response may contain non-NULL value if the 117 137 * response contains STUN ERROR-CODE attribute. 138 * @param token The token that was set by the application when 139 * calling pj_stun_session_send_msg() function. 140 * Please not that this token IS NOT the token 141 * that was given in pj_stun_session_on_rx_pkt(). 118 142 * @param tdata The original STUN request. 119 143 * @param response The response message, on successful transaction, … … 128 152 void (*on_request_complete)(pj_stun_session *sess, 129 153 pj_status_t status, 154 void *token, 130 155 pj_stun_tx_data *tdata, 131 156 const pj_stun_msg *response, … … 135 160 136 161 /** 137 * Type of callback to be called on incoming STUN indication. 162 * Callback to be called on incoming STUN request message. This function 163 * is called when application calls pj_stun_session_on_rx_pkt() and when 164 * the STUN session has detected that the incoming STUN message is a 165 * STUN indication message. 166 * 167 * @param sess The STUN session. 168 * @param pkt Pointer to the original STUN packet. 169 * @param pkt_len Length of the STUN packet. 170 * @param msg The parsed STUN indication. 171 * @param token The token that was set by the application when 172 * calling pj_stun_session_on_rx_pkt() function. 173 * @param src_addr Source address of the packet. 174 * @param src_addr_len Length of the source address. 175 * 176 * @return The return value of this callback will be 177 * returned back to pj_stun_session_on_rx_pkt() 178 * function. 138 179 */ 139 180 pj_status_t (*on_rx_indication)(pj_stun_session *sess, … … 141 182 unsigned pkt_len, 142 183 const pj_stun_msg *msg, 184 void *token, 143 185 const pj_sockaddr_t *src_addr, 144 186 unsigned src_addr_len); … … 178 220 pj_stun_msg *msg; /**< The STUN message. */ 179 221 180 void * user_data; /**< Arbitrary application data.*/222 void *token; /**< The token. */ 181 223 182 224 pj_stun_client_tsx *client_tsx; /**< Client STUN transaction. */ 225 pj_bool_t retransmit; /**< Retransmit request? */ 183 226 pj_uint32_t msg_magic; /**< Message magic. */ 184 227 pj_uint8_t msg_key[12]; /**< Message/transaction key. */ … … 369 412 * 370 413 * @param sess The STUN session instance. 371 * @param cache_res If PJ_TRUE then response will be cached. 414 * @param token Optional token which will be given back to application in 415 * \a on_send_msg() callback and \a on_request_complete() 416 * callback, if the message is a STUN request message. 417 * Internally this function will put the token in the 418 * \a token field of pj_stun_tx_data, hence it will 419 * overwrite any value that the application puts there. 420 * @param cache_res If the message is a response message for an incoming 421 * request, specify PJ_TRUE to instruct the STUN session 422 * to cache this response for subsequent incoming request 423 * retransmission. Otherwise this parameter will be ignored 424 * for non-response message. 425 * @param retransmit If the message is a request message, specify whether the 426 * request should be retransmitted. Normally application will 427 * specify TRUE if the underlying transport is UDP and FALSE 428 * if the underlying transport is TCP or TLS. 372 429 * @param dst_addr The destination socket address. 373 430 * @param addr_len Length of destination address. … … 378 435 */ 379 436 PJ_DECL(pj_status_t) pj_stun_session_send_msg(pj_stun_session *sess, 437 void *token, 380 438 pj_bool_t cache_res, 439 pj_bool_t retransmit, 381 440 const pj_sockaddr_t *dst_addr, 382 441 unsigned addr_len, … … 384 443 385 444 /** 386 * Create and send STUN response message. 445 * This is a utility function to create and send response for an incoming 446 * STUN request. Internally this function calls pj_stun_session_create_res() 447 * and pj_stun_session_send_msg(). It is provided here as a matter of 448 * convenience. 387 449 * 388 450 * @param sess The STUN session instance. … … 396 458 * \a err_code is non-zero, then default error message will 397 459 * be used. 460 * @param token Optional token which will be given back to application in 461 * \a on_send_msg() callback and \a on_request_complete() 462 * callback, if the message is a STUN request message. 463 * Internally this function will put the token in the 464 * \a token field of pj_stun_tx_data, hence it will 465 * overwrite any value that the application puts there. 398 466 * @param cache Specify whether session should cache this response for 399 467 * future request retransmission. If TRUE, subsequent request … … 410 478 unsigned code, 411 479 const char *err_msg, 480 void *token, 412 481 pj_bool_t cache, 413 482 const pj_sockaddr_t *dst_addr, … … 469 538 * STUN message (useful if packet is received via a 470 539 * stream oriented protocol). 471 * @param src_addr The source address of the packet. 540 * @param token Optional token which will be given back to application 541 * in the \a on_rx_request(), \a on_rx_indication() and 542 * \a on_send_msg() callbacks. The token can be used to 543 * associate processing or incoming request or indication 544 * with some context. 545 * @param src_addr The source address of the packet, which will also 546 * be given back to application callbacks, along with 547 * source address length. 472 548 * @param src_addr_len Length of the source address. 473 549 * … … 478 554 pj_size_t pkt_size, 479 555 unsigned options, 556 void *token, 480 557 unsigned *parsed_len, 481 558 const pj_sockaddr_t *src_addr,
Note: See TracChangeset
for help on using the changeset viewer.