Commit 3cf4815b authored by Ghislain MARY's avatar Ghislain MARY

Reorganize unit tests.

parent 70bc90cc
......@@ -17,9 +17,11 @@
*/
#include "belle-sip/auth-helper.h"
#include "belle_sip_tester.h"
#include <stdio.h>
#include "CUnit/Basic.h"
static void test_authentication(void) {
const char* l_raw_header = "WWW-Authenticate: Digest "
"algorithm=MD5, realm=\"sip.linphone.org\", opaque=\"1bc7f9097684320\","
......@@ -34,6 +36,7 @@ static void test_authentication(void) {
belle_sip_object_unref(www_authenticate);
belle_sip_object_unref(authorization);
}
static void test_authentication_qop_auth(void) {
const char* l_raw_header = "WWW-Authenticate: Digest "
"algorithm=MD5, realm=\"sip.linphone.org\", opaque=\"1bc7f9097684320\","
......@@ -70,26 +73,19 @@ static void test_proxy_authentication(void) {
belle_sip_object_unref(proxy_authorization);
}
int belle_sip_authentication_helper_suite () {
CU_pSuite pSuite = NULL;
test_t authentication_helper_tests[] = {
{ "Proxy-Authenticate", test_proxy_authentication },
{ "WWW-Authenticate", test_authentication },
{ "WWW-Authenticate (with qop)", test_authentication_qop_auth }
};
/* add a suite to the registry */
pSuite = CU_add_suite("Authentication-helper", NULL,NULL);
if (NULL == pSuite) {
return CU_get_error();
}
test_suite_t authentication_helper_test_suite = {
"Authentication helper",
NULL,
NULL,
sizeof(authentication_helper_tests) / sizeof(authentication_helper_tests[0]),
authentication_helper_tests
};
if (NULL == CU_add_test(pSuite, "test_authentication", test_authentication)) {
return CU_get_error();
}
if (NULL == CU_add_test(pSuite, "test_authentication_qop_auth", test_authentication_qop_auth)) {
return CU_get_error();
}
if (NULL == CU_add_test(pSuite, "test_proxy_authentication", test_proxy_authentication)) {
return CU_get_error();
}
return CU_get_error();
}
......@@ -17,16 +17,11 @@
*/
#include "belle-sip/belle-sdp.h"
#include "belle_sip_tester.h"
#include <stdio.h>
#include "CUnit/Basic.h"
static int init_suite_sdp(void) {
return 0;
}
static int clean_suite_sdp(void) {
return 0;
}
//v=0
//o=jehan-mac 1239 1239 IN IP4 192.168.0.18
//s=Talk
......@@ -61,6 +56,7 @@ static void test_attribute(void) {
CU_ASSERT_TRUE(belle_sdp_attribute_as_value(lAttribute));
belle_sip_object_unref(BELLE_SIP_OBJECT(lAttribute));
}
static void test_attribute_2(void) {
belle_sdp_attribute_t* lTmp;
belle_sdp_attribute_t* lAttribute = belle_sdp_attribute_parse("a=ice-pwd:31ec21eb38b2ec6d36e8dc7b\r\n");
......@@ -75,6 +71,7 @@ static void test_attribute_2(void) {
CU_ASSERT_TRUE(belle_sdp_attribute_as_value(lAttribute));
belle_sip_object_unref(BELLE_SIP_OBJECT(lAttribute));
}
static void test_bandwidth(void) {
belle_sdp_bandwidth_t* lTmp;
belle_sdp_bandwidth_t* l_bandwidth = belle_sdp_bandwidth_parse("b=AS:380");
......@@ -89,7 +86,6 @@ static void test_bandwidth(void) {
belle_sip_free(l_raw_bandwidth);
}
static void test_connection(void) {
belle_sdp_connection_t* lTmp;
belle_sdp_connection_t* lConnection = belle_sdp_connection_parse("c=IN IP4 192.168.0.18");
......@@ -132,6 +128,7 @@ static void test_email(void) {
belle_sip_object_unref(BELLE_SIP_OBJECT(l_email));
belle_sip_free(l_raw_email);
}
static void test_info(void) {
belle_sdp_info_t* lTmp;
belle_sdp_info_t* l_info = belle_sdp_info_parse("i=A Seminar on the session description protocol");
......@@ -144,6 +141,7 @@ static void test_info(void) {
belle_sip_object_unref(BELLE_SIP_OBJECT(l_info));
belle_sip_free(l_raw_info);
}
static void test_media(void) {
belle_sdp_media_t* lTmp;
belle_sip_list_t* list;
......@@ -231,7 +229,8 @@ static void test_media_description(void) {
belle_sip_free(l_raw_media_description);
return;
}
static void simple_session_description(void) {
static void test_simple_session_description(void) {
const char* l_src = "v=0\r\n"\
"o=jehan-mac 1239 1239 IN IP4 192.168.0.18\r\n"\
"s=Talk\r\n"\
......@@ -365,6 +364,7 @@ static belle_sdp_mime_parameter_t* find_mime_parameter(belle_sip_list_t* list,co
}
return NULL;
}
static void check_mime_param (belle_sdp_mime_parameter_t* mime_param
,int rate
,int channel_count
......@@ -382,6 +382,7 @@ static void check_mime_param (belle_sdp_mime_parameter_t* mime_param
if (type) CU_ASSERT_STRING_EQUAL(belle_sdp_mime_parameter_get_type(mime_param),type);
if (parameters) CU_ASSERT_STRING_EQUAL(belle_sdp_mime_parameter_get_parameters(mime_param),parameters);
}
static void test_mime_parameter(void) {
const char* l_src = "m=audio 7078 RTP/AVP 111 110 0 8 9 3 101\r\n"\
"a=rtpmap:111 speex/16000\r\n"\
......@@ -447,49 +448,28 @@ static void test_mime_parameter(void) {
belle_sip_list_free_with_data(mime_parameter_list, (void (*)(void*))belle_sip_object_unref);
}
int belle_sdp_test_suite () {
CU_pSuite pSuite = NULL;
/* add a suite to the registry */
pSuite = CU_add_suite("SDP", init_suite_sdp, clean_suite_sdp);
/* add the tests to the suite */
/* NOTE - ORDER IS IMPORTANT - MUST TEST fread() AFTER fprintf() */
if (NULL == CU_add_test(pSuite, "test_connection", test_connection)) {
return CU_get_error();
}
if (NULL == CU_add_test(pSuite, "test_connection_6", test_connection_6)) {
return CU_get_error();
}
if (NULL == CU_add_test(pSuite, "attribute", test_attribute)) {
return CU_get_error();
}
if (NULL == CU_add_test(pSuite, "test_attribute_2", test_attribute_2)) {
return CU_get_error();
}
if (NULL == CU_add_test(pSuite, "bandwidth", test_bandwidth)) {
return CU_get_error();
}
if (NULL == CU_add_test(pSuite, "email", test_email)) {
return CU_get_error();
}
if (NULL == CU_add_test(pSuite, "info", test_info)) {
return CU_get_error();
}
if (NULL == CU_add_test(pSuite, "media", test_media)) {
return CU_get_error();
}
if (NULL == CU_add_test(pSuite, "media_description", test_media_description)) {
return CU_get_error();
}
if (NULL == CU_add_test(pSuite, "mime_parameter", test_mime_parameter)) {
return CU_get_error();
}
if (NULL == CU_add_test(pSuite, "simple_session_description", simple_session_description)) {
return CU_get_error();
}
if (NULL == CU_add_test(pSuite, "test_session_description", test_session_description)) {
return CU_get_error();
}
return 0;
}
test_t sdp_tests[] = {
{ "a= (attribute)", test_attribute },
{ "a= (attribute) 2", test_attribute_2 },
{ "b= (bandwidth)", test_bandwidth },
{ "c= (IPv4 connection)", test_connection },
{ "c= (IPv6 connection)", test_connection_6 },
{ "e= (email)", test_email },
{ "i= (info)", test_info },
{ "m= (media)", test_media },
{ "mime parameter", test_mime_parameter },
{ "Media description", test_media_description },
{ "Simple session description", test_simple_session_description },
{ "Session description", test_session_description }
};
test_suite_t sdp_test_suite = {
"SDP",
NULL,
NULL,
sizeof(sdp_tests) / sizeof(sdp_tests[0]),
sdp_tests
};
......@@ -19,11 +19,11 @@
#include <stdio.h>
#include "CUnit/Basic.h"
#include "belle-sip/belle-sip.h"
#include "belle_sip_tester.h"
#include "register_tester.h"
static const char* sdp = "v=0\r\n"\
"o=jehan-mac 1239 1239 IN IP4 192.168.0.18\r\n"\
"s=Talk\r\n"\
......@@ -45,15 +45,11 @@ static const char* sdp = "v=0\r\n"\
"a=rtpmap:98 H263-1998/90000\r\n"\
"a=fmtp:98 CIF=1;QCIF=1\r\n";
static int init(void) {
register_init();
return 0;
}
static int uninit(void) {
register_uninit();
static belle_sip_dialog_t* caller_dialog;
static belle_sip_dialog_t* callee_dialog;
static belle_sip_response_t* ok_response;
static belle_sip_server_transaction_t* inserv_transaction;
return 0;
}
belle_sip_request_t* build_request(belle_sip_stack_t * stack
, belle_sip_provider_t *prov
......@@ -91,21 +87,18 @@ belle_sip_request_t* build_request(belle_sip_stack_t * stack
return req;
}
static belle_sip_dialog_t* caller_dialog;
static belle_sip_dialog_t* callee_dialog;
static belle_sip_response_t* ok_response;
static belle_sip_server_transaction_t* inserv_transaction;
static void process_dialog_terminated(void *user_ctx, const belle_sip_dialog_terminated_event_t *event){
BELLESIP_UNUSED(user_ctx);
BELLESIP_UNUSED(event);
belle_sip_message("process_dialog_terminated not implemented yet");
}
static void process_io_error(void *user_ctx, const belle_sip_io_error_event_t *event){
BELLESIP_UNUSED(user_ctx);
BELLESIP_UNUSED(event);
belle_sip_message("process_io_error not implemented yet");
}
static void caller_process_request_event(void *user_ctx, const belle_sip_request_event_t *event) {
belle_sip_server_transaction_t* server_transaction;
belle_sip_response_t* resp;
......@@ -124,6 +117,7 @@ static void caller_process_request_event(void *user_ctx, const belle_sip_request
belle_sip_server_transaction_send_response(server_transaction,resp);
}
static void callee_process_request_event(void *user_ctx, const belle_sip_request_event_t *event) {
belle_sip_dialog_t* dialog;
belle_sip_response_t* ringing_response;
......@@ -203,6 +197,7 @@ static void caller_process_response_event(void *user_ctx, const belle_sip_respon
}
static void callee_process_response_event(void *user_ctx, const belle_sip_response_event_t *event){
belle_sip_dialog_t* dialog;
belle_sip_client_transaction_t* client_transaction = belle_sip_response_event_get_client_transaction(event);
......@@ -224,6 +219,7 @@ static void callee_process_response_event(void *user_ctx, const belle_sip_respon
,belle_sip_dialog_state_to_string(belle_sip_dialog_get_state(dialog)));
}
static void process_timeout(void *user_ctx, const belle_sip_timeout_event_t *event) {
BELLESIP_UNUSED(user_ctx);
/* belle_sip_client_transaction_t* client_transaction = belle_sip_timeout_event_get_client_transaction(event);
......@@ -234,6 +230,7 @@ static void process_timeout(void *user_ctx, const belle_sip_timeout_event_t *eve
belle_sip_message("Unhandled event timeout [%p]",event);
}
}
static void process_transaction_terminated(void *user_ctx, const belle_sip_transaction_terminated_event_t *event) {
BELLESIP_UNUSED(user_ctx);
/* belle_sip_client_transaction_t* client_transaction = belle_sip_transaction_terminated_event_get_client_transaction(event);
......@@ -249,8 +246,6 @@ static void listener_destroyed(void *user_ctx){
belle_sip_object_unref(user_ctx);
}
static void do_simple_call(void) {
#define CALLER "marie"
#define CALLEE "pauline"
......@@ -357,18 +352,17 @@ static void simple_call_with_delay(void){
belle_sip_object_unref(lp);
}*/
int belle_sip_dialog_test_suite(){
CU_pSuite pSuite = CU_add_suite("Dialog", init, uninit);
if (NULL == CU_add_test(pSuite, "simple_call", simple_call)) {
return CU_get_error();
}
if (NULL == CU_add_test(pSuite, "simple_call_with_delay", simple_call_with_delay)) {
return CU_get_error();
}
/* if (NULL == CU_add_test(pSuite, "simple_call_udp_tcp_with_delay", simple_call_udp_tcp_with_delay)) {
return CU_get_error();
}*/
return 0;
}
test_t dialog_tests[] = {
{ "Simple call", simple_call },
{ "Simple call with delay", simple_call_with_delay }
};
test_suite_t dialog_test_suite = {
"Dialog",
register_init,
register_uninit,
sizeof(dialog_tests) / sizeof(dialog_tests[0]),
dialog_tests
};
This diff is collapsed.
......@@ -17,17 +17,10 @@
*/
#include "belle-sip/belle-sip.h"
#include "belle_sip_tester.h"
#include <stdio.h>
#include "CUnit/Basic.h"
static int init_suite_message(void) {
return 0;
}
static int clean_suite_message(void) {
return 0;
}
static void check_uri_and_headers(belle_sip_message_t* message) {
if (belle_sip_message_is_request(message)) {
......@@ -96,6 +89,7 @@ static void testRegisterMessage(void) {
belle_sip_object_unref(message);
}
static void testInviteMessage(void) {
const char* raw_message = "INVITE sip:becheong@sip.linphone.org SIP/2.0\r\n"\
"Via: SIP/2.0/UDP 10.23.17.117:22600;branch=z9hG4bK-d8754z-4d7620d2feccbfac-1---d8754z-;rport=4820;received=202.165.193.129\r\n"\
......@@ -124,6 +118,7 @@ static void testInviteMessage(void) {
belle_sip_object_unref(message);
belle_sip_free(encoded_message);
}
static void test401Response(void) {
const char* raw_message = "SIP/2.0 401 Unauthorized\r\n"
"Call-ID: 577586163\r\n"
......@@ -147,6 +142,7 @@ static void test401Response(void) {
belle_sip_object_unref(message);
belle_sip_free(encoded_message);
}
static void testRegisterRaw(void) {
const char* raw_message = "REGISTER sip:192.168.0.20 SIP/2.0\r\n"\
"Via: SIP/2.0/UDP 192.168.1.8:5062;rport;branch=z9hG4bK1439638806\r\n"\
......@@ -242,6 +238,7 @@ static void test_extract_source(void) {
belle_sip_object_unref(message);
}
static void test_sipfrag(void) {
const char* raw_message = "SIP/2.0 100 Trying\r\n";
belle_sip_response_t* response;
......@@ -255,42 +252,24 @@ static void test_sipfrag(void) {
/*static void test_fix_contact_with_received_rport() {
}*/
int belle_sip_message_test_suite () {
CU_pSuite pSuite = NULL;
/* add a suite to the registry */
pSuite = CU_add_suite("Message", init_suite_message, clean_suite_message);
if (NULL == pSuite) {
return CU_get_error();
}
/* add the tests to the suite */
/* NOTE - ORDER IS IMPORTANT - MUST TEST fread() AFTER fprintf() */
if (NULL == CU_add_test(pSuite, "testRegisterMessage", testRegisterMessage)) {
return CU_get_error();
}
if (NULL == CU_add_test(pSuite, "testInviteMessage", testInviteMessage)) {
return CU_get_error();
}
if (NULL == CU_add_test(pSuite, "testOptionMessage", testOptionMessage)) {
return CU_get_error();
}
if (NULL == CU_add_test(pSuite, "test of register raw message", testRegisterRaw)) {
return CU_get_error();
}
if (NULL == CU_add_test(pSuite, "test of 401 response", test401Response)) {
return CU_get_error();
}
if (NULL == CU_add_test(pSuite, "test belle_sip_request_extract_origin", test_extract_source)) {
return CU_get_error();
}
if (NULL == CU_add_test(pSuite, "test_sipfrag", test_sipfrag)) {
return CU_get_error();
}
return CU_get_error();
}
/* NOTE - ORDER IS IMPORTANT - MUST TEST fread() AFTER fprintf() */
test_t message_tests[] = {
{ "REGISTER", testRegisterMessage },
{ "INVITE", testInviteMessage },
{ "Option message", testOptionMessage },
{ "REGISTER (Raw)", testRegisterRaw },
{ "401 Response", test401Response },
{ "Origin extraction", test_extract_source },
{ "SIP frag", test_sipfrag },
};
test_suite_t message_test_suite = {
"Message",
NULL,
NULL,
sizeof(message_tests) / sizeof(message_tests[0]),
message_tests
};
......@@ -20,13 +20,18 @@
#include "CUnit/Basic.h"
#include "belle-sip/belle-sip.h"
#include "belle_sip_internal.h"
#include "belle_sip_tester.h"
#ifndef _MSC_VER
#include <sys/time.h>
#endif
#define USERNAME "toto"
#define SIPDOMAIN "sip.linphone.org"
#define PASSWD "secret"
typedef enum auth_mode {
none
,digest
......@@ -38,6 +43,7 @@ typedef struct _stat {
int fourHundredOne;
int refreshOk;
}stat_t;
typedef struct endpoint {
belle_sip_stack_t* stack;
belle_sip_listener_callbacks_t* listener_callbacks;
......@@ -54,6 +60,7 @@ typedef struct endpoint {
unsigned char unreconizable_contact;
} endpoint_t;
static unsigned int wait_for(belle_sip_stack_t*s1, belle_sip_stack_t*s2,int* counter,int value,int timeout) {
int retry=0;
#define ITER 100
......@@ -73,6 +80,7 @@ static unsigned int wait_for(belle_sip_stack_t*s1, belle_sip_stack_t*s2,int* co
// /*belle_sip_main_loop_quit(belle_sip_stack_get_main_loop(stack));*/
// /*CU_ASSERT(CU_FALSE);*/
//}
static void compute_response(const char* username
,const char* realm
,const char* passwd
......@@ -85,6 +93,7 @@ static void compute_response(const char* username
belle_sip_auth_helper_compute_ha2(method,uri,ha2);
belle_sip_auth_helper_compute_response(ha1,nonce,ha2,response);
}
static void compute_response_auth_qop(const char* username
,const char* realm
,const char* passwd
......@@ -100,7 +109,9 @@ static void compute_response_auth_qop(const char* username
belle_sip_auth_helper_compute_ha2(method,uri,ha2);
belle_sip_auth_helper_compute_response_qop_auth(ha1, nonce,nonce_count, cnonce,qop,ha2,response);
}
#define MAX_NC_COUNT 3
static void server_process_request_event(void *obj, const belle_sip_request_event_t *event){
endpoint_t* endpoint = (endpoint_t*)obj;
belle_sip_server_transaction_t* server_transaction =belle_sip_provider_create_server_transaction(endpoint->provider,belle_sip_request_event_get_request(event));
......@@ -207,6 +218,7 @@ static void server_process_request_event(void *obj, const belle_sip_request_even
}
belle_sip_server_transaction_send_response(server_transaction,resp);
}
static void client_process_response_event(void *obj, const belle_sip_response_event_t *event){
//belle_sip_client_transaction_t* client_transaction = belle_sip_response_event_get_client_transaction(event);
endpoint_t* endpoint = (endpoint_t*)obj;
......@@ -220,12 +232,14 @@ static void client_process_response_event(void *obj, const belle_sip_response_ev
}
//static void process_timeout(void *obj, const belle_sip_timeout_event_t *event){
// belle_sip_message("process_timeout");
//}
//static void process_transaction_terminated(void *obj, const belle_sip_transaction_terminated_event_t *event){
// belle_sip_message("process_transaction_terminated");
//}
static void client_process_auth_requested(void *obj, belle_sip_auth_event_t *event){
BELLESIP_UNUSED(obj);
belle_sip_message("process_auth_requested requested for [%s@%s]"
......@@ -272,6 +286,7 @@ static void destroy_endpoint(endpoint_t* endpoint) {
static endpoint_t* create_udp_endpoint(int port,belle_sip_listener_callbacks_t* listener_callbacks) {
return create_endpoint(port,"udp",listener_callbacks);
}
static void register_base(endpoint_t* client,endpoint_t *server) {
belle_sip_request_t* req;
belle_sip_client_transaction_t* trans;
......@@ -337,6 +352,7 @@ static void register_base(endpoint_t* client,endpoint_t *server) {
belle_sip_refresher_stop(refresher);
belle_sip_object_unref(refresher);
}
static void register_test_with_param(unsigned char expire_in_contact,auth_mode_t auth_mode) {
belle_sip_listener_callbacks_t client_callbacks;
belle_sip_listener_callbacks_t server_callbacks;
......@@ -433,9 +449,11 @@ static void subscribe_test(void) {
static void register_expires_header(void) {
register_test_with_param(0,none);
}
static void register_expires_in_contact(void) {
register_test_with_param(1,none);
}
static void register_expires_header_digest(void) {
register_test_with_param(0,digest);
}
......@@ -444,7 +462,7 @@ static void register_expires_in_contact_header_digest_auth(void) {
register_test_with_param(1,digest_auth);
}
static void register_with_unreconizable_contact(void) {
static void register_with_unrecognizable_contact(void) {
belle_sip_listener_callbacks_t client_callbacks;
belle_sip_listener_callbacks_t server_callbacks;
endpoint_t* client,*server;
......@@ -464,27 +482,20 @@ static void register_with_unreconizable_contact(void) {
}
int belle_sip_refresher_test_suite(){
CU_pSuite pSuite = CU_add_suite("Refresher", NULL, NULL);
if (NULL == CU_add_test(pSuite, "register_expires_header", register_expires_header)) {
return CU_get_error();
}
if (NULL == CU_add_test(pSuite, "register_expires_in_contact", register_expires_in_contact)) {
return CU_get_error();
}
if (NULL == CU_add_test(pSuite, "register_expires_header_digest", register_expires_header_digest)) {
return CU_get_error();
}
if (NULL == CU_add_test(pSuite, "register_expires_in_contact_header_digest_auth", register_expires_in_contact_header_digest_auth)) {
return CU_get_error();
}
if (NULL == CU_add_test(pSuite, "subscribe_test", subscribe_test)) {
return CU_get_error();
}
if (NULL == CU_add_test(pSuite, "register_with_unreconizable_contact", register_with_unreconizable_contact)) {
return CU_get_error();
}
return 0;
}
test_t refresher_tests[] = {
{ "REGISTER Expires header", register_expires_header },
{ "REGISTER Expires in Contact", register_expires_in_contact },
{ "REGISTER Expires header digest", register_expires_header_digest },
{ "REGISTER Expires in Contact digest auth", register_expires_in_contact_header_digest_auth },
{ "SUBSCRIBE", subscribe_test },
{ "REGISTER with unrecognizable Contact", register_with_unrecognizable_contact },
};
test_suite_t refresher_test_suite = {
"Refresher",
NULL,
NULL,
sizeof(refresher_tests) / sizeof(refresher_tests[0]),
refresher_tests
};
......@@ -20,9 +20,11 @@
#include "CUnit/Basic.h"
#include "belle-sip/belle-sip.h"
#include "belle_sip_internal.h"
#include "belle_sip_tester.h"
#include "register_tester.h"
const char *test_domain="test.linphone.org";
const char *auth_domain="sip.linphone.org";
static int is_register_ok;
......@@ -31,12 +33,17 @@ static int using_transaction;
belle_sip_stack_t * stack;
belle_sip_provider_t *prov;
static belle_sip_listener_t* l;
belle_sip_request_t* authorized_request;
belle_sip_listener_callbacks_t listener_callbacks;
belle_sip_listener_t *listener;
static void process_dialog_terminated(void *user_ctx, const belle_sip_dialog_terminated_event_t *event){
BELLESIP_UNUSED(user_ctx);
BELLESIP_UNUSED(event);
belle_sip_message("process_dialog_terminated called");
}
static void process_io_error(void *user_ctx, const belle_sip_io_error_event_t *event){
BELLESIP_UNUSED(user_ctx);
BELLESIP_UNUSED(event);
......@@ -44,12 +51,13 @@ static void process_io_error(void *user_ctx, const belle_sip_io_error_event_t *e
belle_sip_main_loop_quit(belle_sip_stack_get_main_loop(stack));
/*CU_ASSERT(CU_FALSE);*/
}
static void process_request_event(void *user_ctx, const belle_sip_request_event_t *event){
BELLESIP_UNUSED(user_ctx);
BELLESIP_UNUSED(event);
belle_sip_message("process_request_event");
}
belle_sip_request_t* authorized_request;
static void process_response_event(void *user_ctx, const belle_sip_response_event_t *event){
int status;
belle_sip_request_t* request;
......@@ -79,16 +87,19 @@ static void process_response_event(void *user_ctx, const belle_sip_response_even
belle_sip_main_loop_quit(belle_sip_stack_get_main_loop(stack));
}
}
static void process_timeout(void *user_ctx, const belle_sip_timeout_event_t *event){
BELLESIP_UNUSED(user_ctx);
BELLESIP_UNUSED(event);
belle_sip_message("process_timeout");
}
static void process_transaction_terminated(void *user_ctx, const belle_sip_transaction_terminated_event_t *event){
BELLESIP_UNUSED(user_ctx);
BELLESIP_UNUSED(event);
belle_sip_message("process_transaction_terminated");
}
static void process_auth_requested(void *user_ctx, belle_sip_auth_event_t *event){
BELLESIP_UNUSED(user_ctx);
belle_sip_message("process_auth_requested requested for [%s@%s]"
......@@ -97,10 +108,6 @@ static void process_auth_requested(void *user_ctx, belle_sip_auth_event_t *event
belle_sip_auth_event_set_passwd(event,"secret");
}
belle_sip_listener_callbacks_t listener_callbacks;
belle_sip_listener_t *listener;
int register_init(void) {
belle_sip_listening_point_t *lp;
stack=belle_sip_stack_new(NULL);
......@@ -125,6 +132,7 @@ int register_init(void) {
listener=belle_sip_listener_create_from_callbacks(&listener_callbacks,NULL);
return 0;
}
int register_uninit(void) {
belle_sip_object_unref(prov);
belle_sip_object_unref(stack);
......@@ -162,6 +170,7 @@ void unregister_user(belle_sip_stack_t * stack
CU_ASSERT_EQUAL(using_transaction,use_transaction);
belle_sip_provider_remove_sip_listener(prov,l);
}
belle_sip_request_t* try_register_user_at_domain(belle_sip_stack_t * stack
,belle_sip_provider_t *prov
,const char *transport
......@@ -221,6 +230,7 @@ belle_sip_request_t* try_register_user_at_domain(belle_sip_stack_t * stack
if (outbound) belle_sip_free(outbound);
return copy;
}
belle_sip_request_t* register_user_at_domain(belle_sip_stack_t * stack
,belle_sip_provider_t *prov
,const char *transport
......@@ -231,6 +241,7 @@ belle_sip_request_t* register_user_at_domain(belle_sip_stack_t * stack
return try_register_user_at_domain(stack,prov,transport,use_transaction,username,domain,outband,1);
}
belle_sip_request_t* register_user(belle_sip_stack_t * stack
,belle_sip_provider_t *prov
,const char *transport
......@@ -249,9 +260,11 @@ static void register_with_outbound(const char *transport, int use_transaction,co
belle_sip_object_unref(req);
}
}
static void register_test(const char *transport, int use_transaction) {
register_with_outbound(transport,use_transaction,NULL);
}
static void stateless_register_udp(void){
register_test(NULL,0);
}
......@@ -267,12 +280,14 @@ static void stateless_register_tcp(void){
static void stateful_register_udp(void){
register_test(NULL,1);
}
static void stateful_register_udp_with_keep_alive(void) {
belle_sip_listening_point_set_keep_alive(belle_sip_provider_get_listening_point(prov,"udp"),200);
register_test(NULL,1);
belle_sip_main_loop_sleep(belle_sip_stack_get_main_loop(stack),500);
belle_sip_listening_point_set_keep_alive(belle_sip_provider_get_listening_point(prov,"udp"),-1);
}
static void stateful_register_udp_with_outbound_proxy(void){
register_with_outbound("udp",1,test_domain);
}
......@@ -297,12 +312,12 @@ static void stateful_register_tls(void){
register_test("tls",1);
}
static void bad_req_process_io_error(void *user_ctx, const belle_sip_io_error_event_t *event){
BELLESIP_UNUSED(user_ctx);
BELLESIP_UNUSED(event);
belle_sip_message("bad_req_process_io_error not implemented yet");
}