diff options
author | Liong Sauw Ming <ming@teluu.com> | 2012-07-18 07:52:33 +0000 |
---|---|---|
committer | Liong Sauw Ming <ming@teluu.com> | 2012-07-18 07:52:33 +0000 |
commit | c1eabb7ee738b17cf6fd66e761a9269cb7582434 (patch) | |
tree | d23bc2d4b3616f8ff55fb193b4a44d452e34e152 /pjsip | |
parent | bf66ba19d4ad1a3ccfd3e8a5e68c62b82a56a037 (diff) |
Fixed #1556: Fix From/To tag and Via branch comparison to be case insensitive
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4208 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip')
-rw-r--r-- | pjsip/src/pjsip-ua/sip_100rel.c | 4 | ||||
-rw-r--r-- | pjsip/src/pjsip-ua/sip_inv.c | 2 | ||||
-rw-r--r-- | pjsip/src/pjsip/sip_dialog.c | 14 | ||||
-rw-r--r-- | pjsip/src/pjsip/sip_transaction.c | 41 | ||||
-rw-r--r-- | pjsip/src/pjsip/sip_ua_layer.c | 48 | ||||
-rw-r--r-- | pjsip/src/pjsip/sip_util_proxy.c | 2 | ||||
-rw-r--r-- | pjsip/src/test/tsx_uac_test.c | 32 | ||||
-rw-r--r-- | pjsip/src/test/tsx_uas_test.c | 74 |
8 files changed, 111 insertions, 106 deletions
diff --git a/pjsip/src/pjsip-ua/sip_100rel.c b/pjsip/src/pjsip-ua/sip_100rel.c index d2bb1d42..60b989b2 100644 --- a/pjsip/src/pjsip-ua/sip_100rel.c +++ b/pjsip/src/pjsip-ua/sip_100rel.c @@ -273,7 +273,7 @@ PJ_DEF(pj_status_t) pjsip_100rel_create_prack( pjsip_inv_session *inv, /* Find UAC state for the specified call leg */ uac_state = dd->uac_state_list; while (uac_state) { - if (pj_strcmp(&uac_state->tag, to_tag)==0) + if (pj_stricmp(&uac_state->tag, to_tag)==0) break; uac_state = uac_state->next; } @@ -320,7 +320,7 @@ PJ_DEF(pj_status_t) pjsip_100rel_create_prack( pjsip_inv_session *inv, /* If this response is a forked response from a different call-leg, * update the req URI (https://trac.pjsip.org/repos/ticket/1364) */ - if (pj_strcmp(&uac_state->tag, &dd->inv->dlg->remote.info->tag)) { + if (pj_stricmp(&uac_state->tag, &dd->inv->dlg->remote.info->tag)) { const pjsip_contact_hdr *mhdr; mhdr = (const pjsip_contact_hdr*) diff --git a/pjsip/src/pjsip-ua/sip_inv.c b/pjsip/src/pjsip-ua/sip_inv.c index d14081b9..643ec706 100644 --- a/pjsip/src/pjsip-ua/sip_inv.c +++ b/pjsip/src/pjsip-ua/sip_inv.c @@ -1745,7 +1745,7 @@ static pj_status_t inv_check_sdp_in_incoming_msg( pjsip_inv_session *inv, if (tsx->role == PJSIP_ROLE_UAC && rdata->msg_info.msg->line.status.code/100 == 2 && tsx_inv_data->done_early && - pj_strcmp(&tsx_inv_data->done_tag, &res_tag)) + pj_stricmp(&tsx_inv_data->done_tag, &res_tag)) { const pjmedia_sdp_session *reoffer_sdp = NULL; diff --git a/pjsip/src/pjsip/sip_dialog.c b/pjsip/src/pjsip/sip_dialog.c index 89986895..9ddadb02 100644 --- a/pjsip/src/pjsip/sip_dialog.c +++ b/pjsip/src/pjsip/sip_dialog.c @@ -206,8 +206,8 @@ PJ_DEF(pj_status_t) pjsip_dlg_create_uac( pjsip_user_agent *ua, pj_create_unique_string(dlg->pool, &dlg->local.info->tag); /* Calculate hash value of local tag. */ - dlg->local.tag_hval = pj_hash_calc(0, dlg->local.info->tag.ptr, - dlg->local.info->tag.slen); + dlg->local.tag_hval = pj_hash_calc_tolower(0, NULL, + &dlg->local.info->tag); /* Randomize local CSeq. */ dlg->local.first_cseq = pj_rand() & 0x7FFF; @@ -374,8 +374,7 @@ PJ_DEF(pj_status_t) pjsip_dlg_create_uas( pjsip_user_agent *ua, pj_strdup(dlg->pool, &dlg->local.info_str, &tmp); /* Calculate hash value of local tag. */ - dlg->local.tag_hval = pj_hash_calc(0, dlg->local.info->tag.ptr, - dlg->local.info->tag.slen); + dlg->local.tag_hval = pj_hash_calc_tolower(0, NULL, &dlg->local.info->tag); /* Randomize local cseq */ @@ -522,8 +521,7 @@ PJ_DEF(pj_status_t) pjsip_dlg_create_uas( pjsip_user_agent *ua, ++dlg->tsx_count; /* Calculate hash value of remote tag. */ - dlg->remote.tag_hval = pj_hash_calc(0, dlg->remote.info->tag.ptr, - dlg->remote.info->tag.slen); + dlg->remote.tag_hval = pj_hash_calc_tolower(0, NULL, &dlg->remote.info->tag); /* Update remote capabilities info */ pjsip_dlg_update_remote_cap(dlg, rdata->msg_info.msg, PJ_TRUE); @@ -1817,7 +1815,7 @@ void pjsip_dlg_on_rx_response( pjsip_dialog *dlg, pjsip_rx_data *rdata ) res_code > 100 && res_code/100 <= 2 && pjsip_method_creates_dialog(&rdata->msg_info.cseq->method) && - pj_strcmp(&dlg->remote.info->tag, &rdata->msg_info.to->tag))) + pj_stricmp(&dlg->remote.info->tag, &rdata->msg_info.to->tag))) { pjsip_contact_hdr *contact; @@ -1826,7 +1824,7 @@ void pjsip_dlg_on_rx_response( pjsip_dialog *dlg, pjsip_rx_data *rdata ) * with To-tag or forking, apply strict update. */ pjsip_dlg_update_remote_cap(dlg, rdata->msg_info.msg, - pj_strcmp(&dlg->remote.info->tag, + pj_stricmp(&dlg->remote.info->tag, &rdata->msg_info.to->tag)); /* Update To tag. */ diff --git a/pjsip/src/pjsip/sip_transaction.c b/pjsip/src/pjsip/sip_transaction.c index 3560b775..b0cad3ce 100644 --- a/pjsip/src/pjsip/sip_transaction.c +++ b/pjsip/src/pjsip/sip_transaction.c @@ -403,7 +403,7 @@ PJ_DEF(pj_status_t) pjsip_tsx_create_key( pj_pool_t *pool, pj_str_t *key, */ const pj_str_t *branch = &rdata->msg_info.via->branch_param; - if (pj_strncmp(branch,&rfc3261_branch,PJSIP_RFC3261_BRANCH_LEN)==0) { + if (pj_strnicmp(branch,&rfc3261_branch,PJSIP_RFC3261_BRANCH_LEN)==0) { /* Create transaction key. */ return create_tsx_key_3261(pool, key, role, method, branch); @@ -548,10 +548,10 @@ static pj_status_t mod_tsx_layer_register_tsx( pjsip_transaction *tsx) * Do not use PJ_ASSERT_RETURN since it evaluates the expression * twice! */ - if(pj_hash_get(mod_tsx_layer.htable, - tsx->transaction_key.ptr, - tsx->transaction_key.slen, - NULL)) + if(pj_hash_get_lower(mod_tsx_layer.htable, + tsx->transaction_key.ptr, + tsx->transaction_key.slen, + NULL)) { pj_mutex_unlock(mod_tsx_layer.mutex); PJ_LOG(2,(THIS_FILE, @@ -568,11 +568,13 @@ static pj_status_t mod_tsx_layer_register_tsx( pjsip_transaction *tsx) /* Register the transaction to the hash table. */ #ifdef PRECALC_HASH - pj_hash_set( tsx->pool, mod_tsx_layer.htable, tsx->transaction_key.ptr, - tsx->transaction_key.slen, tsx->hashed_key, tsx); + pj_hash_set_lower( tsx->pool, mod_tsx_layer.htable, + tsx->transaction_key.ptr, + tsx->transaction_key.slen, tsx->hashed_key, tsx); #else - pj_hash_set( tsx->pool, mod_tsx_layer.htable, tsx->transaction_key.ptr, - tsx->transaction_key.slen, 0, tsx); + pj_hash_set_lower( tsx->pool, mod_tsx_layer.htable, + tsx->transaction_key.ptr, + tsx->transaction_key.slen, 0, tsx); #endif /* Unlock mutex. */ @@ -604,11 +606,11 @@ static void mod_tsx_layer_unregister_tsx( pjsip_transaction *tsx) /* Register the transaction to the hash table. */ #ifdef PRECALC_HASH - pj_hash_set( NULL, mod_tsx_layer.htable, tsx->transaction_key.ptr, - tsx->transaction_key.slen, tsx->hashed_key, NULL); + pj_hash_set_lower( NULL, mod_tsx_layer.htable, tsx->transaction_key.ptr, + tsx->transaction_key.slen, tsx->hashed_key, NULL); #else - pj_hash_set( NULL, mod_tsx_layer.htable, tsx->transaction_key.ptr, - tsx->transaction_key.slen, 0, NULL); + pj_hash_set_lower( NULL, mod_tsx_layer.htable, tsx->transaction_key.ptr, + tsx->transaction_key.slen, 0, NULL); #endif TSX_TRACE_((THIS_FILE, @@ -651,7 +653,8 @@ PJ_DEF(pjsip_transaction*) pjsip_tsx_layer_find_tsx( const pj_str_t *key, pj_mutex_lock(mod_tsx_layer.mutex); tsx = (pjsip_transaction*) - pj_hash_get( mod_tsx_layer.htable, key->ptr, key->slen, &hval ); + pj_hash_get_lower( mod_tsx_layer.htable, key->ptr, key->slen, + &hval ); pj_mutex_unlock(mod_tsx_layer.mutex); TSX_TRACE_((THIS_FILE, @@ -785,7 +788,7 @@ static pj_bool_t mod_tsx_layer_on_rx_request(pjsip_rx_data *rdata) pj_mutex_lock( mod_tsx_layer.mutex ); tsx = (pjsip_transaction*) - pj_hash_get( mod_tsx_layer.htable, key.ptr, key.slen, &hval ); + pj_hash_get_lower( mod_tsx_layer.htable, key.ptr, key.slen, &hval ); TSX_TRACE_((THIS_FILE, @@ -834,7 +837,7 @@ static pj_bool_t mod_tsx_layer_on_rx_response(pjsip_rx_data *rdata) pj_mutex_lock( mod_tsx_layer.mutex ); tsx = (pjsip_transaction*) - pj_hash_get( mod_tsx_layer.htable, key.ptr, key.slen, &hval ); + pj_hash_get_lower( mod_tsx_layer.htable, key.ptr, key.slen, &hval ); TSX_TRACE_((THIS_FILE, @@ -1299,8 +1302,7 @@ PJ_DEF(pj_status_t) pjsip_tsx_create_uac( pjsip_module *tsx_user, /* Calculate hashed key value. */ #ifdef PRECALC_HASH - tsx->hashed_key = pj_hash_calc(0, tsx->transaction_key.ptr, - tsx->transaction_key.slen); + tsx->hashed_key = pj_hash_calc_tolower(0, NULL, &tsx->transaction_key); #endif PJ_LOG(6, (tsx->obj_name, "tsx_key=%.*s", tsx->transaction_key.slen, @@ -1432,8 +1434,7 @@ PJ_DEF(pj_status_t) pjsip_tsx_create_uas( pjsip_module *tsx_user, /* Calculate hashed key value. */ #ifdef PRECALC_HASH - tsx->hashed_key = pj_hash_calc(0, tsx->transaction_key.ptr, - tsx->transaction_key.slen); + tsx->hashed_key = pj_hash_calc_tolower(0, NULL, &tsx->transaction_key); #endif /* Duplicate branch parameter for transaction. */ diff --git a/pjsip/src/pjsip/sip_ua_layer.c b/pjsip/src/pjsip/sip_ua_layer.c index e305d610..1279d738 100644 --- a/pjsip/src/pjsip/sip_ua_layer.c +++ b/pjsip/src/pjsip/sip_ua_layer.c @@ -302,9 +302,10 @@ PJ_DEF(pj_status_t) pjsip_ua_register_dlg( pjsip_user_agent *ua, struct dlg_set *dlg_set; dlg_set = (struct dlg_set*) - pj_hash_get( mod_ua.dlg_table, dlg->local.info->tag.ptr, - dlg->local.info->tag.slen, - &dlg->local.tag_hval); + pj_hash_get_lower( mod_ua.dlg_table, + dlg->local.info->tag.ptr, + dlg->local.info->tag.slen, + &dlg->local.tag_hval); if (dlg_set) { /* This is NOT the first dialog in the dialog set. @@ -326,9 +327,11 @@ PJ_DEF(pj_status_t) pjsip_ua_register_dlg( pjsip_user_agent *ua, dlg->dlg_set = dlg_set; /* Register the dialog set in the hash table. */ - pj_hash_set_np(mod_ua.dlg_table, - dlg->local.info->tag.ptr, dlg->local.info->tag.slen, - dlg->local.tag_hval, dlg_set->ht_entry, dlg_set); + pj_hash_set_np_lower(mod_ua.dlg_table, + dlg->local.info->tag.ptr, + dlg->local.info->tag.slen, + dlg->local.tag_hval, dlg_set->ht_entry, + dlg_set); } } else { @@ -341,9 +344,10 @@ PJ_DEF(pj_status_t) pjsip_ua_register_dlg( pjsip_user_agent *ua, dlg->dlg_set = dlg_set; - pj_hash_set_np(mod_ua.dlg_table, - dlg->local.info->tag.ptr, dlg->local.info->tag.slen, - dlg->local.tag_hval, dlg_set->ht_entry, dlg_set); + pj_hash_set_np_lower(mod_ua.dlg_table, + dlg->local.info->tag.ptr, + dlg->local.info->tag.slen, + dlg->local.tag_hval, dlg_set->ht_entry, dlg_set); } /* Unlock user agent. */ @@ -387,8 +391,9 @@ PJ_DEF(pj_status_t) pjsip_ua_unregister_dlg( pjsip_user_agent *ua, /* If dialog list is empty, remove the dialog set from the hash table. */ if (pj_list_empty(&dlg_set->dlg_list)) { - pj_hash_set(NULL, mod_ua.dlg_table, dlg->local.info->tag.ptr, - dlg->local.info->tag.slen, dlg->local.tag_hval, NULL); + pj_hash_set_lower(NULL, mod_ua.dlg_table, dlg->local.info->tag.ptr, + dlg->local.info->tag.slen, dlg->local.tag_hval, + NULL); /* Return dlg_set to free nodes. */ pj_list_push_back(&mod_ua.free_dlgset_nodes, dlg_set); @@ -449,8 +454,8 @@ PJ_DEF(pjsip_dialog*) pjsip_ua_find_dialog(const pj_str_t *call_id, /* Lookup the dialog set. */ dlg_set = (struct dlg_set*) - pj_hash_get(mod_ua.dlg_table, local_tag->ptr, local_tag->slen, - NULL); + pj_hash_get_lower(mod_ua.dlg_table, local_tag->ptr, + local_tag->slen, NULL); if (dlg_set == NULL) { /* Not found */ pj_mutex_unlock(mod_ua.mutex); @@ -462,7 +467,7 @@ PJ_DEF(pjsip_dialog*) pjsip_ua_find_dialog(const pj_str_t *call_id, */ dlg = dlg_set->dlg_list.next; while (dlg != (pjsip_dialog*)&dlg_set->dlg_list) { - if (pj_strcmp(&dlg->remote.info->tag, remote_tag) == 0) + if (pj_stricmp(&dlg->remote.info->tag, remote_tag) == 0) break; dlg = dlg->next; } @@ -563,7 +568,8 @@ static struct dlg_set *find_dlg_set_for_msg( pjsip_rx_data *rdata ) /* Lookup the dialog set. */ dlg_set = (struct dlg_set*) - pj_hash_get(mod_ua.dlg_table, tag->ptr, tag->slen, NULL); + pj_hash_get_lower(mod_ua.dlg_table, tag->ptr, tag->slen, + NULL); return dlg_set; } } @@ -624,7 +630,7 @@ retry_on_deadlock: dlg = dlg_set->dlg_list.next; while (dlg != (pjsip_dialog*)&dlg_set->dlg_list) { - if (pj_strcmp(&dlg->remote.info->tag, from_tag) == 0) + if (pj_stricmp(&dlg->remote.info->tag, from_tag) == 0) break; dlg = dlg->next; @@ -761,10 +767,10 @@ retry_on_deadlock: /* Get the dialog set. */ dlg_set = (struct dlg_set*) - pj_hash_get(mod_ua.dlg_table, - rdata->msg_info.from->tag.ptr, - rdata->msg_info.from->tag.slen, - NULL); + pj_hash_get_lower(mod_ua.dlg_table, + rdata->msg_info.from->tag.ptr, + rdata->msg_info.from->tag.slen, + NULL); if (!dlg_set) { /* Unlock dialog hash table. */ @@ -812,7 +818,7 @@ retry_on_deadlock: break; /* Otherwise find the one with matching To tag. */ - if (pj_strcmp(to_tag, &dlg->remote.info->tag) == 0) + if (pj_stricmp(to_tag, &dlg->remote.info->tag) == 0) break; dlg = dlg->next; diff --git a/pjsip/src/pjsip/sip_util_proxy.c b/pjsip/src/pjsip/sip_util_proxy.c index 7666118f..240cf18b 100644 --- a/pjsip/src/pjsip/sip_util_proxy.c +++ b/pjsip/src/pjsip/sip_util_proxy.c @@ -345,7 +345,7 @@ PJ_DEF(pj_str_t) pjsip_calculate_branch_id( pjsip_rx_data *rdata ) /* If incoming request does not have RFC 3261 branch value, create * a branch value from GUID . */ - if (pj_strncmp(&rdata->msg_info.via->branch_param, + if (pj_strnicmp(&rdata->msg_info.via->branch_param, &rfc3261_branch, PJSIP_RFC3261_BRANCH_LEN) != 0 ) { pj_str_t tmp; diff --git a/pjsip/src/test/tsx_uac_test.c b/pjsip/src/test/tsx_uac_test.c index 1d67dea5..0677da18 100644 --- a/pjsip/src/test/tsx_uac_test.c +++ b/pjsip/src/test/tsx_uac_test.c @@ -159,7 +159,7 @@ static struct my_timer */ static void tsx_user_on_tsx_state(pjsip_transaction *tsx, pjsip_event *e) { - if (pj_strcmp2(&tsx->branch, TEST1_BRANCH_ID)==0) { + if (pj_stricmp2(&tsx->branch, TEST1_BRANCH_ID)==0) { /* * Transaction with TEST1_BRANCH_ID should terminate with transaction * timeout status. @@ -213,7 +213,7 @@ static void tsx_user_on_tsx_state(pjsip_transaction *tsx, pjsip_event *e) } } - } else if (pj_strcmp2(&tsx->branch, TEST2_BRANCH_ID)==0) { + } else if (pj_stricmp2(&tsx->branch, TEST2_BRANCH_ID)==0) { /* * Transaction with TEST2_BRANCH_ID should terminate with transport error. */ @@ -231,7 +231,7 @@ static void tsx_user_on_tsx_state(pjsip_transaction *tsx, pjsip_event *e) test_complete = 1; } - } else if (pj_strcmp2(&tsx->branch, TEST3_BRANCH_ID)==0) { + } else if (pj_stricmp2(&tsx->branch, TEST3_BRANCH_ID)==0) { /* * This test terminates the transaction while resolver is still * running. @@ -256,7 +256,7 @@ static void tsx_user_on_tsx_state(pjsip_transaction *tsx, pjsip_event *e) } - } else if (pj_strcmp2(&tsx->branch, TEST4_BRANCH_ID)==0) { + } else if (pj_stricmp2(&tsx->branch, TEST4_BRANCH_ID)==0) { /* * This test simulates transport failure after several * retransmissions. @@ -284,7 +284,7 @@ static void tsx_user_on_tsx_state(pjsip_transaction *tsx, pjsip_event *e) } - } else if (pj_strcmp2(&tsx->branch, TEST5_BRANCH_ID)==0) { + } else if (pj_stricmp2(&tsx->branch, TEST5_BRANCH_ID)==0) { /* * This test simulates transport failure after several * retransmissions. @@ -312,7 +312,7 @@ static void tsx_user_on_tsx_state(pjsip_transaction *tsx, pjsip_event *e) } - } else if (pj_strcmp2(&tsx->branch, TEST6_BRANCH_ID)==0) { + } else if (pj_stricmp2(&tsx->branch, TEST6_BRANCH_ID)==0) { /* * Successfull non-INVITE transaction. */ @@ -355,7 +355,7 @@ static void tsx_user_on_tsx_state(pjsip_transaction *tsx, pjsip_event *e) } - } else if (pj_strcmp2(&tsx->branch, TEST7_BRANCH_ID)==0) { + } else if (pj_stricmp2(&tsx->branch, TEST7_BRANCH_ID)==0) { /* * Successfull non-INVITE transaction. */ @@ -408,7 +408,7 @@ static void tsx_user_on_tsx_state(pjsip_transaction *tsx, pjsip_event *e) } - } else if (pj_strcmp2(&tsx->branch, TEST8_BRANCH_ID)==0) { + } else if (pj_stricmp2(&tsx->branch, TEST8_BRANCH_ID)==0) { /* * Failed INVITE transaction. */ @@ -468,7 +468,7 @@ static void tsx_user_on_tsx_state(pjsip_transaction *tsx, pjsip_event *e) } - } else if (pj_strcmp2(&tsx->branch, TEST9_BRANCH_ID)==0) { + } else if (pj_stricmp2(&tsx->branch, TEST9_BRANCH_ID)==0) { /* * Failed INVITE transaction with provisional response. */ @@ -583,7 +583,7 @@ static void terminate_tsx_callback( pj_timer_heap_t *timer_heap, */ static pj_bool_t msg_receiver_on_rx_request(pjsip_rx_data *rdata) { - if (pj_strcmp2(&rdata->msg_info.via->branch_param, TEST1_BRANCH_ID) == 0) { + if (pj_stricmp2(&rdata->msg_info.via->branch_param, TEST1_BRANCH_ID) == 0) { /* * The TEST1_BRANCH_ID test performs the verifications for transaction * retransmission mechanism. It will not answer the incoming request @@ -651,7 +651,7 @@ static pj_bool_t msg_receiver_on_rx_request(pjsip_rx_data *rdata) return PJ_TRUE; } else - if (pj_strcmp2(&rdata->msg_info.via->branch_param, TEST4_BRANCH_ID) == 0) { + if (pj_stricmp2(&rdata->msg_info.via->branch_param, TEST4_BRANCH_ID) == 0) { /* * The TEST4_BRANCH_ID test simulates transport failure after several * retransmissions. @@ -672,7 +672,7 @@ static pj_bool_t msg_receiver_on_rx_request(pjsip_rx_data *rdata) } else - if (pj_strcmp2(&rdata->msg_info.via->branch_param, TEST5_BRANCH_ID) == 0) { + if (pj_stricmp2(&rdata->msg_info.via->branch_param, TEST5_BRANCH_ID) == 0) { /* * The TEST5_BRANCH_ID test simulates user terminating the transaction * after several retransmissions. @@ -703,7 +703,7 @@ static pj_bool_t msg_receiver_on_rx_request(pjsip_rx_data *rdata) return PJ_TRUE; } else - if (pj_strcmp2(&rdata->msg_info.via->branch_param, TEST6_BRANCH_ID) == 0) { + if (pj_stricmp2(&rdata->msg_info.via->branch_param, TEST6_BRANCH_ID) == 0) { /* * The TEST6_BRANCH_ID test successfull non-INVITE transaction. */ @@ -728,7 +728,7 @@ static pj_bool_t msg_receiver_on_rx_request(pjsip_rx_data *rdata) } else - if (pj_strcmp2(&rdata->msg_info.via->branch_param, TEST7_BRANCH_ID) == 0) { + if (pj_stricmp2(&rdata->msg_info.via->branch_param, TEST7_BRANCH_ID) == 0) { /* * The TEST7_BRANCH_ID test successfull non-INVITE transaction * with provisional response. @@ -778,7 +778,7 @@ static pj_bool_t msg_receiver_on_rx_request(pjsip_rx_data *rdata) } else - if (pj_strcmp2(&rdata->msg_info.via->branch_param, TEST8_BRANCH_ID) == 0) { + if (pj_stricmp2(&rdata->msg_info.via->branch_param, TEST8_BRANCH_ID) == 0) { /* * The TEST8_BRANCH_ID test failed INVITE transaction. */ @@ -841,7 +841,7 @@ static pj_bool_t msg_receiver_on_rx_request(pjsip_rx_data *rdata) } else - if (pj_strcmp2(&rdata->msg_info.via->branch_param, TEST9_BRANCH_ID) == 0) { + if (pj_stricmp2(&rdata->msg_info.via->branch_param, TEST9_BRANCH_ID) == 0) { /* * The TEST9_BRANCH_ID test failed INVITE transaction with * provisional response. diff --git a/pjsip/src/test/tsx_uas_test.c b/pjsip/src/test/tsx_uas_test.c index f39a1a28..973f3315 100644 --- a/pjsip/src/test/tsx_uas_test.c +++ b/pjsip/src/test/tsx_uas_test.c @@ -352,8 +352,8 @@ static void schedule_terminate_tsx( pjsip_transaction *tsx, */ static void tsx_user_on_tsx_state(pjsip_transaction *tsx, pjsip_event *e) { - if (pj_strcmp2(&tsx->branch, TEST1_BRANCH_ID)==0 || - pj_strcmp2(&tsx->branch, TEST2_BRANCH_ID)==0) + if (pj_stricmp2(&tsx->branch, TEST1_BRANCH_ID)==0 || + pj_stricmp2(&tsx->branch, TEST2_BRANCH_ID)==0) { /* * TEST1_BRANCH_ID tests that non-INVITE transaction transmits final @@ -362,7 +362,7 @@ static void tsx_user_on_tsx_state(pjsip_transaction *tsx, pjsip_event *e) * * TEST2_BRANCH_ID does similar test for non-2xx final response. */ - int status_code = (pj_strcmp2(&tsx->branch, TEST1_BRANCH_ID)==0) ? + int status_code = (pj_stricmp2(&tsx->branch, TEST1_BRANCH_ID)==0) ? TEST1_STATUS_CODE : TEST2_STATUS_CODE; if (tsx->state == PJSIP_TSX_STATE_TERMINATED) { @@ -392,7 +392,7 @@ static void tsx_user_on_tsx_state(pjsip_transaction *tsx, pjsip_event *e) } else - if (pj_strcmp2(&tsx->branch, TEST3_BRANCH_ID)==0) { + if (pj_stricmp2(&tsx->branch, TEST3_BRANCH_ID)==0) { /* * TEST3_BRANCH_ID tests sending provisional response. */ @@ -455,7 +455,7 @@ static void tsx_user_on_tsx_state(pjsip_transaction *tsx, pjsip_event *e) } } else - if (pj_strcmp2(&tsx->branch, TEST4_BRANCH_ID)==0) { + if (pj_stricmp2(&tsx->branch, TEST4_BRANCH_ID)==0) { /* * TEST4_BRANCH_ID tests receiving retransmissions in TRYING state. */ @@ -488,7 +488,7 @@ static void tsx_user_on_tsx_state(pjsip_transaction *tsx, pjsip_event *e) } else - if (pj_strcmp2(&tsx->branch, TEST5_BRANCH_ID)==0) { + if (pj_stricmp2(&tsx->branch, TEST5_BRANCH_ID)==0) { /* * TEST5_BRANCH_ID tests receiving retransmissions in PROCEEDING state */ @@ -525,7 +525,7 @@ static void tsx_user_on_tsx_state(pjsip_transaction *tsx, pjsip_event *e) } } else - if (pj_strcmp2(&tsx->branch, TEST6_BRANCH_ID)==0) { + if (pj_stricmp2(&tsx->branch, TEST6_BRANCH_ID)==0) { /* * TEST6_BRANCH_ID tests receiving retransmissions in COMPLETED state */ @@ -560,8 +560,8 @@ static void tsx_user_on_tsx_state(pjsip_transaction *tsx, pjsip_event *e) } else - if (pj_strcmp2(&tsx->branch, TEST7_BRANCH_ID)==0 || - pj_strcmp2(&tsx->branch, TEST8_BRANCH_ID)==0) + if (pj_stricmp2(&tsx->branch, TEST7_BRANCH_ID)==0 || + pj_stricmp2(&tsx->branch, TEST8_BRANCH_ID)==0) { /* * TEST7_BRANCH_ID and TEST8_BRANCH_ID test retransmission of @@ -569,7 +569,7 @@ static void tsx_user_on_tsx_state(pjsip_transaction *tsx, pjsip_event *e) */ int code; - if (pj_strcmp2(&tsx->branch, TEST7_BRANCH_ID) == 0) + if (pj_stricmp2(&tsx->branch, TEST7_BRANCH_ID) == 0) code = TEST7_STATUS_CODE; else code = TEST8_STATUS_CODE; @@ -637,7 +637,7 @@ static void tsx_user_on_tsx_state(pjsip_transaction *tsx, pjsip_event *e) } else - if (pj_strcmp2(&tsx->branch, TEST9_BRANCH_ID)==0) { + if (pj_stricmp2(&tsx->branch, TEST9_BRANCH_ID)==0) { /* * TEST9_BRANCH_ID tests that retransmission of INVITE final response * must cease when ACK is received. @@ -701,9 +701,9 @@ static void tsx_user_on_tsx_state(pjsip_transaction *tsx, pjsip_event *e) } else - if (pj_strcmp2(&tsx->branch, TEST10_BRANCH_ID)==0 || - pj_strcmp2(&tsx->branch, TEST11_BRANCH_ID)==0 || - pj_strcmp2(&tsx->branch, TEST12_BRANCH_ID)==0) + if (pj_stricmp2(&tsx->branch, TEST10_BRANCH_ID)==0 || + pj_stricmp2(&tsx->branch, TEST11_BRANCH_ID)==0 || + pj_stricmp2(&tsx->branch, TEST12_BRANCH_ID)==0) { if (tsx->state == PJSIP_TSX_STATE_TERMINATED) { @@ -739,8 +739,8 @@ static pj_bool_t on_rx_message(pjsip_rx_data *rdata) pj_str_t branch_param = rdata->msg_info.via->branch_param; pj_status_t status; - if (pj_strcmp2(&branch_param, TEST1_BRANCH_ID) == 0 || - pj_strcmp2(&branch_param, TEST2_BRANCH_ID) == 0) + if (pj_stricmp2(&branch_param, TEST1_BRANCH_ID) == 0 || + pj_stricmp2(&branch_param, TEST2_BRANCH_ID) == 0) { /* * TEST1_BRANCH_ID tests that non-INVITE transaction transmits 2xx @@ -749,7 +749,7 @@ static pj_bool_t on_rx_message(pjsip_rx_data *rdata) * * TEST2_BRANCH_ID performs similar test for non-2xx final response. */ - int status_code = (pj_strcmp2(&branch_param, TEST1_BRANCH_ID) == 0) ? + int status_code = (pj_stricmp2(&branch_param, TEST1_BRANCH_ID) == 0) ? TEST1_STATUS_CODE : TEST2_STATUS_CODE; if (msg->type == PJSIP_REQUEST_MSG) { @@ -789,7 +789,7 @@ static pj_bool_t on_rx_message(pjsip_rx_data *rdata) } return PJ_TRUE; - } else if (pj_strcmp2(&branch_param, TEST3_BRANCH_ID) == 0) { + } else if (pj_stricmp2(&branch_param, TEST3_BRANCH_ID) == 0) { /* TEST3_BRANCH_ID tests provisional response. */ @@ -838,9 +838,9 @@ static pj_bool_t on_rx_message(pjsip_rx_data *rdata) } return PJ_TRUE; - } else if (pj_strcmp2(&branch_param, TEST4_BRANCH_ID) == 0 || - pj_strcmp2(&branch_param, TEST5_BRANCH_ID) == 0 || - pj_strcmp2(&branch_param, TEST6_BRANCH_ID) == 0) + } else if (pj_stricmp2(&branch_param, TEST4_BRANCH_ID) == 0 || + pj_stricmp2(&branch_param, TEST5_BRANCH_ID) == 0 || + pj_stricmp2(&branch_param, TEST6_BRANCH_ID) == 0) { /* TEST4_BRANCH_ID: absorbs retransmissions in TRYING state. */ @@ -863,12 +863,12 @@ static pj_bool_t on_rx_message(pjsip_rx_data *rdata) pjsip_tsx_recv_msg(tsx, rdata); save_key(tsx); - if (pj_strcmp2(&branch_param, TEST4_BRANCH_ID) == 0) { + if (pj_stricmp2(&branch_param, TEST4_BRANCH_ID) == 0) { - } else if (pj_strcmp2(&branch_param, TEST5_BRANCH_ID) == 0) { + } else if (pj_stricmp2(&branch_param, TEST5_BRANCH_ID) == 0) { send_response(rdata, tsx, TEST5_PROVISIONAL_CODE); - } else if (pj_strcmp2(&branch_param, TEST6_BRANCH_ID) == 0) { + } else if (pj_stricmp2(&branch_param, TEST6_BRANCH_ID) == 0) { PJ_LOG(4,(THIS_FILE, " sending provisional response")); send_response(rdata, tsx, TEST6_PROVISIONAL_CODE); PJ_LOG(4,(THIS_FILE, " sending final response")); @@ -882,11 +882,11 @@ static pj_bool_t on_rx_message(pjsip_rx_data *rdata) ++recv_count; - if (pj_strcmp2(&branch_param, TEST4_BRANCH_ID) == 0) { + if (pj_stricmp2(&branch_param, TEST4_BRANCH_ID) == 0) { PJ_LOG(3,(THIS_FILE, " error: not expecting response!")); test_complete = -132; - } else if (pj_strcmp2(&branch_param, TEST5_BRANCH_ID) == 0) { + } else if (pj_stricmp2(&branch_param, TEST5_BRANCH_ID) == 0) { if (rdata->msg_info.msg->line.status.code!=TEST5_PROVISIONAL_CODE) { PJ_LOG(3,(THIS_FILE, " error: incorrect status code!")); @@ -898,7 +898,7 @@ static pj_bool_t on_rx_message(pjsip_rx_data *rdata) test_complete = -134; } - } else if (pj_strcmp2(&branch_param, TEST6_BRANCH_ID) == 0) { + } else if (pj_stricmp2(&branch_param, TEST6_BRANCH_ID) == 0) { int code = rdata->msg_info.msg->line.status.code; @@ -927,8 +927,8 @@ static pj_bool_t on_rx_message(pjsip_rx_data *rdata) return PJ_TRUE; - } else if (pj_strcmp2(&branch_param, TEST7_BRANCH_ID) == 0 || - pj_strcmp2(&branch_param, TEST8_BRANCH_ID) == 0) + } else if (pj_stricmp2(&branch_param, TEST7_BRANCH_ID) == 0 || + pj_stricmp2(&branch_param, TEST8_BRANCH_ID) == 0) { /* @@ -950,7 +950,7 @@ static pj_bool_t on_rx_message(pjsip_rx_data *rdata) pjsip_tsx_recv_msg(tsx, rdata); save_key(tsx); - if (pj_strcmp2(&branch_param, TEST7_BRANCH_ID) == 0) { + if (pj_stricmp2(&branch_param, TEST7_BRANCH_ID) == 0) { send_response(rdata, tsx, TEST7_STATUS_CODE); @@ -965,7 +965,7 @@ static pj_bool_t on_rx_message(pjsip_rx_data *rdata) ++recv_count; - if (pj_strcmp2(&branch_param, TEST7_BRANCH_ID) == 0) + if (pj_stricmp2(&branch_param, TEST7_BRANCH_ID) == 0) code = TEST7_STATUS_CODE; else code = TEST8_STATUS_CODE; @@ -1013,7 +1013,7 @@ static pj_bool_t on_rx_message(pjsip_rx_data *rdata) } return PJ_TRUE; - } else if (pj_strcmp2(&branch_param, TEST9_BRANCH_ID) == 0) { + } else if (pj_stricmp2(&branch_param, TEST9_BRANCH_ID) == 0) { /* * TEST9_BRANCH_ID tests that the retransmission of INVITE final @@ -1118,15 +1118,15 @@ static pj_bool_t on_rx_message(pjsip_rx_data *rdata) } return PJ_TRUE; - } else if (pj_strcmp2(&branch_param, TEST10_BRANCH_ID) == 0 || - pj_strcmp2(&branch_param, TEST11_BRANCH_ID) == 0 || - pj_strcmp2(&branch_param, TEST12_BRANCH_ID) == 0) + } else if (pj_stricmp2(&branch_param, TEST10_BRANCH_ID) == 0 || + pj_stricmp2(&branch_param, TEST11_BRANCH_ID) == 0 || + pj_stricmp2(&branch_param, TEST12_BRANCH_ID) == 0) { int test_num, code1, code2; - if (pj_strcmp2(&branch_param, TEST10_BRANCH_ID) == 0) + if (pj_stricmp2(&branch_param, TEST10_BRANCH_ID) == 0) test_num=10, code1 = 100, code2 = 0; - else if (pj_strcmp2(&branch_param, TEST11_BRANCH_ID) == 0) + else if (pj_stricmp2(&branch_param, TEST11_BRANCH_ID) == 0) test_num=11, code1 = 100, code2 = 200; else test_num=12, code1 = 200, code2 = 0; |