register_tester.c 33 KB
Newer Older
jehan's avatar
jehan committed
1 2 3 4 5 6
/*
	belle-sip - SIP (RFC3261) library.
    Copyright (C) 2010  Belledonne Communications SARL

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
Simon Morlat's avatar
Simon Morlat committed
7
    the Free Software Foundation, either version 2 of the License, or
jehan's avatar
jehan committed
8 9 10 11 12 13 14 15 16 17
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
Ghislain MARY's avatar
Ghislain MARY committed
18

jehan's avatar
jehan committed
19 20 21 22 23 24
#include <stdio.h>
#include "CUnit/Basic.h"
#include "linphonecore.h"
#include "private.h"
#include "liblinphone_tester.h"

25 26 27 28 29 30 31 32 33 34


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); /*create authentication structure from identity*/
	linphone_core_add_auth_info(lc,info); /*add authentication info to LinphoneCore*/
}



35
static LinphoneCoreManager* create_lcm_with_auth(unsigned int with_auth) {
Simon Morlat's avatar
Simon Morlat committed
36
	LinphoneCoreManager* mgr=linphone_core_manager_new(NULL);
37 38
	
	if (with_auth) {
39
		LinphoneCoreVTable* vtable = linphone_core_v_table_new();
40 41
		vtable->auth_info_requested=auth_info_requested;
		linphone_core_add_listener(mgr->lc,vtable);
42 43 44 45 46 47
	}
	
	/*to allow testing with 127.0.0.1*/
	linphone_core_set_network_reachable(mgr->lc,TRUE);
	return mgr;
}
jehan's avatar
jehan committed
48

49 50
static LinphoneCoreManager* create_lcm() {
	return create_lcm_with_auth(0);
jehan's avatar
jehan committed
51 52 53
}

void registration_state_changed(struct _LinphoneCore *lc, LinphoneProxyConfig *cfg, LinphoneRegistrationState cstate, const char *message){
54
		stats* counters;
jehan's avatar
jehan committed
55 56 57 58
		ms_message("New registration state %s for user id [%s] at proxy [%s]\n"
				,linphone_registration_state_to_string(cstate)
				,linphone_proxy_config_get_identity(cfg)
				,linphone_proxy_config_get_addr(cfg));
59
		counters = get_stats(lc);
jehan's avatar
jehan committed
60 61 62 63 64 65 66 67 68 69 70
		switch (cstate) {
		case LinphoneRegistrationNone:counters->number_of_LinphoneRegistrationNone++;break;
		case LinphoneRegistrationProgress:counters->number_of_LinphoneRegistrationProgress++;break;
		case LinphoneRegistrationOk:counters->number_of_LinphoneRegistrationOk++;break;
		case LinphoneRegistrationCleared:counters->number_of_LinphoneRegistrationCleared++;break;
		case LinphoneRegistrationFailed:counters->number_of_LinphoneRegistrationFailed++;break;
		default:
			CU_FAIL("unexpected event");break;
		}

}
Ghislain MARY's avatar
Ghislain MARY committed
71

72 73 74 75 76 77 78
static void register_with_refresh_base_3(LinphoneCore* lc
											, bool_t refresh
											,const char* domain
											,const char* route
											,bool_t late_auth_info
											,LCSipTransports transport
											,LinphoneRegistrationState expected_final_state) {
jehan's avatar
jehan committed
79
	int retry=0;
Simon Morlat's avatar
Simon Morlat committed
80
	char* addr;
81 82 83 84 85 86
	LinphoneProxyConfig* proxy_cfg;
	stats* counters;
	LinphoneAddress *from;
	const char* server_addr;
	LinphoneAuthInfo *info;

jehan's avatar
jehan committed
87 88
	CU_ASSERT_PTR_NOT_NULL(lc);
	if (!lc) return;
89
	counters = get_stats(lc);
jehan's avatar
jehan committed
90 91 92 93 94
	reset_counters(counters);
	linphone_core_set_sip_transports(lc,&transport);

	proxy_cfg = linphone_proxy_config_new();

95
	from = create_linphone_address(domain);
jehan's avatar
jehan committed
96

97 98
	linphone_proxy_config_set_identity(proxy_cfg,addr=linphone_address_as_string(from));
	ms_free(addr);
99
	server_addr = linphone_address_get_domain(from);
jehan's avatar
jehan committed
100 101

	linphone_proxy_config_enable_register(proxy_cfg,TRUE);
102
	linphone_proxy_config_set_expires(proxy_cfg,1);
jehan's avatar
jehan committed
103 104 105 106 107 108 109 110 111 112 113
	if (route) {
		linphone_proxy_config_set_route(proxy_cfg,route);
		linphone_proxy_config_set_server_addr(proxy_cfg,route);
	} else {
		linphone_proxy_config_set_server_addr(proxy_cfg,server_addr);
	}
	linphone_address_destroy(from);

	linphone_core_add_proxy_config(lc,proxy_cfg);
	linphone_core_set_default_proxy(lc,proxy_cfg);

114 115
	while (counters->number_of_LinphoneRegistrationOk<1+(refresh!=0)
			&& retry++ <(110 /*only wait 11 s if final state is progress*/+(expected_final_state==LinphoneRegistrationProgress?0:200))) {
jehan's avatar
jehan committed
116
		linphone_core_iterate(lc);
jehan's avatar
jehan committed
117
		if (counters->number_of_auth_info_requested>0 && linphone_proxy_config_get_state(proxy_cfg) == LinphoneRegistrationFailed && late_auth_info) {
118
			if (!linphone_core_get_auth_info_list(lc)) {
jehan's avatar
jehan committed
119
				CU_ASSERT_EQUAL(linphone_proxy_config_get_error(proxy_cfg),LinphoneReasonUnauthorized);
120
				info=linphone_auth_info_new(test_username,NULL,test_password,NULL,auth_domain,NULL); /*create authentication structure from identity*/
121 122
				linphone_core_add_auth_info(lc,info); /*add authentication info to LinphoneCore*/
			}
jehan's avatar
jehan committed
123
		}
124 125
		if (linphone_proxy_config_get_error(proxy_cfg) == LinphoneReasonBadCredentials
				|| (counters->number_of_auth_info_requested>2 &&linphone_proxy_config_get_error(proxy_cfg) == LinphoneReasonUnauthorized)) /*no need to continue if auth cannot be found*/
126
			break; /*no need to continue*/
jehan's avatar
jehan committed
127 128
		ms_usleep(100000);
	}
129
	CU_ASSERT_EQUAL(linphone_proxy_config_is_registered(proxy_cfg),(expected_final_state == LinphoneRegistrationOk));
jehan's avatar
jehan committed
130
	CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationNone,0);
