- Timestamp:
- Mar 23, 2009 1:17:30 PM (16 years ago)
- Location:
- pjproject/branches/1.0
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/1.0
- Property svn:mergeinfo changed
/pjproject/trunk merged: 2519
- Property svn:mergeinfo changed
-
pjproject/branches/1.0/pjsip/src/pjsip/sip_transport_udp.c
r2394 r2539 495 495 496 496 } else { 497 /* If bound address specifies "INADDR_ANY" (IPv6), get the 498 * IP address of local hostname 499 */ 500 pj_uint32_t loop6[4] = { 0, 0, 0, 0}; 501 497 502 bound_name->port = pj_ntohs(tmp_addr.ipv6.sin6_port); 503 504 if (pj_memcmp(&tmp_addr.ipv6.sin6_addr, loop6, sizeof(loop6))==0) { 505 status = pj_gethostip(tmp_addr.addr.sa_family, &tmp_addr); 506 if (status != PJ_SUCCESS) 507 return status; 508 } 509 498 510 status = pj_inet_ntop(tmp_addr.addr.sa_family, 499 511 pj_sockaddr_get_addr(&tmp_addr), 500 512 hostbuf, hostbufsz); 513 if (status == PJ_SUCCESS) { 514 bound_name->host.slen = pj_ansi_strlen(hostbuf); 515 } 501 516 } 502 517 … … 510 525 { 511 526 enum { INFO_LEN = 80 }; 512 char local_addr[PJ_INET6_ADDRSTRLEN ];527 char local_addr[PJ_INET6_ADDRSTRLEN+10]; 513 528 514 529 pj_assert(a_name->host.slen != 0); … … 522 537 } 523 538 524 pj_inet_ntop(tp->base.local_addr.addr.sa_family, 525 pj_sockaddr_get_addr(&tp->base.local_addr), 526 local_addr, sizeof(local_addr)); 539 pj_sockaddr_print(&tp->base.local_addr, local_addr, sizeof(local_addr), 3); 527 540 528 541 pj_ansi_snprintf( 529 tp->base.info, INFO_LEN, "udp %s :%d[published as %s:%d]",542 tp->base.info, INFO_LEN, "udp %s [published as %s:%d]", 530 543 local_addr, 531 pj_sockaddr_get_port(&tp->base.local_addr),532 544 tp->base.local_name.host.ptr, 533 545 tp->base.local_name.port); … … 640 652 pj_pool_t *pool; 641 653 struct udp_transport *tp; 642 const char *format ;654 const char *format, *ipv6_quoteb, *ipv6_quotee; 643 655 unsigned i; 644 656 pj_status_t status; … … 648 660 649 661 /* Object name. */ 650 if (type & PJSIP_TRANSPORT_IPV6) 662 if (type & PJSIP_TRANSPORT_IPV6) { 651 663 format = "udpv6%p"; 652 else 664 ipv6_quoteb = "["; 665 ipv6_quotee = "]"; 666 } else { 653 667 format = "udp%p"; 668 ipv6_quoteb = ipv6_quotee = ""; 669 } 654 670 655 671 /* Create pool. */ … … 768 784 if (p_transport) 769 785 *p_transport = &tp->base; 770 786 771 787 PJ_LOG(4,(tp->base.obj_name, 772 "SIP %s started, published address is % .*s:%d",788 "SIP %s started, published address is %s%.*s%s:%d", 773 789 pjsip_transport_get_type_desc((pjsip_transport_type_e)tp->base.key.type), 790 ipv6_quoteb, 774 791 (int)tp->base.local_name.host.slen, 775 792 tp->base.local_name.host.ptr, 793 ipv6_quotee, 776 794 tp->base.local_name.port)); 777 795 … … 860 878 pj_sock_t sock; 861 879 pj_status_t status; 862 char addr_buf[PJ_INET _ADDRSTRLEN];880 char addr_buf[PJ_INET6_ADDRSTRLEN]; 863 881 pjsip_host_port bound_name; 864 882 … … 884 902 } 885 903 886 return pjsip_udp_transport_attach ( endpt, sock, a_name, async_cnt,887 p_transport);904 return pjsip_udp_transport_attach2(endpt, PJSIP_TRANSPORT_UDP6, 905 sock, a_name, async_cnt, p_transport); 888 906 } 889 907 … … 982 1000 983 1001 if (option & PJSIP_UDP_TRANSPORT_DESTROY_SOCKET) { 984 char addr_buf[PJ_INET _ADDRSTRLEN];1002 char addr_buf[PJ_INET6_ADDRSTRLEN]; 985 1003 pjsip_host_port bound_name; 986 1004
Note: See TracChangeset
for help on using the changeset viewer.