Commit e67a8737 authored by Ghislain MARY's avatar Ghislain MARY
Browse files

Add configuration to enable/disable DNS SRV resolution.

parent d8bd9cac
......@@ -704,6 +704,12 @@ void sal_set_dns_timeout(Sal* sal,int timeout) {
int sal_get_dns_timeout(const Sal* sal) {
return belle_sip_stack_get_dns_timeout(sal->stack);
}
void sal_enable_dns_srv(Sal *sal, bool_t enable) {
belle_sip_stack_enable_dns_srv(sal->stack, (unsigned char)enable);
}
bool_t sal_dns_srv_enabled(const Sal *sal) {
return (bool_t)belle_sip_stack_dns_srv_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);
......
......@@ -499,6 +499,8 @@ static void net_config_read (LinphoneCore *lc)
/*legacy parameter*/
linphone_core_set_download_ptime(lc,tmp);
}
tmp = lp_config_get_int(lc->config, "net", "dns_srv_enabled", 1);
linphone_core_enable_dns_srv(lc, tmp);
/* This is to filter out unsupported firewall policies */
linphone_core_set_firewall_policy(lc, linphone_core_get_firewall_policy(lc));
......@@ -1069,6 +1071,16 @@ void linphone_core_set_upload_bandwidth(LinphoneCore *lc, int bw){
if (linphone_core_ready(lc)) lp_config_set_int(lc->config,"net","upload_bw",bw);
}
void linphone_core_enable_dns_srv(LinphoneCore *lc, bool_t enable) {
sal_enable_dns_srv(lc->sal, enable);
if (linphone_core_ready(lc))
lp_config_set_int(lc->config, "net", "dns_srv_enabled", enable ? 1 : 0);
}
bool_t linphone_core_dns_srv_enabled(const LinphoneCore *lc) {
return sal_dns_srv_enabled(lc->sal);
}
/**
* Retrieve the maximum available download bandwidth.
* This value was set by linphone_core_set_download_bandwidth().
......
......@@ -1364,6 +1364,22 @@ LINPHONE_PUBLIC void linphone_core_set_upload_ptime(LinphoneCore *lc, int ptime)
LINPHONE_PUBLIC int linphone_core_get_upload_ptime(LinphoneCore *lc);
/**
* Enable or disable DNS SRV resolution.
* @param[in] lc #LinphoneCore object.
* @param[in] enable TRUE to enable DNS SRV resolution, FALSE to disable it.
* @ingroup media_parameters
*/
LINPHONE_PUBLIC void linphone_core_enable_dns_srv(LinphoneCore *lc, bool_t enable);
/**
* Tells whether DNS SRV resolution is enabled.
* @param[in] lc #LinphoneCore object.
* @returns TRUE if DNS SRV resolution is enabled, FALSE if disabled.
* @ingroup media_parameters
*/
LINPHONE_PUBLIC bool_t linphone_core_dns_srv_enabled(const LinphoneCore *lc);
/* returns a MSList of PayloadType */
LINPHONE_PUBLIC const MSList *linphone_core_get_audio_codecs(const LinphoneCore *lc);
......
......@@ -685,6 +685,8 @@ bool_t sal_nat_helper_enabled(Sal *sal);
LINPHONE_PUBLIC void sal_set_dns_timeout(Sal* sal,int timeout);
LINPHONE_PUBLIC int sal_get_dns_timeout(const Sal* sal);
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_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 char * sal_get_random_bytes(unsigned char *ret, size_t size);
......
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