131 132 133 134 135 136
	CU_ASSERT_TRUE(counters->number_of_LinphoneRegistrationProgress>=1);
	if (expected_final_state == LinphoneRegistrationOk) {
		CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationOk,1+(refresh!=0));
		CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,late_auth_info?1:0);
	} else
		/*checking to be done outside this functions*/
jehan's avatar
jehan committed
137 138 139
	CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationCleared,0);

}
Ghislain MARY's avatar
Ghislain MARY committed
140

141 142 143 144 145 146 147 148
static void register_with_refresh_base_2(LinphoneCore* lc
											, bool_t refresh
											,const char* domain
											,const char* route
											,bool_t late_auth_info
											,LCSipTransports transport) {
	register_with_refresh_base_3(lc, refresh, domain, route, late_auth_info, transport,LinphoneRegistrationOk );
}
jehan's avatar
jehan committed
149
static void register_with_refresh_base(LinphoneCore* lc, bool_t refresh,const char* domain,const char* route) {
150 151
	LCSipTransports transport = {5070,5070,0,5071};
	register_with_refresh_base_2(lc,refresh,domain,route,FALSE,transport);
jehan's avatar
jehan committed
152
}
Ghislain MARY's avatar
Ghislain MARY committed
153

154 155 156 157
static void register_with_refresh(LinphoneCoreManager* lcm, bool_t refresh,const char* domain,const char* route) {
	stats* counters = &lcm->stat;
	register_with_refresh_base(lcm->lc,refresh,domain,route);
	linphone_core_manager_stop(lcm);
jehan's avatar
jehan committed
158 159 160
	CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationCleared,1);
}

161
static void register_with_refresh_with_send_error() {
jehan's avatar
jehan committed
162
	int retry=0;
163 164
	LinphoneCoreManager* lcm = create_lcm_with_auth(1);
	stats* counters = &lcm->stat;
165
	LinphoneAuthInfo *info=linphone_auth_info_new(test_username,NULL,test_password,NULL,auth_domain,NULL); /*create authentication structure from identity*/
166 167
	char route[256];
	sprintf(route,"sip:%s",test_route);
168
	linphone_core_add_auth_info(lcm->lc,info); /*add authentication info to LinphoneCore*/
jehan's avatar
jehan committed
169

170
	register_with_refresh_base(lcm->lc,TRUE,auth_domain,route);
jehan's avatar
jehan committed
171
	/*simultate a network error*/
172
	sal_set_send_error(lcm->lc->sal, -1);
173
	while (counters->number_of_LinphoneRegistrationProgress<2 && retry++ <20) {
174
			linphone_core_iterate(lcm->lc);
jehan's avatar
jehan committed
175 176
			ms_usleep(100000);
	}
177 178
	CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,0);
	CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationProgress,2);
jehan's avatar
jehan committed
179 180 181

	CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationCleared,0);

182
	linphone_core_manager_destroy(lcm);
jehan's avatar
jehan committed
183
}
Ghislain MARY's avatar
Ghislain MARY committed
184

jehan's avatar
jehan committed
185
static void simple_register(){
186 187 188
	LinphoneCoreManager* lcm = create_lcm();
	stats* counters = &lcm->stat;
	register_with_refresh(lcm,FALSE,NULL,NULL);
jehan's avatar
jehan committed
189
	CU_ASSERT_EQUAL(counters->number_of_auth_info_requested,0);
190
	linphone_core_manager_destroy(lcm);
jehan's avatar
jehan committed
191 192
}

193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238
static void simple_unregister(){
	LinphoneCoreManager* lcm = create_lcm();
	stats* counters = &lcm->stat;
	LinphoneProxyConfig* proxy_config;
	register_with_refresh_base(lcm->lc,FALSE,NULL,NULL);

	linphone_core_get_default_proxy(lcm->lc,&proxy_config);

	linphone_proxy_config_edit(proxy_config);
	reset_counters(counters); /*clear stats*/

	/*nothing is supposed to arrive until done*/
	CU_ASSERT_FALSE(wait_for_until(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationCleared,1,3000));
	linphone_proxy_config_enable_register(proxy_config,FALSE);
	linphone_proxy_config_done(proxy_config);
	CU_ASSERT_TRUE(wait_for(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationCleared,1));
	linphone_core_manager_destroy(lcm);
}

static void change_expires(){
	LinphoneCoreManager* lcm = create_lcm();
	stats* counters = &lcm->stat;
	LinphoneProxyConfig* proxy_config;
	register_with_refresh_base(lcm->lc,FALSE,NULL,NULL);

	linphone_core_get_default_proxy(lcm->lc,&proxy_config);

	linphone_proxy_config_edit(proxy_config);
	reset_counters(counters); /*clear stats*/

	/*nothing is supposed to arrive until done*/
	CU_ASSERT_FALSE(wait_for_until(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationCleared,1,3000));

	linphone_proxy_config_set_expires(proxy_config,3);

	linphone_proxy_config_done(proxy_config);
	CU_ASSERT_TRUE(wait_for(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationOk,1));
	/*wait 2s without receive refresh*/
	CU_ASSERT_FALSE(wait_for_until(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationOk,2,2000));
	/* now, it should be ok*/
	CU_ASSERT_TRUE(wait_for(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationOk,2));


	linphone_core_manager_destroy(lcm);
}

