tester: change transport_supported to not take linphonecore argument since we dont need it

parent 1f49ce76
This diff is collapsed.
This diff is collapsed.
......@@ -299,7 +299,7 @@ void end_call(LinphoneCoreManager *m1, LinphoneCoreManager *m2);
void disable_all_audio_codecs_except_one(LinphoneCore *lc, const char *mime, int rate);
void disable_all_video_codecs_except_one(LinphoneCore *lc, const char *mime);
stats * get_stats(LinphoneCore *lc);
bool_t transport_supported(LinphoneCore *lc, LinphoneTransportType transport);
bool_t transport_supported(LinphoneTransportType transport);
LinphoneCoreManager *get_manager(LinphoneCore *lc);
const char *liblinphone_tester_get_subscribe_content(void);
const char *liblinphone_tester_get_notify_content(void);
......
......@@ -290,8 +290,8 @@ static void logCollectionUploadStateChangedCb(LinphoneCore *lc, LinphoneCoreLogC
}
}
static void upload_collected_traces() {
LinphoneCoreManager* marie = setup(TRUE);
if (transport_supported(marie->lc, LinphoneTransportTls)) {
if (transport_supported(LinphoneTransportTls)) {
LinphoneCoreManager* marie = setup(TRUE);
int waiting = 100;
LinphoneCoreVTable *v_table = linphone_core_v_table_new();
v_table->log_collection_upload_state_changed = logCollectionUploadStateChangedCb;
......@@ -312,8 +312,8 @@ static void upload_collected_traces() {
linphone_core_compress_log_collection(marie->lc);
linphone_core_upload_log_collection(marie->lc);
BC_ASSERT_TRUE(wait_for(marie->lc,marie->lc,&marie->stat.number_of_LinphoneCoreLogCollectionUploadStateDelivered,2));
collect_cleanup(marie);
}
collect_cleanup(marie);
}
test_t log_collection_tests[] = {
......
......@@ -441,8 +441,8 @@ bool_t compare_files(const char *path1, const char *path2) {
}
static void file_transfer_message(void) {
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
if (transport_supported(marie->lc, LinphoneTransportTls)) {
if (transport_supported(LinphoneTransportTls)) {
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
char* to;
LinphoneChatRoom* chat_room;
LinphoneChatMessage* message;
......@@ -506,15 +506,15 @@ static void file_transfer_message(void) {
linphone_core_manager_destroy(pauline);
ms_free(send_filepath);
ms_free(receive_filepath);
linphone_core_manager_destroy(marie);
}
linphone_core_manager_destroy(marie);
}
/* same than previous but with a 160 characters file */
#define SMALL_FILE_SIZE 160
static void small_file_transfer_message(void) {
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
if (transport_supported(marie->lc, LinphoneTransportTls)) {
if (transport_supported(LinphoneTransportTls)) {
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
int i;
char* to;
LinphoneChatRoom* chat_room;
......@@ -571,8 +571,8 @@ static void small_file_transfer_message(void) {
linphone_content_unref(content);
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(marie);
}
linphone_core_manager_destroy(marie);
}
#ifdef HAVE_LIME
......@@ -915,8 +915,8 @@ static void lime_text_message(void) {
#endif /* HAVE_LIME */
static void file_transfer_message_io_error_upload(void) {
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
if (transport_supported(marie->lc, LinphoneTransportTls)) {
if (transport_supported(LinphoneTransportTls)) {
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
int i;
char* to;
LinphoneChatRoom* chat_room;
......@@ -978,15 +978,15 @@ static void file_transfer_message_io_error_upload(void) {
linphone_content_unref(content);
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(marie);
}
linphone_core_manager_destroy(marie);
}
#ifdef TEST_IS_BUGGED_NO_CALL_TO_IO_ERROR_CALLBACK
static void file_transfer_message_io_error_download(void) {
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
if (transport_supported(marie->lc, LinphoneTransportTls)) {
if (transport_supported(LinphoneTransportTls)) {
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
int i;
char* to;
LinphoneChatRoom* chat_room;
......@@ -1047,14 +1047,14 @@ static void file_transfer_message_io_error_download(void) {
sal_set_recv_error(marie->lc->sal, 0);
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(marie);
}
linphone_core_manager_destroy(marie);
}
#endif
static void file_transfer_message_upload_cancelled(void) {
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
if (transport_supported(marie->lc, LinphoneTransportTls)) {
if (transport_supported(LinphoneTransportTls)) {
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
int i;
char* to;
LinphoneChatRoom* chat_room;
......@@ -1111,8 +1111,8 @@ static void file_transfer_message_upload_cancelled(void) {
linphone_content_unref(content);
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(marie);
}
linphone_core_manager_destroy(marie);
}
static void file_transfer_message_download_cancelled(void) {
......@@ -1182,8 +1182,8 @@ static void file_transfer_message_download_cancelled(void) {
}
static void file_transfer_using_external_body_url(void) {
LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc");
if (transport_supported(marie->lc, LinphoneTransportTls)) {
if (transport_supported(LinphoneTransportTls)) {
LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc");
char *to;
LinphoneChatMessageCbs *cbs;
LinphoneChatRoom *chat_room;
......@@ -1216,13 +1216,13 @@ static void file_transfer_using_external_body_url(void) {
BC_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &pauline->stat.number_of_LinphoneMessageInProgress, 1));
ms_free(to);
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(marie);
}
linphone_core_manager_destroy(marie);
}
static void file_transfer_message_two_messages() {
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
if (transport_supported(marie->lc, LinphoneTransportTls)) {
if (transport_supported(LinphoneTransportTls)) {
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
char* to;
LinphoneChatRoom* pauline_room;
LinphoneChatMessage* message;
......@@ -1304,8 +1304,8 @@ static void file_transfer_message_two_messages() {
linphone_core_manager_destroy(pauline);
ms_free(send_filepath);
ms_free(receive_filepath);
linphone_core_manager_destroy(marie);
}
linphone_core_manager_destroy(marie);
}
static void text_message_with_send_error(void) {
......@@ -1444,8 +1444,8 @@ static void info_message_with_args(bool_t with_content) {
if (linphone_content_get_buffer(content))BC_ASSERT_TRUE(strcmp((const char*)linphone_content_get_buffer(content),info_content)==0);
BC_ASSERT_EQUAL(linphone_content_get_size(content),strlen(info_content), int, "%d");
}
linphone_core_manager_destroy(marie);
}
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
}
......@@ -1613,8 +1613,8 @@ static void history_range_full_test(){
history_message_count_helper(chatroom, -1, 3, 4);
history_message_count_helper(chatroom, -2, 2, 3);
history_message_count_helper(chatroom, -3, 1, 2);
linphone_core_manager_destroy(marie);
}
linphone_core_manager_destroy(marie);
linphone_address_destroy(jehan_addr);
remove(tmp_db);
}
......@@ -1672,8 +1672,8 @@ static void history_messages_count() {
messages = linphone_chat_room_get_history_range(chatroom, 1265, 1260);
BC_ASSERT_EQUAL(ms_list_size(messages), 1270-1265, int, "%d");
ms_list_free_with_data(messages, (void (*)(void*))linphone_chat_message_unref);
linphone_core_manager_destroy(marie);
}
linphone_core_manager_destroy(marie);
linphone_address_destroy(jehan_addr);
remove(tmp_db);
}
......
......@@ -294,13 +294,13 @@ static void simple_tcp_register_compatibility_mode(){
}
static void simple_tls_register(){
char route[256];
LinphoneCoreManager* lcm = create_lcm();
if (transport_supported(lcm->lc,LinphoneTransportTls)) {
if (transport_supported(LinphoneTransportTls)) {
char route[256];
LinphoneCoreManager* lcm = create_lcm();
sprintf(route,"sip:%s;transport=tls",test_route);
register_with_refresh(lcm,FALSE,test_domain,route);
linphone_core_manager_destroy(lcm);
}
linphone_core_manager_destroy(lcm);
}
......@@ -458,14 +458,13 @@ static void authenticated_register_with_wrong_credentials_without_403() {
authenticated_register_with_wrong_credentials_with_params("tester-no-403");
}
static LinphoneCoreManager* configure_lcm(void) {
LinphoneCoreManager *lcm=linphone_core_manager_new2( "multi_account_rc", FALSE);
if (transport_supported(lcm->lc,LinphoneTransportTls)) {
if (transport_supported(LinphoneTransportTls)) {
LinphoneCoreManager *lcm=linphone_core_manager_new2( "multi_account_rc", FALSE);
stats *counters=&lcm->stat;
BC_ASSERT_TRUE(wait_for(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationOk,ms_list_size(linphone_core_get_proxy_config_list(lcm->lc))));
BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,0, int, "%d");
return lcm;
}
linphone_core_manager_destroy(lcm);
return NULL;
}
......@@ -685,15 +684,14 @@ static void io_recv_error_retry_immediatly(){
}
static void io_recv_error_late_recovery(){
LinphoneCoreManager *lcm;
LinphoneCore* lc;
int register_ok;
stats* counters ;
int number_of_udp_proxy=0;
MSList* lcs;
lcm=linphone_core_manager_new2( "multi_account_rc",FALSE); /*to make sure iterates are not call yet*/
if (transport_supported(lcm->lc, LinphoneTransportTls)) {
if (transport_supported(LinphoneTransportTls)) {
LinphoneCoreManager *lcm;
LinphoneCore* lc;
int register_ok;
stats* counters ;
int number_of_udp_proxy=0;
MSList* lcs;
lcm=linphone_core_manager_new2( "multi_account_rc",FALSE); /*to make sure iterates are not call yet*/
lc=lcm->lc;
sal_set_refresher_retry_after(lc->sal,1000);
counters=&lcm->stat;
......@@ -716,8 +714,8 @@ static void io_recv_error_late_recovery(){
sal_set_send_error(lc->sal, 0);
BC_ASSERT_TRUE(wait_for_list(lcs=ms_list_append(NULL,lc),&counters->number_of_LinphoneRegistrationOk,register_ok-number_of_udp_proxy +register_ok,sal_get_refresher_retry_after(lc->sal)+3000));
linphone_core_manager_destroy(lcm);
}
linphone_core_manager_destroy(lcm);
}
static void io_recv_error_without_active_register(){
......@@ -761,13 +759,13 @@ static void io_recv_error_without_active_register(){
static void tls_certificate_failure(){
LinphoneCoreManager* lcm;
LinphoneCore *lc;
char rootcapath[256];
if (transport_supported(LinphoneTransportTls)) {
LinphoneCoreManager* lcm;
LinphoneCore *lc;
char rootcapath[256];
lcm=linphone_core_manager_new2("pauline_rc",FALSE);
lc=lcm->lc;
if (transport_supported(lc,LinphoneTransportTls)) {
lcm=linphone_core_manager_new2("pauline_rc",FALSE);
lc=lcm->lc;
snprintf(rootcapath,sizeof(rootcapath), "%s/certificates/cn/agent.pem", bc_tester_read_dir_prefix); /*bad root ca*/
linphone_core_set_root_ca(lcm->lc,rootcapath);
linphone_core_set_network_reachable(lc,TRUE);
......@@ -780,21 +778,21 @@ static void tls_certificate_failure(){
linphone_core_refresh_registers(lcm->lc);
BC_ASSERT_TRUE(wait_for(lc,lc,&lcm->stat.number_of_LinphoneRegistrationOk,1));
BC_ASSERT_EQUAL(lcm->stat.number_of_LinphoneRegistrationFailed,2, int, "%d");
linphone_core_manager_destroy(lcm);
}
linphone_core_manager_destroy(lcm);
}
/*the purpose of this test is to check that will not block the proxy config during SSL handshake for entire life in case of mistaken configuration*/
static void tls_with_non_tls_server(){
LinphoneCoreManager *lcm;
LinphoneProxyConfig* proxy_cfg;
LinphoneAddress* addr;
char tmp[256];
LinphoneCore *lc;
lcm=linphone_core_manager_new2( "marie_rc", 0);
lc=lcm->lc;
if (transport_supported(lc,LinphoneTransportTls)) {
if (transport_supported(LinphoneTransportTls)) {
LinphoneCoreManager *lcm;
LinphoneProxyConfig* proxy_cfg;
LinphoneAddress* addr;
char tmp[256];
LinphoneCore *lc;
lcm=linphone_core_manager_new2( "marie_rc", 0);
lc=lcm->lc;
sal_set_transport_timeout(lc->sal,3000);
linphone_core_get_default_proxy(lc,&proxy_cfg);
linphone_proxy_config_edit(proxy_cfg);
......@@ -805,42 +803,42 @@ static void tls_with_non_tls_server(){
linphone_proxy_config_done(proxy_cfg);
linphone_address_destroy(addr);
BC_ASSERT_TRUE(wait_for_until(lc,lc,&lcm->stat.number_of_LinphoneRegistrationFailed,1,5000));
linphone_core_manager_destroy(lcm);
}
linphone_core_manager_destroy(lcm);
}
static void tls_alt_name_register(){
LinphoneCoreManager* lcm;
LinphoneCore *lc;
char rootcapath[256];
if (transport_supported(LinphoneTransportTls)) {
LinphoneCoreManager* lcm;
LinphoneCore *lc;
char rootcapath[256];
lcm=linphone_core_manager_new2("pauline_alt_rc",FALSE);
lc=lcm->lc;
if (transport_supported(lc,LinphoneTransportTls)) {
lcm=linphone_core_manager_new2("pauline_alt_rc",FALSE);
lc=lcm->lc;
snprintf(rootcapath,sizeof(rootcapath), "%s/certificates/cn/cafile.pem", bc_tester_read_dir_prefix);
linphone_core_set_root_ca(lc,rootcapath);
linphone_core_refresh_registers(lc);
BC_ASSERT_TRUE(wait_for(lc,lc,&lcm->stat.number_of_LinphoneRegistrationOk,1));
BC_ASSERT_EQUAL(lcm->stat.number_of_LinphoneRegistrationFailed,0, int, "%d");
linphone_core_manager_destroy(lcm);
}
linphone_core_manager_destroy(lcm);
}
static void tls_wildcard_register(){
LinphoneCoreManager* lcm;
LinphoneCore *lc;
char rootcapath[256];
if (transport_supported(LinphoneTransportTls)) {
LinphoneCoreManager* lcm;
LinphoneCore *lc;
char rootcapath[256];
lcm=linphone_core_manager_new2("pauline_wild_rc",FALSE);
lc=lcm->lc;
if (transport_supported(lc,LinphoneTransportTls)) {
lcm=linphone_core_manager_new2("pauline_wild_rc",FALSE);
lc=lcm->lc;
snprintf(rootcapath,sizeof(rootcapath), "%s/certificates/cn/cafile.pem", bc_tester_read_dir_prefix);
linphone_core_set_root_ca(lc,rootcapath);
linphone_core_refresh_registers(lc);
BC_ASSERT_TRUE(wait_for(lc,lc,&lcm->stat.number_of_LinphoneRegistrationOk,2));
BC_ASSERT_EQUAL(lcm->stat.number_of_LinphoneRegistrationFailed,0, int, "%d");
linphone_core_manager_destroy(lcm);
}
linphone_core_manager_destroy(lcm);
}
static void redirect(){
......
......@@ -58,12 +58,12 @@ static void remote_provisioning_transient(void) {
}
static void remote_provisioning_https(void) {
LinphoneCoreManager* marie = linphone_core_manager_new2("marie_remote_https_rc", FALSE);
if (transport_supported(marie->lc, LinphoneTransportTls)) {
if (transport_supported(LinphoneTransportTls)) {
LinphoneCoreManager* marie = linphone_core_manager_new2("marie_remote_https_rc", FALSE);
BC_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringSuccessful,1));
BC_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneRegistrationOk,1));
linphone_core_manager_destroy(marie);
}
linphone_core_manager_destroy(marie);
}
static void remote_provisioning_not_found(void) {
......
......@@ -225,8 +225,9 @@ LinphoneCoreManager *get_manager(LinphoneCore *lc){
return manager;
}
bool_t transport_supported(LinphoneCore *lc, LinphoneTransportType transport) {
bool_t supported = linphone_core_sip_transport_supported(lc, transport);
bool_t transport_supported(LinphoneTransportType transport) {
Sal *sal = sal_init();
bool_t supported = sal_transport_available(sal,(SalTransport)transport);
if (!supported) ms_warning("TLS transport not supported, falling back to TCP if possible otherwise skipping test.");
return supported;
}
......@@ -287,7 +288,7 @@ LinphoneCoreManager* linphone_core_manager_init(const char* rc_file) {
char hellopath[512];
char *recordpath = ms_strdup_printf("%s/record_for_lc_%p.wav",bc_tester_writable_dir_prefix,mgr->lc);
ms_message("Manager for '%s' using files", rc_file ? rc_file : "--");
linphone_core_use_files(mgr->lc, TRUE);
linphone_core_set_use_files(mgr->lc, TRUE);
snprintf(hellopath,sizeof(hellopath), "%s/sounds/hello8000.wav", bc_tester_read_dir_prefix);
linphone_core_set_play_file(mgr->lc,hellopath);
linphone_core_set_record_file(mgr->lc,recordpath);
......
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