Changeset 4385


Ignore:
Timestamp:
Feb 27, 2013 10:11:59 AM (11 years ago)
Author:
nanang
Message:

Re #1556: backported to 1.x

Location:
pjproject/branches/1.x
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/1.x

  • pjproject/branches/1.x/pjlib/include/pj/guid.h

    r3553 r4385  
    8484 
    8585/** 
     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 */ 
     94PJ_DECL(pj_str_t*) pj_generate_unique_string_lower(pj_str_t *str); 
     95 
     96/** 
    8697 * Generate a unique string. 
    8798 * 
     
    90101 */ 
    91102PJ_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 */ 
     110PJ_DECL(void) pj_create_unique_string_lower(pj_pool_t *pool, pj_str_t *str); 
    92111 
    93112 
  • pjproject/branches/1.x/pjlib/include/pj/hash.h

    r3673 r4385  
    7676 * 
    7777 * @param hval      The initial hash value, normally zero. 
    78  * @param result    Buffer to store the result, which must be enough to hold 
    79  *                  the string. 
     78 * @param result    Optional. Buffer to store the result, which must be enough 
     79 *                  to hold the string. 
    8080 * @param key       The input key to be converted and calculated. 
    8181 * 
     
    114114                             const void *key, unsigned keylen, 
    115115                             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 */ 
     124PJ_DECL(void *) pj_hash_get_lower( pj_hash_table_t *ht, 
     125                                   const void *key, unsigned keylen, 
     126                                   pj_uint32_t *hval ); 
    116127 
    117128 
     
    143154 
    144155/** 
     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 */ 
     161PJ_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/** 
    145167 * Associate/disassociate a value with the specified key. This function works 
    146168 * like #pj_hash_set(), except that it doesn't use pool (hence the np -- no  
     
    166188 
    167189/** 
     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 */ 
     195PJ_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/** 
    168202 * Get the total number of entries in the hash table. 
    169203 * 
  • pjproject/branches/1.x/pjlib/src/pj/guid.c

    r3553 r4385  
    1818 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  
    1919 */ 
     20#include <pj/ctype.h> 
    2021#include <pj/guid.h> 
    2122#include <pj/pool.h> 
     23 
     24PJ_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} 
    2234 
    2335PJ_DEF(void) pj_create_unique_string(pj_pool_t *pool, pj_str_t *str) 
     
    2638    pj_generate_unique_string(str); 
    2739} 
     40 
     41PJ_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/branches/1.x/pjlib/src/pj/hash.c

    r3553 r4385  
    8080    for (i=0; i<key->slen; ++i) { 
    8181        pj_uint8_t c = key->ptr[i]; 
     82        char lower; 
    8283        if (c & 64) 
    83             result[i] = (char)(c | 32); 
     84            lower = (char)(c | 32); 
    8485        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; 
    8790    } 
    8891#else 
    8992    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; 
    9297    } 
    9398#endif 
     
    129134                                   const void *key, unsigned keylen, 
    130135                                   void *val, pj_uint32_t *hval, 
    131                                    void *entry_buf) 
     136                                   void *entry_buf, pj_bool_t lower) 
    132137{ 
    133138    pj_uint32_t hash; 
     
    147152            const pj_uint8_t *p = (const pj_uint8_t*)key; 
    148153            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; 
    150158            } 
    151159            keylen = p - (const unsigned char*)key; 
     
    154162                                  *end = p + keylen; 
    155163            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; 
    157168            } 
    158169        } 
     
    169180    { 
    170181        if (entry->hash==hash && entry->keylen==keylen && 
    171             pj_memcmp(entry->key, key, keylen)==0)  
     182            ((lower && pj_ansi_strnicmp((const char*)entry->key, 
     183                                        (const char*)key, keylen)==0) || 
     184             (!lower && pj_memcmp(entry->key, key, keylen)==0))) 
    172185        { 
    173             break;       
     186            break; 
    174187        } 
    175188    } 
     
    215228{ 
    216229    pj_hash_entry *entry; 
    217     entry = *find_entry( NULL, ht, key, keylen, NULL, hval, NULL); 
     230    entry = *find_entry( NULL, ht, key, keylen, NULL, hval, NULL, PJ_FALSE); 
    218231    return entry ? entry->value : NULL; 
    219232} 
    220233 
    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 ) 
     234PJ_DEF(void *) pj_hash_get_lower( pj_hash_table_t *ht, 
     235                                  const void *key, unsigned keylen, 
     236                                  pj_uint32_t *hval) 
     237{ 
     238    pj_hash_entry *entry; 
     239    entry = *find_entry( NULL, ht, key, keylen, NULL, hval, NULL, PJ_TRUE); 
     240    return entry ? entry->value : NULL; 
     241} 
     242 
     243static void hash_set( pj_pool_t *pool, pj_hash_table_t *ht, 
     244                      const void *key, unsigned keylen, pj_uint32_t hval, 
     245                      void *value, void *entry_buf, pj_bool_t lower ) 
    224246{ 
    225247    pj_hash_entry **p_entry; 
    226248 
    227     p_entry = find_entry( pool, ht, key, keylen, value, &hval, NULL); 
     249    p_entry = find_entry( pool, ht, key, keylen, value, &hval, entry_buf, 
     250                          lower); 
    228251    if (*p_entry) { 
    229252        if (value == NULL) { 
     
    242265} 
    243266 
     267PJ_DEF(void) pj_hash_set( pj_pool_t *pool, pj_hash_table_t *ht, 
     268                          const void *key, unsigned keylen, pj_uint32_t hval, 
     269                          void *value ) 
     270{ 
     271    hash_set(pool, ht, key, keylen, hval, value, NULL, PJ_FALSE); 
     272} 
     273 
     274PJ_DEF(void) pj_hash_set_lower( pj_pool_t *pool, pj_hash_table_t *ht, 
     275                                const void *key, unsigned keylen, 
     276                                pj_uint32_t hval, void *value ) 
     277{ 
     278    hash_set(pool, ht, key, keylen, hval, value, NULL, PJ_TRUE); 
     279} 
     280 
    244281PJ_DEF(void) pj_hash_set_np( pj_hash_table_t *ht, 
    245282                             const void *key, unsigned keylen,  
     
    247284                             void *value) 
    248285{ 
    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     } 
     286    hash_set(NULL, ht, key, keylen, hval, value, (void *)entry_buf, PJ_FALSE); 
     287} 
     288 
     289PJ_DEF(void) pj_hash_set_np_lower( pj_hash_table_t *ht, 
     290                                   const void *key, unsigned keylen, 
     291                                   pj_uint32_t hval, 
     292                                   pj_hash_entry_buf entry_buf, 
     293                                   void *value) 
     294{ 
     295    hash_set(NULL, ht, key, keylen, hval, value, (void *)entry_buf, PJ_TRUE); 
    267296} 
    268297 
  • pjproject/branches/1.x/pjsip/src/pjsip-ua/sip_100rel.c

    r3746 r4385  
    273273    uac_state = dd->uac_state_list; 
    274274    while (uac_state) { 
    275         if (pj_strcmp(&uac_state->tag, to_tag)==0) 
     275        if (pj_stricmp(&uac_state->tag, to_tag)==0) 
    276276            break; 
    277277        uac_state = uac_state->next; 
     
    320320     * update the req URI (https://trac.pjsip.org/repos/ticket/1364) 
    321321     */ 
    322     if (pj_strcmp(&uac_state->tag, &dd->inv->dlg->remote.info->tag)) { 
     322    if (pj_stricmp(&uac_state->tag, &dd->inv->dlg->remote.info->tag)) { 
    323323        const pjsip_contact_hdr *mhdr; 
    324324 
  • pjproject/branches/1.x/pjsip/src/pjsip-ua/sip_inv.c

    r4377 r4385  
    17121712            rdata->msg_info.msg->line.status.code/100 == 2 && 
    17131713            tsx_inv_data->done_early && 
    1714             pj_strcmp(&tsx_inv_data->done_tag, &res_tag)) 
     1714            pj_stricmp(&tsx_inv_data->done_tag, &res_tag)) 
    17151715        { 
    17161716            const pjmedia_sdp_session *reoffer_sdp = NULL; 
  • pjproject/branches/1.x/pjsip/src/pjsip/sip_dialog.c

    r4380 r4385  
    207207 
    208208    /* 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); 
    211211 
    212212    /* Randomize local CSeq. */ 
     
    375375 
    376376    /* 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); 
    379378 
    380379 
     
    523522 
    524523    /* 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); 
    527525 
    528526    /* Update remote capabilities info */ 
     
    17771775         res_code/100 <= 2 && 
    17781776         pjsip_method_creates_dialog(&rdata->msg_info.cseq->method) && 
    1779          pj_strcmp(&dlg->remote.info->tag, &rdata->msg_info.to->tag))) 
     1777         pj_stricmp(&dlg->remote.info->tag, &rdata->msg_info.to->tag))) 
    17801778    { 
    17811779        pjsip_contact_hdr *contact; 
     
    17861784         */ 
    17871785        pjsip_dlg_update_remote_cap(dlg, rdata->msg_info.msg, 
    1788                                     pj_strcmp(&dlg->remote.info->tag, 
     1786                                    pj_stricmp(&dlg->remote.info->tag, 
    17891787                                              &rdata->msg_info.to->tag)); 
    17901788 
  • pjproject/branches/1.x/pjsip/src/pjsip/sip_transaction.c

    r4379 r4385  
    404404    const pj_str_t *branch = &rdata->msg_info.via->branch_param; 
    405405 
    406     if (pj_strncmp(branch,&rfc3261_branch,PJSIP_RFC3261_BRANCH_LEN)==0) { 
     406    if (pj_strnicmp(branch,&rfc3261_branch,PJSIP_RFC3261_BRANCH_LEN)==0) { 
    407407 
    408408        /* Create transaction key. */ 
     
    549549     * twice! 
    550550     */ 
    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)) 
    555555    { 
    556556        pj_mutex_unlock(mod_tsx_layer.mutex); 
     
    569569    /* Register the transaction to the hash table. */ 
    570570#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); 
    573574#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); 
    576578#endif 
    577579 
     
    605607    /* Register the transaction to the hash table. */ 
    606608#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); 
    609611#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); 
    612614#endif 
    613615 
     
    652654    pj_mutex_lock(mod_tsx_layer.mutex); 
    653655    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 ); 
    655658    pj_mutex_unlock(mod_tsx_layer.mutex); 
    656659 
     
    786789 
    787790    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 ); 
    789792 
    790793 
     
    835838 
    836839    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 ); 
    838841 
    839842 
     
    12941297    /* Calculate hashed key value. */ 
    12951298#ifdef PRECALC_HASH 
    1296     tsx->hashed_key = pj_hash_calc(0, tsx->transaction_key.ptr, 
    1297                                    tsx->transaction_key.slen); 
     1299    tsx->hashed_key = pj_hash_calc_tolower(0, NULL, &tsx->transaction_key); 
    12981300#endif 
    12991301 
     
    14251427    /* Calculate hashed key value. */ 
    14261428#ifdef PRECALC_HASH 
    1427     tsx->hashed_key = pj_hash_calc(0, tsx->transaction_key.ptr, 
    1428                                    tsx->transaction_key.slen); 
     1429    tsx->hashed_key = pj_hash_calc_tolower(0, NULL, &tsx->transaction_key); 
    14291430#endif 
    14301431 
  • pjproject/branches/1.x/pjsip/src/pjsip/sip_ua_layer.c

    r3553 r4385  
    303303 
    304304        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); 
    308309 
    309310        if (dlg_set) { 
     
    327328 
    328329            /* 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); 
    332335        } 
    333336 
     
    342345        dlg->dlg_set = dlg_set; 
    343346 
    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); 
    347351    } 
    348352 
     
    388392    /* If dialog list is empty, remove the dialog set from the hash table. */ 
    389393    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); 
    392397 
    393398        /* Return dlg_set to free nodes. */ 
     
    450455    /* Lookup the dialog set. */ 
    451456    dlg_set = (struct dlg_set*) 
    452               pj_hash_get(mod_ua.dlg_table, local_tag->ptr, local_tag->slen, 
    453                           NULL); 
     457              pj_hash_get_lower(mod_ua.dlg_table, local_tag->ptr, 
     458                                local_tag->slen, NULL); 
    454459    if (dlg_set == NULL) { 
    455460        /* Not found */ 
     
    463468    dlg = dlg_set->dlg_list.next; 
    464469    while (dlg != (pjsip_dialog*)&dlg_set->dlg_list) {   
    465         if (pj_strcmp(&dlg->remote.info->tag, remote_tag) == 0) 
     470        if (pj_stricmp(&dlg->remote.info->tag, remote_tag) == 0) 
    466471            break; 
    467472        dlg = dlg->next; 
     
    564569        /* Lookup the dialog set. */ 
    565570        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); 
    567573        return dlg_set; 
    568574    } 
     
    621627    while (dlg != (pjsip_dialog*)&dlg_set->dlg_list) { 
    622628         
    623         if (pj_strcmp(&dlg->remote.info->tag, from_tag) == 0) 
     629        if (pj_stricmp(&dlg->remote.info->tag, from_tag) == 0) 
    624630            break; 
    625631 
     
    758764        /* Get the dialog set. */ 
    759765        dlg_set = (struct dlg_set*) 
    760                   pj_hash_get(mod_ua.dlg_table,  
    761                               rdata->msg_info.from->tag.ptr, 
    762                               rdata->msg_info.from->tag.slen, 
    763                               NULL); 
     766                  pj_hash_get_lower(mod_ua.dlg_table,  
     767                                    rdata->msg_info.from->tag.ptr, 
     768                                    rdata->msg_info.from->tag.slen, 
     769                                    NULL); 
    764770 
    765771        if (!dlg_set) { 
     
    809815 
    810816            /* Otherwise find the one with matching To tag. */ 
    811             if (pj_strcmp(to_tag, &dlg->remote.info->tag) == 0) 
     817            if (pj_stricmp(to_tag, &dlg->remote.info->tag) == 0) 
    812818                break; 
    813819 
  • pjproject/branches/1.x/pjsip/src/pjsip/sip_util_proxy.c

    r3553 r4385  
    346346     * a branch value from GUID . 
    347347     */ 
    348     if (pj_strncmp(&rdata->msg_info.via->branch_param,  
     348    if (pj_strnicmp(&rdata->msg_info.via->branch_param,  
    349349                   &rfc3261_branch, PJSIP_RFC3261_BRANCH_LEN) != 0 )  
    350350    { 
  • pjproject/branches/1.x/pjsip/src/test/tsx_uac_test.c

    r3553 r4385  
    160160static void tsx_user_on_tsx_state(pjsip_transaction *tsx, pjsip_event *e) 
    161161{ 
    162     if (pj_strcmp2(&tsx->branch, TEST1_BRANCH_ID)==0) { 
     162    if (pj_stricmp2(&tsx->branch, TEST1_BRANCH_ID)==0) { 
    163163        /* 
    164164         * Transaction with TEST1_BRANCH_ID should terminate with transaction 
     
    214214        } 
    215215 
    216     } else if (pj_strcmp2(&tsx->branch, TEST2_BRANCH_ID)==0) { 
     216    } else if (pj_stricmp2(&tsx->branch, TEST2_BRANCH_ID)==0) { 
    217217        /* 
    218218         * Transaction with TEST2_BRANCH_ID should terminate with transport error. 
     
    232232        } 
    233233 
    234     } else if (pj_strcmp2(&tsx->branch, TEST3_BRANCH_ID)==0) { 
     234    } else if (pj_stricmp2(&tsx->branch, TEST3_BRANCH_ID)==0) { 
    235235        /* 
    236236         * This test terminates the transaction while resolver is still 
     
    257257        } 
    258258 
    259     } else if (pj_strcmp2(&tsx->branch, TEST4_BRANCH_ID)==0) { 
     259    } else if (pj_stricmp2(&tsx->branch, TEST4_BRANCH_ID)==0) { 
    260260        /*  
    261261         * This test simulates transport failure after several  
     
    285285 
    286286 
    287     } else if (pj_strcmp2(&tsx->branch, TEST5_BRANCH_ID)==0) { 
     287    } else if (pj_stricmp2(&tsx->branch, TEST5_BRANCH_ID)==0) { 
    288288        /*  
    289289         * This test simulates transport failure after several  
     
    313313 
    314314 
    315     } else if (pj_strcmp2(&tsx->branch, TEST6_BRANCH_ID)==0) { 
     315    } else if (pj_stricmp2(&tsx->branch, TEST6_BRANCH_ID)==0) { 
    316316        /*  
    317317         * Successfull non-INVITE transaction. 
     
    356356        } 
    357357 
    358     } else if (pj_strcmp2(&tsx->branch, TEST7_BRANCH_ID)==0) { 
     358    } else if (pj_stricmp2(&tsx->branch, TEST7_BRANCH_ID)==0) { 
    359359        /*  
    360360         * Successfull non-INVITE transaction. 
     
    409409 
    410410 
    411     } else if (pj_strcmp2(&tsx->branch, TEST8_BRANCH_ID)==0) { 
     411    } else if (pj_stricmp2(&tsx->branch, TEST8_BRANCH_ID)==0) { 
    412412        /*  
    413413         * Failed INVITE transaction. 
     
    469469 
    470470 
    471     } else if (pj_strcmp2(&tsx->branch, TEST9_BRANCH_ID)==0) { 
     471    } else if (pj_stricmp2(&tsx->branch, TEST9_BRANCH_ID)==0) { 
    472472        /*  
    473473         * Failed INVITE transaction with provisional response. 
     
    584584static pj_bool_t msg_receiver_on_rx_request(pjsip_rx_data *rdata) 
    585585{ 
    586     if (pj_strcmp2(&rdata->msg_info.via->branch_param, TEST1_BRANCH_ID) == 0) { 
     586    if (pj_stricmp2(&rdata->msg_info.via->branch_param, TEST1_BRANCH_ID) == 0) { 
    587587        /* 
    588588         * The TEST1_BRANCH_ID test performs the verifications for transaction 
     
    652652 
    653653    } else 
    654     if (pj_strcmp2(&rdata->msg_info.via->branch_param, TEST4_BRANCH_ID) == 0) { 
     654    if (pj_stricmp2(&rdata->msg_info.via->branch_param, TEST4_BRANCH_ID) == 0) { 
    655655        /* 
    656656         * The TEST4_BRANCH_ID test simulates transport failure after several 
     
    673673 
    674674    } else 
    675     if (pj_strcmp2(&rdata->msg_info.via->branch_param, TEST5_BRANCH_ID) == 0) { 
     675    if (pj_stricmp2(&rdata->msg_info.via->branch_param, TEST5_BRANCH_ID) == 0) { 
    676676        /* 
    677677         * The TEST5_BRANCH_ID test simulates user terminating the transaction 
     
    704704 
    705705    } else 
    706     if (pj_strcmp2(&rdata->msg_info.via->branch_param, TEST6_BRANCH_ID) == 0) { 
     706    if (pj_stricmp2(&rdata->msg_info.via->branch_param, TEST6_BRANCH_ID) == 0) { 
    707707        /* 
    708708         * The TEST6_BRANCH_ID test successfull non-INVITE transaction. 
     
    729729 
    730730    } else 
    731     if (pj_strcmp2(&rdata->msg_info.via->branch_param, TEST7_BRANCH_ID) == 0) { 
     731    if (pj_stricmp2(&rdata->msg_info.via->branch_param, TEST7_BRANCH_ID) == 0) { 
    732732        /* 
    733733         * The TEST7_BRANCH_ID test successfull non-INVITE transaction 
     
    779779 
    780780    } else 
    781     if (pj_strcmp2(&rdata->msg_info.via->branch_param, TEST8_BRANCH_ID) == 0) { 
     781    if (pj_stricmp2(&rdata->msg_info.via->branch_param, TEST8_BRANCH_ID) == 0) { 
    782782        /* 
    783783         * The TEST8_BRANCH_ID test failed INVITE transaction. 
     
    842842 
    843843    } else 
    844     if (pj_strcmp2(&rdata->msg_info.via->branch_param, TEST9_BRANCH_ID) == 0) { 
     844    if (pj_stricmp2(&rdata->msg_info.via->branch_param, TEST9_BRANCH_ID) == 0) { 
    845845        /* 
    846846         * The TEST9_BRANCH_ID test failed INVITE transaction with 
  • pjproject/branches/1.x/pjsip/src/test/tsx_uas_test.c

    r3553 r4385  
    353353static void tsx_user_on_tsx_state(pjsip_transaction *tsx, pjsip_event *e) 
    354354{ 
    355     if (pj_strcmp2(&tsx->branch, TEST1_BRANCH_ID)==0 || 
    356         pj_strcmp2(&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)  
    357357    { 
    358358        /* 
     
    363363         * TEST2_BRANCH_ID does similar test for non-2xx final response. 
    364364         */ 
    365         int status_code = (pj_strcmp2(&tsx->branch, TEST1_BRANCH_ID)==0) ? 
     365        int status_code = (pj_stricmp2(&tsx->branch, TEST1_BRANCH_ID)==0) ? 
    366366                          TEST1_STATUS_CODE : TEST2_STATUS_CODE; 
    367367 
     
    393393    } 
    394394    else 
    395     if (pj_strcmp2(&tsx->branch, TEST3_BRANCH_ID)==0) { 
     395    if (pj_stricmp2(&tsx->branch, TEST3_BRANCH_ID)==0) { 
    396396        /* 
    397397         * TEST3_BRANCH_ID tests sending provisional response. 
     
    456456 
    457457    } else 
    458     if (pj_strcmp2(&tsx->branch, TEST4_BRANCH_ID)==0) { 
     458    if (pj_stricmp2(&tsx->branch, TEST4_BRANCH_ID)==0) { 
    459459        /* 
    460460         * TEST4_BRANCH_ID tests receiving retransmissions in TRYING state. 
     
    489489 
    490490    } else 
    491     if (pj_strcmp2(&tsx->branch, TEST5_BRANCH_ID)==0) { 
     491    if (pj_stricmp2(&tsx->branch, TEST5_BRANCH_ID)==0) { 
    492492        /* 
    493493         * TEST5_BRANCH_ID tests receiving retransmissions in PROCEEDING state 
     
    526526 
    527527    } else 
    528     if (pj_strcmp2(&tsx->branch, TEST6_BRANCH_ID)==0) { 
     528    if (pj_stricmp2(&tsx->branch, TEST6_BRANCH_ID)==0) { 
    529529        /* 
    530530         * TEST6_BRANCH_ID tests receiving retransmissions in COMPLETED state 
     
    561561 
    562562    } else 
    563     if (pj_strcmp2(&tsx->branch, TEST7_BRANCH_ID)==0 || 
    564         pj_strcmp2(&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)  
    565565    { 
    566566        /* 
     
    570570        int code; 
    571571 
    572         if (pj_strcmp2(&tsx->branch, TEST7_BRANCH_ID) == 0) 
     572        if (pj_stricmp2(&tsx->branch, TEST7_BRANCH_ID) == 0) 
    573573            code = TEST7_STATUS_CODE; 
    574574        else 
     
    638638 
    639639    } else 
    640     if (pj_strcmp2(&tsx->branch, TEST9_BRANCH_ID)==0)  { 
     640    if (pj_stricmp2(&tsx->branch, TEST9_BRANCH_ID)==0)  { 
    641641        /* 
    642642         * TEST9_BRANCH_ID tests that retransmission of INVITE final response 
     
    702702 
    703703    } else 
    704     if (pj_strcmp2(&tsx->branch, TEST10_BRANCH_ID)==0 || 
    705         pj_strcmp2(&tsx->branch, TEST11_BRANCH_ID)==0 || 
    706         pj_strcmp2(&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)   
    707707    { 
    708708        if (tsx->state == PJSIP_TSX_STATE_TERMINATED) { 
     
    740740    pj_status_t status; 
    741741 
    742     if (pj_strcmp2(&branch_param, TEST1_BRANCH_ID) == 0 || 
    743         pj_strcmp2(&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)  
    744744    { 
    745745        /* 
     
    750750         * TEST2_BRANCH_ID performs similar test for non-2xx final response. 
    751751         */ 
    752         int status_code = (pj_strcmp2(&branch_param, TEST1_BRANCH_ID) == 0) ? 
     752        int status_code = (pj_stricmp2(&branch_param, TEST1_BRANCH_ID) == 0) ? 
    753753                          TEST1_STATUS_CODE : TEST2_STATUS_CODE; 
    754754 
     
    790790        return PJ_TRUE; 
    791791 
    792     } else if (pj_strcmp2(&branch_param, TEST3_BRANCH_ID) == 0) { 
     792    } else if (pj_stricmp2(&branch_param, TEST3_BRANCH_ID) == 0) { 
    793793 
    794794        /* TEST3_BRANCH_ID tests provisional response. */ 
     
    839839        return PJ_TRUE; 
    840840 
    841     } else if (pj_strcmp2(&branch_param, TEST4_BRANCH_ID) == 0 || 
    842                pj_strcmp2(&branch_param, TEST5_BRANCH_ID) == 0 || 
    843                pj_strcmp2(&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)  
    844844    { 
    845845 
     
    864864            save_key(tsx); 
    865865 
    866             if (pj_strcmp2(&branch_param, TEST4_BRANCH_ID) == 0) { 
    867  
    868             } else if (pj_strcmp2(&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) { 
    869869                send_response(rdata, tsx, TEST5_PROVISIONAL_CODE); 
    870870 
    871             } else if (pj_strcmp2(&branch_param, TEST6_BRANCH_ID) == 0) { 
     871            } else if (pj_stricmp2(&branch_param, TEST6_BRANCH_ID) == 0) { 
    872872                PJ_LOG(4,(THIS_FILE, "    sending provisional response")); 
    873873                send_response(rdata, tsx, TEST6_PROVISIONAL_CODE); 
     
    883883            ++recv_count; 
    884884 
    885             if (pj_strcmp2(&branch_param, TEST4_BRANCH_ID) == 0) { 
     885            if (pj_stricmp2(&branch_param, TEST4_BRANCH_ID) == 0) { 
    886886                PJ_LOG(3,(THIS_FILE, "    error: not expecting response!")); 
    887887                test_complete = -132; 
    888888 
    889             } else if (pj_strcmp2(&branch_param, TEST5_BRANCH_ID) == 0) { 
     889            } else if (pj_stricmp2(&branch_param, TEST5_BRANCH_ID) == 0) { 
    890890 
    891891                if (rdata->msg_info.msg->line.status.code!=TEST5_PROVISIONAL_CODE) { 
     
    899899                } 
    900900 
    901             } else if (pj_strcmp2(&branch_param, TEST6_BRANCH_ID) == 0) { 
     901            } else if (pj_stricmp2(&branch_param, TEST6_BRANCH_ID) == 0) { 
    902902 
    903903                int code = rdata->msg_info.msg->line.status.code; 
     
    928928 
    929929 
    930     } else if (pj_strcmp2(&branch_param, TEST7_BRANCH_ID) == 0 || 
    931                pj_strcmp2(&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)  
    932932    { 
    933933 
     
    951951            save_key(tsx); 
    952952 
    953             if (pj_strcmp2(&branch_param, TEST7_BRANCH_ID) == 0) { 
     953            if (pj_stricmp2(&branch_param, TEST7_BRANCH_ID) == 0) { 
    954954 
    955955                send_response(rdata, tsx, TEST7_STATUS_CODE); 
     
    966966            ++recv_count; 
    967967 
    968             if (pj_strcmp2(&branch_param, TEST7_BRANCH_ID) == 0) 
     968            if (pj_stricmp2(&branch_param, TEST7_BRANCH_ID) == 0) 
    969969                code = TEST7_STATUS_CODE; 
    970970            else 
     
    10141014        return PJ_TRUE; 
    10151015 
    1016     } else if (pj_strcmp2(&branch_param, TEST9_BRANCH_ID) == 0) { 
     1016    } else if (pj_stricmp2(&branch_param, TEST9_BRANCH_ID) == 0) { 
    10171017 
    10181018        /* 
     
    11191119        return PJ_TRUE; 
    11201120 
    1121     } else if (pj_strcmp2(&branch_param, TEST10_BRANCH_ID) == 0 || 
    1122                pj_strcmp2(&branch_param, TEST11_BRANCH_ID) == 0 || 
    1123                pj_strcmp2(&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)  
    11241124    { 
    11251125        int test_num, code1, code2; 
    11261126 
    1127         if (pj_strcmp2(&branch_param, TEST10_BRANCH_ID) == 0) 
     1127        if (pj_stricmp2(&branch_param, TEST10_BRANCH_ID) == 0) 
    11281128            test_num=10, code1 = 100, code2 = 0; 
    1129         else if (pj_strcmp2(&branch_param, TEST11_BRANCH_ID) == 0) 
     1129        else if (pj_stricmp2(&branch_param, TEST11_BRANCH_ID) == 0) 
    11301130            test_num=11, code1 = 100, code2 = 200; 
    11311131        else 
Note: See TracChangeset for help on using the changeset viewer.