- Timestamp:
- Feb 3, 2007 8:31:33 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/iceproject/pjlib-util/include/pjlib-util/stun_transaction.h
r913 r929 1 /* $Id */1 /* $Id$ */ 2 2 /* 3 3 * Copyright (C) 2003-2005 Benny Prijono <benny@prijono.org> … … 38 38 * @ingroup PJLIB_UTIL_STUN 39 39 * @{ 40 * 41 The @ref PJLIB_UTIL_STUN_TRANSACTION is used to manage outgoing STUN request, 42 for example to retransmit the request and to notify application about the 43 completion of the request. 44 45 The @ref PJLIB_UTIL_STUN_TRANSACTION does not use any networking operations, 46 but instead application must supply the transaction with a callback to 47 be used by the transaction to send outgoing requests. This way the STUN 48 transaction is made more generic and can work with different types of 49 networking codes in application. 50 51 40 52 */ 41 53 … … 50 62 typedef struct pj_stun_tsx_cb 51 63 { 64 /** 65 * This callback is called when the STUN transaction completed. 66 * 67 * @param tsx The STUN transaction. 68 * @param status Status of the transaction. Status PJ_SUCCESS 69 * means that the request has received a successful 70 * response. 71 * @param response The STUN response, which value may be NULL if 72 * \a status is not PJ_SUCCESS. 73 */ 52 74 void (*on_complete)(pj_stun_client_tsx *tsx, 53 75 pj_status_t status, 54 76 pj_stun_msg *response); 77 78 /** 79 * This callback is called by the STUN transaction when it wants to send 80 * outgoing message. 81 * 82 * @param tsx The STUN transaction instance. 83 * @param stun_pkt The STUN packet to be sent. 84 * @param pkt_size Size of the STUN packet. 85 * 86 * @return If return value of the callback is not PJ_SUCCESS, 87 * the transaction will fail. 88 */ 55 89 pj_status_t (*on_send_msg)(pj_stun_client_tsx *tsx, 56 90 const void *stun_pkt, … … 62 96 63 97 /** 64 * Create a STUN client transaction. 98 * Create an instance of STUN client transaction. The STUN client 99 * transaction is used to transmit outgoing STUN request and to 100 * ensure the reliability of the request by periodically retransmitting 101 * the request, if necessary. 102 * 103 * @param endpt The STUN endpoint, which will be used to retrieve 104 * various settings for the transaction. 105 * @param cb Callback structure, to be used by the transaction 106 * to send message and to notify the application about 107 * the completion of the transaction. 108 * @param p_tsx Pointer to receive the transaction instance. 109 * 110 * @return PJ_SUCCESS on success, or the appropriate error code. 65 111 */ 66 112 PJ_DECL(pj_status_t) pj_stun_client_tsx_create( pj_stun_endpoint *endpt, … … 69 115 70 116 /** 71 * . 117 * Destroy a STUN client transaction. 118 * 119 * @param tsx The STUN transaction. 120 * 121 * @return PJ_SUCCESS on success, or the appropriate error code. 72 122 */ 73 123 PJ_DECL(pj_status_t) pj_stun_client_tsx_destroy(pj_stun_client_tsx *tsx); … … 75 125 76 126 /** 77 * . 127 * Associate an arbitrary data with the STUN transaction. This data 128 * can be then retrieved later from the transaction, by using 129 * pj_stun_client_tsx_get_data() function. 130 * 131 * @param tsx The STUN client transaction. 132 * @param data Application data to be associated with the 133 * STUN transaction. 134 * 135 * @return PJ_SUCCESS on success. 78 136 */ 79 137 PJ_DECL(pj_status_t) pj_stun_client_tsx_set_data(pj_stun_client_tsx *tsx, … … 82 140 83 141 /** 84 * . 142 * Get the user data that was previously associated with the STUN 143 * transaction. 144 * 145 * @param tsx The STUN client transaction. 146 * 147 * @return The user data. 85 148 */ 86 149 PJ_DECL(void*) pj_stun_client_tsx_get_data(pj_stun_client_tsx *tsx); … … 88 151 89 152 /** 90 * . 153 * Start the STUN client transaction by sending STUN request using 154 * this transaction. If reliable transport such as TCP or TLS is used, 155 * the retransmit flag should be set to PJ_FALSE because reliablity 156 * will be assured by the transport layer. 157 * 158 * @param tsx The STUN client transaction. 159 * @param retransmit Should this message be retransmitted by the 160 * STUN transaction. 161 * @param msg The STUN message. 162 * 163 * @return PJ_SUCCESS on success or the appropriate error code. 91 164 */ 92 165 PJ_DECL(pj_status_t) pj_stun_client_tsx_send_msg(pj_stun_client_tsx *tsx, 166 pj_bool_t retransmit, 93 167 const pj_stun_msg *msg); 94 168 95 169 96 170 /** 97 * . 171 * Notify the STUN transaction about the arrival of STUN response. 172 * If the STUN response contains a final error (300 and greater), the 173 * transaction will be terminated and callback will be called. If the 174 * STUN response contains response code 100-299, retransmission 175 * will cease, but application must still call this function again 176 * with a final response later to allow the transaction to complete. 177 * 178 * @param tsx The STUN client transaction instance. 179 * @param packet The incoming packet. 180 * @param pkt_size Size of the incoming packet. 181 * @param parsed_len Optional pointer to receive the number of bytes 182 * that have been parsed from the incoming packet 183 * for the STUN message. This is useful if the 184 * STUN transaction is running over stream oriented 185 * socket such as TCP or TLS. 186 * 187 * @return PJ_SUCCESS on success or the appropriate error code. 98 188 */ 99 189 PJ_DECL(pj_status_t) pj_stun_client_tsx_on_rx_msg(pj_stun_client_tsx *tsx,
Note: See TracChangeset
for help on using the changeset viewer.