Commit 49d820f2 authored by Ghislain MARY's avatar Ghislain MARY

Reflect API changes done in bctoolbox.

parent 2d107266
......@@ -436,7 +436,7 @@ static void append_dns_result(belle_sip_simple_resolver_context_t *ctx, struct a
return;
}
if (ctx->flags & AI_V4MAPPED) family=AF_INET6;
*ai_list = ai_list_append(*ai_list, bctbx_ip_address_to_addrinfo(family, host, ctx->port));
*ai_list = ai_list_append(*ai_list, bctbx_ip_address_to_addrinfo(family, SOCK_STREAM, host, ctx->port));
belle_sip_message("%s resolved to %s", ctx->name, host);
}
......@@ -959,7 +959,7 @@ static void process_srv_results(void *data, const char *name, belle_sip_list_t *
* Perform combined SRV + A / AAAA resolution.
**/
belle_sip_resolver_context_t * belle_sip_stack_resolve(belle_sip_stack_t *stack, const char *transport, const char *name, int port, int family, belle_sip_resolver_callback_t cb, void *data) {
struct addrinfo *res = bctbx_ip_address_to_addrinfo(family, name, port);
struct addrinfo *res = bctbx_ip_address_to_addrinfo(family, SOCK_STREAM, name, port);
if (res == NULL) {
/* First perform asynchronous DNS SRV query */
belle_sip_combined_resolver_context_t *ctx = belle_sip_object_new(belle_sip_combined_resolver_context_t);
......@@ -1056,7 +1056,7 @@ static belle_sip_resolver_context_t * belle_sip_stack_resolve_dual(belle_sip_sta
}
belle_sip_resolver_context_t * belle_sip_stack_resolve_a(belle_sip_stack_t *stack, const char *name, int port, int family, belle_sip_resolver_callback_t cb , void *data) {
struct addrinfo *res = bctbx_ip_address_to_addrinfo(family, name, port);
struct addrinfo *res = bctbx_ip_address_to_addrinfo(family, SOCK_STREAM, name, port);
if (res == NULL) {
switch(family){
case AF_UNSPEC:
......@@ -1134,7 +1134,7 @@ void belle_sip_get_src_addr_for(const struct sockaddr *dest, socklen_t destlen,
return;
fail:
{
struct addrinfo *res = bctbx_ip_address_to_addrinfo(af_type, af_type == AF_INET ? "127.0.0.1" : "::1", local_port);
struct addrinfo *res = bctbx_ip_address_to_addrinfo(af_type, SOCK_STREAM, af_type == AF_INET ? "127.0.0.1" : "::1", local_port);
if (res != NULL) {
memcpy(src,res->ai_addr,MIN((size_t)*srclen,res->ai_addrlen));
*srclen=res->ai_addrlen;
......
......@@ -736,7 +736,7 @@ void belle_sip_channel_init(belle_sip_channel_t *obj, belle_sip_stack_t *stack,c
obj->simulated_recv_return=1;/*not set*/
if (peername){
/*check if we are given a real dns name or just an ip address*/
struct addrinfo *ai=bctbx_ip_address_to_addrinfo(AF_UNSPEC,peername,peer_port);
struct addrinfo *ai=bctbx_ip_address_to_addrinfo(AF_UNSPEC,SOCK_STREAM,peername,peer_port);
if (ai) bctbx_freeaddrinfo(ai);
else obj->has_name=TRUE;
}
......@@ -756,7 +756,7 @@ void belle_sip_channel_init_with_addr(belle_sip_channel_t *obj, belle_sip_stack_
ai.ai_addrlen=addrlen;
bctbx_addrinfo_to_ip_address(&ai,remoteip,sizeof(remoteip),&peer_port);
belle_sip_channel_init(obj,stack,bindip,localport,NULL,remoteip,peer_port);
obj->peer_list=obj->current_peer=bctbx_ip_address_to_addrinfo(ai.ai_family, obj->peer_name,obj->peer_port);
obj->peer_list=obj->current_peer=bctbx_ip_address_to_addrinfo(ai.ai_family, ai.ai_socktype, obj->peer_name,obj->peer_port);
obj->ai_family=ai.ai_family;
}
......
......@@ -123,7 +123,7 @@ static void ipv4_a_query(void) {
struct sockaddr_in *sock_in = (struct sockaddr_in *)client->ai_list->ai_addr;
int ntohsi = (int)ntohs(sock_in->sin_port);
BC_ASSERT_EQUAL(ntohsi, SIP_PORT, int, "%d");
ai = bctbx_ip_address_to_addrinfo(AF_INET, IPV4_SIP_IP, SIP_PORT);
ai = bctbx_ip_address_to_addrinfo(AF_INET, SOCK_STREAM, IPV4_SIP_IP, SIP_PORT);
if (ai) {
BC_ASSERT_EQUAL(sock_in->sin_addr.s_addr, ((struct sockaddr_in *)ai->ai_addr)->sin_addr.s_addr, int, "%d");
bctbx_freeaddrinfo(ai);
......@@ -150,7 +150,7 @@ static void ipv4_cname_a_query(void) {
struct sockaddr_in *sock_in = (struct sockaddr_in *)client->ai_list->ai_addr;
int ntohsi = (int)ntohs(sock_in->sin_port);
BC_ASSERT_EQUAL(ntohsi, SIP_PORT, int, "%d");
ai = bctbx_ip_address_to_addrinfo(AF_INET, IPV4_CNAME_IP, SIP_PORT);
ai = bctbx_ip_address_to_addrinfo(AF_INET, SOCK_STREAM, IPV4_CNAME_IP, SIP_PORT);
if (ai) {
BC_ASSERT_EQUAL(sock_in->sin_addr.s_addr, ((struct sockaddr_in *)ai->ai_addr)->sin_addr.s_addr, int, "%d");
bctbx_freeaddrinfo(ai);
......@@ -287,7 +287,7 @@ static void ipv6_aaaa_query(void) {
/*the IPv6 address shall return first, and must be a real ipv6 address*/
BC_ASSERT_EQUAL(client->ai_list->ai_family,AF_INET6,int,"%d");
BC_ASSERT_FALSE(IN6_IS_ADDR_V4MAPPED(&sock_in6->sin6_addr));
ai = bctbx_ip_address_to_addrinfo(AF_INET6, IPV6_SIP_IP, SIP_PORT);
ai = bctbx_ip_address_to_addrinfo(AF_INET6, SOCK_STREAM, IPV6_SIP_IP, SIP_PORT);
BC_ASSERT_PTR_NOT_NULL(ai);
if (ai) {
struct in6_addr *ipv6_address = &((struct sockaddr_in6 *)ai->ai_addr)->sin6_addr;
......@@ -305,7 +305,7 @@ static void ipv6_aaaa_query(void) {
BC_ASSERT_EQUAL(next->ai_family,AF_INET6,int,"%d");
BC_ASSERT_TRUE(IN6_IS_ADDR_V4MAPPED(&sock_in6->sin6_addr));
BC_ASSERT_EQUAL(ntohsi, SIP_PORT, int, "%d");
ai = bctbx_ip_address_to_addrinfo(AF_INET6, IPV6_SIP_IPV4, SIP_PORT);
ai = bctbx_ip_address_to_addrinfo(AF_INET6, SOCK_STREAM, IPV6_SIP_IPV4, SIP_PORT);
BC_ASSERT_PTR_NOT_NULL(ai);
if (ai) {
struct in6_addr *ipv6_address = &((struct sockaddr_in6 *)ai->ai_addr)->sin6_addr;
......@@ -371,7 +371,7 @@ static void srv_a_query_no_srv_result(void) {
struct sockaddr_in *sock_in = (struct sockaddr_in *)client->ai_list->ai_addr;
int ntohsi = (int)ntohs(sock_in->sin_port);
BC_ASSERT_EQUAL(ntohsi, SIP_PORT, int, "%d");
ai = bctbx_ip_address_to_addrinfo(AF_INET, IPV4_CNAME_IP, SIP_PORT);
ai = bctbx_ip_address_to_addrinfo(AF_INET, SOCK_STREAM, IPV4_CNAME_IP, SIP_PORT);
if (ai) {
BC_ASSERT_EQUAL(sock_in->sin_addr.s_addr, ((struct sockaddr_in *)ai->ai_addr)->sin_addr.s_addr, int, "%d");
bctbx_freeaddrinfo(ai);
......@@ -413,7 +413,7 @@ static void no_query_needed(void) {
struct sockaddr_in *sock_in = (struct sockaddr_in *)client->ai_list->ai_addr;
int ntohsi = (int)ntohs(sock_in->sin_port);
BC_ASSERT_EQUAL(ntohsi, SIP_PORT, int, "%d");
ai = bctbx_ip_address_to_addrinfo(AF_INET, IPV4_SIP_IP, SIP_PORT);
ai = bctbx_ip_address_to_addrinfo(AF_INET, SOCK_STREAM, IPV4_SIP_IP, SIP_PORT);
if (ai) {
BC_ASSERT_EQUAL(sock_in->sin_addr.s_addr, ((struct sockaddr_in *)ai->ai_addr)->sin_addr.s_addr, int, "%d");
bctbx_freeaddrinfo(ai);
......@@ -461,7 +461,7 @@ static void dns_fallback(void) {
struct sockaddr_in *sock_in = (struct sockaddr_in *)client->ai_list->ai_addr;
int ntohsi = (int)ntohs(sock_in->sin_port);
BC_ASSERT_EQUAL(ntohsi, SIP_PORT, int, "%d");
ai = bctbx_ip_address_to_addrinfo(AF_INET, IPV4_SIP_IP, SIP_PORT);
ai = bctbx_ip_address_to_addrinfo(AF_INET, SOCK_STREAM, IPV4_SIP_IP, SIP_PORT);
if (ai) {
BC_ASSERT_EQUAL(sock_in->sin_addr.s_addr, ((struct sockaddr_in *)ai->ai_addr)->sin_addr.s_addr, int, "%d");
bctbx_freeaddrinfo(ai);
......@@ -497,7 +497,7 @@ static void ipv6_dns_server(void) {
struct sockaddr_in *sock_in = (struct sockaddr_in *)client->ai_list->ai_addr;
int ntohsi = (int)ntohs(sock_in->sin_port);
BC_ASSERT_EQUAL(ntohsi, SIP_PORT, int, "%d");
ai = bctbx_ip_address_to_addrinfo(AF_INET, IPV4_SIP_IP, SIP_PORT);
ai = bctbx_ip_address_to_addrinfo(AF_INET, SOCK_STREAM, IPV4_SIP_IP, SIP_PORT);
if (ai) {
BC_ASSERT_EQUAL(sock_in->sin_addr.s_addr, ((struct sockaddr_in *)ai->ai_addr)->sin_addr.s_addr, int, "%d");
bctbx_freeaddrinfo(ai);
......@@ -533,7 +533,7 @@ static void ipv4_and_ipv6_dns_server(void) {
struct sockaddr_in *sock_in = (struct sockaddr_in *)client->ai_list->ai_addr;
int ntohsi = (int)ntohs(sock_in->sin_port);
BC_ASSERT_EQUAL(ntohsi, SIP_PORT, int, "%d");
ai = bctbx_ip_address_to_addrinfo(AF_INET, IPV4_SIP_IP, SIP_PORT);
ai = bctbx_ip_address_to_addrinfo(AF_INET, SOCK_STREAM, IPV4_SIP_IP, SIP_PORT);
if (ai) {
BC_ASSERT_EQUAL(sock_in->sin_addr.s_addr, ((struct sockaddr_in *)ai->ai_addr)->sin_addr.s_addr, int, "%d");
bctbx_freeaddrinfo(ai);
......
......@@ -37,7 +37,7 @@ static belle_sip_object_pool_t *pool;
static int leaked_objects_count;
static int _belle_sip_tester_ipv6_available(void){
struct addrinfo *ai=bctbx_ip_address_to_addrinfo(AF_INET6,"2a01:e00::2",53);
struct addrinfo *ai=bctbx_ip_address_to_addrinfo(AF_INET6,SOCK_STREAM,"2a01:e00::2",53);
if (ai){
struct sockaddr_storage ss;
struct addrinfo src;
......
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