Commit 4acde249 authored by Ghislain MARY's avatar Ghislain MARY

Add configuration to enable/disable DNS SRV resolution.

parent deef6374
......@@ -52,6 +52,10 @@ BELLESIP_EXPORT int belle_sip_stack_get_dns_timeout(const belle_sip_stack_t *sta
BELLESIP_EXPORT void belle_sip_stack_set_dns_timeout(belle_sip_stack_t *stack, int timeout);
BELLESIP_EXPORT unsigned char belle_sip_stack_dns_srv_enabled(const belle_sip_stack_t *stack);
BELLESIP_EXPORT void belle_sip_stack_enable_dns_srv(belle_sip_stack_t *stack, unsigned char enable);
/**
* Can be used to simulate network transmission delays, for tests.
**/
......
......@@ -499,6 +499,7 @@ struct belle_sip_stack{
int resolver_send_error; /* used to simulate network error*/
int dscp;
char *dns_user_hosts_file; /* used to load additional hosts file for tests */
unsigned char dns_srv_enabled;
};
belle_sip_hop_t* belle_sip_hop_new(const char* transport, const char *cname, const char* host,int port);
......
......@@ -745,8 +745,10 @@ static void channel_res_done(void *data, const char *name, struct addrinfo *ai_l
void belle_sip_channel_resolve(belle_sip_channel_t *obj){
channel_set_state(obj,BELLE_SIP_CHANNEL_RES_IN_PROGRESS);
obj->resolver_ctx=belle_sip_stack_resolve(obj->stack, belle_sip_channel_get_transport_name_lower_case(obj), obj->peer_name, obj->peer_port, obj->lp->ai_family, channel_res_done, obj);
//obj->resolver_ctx=belle_sip_stack_resolve_a(obj->stack, obj->peer_name, obj->peer_port, obj->lp->ai_family, channel_res_done, obj);
if (belle_sip_stack_dns_srv_enabled(obj->stack))
obj->resolver_ctx=belle_sip_stack_resolve(obj->stack, belle_sip_channel_get_transport_name_lower_case(obj), obj->peer_name, obj->peer_port, obj->lp->ai_family, channel_res_done, obj);
else
obj->resolver_ctx=belle_sip_stack_resolve_a(obj->stack, obj->peer_name, obj->peer_port, obj->lp->ai_family, channel_res_done, obj);
if (obj->resolver_ctx){
belle_sip_object_ref(obj->resolver_ctx);
}
......
......@@ -91,6 +91,7 @@ belle_sip_stack_t * belle_sip_stack_new(const char *properties){
stack->timer_config.T4=5000;
stack->transport_timeout=30000;
stack->dns_timeout=15000;
stack->dns_srv_enabled=TRUE;
stack->inactive_transport_timeout=3600; /*one hour*/
return stack;
}
......@@ -111,6 +112,14 @@ void belle_sip_stack_set_dns_timeout(belle_sip_stack_t *stack, int timeout) {
stack->dns_timeout = timeout;
}
unsigned char belle_sip_stack_dns_srv_enabled(const belle_sip_stack_t *stack) {
return stack->dns_srv_enabled;
}
void belle_sip_stack_enable_dns_srv(belle_sip_stack_t *stack, unsigned char enable) {
stack->dns_srv_enabled = enable;
}
belle_sip_listening_point_t *belle_sip_stack_create_listening_point(belle_sip_stack_t *s, const char *ipaddress, int port, const char *transport){
belle_sip_listening_point_t *lp=NULL;
if (strcasecmp(transport,"UDP")==0) {
......
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