summaryrefslogtreecommitdiff
path: root/pjsip-apps/src/samples/proxy.h
diff options
context:
space:
mode:
authorLiong Sauw Ming <ming@teluu.com>2016-05-20 04:17:00 +0000
committerLiong Sauw Ming <ming@teluu.com>2016-05-20 04:17:00 +0000
commit58d6c60c881d265cee8c5ca5dbaad545ff44e995 (patch)
treeb2bb5a9c72e01491d8dd6bce70d3a4c6c1ab4750 /pjsip-apps/src/samples/proxy.h
parent2e1173b56db0083559b4bc09e00d27d03dbad8bc (diff)
Re #1922: Replace IPv4 specific APIs as per Apple's recommendations
https://developer.apple.com/library/ios/documentation/NetworkingInternetWeb/Conceptual/NetworkingOverview/UnderstandingandPreparingfortheIPv6Transition/UnderstandingandPreparingfortheIPv6Transition.html#//apple_ref/doc/uid/TP40010220-CH213-SW27 git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@5311 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip-apps/src/samples/proxy.h')
-rw-r--r--pjsip-apps/src/samples/proxy.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/pjsip-apps/src/samples/proxy.h b/pjsip-apps/src/samples/proxy.h
index 93be0a8e..cf963175 100644
--- a/pjsip-apps/src/samples/proxy.h
+++ b/pjsip-apps/src/samples/proxy.h
@@ -252,21 +252,27 @@ static pj_status_t init_proxy(void)
* to be added in Record-Route.
*/
if (pj_gethostip(pj_AF_INET(), &pri_addr)==PJ_SUCCESS) {
- pj_strdup2(global.pool, &global.name[global.name_cnt].host,
- pj_inet_ntoa(pri_addr.ipv4.sin_addr));
+ char addr[PJ_INET_ADDRSTRLEN];
+ pj_inet_ntop(pj_AF_INET(), &pri_addr.ipv4.sin_addr, addr,
+ sizeof(addr));
+ pj_strdup2(global.pool, &global.name[global.name_cnt].host, addr);
global.name[global.name_cnt].port = global.port;
global.name_cnt++;
}
/* Get the rest of IP interfaces */
- if (pj_enum_ip_interface(pj_AF_INET(), &addr_cnt, addr_list) == PJ_SUCCESS) {
+ if (pj_enum_ip_interface(pj_AF_INET(), &addr_cnt, addr_list) == PJ_SUCCESS)
+ {
for (i=0; i<addr_cnt; ++i) {
-
+ char addr[PJ_INET_ADDRSTRLEN];
+
if (addr_list[i].ipv4.sin_addr.s_addr == pri_addr.ipv4.sin_addr.s_addr)
continue;
+ pj_inet_ntop(pj_AF_INET(), &addr_list[i].ipv4.sin_addr, addr,
+ sizeof(addr));
pj_strdup2(global.pool, &global.name[global.name_cnt].host,
- pj_inet_ntoa(addr_list[i].ipv4.sin_addr));
+ addr);
global.name[global.name_cnt].port = global.port;
global.name_cnt++;
}