jehan's avatar
jehan committed
239 240
/*take care of min expires configuration from server*/
static void simple_register_with_refresh() {
241 242 243
	LinphoneCoreManager* lcm = create_lcm();
	stats* counters = &lcm->stat;
	register_with_refresh(lcm,TRUE,NULL,NULL);
jehan's avatar
jehan committed
244
	CU_ASSERT_EQUAL(counters->number_of_auth_info_requested,0);
245
	linphone_core_manager_destroy(lcm);
jehan's avatar
jehan committed
246 247 248
}

static void simple_auth_register_with_refresh() {
249 250
	LinphoneCoreManager* lcm = create_lcm_with_auth(1);
	stats* counters = &lcm->stat;
251 252
	char route[256];
	sprintf(route,"sip:%s",test_route);
253
	register_with_refresh(lcm,TRUE,auth_domain,route);
jehan's avatar
jehan committed
254
	CU_ASSERT_EQUAL(counters->number_of_auth_info_requested,1);
255
	linphone_core_manager_destroy(lcm);
jehan's avatar
jehan committed
256 257 258 259
}

static void simple_tcp_register(){
	char route[256];
260
	LinphoneCoreManager* lcm;
261
	sprintf(route,"sip:%s;transport=tcp",test_route);
262 263 264
	lcm = create_lcm();
	register_with_refresh(lcm,FALSE,test_domain,route);
	linphone_core_manager_destroy(lcm);
jehan's avatar
jehan committed
265
}
Ghislain MARY's avatar
Ghislain MARY committed
266

267
static void simple_tcp_register_compatibility_mode(){
268
	char route[256];
269
	LinphoneCoreManager* lcm;
270
	LCSipTransports transport = {0,5070,0,0};
271
	sprintf(route,"sip:%s",test_route);
272 273 274
	lcm = create_lcm();
	register_with_refresh_base_2(lcm->lc,FALSE,test_domain,route,FALSE,transport);
	linphone_core_manager_destroy(lcm);
275 276 277
}


jehan's avatar
jehan committed
278 279
static void simple_tls_register(){
	char route[256];
280
	LinphoneCoreManager* lcm;
281
	sprintf(route,"sip:%s;transport=tls",test_route);
282 283 284
	lcm = create_lcm();
	register_with_refresh(lcm,FALSE,test_domain,route);
	linphone_core_manager_destroy(lcm);
jehan's avatar
jehan committed
285 286
}

287

jehan's avatar
jehan committed
288
static void simple_authenticated_register(){
289
	stats* counters;
290
	LinphoneCoreManager* lcm = create_lcm();
291
	LinphoneAuthInfo *info=linphone_auth_info_new(test_username,NULL,test_password,NULL,auth_domain,NULL); /*create authentication structure from identity*/
292 293
	char route[256];
	sprintf(route,"sip:%s",test_route);
294 295 296
	linphone_core_add_auth_info(lcm->lc,info); /*add authentication info to LinphoneCore*/
	counters = &lcm->stat;
	register_with_refresh(lcm,FALSE,auth_domain,route);
jehan's avatar
jehan committed
297 298 299
	CU_ASSERT_EQUAL(counters->number_of_auth_info_requested,0);
}

300 301
static void ha1_authenticated_register(){
	stats* counters;
302
	LinphoneCoreManager* lcm = create_lcm();
303 304 305 306
	char ha1[33];
	LinphoneAuthInfo *info;
	char route[256];
	sal_auth_compute_ha1(test_username,auth_domain,test_password,ha1);
307
	info=linphone_auth_info_new(test_username,NULL,NULL,ha1,auth_domain,NULL); /*create authentication structure from identity*/
308
	sprintf(route,"sip:%s",test_route);
309 310 311
	linphone_core_add_auth_info(lcm->lc,info); /*add authentication info to LinphoneCore*/
	counters = &lcm->stat;
	register_with_refresh(lcm,FALSE,auth_domain,route);
312 313 314
	CU_ASSERT_EQUAL(counters->number_of_auth_info_requested,0);
}

jehan's avatar
jehan committed
315
static void authenticated_register_with_no_initial_credentials(){
316
	LinphoneCoreManager *mgr;
317
	LinphoneCoreVTable* vtable = linphone_core_v_table_new();
318
	stats* counters;
319
	char route[256];
320
	
321
	sprintf(route,"sip:%s",test_route);
322
	
Simon Morlat's avatar
Simon Morlat committed
323
	mgr = linphone_core_manager_new(NULL);
324
	
325 326
	vtable->auth_info_requested=auth_info_requested;
	linphone_core_add_listener(mgr->lc,vtable);
327

328
	counters= get_stats(mgr->lc);
jehan's avatar
jehan committed
329
	counters->number_of_auth_info_requested=0;
330
	register_with_refresh(mgr,FALSE,auth_domain,route);
jehan's avatar
jehan committed
331
	CU_ASSERT_EQUAL(counters->number_of_auth_info_requested,1);
332
	linphone_core_manager_destroy(mgr);
jehan's avatar
jehan committed
333
}
Ghislain MARY's avatar
Ghislain MARY committed
334

jehan's avatar
jehan committed
335 336

static void authenticated_register_with_late_credentials(){
337
	LinphoneCoreManager *mgr;
338
	stats* counters;
339
	LCSipTransports transport = {5070,5070,0,5071};
340
	char route[256];
341
	
342
	sprintf(route,"sip:%s",test_route);
343
	
Simon Morlat's avatar
Simon Morlat committed
344
	mgr =  linphone_core_manager_new(NULL);
345

346 347
	counters = get_stats(mgr->lc);
	register_with_refresh_base_2(mgr->lc,FALSE,auth_domain,route,TRUE,transport);
348
	CU_ASSERT_EQUAL(counters->number_of_auth_info_requested,1);
349
	linphone_core_manager_destroy(mgr);
jehan's avatar
jehan committed
350
}
jehan's avatar
jehan committed
351

