Changeset 1411
- Timestamp:
- Aug 1, 2007 11:38:14 AM (17 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/samples/proxy.h
r1405 r1411 236 236 static pj_status_t init_proxy(void) 237 237 { 238 pj_in_addr addr; 238 pj_in_addr pri_addr; 239 pj_in_addr addr_list[16]; 240 unsigned addr_cnt = PJ_ARRAY_SIZE(addr_list); 239 241 unsigned i; 240 242 … … 249 251 * to be added in Record-Route. 250 252 */ 251 if (pj_gethostip(& addr) ==PJ_SUCCESS) {253 if (pj_gethostip(&pri_addr)==PJ_SUCCESS) { 252 254 pj_strdup2(global.pool, &global.name[global.name_cnt].host, 253 pj_inet_ntoa( addr));255 pj_inet_ntoa(pri_addr)); 254 256 global.name[global.name_cnt].port = global.port; 255 257 global.name_cnt++; 256 258 } 257 259 260 /* Get the rest of IP interfaces */ 261 if (pj_enum_ip_interface(&addr_cnt, addr_list) == PJ_SUCCESS) { 262 for (i=0; i<addr_cnt; ++i) { 263 264 if (addr_list[i].s_addr == pri_addr.s_addr) 265 continue; 266 267 pj_strdup2(global.pool, &global.name[global.name_cnt].host, 268 pj_inet_ntoa(addr_list[i])); 269 global.name[global.name_cnt].port = global.port; 270 global.name_cnt++; 271 } 272 } 273 274 /* No need to add this, this should have been added above. 258 275 global.name[global.name_cnt].host = pj_str("127.0.0.1"); 259 276 global.name[global.name_cnt].port = global.port; 260 277 global.name_cnt++; 278 */ 261 279 262 280 global.name[global.name_cnt].host = *pj_gethostname(); -
pjproject/trunk/pjsip/src/pjsip/sip_util_proxy.c
r1241 r1411 24 24 #include <pj/ctype.h> 25 25 #include <pj/except.h> 26 #include <pj/guid.h> 26 27 #include <pj/pool.h> 27 28 #include <pj/string.h> … … 43 44 * @return PJ_SUCCESS on success. 44 45 */ 46 /* 45 47 PJ_DEF(pj_status_t) pjsip_endpt_clone_msg( pjsip_endpoint *endpt, 46 48 const pjsip_rx_data *rdata, … … 62 64 return PJ_SUCCESS; 63 65 } 66 */ 64 67 65 68 … … 336 339 pj_uint8_t digest[16]; 337 340 pj_str_t branch; 341 pj_str_t rfc3261_branch = {PJSIP_RFC3261_BRANCH_ID, 342 PJSIP_RFC3261_BRANCH_LEN}; 343 344 /* If incoming request does not have RFC 3261 branch value, create 345 * a branch value from GUID . 346 */ 347 if (pj_strncmp(&rdata->msg_info.via->branch_param, 348 &rfc3261_branch, PJSIP_RFC3261_BRANCH_LEN) != 0 ) 349 { 350 pj_str_t tmp; 351 352 branch.ptr = (char*) 353 pj_pool_alloc(rdata->tp_info.pool, PJSIP_MAX_BRANCH_LEN); 354 branch.slen = PJSIP_RFC3261_BRANCH_LEN; 355 pj_memcpy(branch.ptr, PJSIP_RFC3261_BRANCH_ID, 356 PJSIP_RFC3261_BRANCH_LEN); 357 358 tmp.ptr = branch.ptr + PJSIP_RFC3261_BRANCH_LEN + 2; 359 *(tmp.ptr-2) = (pj_int8_t)(branch.slen+73); 360 *(tmp.ptr-1) = (pj_int8_t)(branch.slen+99); 361 pj_generate_unique_string( &tmp ); 362 363 branch.slen = PJSIP_MAX_BRANCH_LEN; 364 return branch; 365 } 338 366 339 367 /* Create branch ID for new request by calculating MD5 hash … … 347 375 branch.ptr = (char*) 348 376 pj_pool_alloc(rdata->tp_info.pool, 349 3 2+ PJSIP_RFC3261_BRANCH_LEN);377 34 + PJSIP_RFC3261_BRANCH_LEN); 350 378 pj_memcpy(branch.ptr, PJSIP_RFC3261_BRANCH_ID, PJSIP_RFC3261_BRANCH_LEN); 351 352 digest2str(digest, branch.ptr+PJSIP_RFC3261_BRANCH_LEN); 353 354 branch.slen = 32 + PJSIP_RFC3261_BRANCH_LEN; 379 branch.slen = PJSIP_RFC3261_BRANCH_LEN; 380 *(branch.ptr+PJSIP_RFC3261_BRANCH_LEN) = (pj_int8_t)(branch.slen+73); 381 *(branch.ptr+PJSIP_RFC3261_BRANCH_LEN+1) = (pj_int8_t)(branch.slen+99); 382 digest2str(digest, branch.ptr+PJSIP_RFC3261_BRANCH_LEN+2); 383 branch.slen = 34 + PJSIP_RFC3261_BRANCH_LEN; 355 384 356 385 return branch;
Note: See TracChangeset
for help on using the changeset viewer.