Changeset 1498
- Timestamp:
- Oct 13, 2007 12:06:59 AM (17 years ago)
- Location:
- pjproject/trunk/pjnath
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjnath/include/pjnath/stun_session.h
r1374 r1498 260 260 * @param msg_type The STUN request message type, from pj_stun_method_e or 261 261 * from pj_stun_msg_type. 262 * @param magic STUN magic, use PJ_STUN_MAGIC. 262 263 * @param tsx_id Optional transaction ID. 263 264 * @param p_tdata Pointer to receive STUN transmit data instance containing … … 268 269 PJ_DECL(pj_status_t) pj_stun_session_create_req(pj_stun_session *sess, 269 270 int msg_type, 271 pj_uint32_t magic, 270 272 const pj_uint8_t tsx_id[12], 271 273 pj_stun_tx_data **p_tdata); -
pjproject/trunk/pjnath/src/pjnath/ice_session.c
r1450 r1498 1377 1377 /* Create request */ 1378 1378 status = pj_stun_session_create_req(comp->stun_sess, 1379 PJ_STUN_BINDING_REQUEST, 1379 PJ_STUN_BINDING_REQUEST, PJ_STUN_MAGIC, 1380 1380 NULL, &check->tdata); 1381 1381 if (status != PJ_SUCCESS) { -
pjproject/trunk/pjnath/src/pjnath/ice_strans.c
r1450 r1498 578 578 status = pj_stun_session_create_req(comp->stun_sess, 579 579 PJ_STUN_BINDING_REQUEST, 580 PJ_STUN_MAGIC, 580 581 comp->ka_tsx_id, &tdata); 581 582 if (status != PJ_SUCCESS) … … 679 680 status = pj_stun_session_create_req(comp->stun_sess, 680 681 PJ_STUN_BINDING_REQUEST, 682 PJ_STUN_MAGIC, 681 683 comp->ka_tsx_id, 682 684 &tdata); -
pjproject/trunk/pjnath/src/pjnath/nat_detect.c
r1497 r1498 55 55 }; 56 56 57 static const char *test_names[] = 58 { 59 "Test I: Binding request", 60 "Test II: Binding request with change address and port request", 61 "Test IB: Binding request to alternate address", 62 "Test III: Binding request with change port request" 63 }; 64 57 65 typedef struct nat_detect_session 58 66 { … … 309 317 /* Create BIND request */ 310 318 status = pj_stun_session_create_req(sess->stun_sess, 311 PJ_STUN_BINDING_REQUEST, 319 PJ_STUN_BINDING_REQUEST, 0x83224, 312 320 NULL, &tdata); 313 321 if (status != PJ_SUCCESS) 314 322 return status; 315 323 316 /* Add CHANGE-REQUEST attribute if necessary */ 317 if (change_flag) { 318 status = pj_stun_msg_add_uint_attr(sess->pool, tdata->msg, 319 PJ_STUN_ATTR_CHANGE_REQUEST, 320 change_flag); 321 if (status != PJ_SUCCESS) 322 return status; 323 } 324 /* Add CHANGE-REQUEST attribute */ 325 status = pj_stun_msg_add_uint_attr(sess->pool, tdata->msg, 326 PJ_STUN_ATTR_CHANGE_REQUEST, 327 change_flag); 328 if (status != PJ_SUCCESS) 329 return status; 324 330 325 331 /* Configure alternate address */ … … 328 334 else 329 335 sess->cur_server = &sess->server; 336 337 PJ_LOG(5,(sess->pool->obj_name, 338 "Performing %s to %s:%d", 339 test_names[state], 340 pj_inet_ntoa(sess->cur_server->sin_addr), 341 pj_ntohs(sess->cur_server->sin_port))); 330 342 331 343 /* Send the request */ … … 562 574 563 575 /* Compare mapped address with local address */ 564 sess->test1_same_ip =(pj_memcmp(&sess->local_addr, &mattr->sockaddr,565 576 sess->test1_same_ip=(pj_memcmp(&sess->local_addr, &mattr->sockaddr, 577 sizeof(pj_sockaddr_in))==0); 566 578 567 579 /* Execute test 2: 568 * 569 * 580 * Send BINDING_REQUEST with both the "change IP" and "change port" 581 * flags from the CHANGE-REQUEST attribute set 570 582 */ 571 583 start_test(sess, ST_TEST_2, NULL, CHANGE_ADDR_PORT); … … 663 675 sess_destroy(sess); 664 676 } 677 -
pjproject/trunk/pjnath/src/pjnath/stun_session.c
r1479 r1498 127 127 static pj_status_t create_request_tdata(pj_stun_session *sess, 128 128 unsigned msg_type, 129 pj_uint32_t magic, 129 130 const pj_uint8_t tsx_id[12], 130 131 pj_stun_tx_data **p_tdata) … … 138 139 139 140 /* Create STUN message */ 140 status = pj_stun_msg_create(tdata->pool, msg_type, PJ_STUN_MAGIC,141 status = pj_stun_msg_create(tdata->pool, msg_type, magic, 141 142 tsx_id, &tdata->msg); 142 143 if (status != PJ_SUCCESS) { … … 477 478 PJ_DEF(pj_status_t) pj_stun_session_create_req(pj_stun_session *sess, 478 479 int method, 480 pj_uint32_t magic, 479 481 const pj_uint8_t tsx_id[12], 480 482 pj_stun_tx_data **p_tdata) … … 485 487 PJ_ASSERT_RETURN(sess && p_tdata, PJ_EINVAL); 486 488 487 status = create_request_tdata(sess, method, tsx_id, &tdata);489 status = create_request_tdata(sess, method, magic, tsx_id, &tdata); 488 490 if (status != PJ_SUCCESS) 489 491 return status; -
pjproject/trunk/pjnath/src/pjstun-client/client_main.c
r1495 r1498 376 376 377 377 rc = pj_stun_session_create_req(g.sess, PJ_STUN_BINDING_REQUEST, 378 NULL, &tdata);378 PJ_STUN_MAGIC, NULL, &tdata); 379 379 pj_assert(rc == PJ_SUCCESS); 380 380 … … 392 392 393 393 rc = pj_stun_session_create_req(g.sess, PJ_STUN_ALLOCATE_REQUEST, 394 NULL, &tdata);394 PJ_STUN_MAGIC, NULL, &tdata); 395 395 pj_assert(rc == PJ_SUCCESS); 396 396 … … 452 452 rc = pj_stun_session_create_req(g.sess, 453 453 PJ_STUN_SET_ACTIVE_DESTINATION_REQUEST, 454 NULL, &tdata);454 PJ_STUN_MAGIC, NULL, &tdata); 455 455 pj_assert(rc == PJ_SUCCESS); 456 456
Note: See TracChangeset
for help on using the changeset viewer.