352 353 354 355 356 357
static void authenticated_register_with_wrong_late_credentials(){
	LinphoneCoreManager *mgr;
	stats* counters;
	LCSipTransports transport = {5070,5070,0,5071};
	char route[256];
	const char* saved_test_passwd=test_password;
358
	char* wrong_passwd="mot de pass tout pourri";
359 360 361 362 363 364

	test_password=wrong_passwd;

	sprintf(route,"sip:%s",test_route);

	mgr =  linphone_core_manager_new(NULL);
365

366 367
	counters = get_stats(mgr->lc);
	register_with_refresh_base_3(mgr->lc,FALSE,auth_domain,route,TRUE,transport,LinphoneRegistrationFailed);
368
	CU_ASSERT_EQUAL(counters->number_of_auth_info_requested,2);
369 370 371 372 373 374 375
	CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,2);
	CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationProgress,2);
	test_password=saved_test_passwd;

	linphone_core_manager_destroy(mgr);
}

376
static void authenticated_register_with_wrong_credentials_with_params_base(const char* user_agent,LinphoneCoreManager *mgr) {
jehan's avatar
jehan committed
377 378
	stats* counters;
	LCSipTransports transport = {5070,5070,0,5071};
379
	LinphoneAuthInfo *info=linphone_auth_info_new(test_username,NULL,"wrong passwd",NULL,auth_domain,NULL); /*create authentication structure from identity*/
jehan's avatar
jehan committed
380
	char route[256];
381
	
jehan's avatar
jehan committed
382
	sprintf(route,"sip:%s",test_route);
383
	
384 385 386 387
	sal_set_refresher_retry_after(mgr->lc->sal,500);
	if (user_agent) {
		linphone_core_set_user_agent(mgr->lc,user_agent,NULL);
	}
388 389
	linphone_core_add_auth_info(mgr->lc,info); /*add wrong authentication info to LinphoneCore*/
	counters = get_stats(mgr->lc);
390 391 392 393 394
	register_with_refresh_base_3(mgr->lc,TRUE,auth_domain,route,FALSE,transport,LinphoneRegistrationFailed);
	//CU_ASSERT_EQUAL(counters->number_of_auth_info_requested,3); register_with_refresh_base_3 does not alow to precisely check number of number_of_auth_info_requested
	/*wait for retry*/
	CU_ASSERT_TRUE(wait_for(mgr->lc,mgr->lc,&counters->number_of_auth_info_requested,4));
	CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,1);
395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410
	
	/*check the detailed error info */
	if (!user_agent || strcmp(user_agent,"tester-no-403")!=0){
		LinphoneProxyConfig *cfg=NULL;
		linphone_core_get_default_proxy(mgr->lc,&cfg);
		CU_ASSERT_PTR_NOT_NULL(cfg);
		if (cfg){
			const LinphoneErrorInfo *ei=linphone_proxy_config_get_error_info(cfg);
			const char *phrase=linphone_error_info_get_phrase(ei);
			CU_ASSERT_PTR_NOT_NULL(phrase);
			if (phrase) CU_ASSERT_TRUE(strcmp(phrase,"Forbidden")==0);
			CU_ASSERT_EQUAL(linphone_error_info_get_protocol_code(ei),403);
			CU_ASSERT_PTR_NULL(linphone_error_info_get_details(ei));
		}
		
	}
411 412 413 414
	}
static void authenticated_register_with_wrong_credentials_with_params(const char* user_agent) {
	LinphoneCoreManager *mgr = linphone_core_manager_new(NULL);
	authenticated_register_with_wrong_credentials_with_params_base(user_agent,mgr);
415
	linphone_core_manager_destroy(mgr);
jehan's avatar
jehan committed
416
}
417 418 419
static void authenticated_register_with_wrong_credentials() {
	authenticated_register_with_wrong_credentials_with_params(NULL);
}
420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437
static void authenticated_register_with_wrong_credentials_2() {
	LinphoneCoreManager *mgr = linphone_core_manager_new(NULL);
	stats* counters = get_stats(mgr->lc);
	int current_in_progress;
	LinphoneProxyConfig* proxy;

	authenticated_register_with_wrong_credentials_with_params_base(NULL,mgr);

	linphone_core_get_default_proxy(mgr->lc,&proxy);
	/*Make sure registration attempts are stopped*/
	linphone_proxy_config_edit(proxy);
	linphone_proxy_config_enable_register(proxy,FALSE);
	linphone_proxy_config_done(proxy);
	current_in_progress=counters->number_of_LinphoneRegistrationProgress;
	CU_ASSERT_FALSE(wait_for(mgr->lc,mgr->lc,&counters->number_of_LinphoneRegistrationProgress,current_in_progress+1));

	linphone_core_manager_destroy(mgr);
}
438 439 440
static void authenticated_register_with_wrong_credentials_without_403() {
	authenticated_register_with_wrong_credentials_with_params("tester-no-403");
}
441
static LinphoneCoreManager* configure_lcm(void) {
442
	LinphoneCoreManager *mgr=linphone_core_manager_new( "multi_account_rc");
443 444 445
	stats *counters=&mgr->stat;
	CU_ASSERT_TRUE(wait_for(mgr->lc,mgr->lc,&counters->number_of_LinphoneRegistrationOk,ms_list_size(linphone_core_get_proxy_config_list(mgr->lc))));
	return mgr;
jehan's avatar
jehan committed
446 447 448
}

static void multiple_proxy(){
449 450
	LinphoneCoreManager *mgr=configure_lcm();
	linphone_core_manager_destroy(mgr);
jehan's avatar
jehan committed
451 452
}

