Commit 24ec0406 authored by Ghislain MARY's avatar Ghislain MARY

Use our own implementation of getnameinfo().

parent 8d49d185
......@@ -261,7 +261,7 @@ static struct dns_resolv_conf *resconf(belle_sip_simple_resolver_context_t *ctx)
for(i=0;i<sizeof(ctx->resconf->nameserver)/sizeof(ctx->resconf->nameserver[0]);++i){
struct sockaddr *ns_addr=(struct sockaddr*)&ctx->resconf->nameserver[i];
if (ns_addr->sa_family==AF_UNSPEC) break;
getnameinfo(ns_addr,ns_addr->sa_family==AF_INET6 ? sizeof(struct sockaddr_in6) : sizeof(struct sockaddr)
bctbx_getnameinfo(ns_addr,ns_addr->sa_family==AF_INET6 ? sizeof(struct sockaddr_in6) : sizeof(struct sockaddr)
,ip,sizeof(ip),serv,sizeof(serv),NI_NUMERICHOST|NI_NUMERICSERV);
belle_sip_message("\t%s",ip);
if (ns_addr->sa_family==AF_INET6) using_ipv6=TRUE;
......@@ -459,7 +459,7 @@ static void append_dns_result(belle_sip_simple_resolver_context_t *ctx, struct a
int gai_err;
int family=ctx->family;
if ((gai_err=getnameinfo(addr, addrlen, host, sizeof(host), NULL, 0, NI_NUMERICHOST)) != 0){
if ((gai_err=bctbx_getnameinfo(addr, addrlen, host, sizeof(host), NULL, 0, NI_NUMERICHOST)) != 0){
belle_sip_error("append_dns_result(): getnameinfo() failed: %s",gai_strerror(gai_err));
return;
}
......
......@@ -172,7 +172,7 @@ static void fix_incoming_via(belle_sip_request_t *msg, const struct addrinfo* or
return;
}
bctbx_sockaddr_remove_v4_mapping(origin->ai_addr, (struct sockaddr*)&saddr, &slen);
err=getnameinfo((struct sockaddr*)&saddr,slen,received,sizeof(received),
err=bctbx_getnameinfo((struct sockaddr*)&saddr,slen,received,sizeof(received),
rport,sizeof(rport),NI_NUMERICHOST|NI_NUMERICSERV);
if (err!=0){
belle_sip_error("fix_via: getnameinfo() failed: %s",gai_strerror(errno));
......@@ -1396,7 +1396,7 @@ void belle_sip_channel_set_ready(belle_sip_channel_t *obj, const struct sockaddr
bctbx_sockaddr_remove_v4_mapping(addr,(struct sockaddr*) &saddr,&slen2);
err=getnameinfo((struct sockaddr*)&saddr,slen2,name,sizeof(name),serv,sizeof(serv),NI_NUMERICHOST|NI_NUMERICSERV);
err=bctbx_getnameinfo((struct sockaddr*)&saddr,slen2,name,sizeof(name),serv,sizeof(serv),NI_NUMERICHOST|NI_NUMERICSERV);
if (err!=0){
belle_sip_error("belle_sip_channel_set_ready(): getnameinfo() failed: %s",gai_strerror(err));
}else{
......
......@@ -110,7 +110,7 @@ static belle_sip_socket_t create_server_socket(const char *addr, int * port, int
socklen_t saddr_len=sizeof(saddr);
err=getsockname(sock,(struct sockaddr*)&saddr,&saddr_len);
if (err==0){
err=getnameinfo((struct sockaddr*)&saddr,saddr_len,NULL,0,portnum,sizeof(portnum),NI_NUMERICSERV|NI_NUMERICHOST);
err=bctbx_getnameinfo((struct sockaddr*)&saddr,saddr_len,NULL,0,portnum,sizeof(portnum),NI_NUMERICSERV|NI_NUMERICHOST);
if (err==0){
*port=atoi(portnum);
belle_sip_message("Random TCP port is %i",*port);
......
......@@ -109,7 +109,7 @@ static belle_sip_socket_t create_udp_socket(const char *addr, int *port, int *fa
socklen_t saddr_len=sizeof(saddr);
err=getsockname(sock,(struct sockaddr*)&saddr,&saddr_len);
if (err==0){
err=getnameinfo((struct sockaddr*)&saddr,saddr_len,NULL,0,portnum,sizeof(portnum),NI_NUMERICSERV|NI_NUMERICHOST);
err=bctbx_getnameinfo((struct sockaddr*)&saddr,saddr_len,NULL,0,portnum,sizeof(portnum),NI_NUMERICSERV|NI_NUMERICHOST);
if (err==0){
*port=atoi(portnum);
belle_sip_message("Random UDP port is %i",*port);
......
......@@ -35,7 +35,7 @@ static void resolver_callback(void *data, const char *queried_name, struct addri
char port[NI_MAXSERV];
for(ai_it=ai_list;ai_it!=NULL;ai_it=ai_it->ai_next){
err=getnameinfo(ai_it->ai_addr,ai_list->ai_addrlen,name,sizeof(name),port,sizeof(port),NI_NUMERICSERV|NI_NUMERICHOST);
err=bctbx_getnameinfo(ai_it->ai_addr,ai_list->ai_addrlen,name,sizeof(name),port,sizeof(port),NI_NUMERICSERV|NI_NUMERICHOST);
if (err!=0){
fprintf(stderr,"getnameinfo error: %s",gai_strerror(err));
}else{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment