[Freeswitch-svn] [commit] r11803 - in freeswitch/trunk/libs/sofia-sip: . libsofia-sip-ua/tport

FreeSWITCH SVN mikej at freeswitch.org
Wed Feb 11 08:50:53 PST 2009


Author: mikej
Date: Wed Feb 11 10:50:52 2009
New Revision: 11803

Log:
Thu Jan  8 15:00:46 CST 2009  Pekka Pessi <first.last at nokia.com>
  * tport: using <sofia-sip/su_string.h> functions



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

Modified: freeswitch/trunk/libs/sofia-sip/.update
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/.update	(original)
+++ freeswitch/trunk/libs/sofia-sip/.update	Wed Feb 11 10:50:52 2009
@@ -1 +1 @@
-Wed Feb 11 10:50:12 CST 2009
+Wed Feb 11 10:50:46 CST 2009

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport.c	Wed Feb 11 10:50:52 2009
@@ -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 @@
       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 @@
   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 @@
   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 @@
 {
   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 @@
 	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 @@
 	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 @@
     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])

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_logging.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_logging.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_logging.c	Wed Feb 11 10:50:52 2009
@@ -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 @@
 	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;

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_sigcomp.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_sigcomp.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_sigcomp.c	Wed Feb 11 10:50:52 2009
@@ -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 @@
 {
   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;

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_stub_sigcomp.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_stub_sigcomp.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_stub_sigcomp.c	Wed Feb 11 10:50:52 2009
@@ -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 @@
 /** 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;
 }

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.c	Wed Feb 11 10:50:52 2009
@@ -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>

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tls.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tls.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tls.c	Wed Feb 11 10:50:52 2009
@@ -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



More information about the Freeswitch-svn mailing list