- Timestamp:
- Jul 18, 2012 7:52:33 AM (12 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/include/pj/guid.h
r3553 r4208 84 84 85 85 /** 86 * Create a globally unique string in lowercase, which length is 87 * PJ_GUID_STRING_LENGTH characters. Caller is responsible for preallocating 88 * the storage used in the string. 89 * 90 * @param str The string to store the result. 91 * 92 * @return The string. 93 */ 94 PJ_DECL(pj_str_t*) pj_generate_unique_string_lower(pj_str_t *str); 95 96 /** 86 97 * Generate a unique string. 87 98 * … … 90 101 */ 91 102 PJ_DECL(void) pj_create_unique_string(pj_pool_t *pool, pj_str_t *str); 103 104 /** 105 * Generate a unique string in lowercase. 106 * 107 * @param pool Pool to allocate memory from. 108 * @param str The string. 109 */ 110 PJ_DECL(void) pj_create_unique_string_lower(pj_pool_t *pool, pj_str_t *str); 92 111 93 112 -
pjproject/trunk/pjlib/include/pj/hash.h
r3841 r4208 76 76 * 77 77 * @param hval The initial hash value, normally zero. 78 * @param result Buffer to store the result, which must be enough to hold79 * t he string.78 * @param result Optional. Buffer to store the result, which must be enough 79 * to hold the string. 80 80 * @param key The input key to be converted and calculated. 81 81 * … … 114 114 const void *key, unsigned keylen, 115 115 pj_uint32_t *hval ); 116 117 118 /** 119 * Variant of #pj_hash_get() with the key being converted to lowercase when 120 * calculating the hash value. 121 * 122 * @see pj_hash_get() 123 */ 124 PJ_DECL(void *) pj_hash_get_lower( pj_hash_table_t *ht, 125 const void *key, unsigned keylen, 126 pj_uint32_t *hval ); 116 127 117 128 … … 143 154 144 155 /** 156 * Variant of #pj_hash_set() with the key being converted to lowercase when 157 * calculating the hash value. 158 * 159 * @see pj_hash_set() 160 */ 161 PJ_DECL(void) pj_hash_set_lower( pj_pool_t *pool, pj_hash_table_t *ht, 162 const void *key, unsigned keylen, 163 pj_uint32_t hval, void *value ); 164 165 166 /** 145 167 * Associate/disassociate a value with the specified key. This function works 146 168 * like #pj_hash_set(), except that it doesn't use pool (hence the np -- no … … 166 188 167 189 /** 190 * Variant of #pj_hash_set_np() with the key being converted to lowercase 191 * when calculating the hash value. 192 * 193 * @see pj_hash_set_np() 194 */ 195 PJ_DECL(void) pj_hash_set_np_lower(pj_hash_table_t *ht, 196 const void *key, unsigned keylen, 197 pj_uint32_t hval, 198 pj_hash_entry_buf entry_buf, 199 void *value); 200 201 /** 168 202 * Get the total number of entries in the hash table. 169 203 * -
pjproject/trunk/pjlib/src/pj/guid.c
r3553 r4208 18 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 #include <pj/ctype.h> 20 21 #include <pj/guid.h> 21 22 #include <pj/pool.h> 23 24 PJ_DEF(pj_str_t*) pj_generate_unique_string_lower(pj_str_t *str) 25 { 26 int i; 27 28 pj_generate_unique_string(str); 29 for (i = 0; i < str->slen; i++) 30 str->ptr[i] = (char)pj_tolower(str->ptr[i]); 31 32 return str; 33 } 22 34 23 35 PJ_DEF(void) pj_create_unique_string(pj_pool_t *pool, pj_str_t *str) … … 26 38 pj_generate_unique_string(str); 27 39 } 40 41 PJ_DEF(void) pj_create_unique_string_lower(pj_pool_t *pool, pj_str_t *str) 42 { 43 int i; 44 45 pj_create_unique_string(pool, str); 46 for (i = 0; i < str->slen; i++) 47 str->ptr[i] = (char)pj_tolower(str->ptr[i]); 48 } -
pjproject/trunk/pjlib/src/pj/hash.c
r3553 r4208 80 80 for (i=0; i<key->slen; ++i) { 81 81 pj_uint8_t c = key->ptr[i]; 82 char lower; 82 83 if (c & 64) 83 result[i]= (char)(c | 32);84 lower = (char)(c | 32); 84 85 else 85 result[i] = (char)c; 86 hval = hval * PJ_HASH_MULTIPLIER + result[i]; 86 lower = (char)c; 87 if (result) 88 result[i] = lower; 89 hval = hval * PJ_HASH_MULTIPLIER + lower; 87 90 } 88 91 #else 89 92 for (i=0; i<key->slen; ++i) { 90 result[i] = (char)pj_tolower(key->ptr[i]); 91 hval = hval * PJ_HASH_MULTIPLIER + result[i]; 93 char lower = (char)pj_tolower(key->ptr[i]); 94 if (result) 95 result[i] = lower; 96 hval = hval * PJ_HASH_MULTIPLIER + lower; 92 97 } 93 98 #endif … … 129 134 const void *key, unsigned keylen, 130 135 void *val, pj_uint32_t *hval, 131 void *entry_buf )136 void *entry_buf, pj_bool_t lower) 132 137 { 133 138 pj_uint32_t hash; … … 147 152 const pj_uint8_t *p = (const pj_uint8_t*)key; 148 153 for ( ; *p; ++p ) { 149 hash = hash * PJ_HASH_MULTIPLIER + *p; 154 if (lower) 155 hash = hash * PJ_HASH_MULTIPLIER + pj_tolower(*p); 156 else 157 hash = hash * PJ_HASH_MULTIPLIER + *p; 150 158 } 151 159 keylen = p - (const unsigned char*)key; … … 154 162 *end = p + keylen; 155 163 for ( ; p!=end; ++p) { 156 hash = hash * PJ_HASH_MULTIPLIER + *p; 164 if (lower) 165 hash = hash * PJ_HASH_MULTIPLIER + pj_tolower(*p); 166 else 167 hash = hash * PJ_HASH_MULTIPLIER + *p; 157 168 } 158 169 } … … 168 179 p_entry = &entry->next, entry = *p_entry) 169 180 { 181 pj_str_t str; 182 183 if (lower) { 184 str.ptr = (char *)entry->key; 185 str.slen = keylen; 186 } 170 187 if (entry->hash==hash && entry->keylen==keylen && 171 pj_memcmp(entry->key, key, keylen)==0) 188 ((lower && pj_strnicmp2(&str, (const char *)key, keylen)==0) || 189 (!lower && pj_memcmp(entry->key, key, keylen)==0))) 172 190 { 173 191 break; … … 215 233 { 216 234 pj_hash_entry *entry; 217 entry = *find_entry( NULL, ht, key, keylen, NULL, hval, NULL );235 entry = *find_entry( NULL, ht, key, keylen, NULL, hval, NULL, PJ_FALSE); 218 236 return entry ? entry->value : NULL; 219 237 } 220 238 221 PJ_DEF(void) pj_hash_set( pj_pool_t *pool, pj_hash_table_t *ht, 222 const void *key, unsigned keylen, pj_uint32_t hval, 223 void *value ) 239 PJ_DEF(void *) pj_hash_get_lower( pj_hash_table_t *ht, 240 const void *key, unsigned keylen, 241 pj_uint32_t *hval) 242 { 243 pj_hash_entry *entry; 244 entry = *find_entry( NULL, ht, key, keylen, NULL, hval, NULL, PJ_TRUE); 245 return entry ? entry->value : NULL; 246 } 247 248 static void hash_set( pj_pool_t *pool, pj_hash_table_t *ht, 249 const void *key, unsigned keylen, pj_uint32_t hval, 250 void *value, void *entry_buf, pj_bool_t lower ) 224 251 { 225 252 pj_hash_entry **p_entry; 226 253 227 p_entry = find_entry( pool, ht, key, keylen, value, &hval, NULL); 254 p_entry = find_entry( pool, ht, key, keylen, value, &hval, entry_buf, 255 lower); 228 256 if (*p_entry) { 229 257 if (value == NULL) { … … 242 270 } 243 271 272 PJ_DEF(void) pj_hash_set( pj_pool_t *pool, pj_hash_table_t *ht, 273 const void *key, unsigned keylen, pj_uint32_t hval, 274 void *value ) 275 { 276 hash_set(pool, ht, key, keylen, hval, value, NULL, PJ_FALSE); 277 } 278 279 PJ_DEF(void) pj_hash_set_lower( pj_pool_t *pool, pj_hash_table_t *ht, 280 const void *key, unsigned keylen, 281 pj_uint32_t hval, void *value ) 282 { 283 hash_set(pool, ht, key, keylen, hval, value, NULL, PJ_TRUE); 284 } 285 244 286 PJ_DEF(void) pj_hash_set_np( pj_hash_table_t *ht, 245 287 const void *key, unsigned keylen, … … 247 289 void *value) 248 290 { 249 pj_hash_entry **p_entry; 250 251 p_entry = find_entry( NULL, ht, key, keylen, value, &hval, 252 (void*)entry_buf ); 253 if (*p_entry) { 254 if (value == NULL) { 255 /* delete entry */ 256 PJ_LOG(6, ("hashtbl", "%p: p_entry %p deleted", ht, *p_entry)); 257 *p_entry = (*p_entry)->next; 258 --ht->count; 259 260 } else { 261 /* overwrite */ 262 (*p_entry)->value = value; 263 PJ_LOG(6, ("hashtbl", "%p: p_entry %p value set to %p", ht, 264 *p_entry, value)); 265 } 266 } 291 hash_set(NULL, ht, key, keylen, hval, value, (void *)entry_buf, PJ_FALSE); 292 } 293 294 PJ_DEF(void) pj_hash_set_np_lower( pj_hash_table_t *ht, 295 const void *key, unsigned keylen, 296 pj_uint32_t hval, 297 pj_hash_entry_buf entry_buf, 298 void *value) 299 { 300 hash_set(NULL, ht, key, keylen, hval, value, (void *)entry_buf, PJ_TRUE); 267 301 } 268 302 -
pjproject/trunk/pjsip/src/pjsip-ua/sip_100rel.c
r3841 r4208 274 274 uac_state = dd->uac_state_list; 275 275 while (uac_state) { 276 if (pj_str cmp(&uac_state->tag, to_tag)==0)276 if (pj_stricmp(&uac_state->tag, to_tag)==0) 277 277 break; 278 278 uac_state = uac_state->next; … … 321 321 * update the req URI (https://trac.pjsip.org/repos/ticket/1364) 322 322 */ 323 if (pj_str cmp(&uac_state->tag, &dd->inv->dlg->remote.info->tag)) {323 if (pj_stricmp(&uac_state->tag, &dd->inv->dlg->remote.info->tag)) { 324 324 const pjsip_contact_hdr *mhdr; 325 325 -
pjproject/trunk/pjsip/src/pjsip-ua/sip_inv.c
r4156 r4208 1746 1746 rdata->msg_info.msg->line.status.code/100 == 2 && 1747 1747 tsx_inv_data->done_early && 1748 pj_str cmp(&tsx_inv_data->done_tag, &res_tag))1748 pj_stricmp(&tsx_inv_data->done_tag, &res_tag)) 1749 1749 { 1750 1750 const pjmedia_sdp_session *reoffer_sdp = NULL; -
pjproject/trunk/pjsip/src/pjsip/sip_dialog.c
r4206 r4208 207 207 208 208 /* Calculate hash value of local tag. */ 209 dlg->local.tag_hval = pj_hash_calc (0, dlg->local.info->tag.ptr,210 dlg->local.info->tag.slen);209 dlg->local.tag_hval = pj_hash_calc_tolower(0, NULL, 210 &dlg->local.info->tag); 211 211 212 212 /* Randomize local CSeq. */ … … 375 375 376 376 /* Calculate hash value of local tag. */ 377 dlg->local.tag_hval = pj_hash_calc(0, dlg->local.info->tag.ptr, 378 dlg->local.info->tag.slen); 377 dlg->local.tag_hval = pj_hash_calc_tolower(0, NULL, &dlg->local.info->tag); 379 378 380 379 … … 523 522 524 523 /* Calculate hash value of remote tag. */ 525 dlg->remote.tag_hval = pj_hash_calc(0, dlg->remote.info->tag.ptr, 526 dlg->remote.info->tag.slen); 524 dlg->remote.tag_hval = pj_hash_calc_tolower(0, NULL, &dlg->remote.info->tag); 527 525 528 526 /* Update remote capabilities info */ … … 1818 1816 res_code/100 <= 2 && 1819 1817 pjsip_method_creates_dialog(&rdata->msg_info.cseq->method) && 1820 pj_str cmp(&dlg->remote.info->tag, &rdata->msg_info.to->tag)))1818 pj_stricmp(&dlg->remote.info->tag, &rdata->msg_info.to->tag))) 1821 1819 { 1822 1820 pjsip_contact_hdr *contact; … … 1827 1825 */ 1828 1826 pjsip_dlg_update_remote_cap(dlg, rdata->msg_info.msg, 1829 pj_str cmp(&dlg->remote.info->tag,1827 pj_stricmp(&dlg->remote.info->tag, 1830 1828 &rdata->msg_info.to->tag)); 1831 1829 -
pjproject/trunk/pjsip/src/pjsip/sip_transaction.c
r4165 r4208 404 404 const pj_str_t *branch = &rdata->msg_info.via->branch_param; 405 405 406 if (pj_strn cmp(branch,&rfc3261_branch,PJSIP_RFC3261_BRANCH_LEN)==0) {406 if (pj_strnicmp(branch,&rfc3261_branch,PJSIP_RFC3261_BRANCH_LEN)==0) { 407 407 408 408 /* Create transaction key. */ … … 549 549 * twice! 550 550 */ 551 if(pj_hash_get (mod_tsx_layer.htable,552 tsx->transaction_key.ptr,553 tsx->transaction_key.slen,554 NULL))551 if(pj_hash_get_lower(mod_tsx_layer.htable, 552 tsx->transaction_key.ptr, 553 tsx->transaction_key.slen, 554 NULL)) 555 555 { 556 556 pj_mutex_unlock(mod_tsx_layer.mutex); … … 569 569 /* Register the transaction to the hash table. */ 570 570 #ifdef PRECALC_HASH 571 pj_hash_set( tsx->pool, mod_tsx_layer.htable, tsx->transaction_key.ptr, 572 tsx->transaction_key.slen, tsx->hashed_key, tsx); 571 pj_hash_set_lower( tsx->pool, mod_tsx_layer.htable, 572 tsx->transaction_key.ptr, 573 tsx->transaction_key.slen, tsx->hashed_key, tsx); 573 574 #else 574 pj_hash_set( tsx->pool, mod_tsx_layer.htable, tsx->transaction_key.ptr, 575 tsx->transaction_key.slen, 0, tsx); 575 pj_hash_set_lower( tsx->pool, mod_tsx_layer.htable, 576 tsx->transaction_key.ptr, 577 tsx->transaction_key.slen, 0, tsx); 576 578 #endif 577 579 … … 605 607 /* Register the transaction to the hash table. */ 606 608 #ifdef PRECALC_HASH 607 pj_hash_set ( NULL, mod_tsx_layer.htable, tsx->transaction_key.ptr,608 tsx->transaction_key.slen, tsx->hashed_key, NULL);609 pj_hash_set_lower( NULL, mod_tsx_layer.htable, tsx->transaction_key.ptr, 610 tsx->transaction_key.slen, tsx->hashed_key, NULL); 609 611 #else 610 pj_hash_set ( NULL, mod_tsx_layer.htable, tsx->transaction_key.ptr,611 tsx->transaction_key.slen, 0, NULL);612 pj_hash_set_lower( NULL, mod_tsx_layer.htable, tsx->transaction_key.ptr, 613 tsx->transaction_key.slen, 0, NULL); 612 614 #endif 613 615 … … 652 654 pj_mutex_lock(mod_tsx_layer.mutex); 653 655 tsx = (pjsip_transaction*) 654 pj_hash_get( mod_tsx_layer.htable, key->ptr, key->slen, &hval ); 656 pj_hash_get_lower( mod_tsx_layer.htable, key->ptr, key->slen, 657 &hval ); 655 658 pj_mutex_unlock(mod_tsx_layer.mutex); 656 659 … … 786 789 787 790 tsx = (pjsip_transaction*) 788 pj_hash_get ( mod_tsx_layer.htable, key.ptr, key.slen, &hval );791 pj_hash_get_lower( mod_tsx_layer.htable, key.ptr, key.slen, &hval ); 789 792 790 793 … … 835 838 836 839 tsx = (pjsip_transaction*) 837 pj_hash_get ( mod_tsx_layer.htable, key.ptr, key.slen, &hval );840 pj_hash_get_lower( mod_tsx_layer.htable, key.ptr, key.slen, &hval ); 838 841 839 842 … … 1300 1303 /* Calculate hashed key value. */ 1301 1304 #ifdef PRECALC_HASH 1302 tsx->hashed_key = pj_hash_calc(0, tsx->transaction_key.ptr, 1303 tsx->transaction_key.slen); 1305 tsx->hashed_key = pj_hash_calc_tolower(0, NULL, &tsx->transaction_key); 1304 1306 #endif 1305 1307 … … 1433 1435 /* Calculate hashed key value. */ 1434 1436 #ifdef PRECALC_HASH 1435 tsx->hashed_key = pj_hash_calc(0, tsx->transaction_key.ptr, 1436 tsx->transaction_key.slen); 1437 tsx->hashed_key = pj_hash_calc_tolower(0, NULL, &tsx->transaction_key); 1437 1438 #endif 1438 1439 -
pjproject/trunk/pjsip/src/pjsip/sip_ua_layer.c
r3664 r4208 303 303 304 304 dlg_set = (struct dlg_set*) 305 pj_hash_get( mod_ua.dlg_table, dlg->local.info->tag.ptr, 306 dlg->local.info->tag.slen, 307 &dlg->local.tag_hval); 305 pj_hash_get_lower( mod_ua.dlg_table, 306 dlg->local.info->tag.ptr, 307 dlg->local.info->tag.slen, 308 &dlg->local.tag_hval); 308 309 309 310 if (dlg_set) { … … 327 328 328 329 /* Register the dialog set in the hash table. */ 329 pj_hash_set_np(mod_ua.dlg_table, 330 dlg->local.info->tag.ptr, dlg->local.info->tag.slen, 331 dlg->local.tag_hval, dlg_set->ht_entry, dlg_set); 330 pj_hash_set_np_lower(mod_ua.dlg_table, 331 dlg->local.info->tag.ptr, 332 dlg->local.info->tag.slen, 333 dlg->local.tag_hval, dlg_set->ht_entry, 334 dlg_set); 332 335 } 333 336 … … 342 345 dlg->dlg_set = dlg_set; 343 346 344 pj_hash_set_np(mod_ua.dlg_table, 345 dlg->local.info->tag.ptr, dlg->local.info->tag.slen, 346 dlg->local.tag_hval, dlg_set->ht_entry, dlg_set); 347 pj_hash_set_np_lower(mod_ua.dlg_table, 348 dlg->local.info->tag.ptr, 349 dlg->local.info->tag.slen, 350 dlg->local.tag_hval, dlg_set->ht_entry, dlg_set); 347 351 } 348 352 … … 388 392 /* If dialog list is empty, remove the dialog set from the hash table. */ 389 393 if (pj_list_empty(&dlg_set->dlg_list)) { 390 pj_hash_set(NULL, mod_ua.dlg_table, dlg->local.info->tag.ptr, 391 dlg->local.info->tag.slen, dlg->local.tag_hval, NULL); 394 pj_hash_set_lower(NULL, mod_ua.dlg_table, dlg->local.info->tag.ptr, 395 dlg->local.info->tag.slen, dlg->local.tag_hval, 396 NULL); 392 397 393 398 /* Return dlg_set to free nodes. */ … … 450 455 /* Lookup the dialog set. */ 451 456 dlg_set = (struct dlg_set*) 452 pj_hash_get (mod_ua.dlg_table, local_tag->ptr, local_tag->slen,453 457 pj_hash_get_lower(mod_ua.dlg_table, local_tag->ptr, 458 local_tag->slen, NULL); 454 459 if (dlg_set == NULL) { 455 460 /* Not found */ … … 463 468 dlg = dlg_set->dlg_list.next; 464 469 while (dlg != (pjsip_dialog*)&dlg_set->dlg_list) { 465 if (pj_str cmp(&dlg->remote.info->tag, remote_tag) == 0)470 if (pj_stricmp(&dlg->remote.info->tag, remote_tag) == 0) 466 471 break; 467 472 dlg = dlg->next; … … 564 569 /* Lookup the dialog set. */ 565 570 dlg_set = (struct dlg_set*) 566 pj_hash_get(mod_ua.dlg_table, tag->ptr, tag->slen, NULL); 571 pj_hash_get_lower(mod_ua.dlg_table, tag->ptr, tag->slen, 572 NULL); 567 573 return dlg_set; 568 574 } … … 625 631 while (dlg != (pjsip_dialog*)&dlg_set->dlg_list) { 626 632 627 if (pj_str cmp(&dlg->remote.info->tag, from_tag) == 0)633 if (pj_stricmp(&dlg->remote.info->tag, from_tag) == 0) 628 634 break; 629 635 … … 762 768 /* Get the dialog set. */ 763 769 dlg_set = (struct dlg_set*) 764 pj_hash_get (mod_ua.dlg_table,765 rdata->msg_info.from->tag.ptr,766 rdata->msg_info.from->tag.slen,767 NULL);770 pj_hash_get_lower(mod_ua.dlg_table, 771 rdata->msg_info.from->tag.ptr, 772 rdata->msg_info.from->tag.slen, 773 NULL); 768 774 769 775 if (!dlg_set) { … … 813 819 814 820 /* Otherwise find the one with matching To tag. */ 815 if (pj_str cmp(to_tag, &dlg->remote.info->tag) == 0)821 if (pj_stricmp(to_tag, &dlg->remote.info->tag) == 0) 816 822 break; 817 823 -
pjproject/trunk/pjsip/src/pjsip/sip_util_proxy.c
r3553 r4208 346 346 * a branch value from GUID . 347 347 */ 348 if (pj_strn cmp(&rdata->msg_info.via->branch_param,348 if (pj_strnicmp(&rdata->msg_info.via->branch_param, 349 349 &rfc3261_branch, PJSIP_RFC3261_BRANCH_LEN) != 0 ) 350 350 { -
pjproject/trunk/pjsip/src/test/tsx_uac_test.c
r3553 r4208 160 160 static void tsx_user_on_tsx_state(pjsip_transaction *tsx, pjsip_event *e) 161 161 { 162 if (pj_str cmp2(&tsx->branch, TEST1_BRANCH_ID)==0) {162 if (pj_stricmp2(&tsx->branch, TEST1_BRANCH_ID)==0) { 163 163 /* 164 164 * Transaction with TEST1_BRANCH_ID should terminate with transaction … … 214 214 } 215 215 216 } else if (pj_str cmp2(&tsx->branch, TEST2_BRANCH_ID)==0) {216 } else if (pj_stricmp2(&tsx->branch, TEST2_BRANCH_ID)==0) { 217 217 /* 218 218 * Transaction with TEST2_BRANCH_ID should terminate with transport error. … … 232 232 } 233 233 234 } else if (pj_str cmp2(&tsx->branch, TEST3_BRANCH_ID)==0) {234 } else if (pj_stricmp2(&tsx->branch, TEST3_BRANCH_ID)==0) { 235 235 /* 236 236 * This test terminates the transaction while resolver is still … … 257 257 } 258 258 259 } else if (pj_str cmp2(&tsx->branch, TEST4_BRANCH_ID)==0) {259 } else if (pj_stricmp2(&tsx->branch, TEST4_BRANCH_ID)==0) { 260 260 /* 261 261 * This test simulates transport failure after several … … 285 285 286 286 287 } else if (pj_str cmp2(&tsx->branch, TEST5_BRANCH_ID)==0) {287 } else if (pj_stricmp2(&tsx->branch, TEST5_BRANCH_ID)==0) { 288 288 /* 289 289 * This test simulates transport failure after several … … 313 313 314 314 315 } else if (pj_str cmp2(&tsx->branch, TEST6_BRANCH_ID)==0) {315 } else if (pj_stricmp2(&tsx->branch, TEST6_BRANCH_ID)==0) { 316 316 /* 317 317 * Successfull non-INVITE transaction. … … 356 356 } 357 357 358 } else if (pj_str cmp2(&tsx->branch, TEST7_BRANCH_ID)==0) {358 } else if (pj_stricmp2(&tsx->branch, TEST7_BRANCH_ID)==0) { 359 359 /* 360 360 * Successfull non-INVITE transaction. … … 409 409 410 410 411 } else if (pj_str cmp2(&tsx->branch, TEST8_BRANCH_ID)==0) {411 } else if (pj_stricmp2(&tsx->branch, TEST8_BRANCH_ID)==0) { 412 412 /* 413 413 * Failed INVITE transaction. … … 469 469 470 470 471 } else if (pj_str cmp2(&tsx->branch, TEST9_BRANCH_ID)==0) {471 } else if (pj_stricmp2(&tsx->branch, TEST9_BRANCH_ID)==0) { 472 472 /* 473 473 * Failed INVITE transaction with provisional response. … … 584 584 static pj_bool_t msg_receiver_on_rx_request(pjsip_rx_data *rdata) 585 585 { 586 if (pj_str cmp2(&rdata->msg_info.via->branch_param, TEST1_BRANCH_ID) == 0) {586 if (pj_stricmp2(&rdata->msg_info.via->branch_param, TEST1_BRANCH_ID) == 0) { 587 587 /* 588 588 * The TEST1_BRANCH_ID test performs the verifications for transaction … … 652 652 653 653 } else 654 if (pj_str cmp2(&rdata->msg_info.via->branch_param, TEST4_BRANCH_ID) == 0) {654 if (pj_stricmp2(&rdata->msg_info.via->branch_param, TEST4_BRANCH_ID) == 0) { 655 655 /* 656 656 * The TEST4_BRANCH_ID test simulates transport failure after several … … 673 673 674 674 } else 675 if (pj_str cmp2(&rdata->msg_info.via->branch_param, TEST5_BRANCH_ID) == 0) {675 if (pj_stricmp2(&rdata->msg_info.via->branch_param, TEST5_BRANCH_ID) == 0) { 676 676 /* 677 677 * The TEST5_BRANCH_ID test simulates user terminating the transaction … … 704 704 705 705 } else 706 if (pj_str cmp2(&rdata->msg_info.via->branch_param, TEST6_BRANCH_ID) == 0) {706 if (pj_stricmp2(&rdata->msg_info.via->branch_param, TEST6_BRANCH_ID) == 0) { 707 707 /* 708 708 * The TEST6_BRANCH_ID test successfull non-INVITE transaction. … … 729 729 730 730 } else 731 if (pj_str cmp2(&rdata->msg_info.via->branch_param, TEST7_BRANCH_ID) == 0) {731 if (pj_stricmp2(&rdata->msg_info.via->branch_param, TEST7_BRANCH_ID) == 0) { 732 732 /* 733 733 * The TEST7_BRANCH_ID test successfull non-INVITE transaction … … 779 779 780 780 } else 781 if (pj_str cmp2(&rdata->msg_info.via->branch_param, TEST8_BRANCH_ID) == 0) {781 if (pj_stricmp2(&rdata->msg_info.via->branch_param, TEST8_BRANCH_ID) == 0) { 782 782 /* 783 783 * The TEST8_BRANCH_ID test failed INVITE transaction. … … 842 842 843 843 } else 844 if (pj_str cmp2(&rdata->msg_info.via->branch_param, TEST9_BRANCH_ID) == 0) {844 if (pj_stricmp2(&rdata->msg_info.via->branch_param, TEST9_BRANCH_ID) == 0) { 845 845 /* 846 846 * The TEST9_BRANCH_ID test failed INVITE transaction with -
pjproject/trunk/pjsip/src/test/tsx_uas_test.c
r3553 r4208 353 353 static void tsx_user_on_tsx_state(pjsip_transaction *tsx, pjsip_event *e) 354 354 { 355 if (pj_str cmp2(&tsx->branch, TEST1_BRANCH_ID)==0 ||356 pj_str cmp2(&tsx->branch, TEST2_BRANCH_ID)==0)355 if (pj_stricmp2(&tsx->branch, TEST1_BRANCH_ID)==0 || 356 pj_stricmp2(&tsx->branch, TEST2_BRANCH_ID)==0) 357 357 { 358 358 /* … … 363 363 * TEST2_BRANCH_ID does similar test for non-2xx final response. 364 364 */ 365 int status_code = (pj_str cmp2(&tsx->branch, TEST1_BRANCH_ID)==0) ?365 int status_code = (pj_stricmp2(&tsx->branch, TEST1_BRANCH_ID)==0) ? 366 366 TEST1_STATUS_CODE : TEST2_STATUS_CODE; 367 367 … … 393 393 } 394 394 else 395 if (pj_str cmp2(&tsx->branch, TEST3_BRANCH_ID)==0) {395 if (pj_stricmp2(&tsx->branch, TEST3_BRANCH_ID)==0) { 396 396 /* 397 397 * TEST3_BRANCH_ID tests sending provisional response. … … 456 456 457 457 } else 458 if (pj_str cmp2(&tsx->branch, TEST4_BRANCH_ID)==0) {458 if (pj_stricmp2(&tsx->branch, TEST4_BRANCH_ID)==0) { 459 459 /* 460 460 * TEST4_BRANCH_ID tests receiving retransmissions in TRYING state. … … 489 489 490 490 } else 491 if (pj_str cmp2(&tsx->branch, TEST5_BRANCH_ID)==0) {491 if (pj_stricmp2(&tsx->branch, TEST5_BRANCH_ID)==0) { 492 492 /* 493 493 * TEST5_BRANCH_ID tests receiving retransmissions in PROCEEDING state … … 526 526 527 527 } else 528 if (pj_str cmp2(&tsx->branch, TEST6_BRANCH_ID)==0) {528 if (pj_stricmp2(&tsx->branch, TEST6_BRANCH_ID)==0) { 529 529 /* 530 530 * TEST6_BRANCH_ID tests receiving retransmissions in COMPLETED state … … 561 561 562 562 } else 563 if (pj_str cmp2(&tsx->branch, TEST7_BRANCH_ID)==0 ||564 pj_str cmp2(&tsx->branch, TEST8_BRANCH_ID)==0)563 if (pj_stricmp2(&tsx->branch, TEST7_BRANCH_ID)==0 || 564 pj_stricmp2(&tsx->branch, TEST8_BRANCH_ID)==0) 565 565 { 566 566 /* … … 570 570 int code; 571 571 572 if (pj_str cmp2(&tsx->branch, TEST7_BRANCH_ID) == 0)572 if (pj_stricmp2(&tsx->branch, TEST7_BRANCH_ID) == 0) 573 573 code = TEST7_STATUS_CODE; 574 574 else … … 638 638 639 639 } else 640 if (pj_str cmp2(&tsx->branch, TEST9_BRANCH_ID)==0) {640 if (pj_stricmp2(&tsx->branch, TEST9_BRANCH_ID)==0) { 641 641 /* 642 642 * TEST9_BRANCH_ID tests that retransmission of INVITE final response … … 702 702 703 703 } else 704 if (pj_str cmp2(&tsx->branch, TEST10_BRANCH_ID)==0 ||705 pj_str cmp2(&tsx->branch, TEST11_BRANCH_ID)==0 ||706 pj_str cmp2(&tsx->branch, TEST12_BRANCH_ID)==0)704 if (pj_stricmp2(&tsx->branch, TEST10_BRANCH_ID)==0 || 705 pj_stricmp2(&tsx->branch, TEST11_BRANCH_ID)==0 || 706 pj_stricmp2(&tsx->branch, TEST12_BRANCH_ID)==0) 707 707 { 708 708 if (tsx->state == PJSIP_TSX_STATE_TERMINATED) { … … 740 740 pj_status_t status; 741 741 742 if (pj_str cmp2(&branch_param, TEST1_BRANCH_ID) == 0 ||743 pj_str cmp2(&branch_param, TEST2_BRANCH_ID) == 0)742 if (pj_stricmp2(&branch_param, TEST1_BRANCH_ID) == 0 || 743 pj_stricmp2(&branch_param, TEST2_BRANCH_ID) == 0) 744 744 { 745 745 /* … … 750 750 * TEST2_BRANCH_ID performs similar test for non-2xx final response. 751 751 */ 752 int status_code = (pj_str cmp2(&branch_param, TEST1_BRANCH_ID) == 0) ?752 int status_code = (pj_stricmp2(&branch_param, TEST1_BRANCH_ID) == 0) ? 753 753 TEST1_STATUS_CODE : TEST2_STATUS_CODE; 754 754 … … 790 790 return PJ_TRUE; 791 791 792 } else if (pj_str cmp2(&branch_param, TEST3_BRANCH_ID) == 0) {792 } else if (pj_stricmp2(&branch_param, TEST3_BRANCH_ID) == 0) { 793 793 794 794 /* TEST3_BRANCH_ID tests provisional response. */ … … 839 839 return PJ_TRUE; 840 840 841 } else if (pj_str cmp2(&branch_param, TEST4_BRANCH_ID) == 0 ||842 pj_str cmp2(&branch_param, TEST5_BRANCH_ID) == 0 ||843 pj_str cmp2(&branch_param, TEST6_BRANCH_ID) == 0)841 } else if (pj_stricmp2(&branch_param, TEST4_BRANCH_ID) == 0 || 842 pj_stricmp2(&branch_param, TEST5_BRANCH_ID) == 0 || 843 pj_stricmp2(&branch_param, TEST6_BRANCH_ID) == 0) 844 844 { 845 845 … … 864 864 save_key(tsx); 865 865 866 if (pj_str cmp2(&branch_param, TEST4_BRANCH_ID) == 0) {867 868 } else if (pj_str cmp2(&branch_param, TEST5_BRANCH_ID) == 0) {866 if (pj_stricmp2(&branch_param, TEST4_BRANCH_ID) == 0) { 867 868 } else if (pj_stricmp2(&branch_param, TEST5_BRANCH_ID) == 0) { 869 869 send_response(rdata, tsx, TEST5_PROVISIONAL_CODE); 870 870 871 } else if (pj_str cmp2(&branch_param, TEST6_BRANCH_ID) == 0) {871 } else if (pj_stricmp2(&branch_param, TEST6_BRANCH_ID) == 0) { 872 872 PJ_LOG(4,(THIS_FILE, " sending provisional response")); 873 873 send_response(rdata, tsx, TEST6_PROVISIONAL_CODE); … … 883 883 ++recv_count; 884 884 885 if (pj_str cmp2(&branch_param, TEST4_BRANCH_ID) == 0) {885 if (pj_stricmp2(&branch_param, TEST4_BRANCH_ID) == 0) { 886 886 PJ_LOG(3,(THIS_FILE, " error: not expecting response!")); 887 887 test_complete = -132; 888 888 889 } else if (pj_str cmp2(&branch_param, TEST5_BRANCH_ID) == 0) {889 } else if (pj_stricmp2(&branch_param, TEST5_BRANCH_ID) == 0) { 890 890 891 891 if (rdata->msg_info.msg->line.status.code!=TEST5_PROVISIONAL_CODE) { … … 899 899 } 900 900 901 } else if (pj_str cmp2(&branch_param, TEST6_BRANCH_ID) == 0) {901 } else if (pj_stricmp2(&branch_param, TEST6_BRANCH_ID) == 0) { 902 902 903 903 int code = rdata->msg_info.msg->line.status.code; … … 928 928 929 929 930 } else if (pj_str cmp2(&branch_param, TEST7_BRANCH_ID) == 0 ||931 pj_str cmp2(&branch_param, TEST8_BRANCH_ID) == 0)930 } else if (pj_stricmp2(&branch_param, TEST7_BRANCH_ID) == 0 || 931 pj_stricmp2(&branch_param, TEST8_BRANCH_ID) == 0) 932 932 { 933 933 … … 951 951 save_key(tsx); 952 952 953 if (pj_str cmp2(&branch_param, TEST7_BRANCH_ID) == 0) {953 if (pj_stricmp2(&branch_param, TEST7_BRANCH_ID) == 0) { 954 954 955 955 send_response(rdata, tsx, TEST7_STATUS_CODE); … … 966 966 ++recv_count; 967 967 968 if (pj_str cmp2(&branch_param, TEST7_BRANCH_ID) == 0)968 if (pj_stricmp2(&branch_param, TEST7_BRANCH_ID) == 0) 969 969 code = TEST7_STATUS_CODE; 970 970 else … … 1014 1014 return PJ_TRUE; 1015 1015 1016 } else if (pj_str cmp2(&branch_param, TEST9_BRANCH_ID) == 0) {1016 } else if (pj_stricmp2(&branch_param, TEST9_BRANCH_ID) == 0) { 1017 1017 1018 1018 /* … … 1119 1119 return PJ_TRUE; 1120 1120 1121 } else if (pj_str cmp2(&branch_param, TEST10_BRANCH_ID) == 0 ||1122 pj_str cmp2(&branch_param, TEST11_BRANCH_ID) == 0 ||1123 pj_str cmp2(&branch_param, TEST12_BRANCH_ID) == 0)1121 } else if (pj_stricmp2(&branch_param, TEST10_BRANCH_ID) == 0 || 1122 pj_stricmp2(&branch_param, TEST11_BRANCH_ID) == 0 || 1123 pj_stricmp2(&branch_param, TEST12_BRANCH_ID) == 0) 1124 1124 { 1125 1125 int test_num, code1, code2; 1126 1126 1127 if (pj_str cmp2(&branch_param, TEST10_BRANCH_ID) == 0)1127 if (pj_stricmp2(&branch_param, TEST10_BRANCH_ID) == 0) 1128 1128 test_num=10, code1 = 100, code2 = 0; 1129 else if (pj_str cmp2(&branch_param, TEST11_BRANCH_ID) == 0)1129 else if (pj_stricmp2(&branch_param, TEST11_BRANCH_ID) == 0) 1130 1130 test_num=11, code1 = 100, code2 = 200; 1131 1131 else
Note: See TracChangeset
for help on using the changeset viewer.