Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
BC
public
belle-sip
Commits
245bdae5
Commit
245bdae5
authored
Jul 13, 2016
by
Ghislain MARY
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add stack parameter to enable/disable DNS search.
parent
30415ca8
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
28 additions
and
2 deletions
+28
-2
include/belle-sip/sipstack.h
include/belle-sip/sipstack.h
+4
-0
src/belle_sip_internal.h
src/belle_sip_internal.h
+1
-1
src/belle_sip_resolver.c
src/belle_sip_resolver.c
+2
-0
src/dns.c
src/dns.c
+10
-1
src/dns.h
src/dns.h
+2
-0
src/sipstack.c
src/sipstack.c
+9
-0
No files found.
include/belle-sip/sipstack.h
View file @
245bdae5
...
...
@@ -61,6 +61,10 @@ BELLESIP_EXPORT unsigned char belle_sip_stack_dns_srv_enabled(const belle_sip_st
BELLESIP_EXPORT
void
belle_sip_stack_enable_dns_srv
(
belle_sip_stack_t
*
stack
,
unsigned
char
enable
);
BELLESIP_EXPORT
unsigned
char
belle_sip_stack_dns_search_enabled
(
const
belle_sip_stack_t
*
stack
);
BELLESIP_EXPORT
void
belle_sip_stack_enable_dns_search
(
belle_sip_stack_t
*
stack
,
unsigned
char
enable
);
/**
* Override system's DNS servers used for DNS resolving by app-supplied list of dns servers.
* @param stack the stack
...
...
src/belle_sip_internal.h
View file @
245bdae5
...
...
@@ -525,7 +525,7 @@ struct belle_sip_stack{
char
*
http_proxy_passwd
;
/*for future use*/
unsigned
char
dns_srv_enabled
;
unsigned
char
dns_search_enabled
;
};
belle_sip_hop_t
*
belle_sip_hop_new
(
const
char
*
transport
,
const
char
*
cname
,
const
char
*
host
,
int
port
);
...
...
src/belle_sip_resolver.c
View file @
245bdae5
...
...
@@ -447,6 +447,7 @@ static int resolver_process_data(belle_sip_simple_resolver_context_t *ctx, unsig
int
error
;
unsigned
char
simulated_timeout
=
0
;
int
timeout
=
belle_sip_stack_get_dns_timeout
(
ctx
->
base
.
stack
);
unsigned
char
search_enabled
=
belle_sip_stack_dns_search_enabled
(
ctx
->
base
.
stack
);
/*Setting timeout to 0 can be used to simulate DNS timeout*/
if
((
revents
!=
0
)
&&
timeout
==
0
){
...
...
@@ -459,6 +460,7 @@ static int resolver_process_data(belle_sip_simple_resolver_context_t *ctx, unsig
notify_results
(
ctx
);
return
BELLE_SIP_STOP
;
}
dns_res_enable_search
(
ctx
->
R
,
search_enabled
);
/*belle_sip_message("resolver_process_data(): revents=%i",revents);*/
error
=
dns_res_check
(
ctx
->
R
);
if
(
!
error
)
{
...
...
src/dns.c
View file @
245bdae5
...
...
@@ -7047,6 +7047,8 @@ struct dns_resolver {
struct
dns_rr_i
hints_i
,
hints_j
;
struct
dns_rr
hints_ns
,
ans_cname
;
}
stack
[
DNS_R_MAXDEPTH
];
unsigned
char
search_enabled
;
};
/* struct dns_resolver */
...
...
@@ -7726,7 +7728,10 @@ exec:
if
(
!
R
->
nodata
)
dns_p_movptr
(
&
R
->
nodata
,
&
F
->
answer
);
dgoto
(
R
->
sp
,
DNS_R_SEARCH
);
if
(
R
->
search_enabled
)
dgoto
(
R
->
sp
,
DNS_R_SEARCH
);
else
dgoto
(
R
->
sp
,
DNS_R_FINISH
);
}
dns_rr_foreach
(
&
rr
,
F
->
answer
,
.
section
=
DNS_S_NS
,
.
type
=
DNS_T_NS
)
{
...
...
@@ -8096,6 +8101,10 @@ void dns_res_sethints(struct dns_resolver *res, struct dns_hints *hints) {
res
->
hints
=
hints
;
}
/* dns_res_sethints() */
void
dns_res_enable_search
(
struct
dns_resolver
*
res
,
unsigned
char
enable
)
{
res
->
search_enabled
=
enable
;
}
/*
* A D D R I N F O R O U T I N E S
...
...
src/dns.h
View file @
245bdae5
...
...
@@ -1200,6 +1200,8 @@ DNS_PUBLIC const struct dns_stat *dns_res_stat(struct dns_resolver *);
DNS_PUBLIC
void
dns_res_sethints
(
struct
dns_resolver
*
,
struct
dns_hints
*
);
DNS_PUBLIC
void
dns_res_enable_search
(
struct
dns_resolver
*
,
unsigned
char
enable
);
/*
* A D D R I N F O I N T E R F A C E
...
...
src/sipstack.c
View file @
245bdae5
...
...
@@ -120,6 +120,7 @@ belle_sip_stack_t * belle_sip_stack_new(const char *properties){
stack
->
transport_timeout
=
63000
;
stack
->
dns_timeout
=
15000
;
stack
->
dns_srv_enabled
=
TRUE
;
stack
->
dns_search_enabled
=
TRUE
;
stack
->
inactive_transport_timeout
=
3600
;
/*one hour*/
return
stack
;
}
...
...
@@ -161,6 +162,14 @@ void belle_sip_stack_enable_dns_srv(belle_sip_stack_t *stack, unsigned char enab
stack
->
dns_srv_enabled
=
enable
;
}
unsigned
char
belle_sip_stack_dns_search_enabled
(
const
belle_sip_stack_t
*
stack
)
{
return
stack
->
dns_search_enabled
;
}
void
belle_sip_stack_enable_dns_search
(
belle_sip_stack_t
*
stack
,
unsigned
char
enable
)
{
stack
->
dns_search_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
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment