Commit 13c1841b authored by DanmeiChen's avatar DanmeiChen

indentation of code, use tab

parent b366baa6
......@@ -277,20 +277,19 @@ static
#else // STATIC_IMAXDIV ][
_inline
#endif // STATIC_IMAXDIV ]
imaxdiv_t __cdecl imaxdiv(intmax_t numer, intmax_t denom)
{
imaxdiv_t result;
imaxdiv_t __cdecl imaxdiv(intmax_t numer, intmax_t denom) {
imaxdiv_t result;
result.quot = numer / denom;
result.rem = numer % denom;
result.quot = numer / denom;
result.rem = numer % denom;
if (numer < 0 && result.rem > 0) {
// did division wrong; must fix up
++result.quot;
result.rem -= denom;
}
if (numer < 0 && result.rem > 0) {
// did division wrong; must fix up
++result.quot;
result.rem -= denom;
}
return result;
return result;
}
// 7.8.2.3 The strtoimax and strtoumax functions
......
......@@ -43,17 +43,17 @@ typedef unsigned __int64 uint64_t;
#endif
#ifdef _MSC_VER
#ifdef BELLESIP_STATIC
#define BELLESIP_EXPORT
#else
#ifdef BELLESIP_EXPORTS
#define BELLESIP_EXPORT __declspec(dllexport)
#else
#define BELLESIP_EXPORT __declspec(dllimport)
#endif
#endif
#ifdef BELLESIP_STATIC
#define BELLESIP_EXPORT
#else
#ifdef BELLESIP_EXPORTS
#define BELLESIP_EXPORT __declspec(dllexport)
#else
#define BELLESIP_EXPORT __declspec(dllimport)
#endif
#endif
#else
#define BELLESIP_EXPORT
#define BELLESIP_EXPORT
#endif
#define BELLESIP_UNUSED(a) (void)a;
......
This diff is collapsed.
......@@ -977,7 +977,7 @@ struct belle_sip_auth_event {
char* distinguished_name;
belle_sip_certificates_chain_t * cert;
belle_sip_signing_key_t* key;
char* algorithm; /* either MD5 ot SHA256*/
char* algorithm; /* either MD5 ot SHA256*/
};
belle_sip_auth_event_t* belle_sip_auth_event_create(belle_sip_object_t *source, const char* realm,const belle_sip_uri_t * from_uri);
......
......@@ -1595,11 +1595,11 @@ void belle_sip_channel_check_dns_reusability(belle_sip_channel_t *obj) {
#ifdef __ANDROID__
unsigned long belle_sip_begin_background_task(const char *name, belle_sip_background_task_end_callback_t cb, void *data){
return wake_lock_acquire(name);
return wake_lock_acquire(name);
}
void belle_sip_end_background_task(unsigned long id){
wake_lock_release(id);
wake_lock_release(id);
}
#elif !TARGET_OS_IPHONE && !defined(__APPLE__)
......
......@@ -4943,22 +4943,22 @@ int dns_resconf_loadwin(struct dns_resolv_conf *resconf) {
FIXED_INFO *pFixedInfo;
ULONG ulOutBufLen;
DWORD dwRetVal;
IP_ADDR_STRING *pIPAddr;
IP_ADDR_STRING *pIPAddr;
unsigned sa_count = 0;
int error;
pFixedInfo = (FIXED_INFO *) malloc(sizeof(FIXED_INFO));
if (pFixedInfo == NULL) {
return -1;
}
ulOutBufLen = sizeof(FIXED_INFO);
if (pFixedInfo == NULL) {
return -1;
}
ulOutBufLen = sizeof(FIXED_INFO);
if (GetNetworkParams(pFixedInfo, &ulOutBufLen) == ERROR_BUFFER_OVERFLOW) {
free(pFixedInfo);
pFixedInfo = (FIXED_INFO *) malloc(ulOutBufLen);
if (pFixedInfo == NULL) {
return -1;
}
}
free(pFixedInfo);
pFixedInfo = (FIXED_INFO *) malloc(ulOutBufLen);
if (pFixedInfo == NULL) {
return -1;
}
}
if ((dwRetVal = GetNetworkParams(pFixedInfo, &ulOutBufLen)) == NO_ERROR) {
memset(resconf->search, '\0', sizeof resconf->search);
......
This diff is collapsed.
......@@ -65,9 +65,9 @@ typedef unsigned int md5_word_t; /* 32-bit word */
/* Define the state of the MD5 Algorithm. */
typedef struct md5_state_s {
md5_word_t count[2]; /* message length in bits, lsw first */
md5_word_t abcd[4]; /* digest buffer */
md5_byte_t buf[64]; /* accumulate block */
md5_word_t count[2]; /* message length in bits, lsw first */
md5_word_t abcd[4]; /* digest buffer */
md5_byte_t buf[64]; /* accumulate block */
} md5_state_t;
#ifdef __cplusplus
......
......@@ -1103,57 +1103,57 @@ static belle_sip_list_t* belle_sip_provider_get_auth_context_by_realm_or_call_id
return result;
}
static void belle_sip_provider_update_or_create_auth_context(belle_sip_provider_t *p,belle_sip_header_call_id_t* call_id,belle_sip_header_www_authenticate_t* authenticate,belle_sip_uri_t *from_uri,const char* realm) {
belle_sip_list_t* auth_context_lst = NULL;
authorization_context_t* auth_context;
for (auth_context_lst= belle_sip_provider_get_auth_context_by_realm_or_call_id(p,call_id,from_uri,realm);auth_context_lst!=NULL;auth_context_lst=auth_context_lst->next) {
auth_context=(authorization_context_t*)auth_context_lst->data;
if ((strcmp(auth_context->realm,belle_sip_header_www_authenticate_get_realm(authenticate))==0)&&((auth_context->algorithm==NULL)||strcmp(auth_context->algorithm,belle_sip_header_www_authenticate_get_algorithm(authenticate))==0)) {
authorization_context_fill_from_auth(auth_context,authenticate,from_uri);
if (auth_context_lst) belle_sip_free(auth_context_lst);
return; /*only one realm is supposed to be found for now*/
}
static void belle_sip_provider_update_or_create_auth_context(belle_sip_provider_t *p, belle_sip_header_call_id_t *call_id, belle_sip_header_www_authenticate_t *authenticate, belle_sip_uri_t *from_uri, const char *realm) {
belle_sip_list_t *auth_context_lst = NULL;
authorization_context_t *auth_context;
for (auth_context_lst = belle_sip_provider_get_auth_context_by_realm_or_call_id(p, call_id, from_uri, realm); auth_context_lst != NULL; auth_context_lst = auth_context_lst->next) {
auth_context = (authorization_context_t *)auth_context_lst->data;
if ((strcmp(auth_context->realm, belle_sip_header_www_authenticate_get_realm(authenticate)) == 0) && ((auth_context->algorithm == NULL) || strcmp(auth_context->algorithm, belle_sip_header_www_authenticate_get_algorithm(authenticate)) == 0)) {
authorization_context_fill_from_auth(auth_context, authenticate, from_uri);
if (auth_context_lst) belle_sip_free(auth_context_lst);
return; /*only one realm is supposed to be found for now*/
}
}
/*no auth context found, creating one*/
auth_context=belle_sip_authorization_create(call_id);
if (BELLE_SIP_OBJECT_IS_INSTANCE_OF(authenticate,belle_sip_header_proxy_authenticate_t)) {
auth_context->is_proxy=1; /*this cannot be changed*/
auth_context = belle_sip_authorization_create(call_id);
if (BELLE_SIP_OBJECT_IS_INSTANCE_OF(authenticate, belle_sip_header_proxy_authenticate_t)) {
auth_context->is_proxy = 1; /*this cannot be changed*/
}
belle_sip_debug("belle_sip_provider_auth: no matching auth context, creating one for [realm=%s][user_id=%s][call_id=%s]"
, belle_sip_header_www_authenticate_get_realm(authenticate)?belle_sip_header_www_authenticate_get_realm(authenticate):"(null)"
, from_uri?belle_sip_uri_get_user(from_uri):"(null)"
, call_id?belle_sip_header_call_id_get_call_id(call_id):"(null)");
authorization_context_fill_from_auth(auth_context,authenticate,from_uri);
, belle_sip_header_www_authenticate_get_realm(authenticate) ? belle_sip_header_www_authenticate_get_realm(authenticate) : "(null)"
, from_uri ? belle_sip_uri_get_user(from_uri) : "(null)"
, call_id ? belle_sip_header_call_id_get_call_id(call_id) : "(null)");
authorization_context_fill_from_auth(auth_context, authenticate, from_uri);
p->auth_contexts=belle_sip_list_append(p->auth_contexts,auth_context);
p->auth_contexts = belle_sip_list_append(p->auth_contexts, auth_context);
if (auth_context_lst) belle_sip_free(auth_context_lst);
return;
}
static belle_sip_list_t* belle_sip_list_find_event(belle_sip_list_t* list, belle_sip_auth_event_t* auth_event){
for(;list!=NULL;list=list->next){
belle_sip_auth_event_t* ref_event = (belle_sip_auth_event_t*)list->data;
if((!strcmp(ref_event->realm, auth_event->realm))&&(!strcmp(ref_event->username, auth_event->username)))
return list;
}
return NULL;
}
static belle_sip_list_t* belle_sip_list_find_double_events(belle_sip_list_t* list, belle_sip_auth_event_t* auth_event){
belle_sip_list_t* ref_list;
belle_sip_list_t* ref_list2;
if((ref_list=belle_sip_list_find_event(list,auth_event))&&(ref_list2=belle_sip_list_find_event(ref_list->next,auth_event))){
belle_sip_auth_event_t* ref_event = (belle_sip_auth_event_t*)ref_list2->data;
/*delete which hasn't passwd*/
if(ref_event->passwd || ref_event->ha1)
return ref_list;
else
return ref_list2;
}
return NULL;
static belle_sip_list_t *belle_sip_list_find_event(belle_sip_list_t *list, belle_sip_auth_event_t *auth_event) {
for (; list != NULL; list = list->next) {
belle_sip_auth_event_t *ref_event = (belle_sip_auth_event_t *)list->data;
if ((!strcmp(ref_event->realm, auth_event->realm)) && (!strcmp(ref_event->username, auth_event->username)))
return list;
}
return NULL;
}
static belle_sip_list_t *belle_sip_list_find_double_events(belle_sip_list_t *list, belle_sip_auth_event_t *auth_event) {
belle_sip_list_t *ref_list;
belle_sip_list_t *ref_list2;
if ((ref_list = belle_sip_list_find_event(list, auth_event)) && (ref_list2 = belle_sip_list_find_event(ref_list->next, auth_event))) {
belle_sip_auth_event_t *ref_event = (belle_sip_auth_event_t *)ref_list2->data;
/*delete which hasn't passwd*/
if (ref_event->passwd || ref_event->ha1)
return ref_list;
else
return ref_list2;
}
return NULL;
}
int belle_sip_provider_add_authorization(belle_sip_provider_t *p, belle_sip_request_t* request, belle_sip_response_t *resp,
......@@ -1171,8 +1171,8 @@ int belle_sip_provider_add_authorization(belle_sip_provider_t *p, belle_sip_requ
char computed_ha1[65];
int result=0;
const char* request_method;
size_t size;
const char* algo;
size_t size;
const char* algo;
/*check params*/
if (!p || !request) {
belle_sip_error("belle_sip_provider_add_authorization bad parameters");
......@@ -1238,8 +1238,8 @@ int belle_sip_provider_add_authorization(belle_sip_provider_t *p, belle_sip_requ
, from_uri?belle_sip_uri_get_user(from_uri):"(null)"
, call_id?belle_sip_header_call_id_get_call_id(call_id):"(null)"
);
head=belle_sip_provider_get_auth_context_by_realm_or_call_id(p,call_id,from_uri,realm);
/*we assume there no existing auth headers*/
head=belle_sip_provider_get_auth_context_by_realm_or_call_id(p,call_id,from_uri,realm);
/*we assume there no existing auth headers*/
for (auth_context_iterator=head;auth_context_iterator!=NULL;auth_context_iterator=auth_context_iterator->next) {
/*clear auth info*/
auth_context=(authorization_context_t*)auth_context_iterator->data;
......
......@@ -41,25 +41,25 @@ static void test_authentication(void) {
}
static void test_authentication_sha256(void) {
const char* l_raw_header = "WWW-Authenticate: Digest "
"algorithm=SHA-256, realm=\"http-auth@example.org\", opaque=\"FQhe/qaU925kfnzjCev0ciny7QMkPqMAFRtzCUYo5tdS\","
" qop=\"auth,auth-int\", nonce=\"7ypf/xlj9XXwfDPEoM4URrv/xwf94BcCAzFZH4GiTo0v\"";
char ha1[65];
size_t size = sizeof(ha1)/sizeof(char);
belle_sip_header_www_authenticate_t* www_authenticate=belle_sip_header_www_authenticate_parse(l_raw_header);
belle_sip_header_authorization_t* authorization = belle_sip_auth_helper_create_authorization(www_authenticate);
belle_sip_header_authorization_set_uri(authorization,belle_sip_uri_parse("sip:sip.linphone.org"));
belle_sip_header_authorization_set_nonce_count(authorization,1);
belle_sip_header_authorization_set_qop(authorization,"auth");
belle_sip_header_authorization_set_cnonce(authorization,"8302210f"); /*for testing purpose*/
const char *algo = belle_sip_header_authorization_get_algorithm(authorization);
BC_ASSERT_EQUAL(0,belle_sip_auth_helper_compute_ha1_for_algorithm("Mufasa","http-auth@example.org","Circle of Life",ha1,size,algo), int, "%d");
BC_ASSERT_EQUAL(0,belle_sip_auth_helper_fill_authorization(authorization,"REGISTER",ha1), int, "%d");
BC_ASSERT_STRING_EQUAL(belle_sip_header_authorization_get_qop(authorization),"auth");
BC_ASSERT_STRING_EQUAL(belle_sip_header_authorization_get_response(authorization),"91253bea2bbc3b34a5dac192c672fb7fff1ae6d657207b6719842827a509a501");
BC_ASSERT_EQUAL(belle_sip_header_authorization_get_nonce_count(authorization),1, int, "%d");
belle_sip_object_unref(www_authenticate);
belle_sip_object_unref(authorization);
const char *l_raw_header = "WWW-Authenticate: Digest "
"algorithm=SHA-256, realm=\"http-auth@example.org\", opaque=\"FQhe/qaU925kfnzjCev0ciny7QMkPqMAFRtzCUYo5tdS\","
" qop=\"auth,auth-int\", nonce=\"7ypf/xlj9XXwfDPEoM4URrv/xwf94BcCAzFZH4GiTo0v\"";
char ha1[65];
size_t size = sizeof(ha1) / sizeof(char);
belle_sip_header_www_authenticate_t *www_authenticate = belle_sip_header_www_authenticate_parse(l_raw_header);
belle_sip_header_authorization_t *authorization = belle_sip_auth_helper_create_authorization(www_authenticate);
belle_sip_header_authorization_set_uri(authorization, belle_sip_uri_parse("sip:sip.linphone.org"));
belle_sip_header_authorization_set_nonce_count(authorization, 1);
belle_sip_header_authorization_set_qop(authorization, "auth");
belle_sip_header_authorization_set_cnonce(authorization, "8302210f"); /*for testing purpose*/
const char *algo = belle_sip_header_authorization_get_algorithm(authorization);
BC_ASSERT_EQUAL(0, belle_sip_auth_helper_compute_ha1_for_algorithm("Mufasa", "http-auth@example.org", "Circle of Life", ha1, size, algo), int, "%d");
BC_ASSERT_EQUAL(0, belle_sip_auth_helper_fill_authorization(authorization, "REGISTER", ha1), int, "%d");
BC_ASSERT_STRING_EQUAL(belle_sip_header_authorization_get_qop(authorization), "auth");
BC_ASSERT_STRING_EQUAL(belle_sip_header_authorization_get_response(authorization), "91253bea2bbc3b34a5dac192c672fb7fff1ae6d657207b6719842827a509a501");
BC_ASSERT_EQUAL(belle_sip_header_authorization_get_nonce_count(authorization), 1, int, "%d");
belle_sip_object_unref(www_authenticate);
belle_sip_object_unref(authorization);
}
......@@ -218,8 +218,8 @@ static void test_certificate_fingerprint(void) {
test_t authentication_helper_tests[] = {
TEST_NO_TAG("Proxy-Authenticate", test_proxy_authentication),
TEST_NO_TAG("WWW-Authenticate", test_authentication),
TEST_NO_TAG("WWW-Authenticate-sha", test_authentication_sha256),
TEST_NO_TAG("WWW-Authenticate", test_authentication),
TEST_NO_TAG("WWW-Authenticate-sha", test_authentication_sha256),
TEST_NO_TAG("WWW-Authenticate (with qop)", test_authentication_qop_auth),
TEST_NO_TAG("generate and parse self signed certificates", test_generate_and_parse_certificates),
TEST_NO_TAG("generate certificate fingerprint", test_certificate_fingerprint)
......
This diff is collapsed.
......@@ -213,93 +213,93 @@ const char *belle_sip_tester_root_ca =
"G+GMmIPLHzHxREzGBHNJdmAPx/i9F4BrLunMTA5amnkPIAou1Z5jJh5VkpTYghdae9C8x49OhgQ=\n"
"-----END CERTIFICprocess_auth_requestedATE-----\n";
static void process_auth_requested(void *user_ctx, belle_sip_auth_event_t *event){
BELLESIP_UNUSED(user_ctx);
if (belle_sip_auth_event_get_mode(event) == BELLE_SIP_AUTH_MODE_HTTP_DIGEST) {
const char *username = belle_sip_auth_event_get_username(event);
const char *realm = belle_sip_auth_event_get_realm(event);
belle_sip_message("process_auth_requested requested for [%s@%s]"
,username?username:""
,realm?realm:"");
belle_sip_auth_event_set_passwd(event,"secret");
} else if (belle_sip_auth_event_get_mode(event) == BELLE_SIP_AUTH_MODE_TLS) {
const char *distinguished_name = NULL;
belle_sip_certificates_chain_t* cert = belle_sip_certificates_chain_parse(belle_sip_tester_client_cert,strlen(belle_sip_tester_client_cert),BELLE_SIP_CERTIFICATE_RAW_FORMAT_PEM);
belle_sip_signing_key_t* key = belle_sip_signing_key_parse(belle_sip_tester_private_key,strlen(belle_sip_tester_private_key),belle_sip_tester_private_key_passwd);
belle_sip_auth_event_set_client_certificates_chain(event,cert);
belle_sip_auth_event_set_signing_key(event,key);
distinguished_name = belle_sip_auth_event_get_distinguished_name(event);
belle_sip_message("process_auth_requested requested for DN[%s]",distinguished_name?distinguished_name:"");
} else {
belle_sip_error("Unexpected auth mode");
}
static void process_auth_requested(void *user_ctx, belle_sip_auth_event_t *event) {
BELLESIP_UNUSED(user_ctx);
if (belle_sip_auth_event_get_mode(event) == BELLE_SIP_AUTH_MODE_HTTP_DIGEST) {
const char *username = belle_sip_auth_event_get_username(event);
const char *realm = belle_sip_auth_event_get_realm(event);
belle_sip_message("process_auth_requested requested for [%s@%s]"
, username ? username : ""
, realm ? realm : "");
belle_sip_auth_event_set_passwd(event, "secret");
} else if (belle_sip_auth_event_get_mode(event) == BELLE_SIP_AUTH_MODE_TLS) {
const char *distinguished_name = NULL;
belle_sip_certificates_chain_t *cert = belle_sip_certificates_chain_parse(belle_sip_tester_client_cert, strlen(belle_sip_tester_client_cert), BELLE_SIP_CERTIFICATE_RAW_FORMAT_PEM);
belle_sip_signing_key_t *key = belle_sip_signing_key_parse(belle_sip_tester_private_key, strlen(belle_sip_tester_private_key), belle_sip_tester_private_key_passwd);
belle_sip_auth_event_set_client_certificates_chain(event, cert);
belle_sip_auth_event_set_signing_key(event, key);
distinguished_name = belle_sip_auth_event_get_distinguished_name(event);
belle_sip_message("process_auth_requested requested for DN[%s]", distinguished_name ? distinguished_name : "");
} else {
belle_sip_error("Unexpected auth mode");
}
}
static void process_auth_requested_for_algorithm(void *user_ctx, belle_sip_auth_event_t *event){
const char** client;
client = (const char** ) user_ctx; //*client is algorithm of client, *(client+1) is password haché
if(*client==NULL)
*client = "MD5";
if (belle_sip_auth_event_get_mode(event) == BELLE_SIP_AUTH_MODE_HTTP_DIGEST) {
const char *username = belle_sip_auth_event_get_username(event);
const char *realm = belle_sip_auth_event_get_realm(event);
belle_sip_message("process_auth_requested requested for [%s@%s]"
,username?username:""
,realm?realm:"");
/* Default algorithm is MD5 if it's NULL. If algorithm of client = algorithm of server (event->algorithm), set ha1 or passwd. */
if (((event->algorithm)&&(!strcmp(*client,event->algorithm)))||((event->algorithm==NULL)&&(!strcmp(*client, "MD5")))){
if(*(client+1))
belle_sip_auth_event_set_ha1(event, *(client+1));
else
belle_sip_auth_event_set_passwd(event,"secret");
}
} else if (belle_sip_auth_event_get_mode(event) == BELLE_SIP_AUTH_MODE_TLS) {
const char *distinguished_name = NULL;
belle_sip_certificates_chain_t* cert = belle_sip_certificates_chain_parse(belle_sip_tester_client_cert,strlen(belle_sip_tester_client_cert),BELLE_SIP_CERTIFICATE_RAW_FORMAT_PEM);
belle_sip_signing_key_t* key = belle_sip_signing_key_parse(belle_sip_tester_private_key,strlen(belle_sip_tester_private_key),belle_sip_tester_private_key_passwd);
belle_sip_auth_event_set_client_certificates_chain(event,cert);
belle_sip_auth_event_set_signing_key(event,key);
distinguished_name = belle_sip_auth_event_get_distinguished_name(event);
belle_sip_message("process_auth_requested requested for DN[%s]",distinguished_name?distinguished_name:"");
} else {
belle_sip_error("Unexpected auth mode");
}
static void process_auth_requested_for_algorithm(void *user_ctx, belle_sip_auth_event_t *event) {
const char **client;
client = (const char **) user_ctx; //*client is algorithm of client, *(client+1) is password haché
if (*client == NULL)
*client = "MD5";
if (belle_sip_auth_event_get_mode(event) == BELLE_SIP_AUTH_MODE_HTTP_DIGEST) {
const char *username = belle_sip_auth_event_get_username(event);
const char *realm = belle_sip_auth_event_get_realm(event);
belle_sip_message("process_auth_requested requested for [%s@%s]"
, username ? username : ""
, realm ? realm : "");
/* Default algorithm is MD5 if it's NULL. If algorithm of client = algorithm of server (event->algorithm), set ha1 or passwd. */
if (((event->algorithm) && (!strcmp(*client, event->algorithm))) || ((event->algorithm == NULL) && (!strcmp(*client, "MD5")))) {
if (*(client + 1))
belle_sip_auth_event_set_ha1(event, *(client + 1));
else
belle_sip_auth_event_set_passwd(event, "secret");
}
} else if (belle_sip_auth_event_get_mode(event) == BELLE_SIP_AUTH_MODE_TLS) {
const char *distinguished_name = NULL;
belle_sip_certificates_chain_t *cert = belle_sip_certificates_chain_parse(belle_sip_tester_client_cert, strlen(belle_sip_tester_client_cert), BELLE_SIP_CERTIFICATE_RAW_FORMAT_PEM);
belle_sip_signing_key_t *key = belle_sip_signing_key_parse(belle_sip_tester_private_key, strlen(belle_sip_tester_private_key), belle_sip_tester_private_key_passwd);
belle_sip_auth_event_set_client_certificates_chain(event, cert);
belle_sip_auth_event_set_signing_key(event, key);
distinguished_name = belle_sip_auth_event_get_distinguished_name(event);
belle_sip_message("process_auth_requested requested for DN[%s]", distinguished_name ? distinguished_name : "");
} else {
belle_sip_error("Unexpected auth mode");
}
}
int register_before_all(void) {
belle_sip_listening_point_t *lp;
stack=belle_sip_stack_new(NULL);
const char* client[2] = {NULL, NULL};
stack = belle_sip_stack_new(NULL);
const char *client[2] = {NULL, NULL};
if (userhostsfile)
belle_sip_stack_set_dns_user_hosts_file(stack,userhostsfile);
lp=belle_sip_stack_create_listening_point(stack,"0.0.0.0",7060,"UDP");
prov=belle_sip_stack_create_provider(stack,lp);
belle_sip_stack_set_dns_user_hosts_file(stack, userhostsfile);
lp = belle_sip_stack_create_listening_point(stack, "0.0.0.0", 7060, "UDP");
prov = belle_sip_stack_create_provider(stack, lp);
lp=belle_sip_stack_create_listening_point(stack,"0.0.0.0",7060,"TCP");
belle_sip_provider_add_listening_point(prov,lp);
lp=belle_sip_stack_create_listening_point(stack,"0.0.0.0",7061,"TLS");
lp = belle_sip_stack_create_listening_point(stack, "0.0.0.0", 7060, "TCP");
belle_sip_provider_add_listening_point(prov, lp);
lp = belle_sip_stack_create_listening_point(stack, "0.0.0.0", 7061, "TLS");
if (lp) {
belle_tls_crypto_config_t *crypto_config=belle_tls_crypto_config_new();
belle_tls_crypto_config_t *crypto_config = belle_tls_crypto_config_new();
belle_tls_crypto_config_set_root_ca_data(crypto_config, belle_sip_tester_root_ca);
belle_sip_tls_listening_point_set_crypto_config(BELLE_SIP_TLS_LISTENING_POINT(lp), crypto_config);
belle_sip_provider_add_listening_point(prov,lp);
belle_sip_provider_add_listening_point(prov, lp);
belle_sip_object_unref(crypto_config);
}
listener_callbacks.process_dialog_terminated=process_dialog_terminated;
listener_callbacks.process_io_error=process_io_error;
listener_callbacks.process_request_event=process_request_event;
listener_callbacks.process_response_event=process_response_event;
listener_callbacks.process_timeout=process_timeout;
listener_callbacks.process_transaction_terminated=process_transaction_terminated;
listener_callbacks.process_auth_requested=process_auth_requested_for_algorithm;
listener_callbacks.listener_destroyed=NULL;
listener=belle_sip_listener_create_from_callbacks(&listener_callbacks,client);
listener_callbacks.process_dialog_terminated = process_dialog_terminated;
listener_callbacks.process_io_error = process_io_error;
listener_callbacks.process_request_event = process_request_event;
listener_callbacks.process_response_event = process_response_event;
listener_callbacks.process_timeout = process_timeout;
listener_callbacks.process_transaction_terminated = process_transaction_terminated;
listener_callbacks.process_auth_requested = process_auth_requested_for_algorithm;
listener_callbacks.listener_destroyed = NULL;
listener = belle_sip_listener_create_from_callbacks(&listener_callbacks, client);
return 0;
}
......
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