jehan's avatar
jehan committed
453 454
static void network_state_change(){
	int register_ok;
455 456 457 458
	stats *counters;
	LinphoneCoreManager *mgr=configure_lcm();
	LinphoneCore *lc=mgr->lc;
	
459
	counters = get_stats(lc);
jehan's avatar
jehan committed
460 461
	register_ok=counters->number_of_LinphoneRegistrationOk;
	linphone_core_set_network_reachable(lc,FALSE);
462
	CU_ASSERT_TRUE(wait_for(lc,lc,&counters->number_of_NetworkReachableFalse,1));
jehan's avatar
jehan committed
463
	CU_ASSERT_TRUE(wait_for(lc,lc,&counters->number_of_LinphoneRegistrationNone,register_ok));
jehan's avatar
jehan committed
464
	linphone_core_set_network_reachable(lc,TRUE);
465
	CU_ASSERT_TRUE(wait_for(lc,lc,&counters->number_of_NetworkReachableTrue,1));
jehan's avatar
jehan committed
466
	wait_for(lc,lc,&counters->number_of_LinphoneRegistrationOk,2*register_ok);
467

468
	linphone_core_manager_destroy(mgr);
jehan's avatar
jehan committed
469
}
jehan's avatar
jehan committed
470 471 472 473 474 475 476 477 478 479 480
static int get_number_of_udp_proxy(const LinphoneCore* lc) {
	int number_of_udp_proxy=0;
	LinphoneProxyConfig* proxy_cfg;
	MSList* proxys;
	for (proxys=(MSList*)linphone_core_get_proxy_config_list(lc);proxys!=NULL;proxys=proxys->next) {
			proxy_cfg=(LinphoneProxyConfig*)proxys->data;
			if (strcmp("udp",linphone_proxy_config_get_transport(proxy_cfg))==0)
				number_of_udp_proxy++;
	}
	return number_of_udp_proxy;
}
481
static void transport_change(){
482
	LinphoneCoreManager *mgr;
483 484 485 486 487
	LinphoneCore* lc;
	int register_ok;
	stats* counters ;
	LCSipTransports sip_tr;
	LCSipTransports sip_tr_orig;
jehan's avatar
jehan committed
488
	int number_of_udp_proxy=0;
jehan's avatar
jehan committed
489
	int total_number_of_proxies;
jehan's avatar
jehan committed
490
	memset(&sip_tr,0,sizeof(sip_tr));
491 492 493
	
	mgr=configure_lcm();
	lc=mgr->lc;
494
	counters = get_stats(lc);
495
	register_ok=counters->number_of_LinphoneRegistrationOk;
jehan's avatar
jehan committed
496 497

	number_of_udp_proxy=get_number_of_udp_proxy(lc);
jehan's avatar
jehan committed
498
	total_number_of_proxies=ms_list_size(linphone_core_get_proxy_config_list(lc));
499
	linphone_core_get_sip_transports(lc,&sip_tr_orig);
jehan's avatar
jehan committed
500

501 502 503 504
	sip_tr.udp_port=sip_tr_orig.udp_port;

	/*keep only udp*/
	linphone_core_set_sip_transports(lc,&sip_tr);
jehan's avatar
jehan committed
505
	CU_ASSERT_TRUE(wait_for(lc,lc,&counters->number_of_LinphoneRegistrationOk,register_ok+number_of_udp_proxy));
506

507
	CU_ASSERT_TRUE(wait_for(lc,lc,&counters->number_of_LinphoneRegistrationFailed,total_number_of_proxies-number_of_udp_proxy));
508

509
	linphone_core_manager_destroy(mgr);
510 511
}

512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606
static void proxy_transport_change(){
	LinphoneCoreManager* lcm = create_lcm();
	stats* counters = &lcm->stat;
	LinphoneProxyConfig* proxy_config;
	LinphoneAddress* addr;
	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*/

	register_with_refresh_base(lcm->lc,FALSE,auth_domain,NULL);

	linphone_core_get_default_proxy(lcm->lc,&proxy_config);
	reset_counters(counters); /*clear stats*/
	linphone_proxy_config_edit(proxy_config);

	CU_ASSERT_FALSE(wait_for_until(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationCleared,1,3000));
	addr = linphone_address_new(linphone_proxy_config_get_addr(proxy_config));

	if (LinphoneTransportTcp == linphone_address_get_transport(addr)) {
		linphone_address_set_transport(addr,LinphoneTransportUdp);
	} else {
		linphone_address_set_transport(addr,LinphoneTransportTcp);
	}
	linphone_proxy_config_set_server_addr(proxy_config,addr_as_string=linphone_address_as_string(addr));

	linphone_proxy_config_done(proxy_config);

	CU_ASSERT(wait_for(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationOk,1));
	/*as we change p[roxy server destination, we should'nt be notified about the clear*/
	CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationCleared,0);
	ms_free(addr_as_string);
	linphone_address_destroy(addr);
	linphone_core_manager_destroy(lcm);

}
static void proxy_transport_change_with_wrong_port() {
	LinphoneCoreManager* lcm = create_lcm();
	stats* counters = &lcm->stat;
	LinphoneProxyConfig* proxy_config;
	LinphoneAuthInfo *info=linphone_auth_info_new(test_username,NULL,test_password,NULL,auth_domain,NULL); /*create authentication structure from identity*/
	char route[256];
	LCSipTransports transport= {LC_SIP_TRANSPORT_RANDOM,LC_SIP_TRANSPORT_RANDOM,LC_SIP_TRANSPORT_RANDOM,LC_SIP_TRANSPORT_RANDOM};
	sprintf(route,"sip:%s",test_route);

	linphone_core_add_auth_info(lcm->lc,info); /*add authentication info to LinphoneCore*/

	register_with_refresh_base_3(lcm->lc, FALSE, auth_domain, "sip2.linphone.org:5987", 0,transport,LinphoneRegistrationProgress);

	linphone_core_get_default_proxy(lcm->lc,&proxy_config);
	linphone_proxy_config_edit(proxy_config);

	CU_ASSERT_FALSE(wait_for_until(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationCleared,1,3000));
	linphone_proxy_config_set_server_addr(proxy_config,route);
	linphone_proxy_config_done(proxy_config);

	CU_ASSERT(wait_for(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationOk,1));
	/*as we change proxy server destination, we should'nt be notified about the clear*/
	CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationCleared,0);
	CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationOk,1);
	CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationProgress,1);
	CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,0);

	linphone_core_manager_destroy(lcm);

}

