Commit 5dc6c5cb authored by Ghislain MARY's avatar Ghislain MARY
Browse files

Add API and config parameter to enable/disable DNS search.

parent 02e1a3fc
......@@ -877,6 +877,14 @@ bool_t sal_dns_srv_enabled(const Sal *sal) {
return (bool_t)belle_sip_stack_dns_srv_enabled(sal->stack);
}
void sal_enable_dns_search(Sal *sal, bool_t enable) {
belle_sip_stack_enable_dns_search(sal->stack, (unsigned char)enable);
}
bool_t sal_dns_search_enabled(const Sal *sal) {
return (bool_t)belle_sip_stack_dns_search_enabled(sal->stack);
}
void sal_set_dns_user_hosts_file(Sal *sal, const char *hosts_file) {
belle_sip_stack_set_dns_user_hosts_file(sal->stack, hosts_file);
}
......
......@@ -790,6 +790,8 @@ static void net_config_read (LinphoneCore *lc)
}
tmp = lp_config_get_int(lc->config, "net", "dns_srv_enabled", 1);
linphone_core_enable_dns_srv(lc, tmp);
tmp = lp_config_get_int(lc->config, "net", "dns_search_enabled", 1);
linphone_core_enable_dns_search(lc, tmp);
/* This is to filter out unsupported firewall policies */
if (nat_policy_ref == NULL)
......@@ -1523,6 +1525,16 @@ bool_t linphone_core_dns_srv_enabled(const LinphoneCore *lc) {
return sal_dns_srv_enabled(lc->sal);
}
void linphone_core_enable_dns_search(LinphoneCore *lc, bool_t enable) {
sal_enable_dns_search(lc->sal, enable);
if (linphone_core_ready(lc))
lp_config_set_int(lc->config, "net", "dns_search_enabled", enable ? 1 : 0);
}
bool_t linphone_core_dns_search_enabled(const LinphoneCore *lc) {
return sal_dns_search_enabled(lc->sal);
}
int linphone_core_get_download_bandwidth(const LinphoneCore *lc){
return lc->net_conf.download_bw;
}
......
......@@ -2754,6 +2754,22 @@ LINPHONE_PUBLIC void linphone_core_enable_dns_srv(LinphoneCore *lc, bool_t enabl
*/
LINPHONE_PUBLIC bool_t linphone_core_dns_srv_enabled(const LinphoneCore *lc);
/**
* Enable or disable DNS search (use of local domain if the fully qualified name did return results).
* @param[in] lc #LinphoneCore object.
* @param[in] enable TRUE to enable DNS search, FALSE to disable it.
* @ingroup media_parameters
*/
LINPHONE_PUBLIC void linphone_core_enable_dns_search(LinphoneCore *lc, bool_t enable);
/**
* Tells whether DNS search (use of local domain if the fully qualified name did return results) is enabled.
* @param[in] lc #LinphoneCore object.
* @return TRUE if DNS search is enabled, FALSE if disabled.
* @ingroup media_parameters
*/
LINPHONE_PUBLIC bool_t linphone_core_dns_search_enabled(const LinphoneCore *lc);
/**
* Forces liblinphone to use the supplied list of dns servers, instead of system's ones.
* @param[in] lc #LinphoneCore object.
......
......@@ -870,6 +870,8 @@ LINPHONE_PUBLIC int sal_get_transport_timeout(const Sal* sal);
void sal_set_dns_servers(Sal *sal, const MSList *servers);
LINPHONE_PUBLIC void sal_enable_dns_srv(Sal *sal, bool_t enable);
LINPHONE_PUBLIC bool_t sal_dns_srv_enabled(const Sal *sal);
LINPHONE_PUBLIC void sal_enable_dns_search(Sal *sal, bool_t enable);
LINPHONE_PUBLIC bool_t sal_dns_search_enabled(const Sal *sal);
LINPHONE_PUBLIC void sal_set_dns_user_hosts_file(Sal *sal, const char *hosts_file);
LINPHONE_PUBLIC const char *sal_get_dns_user_hosts_file(const Sal *sal);
unsigned int sal_get_random(void);
......
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