Changeset 2710 for pjproject/branches/projects/sipit24
- Timestamp:
- May 18, 2009 11:18:38 AM (16 years ago)
- Location:
- pjproject/branches/projects/sipit24
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/projects/sipit24/pjnath/src/pjnath-test/ice_test.c
r2705 r2710 65 65 66 66 struct test_result expected;/* Expected result */ 67 68 pj_bool_t nom_regular; /* Use regular nomination? */ 67 69 }; 68 70 -
pjproject/branches/projects/sipit24/pjsip/include/pjsip/sip_config.h
r2394 r2710 228 228 229 229 /** 230 * RFC 3261 section 18.1.1: 231 * If a request is within 200 bytes of the path MTU, or if it is larger 232 * than 1300 bytes and the path MTU is unknown, the request MUST be sent 233 * using an RFC 2914 [43] congestion controlled transport protocol, such 234 * as TCP. 235 * 236 * This setting controls the threshold of the UDP packet, which if it's 237 * larger than this value the request will be sent with TCP. Default is 238 * 1300 bytes. 239 */ 240 #ifndef PJSIP_UDP_SIZE_THRESHOLD 241 # define PJSIP_UDP_SIZE_THRESHOLD 1300 242 #endif 243 244 /** 230 245 * Encode SIP headers in their short forms to reduce size. By default, 231 246 * SIP headers in outgoing messages will be encoded in their full names. -
pjproject/branches/projects/sipit24/pjsip/include/pjsip/sip_transport.h
r2394 r2710 579 579 */ 580 580 PJ_DECL(pj_status_t) pjsip_tx_data_dec_ref( pjsip_tx_data *tdata ); 581 582 /** 583 * Print the SIP message to transmit data buffer's internal buffer. This 584 * may allocate memory for the buffer, if the buffer has not been allocated 585 * yet, and encode the SIP message to that buffer. 586 * 587 * @param tdata The transmit buffer. 588 * 589 * @return PJ_SUCCESS on success of the appropriate error code. 590 */ 591 PJ_DECL(pj_status_t) pjsip_tx_data_encode(pjsip_tx_data *tdata); 581 592 582 593 /** -
pjproject/branches/projects/sipit24/pjsip/src/pjsip/sip_transaction.c
r2646 r2710 1726 1726 pjsip_tx_data_get_info(send_state->tdata), -sent, 1727 1727 pj_strerror(-sent, errmsg, sizeof(errmsg)).ptr)); 1728 1729 /* Reset retransmission count */ 1730 tsx->retransmit_count = 0; 1731 1732 /* And reset timeout timer */ 1733 if (tsx->timeout_timer.id) { 1734 pjsip_endpt_cancel_timer(tsx->endpt, &tsx->timeout_timer); 1735 tsx->timeout_timer.id = TIMER_INACTIVE; 1736 1737 tsx->timeout_timer.id = TIMER_ACTIVE; 1738 pjsip_endpt_schedule_timer( tsx->endpt, &tsx->timeout_timer, 1739 &timeout_timer_val); 1740 } 1728 1741 } 1729 1742 } -
pjproject/branches/projects/sipit24/pjsip/src/pjsip/sip_transport.c
r2394 r2710 435 435 } 436 436 437 /* 438 * Print the SIP message to transmit data buffer's internal buffer. 439 */ 440 PJ_DEF(pj_status_t) pjsip_tx_data_encode(pjsip_tx_data *tdata) 441 { 442 /* Allocate buffer if necessary. */ 443 if (tdata->buf.start == NULL) { 444 PJ_USE_EXCEPTION; 445 446 PJ_TRY { 447 tdata->buf.start = (char*) 448 pj_pool_alloc(tdata->pool, PJSIP_MAX_PKT_LEN); 449 } 450 PJ_CATCH_ANY { 451 return PJ_ENOMEM; 452 } 453 PJ_END 454 455 tdata->buf.cur = tdata->buf.start; 456 tdata->buf.end = tdata->buf.start + PJSIP_MAX_PKT_LEN; 457 } 458 459 /* Do we need to reprint? */ 460 if (!pjsip_tx_data_is_valid(tdata)) { 461 pj_ssize_t size; 462 463 size = pjsip_msg_print( tdata->msg, tdata->buf.start, 464 tdata->buf.end - tdata->buf.start); 465 if (size < 0) { 466 return PJSIP_EMSGTOOLONG; 467 } 468 pj_assert(size != 0); 469 tdata->buf.cur[size] = '\0'; 470 tdata->buf.cur += size; 471 } 472 473 return PJ_SUCCESS; 474 } 475 437 476 PJ_DEF(pj_bool_t) pjsip_tx_data_is_valid( pjsip_tx_data *tdata ) 438 477 { … … 568 607 static pj_status_t mod_on_tx_msg(pjsip_tx_data *tdata) 569 608 { 570 /* Allocate buffer if necessary. */ 571 if (tdata->buf.start == NULL) { 572 PJ_USE_EXCEPTION; 573 574 PJ_TRY { 575 tdata->buf.start = (char*) 576 pj_pool_alloc(tdata->pool, PJSIP_MAX_PKT_LEN); 577 } 578 PJ_CATCH_ANY { 579 return PJ_ENOMEM; 580 } 581 PJ_END 582 583 tdata->buf.cur = tdata->buf.start; 584 tdata->buf.end = tdata->buf.start + PJSIP_MAX_PKT_LEN; 585 } 586 587 /* Do we need to reprint? */ 588 if (!pjsip_tx_data_is_valid(tdata)) { 589 pj_ssize_t size; 590 591 size = pjsip_msg_print( tdata->msg, tdata->buf.start, 592 tdata->buf.end - tdata->buf.start); 593 if (size < 0) { 594 return PJSIP_EMSGTOOLONG; 595 } 596 pj_assert(size != 0); 597 tdata->buf.cur[size] = '\0'; 598 tdata->buf.cur += size; 599 } 600 601 return PJ_SUCCESS; 609 return pjsip_tx_data_encode(tdata); 602 610 } 603 611 -
pjproject/branches/projects/sipit24/pjsip/src/pjsip/sip_util.c
r2703 r2710 1136 1136 via->rport_param = 0; 1137 1137 1138 pjsip_tx_data_invalidate_msg(tdata); 1139 1138 1140 /* Send message using this transport. */ 1139 1141 status = pjsip_transport_send( stateless_data->cur_transport, … … 1192 1194 addr->entry[0].type == PJSIP_TRANSPORT_UDP) 1193 1195 { 1194 char buf[1500];1195 1196 int len; 1196 1197 1198 /* Encode the request */ 1199 status = pjsip_tx_data_encode(stateless_data->tdata); 1200 if (status != PJ_SUCCESS) { 1201 if (stateless_data->app_cb) { 1202 pj_bool_t cont = PJ_FALSE; 1203 (*stateless_data->app_cb)(stateless_data, -status, &cont); 1204 } 1205 pjsip_tx_data_dec_ref(stateless_data->tdata); 1206 return; 1207 } 1208 1197 1209 /* Check if request message is larger than 1300 bytes. */ 1198 len = pjsip_msg_print(stateless_data->tdata->msg, buf, 1300); 1199 if (len < 0) { 1210 len = stateless_data->tdata->buf.end - 1211 stateless_data->tdata->buf.start; 1212 if (len >= PJSIP_UDP_SIZE_THRESHOLD) { 1200 1213 int i; 1201 1214 int count = stateless_data->addr.count;
Note: See TracChangeset
for help on using the changeset viewer.