static void proxy_transport_change_with_wrong_port_givin_up() {
	LinphoneCoreManager* lcm = create_lcm();
	stats* counters = &lcm->stat;
	LinphoneProxyConfig* proxy_config;
	LinphoneAuthInfo *info=linphone_auth_info_new(test_username,NULL,test_password,NULL,auth_domain,NULL); /*create authentication structure from identity*/
	char route[256];
	LCSipTransports transport= {LC_SIP_TRANSPORT_RANDOM,LC_SIP_TRANSPORT_RANDOM,LC_SIP_TRANSPORT_RANDOM,LC_SIP_TRANSPORT_RANDOM};
	sprintf(route,"sip:%s",test_route);

	linphone_core_add_auth_info(lcm->lc,info); /*add authentication info to LinphoneCore*/

	register_with_refresh_base_3(lcm->lc, FALSE, auth_domain, "sip2.linphone.org:5987", 0,transport,LinphoneRegistrationProgress);

	linphone_core_get_default_proxy(lcm->lc,&proxy_config);
	linphone_proxy_config_edit(proxy_config);

	CU_ASSERT_FALSE(wait_for_until(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationCleared,1,3000));
	linphone_proxy_config_enableregister(proxy_config,FALSE);
	linphone_proxy_config_done(proxy_config);

	CU_ASSERT(wait_for(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationCleared,1));
	CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationOk,0);
	CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationProgress,1);
	CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,0);

	linphone_core_manager_destroy(lcm);

}

jehan's avatar
jehan committed
607
static void io_recv_error(){
608
	LinphoneCoreManager *mgr;
jehan's avatar
jehan committed
609 610 611
	LinphoneCore* lc;
	int register_ok;
	stats* counters ;
jehan's avatar
jehan committed
612
	int number_of_udp_proxy=0;
jehan's avatar
jehan committed
613

614 615 616
	
	mgr=configure_lcm();
	lc=mgr->lc;
617
	counters = get_stats(lc);
jehan's avatar
jehan committed
618
	register_ok=counters->number_of_LinphoneRegistrationOk;
jehan's avatar
jehan committed
619
	number_of_udp_proxy=get_number_of_udp_proxy(lc);
jehan's avatar
jehan committed
620 621
	sal_set_recv_error(lc->sal, 0);

622 623 624
	CU_ASSERT_TRUE(wait_for(lc,lc,&counters->number_of_LinphoneRegistrationProgress,2*(register_ok-number_of_udp_proxy) /*because 1 udp*/));
	CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,0)

jehan's avatar
jehan committed
625 626
	sal_set_recv_error(lc->sal, 1); /*reset*/

627
	linphone_core_manager_destroy(mgr);
jehan's avatar
jehan committed
628 629
}

jehan's avatar
jehan committed
630 631 632 633 634 635 636 637 638 639 640 641 642 643 644
static void io_recv_error_retry_immediatly(){
	LinphoneCoreManager *mgr;
	LinphoneCore* lc;
	int register_ok;
	stats* counters ;
	int number_of_udp_proxy=0;


	mgr=configure_lcm();
	lc=mgr->lc;
	counters = get_stats(lc);
	register_ok=counters->number_of_LinphoneRegistrationOk;
	number_of_udp_proxy=get_number_of_udp_proxy(lc);
	sal_set_recv_error(lc->sal, 0);

645
	CU_ASSERT_TRUE(wait_for(lc,NULL,&counters->number_of_LinphoneRegistrationProgress,(register_ok-number_of_udp_proxy)+register_ok /*because 1 udp*/));
jehan's avatar
jehan committed
646 647 648
	CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,0)
	sal_set_recv_error(lc->sal, 1); /*reset*/

649
	CU_ASSERT_TRUE(wait_for(lc,lc,&counters->number_of_LinphoneRegistrationOk,register_ok-number_of_udp_proxy+register_ok));
jehan's avatar
jehan committed
650 651 652 653 654 655 656 657 658 659 660 661

	linphone_core_manager_destroy(mgr);
}

static void io_recv_error_late_recovery(){
	LinphoneCoreManager *mgr;
	LinphoneCore* lc;
	int register_ok;
	stats* counters ;
	int number_of_udp_proxy=0;
	MSList* lcs;

662
	mgr=linphone_core_manager_new2( "multi_account_rc",FALSE); /*to make sure iterates are not call yet*/
jehan's avatar
jehan committed
663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678
	lc=mgr->lc;
	sal_set_refresher_retry_after(lc->sal,1000);
	counters=&mgr->stat;
	CU_ASSERT_TRUE(wait_for(mgr->lc,mgr->lc,&counters->number_of_LinphoneRegistrationOk,ms_list_size(linphone_core_get_proxy_config_list(mgr->lc))));


	counters = get_stats(lc);
	register_ok=counters->number_of_LinphoneRegistrationOk;
	number_of_udp_proxy=get_number_of_udp_proxy(lc);
	/*simulate a general socket error*/
	sal_set_recv_error(lc->sal, 0);
	sal_set_send_error(lc->sal, -1);

	CU_ASSERT_TRUE(wait_for(lc,NULL,&counters->number_of_LinphoneRegistrationProgress,(register_ok-number_of_udp_proxy)+register_ok /*because 1 udp*/));
	CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,0)

