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

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



git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11803 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2009-02-11 16:50:52 +00:00
parent 2fa6c7435d
commit 1ab22fe83c
7 changed files with 24 additions and 24 deletions

View File

@ -1 +1 @@
Wed Feb 11 10:50:12 CST 2009 Wed Feb 11 10:50:46 CST 2009

View File

@ -37,7 +37,7 @@
#include "config.h" #include "config.h"
#include <sofia-sip/string0.h> #include <sofia-sip/su_string.h>
#include <sofia-sip/su.h> #include <sofia-sip/su.h>
#include <sofia-sip/su_errno.h> #include <sofia-sip/su_errno.h>
#include <sofia-sip/su_alloc.h> #include <sofia-sip/su_alloc.h>
@ -1404,7 +1404,7 @@ tport_vtable_t const *tport_vtable_by_name(char const *protoname,
continue; continue;
if (vtable->vtp_public != public) if (vtable->vtp_public != public)
continue; continue;
if (strcasecmp(vtable->vtp_name, protoname)) if (!su_casematch(protoname, vtable->vtp_name))
continue; continue;
assert(vtable->vtp_pri_size >= sizeof (tport_primary_t)); assert(vtable->vtp_pri_size >= sizeof (tport_primary_t));
@ -1798,8 +1798,7 @@ int tport_server_addrinfo(tport_master_t *mr,
for (i = 0, N = 0; transports[i] && N < TPORT_N; i++) { for (i = 0, N = 0; transports[i] && N < TPORT_N; i++) {
su_addrinfo_t *ai = &hints[N]; su_addrinfo_t *ai = &hints[N];
if (strcasecmp(transports[i], protocol) != 0 && if (!su_casematch(protocol, transports[i]) && !su_strmatch(protocol, "*"))
strcmp(protocol, tpn_any) != 0)
continue; continue;
/* Resolve protocol, skip unknown transport protocols. */ /* Resolve protocol, skip unknown transport protocols. */
@ -2418,25 +2417,25 @@ int getprotohints(su_addrinfo_t *hints,
hints->ai_canonname = (char *)proto; hints->ai_canonname = (char *)proto;
#if HAVE_TLS #if HAVE_TLS
if (strcasecmp(proto, "tls") == 0) if (su_casematch(proto, "tls"))
proto = "tcp"; proto = "tcp";
#endif #endif
#if HAVE_SCTP #if HAVE_SCTP
if (strcasecmp(proto, "sctp") == 0) { if (su_casematch(proto, "sctp")) {
hints->ai_protocol = IPPROTO_SCTP; hints->ai_protocol = IPPROTO_SCTP;
hints->ai_socktype = SOCK_STREAM; hints->ai_socktype = SOCK_STREAM;
return 0; return 0;
} }
#endif #endif
if (strcasecmp(proto, "udp") == 0) { if (su_casematch(proto, "udp")) {
hints->ai_protocol = IPPROTO_UDP; hints->ai_protocol = IPPROTO_UDP;
hints->ai_socktype = SOCK_DGRAM; hints->ai_socktype = SOCK_DGRAM;
return 0; return 0;
} }
if (strcasecmp(proto, "tcp") == 0) { if (su_casematch(proto, "tcp")) {
hints->ai_protocol = IPPROTO_TCP; hints->ai_protocol = IPPROTO_TCP;
hints->ai_socktype = SOCK_STREAM; hints->ai_socktype = SOCK_STREAM;
return 0; return 0;
@ -4327,7 +4326,7 @@ tport_t *tport_by_protocol(tport_t const *self, char const *proto)
{ {
if (proto && strcmp(proto, tpn_any) != 0) { if (proto && strcmp(proto, tpn_any) != 0) {
for (; self; self = tport_next(self)) for (; self; self = tport_next(self))
if (strcasecmp(proto, self->tp_protoname) == 0) if (su_casematch(proto, self->tp_protoname))
break; break;
} }
@ -4381,7 +4380,7 @@ tport_t *tport_primary_by_name(tport_t const *tp, tp_name_t const *tpn)
continue; continue;
#endif #endif
} }
if (proto && strcasecmp(proto, tp->tp_protoname)) if (proto && !su_casematch(proto, tp->tp_protoname))
continue; continue;
if (comp && comp != tp->tp_name->tpn_comp) { if (comp && comp != tp->tp_name->tpn_comp) {
@ -4515,9 +4514,10 @@ tport_t *tport_by_name(tport_t const *self, tp_name_t const *tpn)
SU_DEBUG_7(("tport(%p): found %p by name " TPN_FORMAT "\n", SU_DEBUG_7(("tport(%p): found %p by name " TPN_FORMAT "\n",
(void *)self, (void *)sub, TPN_ARGS(tpn))); (void *)self, (void *)sub, TPN_ARGS(tpn)));
} }
else if ((strcasecmp(canon, sub->tp_canon) && else if (!su_casematch(port, sub->tp_port))
strcasecmp(host, sub->tp_host)) || continue;
strcmp(port, sub->tp_port)) else if (!su_casematch(canon, sub->tp_canon) &&
!su_casematch(host, sub->tp_host))
continue; continue;
return (tport_t *)sub; return (tport_t *)sub;
@ -4635,9 +4635,9 @@ int tport_name_by_url(su_home_t *home,
for (b = (char *)url->url_params; b[0]; b += n) { for (b = (char *)url->url_params; b[0]; b += n) {
n = strcspn(b, ";"); n = strcspn(b, ";");
if (n > 10 && strncasecmp(b, "transport=", 10) == 0) if (n > 10 && su_casenmatch(b, "transport=", 10))
tpn->tpn_proto = b + 10; tpn->tpn_proto = b + 10;
else if (n > 6 && strncasecmp(b, "maddr=", 6) == 0) else if (n > 6 && su_casenmatch(b, "maddr=", 6))
tpn->tpn_host = b + 6; tpn->tpn_host = b + 6;
if (b[n]) if (b[n])

View File

@ -36,7 +36,7 @@
#include "tport_internal.h" #include "tport_internal.h"
#include <sofia-sip/string0.h> #include <sofia-sip/su_string.h>
#include <stdlib.h> #include <stdlib.h>
#include <time.h> #include <time.h>
#include <assert.h> #include <assert.h>
@ -245,7 +245,7 @@ void tport_log_msg(tport_t *self, msg_t *msg,
break; break;
} }
n = strncspn(s, end - s, "\r\n"); n = su_strncspn(s, end - s, "\r\n");
if (linelen + n > MAX_LINELEN) { if (linelen + n > MAX_LINELEN) {
n = MAX_LINELEN - linelen; n = MAX_LINELEN - linelen;

View File

@ -38,7 +38,7 @@
#include "tport.h" #include "tport.h"
#include <sofia-sip/string0.h> #include <sofia-sip/su_string.h>
#include <stdlib.h> #include <stdlib.h>
#include <time.h> #include <time.h>
#include <assert.h> #include <assert.h>
@ -146,8 +146,7 @@ char const *vsc_comp_name(tport_sigcomp_t const *master_sc,
{ {
if (master_sc == NULL || if (master_sc == NULL ||
master_sc->sc_cc == NULL || master_sc->sc_cc == NULL ||
compression == NULL || !su_casematch(compression, tport_sigcomp_name))
strcasecmp(compression, tport_sigcomp_name))
return NULL; return NULL;
return tport_sigcomp_name; return tport_sigcomp_name;

View File

@ -34,7 +34,7 @@
#include "tport_internal.h" #include "tport_internal.h"
#include <string.h> #include <string.h>
#include <sofia-sip/string0.h> #include <sofia-sip/su_string.h>
tport_comp_vtable_t const *tport_comp_vtable = NULL; tport_comp_vtable_t const *tport_comp_vtable = NULL;
@ -48,7 +48,7 @@ char const tport_sigcomp_name[] = "sigcomp";
/** Canonize compression string */ /** Canonize compression string */
char const *tport_canonize_comp(char const *comp) char const *tport_canonize_comp(char const *comp)
{ {
if (tport_comp_vtable && comp && strcasecmp(comp, tport_sigcomp_name) == 0) if (tport_comp_vtable && su_casematch(comp, tport_sigcomp_name))
return tport_sigcomp_name; return tport_sigcomp_name;
return NULL; return NULL;
} }

View File

@ -41,6 +41,7 @@
#include <sofia-sip/su.h> #include <sofia-sip/su.h>
#include <sofia-sip/su_alloc.h> #include <sofia-sip/su_alloc.h>
#include <sofia-sip/su_wait.h> #include <sofia-sip/su_wait.h>
#include <sofia-sip/su_string.h>
#include <openssl/lhash.h> #include <openssl/lhash.h>
#include <openssl/bn.h> #include <openssl/bn.h>

View File

@ -48,7 +48,7 @@
#include <errno.h> #include <errno.h>
#include <limits.h> #include <limits.h>
#include <string.h> #include <string.h>
#include <sofia-sip/string0.h> #include <sofia-sip/su_string.h>
#if HAVE_FUNC #if HAVE_FUNC
#elif HAVE_FUNCTION #elif HAVE_FUNCTION