Commit a8418666 authored by Ghislain MARY's avatar Ghislain MARY

Fix deprecation warnings.

parent a570c27e
......@@ -1982,7 +1982,7 @@ static int lpc_cmd_register(LinphoneCore *lc, char *args){
info=linphone_auth_info_new(linphone_address_get_username(from),NULL,passwd,NULL,NULL,linphone_address_get_username(from));
linphone_core_add_auth_info(lc,info);
linphone_address_unref(from);
linphone_auth_info_destroy(info);
linphone_auth_info_unref(info);
}
}
elem=linphone_core_get_proxy_config_list(lc);
......
......@@ -889,7 +889,7 @@ linphonec_prompt_for_auth_final(LinphoneCore *lc)
*/
linphone_auth_info_set_passwd(pending_auth, input);
linphone_core_add_auth_info(lc, pending_auth);
linphone_auth_info_destroy(pending_auth);
linphone_auth_info_unref(pending_auth);
auth_stack.elem[auth_stack.nitems-1]=0;
--(auth_stack.nitems);
#ifdef HAVE_READLINE
......
......@@ -427,7 +427,7 @@ void linphone_core_add_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *info)
ai=(LinphoneAuthInfo*)linphone_core_find_auth_info(lc,info->realm,info->username,info->domain);
if (ai!=NULL && ai->domain && info->domain && strcmp(ai->domain, info->domain)==0){
lc->auth_info=bctbx_list_remove(lc->auth_info,ai);
linphone_auth_info_destroy(ai);
linphone_auth_info_unref(ai);
updating=TRUE;
}
lc->auth_info=bctbx_list_append(lc->auth_info,linphone_auth_info_clone(info));
......@@ -487,7 +487,7 @@ void linphone_core_remove_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *in
r=(LinphoneAuthInfo*)linphone_core_find_auth_info(lc,info->realm,info->username,info->domain);
if (r){
lc->auth_info=bctbx_list_remove(lc->auth_info,r);
linphone_auth_info_destroy(r);
linphone_auth_info_unref(r);
write_auth_infos(lc);
}
}
......@@ -501,7 +501,7 @@ void linphone_core_clear_all_auth_info(LinphoneCore *lc){
int i;
for(i=0,elem=lc->auth_info;elem!=NULL;elem=bctbx_list_next(elem),i++){
LinphoneAuthInfo *info=(LinphoneAuthInfo*)elem->data;
linphone_auth_info_destroy(info);
linphone_auth_info_unref(info);
linphone_auth_info_write_config(lc->config,NULL,i);
}
bctbx_list_free(lc->auth_info);
......
......@@ -1039,7 +1039,7 @@ static void auth_failure(SalOp *op, SalAuthInfo* info) {
ms_message("%s/%s/%s/%s authentication fails.", info->realm, info->username, info->domain, info->mode == SalAuthModeHttpDigest ? "HttpDigest" : "Tls");
/*ask again for password if auth info was already supplied but apparently not working*/
linphone_core_notify_authentication_requested(lc, auth_info, method);
linphone_auth_info_destroy(auth_info);
linphone_auth_info_unref(auth_info);
// Deprecated
linphone_core_notify_auth_info_requested(lc, info->realm, info->username, info->domain);
}
......@@ -1275,7 +1275,7 @@ static bool_t auth_requested(Sal* sal, SalAuthInfo* sai) {
LinphoneAuthMethod method = sai->mode == SalAuthModeHttpDigest ? LinphoneAuthHttpDigest : LinphoneAuthTls;
LinphoneAuthInfo *ai = linphone_core_create_auth_info(lc, sai->username, NULL, NULL, NULL, sai->realm, sai->domain);
linphone_core_notify_authentication_requested(lc, ai, method);
linphone_auth_info_destroy(ai);
linphone_auth_info_unref(ai);
// Deprecated
linphone_core_notify_auth_info_requested(lc, sai->realm, sai->username, sai->domain);
if (fill_auth_info(lc, sai)) {
......
......@@ -43,7 +43,7 @@ void linphone_carddav_context_destroy(LinphoneCardDavContext *cdc) {
cdc->friend_list = NULL;
}
if (cdc->auth_info) {
linphone_auth_info_destroy(cdc->auth_info);
linphone_auth_info_unref(cdc->auth_info);
cdc->auth_info = NULL;
}
ms_free(cdc);
......
......@@ -101,7 +101,7 @@ const LinphoneContent * linphone_info_message_get_content(const LinphoneInfoMess
void linphone_core_notify_info_message(LinphoneCore* lc,SalOp *op, SalBodyHandler *body_handler){
LinphoneCall *call=(LinphoneCall*)sal_op_get_user_pointer(op);
if (call){
LinphoneInfoMessage *info=ms_new0(LinphoneInfoMessage,1);
LinphoneInfoMessage *info=linphone_core_create_info_message(lc);
info->headers=sal_custom_header_clone(sal_op_get_recv_custom_header(op));
if (body_handler) info->content=linphone_content_from_sal_body_handler(body_handler);
linphone_core_notify_info_received(lc,call,info);
......
......@@ -1316,7 +1316,7 @@ static void sip_config_read(LinphoneCore *lc) {
LinphoneAuthInfo *ai=linphone_auth_info_new_from_config_file(lc->config,i);
if (ai!=NULL){
linphone_core_add_auth_info(lc,ai);
linphone_auth_info_destroy(ai);
linphone_auth_info_unref(ai);
}else{
break;
}
......@@ -5461,7 +5461,7 @@ void sip_config_uninit(LinphoneCore *lc)
/*no longuer need to write proxy config if not changedlinphone_proxy_config_write_to_config_file(lc->config,NULL,i);*/ /*mark the end */
lc->auth_info=bctbx_list_free_with_data(lc->auth_info,(void (*)(void*))linphone_auth_info_destroy);
lc->auth_info=bctbx_list_free_with_data(lc->auth_info,(void (*)(void*))linphone_auth_info_unref);
if (lc->vcard_context) {
linphone_vcard_context_destroy(lc->vcard_context);
......@@ -6610,10 +6610,10 @@ LinphoneConference *linphone_core_create_conference_with_params(LinphoneCore *lc
lc->conf_ctx = linphone_remote_conference_new_with_params(lc, params2);
} else {
ms_error("'%s' is not a valid conference method", conf_method_name);
linphone_conference_params_free(params2);
linphone_conference_params_unref(params2);
return NULL;
}
linphone_conference_params_free(params2);
linphone_conference_params_unref(params2);
} else {
ms_error("Could not create a conference: a conference instance already exists");
return NULL;
......@@ -6626,7 +6626,7 @@ int linphone_core_add_to_conference(LinphoneCore *lc, LinphoneCall *call) {
if(conference == NULL) {
LinphoneConferenceParams *params = linphone_conference_params_new(lc);
conference = linphone_core_create_conference_with_params(lc, params);
linphone_conference_params_free(params);
linphone_conference_params_unref(params);
}
if(conference) return linphone_conference_add_participant(lc->conf_ctx, call);
else return -1;
......
......@@ -72,7 +72,7 @@ void RegisterCommand::exec(Daemon *app, const string& args) {
LinphoneAuthInfo *info = linphone_auth_info_new(linphone_address_get_username(from), cuserid, cpassword, NULL, crealm, NULL);
linphone_core_add_auth_info(lc, info); /* Add authentication info to LinphoneCore */
linphone_address_unref(from);
linphone_auth_info_destroy(info);
linphone_auth_info_unref(info);
}
}
linphone_proxy_config_set_identity(cfg, cidentity);
......
......@@ -183,7 +183,7 @@ void account_create_on_server(Account *account, const LinphoneProxyConfig *refcf
NULL,
account->password,NULL,NULL,linphone_address_get_domain(account->modified_identity));
linphone_core_add_auth_info(lc,ai);
linphone_auth_info_destroy(ai);
linphone_auth_info_unref(ai);
if (wait_for_until(lc,NULL,&account->registered,1,3000)==FALSE){
ms_fatal("Account for %s is not working on server.", linphone_proxy_config_get_identity(refcfg));
......@@ -193,7 +193,7 @@ void account_create_on_server(Account *account, const LinphoneProxyConfig *refcf
if (wait_for_until(lc,NULL,&account->done,1,3000)==FALSE){
ms_error("Account creation could not clean the registration context.");
}
linphone_core_destroy(lc);
linphone_core_unref(lc);
unlink(chatdb);
ms_free(chatdb);
}
......@@ -240,7 +240,7 @@ static LinphoneAddress *account_manager_check_account(AccountManager *m, Linphon
NULL,
account->password,NULL,NULL,linphone_address_get_domain(account->modified_identity));
linphone_core_add_auth_info(lc,ai);
linphone_auth_info_destroy(ai);
linphone_auth_info_unref(ai);
linphone_address_unref(id_addr);
return account->modified_identity;
......
......@@ -350,8 +350,10 @@ bool_t call_with_params2(LinphoneCoreManager* caller_mgr
ms_message("Created default call params with video=%i", linphone_call_params_video_enabled(default_params));
linphone_call_accept_with_params(callee_call,default_params);
linphone_call_params_unref(default_params);
}else{
}else if (callee_call) {
linphone_call_accept(callee_call);
} else {
linphone_call_accept(linphone_core_get_current_call(callee_mgr->lc));
}
BC_ASSERT_TRUE(wait_for(callee_mgr->lc,caller_mgr->lc,&callee_mgr->stat.number_of_LinphoneCallConnected,initial_callee.number_of_LinphoneCallConnected+1));
......@@ -2600,6 +2602,8 @@ static void check_call_state(LinphoneCoreManager* mgr,LinphoneCallState state) {
static void call_established_with_rejected_info(void) {
LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
LinphoneInfoMessage *im1;
LinphoneInfoMessage *im2;
int dummy=0;
bool_t call_ok=FALSE;
......@@ -2607,15 +2611,19 @@ static void call_established_with_rejected_info(void) {
if (call_ok){
sal_enable_unconditional_answer(marie->lc->sal,TRUE);
linphone_call_send_info_message(linphone_core_get_current_call(pauline->lc),linphone_core_create_info_message(pauline->lc));
im1 = linphone_core_create_info_message(pauline->lc);
linphone_call_send_info_message(linphone_core_get_current_call(pauline->lc),im1);
wait_for_until(marie->lc,pauline->lc,&dummy,1,1000); /*just to sleep while iterating 1s*/
linphone_info_message_unref(im1);
sal_enable_unconditional_answer(marie->lc->sal,FALSE);
linphone_call_send_info_message(linphone_core_get_current_call(pauline->lc),linphone_core_create_info_message(pauline->lc));
im2 = linphone_core_create_info_message(pauline->lc);
linphone_call_send_info_message(linphone_core_get_current_call(pauline->lc),im2);
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_inforeceived,1));
BC_ASSERT_EQUAL(marie->stat.number_of_inforeceived,1, int, "%d");
linphone_info_message_unref(im2);
check_call_state(pauline,LinphoneCallStreamsRunning);
check_call_state(marie,LinphoneCallStreamsRunning);
......@@ -2926,8 +2934,8 @@ static void call_rejected_because_wrong_credentials_with_params(const char* user
/*to make sure unregister will work*/
linphone_core_clear_all_auth_info(marie->lc);
linphone_core_add_auth_info(marie->lc,good_auth_info);
linphone_auth_info_destroy(good_auth_info);
linphone_auth_info_destroy(wrong_auth_info);
linphone_auth_info_unref(good_auth_info);
linphone_auth_info_unref(wrong_auth_info);
linphone_core_manager_destroy(marie);
}
......
......@@ -1246,13 +1246,14 @@ static void tls_authentication_requested_bad(LinphoneCore *lc, LinphoneAuthInfo
static void tls_client_auth_try_register(const char *identity, bool_t with_good_cert, bool_t must_work){
LinphoneCoreManager *lcm;
LinphoneCoreVTable* vtable = linphone_core_v_table_new();
LinphoneCoreCbs *cbs = linphone_factory_create_core_cbs(linphone_factory_get());
LinphoneProxyConfig *cfg;
lcm = linphone_core_manager_new(NULL);
vtable->authentication_requested= with_good_cert ? tls_authentication_requested_good : tls_authentication_requested_bad;
linphone_core_add_listener(lcm->lc,vtable);
linphone_core_cbs_set_authentication_requested(cbs, with_good_cert ? tls_authentication_requested_good : tls_authentication_requested_bad);
linphone_core_add_callbacks(lcm->lc, cbs);
linphone_core_cbs_unref(cbs);
cfg = linphone_core_create_proxy_config(lcm->lc);
linphone_proxy_config_set_server_addr(cfg, "sip:sip2.linphone.org:5063;transport=tls");
......@@ -1274,7 +1275,6 @@ static void tls_client_auth_try_register(const char *identity, bool_t with_good_
linphone_proxy_config_unref(cfg);
linphone_core_manager_destroy(lcm);
linphone_core_v_table_destroy(vtable);
}
void tls_client_auth_bad_certificate_cn(void) {
......
......@@ -276,7 +276,7 @@ typedef struct _LinphoneCoreManager {
typedef struct _LinphoneConferenceServer {
LinphoneCoreManager base;
LinphoneCall *first_call;
LinphoneCoreVTable *vtable;
LinphoneCoreCbs *cbs;
LinphoneRegistrationState reg_state;
} LinphoneConferenceServer;
......
......@@ -293,9 +293,10 @@ static void upload_collected_traces(void) {
if (transport_supported(LinphoneTransportTls)) {
LinphoneCoreManager* marie = setup(LinphoneLogCollectionEnabled);
int waiting = 100;
LinphoneCoreVTable *v_table = linphone_core_v_table_new();
v_table->log_collection_upload_state_changed = logCollectionUploadStateChangedCb;
linphone_core_add_listener(marie->lc, v_table);
LinphoneCoreCbs *cbs = linphone_factory_create_core_cbs(linphone_factory_get());
linphone_core_cbs_set_log_collection_upload_state_changed(cbs, logCollectionUploadStateChangedCb);
linphone_core_add_callbacks(marie->lc, cbs);
linphone_core_cbs_unref(cbs);
linphone_core_set_log_collection_max_file_size(5000);
linphone_core_set_log_collection_upload_server_url(marie->lc,"https://www.linphone.org:444/lft.php");
......
......@@ -800,7 +800,7 @@ void info_message_received(LinphoneCore *lc, LinphoneCall* call, const LinphoneI
stats* counters = get_stats(lc);
if (counters->last_received_info_message) {
linphone_info_message_destroy(counters->last_received_info_message);
linphone_info_message_unref(counters->last_received_info_message);
}
counters->last_received_info_message=linphone_info_message_copy(msg);
counters->number_of_inforeceived++;
......@@ -827,7 +827,7 @@ void info_message_base(bool_t with_content) {
linphone_content_unref(ct);
}
linphone_call_send_info_message(linphone_core_get_current_call(marie->lc),info);
linphone_info_message_destroy(info);
linphone_info_message_unref(info);
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_inforeceived,1));
......
......@@ -35,8 +35,7 @@ static int get_codec_position(const MSList *l, const char *mime_type, int rate){
/*check basic things about codecs at startup: order and enablement*/
static void start_with_no_config(void){
LinphoneCoreVTable vtable={0};
LinphoneCore *lc=linphone_core_new(&vtable, NULL, NULL, NULL);
LinphoneCore *lc=linphone_factory_create_core(linphone_factory_get(), NULL, NULL, NULL);
const MSList *codecs=linphone_core_get_audio_codecs(lc);
int opus_codec_pos;
int speex_codec_pos=get_codec_position(codecs, "speex", 8000);
......@@ -51,7 +50,7 @@ static void start_with_no_config(void){
if (pt) {
BC_ASSERT_TRUE(linphone_core_payload_type_enabled(lc, pt));
}
linphone_core_destroy(lc);
linphone_core_unref(lc);
}
static void check_payload_type_numbers(LinphoneCall *call1, LinphoneCall *call2, int expected_number){
......
......@@ -343,9 +343,10 @@ static void quality_reporting_sent_using_custom_route(void) {
LinphoneCall* call_marie = NULL;
LinphoneCall* call_pauline = NULL;
LinphoneCoreVTable publish_vtable = {0};
publish_vtable.publish_state_changed = publish_report_with_route_state_changed;
linphone_core_add_listener(marie->lc, &publish_vtable);
LinphoneCoreCbs *cbs = linphone_factory_create_core_cbs(linphone_factory_get());
linphone_core_cbs_set_publish_state_changed(cbs, publish_report_with_route_state_changed);
linphone_core_add_callbacks(marie->lc, cbs);
linphone_core_cbs_unref(cbs);
//INVALID collector: sip.linphone.org do not collect reports, so it will throw a 404 Not Found error
linphone_proxy_config_set_quality_reporting_collector(linphone_core_get_default_proxy_config(marie->lc), "sip:sip.linphone.org");
......
......@@ -22,13 +22,6 @@
#include "liblinphone_tester.h"
static void auth_info_requested(LinphoneCore *lc, const char *realm, const char *username, const char *domain) {
LinphoneAuthInfo *info;
info=linphone_auth_info_new(test_username,NULL,test_password,NULL,realm,domain);
linphone_core_add_auth_info(lc,info);
linphone_auth_info_destroy(info);
}
static void authentication_requested(LinphoneCore *lc, LinphoneAuthInfo *auth_info, LinphoneAuthMethod method) {
linphone_auth_info_set_passwd(auth_info, test_password);
linphone_core_add_auth_info(lc, auth_info); /*add authentication info to LinphoneCore*/
......@@ -38,9 +31,10 @@ static LinphoneCoreManager* create_lcm_with_auth(unsigned int with_auth) {
LinphoneCoreManager* lcm = linphone_core_manager_new(NULL);
if (with_auth) {
LinphoneCoreVTable* vtable = linphone_core_v_table_new();
vtable->authentication_requested = authentication_requested;
linphone_core_add_listener(lcm->lc, vtable);
LinphoneCoreCbs *cbs = linphone_factory_create_core_cbs(linphone_factory_get());
linphone_core_cbs_set_authentication_requested(cbs, authentication_requested);
linphone_core_add_callbacks(lcm->lc, cbs);
linphone_core_cbs_unref(cbs);
}
/*to allow testing with 127.0.0.1*/
......@@ -68,7 +62,6 @@ void registration_state_changed(struct _LinphoneCore *lc, LinphoneProxyConfig *c
default:
BC_FAIL("unexpected event");break;
}
}
static void register_with_refresh_base_3(LinphoneCore* lc
......@@ -122,7 +115,7 @@ static void register_with_refresh_base_3(LinphoneCore* lc
BC_ASSERT_EQUAL(linphone_proxy_config_get_error(proxy_cfg),LinphoneReasonUnauthorized, int, "%d");
info=linphone_auth_info_new(test_username,NULL,test_password,NULL,auth_domain,NULL); /*create authentication structure from identity*/
linphone_core_add_auth_info(lc,info); /*add authentication info to LinphoneCore*/
linphone_auth_info_destroy(info);
linphone_auth_info_unref(info);
}
}
if (linphone_proxy_config_get_error(proxy_cfg) == LinphoneReasonBadCredentials
......@@ -171,7 +164,7 @@ static void register_with_refresh_with_send_error(void) {
char route[256];
sprintf(route,"sip:%s",test_route);
linphone_core_add_auth_info(lcm->lc,info); /*add authentication info to LinphoneCore*/
linphone_auth_info_destroy(info);
linphone_auth_info_unref(info);
register_with_refresh_base(lcm->lc,TRUE,auth_domain,route);
/*simultate a network error*/
sal_set_send_error(lcm->lc->sal, -1);
......@@ -313,7 +306,7 @@ static void simple_authenticated_register(void){
char route[256];
sprintf(route,"sip:%s",test_route);
linphone_core_add_auth_info(lcm->lc,info); /*add authentication info to LinphoneCore*/
linphone_auth_info_destroy(info);
linphone_auth_info_unref(info);
counters = &lcm->stat;
register_with_refresh(lcm,FALSE,auth_domain,route);
BC_ASSERT_EQUAL(counters->number_of_auth_info_requested,0, int, "%d");
......@@ -330,7 +323,7 @@ static void ha1_authenticated_register(void){
info=linphone_auth_info_new(test_username,NULL,NULL,ha1,auth_domain,NULL); /*create authentication structure from identity*/
sprintf(route,"sip:%s",test_route);
linphone_core_add_auth_info(lcm->lc,info); /*add authentication info to LinphoneCore*/
linphone_auth_info_destroy(info);
linphone_auth_info_unref(info);
counters = &lcm->stat;
register_with_refresh(lcm,FALSE,auth_domain,route);
BC_ASSERT_EQUAL(counters->number_of_auth_info_requested,0, int, "%d");
......@@ -339,7 +332,7 @@ static void ha1_authenticated_register(void){
static void authenticated_register_with_no_initial_credentials(void){
LinphoneCoreManager *lcm;
LinphoneCoreVTable* vtable = linphone_core_v_table_new();
LinphoneCoreCbs *cbs = linphone_factory_create_core_cbs(linphone_factory_get());
stats* counters;
char route[256];
......@@ -347,8 +340,9 @@ static void authenticated_register_with_no_initial_credentials(void){
lcm = linphone_core_manager_new(NULL);
vtable->auth_info_requested=auth_info_requested;
linphone_core_add_listener(lcm->lc,vtable);
linphone_core_cbs_set_authentication_requested(cbs, authentication_requested);
linphone_core_add_callbacks(lcm->lc, cbs);
linphone_core_cbs_unref(cbs);
counters= get_stats(lcm->lc);
counters->number_of_auth_info_requested=0;
......@@ -402,7 +396,7 @@ static void authenticated_register_with_provided_credentials(void){
ai = linphone_auth_info_new(test_username, NULL, test_password, NULL, NULL, NULL);
linphone_core_add_auth_info(lcm->lc, ai);
linphone_auth_info_destroy(ai);
linphone_auth_info_unref(ai);
linphone_core_add_proxy_config(lcm->lc, cfg);
BC_ASSERT_TRUE(wait_for(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationOk,1));
......@@ -452,7 +446,7 @@ static void authenticated_register_with_wrong_credentials_with_params_base(const
linphone_core_set_user_agent(lcm->lc,user_agent,NULL);
}
linphone_core_add_auth_info(lcm->lc,info); /*add wrong authentication info to LinphoneCore*/
linphone_auth_info_destroy(info);
linphone_auth_info_unref(info);
counters = get_stats(lcm->lc);
register_with_refresh_base_3(lcm->lc,TRUE,auth_domain,route,FALSE,transport,LinphoneRegistrationFailed);
//BC_ASSERT_EQUAL(counters->number_of_auth_info_requested,3, int, "%d"); register_with_refresh_base_3 does not alow to precisely check number of number_of_auth_info_requested
......@@ -639,7 +633,7 @@ static void proxy_transport_change(void){
char* addr_as_string;
LinphoneAuthInfo *info=linphone_auth_info_new(test_username,NULL,test_password,NULL,auth_domain,NULL); /*create authentication structure from identity*/
linphone_core_add_auth_info(lcm->lc,info); /*add authentication info to LinphoneCore*/
linphone_auth_info_destroy(info);
linphone_auth_info_unref(info);
register_with_refresh_base(lcm->lc,FALSE,auth_domain,NULL);
proxy_config = linphone_core_get_default_proxy_config(lcm->lc);
......@@ -676,7 +670,7 @@ static void proxy_transport_change_with_wrong_port(void) {
sprintf(route,"sip:%s",test_route);
linphone_core_add_auth_info(lcm->lc,info); /*add authentication info to LinphoneCore*/
linphone_auth_info_destroy(info);
linphone_auth_info_unref(info);
register_with_refresh_base_3(lcm->lc, FALSE, auth_domain, "sip2.linphone.org:5987", 0,transport,LinphoneRegistrationProgress);
proxy_config = linphone_core_get_default_proxy_config(lcm->lc);
......@@ -707,7 +701,7 @@ static void proxy_transport_change_with_wrong_port_givin_up(void) {
sprintf(route,"sip:%s",test_route);
linphone_core_add_auth_info(lcm->lc,info); /*add authentication info to LinphoneCore*/
linphone_auth_info_destroy(info);
linphone_auth_info_unref(info);
register_with_refresh_base_3(lcm->lc, FALSE, auth_domain, "sip2.linphone.org:5987", 0,transport,LinphoneRegistrationProgress);
proxy_config = linphone_core_get_default_proxy_config(lcm->lc);
......@@ -1097,13 +1091,14 @@ static void authentication_requested_2(LinphoneCore *lc, LinphoneAuthInfo *auth_
static void tls_auth_info_client_cert_cb(void) {
if (transport_supported(LinphoneTransportTls)) {
LinphoneCoreManager *lcm;
LinphoneCoreVTable* vtable = linphone_core_v_table_new();
LinphoneCoreCbs *cbs = linphone_factory_create_core_cbs(linphone_factory_get());
stats* counters;
lcm = linphone_core_manager_new(NULL);
vtable->authentication_requested=authentication_requested_2;
linphone_core_add_listener(lcm->lc,vtable);
linphone_core_cbs_set_authentication_requested(cbs, authentication_requested_2);
linphone_core_add_callbacks(lcm->lc, cbs);
linphone_core_cbs_unref(cbs);
counters= get_stats(lcm->lc);
counters->number_of_auth_info_requested=0;
......@@ -1131,13 +1126,14 @@ static void authentication_requested_3(LinphoneCore *lc, LinphoneAuthInfo *auth_
static void tls_auth_info_client_cert_cb_2(void) {
if (transport_supported(LinphoneTransportTls)) {
LinphoneCoreManager *lcm;
LinphoneCoreVTable* vtable = linphone_core_v_table_new();
LinphoneCoreCbs *cbs = linphone_factory_create_core_cbs(linphone_factory_get());
stats* counters;
lcm = linphone_core_manager_new(NULL);
vtable->authentication_requested=authentication_requested_3;
linphone_core_add_listener(lcm->lc,vtable);
linphone_core_cbs_set_authentication_requested(cbs, authentication_requested_3);
linphone_core_add_callbacks(lcm->lc, cbs);
linphone_core_cbs_unref(cbs);
counters= get_stats(lcm->lc);
counters->number_of_auth_info_requested=0;
......
......@@ -30,14 +30,12 @@ static void linphone_version_test(void){
}
static void core_init_test(void) {
LinphoneCoreVTable v_table;
LinphoneCore* lc;
memset (&v_table,0,sizeof(v_table));
lc = linphone_core_new(&v_table,NULL,NULL,NULL);
lc = linphone_factory_create_core(linphone_factory_get(),NULL,NULL,NULL);
/* until we have good certificates on our test server... */
linphone_core_verify_server_certificates(lc,FALSE);
if (BC_ASSERT_PTR_NOT_NULL(lc)) {
linphone_core_destroy(lc);
linphone_core_unref(lc);
}
}
......@@ -48,11 +46,9 @@ static void linphone_address_test(void) {
}
static void core_sip_transport_test(void) {
LinphoneCoreVTable v_table;
LinphoneCore* lc;
LCSipTransports tr;
memset (&v_table,0,sizeof(v_table));
lc = linphone_core_new(&v_table,NULL,NULL,NULL);
lc = linphone_factory_create_core(linphone_factory_get(),NULL,NULL,NULL);
if (!BC_ASSERT_PTR_NOT_NULL(lc)) return;
linphone_core_get_sip_transports(lc,&tr);
BC_ASSERT_EQUAL(tr.udp_port,5060, int, "%d"); /*default config*/
......@@ -72,19 +68,16 @@ static void core_sip_transport_test(void) {
BC_ASSERT_EQUAL(lp_config_get_int(linphone_core_get_config(lc),"sip","sip_tcp_port",-2),LC_SIP_TRANSPORT_RANDOM, int, "%d");
BC_ASSERT_EQUAL(lp_config_get_int(linphone_core_get_config(lc),"sip","sip_tls_port",-2),LC_SIP_TRANSPORT_RANDOM, int, "%d");
linphone_core_destroy(lc);
linphone_core_unref(lc);
}
static void linphone_interpret_url_test(void)
{
LinphoneCoreVTable v_table;
static void linphone_interpret_url_test(void) {
LinphoneCore* lc;
const char* sips_address = "sips:margaux@sip.linphone.org";
LinphoneAddress* address;
LinphoneProxyConfig *proxy_config;
char *tmp;
memset ( &v_table,0,sizeof ( v_table ) );
lc = linphone_core_new ( &v_table,NULL,NULL,NULL );
lc = linphone_factory_create_core(linphone_factory_get(),NULL,NULL,NULL);
if (!BC_ASSERT_PTR_NOT_NULL( lc )) return;
proxy_config =linphone_core_create_proxy_config(lc);
......@@ -125,7 +118,7 @@ static void linphone_interpret_url_test(void)
linphone_address_unref(address);
ms_free(tmp);
linphone_core_destroy (lc);
linphone_core_unref(lc);
}
static void linphone_lpconfig_from_buffer(void){
......@@ -276,13 +269,11 @@ void linphone_proxy_config_is_server_config_changed_test(void) {
}
static void chat_room_test(void) {
LinphoneCoreVTable v_table;
LinphoneCore* lc;
memset (&v_table,0,sizeof(v_table));
lc = linphone_core_new(&v_table,NULL,NULL,NULL);
lc = linphone_factory_create_core(linphone_factory_get(),NULL,NULL,NULL);
if (!BC_ASSERT_PTR_NOT_NULL(lc)) return;
BC_ASSERT_PTR_NOT_NULL(linphone_core_get_chat_room_from_uri(lc,"sip:toto@titi.com"));
linphone_core_destroy(lc);
linphone_core_unref(lc);
}
static void devices_reload_test(void) {
......
......@@ -114,7 +114,7 @@ static void configure_nat_policy(LinphoneCore *lc, bool_t turn_enabled) {
linphone_core_set_nat_policy(lc, nat_policy);
linphone_core_add_auth_info(lc, auth_info);
linphone_nat_policy_unref(nat_policy);
linphone_auth_info_destroy(auth_info);
linphone_auth_info_unref(auth_info);
}
static void check_turn_context_statistics(MSTurnContext *turn_context, bool_t forced_relay) {
......
......@@ -112,7 +112,7 @@ static void auth_info_requested(LinphoneCore *lc, const char *realm, const char
void reset_counters( stats* counters) {
if (counters->last_received_chat_message) linphone_chat_message_unref(counters->last_received_chat_message);
if (counters->last_received_info_message) linphone_info_message_destroy(counters->last_received_info_message);
if (counters->last_received_info_message) linphone_info_message_unref(counters->last_received_info_message);
memset(counters,0,sizeof(stats));
}
......@@ -446,7 +446,7 @@ void linphone_core_manager_stop(LinphoneCoreManager *mgr){
unlink(record_file);
}
}
linphone_core_destroy(mgr->lc);
linphone_core_unref(mgr->lc);
if (chatdb) {
if (ortp_file_exist(chatdb)==0) {
if (unlink(chatdb) != 0){
......@@ -468,7 +468,7 @@ void linphone_core_manager_uninit(LinphoneCoreManager *mgr) {
if (mgr->stat.last_received_chat_message) {
linphone_chat_message_unref(mgr->stat.last_received_chat_message);
}
if (mgr->stat.last_received_info_message) linphone_info_message_destroy(mgr->stat.last_received_info_message);
if (mgr->stat.last_received_info_message) linphone_info_message_unref(mgr->stat.last_received_info_message);
if (mgr->identity) {
linphone_address_unref(mgr->identity);
}
......@@ -814,8 +814,8 @@ bool_t check_ice(LinphoneCoreManager* caller, LinphoneCoreManager* callee, Linph
}
static void linphone_conference_server_call_state_changed(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cstate, const char *msg) {
LinphoneCoreVTable *vtable = linphone_core_get_current_vtable(lc);
LinphoneConferenceServer *conf_srv = (LinphoneConferenceServer *)vtable->user_data;
LinphoneCoreCbs *cbs = linphone_core_get_current_callbacks(lc);
LinphoneConferenceServer *conf_srv = (LinphoneConferenceServer *)linphone_core_cbs_get_user_data(cbs);
switch(cstate) {
case LinphoneCallIncomingReceived:
......@@ -865,8 +865,8 @@ static void linphone_conference_server_registration_state_changed(LinphoneCore *
LinphoneProxyConfig *cfg,
LinphoneRegistrationState cstate,
const char *message) {
LinphoneCoreVTable *vtable = linphone_core_get_current_vtable(core);
LinphoneConferenceServer *m = (LinphoneConferenceServer *)linphone_core_v_table_get_user_data(vtable);
LinphoneCoreCbs *cbs = linphone_core_get_current_callbacks(core);
LinphoneConferenceServer *m = (LinphoneConferenceServer *)linphone_core_cbs_get_user_data(cbs);
if(cfg == linphone_core_get_default_proxy_config(core)) {
m->reg_state = cstate;
}
......@@ -876,11 +876,11 @@ LinphoneConferenceServer* linphone_conference_server_new(const char *rc_file, bo
LinphoneConferenceServer *conf_srv = (LinphoneConferenceServer *)ms_new0(LinphoneConferenceServer, 1);
LinphoneCoreManager *lm = (LinphoneCoreManager *)conf_srv;
LinphoneProxyConfig *proxy;
conf_srv->vtable = linphone_core_v_table_new();
conf_srv->vtable->call_state_changed = linphone_conference_server_call_state_changed;
conf_srv->vtable->refer_received = linphone_conference_server_refer_received;
conf_srv->vtable->registration_state_changed = linphone_conference_server_registration_state_changed;
conf_srv->vtable->user_data = conf_srv;
conf_srv->cbs = linphone_factory_create_core_cbs(linphone_factory_get());
linphone_core_cbs_set_call_state_changed(conf_srv->cbs, linphone_conference_server_call_state_changed);
linphone_core_cbs_set_refer_received(conf_srv->cbs, linphone_conference_server_refer_received);
linphone_core_cbs_set_registration_state_changed(conf_srv->cbs, linphone_conference_server_registration_state_changed);
linphone_core_cbs_set_user_data(conf_srv->cbs, conf_srv);
conf_srv->reg_state = LinphoneRegistrationNone;
linphone_core_manager_init(lm, rc_file,NULL);
if (!do_registration) {
......@@ -889,7 +889,7 @@ LinphoneConferenceServer* linphone_conference_server_new(const char *rc_file, bo
linphone_proxy_config_enable_register(proxy,FALSE);
linphone_proxy_config_done(proxy);
}
linphone_core_add_listener(lm->lc, conf_srv->vtable);
linphone_core_add_callbacks(lm->lc, conf_srv->cbs);
linphone_core_manager_start(lm, do_registration);
return conf_srv;
}
......
......@@ -268,12 +268,12 @@ static void friend_list_removed_cb(LinphoneCore *lc, LinphoneFriendList *list) {
}
static void friends_sqlite_storage(void) {
LinphoneCoreVTable *v_table = linphone_core_v_table_new();
LinphoneCore* lc = NULL;
LinphoneCoreCbs *cbs;
LinphoneFriendList *lfl = NULL;
LinphoneFriend *lf = NULL;
LinphoneFriend *lf2 = NULL;
LinphoneVcard *lvc = linphone_vcard_new();
LinphoneVcard *lvc = linphone_factory_create_vcard(linphone_factory_get());
LinphoneAddress *addr = linphone_address_new("sip:sylvain@sip.linphone.org");
const bctbx_list_t *friends = NULL;
bctbx_list_t *friends_from_db = NULL;
......@@ -283,9 +283,11 @@ static void friends_sqlite_storage(void) {
const LinphoneAddress *laddress = NULL, *laddress2 = NULL;
char *address = NULL, *address2 = NULL;
v_table->friend_list_created = friend_list_created_cb;
v_table->friend_list_removed = friend_list_removed_cb;
lc = linphone_core_new(v_table, NULL, NULL, NULL);
cbs = linphone_factory_create_core_cbs(linphone_factory_get());
linphone_core_cbs_set_friend_list_created(cbs, friend_list_created_cb);
linphone_core_cbs_set_friend_list_removed(cbs, friend_list_removed_cb);
lc = linphone_factory_create_core(linphone_factory_get(), cbs, NULL, NULL);
linphone_core_cbs_unref(cbs);
friends = linphone_friend_list_get_friends(linphone_core_get_default_friend_list(lc));
lfl = linphone_core_create_friend_list(lc);
linphone_friend_list_set_user_data(lfl, stats);
......@@ -369,15 +371,13 @@ static void friends_sqlite_storage(void) {
end:
ms_free(stats);
linphone_address_unref(addr);
linphone_core_destroy(lc);
linphone_core_v_table_destroy(v_table);
linphone_core_unref(lc);
unlink(friends_db);
bc_free(friends_db);
}
static void friends_sqlite_store_lot_of_friends(void) {
LinphoneCoreVTable *v_table = linphone_core_v_table_new();
LinphoneCore* lc = linphone_core_new(v_table, NULL, NULL, NULL);
LinphoneCore* lc = linphone_factory_create_core(linphone_factory_get(), NULL, NULL, NULL);
sqlite3 *db;
int i;
char* errmsg = NULL;
......@@ -439,13 +439,11 @@ static void friends_sqlite_store_lot_of_friends(void) {
ret = sqlite3_exec(db,"END",0,0,&errmsg);
BC_ASSERT_TRUE(ret ==SQLITE_OK);
sqlite3_close(db);
linphone_core_destroy(lc);
linphone_core_v_table_destroy(v_table);
linphone_core_unref(lc);
}
static void friends_sqlite_find_friend_in_lot_of_friends(void) {
LinphoneCoreVTable *v_table = linphone_core_v_table_new();
LinphoneCore* lc = linphone_core_new(v_table, NULL, NULL, NULL);
LinphoneCore* lc = linphone_factory_create_core(linphone_factory_get(), NULL, NULL, NULL);
sqlite3 *db;
int i;
char* errmsg = NULL;
......@@ -521,8 +519,7 @@ static void friends_sqlite_find_friend_in_lot_of_friends(void) {
ret = sqlite3_exec(db,"END",0,0,&errmsg);
BC_ASSERT_TRUE(ret ==SQLITE_OK);
sqlite3_close(db);
linphone_core_destroy(lc);
linphone_core_v_table_destroy(v_table);
linphone_core_unref(lc);
}