Simon Morlat's avatar
Simon Morlat committed
679
	CU_ASSERT_TRUE(wait_for_list(lcs=ms_list_append(NULL,lc),&counters->number_of_LinphoneRegistrationFailed,(register_ok-number_of_udp_proxy),sal_get_refresher_retry_after(lc->sal)+3000));
jehan's avatar
jehan committed
680 681 682 683

	sal_set_recv_error(lc->sal, 1); /*reset*/
	sal_set_send_error(lc->sal, 0);

684
	CU_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));
jehan's avatar
jehan committed
685 686 687 688

	linphone_core_manager_destroy(mgr);
}

jehan's avatar
jehan committed
689
static void io_recv_error_without_active_register(){
690
	LinphoneCoreManager *mgr;
jehan's avatar
jehan committed
691 692 693 694 695 696
	LinphoneCore* lc;
	int register_ok;
	stats* counters ;
	int number_of_udp_proxy=0;
	MSList* proxys;

697 698
	mgr=configure_lcm();
	lc=mgr->lc;
699
	counters = get_stats(lc);
700
	
jehan's avatar
jehan committed
701 702 703 704 705 706
	register_ok=counters->number_of_LinphoneRegistrationOk;
	number_of_udp_proxy=get_number_of_udp_proxy(lc);

	for (proxys=ms_list_copy(linphone_core_get_proxy_config_list(lc));proxys!=NULL;proxys=proxys->next) {
		LinphoneProxyConfig* proxy_cfg=(LinphoneProxyConfig*)proxys->data;
		linphone_proxy_config_edit(proxy_cfg);
707 708
		linphone_proxy_config_enableregister(proxy_cfg,FALSE);
		linphone_proxy_config_done(proxy_cfg);
709 710 711 712 713
	}
	ms_list_free(proxys);
	/*wait for unregistrations*/
	CU_ASSERT_TRUE(wait_for(lc,lc,&counters->number_of_LinphoneRegistrationCleared,register_ok /*because 1 udp*/));

jehan's avatar
jehan committed
714 715 716
	sal_set_recv_error(lc->sal, 0);

	/*nothing should happen because no active registration*/
717
	CU_ASSERT_FALSE(wait_for_until(lc,lc,&counters->number_of_LinphoneRegistrationProgress,2*(register_ok-number_of_udp_proxy) /*because 1 udp*/,3000));
jehan's avatar
jehan committed
718 719 720 721 722

	CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,0)

	sal_set_recv_error(lc->sal, 1); /*reset*/

723
	linphone_core_manager_destroy(mgr);
jehan's avatar
jehan committed
724 725
}

jehan's avatar
jehan committed
726

jehan's avatar
jehan committed
727
static void tls_certificate_failure(){
728 729
	LinphoneCoreManager* mgr;
	LinphoneCore *lc;
jehan's avatar
jehan committed
730
	char rootcapath[256];
731
	
Simon Morlat's avatar
Simon Morlat committed
732
	mgr=linphone_core_manager_new2("pauline_rc",FALSE);
733
	lc=mgr->lc;
jehan's avatar
jehan committed
734
	snprintf(rootcapath,sizeof(rootcapath), "%s/certificates/cn/agent.pem", liblinphone_tester_file_prefix); /*bad root ca*/
735
	linphone_core_set_root_ca(mgr->lc,rootcapath);
jehan's avatar
jehan committed
736
	linphone_core_set_network_reachable(lc,TRUE);
737 738 739 740
	CU_ASSERT_TRUE(wait_for(mgr->lc,mgr->lc,&mgr->stat.number_of_LinphoneRegistrationFailed,1));
	linphone_core_set_root_ca(mgr->lc,NULL); /*no root ca*/
	linphone_core_refresh_registers(mgr->lc);
	CU_ASSERT_TRUE(wait_for(lc,lc,&mgr->stat.number_of_LinphoneRegistrationFailed,2));
741
	snprintf(rootcapath,sizeof(rootcapath), "%s/certificates/cn/cafile.pem", liblinphone_tester_file_prefix); /*goot root ca*/
742 743 744 745 746
	linphone_core_set_root_ca(mgr->lc,rootcapath);
	linphone_core_refresh_registers(mgr->lc);
	CU_ASSERT_TRUE(wait_for(lc,lc,&mgr->stat.number_of_LinphoneRegistrationOk,1));
	CU_ASSERT_EQUAL(mgr->stat.number_of_LinphoneRegistrationFailed,2);
	linphone_core_destroy(mgr->lc);
jehan's avatar
jehan committed
747
}
Simon Morlat's avatar
Simon Morlat committed
748

749
/*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*/
jehan's avatar
jehan committed
750
static void tls_with_non_tls_server(){
751
	LinphoneCoreManager *mgr;
jehan's avatar
jehan committed
752 753 754
	LinphoneProxyConfig* proxy_cfg;
	LinphoneAddress* addr;
	char tmp[256];
755 756
	LinphoneCore *lc;
	
Simon Morlat's avatar
Simon Morlat committed
757
	mgr=linphone_core_manager_new2( "marie_rc", 0);
758
	lc=mgr->lc;
759
	sal_set_transport_timeout(lc->sal,3000);
jehan's avatar
jehan committed
760 761 762 763
	linphone_core_get_default_proxy(lc,&proxy_cfg);
	linphone_proxy_config_edit(proxy_cfg);
	addr=linphone_address_new(linphone_proxy_config_get_addr(proxy_cfg));
	snprintf(tmp,sizeof(tmp),"sip:%s:%i;transport=tls"	,linphone_address_get_domain(addr)
764
			,(linphone_address_get_port(addr)>0?linphone_address_get_port(addr):5060));
jehan's avatar
jehan committed
765 766 767
	linphone_proxy_config_set_server_addr(proxy_cfg,tmp);
	linphone_proxy_config_done(proxy_cfg);
	linphone_address_destroy(addr);
768
	CU_ASSERT_TRUE(wait_for_until(lc,lc,&mgr->stat.number_of_LinphoneRegistrationFailed,1,5000));
769
	linphone_core_manager_destroy(mgr);
Simon Morlat's avatar
Simon Morlat committed
770
}
jehan's avatar
jehan committed
771

