From 82eaf99776603b4f6e8eff8d1836f9184083255e Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Sun, 17 Nov 2013 22:29:59 +0100 Subject: [PATCH] adapt to new resolver api. --- coreapi/bellesip_sal/sal_impl.c | 10 ++++++---- coreapi/misc.c | 6 +++--- coreapi/private.h | 2 +- include/sal/sal.h | 6 ++++-- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/coreapi/bellesip_sal/sal_impl.c b/coreapi/bellesip_sal/sal_impl.c index b3a7cfc78..f1daaa1bd 100644 --- a/coreapi/bellesip_sal/sal_impl.c +++ b/coreapi/bellesip_sal/sal_impl.c @@ -839,13 +839,15 @@ void sal_enable_test_features(Sal*ctx, bool_t enabled){ ctx->enable_test_features=enabled; } -unsigned long sal_resolve_a(Sal* sal, const char *name, int port, int family, SalResolverCallback cb, void *data){ - return belle_sip_stack_resolve_a(sal->stack,name,port,family,(belle_sip_resolver_callback_t)cb,data); +SalResolverContext * sal_resolve_a(Sal* sal, const char *name, int port, int family, SalResolverCallback cb, void *data){ + return (SalResolverContext*)belle_sip_stack_resolve_a(sal->stack,name,port,family,(belle_sip_resolver_callback_t)cb,data); } -void sal_resolve_cancel(Sal *sal, unsigned long id){ - belle_sip_stack_resolve_cancel(sal->stack,id); +/* +void sal_resolve_cancel(Sal *sal, SalResolverContext* ctx){ + belle_sip_stack_resolve_cancel(sal->stack,ctx); } +*/ void sal_enable_unconditional_answer(Sal *sal,int value) { belle_sip_provider_enable_unconditional_answer(sal->prov,value); diff --git a/coreapi/misc.c b/coreapi/misc.c index 7d9b70b3f..c96fde835 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -633,7 +633,7 @@ static void stun_server_resolved(LinphoneCore *lc, const char *name, struct addr ms_warning("Stun server resolution failed."); } lc->net_conf.stun_addrinfo=addrinfo; - lc->net_conf.stun_res_id=0; + lc->net_conf.stun_res=NULL; } void linphone_core_resolve_stun_server(LinphoneCore *lc){ @@ -642,7 +642,7 @@ void linphone_core_resolve_stun_server(LinphoneCore *lc){ char host[NI_MAXHOST]; int port=3478; linphone_parse_host_port(server,host,sizeof(host),&port); - lc->net_conf.stun_res_id=sal_resolve_a(lc->sal,host,port,AF_UNSPEC,(SalResolverCallback)stun_server_resolved,lc); + lc->net_conf.stun_res=sal_resolve_a(lc->sal,host,port,AF_UNSPEC,(SalResolverCallback)stun_server_resolved,lc); } } @@ -663,7 +663,7 @@ const struct addrinfo *linphone_core_get_stun_server_addrinfo(LinphoneCore *lc){ int wait_ms=0; int wait_limit=1000; linphone_core_resolve_stun_server(lc); - while (!lc->net_conf.stun_addrinfo && lc->net_conf.stun_res_id!=0 && wait_msnet_conf.stun_addrinfo && lc->net_conf.stun_res!=NULL && wait_mssal); ms_usleep(50000); wait_ms+=50; diff --git a/coreapi/private.h b/coreapi/private.h index 20397cefc..69eead0f1 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -498,7 +498,7 @@ typedef struct net_config char *nat_address_ip; /* ip translated from nat_address */ char *stun_server; struct addrinfo *stun_addrinfo; - unsigned long stun_res_id; + SalResolverContext * stun_res; int download_bw; int upload_bw; int mtu; diff --git a/include/sal/sal.h b/include/sal/sal.h index dd6a8f5db..ad230c9ae 100644 --- a/include/sal/sal.h +++ b/include/sal/sal.h @@ -594,8 +594,10 @@ void sal_get_default_local_ip(Sal *sal, int address_family, char *ip, size_t ipl typedef void (*SalResolverCallback)(void *data, const char *name, struct addrinfo *ai_list); -unsigned long sal_resolve_a(Sal* sal, const char *name, int port, int family, SalResolverCallback cb, void *data); -void sal_resolve_cancel(Sal *sal, unsigned long id); +typedef struct SalResolverContext SalResolverContext; + +SalResolverContext * sal_resolve_a(Sal* sal, const char *name, int port, int family, SalResolverCallback cb, void *data); +//void sal_resolve_cancel(Sal *sal, SalResolverContext *ctx); SalCustomHeader *sal_custom_header_append(SalCustomHeader *ch, const char *name, const char *value); const char *sal_custom_header_find(const SalCustomHeader *ch, const char *name);