Thu Jan 8 13:57:46 CST 2009 Pekka Pessi <first.last@nokia.com>

* soa: using <sofia-sip/su_string.h> functions



git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11797 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2009-02-11 16:48:09 +00:00
parent 3ee0b589cf
commit 54ba0c3fa3
3 changed files with 17 additions and 22 deletions

View File

@ -1 +1 @@
Wed Feb 11 10:47:34 CST 2009
Wed Feb 11 10:47:59 CST 2009

View File

@ -52,7 +52,7 @@
#include <sofia-sip/su_localinfo.h>
#include <sofia-sip/su_uniqueid.h>
#include <sofia-sip/string0.h>
#include <sofia-sip/su_string.h>
#include <sofia-sip/su_errno.h>
#define NONE ((void *)-1)
@ -172,7 +172,7 @@ int soa_add(char const *name,
return su_seterrno(EINVAL);
for (n = soa_namelist; n; n = n->next) {
if (strcasecmp(name, n->basename) == 0)
if (su_casematch(name, n->basename))
return 0;
}
@ -197,7 +197,7 @@ struct soa_session_actions const *soa_find(char const *name)
size_t baselen = strcspn(name, ":/");
for (n = soa_namelist; n; n = n->next) {
if (strncasecmp(name, n->basename, baselen) == 0)
if (su_casenmatch(name, n->basename, baselen))
break;
}
@ -230,7 +230,7 @@ soa_session_t *soa_create(char const *name,
size_t baselen = strcspn(name, ":/");
for (n = soa_namelist; n; n = n->next) {
if (strncasecmp(name, n->basename, baselen) == 0)
if (su_casenmatch(name, n->basename, baselen))
break;
}
if (n == NULL)
@ -553,7 +553,7 @@ int soa_base_set_params(soa_session_t *ss, tagi_t const *tags)
ss->ss_srtp_confidentiality = srtp_confidentiality;
ss->ss_srtp_integrity = srtp_integrity;
if (str0casecmp(media_address, ss->ss_address)) {
if (!su_casematch(media_address, ss->ss_address)) {
su_free(ss->ss_home, (void *)ss->ss_address);
ss->ss_address = su_strdup(ss->ss_home, media_address);
change_session = 1;
@ -562,7 +562,7 @@ int soa_base_set_params(soa_session_t *ss, tagi_t const *tags)
if (hold == (char const *)1)
hold = "*";
if (str0casecmp(hold, ss->ss_hold)) {
if (!su_casematch(hold, ss->ss_hold)) {
su_free(ss->ss_home, (void *)ss->ss_hold);
ss->ss_hold = su_strdup(ss->ss_home, hold);
change_session = 1;
@ -1924,7 +1924,7 @@ void soa_set_activity(soa_session_t *ss,
l = &l_video, r = &r_video;
else if (m->m_type == sdp_media_image)
l = &l_image, r = &r_image;
else if (strcasecmp(m->m_type_name, "message") == 0)
else if (su_casematch(m->m_type_name, "message"))
l = &l_chat, r = &r_chat;
else
continue;
@ -2027,8 +2027,7 @@ int soa_set_sdp(soa_session_t *ss,
else if (sdp_str) {
if (str_len == -1)
str_len = strlen(sdp_str);
new_version = !ssd->ssd_unparsed ||
str0ncmp(sdp_str, ssd->ssd_unparsed, str_len + 1) != 0;
new_version = !su_strnmatch(sdp_str, ssd->ssd_unparsed, str_len + 1);
}
else
return (void)su_seterrno(EINVAL), -1;
@ -2221,7 +2220,7 @@ su_localinfo_t *li_in_list(su_localinfo_t *li0, char const **llist)
su_localinfo_t *li;
for (li = li0; li; li = li->li_next) {
if (strncasecmp(li->li_canonname, list, n) == 0 &&
if (su_casenmatch(li->li_canonname, list, n) &&
li->li_canonname[n] == '\0')
break;
}

View File

@ -62,7 +62,7 @@ struct soa_static_complete;
#include <sofia-sip/su_tag_class.h>
#include <sofia-sip/su_tagarg.h>
#include <sofia-sip/su_strlst.h>
#include <sofia-sip/string0.h>
#include <sofia-sip/su_string.h>
#include <sofia-sip/bnf.h>
#include "sofia-sip/soa.h"
@ -72,10 +72,6 @@ struct soa_static_complete;
#define NONE ((void *)-1)
#define XXX assert(!"implemented")
#if !HAVE_STRCASESTR
char *strcasestr(const char *haystack, const char *needle);
#endif
typedef struct soa_static_session
{
soa_session_t sss_session[1];
@ -175,7 +171,7 @@ static int soa_static_set_params(soa_session_t *ss, tagi_t const *tags)
SOATAG_REUSE_REJECTED_REF(reuse_rejected),
TAG_END());
if (n > 0 && str0casecmp(audio_aux, sss->sss_audio_aux)) {
if (n > 0 && !su_casematch(audio_aux, sss->sss_audio_aux)) {
char *s = su_strdup(ss->ss_home, audio_aux), *tbf = sss->sss_audio_aux;
if (s == NULL && audio_aux != NULL)
return -1;
@ -358,7 +354,7 @@ int soa_sdp_is_auxiliary_codec(sdp_rtpmap_t const *rm, char const *auxiliary)
return 0;
for (match = auxiliary;
(match = strcasestr(match, codec));
(match = su_strcasestr(match, codec));
match = match + 1) {
if (IS_ALPHANUM(match[clen]) || match[clen] == '-')
continue;
@ -1009,8 +1005,8 @@ int soa_sdp_mode_set(sdp_session_t const *user,
rm = remote ? remote->sdp_media : NULL, rm_next = NULL;
hold_all = str0cmp(hold, "*") == 0;
inactive_all = str0cmp(hold, "#") == 0;
hold_all = su_strmatch(hold, "*");
inactive_all = su_strmatch(hold, "#");
i = 0;
@ -1051,13 +1047,13 @@ int soa_sdp_mode_set(sdp_session_t const *user,
else if (hold_all) {
recv_mode = 0;
}
else if (hold && (hold_media = strcasestr(hold, sm->m_type_name))) {
else if (hold && (hold_media = su_strcasestr(hold, sm->m_type_name))) {
recv_mode = 0;
hold_media += strlen(sm->m_type_name);
hold_media += strspn(hold_media, " \t");
if (hold_media[0] == '=') {
hold_media += strspn(hold, " \t");
if (strncasecmp(hold_media, "inactive", strlen("inactive")) == 0)
if (su_casenmatch(hold_media, "inactive", strlen("inactive")))
recv_mode = send_mode = 0;
}
}