Commit 8d7cac3b authored by Nicolas Michon's avatar Nicolas Michon

Changes on dependent proxy configs

parent ee34ccbe
......@@ -166,13 +166,6 @@ LinphoneProxyConfig * linphone_account_creator_create_proxy_config(const Linphon
ms_free(url);
}
if (creator->idkey != NULL) {
linphone_proxy_config_set_idkey(cfg, creator->idkey);
}
if (creator->depends_on != NULL) {
linphone_proxy_config_set_depends_on(cfg, creator->depends_on);
}
linphone_proxy_config_enable_register(cfg, TRUE);
info = linphone_auth_info_new(linphone_address_get_username(identity), // username
......@@ -363,7 +356,6 @@ LinphoneAccountCreator * _linphone_account_creator_new(LinphoneCore *core, const
if (domain) {
linphone_account_creator_set_domain(creator, domain);
}
creator->set_as_default = TRUE;
creator->proxy_cfg = linphone_core_create_proxy_config(core);
......@@ -389,8 +381,6 @@ void linphone_account_creator_reset(LinphoneAccountCreator *creator) {
resetField(&creator->activation_code);
resetField(&creator->domain);
resetField(&creator->route);
resetField(&creator->idkey);
resetField(&creator->depends_on);
}
LinphoneAccountCreator * linphone_core_create_account_creator(LinphoneCore *core, const char *xmlrpc_url) {
......@@ -623,24 +613,6 @@ const char * linphone_account_creator_get_route(const LinphoneAccountCreator *cr
return creator->route;
}
LinphoneAccountCreatorStatus linphone_account_creator_set_idkey(LinphoneAccountCreator *creator, const char *idkey) {
set_string(&creator->idkey, idkey, FALSE);
return LinphoneAccountCreatorStatusRequestOk;
}
const char * linphone_account_creator_get_idkey(const LinphoneAccountCreator *creator) {
return creator->idkey;
}
LinphoneAccountCreatorStatus linphone_account_creator_set_depends_on(LinphoneAccountCreator *creator, const char *depends_on) {
set_string(&creator->depends_on, depends_on, FALSE);
return LinphoneAccountCreatorStatusRequestOk;
}
const char * linphone_account_creator_get_depends_on(const LinphoneAccountCreator *creator) {
return creator->depends_on;
}
LinphoneAccountCreatorStatus linphone_account_creator_set_as_default(LinphoneAccountCreator *creator, bool_t set_as_default) {
creator->set_as_default = set_as_default;
return LinphoneAccountCreatorStatusRequestOk;
......
......@@ -105,9 +105,6 @@ struct _LinphoneAccountCreator {
char *algorithm; /**< Digest authentication algorithm */
LinphoneTransportType transport; /**< Transport used */
char *depends_on; /**< Triggers proxy config depdendency mecanism if not NULL */
char *idkey; /**< Unique identification key */
bool_t set_as_default; /**< Set proxy config as the default one */
/* Deprecated */
......
......@@ -96,8 +96,7 @@ This mecanism must be enabled before the proxy configuration is added to the cor
LinphoneProxyConfig* dependent_proxy_cfg;
LinphoneProxyConfig* master_proxy_cfg;
linphone_proxy_config_set_ref_key(master_proxy_cfg, "unique-proxy-id");
linphone_proxy_config_set_depends_on(dependent_proxy_cfg, "unique-proxy-id");
linphone_proxy_config_set_dependency(dependent_proxy_cfg, master_proxy_cfg);
//Add master first
linphone_core_add_proxy_config(lc, master_proxy_cfg);
linphone_core_add_proxy_config(lc, dependent_proxy_cfg);
......
......@@ -137,6 +137,7 @@ struct _LinphoneProxyConfig
char *refkey;
char *sip_etag; /*publish context*/
char *depends_on; /* NULL or points to another proxy_config->idkey */
LinphoneProxyConfig *dependency; /* Points to another proxy config if depends_on is defined */
char *idkey; /* NULL or referenced by another proxy_config->depends_on */
char *conference_factory_uri;
......
This diff is collapsed.
......@@ -333,36 +333,6 @@ LINPHONE_DEPRECATED LINPHONE_PUBLIC LinphoneAccountCreatorStatus linphone_accoun
**/
LINPHONE_DEPRECATED LINPHONE_PUBLIC const char * linphone_account_creator_get_route(const LinphoneAccountCreator *creator);
/**
* Set the idkey.
* @param[in] creator #LinphoneAccountCreator object
* @param[in] idkey The idkey to set
* @return #LinphoneAccountCreatorStatusRequestOk if everything is OK, or a specific error otherwise.
**/
LINPHONE_PUBLIC LinphoneAccountCreatorStatus linphone_account_creator_set_idkey(LinphoneAccountCreator *creator, const char *idkey);
/**
* Get the idkey.
* @param[in] creator #LinphoneAccountCreator object
* @return The idkey of the #LinphoneAccountCreator
**/
LINPHONE_PUBLIC const char * linphone_account_creator_get_idkey(const LinphoneAccountCreator *creator);
/**
* Set the depends_on property.
* @param[in] creator #LinphoneAccountCreator object
* @param[in] depends_on The idkey to set
* @return #LinphoneAccountCreatorStatusRequestOk if everything is OK, or a specific error otherwise.
**/
LINPHONE_PUBLIC LinphoneAccountCreatorStatus linphone_account_creator_set_depends_on(LinphoneAccountCreator *creator, const char *depends_on);
/**
* Get the depends_on property.
* @param[in] creator #LinphoneAccountCreator object
* @return The idkey of the #LinphoneAccountCreator
**/
LINPHONE_PUBLIC const char * linphone_account_creator_get_depends_on(const LinphoneAccountCreator *creator);
/**
* Set the set_as_default property.
* @param[in] creator #LinphoneAccountCreator object
......
......@@ -587,29 +587,29 @@ LINPHONE_PUBLIC const char * linphone_proxy_config_get_ref_key(const LinphonePro
LINPHONE_PUBLIC void linphone_proxy_config_set_ref_key(LinphoneProxyConfig *cfg, const char *refkey);
/**
* Get the depends_on property of a #LinphoneProxyConfig.
* Get the dependency of a #LinphoneProxyConfig.
*
* @param[in] cfg #LinphoneProxyConfig object.
* @return The idkey string this proxy config is dependent upon, or NULL if not marked dependent
* @return The proxy config this one is dependent upon, or NULL if not marked dependent
**/
LINPHONE_PUBLIC const char *linphone_proxy_config_get_depends_on(LinphoneProxyConfig *cfg);
LINPHONE_PUBLIC LinphoneProxyConfig *linphone_proxy_config_get_dependency(LinphoneProxyConfig *cfg);
/**
* Mark this proxy configuration as being dependent on another.
* The depends_on string must refer to an idkey of a proxy configuration previously added to the core.
* Mark this proxy configuration as being dependent on the given one.
* The dependency must refer to a proxy config previously added to the core and which idkey property is defined.
*
* @see linphone_proxy_config_set_idkey()
*
* The proxy configuration marked as dependent will wait for successful registration on its dependency before triggering its own.
*
* Once registered, both proxy configurations will share the same contact address (the 'master' one).
* Once registered, both proxy configurations will share the same contact address (the 'dependency' one).
*
* This mecanism must be enabled before the proxy configuration is added to the core
*
* @param[in] cfg #LinphoneProxyConfig object.
* @param[in] depends_on The reference key of a master #LinphoneProxyConfig
**/
LINPHONE_PUBLIC void linphone_proxy_config_set_depends_on(LinphoneProxyConfig *cfg, const char *depends_on);
LINPHONE_PUBLIC void linphone_proxy_config_set_dependency(LinphoneProxyConfig *cfg, LinphoneProxyConfig *dependency);
/**
* Get the idkey property of a #LinphoneProxyConfig.
......
......@@ -285,7 +285,7 @@ static void dependent_proxy_config(void) {
BC_ASSERT_PTR_NOT_NULL(marie_cfg);
BC_ASSERT_PTR_NOT_NULL(marie_dependent_cfg);
BC_ASSERT_STRING_EQUAL("master", linphone_proxy_config_get_depends_on(marie_dependent_cfg));
BC_ASSERT_PTR_EQUAL(marie_cfg, linphone_proxy_config_get_dependency(marie_dependent_cfg));
BC_ASSERT_TRUE(wait_for(pauline->lc, NULL, &pauline->stat.number_of_LinphoneRegistrationOk, 1));
......@@ -312,16 +312,14 @@ static void dependent_proxy_config(void) {
if (BC_ASSERT_TRUE(wait_for_until(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallIncomingReceived, 1, 10000))) {
linphone_call_accept(linphone_core_get_current_call(marie->lc));
BC_ASSERT_TRUE(wait_for_until(pauline->lc, marie->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 1, 10000));
BC_ASSERT_TRUE(wait_for_until(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 1, 10000));
end_call(pauline, marie);
}
linphone_address_unref(marie_dependent_addr);
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
}
//Dependent proxy config should not register if its dependency is not in a LinphoneRegistrationOk state
......@@ -388,10 +386,12 @@ static void invalid_dependent_proxy_config(void) {
BC_ASSERT_EQUAL(bctbx_list_size(proxyConfigs), 0, int, "%d");
linphone_proxy_config_set_idkey(master, "invalid");
linphone_core_add_proxy_config(marie->lc, master);
linphone_proxy_config_set_dependency(dependent, master);
linphone_proxy_config_set_idkey(master, "invalid");
//Adding a dependent proxy config linking to inexistent dependency should fail
BC_ASSERT_EQUAL(linphone_core_add_proxy_config(marie->lc, dependent), -1, int, "%d");
......
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