static const pjsip_cred_info* auth_find_cred( const pjsip_auth_clt_sess *sess,
					      const pj_str_t *realm,
					      const pj_str_t *auth_scheme)
{
    unsigned i;
    int wildcard = -1;

    PJ_UNUSED_ARG(auth_scheme);

    for (i=0; i<sess->cred_cnt; ++i) {
	if (pj_stricmp(&sess->cred_info[i].realm, realm) == 0)
	    return &sess->cred_info[i];
	else if (sess->cred_info[i].realm.slen == 1 &&
		 sess->cred_info[i].realm.ptr[0] == '*')
	{
	    wildcard = i;
	}
    }

    /* No matching realm. See if we have credential with wildcard ('*')
     * as the realm.
     */
    if (wildcard != -1)
	return &sess->cred_info[wildcard];

    /* Nothing is suitable */
    return NULL;
}
static const pjsip_cred_info* auth_find_cred( const pjsip_auth_clt_sess *sess,
					      const pj_str_t *realm,
					      const pj_str_t *auth_scheme)
{
    unsigned i;
    int wildcard = -1;

    PJ_UNUSED_ARG(auth_scheme);

    for (i=0; i<sess->cred_cnt; ++i) {
	if (pj_stricmp(&sess->cred_info[i].realm, realm) == 0)
	    return &sess->cred_info[i];
	else if (sess->cred_info[i].realm.slen == 1 &&
		 sess->cred_info[i].realm.ptr[0] == '*')
	{
	    wildcard = i;
	}
    }

     
    if (wildcard != -1)
	return &sess->cred_info[wildcard];

     
    return NULL;
}