Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
liblinphone
Commits
a8418666
Commit
a8418666
authored
Mar 20, 2017
by
Ghislain MARY
Browse files
Fix deprecation warnings.
parent
a570c27e
Changes
22
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
96 additions
and
100 deletions
+96
-100
console/commands.c
console/commands.c
+1
-1
console/linphonec.c
console/linphonec.c
+1
-1
coreapi/authentication.c
coreapi/authentication.c
+3
-3
coreapi/callbacks.c
coreapi/callbacks.c
+2
-2
coreapi/carddav.c
coreapi/carddav.c
+1
-1
coreapi/info.c
coreapi/info.c
+1
-1
coreapi/linphonecore.c
coreapi/linphonecore.c
+5
-5
daemon/commands/register.cc
daemon/commands/register.cc
+1
-1
tester/accountmanager.c
tester/accountmanager.c
+3
-3
tester/call_single_tester.c
tester/call_single_tester.c
+13
-5
tester/flexisip_tester.c
tester/flexisip_tester.c
+4
-4
tester/liblinphone_tester.h
tester/liblinphone_tester.h
+1
-1
tester/log_collection_tester.c
tester/log_collection_tester.c
+4
-3
tester/message_tester.c
tester/message_tester.c
+2
-2
tester/offeranswer_tester.c
tester/offeranswer_tester.c
+2
-3
tester/quality_reporting_tester.c
tester/quality_reporting_tester.c
+4
-3
tester/register_tester.c
tester/register_tester.c
+25
-29
tester/setup_tester.c
tester/setup_tester.c
+9
-18
tester/stun_tester.c
tester/stun_tester.c
+1
-1
tester/tester.c
tester/tester.c
+13
-13
No files found.
console/commands.c
View file @
a8418666
...
...
@@ -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
);
...
...
console/linphonec.c
View file @
a8418666
...
...
@@ -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
...
...
coreapi/authentication.c
View file @
a8418666
...
...
@@ -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
);
...
...
coreapi/callbacks.c
View file @
a8418666
...
...
@@ -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
))
{
...
...
coreapi/carddav.c
View file @
a8418666
...
...
@@ -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
);
...
...
coreapi/info.c
View file @
a8418666
...
...
@@ -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
(
LinphoneI
nfo
M
essage
,
1
);
LinphoneInfoMessage
*
info
=
linphone_core_create_i
nfo
_m
essage
(
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
);
...
...
coreapi/linphonecore.c
View file @
a8418666
...
...
@@ -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_
f
re
e
(
params2
);
linphone_conference_params_
un
re
f
(
params2
);
return
NULL
;
}
linphone_conference_params_
f
re
e
(
params2
);
linphone_conference_params_
un
re
f
(
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_
f
re
e
(
params
);
linphone_conference_params_
un
re
f
(
params
);
}
if
(
conference
)
return
linphone_conference_add_participant
(
lc
->
conf_ctx
,
call
);
else
return
-
1
;
...
...
daemon/commands/register.cc
View file @
a8418666
...
...
@@ -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
);
...
...
tester/accountmanager.c
View file @
a8418666
...
...
@@ -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
;
...
...
tester/call_single_tester.c
View file @
a8418666
...
...
@@ -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
);
}
...
...
tester/flexisip_tester.c
View file @
a8418666
...
...
@@ -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
;
LinphoneCore
VTable
*
vtable
=
linphone_core_v_table_new
(
);
LinphoneCore
Cbs
*
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
)
{
...
...
tester/liblinphone_tester.h
View file @
a8418666
...
...
@@ -276,7 +276,7 @@ typedef struct _LinphoneCoreManager {
typedef
struct
_LinphoneConferenceServer
{
LinphoneCoreManager
base
;
LinphoneCall
*
first_call
;
LinphoneCore
VTable
*
vtable
;
LinphoneCore
Cbs
*
cbs
;
LinphoneRegistrationState
reg_state
;
}
LinphoneConferenceServer
;
...
...
tester/log_collection_tester.c
View file @
a8418666
...
...
@@ -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"
);
...
...
tester/message_tester.c
View file @
a8418666
...
...
@@ -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
));
...
...
tester/offeranswer_tester.c
View file @
a8418666
...
...
@@ -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
){
...
...
tester/quality_reporting_tester.c
View file @
a8418666
...
...
@@ -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"
);
...
...
tester/register_tester.c
View file @
a8418666
...
...
@@ -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
;
LinphoneCore
VTable
*
vtable
=
linphone_core_v_table_new
(
);
LinphoneCore
Cbs
*
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
;
LinphoneCore
VTable
*
vtable
=
linphone_core_v_table_new
(
);
LinphoneCore
Cbs
*
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
;
LinphoneCore
VTable
*
vtable
=
linphone_core_v_table_new
(
);
LinphoneCore
Cbs
*
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
;
...
...
tester/setup_tester.c
View file @
a8418666
...
...
@@ -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
)
{
...
...
tester/stun_tester.c
View file @
a8418666
...
...
@@ -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
)
{
...
...
tester/tester.c
View file @
a8418666
...
...
@@ -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
);