Changeset 993 for pjproject/trunk
- Timestamp:
- Feb 22, 2007 2:09:23 AM (18 years ago)
- Location:
- pjproject/trunk/pjlib-util
- Files:
-
- 6 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib-util/build/pjlib_util.dsp
r992 r993 138 138 # Begin Source File 139 139 140 SOURCE="..\src\pjlib-util\stun_msg_dump.c" 141 # End Source File 142 # Begin Source File 143 140 144 SOURCE="..\src\pjlib-util\stun_server.c" 141 145 # End Source File -
pjproject/trunk/pjlib-util/build/pjlib_util.dsw
r992 r993 58 58 ############################################################################### 59 59 60 Project: "pjstun_client"=".\pjstun_client.dsp" - Package Owner=<4> 61 62 Package=<5> 63 {{{ 64 }}} 65 66 Package=<4> 67 {{{ 68 Begin Project Dependency 69 Project_Dep_Name pjlib 70 End Project Dependency 71 Begin Project Dependency 72 Project_Dep_Name pjlib_util 73 End Project Dependency 74 }}} 75 76 ############################################################################### 77 60 78 Project: "pjstun_srv"=".\pjstun_srv.dsp" - Package Owner=<4> 61 79 -
pjproject/trunk/pjlib-util/include/pjlib-util/stun_msg.h
r992 r993 1191 1191 1192 1192 /** 1193 * Dump STUN message to a printable string output. 1194 * 1195 * @param msg The STUN message 1196 * @param buffer Buffer where the printable string output will 1197 * be printed on. 1198 * @param length On input, specify the maximum length of the buffer. 1199 * On output, it will be filled up with the actual 1200 * length of the output string. 1201 * 1202 * @return The message string output. 1203 */ 1204 PJ_DECL(char*) pj_stun_msg_dump(const pj_stun_msg *msg, 1205 char *buffer, 1206 unsigned *length); 1207 1208 1209 /** 1193 1210 * Find STUN attribute in the STUN message, starting from the specified 1194 1211 * index. 1195 1212 * 1196 1213 * @param msg The STUN message. 1197 * @param attr_type The attribute type to be found .1214 * @param attr_type The attribute type to be found, from pj_stun_attr_type. 1198 1215 * @param start_index The start index of the attribute in the message. 1199 1216 * Specify zero to start searching from the first … … 1213 1230 * 1214 1231 * @param pool The pool to allocate memory from. 1215 * @param attr_type Attribute type .1232 * @param attr_type Attribute type, from #pj_stun_attr_type. 1216 1233 * @param xor_ed If non-zero, the port and address will be XOR-ed 1217 1234 * with magic, to make the XOR-MAPPED-ADDRESS attribute. … … 1235 1252 * 1236 1253 * @param pool The pool to allocate memory from. 1254 * @param attr_type Attribute type, from #pj_stun_attr_type. 1237 1255 * @param value The string value to be assigned to the attribute. 1238 1256 * @param p_attr Pointer to receive the attribute. … … 1316 1334 * 1317 1335 * @param pool The pool to allocate memory from. 1318 * @param attr_type The attribute type .1336 * @param attr_type The attribute type, from #pj_stun_attr_type. 1319 1337 * @param p_attr Pointer to receive the attribute. 1320 1338 * -
pjproject/trunk/pjlib-util/include/pjlib-util/stun_transaction.h
r992 r993 74 74 void (*on_complete)(pj_stun_client_tsx *tsx, 75 75 pj_status_t status, 76 pj_stun_msg *response);76 const pj_stun_msg *response); 77 77 78 78 /** … … 125 125 126 126 /** 127 * Check if transaction has completed. 128 * 129 * @param tsx The STUN transaction. 130 * 131 * @return Non-zero if transaction has completed. 132 */ 133 PJ_DECL(pj_bool_t) pj_stun_client_tsx_is_complete(pj_stun_client_tsx *tsx); 134 135 136 /** 127 137 * Associate an arbitrary data with the STUN transaction. This data 128 138 * can be then retrieved later from the transaction, by using … … 187 197 * @return PJ_SUCCESS on success or the appropriate error code. 188 198 */ 189 PJ_DECL(pj_status_t) pj_stun_client_tsx_on_rx_ msg(pj_stun_client_tsx *tsx,199 PJ_DECL(pj_status_t) pj_stun_client_tsx_on_rx_pkt(pj_stun_client_tsx *tsx, 190 200 const void *packet, 191 201 pj_size_t pkt_size, … … 193 203 194 204 205 /** 206 * Notify the STUN transaction about the arrival of STUN response. 207 * If the STUN response contains a final error (300 and greater), the 208 * transaction will be terminated and callback will be called. If the 209 * STUN response contains response code 100-299, retransmission 210 * will cease, but application must still call this function again 211 * with a final response later to allow the transaction to complete. 212 * 213 * @param tsx The STUN client transaction instance. 214 * @param packet The incoming packet. 215 * @param pkt_size Size of the incoming packet. 216 * @param parsed_len Optional pointer to receive the number of bytes 217 * that have been parsed from the incoming packet 218 * for the STUN message. This is useful if the 219 * STUN transaction is running over stream oriented 220 * socket such as TCP or TLS. 221 * 222 * @return PJ_SUCCESS on success or the appropriate error code. 223 */ 224 PJ_DECL(pj_status_t) pj_stun_client_tsx_on_rx_msg(pj_stun_client_tsx *tsx, 225 const pj_stun_msg *msg); 226 195 227 196 228 /** -
pjproject/trunk/pjlib-util/src/pjlib-util/stun_transaction.c
r992 r993 253 253 254 254 255 255 256 /* 256 257 * Notify the STUN transaction about the arrival of STUN response. 257 258 */ 258 259 PJ_DEF(pj_status_t) pj_stun_client_tsx_on_rx_msg(pj_stun_client_tsx *tsx, 259 const void *packet, 260 pj_size_t pkt_size, 261 unsigned *parsed_len) 262 { 263 pj_stun_msg *msg; 260 const pj_stun_msg *msg) 261 { 264 262 pj_stun_error_code_attr *err_attr; 265 263 pj_status_t status; 266 267 PJ_ASSERT_RETURN(tsx && packet && pkt_size, PJ_EINVAL);268 269 /* Try to parse the message */270 status = pj_stun_msg_decode(tsx->pool, (const pj_uint8_t*)packet,271 pkt_size, 0, &msg, parsed_len,272 NULL, NULL, NULL);273 if (status != PJ_SUCCESS) {274 stun_perror(tsx, "STUN msg_decode() error", status);275 return status;276 }277 264 278 265 /* Must be STUN response message */ … … 330 317 331 318 return PJ_SUCCESS; 332 } 333 319 320 } 321 322 323 /* 324 * Notify the STUN transaction about the arrival of STUN response. 325 */ 326 PJ_DEF(pj_status_t) pj_stun_client_tsx_on_rx_pkt(pj_stun_client_tsx *tsx, 327 const void *packet, 328 pj_size_t pkt_size, 329 unsigned *parsed_len) 330 { 331 pj_stun_msg *msg; 332 pj_status_t status; 333 334 PJ_ASSERT_RETURN(tsx && packet && pkt_size, PJ_EINVAL); 335 336 /* Try to parse the message */ 337 status = pj_stun_msg_decode(tsx->pool, (const pj_uint8_t*)packet, 338 pkt_size, 0, &msg, parsed_len, 339 NULL, NULL, NULL); 340 if (status != PJ_SUCCESS) { 341 stun_perror(tsx, "STUN msg_decode() error", status); 342 return status; 343 } 344 345 return pj_stun_client_tsx_on_rx_msg(tsx, msg); 346 } 347
Note: See TracChangeset
for help on using the changeset viewer.