- Timestamp:
- Jul 23, 2018 7:15:08 AM (6 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/include/pj/sock.h
r5719 r5833 1488 1488 #endif 1489 1489 1490 /***************************************************************************** 1491 * 1492 * Utilities. 1493 * 1494 ***************************************************************************** 1495 */ 1496 1497 /** 1498 * Print socket address string. This method will enclose the address string 1499 * with square bracket if it's IPv6 address. 1500 * 1501 * @param host_str The host address string. 1502 * @param port The port address. 1503 * @param buf Text buffer. 1504 * @param size Size of buffer. 1505 * @param flags Bitmask combination of these value: 1506 * - 1: port number is included. 1507 * 1508 * @return The address string. 1509 */ 1510 PJ_DECL(char *) pj_addr_str_print( const pj_str_t *host_str, int port, 1511 char *buf, int size, unsigned flag); 1512 1513 1490 1514 /** 1491 1515 * @} -
pjproject/trunk/pjlib/src/pj/sock_common.c
r5644 r5833 846 846 847 847 TRACE_((THIS_FILE, "hostname IP is %s", 848 pj_sockaddr_print(&ai.ai_addr, strip, sizeof(strip), 0)));848 pj_sockaddr_print(&ai.ai_addr, strip, sizeof(strip), 3))); 849 849 } 850 850 } … … 858 858 if (status == PJ_SUCCESS) { 859 859 TRACE_((THIS_FILE, "default IP is %s", 860 pj_sockaddr_print(addr, strip, sizeof(strip), 0)));860 pj_sockaddr_print(addr, strip, sizeof(strip), 3))); 861 861 862 862 pj_sockaddr_set_port(addr, 0); … … 970 970 for (i=0; i<cand_cnt; ++i) { 971 971 TRACE_((THIS_FILE, "Checking candidate IP %s, weight=%d", 972 pj_sockaddr_print(&cand_addr[i], strip, sizeof(strip), 0),972 pj_sockaddr_print(&cand_addr[i], strip, sizeof(strip), 3), 973 973 cand_weight[i])); 974 974 … … 995 995 } 996 996 TRACE_((THIS_FILE, "Loopback IP %s returned", 997 pj_sockaddr_print(addr, strip, sizeof(strip), 0)));997 pj_sockaddr_print(addr, strip, sizeof(strip), 3))); 998 998 } else { 999 999 pj_sockaddr_copy_addr(addr, &cand_addr[selected_cand]); 1000 1000 TRACE_((THIS_FILE, "Candidate %s selected", 1001 pj_sockaddr_print(addr, strip, sizeof(strip), 0)));1001 pj_sockaddr_print(addr, strip, sizeof(strip), 3))); 1002 1002 } 1003 1003 … … 1190 1190 1191 1191 1192 PJ_DEF(char *) pj_addr_str_print( const pj_str_t *host_str, int port, 1193 char *buf, int size, unsigned flag) 1194 { 1195 enum { 1196 WITH_PORT = 1 1197 }; 1198 char *bquote, *equote; 1199 int af = pj_AF_UNSPEC(); 1200 pj_in6_addr dummy6; 1201 1202 /* Check if this is an IPv6 address */ 1203 if (pj_inet_pton(pj_AF_INET6(), host_str, &dummy6) == PJ_SUCCESS) 1204 af = pj_AF_INET6(); 1205 1206 if (af == pj_AF_INET6()) { 1207 bquote = "["; 1208 equote = "]"; 1209 } else { 1210 bquote = ""; 1211 equote = ""; 1212 } 1213 1214 if (flag & WITH_PORT) { 1215 pj_ansi_snprintf(buf, size, "%s%.*s%s:%d", 1216 bquote, (int)host_str->slen, host_str->ptr, equote, 1217 port); 1218 } else { 1219 pj_ansi_snprintf(buf, size, "%s%.*s%s", 1220 bquote, (int)host_str->slen, host_str->ptr, equote); 1221 } 1222 return buf; 1223 } 1224 1225 1192 1226 /* Only need to implement these in DLL build */ 1193 1227 #if defined(PJ_DLL) -
pjproject/trunk/pjnath/src/pjnath/ice_session.c
r5813 r5833 763 763 764 764 pj_ansi_strcpy(ice->tmp.txt, pj_sockaddr_print(&lcand->addr, address, 765 sizeof(address), 0));765 sizeof(address), 2)); 766 766 LOG4((ice->obj_name, 767 767 "Candidate %d added: comp_id=%d, type=%s, foundation=%.*s, " … … 774 774 ice->tmp.txt, 775 775 pj_sockaddr_get_port(&lcand->addr), 776 pj_sockaddr_print(&lcand->base_addr, address, sizeof(address), 0),776 pj_sockaddr_print(&lcand->base_addr, address, sizeof(address), 2), 777 777 pj_sockaddr_get_port(&lcand->base_addr), 778 778 lcand->prio, lcand->prio)); … … 922 922 check->lcand->comp_id, 923 923 pj_sockaddr_print(&lcand->addr, laddr, 924 sizeof(laddr), 0),924 sizeof(laddr), 2), 925 925 pj_sockaddr_get_port(&lcand->addr), 926 926 pj_sockaddr_print(&rcand->addr, raddr, 927 sizeof(raddr), 0),927 sizeof(raddr), 2), 928 928 pj_sockaddr_get_port(&rcand->addr)); 929 929 … … 1074 1074 "Base candidate %s:%d not found for srflx candidate %d", 1075 1075 pj_sockaddr_print(&srflx->base_addr, baddr, 1076 sizeof(baddr), 0),1076 sizeof(baddr), 2), 1077 1077 pj_sockaddr_get_port(&srflx->base_addr), 1078 1078 GET_LCAND_ID(clist->checks[i].lcand))); … … 2757 2757 LOG4((ice->obj_name, 2758 2758 "Added new remote candidate from the request: %s:%d", 2759 pj_sockaddr_print(&rcand->addr, raddr, sizeof(raddr), 0),2759 pj_sockaddr_print(&rcand->addr, raddr, sizeof(raddr), 2), 2760 2760 pj_sockaddr_get_port(&rcand->addr))); 2761 2761 -
pjproject/trunk/pjnath/src/pjnath/ice_strans.c
r5655 r5833 1675 1675 "Component %d TX packet to %s:%d with transport %d", 1676 1676 comp_id, 1677 pj_sockaddr_print(dst_addr, daddr, sizeof(addr), 0),1677 pj_sockaddr_print(dst_addr, daddr, sizeof(addr), 2), 1678 1678 pj_sockaddr_get_port(dst_addr), 1679 1679 tp_typ)); -
pjproject/trunk/pjnath/src/pjnath/nat_detect.c
r5636 r5833 303 303 304 304 PJ_LOG(5,(sess->pool->obj_name, "Local address is %s:%d", 305 pj_sockaddr_print(&sess->local_addr, addr, sizeof(addr), 0),305 pj_sockaddr_print(&sess->local_addr, addr, sizeof(addr), 2), 306 306 pj_sockaddr_get_port(&sess->local_addr))); 307 307 308 308 PJ_LOG(5,(sess->pool->obj_name, "Server set to %s:%d", 309 pj_sockaddr_print(server, addr, sizeof(addr), 0),309 pj_sockaddr_print(server, addr, sizeof(addr), 2), 310 310 pj_sockaddr_get_port(server))); 311 311 … … 871 871 "Performing %s to %s:%d", 872 872 test_names[test_id], 873 pj_sockaddr_print(sess->cur_server, addr, sizeof(addr), 0),873 pj_sockaddr_print(sess->cur_server, addr, sizeof(addr), 2), 874 874 pj_sockaddr_get_port(sess->cur_server))); 875 875 -
pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c
r5822 r5833 873 873 char host_port[128]; 874 874 875 pj_ansi_snprintf(host_port, sizeof(host_port), "[%.*s:%d]", 876 (int)tp->remote_name.host.slen, 877 tp->remote_name.host.ptr, 878 tp->remote_name.port); 879 875 pj_addr_str_print(&tp->remote_name.host, 876 tp->remote_name.port, host_port, sizeof(host_port), 1); 880 877 switch (state) { 881 878 case PJSIP_TP_STATE_CONNECTED: -
pjproject/trunk/pjsip/src/pjsip/sip_transport_tcp.c
r5649 r5833 329 329 enum { INFO_LEN = 100 }; 330 330 char local_addr[PJ_INET6_ADDRSTRLEN + 10]; 331 char pub_addr[PJ_INET6_ADDRSTRLEN + 10]; 331 332 pj_sockaddr *listener_addr = &listener->factory.local_addr; 332 333 … … 337 338 } 338 339 pj_sockaddr_print(listener_addr, local_addr, sizeof(local_addr), 3); 340 pj_addr_str_print(&listener->factory.addr_name.host, 341 listener->factory.addr_name.port, pub_addr, 342 sizeof(pub_addr), 1); 339 343 pj_ansi_snprintf( 340 listener->factory.info, INFO_LEN, "tcp %s [published as %.*s:%d]", 341 local_addr, 342 (int)listener->factory.addr_name.host.slen, 343 listener->factory.addr_name.host.ptr, 344 listener->factory.addr_name.port); 345 346 if (listener->asock) { 344 listener->factory.info, INFO_LEN, "tcp %s [published as %s]", 345 local_addr, pub_addr); 346 347 if (listener->asock) { 348 char addr[PJ_INET6_ADDRSTRLEN+10]; 349 347 350 PJ_LOG(4, (listener->factory.obj_name, 348 "SIP TCP listener ready for incoming connections at %.*s:%d",349 (int)listener->factory.addr_name.host.slen,350 listener->factory.addr_name.host.ptr,351 listener->factory.addr_name.port));351 "SIP TCP listener ready for incoming connections at %s", 352 pj_addr_str_print(&listener->factory.addr_name.host, 353 listener->factory.addr_name.port, addr, 354 sizeof(addr), 1))); 352 355 } else { 353 356 PJ_LOG(4, (listener->factory.obj_name, "SIP TCP is ready " … … 1030 1033 1031 1034 if (tcp->has_pending_connect) { 1035 char local_addr_buf[PJ_INET6_ADDRSTRLEN+10]; 1036 char remote_addr_buf[PJ_INET6_ADDRSTRLEN+10]; 1037 1032 1038 /* Update (again) local address, just in case local address currently 1033 1039 * set is different now that asynchronous connect() is started. … … 1051 1057 1052 1058 PJ_LOG(4,(tcp->base.obj_name, 1053 "TCP transport % .*s:%d is connecting to %.*s:%d...",1054 (int)tcp->base.local_name.host.slen,1055 tcp->base.local_name.host.ptr,1056 tcp->base.local_name.port,1057 (int)tcp->base.remote_name.host.slen,1058 tcp->base.remote_name.host.ptr,1059 tcp->base.remote_name.port));1059 "TCP transport %s is connecting to %s...", 1060 pj_addr_str_print(&tcp->base.local_name.host, 1061 tcp->base.local_name.port, 1062 local_addr_buf, sizeof(local_addr_buf), 1), 1063 pj_addr_str_print(&tcp->base.remote_name.host, 1064 tcp->base.remote_name.port, 1065 remote_addr_buf, sizeof(remote_addr_buf), 1))); 1060 1066 } 1061 1067 … … 1083 1089 int addr_len; 1084 1090 pj_status_t status; 1091 char addr_buf[PJ_INET6_ADDRSTRLEN+10]; 1085 1092 1086 1093 PJ_UNUSED_ARG(src_addr_len); … … 1094 1101 1095 1102 PJ_LOG(4,(listener->factory.obj_name, 1096 "TCP listener % .*s:%d: got incoming TCP connection "1103 "TCP listener %s: got incoming TCP connection " 1097 1104 "from %s, sock=%d", 1098 (int)listener->factory.addr_name.host.slen,1099 listener->factory.addr_name.host.ptr,1100 listener->factory.addr_name.port,1105 pj_addr_str_print(&listener->factory.addr_name.host, 1106 listener->factory.addr_name.port, addr_buf, 1107 sizeof(addr_buf), 1), 1101 1108 pj_sockaddr_print(src_addr, addr, sizeof(addr), 3), 1102 1109 sock)); … … 1423 1430 int addrlen; 1424 1431 pjsip_tp_state_callback state_cb; 1432 char local_addr_buf[PJ_INET6_ADDRSTRLEN+10]; 1433 char remote_addr_buf[PJ_INET6_ADDRSTRLEN+10]; 1425 1434 1426 1435 tcp = (struct tcp_transport*) pj_activesock_get_user_data(asock); … … 1463 1472 1464 1473 PJ_LOG(4,(tcp->base.obj_name, 1465 "TCP transport % .*s:%d is connected to %.*s:%d",1466 (int)tcp->base.local_name.host.slen,1467 tcp->base.local_name.host.ptr,1468 tcp->base.local_name.port,1469 (int)tcp->base.remote_name.host.slen,1470 tcp->base.remote_name.host.ptr,1471 tcp->base.remote_name.port));1474 "TCP transport %s is connected to %s", 1475 pj_addr_str_print(&tcp->base.local_name.host, 1476 tcp->base.local_name.port, local_addr_buf, 1477 sizeof(local_addr_buf), 1), 1478 pj_addr_str_print(&tcp->base.remote_name.host, 1479 tcp->base.remote_name.port, remote_addr_buf, 1480 sizeof(remote_addr_buf), 1))); 1472 1481 1473 1482 … … 1529 1538 pj_ssize_t size; 1530 1539 pj_status_t status; 1540 char addr[PJ_INET6_ADDRSTRLEN+10]; 1531 1541 1532 1542 PJ_UNUSED_ARG(th); … … 1548 1558 } 1549 1559 1550 PJ_LOG(5,(tcp->base.obj_name, "Sending %d byte(s) keep-alive to %.*s:%d", 1551 (int)tcp->ka_pkt.slen, (int)tcp->base.remote_name.host.slen, 1552 tcp->base.remote_name.host.ptr, 1553 tcp->base.remote_name.port)); 1560 PJ_LOG(5,(tcp->base.obj_name, "Sending %d byte(s) keep-alive to %s", 1561 (int)tcp->ka_pkt.slen, 1562 pj_addr_str_print(&tcp->base.remote_name.host, 1563 tcp->base.remote_name.port, addr, 1564 sizeof(addr), 1))); 1554 1565 1555 1566 /* Send the data */ -
pjproject/trunk/pjsip/src/pjsip/sip_transport_tls.c
r5821 r5833 413 413 enum { INFO_LEN = 100 }; 414 414 char local_addr[PJ_INET6_ADDRSTRLEN + 10]; 415 char pub_addr[PJ_INET6_ADDRSTRLEN + 10]; 415 416 pj_sockaddr *listener_addr = &listener->factory.local_addr; 416 417 … … 420 421 } 421 422 pj_sockaddr_print(listener_addr, local_addr, sizeof(local_addr), 3); 423 pj_addr_str_print(&listener->factory.addr_name.host, 424 listener->factory.addr_name.port, pub_addr, 425 sizeof(pub_addr), 1); 422 426 pj_ansi_snprintf( 423 listener->factory.info, INFO_LEN, "tls %s [published as %.*s:%d]", 424 local_addr, 425 (int)listener->factory.addr_name.host.slen, 426 listener->factory.addr_name.host.ptr, 427 listener->factory.addr_name.port); 427 listener->factory.info, INFO_LEN, "tls %s [published as %s]", 428 local_addr, pub_addr); 428 429 429 430 if (listener->ssock) { 431 char addr[PJ_INET6_ADDRSTRLEN+10]; 432 430 433 PJ_LOG(4, (listener->factory.obj_name, 431 "SIP TLS listener is ready for incoming connections " 432 "at %.*s:%d", 433 (int)listener->factory.addr_name.host.slen, 434 listener->factory.addr_name.host.ptr, 435 listener->factory.addr_name.port)); 434 "SIP TLS listener is ready for incoming connections at %s", 435 pj_addr_str_print(&listener->factory.addr_name.host, 436 listener->factory.addr_name.port, addr, 437 sizeof(addr), 1))); 436 438 } else { 437 439 PJ_LOG(4, (listener->factory.obj_name, "SIP TLS is ready " … … 1252 1254 if (tls->has_pending_connect) { 1253 1255 pj_ssl_sock_info info; 1256 char local_addr_buf[PJ_INET6_ADDRSTRLEN+10]; 1257 char remote_addr_buf[PJ_INET6_ADDRSTRLEN+10]; 1254 1258 1255 1259 /* Update local address, just in case local address currently set is … … 1281 1285 1282 1286 PJ_LOG(4,(tls->base.obj_name, 1283 "TLS transport % .*s:%d is connecting to %.*s:%d...",1284 (int)tls->base.local_name.host.slen,1285 tls->base.local_name.host.ptr,1286 tls->base.local_name.port,1287 (int)tls->base.remote_name.host.slen,1288 tls->base.remote_name.host.ptr,1289 tls->base.remote_name.port));1287 "TLS transport %s is connecting to %s...", 1288 pj_addr_str_print(&tls->base.local_name.host, 1289 tls->base.local_name.port, 1290 local_addr_buf, sizeof(local_addr_buf), 1), 1291 pj_addr_str_print(&tls->base.remote_name.host, 1292 tls->base.remote_name.port, 1293 remote_addr_buf, sizeof(remote_addr_buf), 1))); 1290 1294 } 1291 1295 … … 1314 1318 pj_bool_t is_shutdown; 1315 1319 pj_status_t status; 1320 char addr_buf[PJ_INET6_ADDRSTRLEN+10]; 1316 1321 1317 1322 PJ_UNUSED_ARG(src_addr_len); … … 1325 1330 1326 1331 PJ_LOG(4,(listener->factory.obj_name, 1327 "TLS listener % .*s:%d: got incoming TLS connection "1332 "TLS listener %s: got incoming TLS connection " 1328 1333 "from %s, sock=%d", 1329 (int)listener->factory.addr_name.host.slen,1330 listener->factory.addr_name.host.ptr,1331 listener->factory.addr_name.port,1334 pj_addr_str_print(&listener->factory.addr_name.host, 1335 listener->factory.addr_name.port, addr_buf, 1336 sizeof(addr_buf), 1), 1332 1337 pj_sockaddr_print(src_addr, addr, sizeof(addr), 3), 1333 1338 new_ssock)); … … 1696 1701 pjsip_tp_state_callback state_cb; 1697 1702 pj_bool_t is_shutdown; 1703 char local_addr_buf[PJ_INET6_ADDRSTRLEN+10]; 1704 char remote_addr_buf[PJ_INET6_ADDRSTRLEN+10]; 1698 1705 1699 1706 tls = (struct tls_transport*) pj_ssl_sock_get_user_data(ssock); … … 1881 1888 PJ_LOG(4,(tls->base.obj_name, 1882 1889 "TLS transport %.*s:%d is connected to %.*s:%d", 1883 (int)tls->base.local_name.host.slen,1884 tls->base.local_name.host.ptr,1885 tls->base.local_name.port,1886 (int)tls->base.remote_name.host.slen,1887 tls->base.remote_name.host.ptr,1888 tls->base.remote_name.port));1890 pj_addr_str_print(&tls->base.local_name.host, 1891 tls->base.local_name.port, local_addr_buf, 1892 sizeof(local_addr_buf), 1), 1893 pj_addr_str_print(&tls->base.remote_name.host, 1894 tls->base.remote_name.port, remote_addr_buf, 1895 sizeof(remote_addr_buf), 1))); 1889 1896 1890 1897 /* Start pending read */ … … 1923 1930 pj_ssize_t size; 1924 1931 pj_status_t status; 1932 char addr[PJ_INET6_ADDRSTRLEN+10]; 1925 1933 1926 1934 PJ_UNUSED_ARG(th); … … 1942 1950 } 1943 1951 1944 PJ_LOG(5,(tls->base.obj_name, "Sending %d byte(s) keep-alive to %.*s:%d", 1945 (int)tls->ka_pkt.slen, (int)tls->base.remote_name.host.slen, 1946 tls->base.remote_name.host.ptr, 1947 tls->base.remote_name.port)); 1952 PJ_LOG(5,(tls->base.obj_name, "Sending %d byte(s) keep-alive to %s", 1953 (int)tls->ka_pkt.slen, 1954 pj_addr_str_print(&tls->base.remote_name.host, 1955 tls->base.remote_name.port, addr, 1956 sizeof(addr), 1))); 1948 1957 1949 1958 /* Send the data */ -
pjproject/trunk/pjsip/src/pjsip/sip_transport_udp.c
r5737 r5833 601 601 enum { INFO_LEN = 80 }; 602 602 char local_addr[PJ_INET6_ADDRSTRLEN+10]; 603 char pub_addr[PJ_INET6_ADDRSTRLEN+10]; 603 604 604 605 pj_assert(a_name->host.slen != 0); … … 620 621 621 622 pj_sockaddr_print(&tp->base.local_addr, local_addr, sizeof(local_addr), 3); 622 623 pj_ansi_snprintf(624 tp->base.info, INFO_LEN, "udp %s [published as %s:%d]",625 local_addr, 626 tp->base.local_name.host.ptr,627 tp->base.local_name.port);623 pj_addr_str_print(&tp->base.local_name.host, 624 tp->base.local_name.port, 625 pub_addr, sizeof(pub_addr), 1), 626 627 pj_ansi_snprintf( tp->base.info, INFO_LEN, "udp %s [published as %s]", 628 local_addr, pub_addr); 628 629 } 629 630 … … 1147 1148 struct udp_transport *tp; 1148 1149 pj_status_t status; 1150 char addr[PJ_INET6_ADDRSTRLEN+10]; 1149 1151 1150 1152 PJ_ASSERT_RETURN(transport != NULL, PJ_EINVAL); … … 1242 1244 tp->is_paused = PJ_FALSE; 1243 1245 1244 PJ_LOG(4, (tp->base.obj_name,1245 "SIP UDP transport restarted, published address is %.*s:%d",1246 (int)tp->base.local_name.host.slen,1247 tp->base.local_name.host.ptr,1248 tp->base.local_name.port));1246 PJ_LOG(4, (tp->base.obj_name, 1247 "SIP UDP transport restarted, published address is %s", 1248 pj_addr_str_print(&tp->base.local_name.host, 1249 tp->base.local_name.port, 1250 addr, sizeof(addr), 1))); 1249 1251 1250 1252 return PJ_SUCCESS; -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c
r5822 r5833 534 534 pjsua_acc_config cfg; 535 535 pjsua_transport_data *t = &pjsua_var.tpdata[tid]; 536 const char *beginquote, *endquote;537 536 char transport_param[32]; 538 537 char uri[PJSIP_MAX_URL_SIZE]; 538 char addr_buf[PJ_INET6_ADDRSTRLEN+10]; 539 539 pjsua_acc_id acc_id; 540 540 pj_status_t status; … … 551 551 /* Lower the priority of local account */ 552 552 --cfg.priority; 553 554 /* Enclose IPv6 address in square brackets */555 if (get_ip_addr_ver(&t->local_name.host) == 6) {556 beginquote = "[";557 endquote = "]";558 } else {559 beginquote = endquote = "";560 }561 553 562 554 /* Don't add transport parameter if it's UDP */ … … 570 562 571 563 /* Build URI for the account */ 572 pj_ansi_snprintf(uri, PJSIP_MAX_URL_SIZE, 573 "<sip:%s%.*s%s:%d%s>", 574 beginquote, 575 (int)t->local_name.host.slen, 576 t->local_name.host.ptr, 577 endquote, 578 t->local_name.port, 564 pj_ansi_snprintf(uri, PJSIP_MAX_URL_SIZE, 565 "<sip:%s%s>", 566 pj_addr_str_print(&t->local_name.host, t->local_name.port, 567 addr_buf, sizeof(addr_buf), 1), 579 568 transport_param); 580 569 … … 1611 1600 pj_str_t srv_ip; 1612 1601 pjsip_contact_hdr *contact_hdr; 1602 char host_addr_buf[PJ_INET6_ADDRSTRLEN+10]; 1603 char via_addr_buf[PJ_INET6_ADDRSTRLEN+10]; 1613 1604 const pj_str_t STR_CONTACT = { "Contact", 7 }; 1614 1605 … … 1777 1768 return PJ_FALSE; 1778 1769 } 1779 1770 pj_addr_str_print(&uri->host, uri->port, host_addr_buf, 1771 sizeof(host_addr_buf), 1); 1772 pj_addr_str_print(via_addr, rport, via_addr_buf, 1773 sizeof(via_addr_buf), 1); 1780 1774 PJ_LOG(3,(THIS_FILE, "IP address change detected for account %d " 1781 "(% .*s:%d --> %.*s:%d). Updating registration "1775 "(%s --> %s). Updating registration " 1782 1776 "(using method %d)", 1783 acc->index, 1784 (int)uri->host.slen, 1785 uri->host.ptr, 1786 uri->port, 1787 (int)via_addr->slen, 1788 via_addr->ptr, 1789 rport, 1790 contact_rewrite_method)); 1777 acc->index, host_addr_buf, via_addr_buf)); 1791 1778 1792 1779 pj_assert(contact_rewrite_method == PJSUA_CONTACT_REWRITE_UNREGISTER || … … 1817 1804 secure = pjsip_transport_get_flag_from_type(tp->key.type) & 1818 1805 PJSIP_TRANSPORT_SECURE; 1819 1820 1821 1822 1823 1824 1825 1826 1806 1807 /* Enclose IPv6 address in square brackets */ 1808 if (tp->key.type & PJSIP_TRANSPORT_IPV6) { 1809 beginquote = "["; 1810 endquote = "]"; 1811 } else { 1812 beginquote = endquote = ""; 1813 } 1827 1814 1828 1815 /* Don't add transport parameter if it's UDP */ … … 2134 2121 &delay); 2135 2122 if (status == PJ_SUCCESS) { 2123 char addr[PJ_INET6_ADDRSTRLEN+10]; 2124 pj_str_t input_str = pj_str(param->rdata->pkt_info.src_name); 2136 2125 acc->ka_timer.id = PJ_TRUE; 2126 2127 pj_addr_str_print(&input_str, param->rdata->pkt_info.src_port, 2128 addr, sizeof(addr), 1); 2137 2129 PJ_LOG(4,(THIS_FILE, "Keep-alive timer started for acc %d, " 2138 2130 "destination:%s:%d, interval:%ds", 2139 acc->index, 2140 param->rdata->pkt_info.src_name, 2141 param->rdata->pkt_info.src_port, 2142 acc->cfg.ka_interval)); 2131 acc->index, addr, acc->cfg.ka_interval)); 2143 2132 } else { 2144 2133 acc->ka_timer.id = PJ_FALSE; -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c
r5830 r5833 388 388 static pj_bool_t logging_on_rx_msg(pjsip_rx_data *rdata) 389 389 { 390 PJ_LOG(4,(THIS_FILE, "RX %d bytes %s from %s %s:%d:\n" 390 char addr[PJ_INET6_ADDRSTRLEN+10]; 391 pj_str_t input_str = pj_str(rdata->pkt_info.src_name); 392 393 PJ_LOG(4,(THIS_FILE, "RX %d bytes %s from %s %s:\n" 391 394 "%.*s\n" 392 395 "--end msg--", 393 396 rdata->msg_info.len, 394 397 pjsip_rx_data_get_info(rdata), 395 rdata->tp_info.transport->type_name, 396 rdata->pkt_info.src_name, 397 rdata->pkt_info.src_port, 398 rdata->tp_info.transport->type_name, 399 pj_addr_str_print(&input_str, 400 rdata->pkt_info.src_port, 401 addr, 402 sizeof(addr), 403 1), 398 404 (int)rdata->msg_info.len, 399 405 rdata->msg_info.msg_buf)); … … 406 412 static pj_status_t logging_on_tx_msg(pjsip_tx_data *tdata) 407 413 { 414 char addr[PJ_INET6_ADDRSTRLEN+10]; 415 pj_str_t input_str = pj_str(tdata->tp_info.dst_name); 408 416 409 417 /* Important note: … … 412 420 * has lower priority than transport layer. 413 421 */ 414 415 PJ_LOG(4,(THIS_FILE, "TX %d bytes %s to %s %s:%d:\n" 422 PJ_LOG(4,(THIS_FILE, "TX %d bytes %s to %s %s:\n" 416 423 "%.*s\n" 417 424 "--end msg--", … … 419 426 pjsip_tx_data_get_info(tdata), 420 427 tdata->tp_info.transport->type_name, 421 tdata->tp_info.dst_name, 422 tdata->tp_info.dst_port, 428 pj_addr_str_print(&input_str, 429 tdata->tp_info.dst_port, 430 addr, 431 sizeof(addr), 432 1), 423 433 (int)(tdata->buf.cur - tdata->buf.start), 424 434 tdata->buf.start)); 435 425 436 426 437 /* Always return success, otherwise message will not get sent! */
Note: See TracChangeset
for help on using the changeset viewer.