]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Thu Jan 8 15:00:46 CST 2009 Pekka Pessi <first.last@nokia.com>
authorMichael Jerris <mike@jerris.com>
Wed, 11 Feb 2009 16:50:52 +0000 (16:50 +0000)
committerMichael Jerris <mike@jerris.com>
Wed, 11 Feb 2009 16:50:52 +0000 (16:50 +0000)
  * tport: using <sofia-sip/su_string.h> functions

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11803 d0543943-73ff-0310-b7d9-9358b9ac24b2

libs/sofia-sip/.update
libs/sofia-sip/libsofia-sip-ua/tport/tport.c
libs/sofia-sip/libsofia-sip-ua/tport/tport_logging.c
libs/sofia-sip/libsofia-sip-ua/tport/tport_sigcomp.c
libs/sofia-sip/libsofia-sip-ua/tport/tport_stub_sigcomp.c
libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.c
libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tls.c

index 0d8f1e33d10db0326b19a9227a8285725879d629..4f63f0981b2809cb7a6a810774bef55fcac6078f 100644 (file)
@@ -1 +1 @@
-Wed Feb 11 10:50:12 CST 2009
+Wed Feb 11 10:50:46 CST 2009
index 5aecd6d9324aba158001b813fe11014b24e2f463..3186fe5bc1784b18fdbc23ce65ffac9e994b2124 100644 (file)
@@ -37,7 +37,7 @@
 
 #include "config.h"
 
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
 #include <sofia-sip/su.h>
 #include <sofia-sip/su_errno.h>
 #include <sofia-sip/su_alloc.h>
@@ -1404,7 +1404,7 @@ tport_vtable_t const *tport_vtable_by_name(char const *protoname,
       continue;
     if (vtable->vtp_public != public)
       continue;
-    if (strcasecmp(vtable->vtp_name, protoname))
+    if (!su_casematch(protoname, vtable->vtp_name))
       continue;
 
     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++) {
     su_addrinfo_t *ai = &hints[N];
 
-    if (strcasecmp(transports[i], protocol) != 0 &&
-       strcmp(protocol, tpn_any) != 0)
+    if (!su_casematch(protocol, transports[i]) && !su_strmatch(protocol, "*"))
       continue;
 
     /* Resolve protocol, skip unknown transport protocols. */
@@ -2418,25 +2417,25 @@ int getprotohints(su_addrinfo_t *hints,
   hints->ai_canonname = (char *)proto;
 
 #if HAVE_TLS
-  if (strcasecmp(proto, "tls") == 0)
+  if (su_casematch(proto, "tls"))
     proto = "tcp";
 #endif
 
 #if HAVE_SCTP
-  if (strcasecmp(proto, "sctp") == 0) {
+  if (su_casematch(proto, "sctp")) {
     hints->ai_protocol = IPPROTO_SCTP;
     hints->ai_socktype = SOCK_STREAM;
     return 0;
   }
 #endif
 
-  if (strcasecmp(proto, "udp") == 0) {
+  if (su_casematch(proto, "udp")) {
     hints->ai_protocol = IPPROTO_UDP;
     hints->ai_socktype = SOCK_DGRAM;
     return 0;
   }
 
-  if (strcasecmp(proto, "tcp") == 0) {
+  if (su_casematch(proto, "tcp")) {
     hints->ai_protocol = IPPROTO_TCP;
     hints->ai_socktype = SOCK_STREAM;
     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) {
     for (; self; self = tport_next(self))
-      if (strcasecmp(proto, self->tp_protoname) == 0)
+      if (su_casematch(proto, self->tp_protoname))
        break;
   }
 
@@ -4381,7 +4380,7 @@ tport_t *tport_primary_by_name(tport_t const *tp, tp_name_t const *tpn)
        continue;
 #endif
     }
-    if (proto && strcasecmp(proto, tp->tp_protoname))
+    if (proto && !su_casematch(proto, tp->tp_protoname))
       continue;
 
     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",
                    (void *)self, (void *)sub, TPN_ARGS(tpn)));
       }
-      else if ((strcasecmp(canon, sub->tp_canon) &&
-               strcasecmp(host, sub->tp_host)) ||
-              strcmp(port, sub->tp_port))
+      else if (!su_casematch(port, sub->tp_port))
+       continue;
+      else if (!su_casematch(canon, sub->tp_canon) &&
+              !su_casematch(host, sub->tp_host))
        continue;
 
       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) {
       n = strcspn(b, ";");
 
-      if (n > 10 && strncasecmp(b, "transport=", 10) == 0)
+      if (n > 10 && su_casenmatch(b, "transport=", 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;
 
       if (b[n])
index 9e2d7916b176838ecf29ec4ffd4df41bf72a148b..af2a46d163956a4d68b9f0be4f48c763034777ea 100644 (file)
@@ -36,7 +36,7 @@
 
 #include "tport_internal.h"
 
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
 #include <stdlib.h>
 #include <time.h>
 #include <assert.h>
@@ -245,7 +245,7 @@ void tport_log_msg(tport_t *self, msg_t *msg,
        break;
       }
 
-      n = strncspn(s, end - s, "\r\n");
+      n = su_strncspn(s, end - s, "\r\n");
 
       if (linelen + n > MAX_LINELEN) {
        n = MAX_LINELEN - linelen;
index 9eeed1311d1d48856233f90188e1f016e6b45068..255eca1d86205d846e2a7ec6e87e5e17c03fe7ef 100644 (file)
@@ -38,7 +38,7 @@
 
 #include "tport.h"
 
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
 #include <stdlib.h>
 #include <time.h>
 #include <assert.h>
@@ -146,8 +146,7 @@ char const *vsc_comp_name(tport_sigcomp_t const *master_sc,
 {
   if (master_sc == NULL ||
       master_sc->sc_cc == NULL ||
-      compression == NULL ||
-      strcasecmp(compression, tport_sigcomp_name))
+      !su_casematch(compression, tport_sigcomp_name))
     return NULL;
 
   return tport_sigcomp_name;
index b8846a9abcbd8e53018504ca1054b2336d22e329..9f2ec50b8dc45c8bbfb705983db8332969685631 100644 (file)
@@ -34,7 +34,7 @@
 #include "tport_internal.h"
 
 #include <string.h>
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
 
 tport_comp_vtable_t const *tport_comp_vtable = NULL;
 
@@ -48,7 +48,7 @@ char const tport_sigcomp_name[] = "sigcomp";
 /** Canonize compression string */
 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 NULL;
 }
index 2cb847b4fef3542c744ffea8012c989deeef7bea..7e8a11503b6d510ad2abab94dd48bcfabcb0a254 100644 (file)
@@ -41,6 +41,7 @@
 #include <sofia-sip/su.h>
 #include <sofia-sip/su_alloc.h>
 #include <sofia-sip/su_wait.h>
+#include <sofia-sip/su_string.h>
 
 #include <openssl/lhash.h>
 #include <openssl/bn.h>
index 79d26ac41b53ea383b3001437b278e13d62093ba..c9fd1fe0c29999f285e976e3847a0cdc7c9d8a6d 100644 (file)
@@ -48,7 +48,7 @@
 #include <errno.h>
 #include <limits.h>
 #include <string.h>
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
 
 #if HAVE_FUNC
 #elif HAVE_FUNCTION