772 773 774 775 776 777 778
static void tls_alt_name_register(){
	LinphoneCoreManager* mgr;
	LinphoneCore *lc;
	char rootcapath[256];
	
	mgr=linphone_core_manager_new2("pauline_alt_rc",FALSE);
	lc=mgr->lc;
779
	snprintf(rootcapath,sizeof(rootcapath), "%s/certificates/cn/cafile.pem", liblinphone_tester_file_prefix);
780 781 782 783 784 785 786 787 788 789 790 791 792 793
	linphone_core_set_root_ca(mgr->lc,rootcapath);
	linphone_core_refresh_registers(mgr->lc);
	CU_ASSERT_TRUE(wait_for(lc,lc,&mgr->stat.number_of_LinphoneRegistrationOk,1));
	CU_ASSERT_EQUAL(mgr->stat.number_of_LinphoneRegistrationFailed,0);
	linphone_core_destroy(mgr->lc);
}

static void tls_wildcard_register(){
	LinphoneCoreManager* mgr;
	LinphoneCore *lc;
	char rootcapath[256];
	
	mgr=linphone_core_manager_new2("pauline_wild_rc",FALSE);
	lc=mgr->lc;
794
	snprintf(rootcapath,sizeof(rootcapath), "%s/certificates/cn/cafile.pem", liblinphone_tester_file_prefix);
795 796
	linphone_core_set_root_ca(mgr->lc,rootcapath);
	linphone_core_refresh_registers(mgr->lc);
797
	CU_ASSERT_TRUE(wait_for(lc,lc,&mgr->stat.number_of_LinphoneRegistrationOk,2));
798 799 800 801
	CU_ASSERT_EQUAL(mgr->stat.number_of_LinphoneRegistrationFailed,0);
	linphone_core_destroy(mgr->lc);
}

jehan's avatar
jehan committed
802 803 804 805 806 807 808 809 810 811 812
static void redirect(){
	char route[256];
	LinphoneCoreManager* lcm;
	LCSipTransports transport = {-1,0,0,0};
	sprintf(route,"sip:%s:5064",test_route);
	lcm = create_lcm();
	linphone_core_set_user_agent(lcm->lc,"redirect",NULL);
	register_with_refresh_base_2(lcm->lc,FALSE,test_domain,route,FALSE,transport);
	linphone_core_manager_destroy(lcm);
}

Ghislain MARY's avatar
Ghislain MARY committed
813 814
test_t register_tests[] = {
	{ "Simple register", simple_register },
815
	{ "Simple register unregister", simple_unregister },
Ghislain MARY's avatar
Ghislain MARY committed
816
	{ "TCP register", simple_tcp_register },
817
	{ "TCP register compatibility mode", simple_tcp_register_compatibility_mode },
818
	{ "TLS register", simple_tls_register },
819 820
	{ "TLS register with alt. name certificate", tls_alt_name_register },
	{ "TLS register with wildcard certificate", tls_wildcard_register },
jehan's avatar
jehan committed
821
	{ "TLS certificate not verified",tls_certificate_failure},
Simon Morlat's avatar
Simon Morlat committed
822
	{ "TLS with non tls server",tls_with_non_tls_server},
Ghislain MARY's avatar
Ghislain MARY committed
823
	{ "Simple authenticated register", simple_authenticated_register },
824
	{ "Ha1 authenticated register", ha1_authenticated_register },
Ghislain MARY's avatar
Ghislain MARY committed
825
	{ "Digest auth without initial credentials", authenticated_register_with_no_initial_credentials },
jehan's avatar
jehan committed
826
	{ "Digest auth with wrong credentials", authenticated_register_with_wrong_credentials },
827
	{ "Digest auth with wrong credentials, check if registration attempts are stopped", authenticated_register_with_wrong_credentials_2 },
828
	{ "Digest auth with wrong credentials without 403", authenticated_register_with_wrong_credentials_without_403},
829
	{ "Authenticated register with wrong late credentials", authenticated_register_with_wrong_late_credentials},
Ghislain MARY's avatar
Ghislain MARY committed
830 831 832
	{ "Authenticated register with late credentials", authenticated_register_with_late_credentials },
	{ "Register with refresh", simple_register_with_refresh },
	{ "Authenticated register with refresh", simple_auth_register_with_refresh },
833
	{ "Register with refresh and send error", register_with_refresh_with_send_error },
Ghislain MARY's avatar
Ghislain MARY committed
834
	{ "Multi account", multiple_proxy },
835 836 837 838 839
	{ "Transport changes", transport_change },
	{ "Proxy transport changes", proxy_transport_change},
	{ "Proxy transport changes with wrong address at first", proxy_transport_change_with_wrong_port},
	{ "Proxy transport changes with wrong address, giving up",proxy_transport_change_with_wrong_port_givin_up},
	{ "Change expires", change_expires},
Ghislain MARY's avatar
Ghislain MARY committed
840
	{ "Network state change", network_state_change },
jehan's avatar
jehan committed
841
	{ "Io recv error", io_recv_error },
jehan's avatar
jehan committed
842 843
	{ "Io recv error with recovery", io_recv_error_retry_immediatly},
	{ "Io recv error with late recovery", io_recv_error_late_recovery},
jehan's avatar
jehan committed
844 845
	{ "Io recv error without active registration", io_recv_error_without_active_register},
	{ "Simple redirect", redirect}
Ghislain MARY's avatar
Ghislain MARY committed
846 847 848 849 850 851 852 853 854
};

test_suite_t register_test_suite = {
	"Register",
	NULL,
	NULL,
	sizeof(register_tests) / sizeof(register_tests[0]),
	register_tests
};
jehan's avatar
jehan committed
855