Freeswitch-trunk
Threads by month
- ----- 2026 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
February 2009
- 17 participants
- 681 discussions
[commit] r11801 - in freeswitch/trunk/libs/sofia-sip: . libsofia-sip-ua/bnf
by FreeSWITCH SVN 11 Feb '09
by FreeSWITCH SVN 11 Feb '09
11 Feb '09
Author: mikej
Date: Wed Feb 11 10:49:51 2009
New Revision: 11801
Log:
Thu Jan 8 14:55:01 CST 2009 Pekka Pessi <first.last(a)nokia.com>
* bnf: using <sofia-sip/su_string.h>
Modified:
freeswitch/trunk/libs/sofia-sip/.update
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/bnf/Makefile.am
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/bnf/bnf.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:49:51 2009
@@ -1 +1 @@
-Wed Feb 11 10:49:17 CST 2009
+Wed Feb 11 10:49:44 CST 2009
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/bnf/Makefile.am
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/bnf/Makefile.am (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/bnf/Makefile.am Wed Feb 11 10:49:51 2009
@@ -26,7 +26,7 @@
COVERAGE_INPUT = $(libbnf_la_SOURCES) $(include_sofia_HEADERS)
-LDADD = libbnf.la
+LDADD = libbnf.la ../su/libsu.la
torture_bnf_LDFLAGS = -static
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/bnf/bnf.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/bnf/bnf.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/bnf/bnf.c Wed Feb 11 10:49:51 2009
@@ -34,6 +34,7 @@
#include "config.h"
#include "sofia-sip/bnf.h"
+#include "sofia-sip/su_string.h"
#include <stdio.h>
#include <assert.h>
@@ -795,12 +796,12 @@
return
n >= 9 /* strlen("localhost") */ &&
- strncasecmp(host, "localhost", 9) == 0 &&
+ su_casenmatch(host, "localhost", 9) &&
(n == 9 ||
((n == 10 || /* localhost. */
n == 21 || /* strlen("localhost.localdomain") */
n == 22) && /* strlen("localhost.localdomain.") */
- strncasecmp(host + 9, ".localdomain.", n - 9) == 0));
+ su_casenmatch(host + 9, ".localdomain.", n - 9)));
}
/** Return true if @a string has domain name in "invalid." domain.
@@ -815,9 +816,9 @@
if (string[n - 1] == '.') /* .invalid. perhaps? */
n--;
if (n == 7 /* strlen("invalid") */)
- return strncasecmp(string, invalid + 1, 7) == 0;
+ return su_casenmatch(string, invalid + 1, 7);
else
- return strncasecmp(string + n - 8, invalid, 8) == 0;
+ return su_casenmatch(string + n - 8, invalid, 8);
}
return 0;
@@ -913,7 +914,7 @@
retval = memcmp(a6, b6, asize);
}
else {
- retval = strcasecmp(a, b);
+ retval = su_strcasecmp(a, b);
}
}
1
0
[commit] r11800 - in freeswitch/trunk/libs/sofia-sip: . libsofia-sip-ua/nua
by FreeSWITCH SVN 11 Feb '09
by FreeSWITCH SVN 11 Feb '09
11 Feb '09
Author: mikej
Date: Wed Feb 11 10:49:25 2009
New Revision: 11800
Log:
Thu Jan 8 14:52:37 CST 2009 Pekka Pessi <first.last(a)nokia.com>
* nua: using <sofia-sip/su_string.h> functions
Modified:
freeswitch/trunk/libs/sofia-sip/.update
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_common.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_event_server.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_extension.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_message.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_notifier.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_options.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_publish.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_registrar.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_subnotref.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/outbound.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_s2.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:49:25 2009
@@ -1 +1 @@
-Wed Feb 11 10:48:54 CST 2009
+Wed Feb 11 10:49:17 CST 2009
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_common.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_common.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_common.c Wed Feb 11 10:49:25 2009
@@ -55,6 +55,7 @@
#include <sofia-sip/su_wait.h>
+#include <sofia-sip/su_string.h>
#include <sofia-sip/su_strlst.h>
#include "sofia-sip/nua.h"
@@ -420,11 +421,11 @@
{
if (sip_substate == NULL)
return nua_substate_active;
- else if (strcasecmp(sip_substate, "terminated") == 0)
+ else if (su_casematch(sip_substate, "terminated"))
return nua_substate_terminated;
- else if (strcasecmp(sip_substate, "pending") == 0)
+ else if (su_casematch(sip_substate, "pending"))
return nua_substate_pending;
- else /* if (strcasecmp(sip_substate, "active") == 0) */
+ else /* if (su_casematch(sip_substate, "active")) */
return nua_substate_active;
}
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.c Wed Feb 11 10:49:25 2009
@@ -39,7 +39,7 @@
#include <assert.h>
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
#include <sofia-sip/su_uniqueid.h>
#include <sofia-sip/sip_protos.h>
@@ -241,10 +241,10 @@
if (event != o) {
if (event == NULL || o == NULL)
continue;
- if (strcmp(event->o_type, o->o_type))
+ if (!su_strmatch(event->o_type, o->o_type))
continue;
- if (str0casecmp(event->o_id, o->o_id)) {
- if (event->o_id || strcmp(event->o_type, "refer"))
+ if (!su_casematch(event->o_id, o->o_id)) {
+ if (event->o_id || !su_strmatch(event->o_type, "refer"))
continue;
}
}
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_event_server.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_event_server.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_event_server.c Wed Feb 11 10:49:25 2009
@@ -39,7 +39,7 @@
#include <assert.h>
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
#include <sofia-sip/sip_protos.h>
#include <sofia-sip/sip_status.h>
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_extension.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_extension.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_extension.c Wed Feb 11 10:49:25 2009
@@ -39,7 +39,7 @@
#include <assert.h>
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
#include <sofia-sip/sip_protos.h>
#include <sofia-sip/sip_status.h>
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_message.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_message.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_message.c Wed Feb 11 10:49:25 2009
@@ -39,7 +39,7 @@
#include <assert.h>
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
#include <sofia-sip/sip_protos.h>
#include <sofia-sip/sip_status.h>
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_notifier.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_notifier.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_notifier.c Wed Feb 11 10:49:25 2009
@@ -42,7 +42,7 @@
#include <assert.h>
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
#include <sofia-sip/sip_protos.h>
#include <sofia-sip/sip_extra.h>
#include <sofia-sip/sip_status.h>
@@ -220,7 +220,7 @@
char const *event = o ? o->o_type : NULL;
if (sr->sr_initial || !nua_dialog_usage_get(ds, nua_notify_usage, o)) {
- if (event && str0cmp(event, "refer") == 0)
+ if (su_strmatch(event, "refer"))
/* refer event subscription should be initiated with REFER */
return SR_STATUS1(sr, SIP_403_FORBIDDEN);
@@ -257,7 +257,7 @@
}
else {
/* Refresh existing subscription */
- if (str0cmp(event, "refer") == 0)
+ if (su_strmatch(event, "refer"))
expires = NH_PGET(nh, refer_expires);
SR_STATUS1(sr, SIP_200_OK);
@@ -360,9 +360,9 @@
if (!nu->nu_tag)
notify = 1;
- else if (snim && !strcasecmp(snim->snim_tag, nu->nu_tag))
+ else if (snim && su_casematch(snim->snim_tag, nu->nu_tag))
notify = 0;
- else if (sbim && !strcasecmp(snim->snim_tag, nu->nu_tag))
+ else if (sbim && su_casematch(snim->snim_tag, nu->nu_tag))
notify = 1, nu->nu_no_body = 1;
else
#endif
@@ -621,7 +621,7 @@
if (cr->cr_usage->du_ready) {
snim = sip_suppress_notify_if_match(sip);
- if (snim && !strcasecmp(snim->snim_tag, nu->nu_tag)) {
+ if (snim && su_casematch(snim->snim_tag, nu->nu_tag)) {
if (nu->nu_requested > nu->nu_expires)
nu->nu_expires = nu->nu_requested;
nu->nu_requested = 0;
@@ -630,7 +630,7 @@
}
sbim = sip_suppress_body_if_match(sip);
- if (sbim && !strcasecmp(sbim->sbim_tag, nu->nu_tag))
+ if (sbim && su_casematch(sbim->sbim_tag, nu->nu_tag))
nu->nu_no_body = 1;
}
#endif
@@ -915,8 +915,8 @@
if (sr->sr_status < 200 || nu == NULL) {
}
else if (sr->sr_status < 300 &&
- /* Application included Refer-Sub: false in response */
- (rs == NULL || str0casecmp("false", rs->rs_value))) {
+ /* No subscription if Refer-Sub: false in response */
+ (rs == NULL || !su_casematch(rs->rs_value, "false"))) {
sr->sr_usage->du_ready = 1;
nu->nu_expires = sip_now() + NH_PGET(nh, refer_expires);
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_options.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_options.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_options.c Wed Feb 11 10:49:25 2009
@@ -41,7 +41,7 @@
#include <assert.h>
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
#include <sofia-sip/sip_protos.h>
#include <sofia-sip/sip_status.h>
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.c Wed Feb 11 10:49:25 2009
@@ -32,7 +32,7 @@
#include "config.h"
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
#include <sofia-sip/su_strlst.h>
#include <sofia-sip/token64.h>
#include <sofia-sip/su_tagarg.h>
@@ -54,10 +54,6 @@
#include <assert.h>
-#if !HAVE_STRCASESTR
-char *strcasestr(char const *haystack, char const *needle);
-#endif
-
/* ====================================================================== */
/* Helper macros and functions for handling #nua_handle_preferences_t. */
@@ -113,7 +109,7 @@
char const pn[] = " " PACKAGE_NAME "/";
size_t pnlen = strlen(pn + 1);
- return strncasecmp(s, pn + 1, pnlen) == 0 || strcasestr(s, pn);
+ return su_casenmatch(s, pn + 1, pnlen) || su_strcasestr(s, pn);
}
/* ====================================================================== */
@@ -964,7 +960,7 @@
/* NUTAG_REGISTRAR(registrar) */
else if (tag == nutag_registrar) {
NHP_SET_STR_BY_URL(nhp, char, registrar, value);
- if (NHP_ISSET(nhp, registrar) && !str0cmp(nhp->nhp_registrar, "*"))
+ if (NHP_ISSET(nhp, registrar) && su_strmatch(nhp->nhp_registrar, "*"))
NHP_SET_STR(nhp, registrar, 0);
}
/* NUTAG_INSTANCE(instance) */
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_publish.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_publish.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_publish.c Wed Feb 11 10:49:25 2009
@@ -41,7 +41,7 @@
#include <assert.h>
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
#include <sofia-sip/sip_protos.h>
#include <sofia-sip/sip_status.h>
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c Wed Feb 11 10:49:25 2009
@@ -39,7 +39,7 @@
#define TP_CLIENT_T struct register_usage
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
#include <sofia-sip/su_strlst.h>
#include <sofia-sip/su_uniqueid.h>
#include <sofia-sip/su_tagarg.h>
@@ -1163,13 +1163,13 @@
if (contact1 &&
(url_is_string(contact1)
- ? strncasecmp(contact1->us_str, "sips:", 5) == 0
+ ? su_casenmatch(contact1->us_str, "sips:", 5)
: contact1->us_url->url_type == url_sips))
name1 = "sips";
if (contact2 &&
(url_is_string(contact2)
- ? strncasecmp(contact2->us_str, "sips:", 5) == 0
+ ? su_casenmatch(contact2->us_str, "sips:", 5)
: contact2->us_url->url_type == url_sips))
name2 = "sips";
@@ -1379,11 +1379,11 @@
if (protocol) {
/* Try to pair vias if we have both udp and tcp */
for (prev = vv; *prev; prev = &(*prev)->v_next) {
- if (strcasecmp(protocol, (*prev)->v_protocol))
+ if (!su_casematch(protocol, (*prev)->v_protocol))
continue;
- if (strcasecmp(v->v_host, (*prev)->v_host))
+ if (!su_casematch(v->v_host, (*prev)->v_host))
continue;
- if (str0cmp(v->v_port, (*prev)->v_port))
+ if (!su_strmatch(v->v_port, (*prev)->v_port))
continue;
break;
}
@@ -2023,7 +2023,7 @@
}
if (transport) {
- if (strncasecmp(transport, "SIP/2.0/", 8) == 0)
+ if (su_casenmatch(transport, "SIP/2.0/", 8))
transport += 8;
/* Make transport parameter lowercase */
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_registrar.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_registrar.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_registrar.c Wed Feb 11 10:49:25 2009
@@ -39,7 +39,7 @@
#include <assert.h>
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
#include <sofia-sip/sip_protos.h>
#include <sofia-sip/sip_status.h>
#include <sofia-sip/sip_util.h>
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c Wed Feb 11 10:49:25 2009
@@ -39,7 +39,7 @@
#include <assert.h>
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
#include <sofia-sip/sip_protos.h>
#include <sofia-sip/sip_status.h>
#include <sofia-sip/sip_util.h>
@@ -4337,9 +4337,9 @@
if (x->x_refresher) {
int uas = sip->sip_request != NULL;
- if (strcasecmp(x->x_refresher, "uac") == 0)
+ if (su_casenmatch(x->x_refresher, "uac", (sizeof "uac")))
t->remote.refresher = uas ? nua_remote_refresher : nua_local_refresher;
- else if (strcasecmp(x->x_refresher, "uas") == 0)
+ else if (su_casenmatch(x->x_refresher, "uas", (sizeof "uas")))
t->remote.refresher = uas ? nua_local_refresher : nua_remote_refresher;
}
else if (t->remote.require) {
@@ -4533,7 +4533,7 @@
else if (ct->c_type == NULL)
SU_DEBUG_3(("nua: empty %s, assuming %s\n",
"Content-Type", SDP_MIME_TYPE));
- else if (strcasecmp(ct->c_type, SDP_MIME_TYPE)) {
+ else if (!su_casematch(ct->c_type, SDP_MIME_TYPE)) {
SU_DEBUG_5(("nua: unknown %s: %s\n", "Content-Type", ct->c_type));
return 0;
}
@@ -4545,7 +4545,7 @@
if (!matching_content_type) {
/* Make sure we got SDP */
- if (pl->pl_len < 3 || strncasecmp(pl->pl_data, "v=0", 3))
+ if (pl->pl_len < 3 || !su_casenmatch(pl->pl_data, "v=0", 3))
return 0;
}
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_subnotref.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_subnotref.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_subnotref.c Wed Feb 11 10:49:25 2009
@@ -44,7 +44,7 @@
#include <assert.h>
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
#include <sofia-sip/sip_protos.h>
#include <sofia-sip/sip_status.h>
#include <sofia-sip/sip_extra.h>
@@ -547,7 +547,8 @@
/* Check for forked subscription. */
if (ds->ds_remote_tag && ds->ds_remote_tag[0] &&
- str0cmp(ds->ds_remote_tag, sr->sr_request.sip->sip_from->a_tag)) {
+ su_strcasecmp(ds->ds_remote_tag,
+ sr->sr_request.sip->sip_from->a_tag)) {
sip_contact_t const *m = NULL;
m = nua_stack_get_contact(sr->sr_owner->nh_nua->nua_registrations);
@@ -611,18 +612,18 @@
else
substate = nua_substate_active, what = "active";
}
- else if (strcasecmp(subs->ss_substate, what = "terminated") == 0) {
+ else if (su_casematch(subs->ss_substate, what = "terminated")) {
substate = nua_substate_terminated;
reason = subs->ss_reason;
- if (str0casecmp(reason, "deactivated") == 0 ||
- str0casecmp(reason, "probation") == 0)
+ if (su_casematch(reason, "deactivated") ||
+ su_casematch(reason, "probation"))
substate = nua_substate_embryonic;
}
- else if (strcasecmp(subs->ss_substate, what = "pending") == 0) {
+ else if (su_casematch(subs->ss_substate, what = "pending")) {
substate = nua_substate_pending;
}
- else /* if (strcasecmp(subs->ss_substate, what = "active") == 0) */ {
+ else /* if (su_casematch(subs->ss_substate, what = "active")) */ {
/* Any extended state is considered as active */
what = subs->ss_substate;
substate = nua_substate_active;
@@ -670,10 +671,10 @@
}
else if (substate == nua_substate_embryonic) {
if (subs && subs->ss_reason) {
- if (str0casecmp(subs->ss_reason, "deactivated") == 0) {
+ if (su_casematch(subs->ss_reason, "deactivated")) {
retry = 0; /* retry immediately */
}
- else if (str0casecmp(subs->ss_reason, "probation") == 0) {
+ else if (su_casematch(subs->ss_reason, "probation")) {
retry = 30;
if (subs->ss_retry_after)
retry = strtoul(subs->ss_retry_after, NULL, 10);
@@ -913,7 +914,7 @@
else if (status < 300) {
sip_refer_sub_t const *rs = sip_refer_sub(sip);
- if (rs && strcasecmp("false", rs->rs_value) == 0)
+ if (rs && su_casematch("false", rs->rs_value))
cr->cr_terminated = 1;
if (!cr->cr_terminated)
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/outbound.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/outbound.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/outbound.c Wed Feb 11 10:49:25 2009
@@ -263,7 +263,7 @@
prefs->interval = interval;
prefs->stream_interval = stream_interval;
-#define MATCH(v) (len == sizeof(#v) - 1 && strncasecmp(#v, s, len) == 0)
+#define MATCH(v) (len == sizeof(#v) - 1 && su_casenmatch(#v, s, len))
if (options) {
for (s = options; s[0]; s++) if (s[0] == '-') s[0] = '_';
@@ -280,9 +280,9 @@
size_t len = span_token(s);
int value = 1;
- if (len > 3 && strncasecmp(s, "no_", 3) == 0)
+ if (len > 3 && su_casenmatch(s, "no_", 3))
value = 0, s += 3, len -= 3;
- else if (len > 4 && strncasecmp(s, "not_", 4) == 0)
+ else if (len > 4 && su_casenmatch(s, "not_", 4))
value = 0, s += 4, len -= 4;
if (len == 0)
@@ -527,7 +527,7 @@
nat_port = ob->ob_nat_port;
if (nat_detected && host_cmp(received, nat_detected) == 0) {
- if (nat_port && strcasecmp(rport, nat_port) == 0)
+ if (nat_port && su_casematch(rport, nat_port))
return 1;
if (!v->v_rport || !v->v_rport[0])
return 1;
@@ -1030,7 +1030,7 @@
sip->sip_request->rq_method == sip_method_options &&
sip->sip_accept &&
sip->sip_accept->ac_type &&
- strcasecmp(sip->sip_accept->ac_type, outbound_content_type) == 0;
+ su_casematch(sip->sip_accept->ac_type, outbound_content_type);
}
/** Answer to the connectivity probe OPTIONS */
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_s2.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_s2.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_s2.c Wed Feb 11 10:49:25 2009
@@ -44,6 +44,7 @@
#include <sofia-sip/su_log.h>
#include <sofia-sip/su_tagarg.h>
#include <sofia-sip/su_alloc.h>
+#include <sofia-sip/su_string.h>
#include <stdlib.h>
#include <string.h>
@@ -982,21 +983,21 @@
tpn->tpn_host,
tpn->tpn_port);
assert(v != NULL);
- if (strncasecmp(tpn->tpn_proto, "tls", 3)) {
+ if (!su_casenmatch(tpn->tpn_proto, "tls", 3)) {
m = sip_contact_format(s2->home, "<sip:%s:%s;transport=%s>",
tpn->tpn_host,
tpn->tpn_port,
tpn->tpn_proto);
- if (s2->udp.contact == NULL && strcasecmp(tpn->tpn_proto, "udp") == 0) {
+ if (s2->udp.contact == NULL && su_casematch(tpn->tpn_proto, "udp")) {
s2->udp.tport = tport_ref(tp);
s2->udp.contact = m;
}
- if (s2->tcp.contact == NULL && strcasecmp(tpn->tpn_proto, "tcp") == 0) {
+ if (s2->tcp.contact == NULL && su_casematch(tpn->tpn_proto, "tcp")) {
s2->tcp.tport = tport_ref(tp);
s2->tcp.contact = m;
}
}
- else if (strcasecmp(tpn->tpn_proto, "tls")) {
+ else if (!su_casematch(tpn->tpn_proto, "tls")) {
m = sip_contact_format(s2->home, "<sips:%s:%s;transport=%s>",
tpn->tpn_host,
tpn->tpn_port,
1
0
11 Feb '09
Author: mikej
Date: Wed Feb 11 10:49:01 2009
New Revision: 11799
Log:
Thu Jan 8 14:47:09 CST 2009 Pekka Pessi <first.last(a)nokia.com>
* utils/sip-dig.c: using <sofia-sip/su_string.h> functions
Modified:
freeswitch/trunk/libs/sofia-sip/.update
freeswitch/trunk/libs/sofia-sip/utils/sip-dig.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:49:01 2009
@@ -1 +1 @@
-Wed Feb 11 10:48:33 CST 2009
+Wed Feb 11 10:48:54 CST 2009
Modified: freeswitch/trunk/libs/sofia-sip/utils/sip-dig.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/utils/sip-dig.c (original)
+++ freeswitch/trunk/libs/sofia-sip/utils/sip-dig.c Wed Feb 11 10:49:01 2009
@@ -141,6 +141,7 @@
#include "sofia-sip/url.h"
#include "sofia-sip/su_alloc.h"
+#include "sofia-sip/su_string.h"
#include "sofia-sip/hostdomain.h"
char const name[] = "sip-dig";
@@ -361,7 +362,7 @@
int transport_is_secure(char const *tportname)
{
- return tportname && strncasecmp(tportname, "tls", 3) == 0;
+ return su_casenmatch(tportname, "tls", 3);
}
int prepare_transport(struct dig *dig, char const *tport)
@@ -372,7 +373,7 @@
for (j = 0; j < N_TPORT - 1; j++) {
if (!tports[j].name)
break;
- if (strcasecmp(tports[j].name, tport) == 0)
+ if (su_casematch(tports[j].name, tport))
return 1;
}
@@ -402,27 +403,27 @@
tports[j].service = service;
tports[j].srv = srv;
}
- else if (strcasecmp(tport, "udp") == 0) {
+ else if (su_casematch(tport, "udp")) {
tports[j].name = "udp";
tports[j].service = "SIP+D2U";
tports[j].srv = "_sip._udp.";
}
- else if (strcasecmp(tport, "tcp") == 0) {
+ else if (su_casematch(tport, "tcp")) {
tports[j].name = "tcp";
tports[j].service = "SIP+D2T";
tports[j].srv = "_sip._tcp.";
}
- else if (strcasecmp(tport, "tls") == 0) {
+ else if (su_casematch(tport, "tls")) {
tports[j].name = "tls";
tports[j].service = "SIPS+D2T";
tports[j].srv = "_sips._tcp.";
}
- else if (strcasecmp(tport, "sctp") == 0) {
+ else if (su_casematch(tport, "sctp")) {
tports[j].name = "sctp";
tports[j].service = "SIP+D2S";
tports[j].srv = "_sip._sctp.";
}
- else if (strcasecmp(tport, "tls-sctp") == 0) {
+ else if (su_casematch(tport, "tls-sctp")) {
tports[j].name = "tls-sctp";
tports[j].service = "SIPS+D2S";
tports[j].srv = "_sips._sctp.";
@@ -451,9 +452,9 @@
for (i = 0; tports[i].name; i++) {
if (dig->sips && !transport_is_secure(tports[i].name))
continue;
- if (!tport || strcasecmp(tport, tports[i].name) == 0)
+ if (!tport || su_casematch(tport, tports[i].name))
tcount++;
- if (tport2 && strcasecmp(tport2, tports[i].name) == 0)
+ else if (tport2 && su_casematch(tport2, tports[i].name))
tcount++;
}
@@ -466,7 +467,7 @@
int i;
for (i = 0; tports[i].name; i++) {
- if (strcasecmp(tports[i].service, s) == 0)
+ if (su_casematch(tports[i].service, s))
return tports + i;
}
@@ -503,13 +504,13 @@
na->na_flags, na->na_services,
na->na_regexp, na->na_replace);
- if (strcasecmp(na->na_flags, "s") && strcasecmp(na->na_flags, "a"))
+ if (!su_casematch(na->na_flags, "s") && !su_casematch(na->na_flags, "a"))
continue;
if (nacount && order != na->na_order)
continue;
- if (dig->sips && strncasecmp(na->na_services, "SIPS+", 5))
+ if (dig->sips && !su_casenmatch(na->na_services, "SIPS+", 5))
continue;
if (!transport_by_service(dig->tports, na->na_services))
@@ -530,19 +531,19 @@
continue;
if (order != na->na_order)
continue;
- if (strcasecmp(na->na_flags, "s") && strcasecmp(na->na_flags, "a"))
+ if (!su_casematch(na->na_flags, "s") && !su_casematch(na->na_flags, "a"))
continue;
- if (dig->sips && strncasecmp(na->na_services, "SIPS+", 5))
+ if (dig->sips && !su_casematch(na->na_services, "SIPS+", 5))
continue;
tp = transport_by_service(dig->tports, na->na_services);
if (!tp)
continue;
- if (strcasecmp(na->na_flags, "s") == 0) {
+ if (su_casematch(na->na_flags, "s")) {
scount = dig_srv(dig, tp->name, na->na_replace, weight / nacount);
}
- else if (strcasecmp(na->na_flags, "a") == 0) {
+ else if (su_casematch(na->na_flags, "a")) {
scount = dig_addr(dig, tp->name, na->na_replace, NULL, weight / nacount);
}
else
@@ -572,7 +573,7 @@
return 0;
for (i = 0, n = 0; dig->tports[i].name; i++) {
- if (tport && strcasecmp(dig->tports[i].name, tport))
+ if (tport && !su_casematch(dig->tports[i].name, tport))
continue;
if (dig->sips && !transport_is_secure(dig->tports[i].name))
@@ -799,9 +800,9 @@
su_inet_ntop(af, &answers[i]->sr_a->a_addr, addr, sizeof addr);
for (j = 0; tports[j].name; j++) {
- if (strcasecmp(tport, tports[j].name) == 0)
+ if (su_casematch(tport, tports[j].name))
print_result(addr, port, tport, weight, preference);
- if (tport2 && strcasecmp(tport2, tports[j].name) == 0)
+ if (su_casematch(tport2, tports[j].name))
print_result(addr, port, tport2, weight, preference);
}
}
1
0
[commit] r11798 - in freeswitch/trunk/libs/sofia-sip: . libsofia-sip-ua/nth
by FreeSWITCH SVN 11 Feb '09
by FreeSWITCH SVN 11 Feb '09
11 Feb '09
Author: mikej
Date: Wed Feb 11 10:48:40 2009
New Revision: 11798
Log:
Thu Jan 8 14:29:39 CST 2009 Pekka Pessi <first.last(a)nokia.com>
* nth: using <sofia-sip/su_string.h> functions
Modified:
freeswitch/trunk/libs/sofia-sip/.update
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nth/nth_client.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nth/nth_server.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:48:40 2009
@@ -1 +1 @@
-Wed Feb 11 10:47:59 CST 2009
+Wed Feb 11 10:48:33 CST 2009
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nth/nth_client.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nth/nth_client.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nth/nth_client.c Wed Feb 11 10:48:40 2009
@@ -46,7 +46,7 @@
#include <assert.h>
#include <errno.h>
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
/** @internal SU message argument structure type */
#define SU_MSG_ARG_T union sm_arg_u
@@ -753,7 +753,7 @@
if (host &&
(host_cmp(host->h_host, u->url_host) ||
- str0cmp(host->h_port, u->url_port)))
+ su_strcmp(host->h_port, u->url_port)))
host = NULL;
if (host == NULL && u->url_host) {
@@ -777,7 +777,7 @@
else if (rq && name && strcmp(name, rq->rq_method_name))
rq = NULL;
- if (rq && version && strcasecmp(version, rq->rq_version))
+ if (rq && version && !su_casematch(version, rq->rq_version))
rq = NULL;
if (!hc->hc_route_url) {
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nth/nth_server.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nth/nth_server.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nth/nth_server.c Wed Feb 11 10:48:40 2009
@@ -32,7 +32,7 @@
#include "config.h"
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
#include <sofia-sip/su.h>
typedef struct server_s server_t;
@@ -592,7 +592,7 @@
for (; (site = *list); list = &site->site_next) {
if (host_cmp(host, site->site_url->url_host) == 0 &&
- str0cmp(port, site->site_url->url_port) == 0) {
+ su_strcmp(port, site->site_url->url_port) == 0) {
break;
}
}
1
0
[commit] r11797 - in freeswitch/trunk/libs/sofia-sip: . libsofia-sip-ua/soa
by FreeSWITCH SVN 11 Feb '09
by FreeSWITCH SVN 11 Feb '09
11 Feb '09
Author: mikej
Date: Wed Feb 11 10:48:09 2009
New Revision: 11797
Log:
Thu Jan 8 13:57:46 CST 2009 Pekka Pessi <first.last(a)nokia.com>
* soa: using <sofia-sip/su_string.h> functions
Modified:
freeswitch/trunk/libs/sofia-sip/.update
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/soa/soa.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.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:48:09 2009
@@ -1 +1 @@
-Wed Feb 11 10:47:34 CST 2009
+Wed Feb 11 10:47:59 CST 2009
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/soa/soa.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/soa/soa.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/soa/soa.c Wed Feb 11 10:48:09 2009
@@ -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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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;
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;
}
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c Wed Feb 11 10:48:09 2009
@@ -62,7 +62,7 @@
#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 @@
#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 @@
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 @@
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 @@
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 @@
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;
}
}
1
0
[commit] r11796 - in freeswitch/trunk/libs/sofia-sip: . libsofia-sip-ua/iptsec
by FreeSWITCH SVN 11 Feb '09
by FreeSWITCH SVN 11 Feb '09
11 Feb '09
Author: mikej
Date: Wed Feb 11 10:47:44 2009
New Revision: 11796
Log:
Thu Jan 8 13:50:53 CST 2009 Pekka Pessi <first.last(a)nokia.com>
* iptsec: using <sofia-sip/su_string.h> functions
Modified:
freeswitch/trunk/libs/sofia-sip/.update
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_client.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_client_ntlm.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_common.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_module.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_ntlm.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_plugin.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_plugin_ntlm.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/test_auth_digest.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:47:44 2009
@@ -1 +1 @@
-Wed Feb 11 10:47:06 CST 2009
+Wed Feb 11 10:47:34 CST 2009
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_client.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_client.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_client.c Wed Feb 11 10:47:44 2009
@@ -47,7 +47,7 @@
#include <sofia-sip/base64.h>
#include <sofia-sip/su_uniqueid.h>
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
#include <sofia-sip/su_debug.h>
@@ -166,9 +166,9 @@
if (!ca || !ch)
return -1;
- if (strcasecmp(ca->ca_scheme, scheme))
+ if (!su_casematch(ca->ca_scheme, scheme))
return 0;
- if (strcmp(ca->ca_realm, realm))
+ if (!su_strmatch(ca->ca_realm, realm))
return 0;
if (ca->ca_credential_class &&
@@ -390,13 +390,13 @@
if (!ca || !ca->ca_scheme || !ca->ca_realm)
return -1;
- if ((scheme != NULL && strcasecmp(scheme, ca->ca_scheme)) ||
- (realm != NULL && strcmp(realm, ca->ca_realm)))
+ if ((scheme != NULL && !su_casematch(scheme, ca->ca_scheme)) ||
+ (realm != NULL && !su_strmatch(realm, ca->ca_realm)))
return 0;
old_user = ca->ca_user, old_pass = ca->ca_pass;
- if (str0cmp(user, old_user) == 0 && str0cmp(pass, old_pass) == 0)
+ if (su_strmatch(user, old_user) && su_strmatch(pass, old_pass))
return 0;
new_user = su_strdup(ca->ca_home, user);
@@ -440,14 +440,14 @@
continue;
if (AUTH_CLIENT_IS_EXTENDED(ca) && ca->ca_clear)
continue;
- if (!ca->ca_scheme[0] || strcasecmp(ca->ca_scheme, d->ca_scheme))
+ if (!ca->ca_scheme[0] || !su_casematch(ca->ca_scheme, d->ca_scheme))
continue;
- if (!ca->ca_realm[0] || strcmp(ca->ca_realm, d->ca_realm))
+ if (!ca->ca_realm || !su_strmatch(ca->ca_realm, d->ca_realm))
continue;
if (!(AUTH_CLIENT_IS_EXTENDED(d) && d->ca_clear) &&
- d->ca_user && strcmp(d->ca_user, ca->ca_user) == 0 &&
- d->ca_pass && strcmp(d->ca_pass, ca->ca_pass) == 0) {
+ su_strmatch(d->ca_user, ca->ca_user) &&
+ su_strmatch(d->ca_pass, ca->ca_pass)) {
retval++;
break;
}
@@ -497,8 +497,8 @@
if (!AUTH_CLIENT_IS_EXTENDED(ca))
continue;
- if ((scheme != NULL && strcasecmp(scheme, ca->ca_scheme)) ||
- (realm != NULL && strcmp(realm, ca->ca_realm)))
+ if ((scheme != NULL && !su_casematch(scheme, ca->ca_scheme)) ||
+ (realm != NULL && !su_strmatch(realm, ca->ca_realm)))
continue;
match = ca->ca_auc->auc_clear(*auc_list);
@@ -990,7 +990,7 @@
for (i = 0; i < MAX_AUC; i++) {
if (ca_plugins[i] == NULL ||
- strcmp(plugin->auc_name, ca_plugins[i]->auc_name) == 0) {
+ su_strmatch(plugin->auc_name, ca_plugins[i]->auc_name) == 0) {
ca_plugins[i] = plugin;
return 0;
}
@@ -1018,7 +1018,7 @@
for (i = 0; i < MAX_AUC; i++) {
auc = ca_plugins[i];
- if (!auc || strcasecmp(auc->auc_name, scheme) == 0)
+ if (!auc || su_casematch(auc->auc_name, scheme))
break;
}
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_client_ntlm.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_client_ntlm.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_client_ntlm.c Wed Feb 11 10:47:44 2009
@@ -44,7 +44,7 @@
#include <sofia-sip/base64.h>
#include <sofia-sip/su_uniqueid.h>
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
#include <sofia-sip/su_debug.h>
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_common.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_common.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_common.c Wed Feb 11 10:47:44 2009
@@ -36,16 +36,13 @@
#include "sofia-sip/auth_common.h"
#include "sofia-sip/msg_header.h"
+#include <sofia-sip/su_string.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <assert.h>
-#if !HAVE_STRCASESTR
-char *strcasestr(char const *haystack, char const *needle);
-#endif
-
su_inline int has_token(char const *qstring, char const *token);
/**
@@ -92,12 +89,12 @@
if expected is found in parameter value,
return non-NULL pointer in *return_value */
for (j = 0; (p = params[j++]);) {
- if (strcasecmp(p, fmt) == 0) {
+ if (su_casematch(p, fmt)) {
/* Matched the whole parameter with fmt name=expected */
value = p;
break;
}
- else if (strncasecmp(p, fmt, namelen) ||
+ else if (!su_casenmatch(p, fmt, namelen) ||
p[namelen] != '=')
continue;
@@ -109,7 +106,7 @@
value = p;
break;
}
- else if (strcasecmp(p, expected) == 0) {
+ else if (su_casematch(p, expected)) {
/* Parameter value matches with extected value
* e.g., qop=auth matches qop=auth */
value = p;
@@ -120,7 +117,7 @@
else {
/* format is name= , return unquoted parameter value after = */
for (j = 0; (p = params[j++]);) {
- if (strncasecmp(p, fmt, len))
+ if (!su_casenmatch(p, fmt, len))
continue;
if (p[len] == '"')
@@ -169,7 +166,8 @@
size_t n = strlen(token);
char const *q;
- q = strcasestr(qstring, token);
+ q = su_strcasestr(qstring, token);
+
return (q &&
(q[n] == 0 || strchr("\", \t", q[n])) &&
(q == qstring || strchr("\", \t", q[-1])));
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_module.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_module.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_module.c Wed Feb 11 10:47:44 2009
@@ -61,6 +61,7 @@
#include <sofia-sip/su_wait.h>
#include <sofia-sip/su_alloc.h>
+#include <sofia-sip/su_string.h>
#include <sofia-sip/su_tagarg.h>
#include <sofia-sip/base64.h>
@@ -181,7 +182,7 @@
am->am_fake = fake;
am->am_remote = url_hdup(am->am_home, (url_t *)remote);
am->am_algorithm = algorithm ? su_strdup(am->am_home, algorithm) : "MD5";
- am->am_nextnonce = !algorithm || strcasecmp(algorithm, "MD5") == 0;
+ am->am_nextnonce = !algorithm || su_casematch(algorithm, "MD5");
if (next_expires == 0)
am->am_nextnonce = 0;
am->am_qop = su_strdup(am->am_home, qop);
@@ -694,11 +695,11 @@
/* Check for qop */
(ar->ar_qop &&
((ar->ar_auth &&
- strcasecmp(ar->ar_qop, "auth") &&
- strcasecmp(ar->ar_qop, "\"auth\"")) ||
+ !su_casematch(ar->ar_qop, "auth") &&
+ !su_casematch(ar->ar_qop, "\"auth\"")) ||
(ar->ar_auth_int &&
- strcasecmp(ar->ar_qop, "auth-int") &&
- strcasecmp(ar->ar_qop, "\"auth-int\"")))
+ !su_casematch(ar->ar_qop, "auth-int") &&
+ !su_casematch(ar->ar_qop, "\"auth-int\"")))
&& (phrase = PA "has invalid qop"))) {
assert(phrase);
SU_DEBUG_5(("auth_method_digest: 400 %s\n", phrase));
@@ -1249,7 +1250,7 @@
char const *arealm;
for (;auth; auth = auth->au_next) {
- if (strcasecmp(auth->au_scheme, scheme))
+ if (!su_casematch(auth->au_scheme, scheme))
continue;
if (!realm)
@@ -1290,7 +1291,7 @@
char const *arealm, *aopaque;
for (;auth; auth = auth->au_next) {
- if (strcasecmp(auth->au_scheme, "Digest"))
+ if (!su_casematch(auth->au_scheme, "Digest"))
continue;
if (realm) {
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_ntlm.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_ntlm.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_ntlm.c Wed Feb 11 10:47:44 2009
@@ -91,7 +91,7 @@
if (n < 0)
return n;
- if (ac->ac_stale && strcasecmp(ac->ac_stale, "true") != 0)
+ if (ac->ac_stale && !su_casematch(ac->ac_stale, "true"))
ac->ac_stale = NULL;
ac->ac_md5 = md5 != NULL || ac->ac_algorithm == NULL;
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_plugin.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_plugin.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_plugin.c Wed Feb 11 10:47:44 2009
@@ -52,6 +52,7 @@
#include <sofia-sip/su_wait.h>
#include <sofia-sip/su_alloc.h>
+#include <sofia-sip/su_string.h>
#include <sofia-sip/su_tagarg.h>
#include "sofia-sip/auth_module.h"
@@ -130,16 +131,16 @@
if (base == NULL)
;
- else if (strcasecmp(base, "Basic") == 0)
+ else if (su_casematch(base, "Basic"))
bscheme = auth_scheme_basic;
- else if (strcasecmp(base, "Digest") == 0)
+ else if (su_casematch(base, "Digest"))
bscheme = auth_scheme_digest;
if (base == NULL || bscheme) {
int i;
for (i = 0; schemes[i] && i < N; i++) {
- if (strncasecmp(schemes[i]->asch_method, method, len) == 0 &&
+ if (su_casenmatch(schemes[i]->asch_method, method, len) &&
schemes[i]->asch_method[len] == 0) {
am = auth_mod_alloc(schemes[i], ta_tags(ta));
if (schemes[i]->asch_init(am, bscheme, root, ta_tags(ta)) == -1) {
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_plugin_ntlm.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_plugin_ntlm.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_plugin_ntlm.c Wed Feb 11 10:47:44 2009
@@ -170,7 +170,7 @@
char const *agssapidata, *atargetname;
for (;auth; auth = auth_mod_credentials(auth->au_next)) {
- if (strcasecmp(auth->au_scheme, "NTLM"))
+ if (!su_casematch(auth->au_scheme, "NTLM"))
continue;
if (gssapidata) {
@@ -224,11 +224,11 @@
/* Check for qop */
(ar->ar_qop &&
((ar->ar_auth &&
- strcasecmp(ar->ar_qop, "auth") &&
- strcasecmp(ar->ar_qop, "\"auth\"")) ||
+ !su_casematch(ar->ar_qop, "auth") &&
+ !su_casematch(ar->ar_qop, "\"auth\"")) ||
(ar->ar_auth_int &&
- strcasecmp(ar->ar_qop, "auth-int") &&
- strcasecmp(ar->ar_qop, "\"auth-int\"")))
+ !su_casematch(ar->ar_qop, "auth-int") &&
+ !su_casematch(ar->ar_qop, "\"auth-int\"")))
&& (phrase = PA "has invalid qop"))) {
assert(phrase);
SU_DEBUG_5(("auth_method_ntlm: 400 %s\n", phrase));
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/test_auth_digest.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/test_auth_digest.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/test_auth_digest.c Wed Feb 11 10:47:44 2009
@@ -73,6 +73,7 @@
#include <sofia-sip/auth_client.h>
#include <sofia-sip/msg_header.h>
#include <sofia-sip/su_wait.h>
+#include <sofia-sip/su_string.h>
int tstflags;
char *argv0;
@@ -349,8 +350,11 @@
TEST_SIZE(auth_digest_challenge_get(home, ac, pa->au_params), 6);
TEST0(pz = sip_proxy_authorization_make(home, cred));
- TEST_SIZE(auth_digest_response_get(home, ar, pz->au_params), 8);
+ {
+ size_t n = auth_digest_response_get(home, ar, pz->au_params);
+ TEST_SIZE(n, 8);
+ }
ar->ar_md5 = ac->ac_md5 || ac->ac_algorithm == NULL;
TEST(auth_digest_sessionkey(ar, sessionkey, "test1"), 0);
@@ -702,7 +706,7 @@
if (au->au_params)
for (i = 0; au->au_params[i]; i++) {
- if (strncasecmp(au->au_params[i], "realm=", 6) == 0)
+ if (su_casenmatch(au->au_params[i], "realm=", 6))
continue;
equal = strchr(au->au_params[i], '=');
if (equal)
1
0
[commit] r11795 - in freeswitch/trunk/libs/sofia-sip: . libsofia-sip-ua/sdp
by FreeSWITCH SVN 11 Feb '09
by FreeSWITCH SVN 11 Feb '09
11 Feb '09
Author: mikej
Date: Wed Feb 11 10:47:14 2009
New Revision: 11795
Log:
Thu Jan 8 13:00:38 CST 2009 Pekka Pessi <first.last(a)nokia.com>
* sdp: using <sofia-sip/su_string.h> functions
Modified:
freeswitch/trunk/libs/sofia-sip/.update
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sdp/sdp.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sdp/sdp_parse.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sdp/sdp_print.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sdp/torture_sdp.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:47:14 2009
@@ -1 +1 @@
-Wed Feb 11 10:46:42 CST 2009
+Wed Feb 11 10:47:06 CST 2009
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sdp/sdp.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sdp/sdp.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sdp/sdp.c Wed Feb 11 10:47:14 2009
@@ -41,6 +41,7 @@
#include <sofia-sip/su_alloc.h>
#include <sofia-sip/su_types.h>
+#include <sofia-sip/su_string.h>
#include "sofia-sip/sdp.h"
@@ -1156,24 +1157,6 @@
/* ---------------------------------------------------------------------- */
-/* Compare two string pointers */
-su_inline
-int str0cmp(char const *a, char const *b)
-{
- if (a == NULL) a = "";
- if (b == NULL) b = "";
- return strcmp(a, b);
-}
-
-/* Compare two string pointers ignoring case. */
-su_inline
-int str0casecmp(char const *a, char const *b)
-{
- if (a == NULL) a = "";
- if (b == NULL) b = "";
- return strcasecmp(a, b);
-}
-
/** Compare two session descriptions
*/
int sdp_session_cmp(sdp_session_t const *a, sdp_session_t const *b)
@@ -1191,11 +1174,11 @@
return rv;
if ((rv = sdp_origin_cmp(a->sdp_origin, b->sdp_origin)))
return rv;
- if ((rv = str0cmp(a->sdp_subject, b->sdp_subject)))
+ if ((rv = su_strcmp(a->sdp_subject, b->sdp_subject)))
return rv;
- if ((rv = str0cmp(a->sdp_information, b->sdp_information)))
+ if ((rv = su_strcmp(a->sdp_information, b->sdp_information)))
return rv;
- if ((rv = str0cmp(a->sdp_uri, b->sdp_uri)))
+ if ((rv = su_strcmp(a->sdp_uri, b->sdp_uri)))
return rv;
if ((rv = sdp_list_cmp(a->sdp_emails, b->sdp_emails)))
return rv;
@@ -1244,9 +1227,9 @@
return a->o_version < b->o_version ? -1 : 1;
if (a->o_id != b->o_id)
return a->o_id < b->o_id ? -1 : 1;
- if ((rv = strcasecmp(a->o_username, b->o_username)))
+ if ((rv = su_strcasecmp(a->o_username, b->o_username)))
return rv;
- if ((rv = strcasecmp(a->o_address->c_address, b->o_address->c_address)))
+ if ((rv = su_strcasecmp(a->o_address->c_address, b->o_address->c_address)))
return rv;
return 0;
@@ -1380,9 +1363,9 @@
if (a->k_method != b->k_method)
return a->k_method < b->k_method ? -1 : 1;
if (a->k_method == sdp_key_x &&
- (rv = str0cmp(a->k_method_name, b->k_method_name)))
+ (rv = su_strcmp(a->k_method_name, b->k_method_name)))
return rv;
- return str0cmp(a->k_material, b->k_material);
+ return su_strcmp(a->k_material, b->k_material);
}
/** Compare two attribute (a=) fields */
@@ -1395,9 +1378,9 @@
if ((a != NULL) != (b != NULL))
return (a != NULL) < (b != NULL) ? -1 : 1;
- if ((rv = str0cmp(a->a_name, b->a_name)))
+ if ((rv = su_strcmp(a->a_name, b->a_name)))
return rv;
- return str0cmp(a->a_value, b->a_value);
+ return su_strcmp(a->a_value, b->a_value);
}
/** Compare two rtpmap structures. */
@@ -1414,7 +1397,7 @@
return a->rm_pt < b->rm_pt ? -1 : 1;
/* Case insensitive encoding */
- if ((rv = str0cmp(a->rm_encoding, b->rm_encoding)))
+ if ((rv = su_strcmp(a->rm_encoding, b->rm_encoding)))
return rv;
/* Rate */
if (a->rm_rate != b->rm_rate)
@@ -1428,13 +1411,13 @@
if (b->rm_params)
b_param = b->rm_params;
- rv = strcasecmp(a_param, b_param);
+ rv = su_strcasecmp(a_param, b_param);
if (rv)
return rv;
}
- return str0casecmp(a->rm_fmtp, b->rm_fmtp);
+ return su_strcasecmp(a->rm_fmtp, b->rm_fmtp);
}
/** Compare two lists. */
@@ -1447,7 +1430,7 @@
return 0;
if ((a != NULL) != (b != NULL))
return (a != NULL) < (b != NULL) ? -1 : 1;
- if ((rv = str0cmp(a->l_text, b->l_text)))
+ if ((rv = su_strcmp(a->l_text, b->l_text)))
return rv;
}
@@ -1472,7 +1455,7 @@
if (a->m_type != b->m_type)
return a->m_type < b->m_type ? -1 : 1;
if (a->m_type == sdp_media_x)
- if ((rv = str0cmp(a->m_type_name, b->m_type_name)))
+ if ((rv = su_strcmp(a->m_type_name, b->m_type_name)))
return rv;
if (a->m_port != b->m_port)
return a->m_port < b->m_port ? -1 : 1;
@@ -1487,7 +1470,7 @@
if (a->m_proto != b->m_proto)
return a->m_proto < b->m_proto ? -1 : 1;
if (a->m_proto == sdp_media_x)
- if ((rv = str0cmp(a->m_proto_name, b->m_proto_name)))
+ if ((rv = su_strcmp(a->m_proto_name, b->m_proto_name)))
return rv;
if (a->m_mode != b->m_mode)
@@ -1502,7 +1485,7 @@
if ((rv = sdp_list_cmp(a->m_format, b->m_format)))
return rv;
- if ((rv = str0cmp(a->m_information, b->m_information)))
+ if ((rv = su_strcmp(a->m_information, b->m_information)))
return rv;
for (ac = a->m_connections, bc = b->m_connections;
@@ -1548,7 +1531,7 @@
sdp_attribute_t *sdp_attribute_find(sdp_attribute_t const *a, char const *name)
{
for (; a; a = a->a_next) {
- if (strcasecmp(a->a_name, name) == 0)
+ if (su_casematch(a->a_name, name))
break;
}
@@ -1561,13 +1544,13 @@
char const *name)
{
for (; a; a = a->a_next) {
- if (strcasecmp(a->a_name, name) == 0)
+ if (su_casematch(a->a_name, name))
break;
}
if (a == 0)
for (a = a2; a; a = a->a_next) {
- if (strcasecmp(a->a_name, name) == 0)
+ if (su_casematch(a->a_name, name))
break;
}
@@ -1578,13 +1561,13 @@
sdp_mode_t sdp_attribute_mode(sdp_attribute_t const *a, sdp_mode_t defmode)
{
for (; a; a = a->a_next) {
- if (strcasecmp(a->a_name, "sendrecv") == 0)
+ if (su_casematch(a->a_name, "sendrecv"))
return sdp_sendrecv;
- if (strcasecmp(a->a_name, "inactive") == 0)
+ if (su_casematch(a->a_name, "inactive"))
return sdp_inactive;
- if (strcasecmp(a->a_name, "recvonly") == 0)
+ if (su_casematch(a->a_name, "recvonly"))
return sdp_recvonly;
- if (strcasecmp(a->a_name, "sendonly") == 0)
+ if (su_casematch(a->a_name, "sendonly"))
return sdp_sendonly;
}
@@ -1707,7 +1690,7 @@
assert(a->a_name != NULL); assert(a->a_next == NULL);
for (; *list; list = &(*list)->a_next) {
- if (strcasecmp((*list)->a_name, a->a_name) == 0)
+ if (su_casematch((*list)->a_name, a->a_name))
break;
}
@@ -1740,7 +1723,7 @@
return NULL;
for (a = *list; a; list = &a->a_next, a = *list) {
- if (strcasecmp(name, a->a_name) == 0)
+ if (su_casematch(name, a->a_name))
break;
}
@@ -1769,7 +1752,7 @@
type_name = "";
if (type != m->m_type ||
- (type == sdp_media_x && strcasecmp(m->m_type_name, type_name)))
+ (type == sdp_media_x && !su_casematch(m->m_type_name, type_name)))
return 0;
if (proto == sdp_proto_any || m->m_proto == sdp_proto_any)
@@ -1779,7 +1762,7 @@
proto_name = "";
if (proto != m->m_proto ||
- (proto == sdp_proto_x && strcasecmp(m->m_proto_name, proto_name)))
+ (proto == sdp_proto_x && !su_casematch(m->m_proto_name, proto_name)))
return 0;
return 1;
@@ -1796,16 +1779,16 @@
return 1;
if (a->m_type != b->m_type ||
- (a->m_type == sdp_media_x &&
- strcasecmp(b->m_type_name, a->m_type_name)))
+ (a->m_type == sdp_media_x
+ && !su_casematch(b->m_type_name, a->m_type_name)))
return 0;
if (a->m_proto == sdp_proto_any || b->m_proto == sdp_proto_any)
return 1;
if (a->m_proto != b->m_proto ||
- (a->m_proto == sdp_proto_x &&
- strcasecmp(b->m_proto_name, a->m_proto_name)))
+ (a->m_proto == sdp_proto_x
+ && !su_casematch(b->m_proto_name, a->m_proto_name)))
return 0;
return 1;
@@ -1850,7 +1833,7 @@
(m->m_proto == sdp_proto_rtp ||
m->m_proto == sdp_proto_srtp ||
(m->m_proto == sdp_proto_x && m->m_proto_name &&
- strncasecmp(m->m_proto_name, "RTP/", 4) == 0));
+ su_casenmatch(m->m_proto_name, "RTP/", 4)));
}
/** Check if payload type, rtp rate and parameters match in rtpmaps*/
@@ -1867,7 +1850,7 @@
if (a->rm_rate != b->rm_rate)
return 0;
- if (strcasecmp(a->rm_encoding, b->rm_encoding))
+ if (!su_casematch(a->rm_encoding, b->rm_encoding))
return 0;
aparam = a->rm_params; bparam = b->rm_params;
@@ -1877,7 +1860,7 @@
if (!aparam) aparam = "1"; if (!bparam) bparam = "1";
- if (strcasecmp(aparam, bparam))
+ if (!su_casematch(aparam, bparam))
return 0;
return 1;
@@ -1900,7 +1883,7 @@
if (rm->rm_rate != list->rm_rate)
continue;
- if (strcasecmp(rm->rm_encoding, list->rm_encoding) != 0)
+ if (!su_casematch(rm->rm_encoding, list->rm_encoding))
continue;
lparam = rm->rm_params; rparam = list->rm_params;
@@ -1909,7 +1892,7 @@
break;
if (!lparam) lparam = "1"; if (!rparam) rparam = "1";
- if (strcasecmp(lparam, rparam))
+ if (!su_casematch(lparam, rparam))
continue;
break;
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sdp/sdp_parse.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sdp/sdp_parse.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sdp/sdp_parse.c Wed Feb 11 10:47:14 2009
@@ -30,11 +30,14 @@
* @author Kai Vehmanen <kai.vehmanen(a)nokia.com>
*
* @date Created: Fri Feb 18 10:25:08 2000 ppessi
+ *
+ * @sa @RFC4566, @RFC2327.
*/
#include "config.h"
#include <sofia-sip/su_alloc.h>
+#include <sofia-sip/su_string.h>
#include "sofia-sip/sdp.h"
@@ -50,12 +53,13 @@
*
* SDP parser handle.
*
- * The SDP parser handle is returned by sdp_parse(). It contains either
- * successfully parse SDP session #sdp_session_t or an error message.
+ * The SDP parser handle returned by sdp_parse() contains either
+ * a successfully parsed SDP session #sdp_session_t or an error message.
* If sdp_session() returns non-NULL, parsing was successful.
*
* @sa #sdp_session_t, sdp_parse(), sdp_session(), sdp_parsing_error(),
- * sdp_sanity_check(), sdp_parser_home(), sdp_parser_free().
+ * sdp_sanity_check(), sdp_parser_home(), sdp_parser_free(), @RFC4566,
+ * @RFC2327.
*/
struct sdp_parser_s {
@@ -129,6 +133,9 @@
* Always a valid parser handle.
*
* @todo Parser accepts some non-conforming SDP even with #sdp_f_strict.
+ *
+ * @sa sdp_session(), sdp_parsing_error(), sdp_sanity_check(),
+ * sdp_parser_home(), sdp_parser_free(), @RFC4566, @RFC2327.
*/
sdp_parser_t *
sdp_parse(su_home_t *home, char const msg[], issize_t msgsize, int flags)
@@ -366,7 +373,7 @@
/* Require that version comes first */
record = next(&message, CRLF, strip);
- if (!record || strcmp(record, "v=0")) {
+ if (!su_strmatch(record, "v=0")) {
if (!p->pr_config || !record || record[1] != '=') {
parsing_error(p, "bad SDP message");
return;
@@ -479,14 +486,14 @@
return
c &&
c->c_nettype == sdp_net_in &&
- ((c->c_addrtype == sdp_addr_ip4 && strcmp(c->c_address, "0.0.0.0")) ||
- (c->c_addrtype == sdp_addr_ip6 && strcmp(c->c_address, "::")));
+ ((c->c_addrtype == sdp_addr_ip4 && su_strmatch(c->c_address, "0.0.0.0")) ||
+ (c->c_addrtype == sdp_addr_ip6 && su_strmatch(c->c_address, "::")));
}
/**Postprocess session description.
*
- * The function post_session() postprocesses the session description. The
- * postprocessing includes setting the session backpointer for each media.
+ * Postprocessing includes setting the session backpointer for each media,
+ * doing sanity checks and setting rejected and mode flags.
*/
static void post_session(sdp_parser_t *p, sdp_session_t *sdp)
{
@@ -517,12 +524,9 @@
c = sdp_media_connections(m);
- if (p->pr_mode_0000 && c) {
- if (c->c_nettype == sdp_net_in &&
- c->c_addrtype == sdp_addr_ip4 &&
- strcmp(c->c_address, "0.0.0.0") == 0)
- /* Reset recvonly flag */
- m->m_mode &= ~sdp_recvonly;
+ if (p->pr_mode_0000 && sdp_connection_is_inaddr_any(c)) {
+ /* Reset recvonly flag */
+ m->m_mode &= ~sdp_recvonly;
}
}
@@ -815,7 +819,7 @@
*result = c;
- if (strncasecmp(r, "IN", 2) == 0) {
+ if (su_casenmatch(r, "IN", 2)) {
char *s;
/* nettype is internet */
@@ -824,9 +828,9 @@
/* addrtype */
s = token(&r, SPACE TAB, NULL, NULL);
- if (s && strcasecmp(s, "IP4") == 0)
+ if (su_casematch(s, "IP4"))
c->c_addrtype = sdp_addr_ip4;
- else if (s && strcasecmp(s, "IP6") == 0)
+ else if (su_casematch(s, "IP6"))
c->c_addrtype = sdp_addr_ip6;
else {
parsing_error(p, "unknown IN address type: %s", s);
@@ -907,9 +911,9 @@
return;
}
- if (strcmp(name, "CT") == 0)
+ if (su_casematch(name, "CT"))
modifier = sdp_bw_ct, name = NULL;
- else if (strcmp(name, "AS") == 0)
+ else if (su_casematch(name, "AS") == 0)
modifier = sdp_bw_as, name = NULL;
else
modifier = sdp_bw_x;
@@ -993,16 +997,17 @@
int n, N;
char *s;
sdp_repeat_t *r;
+ int strict = STRICT(p);
/** Count number of intervals */
for (N = 0, s = d; *s; ) {
- if (!(is_posdigit(*s) || (!STRICT(p) && (*s) == '0')))
+ if (!(is_posdigit(*s) || (!strict && (*s) == '0')))
break;
do { s++; } while (is_digit(*s));
- if (*s && strchr("dhms", *s))
+ if (*s && strchr(strict ? "dhms" : "dhmsDHMS", *s))
s++;
N++;
- if (!(i = STRICT(p) ? is_space(*s) : strspn(s, SPACE TAB)))
+ if (!(i = strict ? is_space(*s) : strspn(s, SPACE TAB)))
break;
s += i;
}
@@ -1024,10 +1029,10 @@
tt = strtoul(d, &d, 10);
switch (*d) {
- case 'd': tt *= 24;
- case 'h': tt *= 60;
- case 'm': tt *= 60;
- case 's': d++;
+ case 'd': case 'D': tt *= 24;
+ case 'h': case 'H': tt *= 60;
+ case 'm': case 'M': tt *= 60;
+ case 's': case 'S': d++;
break;
}
@@ -1152,7 +1157,7 @@
/* These are defined as key-sensitive in RFC 4566 */
#define MATCH(s, tok) \
- (STRICT(p) ? strcmp((s), (tok)) == 0 : strcasecmp((s), (tok)) == 0)
+ (STRICT(p) ? su_strmatch((s), (tok)) : su_casematch((s), (tok)))
if (MATCH(s, "clear"))
k->k_method = sdp_key_clear, k->k_method_name = "clear";
@@ -1208,20 +1213,20 @@
else
PARSE_CHECK_REST(p, r, "a");
- if (strcasecmp(name, "charset") == 0) {
+ if (su_casematch(name, "charset")) {
p->pr_session->sdp_charset = value;
return;
}
if (p->pr_mode_manual)
;
- else if (strcasecmp(name, "inactive") == 0)
+ else if (su_casematch(name, "inactive"))
p->pr_session_mode = sdp_inactive;
- else if (strcasecmp(name, "sendonly") == 0)
+ else if (su_casematch(name, "sendonly"))
p->pr_session_mode = sdp_sendonly;
- else if (strcasecmp(name, "recvonly") == 0)
+ else if (su_casematch(name, "recvonly"))
p->pr_session_mode = sdp_recvonly;
- else if (strcasecmp(name, "sendrecv") == 0)
+ else if (su_casematch(name, "sendrecv"))
p->pr_session_mode = sdp_sendrecv;
{
@@ -1317,7 +1322,7 @@
return;
}
- if (!STRICT(p) && strcasecmp(s, "RTP") == 0)
+ if (!STRICT(p) && su_casematch(s, "RTP"))
m->m_proto = sdp_proto_rtp, m->m_proto_name = "RTP/AVP";
else
sdp_media_transport(m, s);
@@ -1344,44 +1349,51 @@
/** Set media type */
void sdp_media_type(sdp_media_t *m, char const *s)
{
- if (strcmp(s, "*") == 0)
+ if (su_strmatch(s, "*"))
m->m_type = sdp_media_any, m->m_type_name = "*";
- else if (strcasecmp(s, "audio") == 0)
+ else if (su_casematch(s, "audio"))
m->m_type = sdp_media_audio, m->m_type_name = "audio";
- else if (strcasecmp(s, "video") == 0)
+ else if (su_casematch(s, "video"))
m->m_type = sdp_media_video, m->m_type_name = "video";
- else if (strcasecmp(s, "application") == 0)
+ else if (su_casematch(s, "application"))
m->m_type = sdp_media_application, m->m_type_name = "application";
- else if (strcasecmp(s, "data") == 0)
+ else if (su_casematch(s, "data"))
m->m_type = sdp_media_data, m->m_type_name = "data";
- else if (strcasecmp(s, "control") == 0)
+ else if (su_casematch(s, "control"))
m->m_type = sdp_media_control, m->m_type_name = "control";
- else if (strcasecmp(s, "message") == 0)
+ else if (su_casematch(s, "message"))
m->m_type = sdp_media_message, m->m_type_name = "message";
- else if (strcasecmp(s, "image") == 0)
+ else if (su_casematch(s, "image"))
m->m_type = sdp_media_image, m->m_type_name = "image";
- else if (strcasecmp(s, "red") == 0)
+ else if (su_casematch(s, "red"))
m->m_type = sdp_media_red, m->m_type_name = "red";
else
m->m_type = sdp_media_x, m->m_type_name = s;
}
+/** Set transport protocol.
+ *
+ * Set the @m->m_proto to a well-known protocol type as
+ * well as canonize case of @a m_proto_name.
+ */
void sdp_media_transport(sdp_media_t *m, char const *s)
{
- if (strcasecmp(s, "*") == 0)
+ if (m == NULL || s == NULL)
+ ;
+ else if (su_strmatch(s, "*"))
m->m_proto = sdp_proto_any, m->m_proto_name = "*";
- else if (strcasecmp(s, "RTP/AVP") == 0)
+ else if (su_casematch(s, "RTP/AVP"))
m->m_proto = sdp_proto_rtp, m->m_proto_name = "RTP/AVP";
- else if (strcasecmp(s, "RTP/SAVP") == 0)
+ else if (su_casematch(s, "RTP/SAVP"))
m->m_proto = sdp_proto_srtp, m->m_proto_name = "RTP/SAVP";
- else if (strcasecmp(s, "udptl") == 0)
+ else if (su_casematch(s, "udptl"))
/* Lower case - be compatible with people living by T.38 examples */
m->m_proto = sdp_proto_udptl, m->m_proto_name = "udptl";
- else if (strcasecmp(s, "UDP") == 0)
+ else if (su_casematch(s, "UDP"))
m->m_proto = sdp_proto_udp, m->m_proto_name = "UDP";
- else if (strcasecmp(s, "TCP") == 0)
+ else if (su_casematch(s, "TCP"))
m->m_proto = sdp_proto_tcp, m->m_proto_name = "TCP";
- else if (strcasecmp(s, "TLS") == 0)
+ else if (su_casematch(s, "TLS"))
m->m_proto = sdp_proto_tls, m->m_proto_name = "TLS";
else
m->m_proto = sdp_proto_x, m->m_proto_name = s;
@@ -1566,28 +1578,28 @@
if (p->pr_mode_manual)
;
- else if (strcasecmp(name, "inactive") == 0) {
+ else if (su_casematch(name, "inactive")) {
m->m_mode = sdp_inactive;
return;
}
- else if (strcasecmp(name, "sendonly") == 0) {
+ else if (su_casematch(name, "sendonly")) {
m->m_mode = sdp_sendonly;
return;
}
- else if (strcasecmp(name, "recvonly") == 0) {
+ else if (su_casematch(name, "recvonly")) {
m->m_mode = sdp_recvonly;
return;
}
- else if (strcasecmp(name, "sendrecv") == 0) {
+ else if (su_casematch(name, "sendrecv")) {
m->m_mode = sdp_sendrecv;
return;
}
- if (rtp && strcasecmp(name, "rtpmap") == 0) {
+ if (rtp && su_casematch(name, "rtpmap")) {
if ((n = parse_rtpmap(p, r, m)) == 0 || n < -1)
return;
}
- else if (rtp && strcasecmp(name, "fmtp") == 0) {
+ else if (rtp && su_casematch(name, "fmtp")) {
if ((n = parse_fmtp(p, r, m)) == 0 || n < -1)
return;
}
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sdp/sdp_print.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sdp/sdp_print.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sdp/sdp_print.c Wed Feb 11 10:47:14 2009
@@ -34,6 +34,7 @@
#include "config.h"
#include <sofia-sip/su_alloc.h>
+#include <sofia-sip/su_string.h>
#include "sofia-sip/sdp.h"
@@ -544,10 +545,10 @@
char const *name = a->a_name;
char const *value = a->a_value;
- if (strcasecmp(name, "inactive") == 0 ||
- strcasecmp(name, "sendonly") == 0 ||
- strcasecmp(name, "recvonly") == 0 ||
- strcasecmp(name, "sendrecv") == 0)
+ if (su_casematch(name, "inactive") ||
+ su_casematch(name, "sendonly") ||
+ su_casematch(name, "recvonly") ||
+ su_casematch(name, "sendrecv"))
continue;
sdp_printf(p, "a=%s%s%s" CRLF, name, value ? ":" : "", value ? value : "");
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sdp/torture_sdp.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sdp/torture_sdp.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sdp/torture_sdp.c Wed Feb 11 10:47:14 2009
@@ -42,6 +42,7 @@
#include <stdlib.h>
#include <sofia-sip/su_types.h>
+#include <sofia-sip/su_string.h>
#include <sofia-sip/sdp.h>
@@ -913,9 +914,9 @@
int i;
for (i = 1; argv[i]; i++) {
- if (strcmp(argv[i], "-v") == 0)
+ if (su_strmatch(argv[i], "-v"))
tstflags |= tst_verbatim;
- else if (strcmp(argv[i], "-a") == 0)
+ else if (su_strmatch(argv[i], "-a"))
tstflags |= tst_abort;
else
usage(1);
1
0
[commit] r11794 - in freeswitch/trunk/libs/sofia-sip: . libsofia-sip-ua/nta libsofia-sip-ua/nta/sofia-sip
by FreeSWITCH SVN 11 Feb '09
by FreeSWITCH SVN 11 Feb '09
11 Feb '09
Author: mikej
Date: Wed Feb 11 10:46:50 2009
New Revision: 11794
Log:
Thu Jan 8 12:38:05 CST 2009 Pekka Pessi <first.last(a)nokia.com>
* nta: use <sofia-sip/su_string.h> functions
Modified:
freeswitch/trunk/libs/sofia-sip/.update
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta_check.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/sl_utils_log.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/sl_utils_print.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/sofia-sip/sl_utils.h
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/test_nta.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/test_nta_api.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:46:50 2009
@@ -1 +1 @@
-Wed Feb 11 10:46:12 CST 2009
+Wed Feb 11 10:46:42 CST 2009
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.c Wed Feb 11 10:46:50 2009
@@ -41,11 +41,14 @@
* @author Pekka Pessi <Pekka.Pessi(a)nokia.com>
*
* @date Created: Tue Jun 13 02:57:51 2000 ppessi
+ *
+ * @sa
+ * @RFC3261, @RFC4320
*/
#include "config.h"
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
/** @internal SU message argument structure type */
#define SU_MSG_ARG_T union sm_arg_u
@@ -315,7 +318,7 @@
outgoing_queue_t delayed[1];
outgoing_queue_t resolving[1];
- outgoing_queue_t trying[1]; /* Timer F/E */
+ outgoing_queue_t trying[1]; /* Timer F / Timer E */
outgoing_queue_t completed[1]; /* Timer K */
outgoing_queue_t terminated[1];
@@ -1126,21 +1129,21 @@
sip_via_t const *v;
for (v = agent->sa_public_vias; v; v = v->v_next) {
- if (strcasecmp(via->v_host, v->v_host))
+ if (!su_casematch(via->v_host, v->v_host))
continue;
- if (str0cmp(via->v_port, v->v_port))
+ if (!su_strmatch(via->v_port, v->v_port))
continue;
- if (strcasecmp(via->v_protocol, v->v_protocol))
+ if (!su_casematch(via->v_protocol, v->v_protocol))
continue;
return (sip_via_t *)v;
}
for (v = agent->sa_vias; v; v = v->v_next) {
- if (strcasecmp(via->v_host, v->v_host))
+ if (!su_casematch(via->v_host, v->v_host))
continue;
- if (str0cmp(via->v_port, v->v_port))
+ if (!su_strmatch(via->v_port, v->v_port))
continue;
- if (strcasecmp(via->v_protocol, v->v_protocol))
+ if (!su_casematch(via->v_protocol, v->v_protocol))
continue;
return (sip_via_t *)v;
}
@@ -1570,7 +1573,7 @@
if (algorithm != NONE)
agent->sa_algorithm = su_strdup(home, algorithm);
- if (str0cmp(sigcomp, agent->sa_sigcomp_options)) {
+ if (!su_strmatch(sigcomp, agent->sa_sigcomp_options)) {
msg_param_t const *l = NULL;
char *s = su_strdup(home, sigcomp);
char *s1 = su_strdup(home, s), *s2 = s1;
@@ -2181,7 +2184,7 @@
if (tpn->tpn_comp &&
(nta_compressor_vtable == NULL ||
- strcasecmp(tpn->tpn_comp, nta_compressor_vtable->ncv_name) != 0)) {
+ !su_casematch(tpn->tpn_comp, nta_compressor_vtable->ncv_name))) {
SU_DEBUG_1(("nta(%p): comp=%s not supported for " URL_PRINT_FORMAT "\n",
(void *)self, tpn->tpn_comp, URL_PRINT_ARGS(url)));
}
@@ -2308,11 +2311,11 @@
if (tport_has_ip6(tp)) self->sa_tport_ip6 = 1;
#endif
- if (strcasecmp(tpn->tpn_proto, "udp") == 0)
+ if (su_casematch(tpn->tpn_proto, "udp"))
self->sa_tport_udp = 1;
- else if (strcasecmp(tpn->tpn_proto, "tcp") == 0)
+ else if (su_casematch(tpn->tpn_proto, "tcp"))
self->sa_tport_tcp = 1;
- else if (strcasecmp(tpn->tpn_proto, "sctp") == 0)
+ else if (su_casematch(tpn->tpn_proto, "sctp"))
self->sa_tport_sctp = 1;
if (tport_has_tls(tp)) self->sa_tport_tls = 1;
@@ -2330,7 +2333,7 @@
if (su) {
su_inet_ntop(su->su_family, SU_ADDR(su), host, sizeof host);
- maddr = use_maddr && strcasecmp(canon, host) != 0;
+ maddr = use_maddr && !su_casematch(canon, host);
port = ntohs(su->su_port);
}
else {
@@ -2340,9 +2343,9 @@
port = 0;
}
- if (strncasecmp(tpn->tpn_proto, "tls", 3)
- ? port == SIP_DEFAULT_PORT
- : port == SIPS_DEFAULT_PORT)
+ if (su_casenmatch(tpn->tpn_proto, "tls", 3)
+ ? port == SIPS_DEFAULT_PORT
+ : port == SIP_DEFAULT_PORT)
port = 0;
snprintf(sport, sizeof sport, ":%u", port);
@@ -2471,15 +2474,15 @@
v2 = v1->v_next;
if (v2 &&
- strcasecmp(v1->v_host, v2->v_host) == 0 &&
- str0casecmp(v1->v_port, v2->v_port) == 0) {
+ su_casematch(v1->v_host, v2->v_host) &&
+ su_casematch(v1->v_port, v2->v_port)) {
char const *p1 = v1->v_protocol, *p2 = v2->v_protocol;
- if (strcasecmp(p1, sip_transport_udp))
+ if (!su_casematch(p1, sip_transport_udp))
p1 = v2->v_protocol, p2 = v1->v_protocol;
- if (strcasecmp(p1, sip_transport_udp) == 0 &&
- strcasecmp(p2, sip_transport_tcp) == 0)
+ if (su_casematch(p1, sip_transport_udp) &&
+ su_casematch(p2, sip_transport_tcp))
/* Do not include transport if we have both UDP and TCP */
tp = NULL;
}
@@ -2541,26 +2544,23 @@
if (branch && branch != v->v_branch) {
char const *bvalue = branch + strcspn(branch, "=");
if (*bvalue) bvalue++;
- if (!v->v_branch || strcasecmp(bvalue, v->v_branch))
+ if (!v->v_branch || !su_casematch(bvalue, v->v_branch))
msg_header_replace_param(msg_home(msg), v->v_common, branch);
}
- if (via->v_protocol != v->v_protocol &&
- strcasecmp(via->v_protocol, v->v_protocol))
+ if (!su_casematch(via->v_protocol, v->v_protocol))
clear = 1, v->v_protocol = via->v_protocol;
/* XXX - should we do this? */
if ((!user_via || !v->v_host) &&
- via->v_host != v->v_host &&
- str0cmp(via->v_host, v->v_host))
+ !su_strmatch(via->v_host, v->v_host))
clear = 1, v->v_host = via->v_host;
if ((!user_via || !v->v_port ||
/* Replace port in user Via only if we use udp and no rport */
(v->v_protocol == sip_transport_udp && !v->v_rport &&
!orq->orq_stateless)) &&
- via->v_port != v->v_port &&
- str0cmp(via->v_port, v->v_port))
+ !su_strmatch(via->v_port, v->v_port))
clear = 1, v->v_port = via->v_port;
if (clear)
@@ -2628,7 +2628,7 @@
SU_DEBUG_7(("nta: selecting scheme %s\n", url->url_scheme));
*scheme = url->url_scheme;
- if (strcasecmp(url->url_scheme, "sips") == 0)
+ if (su_casematch(url->url_scheme, "sips"))
tpn->tpn_proto = "tls";
else
tpn->tpn_proto = "*";
@@ -2639,11 +2639,11 @@
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 > 5 && strncasecmp(b, "comp=", 5) == 0)
+ else if (n > 5 && su_casenmatch(b, "comp=", 5))
tpn->tpn_comp = b + 5;
- 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])
@@ -2845,7 +2845,7 @@
return;
}
- if (str0casecmp(sip->sip_request->rq_version, sip_version_2_0) != 0) {
+ if (!su_casematch(sip->sip_request->rq_version, sip_version_2_0)) {
agent->sa_stats->as_bad_request++;
agent->sa_stats->as_bad_message++;
@@ -3008,7 +3008,7 @@
return v ? 0 : -1;
}
- if (str0casecmp(v->v_protocol, tpv->v_protocol)) {
+ if (!su_strmatch(v->v_protocol, tpv->v_protocol)) {
tport_hostport(hostport, TPORT_HOSTPORTSIZE, from, 1);
SU_DEBUG_1(("nta: Via check: invalid transport \"%s\" from %s\n",
v->v_protocol, hostport));
@@ -3026,7 +3026,7 @@
if (!tport_hostport(hostport, TPORT_HOSTPORTSIZE, from, 0))
return -1;
- if (strcasecmp(hostport, v->v_host)) {
+ if (!su_casematch(hostport, v->v_host)) {
size_t rlen;
/* Add the "received" field */
memcpy(received, "received=", receivedlen);
@@ -3127,9 +3127,9 @@
url->url_port = lv->v_port;
return 1;
}
- if (url->url_port &&
- strcmp(url->url_port, url_port_default(url->url_type)) == 0)
- /* Remove default port */
+ if (su_strmatch(url->url_port, url_port_default(url->url_type)) ||
+ su_strmatch(url->url_port, ""))
+ /* Remove default or empty port */
url->url_port = NULL;
return 0;
@@ -3196,7 +3196,7 @@
return;
}
- if (str0casecmp(sip->sip_status->st_version, sip_version_2_0) != 0) {
+ if (!su_casematch(sip->sip_status->st_version, sip_version_2_0)) {
agent->sa_stats->as_bad_response++;
agent->sa_stats->as_bad_message++;
@@ -3807,7 +3807,6 @@
su_home_t *home = msg_home(msg);
sip_t *sip = sip_object(msg);
sip_to_t const *to;
- sip_cseq_t *cseq;
uint32_t seq;
url_t reg_url[1];
url_string_t const *original = request_uri;
@@ -3865,7 +3864,7 @@
if (!rq
|| request_uri != (url_string_t *)rq->rq_url
|| method != rq->rq_method
- || str0cmp(method_name, rq->rq_method_name))
+ || !su_strmatch(method_name, rq->rq_method_name))
rq = NULL;
if (rq == NULL) {
@@ -3905,7 +3904,7 @@
sip->sip_from = sip_from_dup(home, leg->leg_local);
else if (leg->leg_local && leg->leg_local->a_tag &&
(!sip->sip_from->a_tag ||
- strcasecmp(sip->sip_from->a_tag, leg->leg_local->a_tag)))
+ !su_casematch(sip->sip_from->a_tag, leg->leg_local->a_tag)))
sip_from_tag(home, sip->sip_from, leg->leg_local->a_tag);
if (sip->sip_from && !sip->sip_from->a_tag) {
@@ -3952,14 +3951,14 @@
sip->sip_call_id = sip_call_id_create(home, NULL);
}
- if ((!sip->sip_cseq ||
- seq != sip->sip_cseq->cs_seq ||
- method != sip->sip_cseq->cs_method ||
- (method == sip_method_unknown &&
- strcmp(method_name, sip->sip_cseq->cs_method_name) != 0)) &&
- (!(cseq = sip_cseq_create(home, seq, method, method_name)) ||
- msg_header_insert(msg, (msg_pub_t *)sip, (msg_header_t *)cseq) < 0))
- return -1;
+ if (!sip->sip_cseq ||
+ seq != sip->sip_cseq->cs_seq ||
+ method != sip->sip_cseq->cs_method ||
+ !su_strmatch(method_name, sip->sip_cseq->cs_method_name)) {
+ sip_cseq_t *cseq = sip_cseq_create(home, seq, method, method_name);
+ if (msg_header_insert(msg, (msg_pub_t *)sip, (msg_header_t *)cseq) < 0)
+ return -1;
+ }
return 0;
}
@@ -4391,10 +4390,10 @@
/* If there already is a tag,
return NULL if it does not match with new one */
if (leg->leg_local->a_tag) {
- if (!tag && str0casecmp(tag, leg->leg_local->a_tag))
- return NULL;
- else
+ if (su_casematch(tag, leg->leg_local->a_tag))
return leg->leg_local->a_tag;
+ else
+ return NULL;
}
if (tag) {
@@ -4711,9 +4710,9 @@
return 0;
else
return
- host_cmp(a->url_host, b->url_host)
- || str0cmp(a->url_port, b->url_port)
- || str0cmp(a->url_user, b->url_user);
+ host_cmp(a->url_host, b->url_host) ||
+ su_strcmp(a->url_port, b->url_port) ||
+ su_strcmp(a->url_user, b->url_user);
}
/** Get a leg by dialog.
@@ -4836,14 +4835,14 @@
if (!remote_tag != !from_tag && !local_tag != !to_tag)
continue;
- if (local_tag && to_tag && strcasecmp(local_tag, to_tag) && to_tag[0])
+ if (local_tag && to_tag && !su_casematch(local_tag, to_tag) && to_tag[0])
continue;
- if (remote_tag && from_tag && strcasecmp(remote_tag, from_tag) && from_tag[0])
+ if (remote_tag && from_tag && !su_casematch(remote_tag, from_tag) && from_tag[0])
continue;
if (leg_url && request_uri && url_cmp(leg_url, request_uri))
continue;
- if (leg_method && method_name && strcasecmp(method_name, leg_method))
+ if (leg_method && method_name && !su_casematch(method_name, leg_method))
continue;
/* Perfect match if both local and To have tag
@@ -4916,7 +4915,7 @@
return leg;
}
else if (leg->leg_method) {
- if (strcasecmp(method_name, leg->leg_method))
+ if (!su_casematch(method_name, leg->leg_method))
continue;
return leg;
}
@@ -5657,7 +5656,7 @@
if (tag && strchr(tag, '='))
tag = strchr(tag, '=') + 1;
- if (tag && irq->irq_tag && strcasecmp(tag, irq->irq_tag))
+ if (tag && irq->irq_tag && !su_casematch(tag, irq->irq_tag))
return NULL;
if (!irq->irq_tag) {
@@ -5845,7 +5844,7 @@
int is_uas_ack = return_ack && agent->sa_is_a_uas;
- if (v->v_branch && strncasecmp(v->v_branch, "z9hG4bK", 7) == 0)
+ if (v->v_branch && su_casenmatch(v->v_branch, "z9hG4bK", 7))
magic_branch = v->v_branch + 7;
else
magic_branch = NULL;
@@ -5859,13 +5858,13 @@
continue;
if (irq->irq_cseq->cs_seq != cseq->cs_seq)
continue;
- if (str0casecmp(irq->irq_from->a_tag, from->a_tag))
+ if (su_strcasecmp(irq->irq_from->a_tag, from->a_tag))
continue;
if (is_uas_ack &&
irq->irq_method == sip_method_invite &&
200 <= irq->irq_status && irq->irq_status < 300 &&
- str0casecmp(irq->irq_tag, to->a_tag) == 0) {
+ su_casematch(irq->irq_tag, to->a_tag)) {
*return_ack = irq;
return NULL;
}
@@ -5878,11 +5877,10 @@
* transaction, except for ACK, where the method of the request
* that created the transaction is INVITE.
*/
-
if (irq->irq_via->v_branch &&
- strcasecmp(irq->irq_via->v_branch + 7, magic_branch) == 0 &&
- strcasecmp(irq->irq_via->v_host, v->v_host) == 0 &&
- str0cmp(irq->irq_via->v_port, v->v_port) == 0) {
+ su_casematch(irq->irq_via->v_branch + 7, magic_branch) &&
+ su_casematch(irq->irq_via->v_host, v->v_host) &&
+ su_strmatch(irq->irq_via->v_port, v->v_port)) {
if (irq->irq_method == cseq->cs_method &&
strcmp(irq->irq_cseq->cs_method_name,
cseq->cs_method_name) == 0)
@@ -5903,9 +5901,9 @@
/* From tag, Call-ID, and CSeq number has been matched above */
/* Match top Via header field */
- if (str0casecmp(irq->irq_via->v_branch, v->v_branch) != 0 ||
- strcasecmp(irq->irq_via->v_host, v->v_host) != 0 ||
- str0cmp(irq->irq_via->v_port, v->v_port) != 0)
+ if (!su_casematch(irq->irq_via->v_branch, v->v_branch) ||
+ !su_casematch(irq->irq_via->v_host, v->v_host) ||
+ !su_strmatch(irq->irq_via->v_port, v->v_port))
;
/* Match Request-URI */
else if (url_cmp(irq->irq_rq->rq_url, rq->rq_url))
@@ -5913,17 +5911,16 @@
else {
/* Match CSeq */
if (irq->irq_method == cseq->cs_method &&
- strcmp(irq->irq_cseq->cs_method_name,
- cseq->cs_method_name) == 0) {
+ su_strmatch(irq->irq_cseq->cs_method_name, cseq->cs_method_name)) {
/* Match To tag */
- if (!str0casecmp(irq->irq_to->a_tag, to->a_tag))
+ if (!su_strcasecmp(irq->irq_to->a_tag, to->a_tag))
return irq; /* found */
}
else if (
/* Tag set by UAS */
- str0casecmp(irq->irq_tag, to->a_tag) &&
+ su_strcasecmp(irq->irq_tag, to->a_tag) &&
/* Original tag */
- str0casecmp(irq->irq_to->a_tag, to->a_tag))
+ su_strcasecmp(irq->irq_to->a_tag, to->a_tag))
;
else if (return_ack && irq->irq_method == sip_method_invite)
return *return_ack = irq, NULL;
@@ -7684,13 +7681,13 @@
if (comp == NULL)
orq->orq_tpn->tpn_comp = comp;
- if (orq->orq_user_via && str0cmp(orq->orq_tpn->tpn_proto, "*") == 0) {
+ if (orq->orq_user_via && su_strmatch(orq->orq_tpn->tpn_proto, "*")) {
char const *proto = sip_via_transport(sip->sip_via);
if (proto) orq->orq_tpn->tpn_proto = proto;
}
if (branch && branch != NONE) {
- if (strncasecmp(branch, "branch=", 7) == 0)
+ if (su_casenmatch(branch, "branch=", 7))
branch = su_strdup(home, branch);
else
branch = su_sprintf(home, "branch=%s", branch);
@@ -7708,7 +7705,7 @@
if (orq->orq_method == sip_method_ack) {
/* Find the original INVITE which we are ACKing */
if (ack_branch != NULL && ack_branch != NONE) {
- if (strncasecmp(ack_branch, "branch=", 7) == 0)
+ if (su_casenmatch(ack_branch, "branch=", 7))
orq->orq_branch = su_strdup(home, ack_branch);
else
orq->orq_branch = su_sprintf(home, "branch=%s", ack_branch);
@@ -7803,7 +7800,7 @@
nta_agent_t *sa = orq->orq_agent;
tport_t *tp;
tp_name_t *tpn = orq->orq_tpn;
- int sips = strcasecmp(orq->orq_scheme, "sips") == 0;
+ int sips = su_casematch(orq->orq_scheme, "sips");
/* Select transport by scheme */
if (sips && strcmp(tpn->tpn_proto, "*") == 0)
@@ -7968,14 +7965,14 @@
/* No retries */;
/* RFC3261, 18.1.1 */
else if (err == EMSGSIZE && !orq->orq_try_tcp_instead) {
- if (strcasecmp(tpn->tpn_proto, "udp") == 0 ||
- strcasecmp(tpn->tpn_proto, "*") == 0) {
+ if (su_casematch(tpn->tpn_proto, "udp") ||
+ su_casematch(tpn->tpn_proto, "*")) {
outgoing_try_tcp_instead(orq);
continue;
}
}
else if (err == ECONNREFUSED && orq->orq_try_tcp_instead) {
- if (strcasecmp(tpn->tpn_proto, "tcp") == 0 && msg_size(msg) <= 65535) {
+ if (su_casematch(tpn->tpn_proto, "tcp") && msg_size(msg) <= 65535) {
outgoing_try_udp_instead(orq);
continue;
}
@@ -8145,7 +8142,7 @@
}
else if (error == ECONNREFUSED && orq->orq_try_tcp_instead) {
/* RFC3261, 18.1.1 */
- if (strcasecmp(tpn->tpn_proto, "tcp") == 0 && msg_size(msg) <= 65535) {
+ if (su_casematch(tpn->tpn_proto, "tcp") && msg_size(msg) <= 65535) {
outgoing_print_tport_error(orq, 5, "retrying with UDP after ",
tpn, msg, error);
outgoing_try_udp_instead(orq);
@@ -8723,7 +8720,7 @@
{
orq->orq_completed = 1;
- outgoing_reset_timer(orq); /* Timer A/E */
+ outgoing_reset_timer(orq); /* Timer A / Timer E */
if (orq->orq_stateless || orq->orq_reliable)
return outgoing_terminate(orq);
@@ -8890,10 +8887,10 @@
continue;
if (orq->orq_method != method && orq->orq_method != method2)
continue;
- if (str0casecmp(orq->orq_from->a_tag, sip->sip_from->a_tag))
+ if (su_strcasecmp(orq->orq_from->a_tag, sip->sip_from->a_tag))
continue;
if (orq->orq_to->a_tag &&
- str0casecmp(orq->orq_to->a_tag, sip->sip_to->a_tag))
+ su_strcasecmp(orq->orq_to->a_tag, sip->sip_to->a_tag))
continue;
if (orq->orq_method == sip_method_ack) {
@@ -8901,7 +8898,7 @@
continue;
}
- if (v && str0casecmp(orq->orq_branch + strlen("branch="), v->v_branch))
+ if (v && !su_casematch(orq->orq_branch + strlen("branch="), v->v_branch))
continue;
break; /* match */
@@ -9012,7 +9009,7 @@
return outgoing_duplicate(orq, msg, sip);
if (sa->sa_is_a_uas) {
- if (str0cmp(sip->sip_to->a_tag, orq->orq_tag) == 0)
+ if (su_strcasecmp(sip->sip_to->a_tag, orq->orq_tag) == 0)
/* Catch retransmission */
return outgoing_duplicate(orq, msg, sip);
}
@@ -9333,7 +9330,7 @@
if (orq->orq_destroyed) {
if (orq->orq_status < 200)
orq->orq_status = status;
- outgoing_complete(orq); /* Timer D/K */
+ outgoing_complete(orq); /* Timer D / Timer K */
return 0;
}
@@ -9589,13 +9586,13 @@
tport;
tport = tport_next(tport)) {
tp_name_t const *tpn = tport_name(tport);
- if (strcmp(tpname, "*") && strcasecmp(tpn->tpn_proto, tpname))
+ if (strcmp(tpname, "*") && !su_casematch(tpn->tpn_proto, tpname))
continue;
if (ident && (tpn->tpn_ident == NULL || strcmp(ident, tpn->tpn_ident)))
continue;
for (j = 0; j < SIPDNS_TRANSPORTS; j++)
- if (strcasecmp(tpn->tpn_proto, sipdns_tports[j].name) == 0)
+ if (su_casematch(tpn->tpn_proto, sipdns_tports[j].name))
break;
assert(j < SIPDNS_TRANSPORTS);
@@ -10021,8 +10018,8 @@
break;
/* Check if NAPTR matches our target */
- if (strncasecmp(na->na_services, "SIP+", 4) &&
- strncasecmp(na->na_services, "SIPS+", 5))
+ if (!su_casenmatch(na->na_services, "SIP+", 4) &&
+ !su_casenmatch(na->na_services, "SIPS+", 5))
/* Not a SIP/SIPS service */
continue;
@@ -10036,7 +10033,7 @@
* but comparing the values in the transport list
* match with those values that make any sense
*/
- if (strcasecmp(na->na_services, sr->sr_tports[j]->service) != 0)
+ if (!su_casematch(na->na_services, sr->sr_tports[j]->service))
continue;
tpn->tpn_proto = sr->sr_tports[j]->name;
@@ -10721,8 +10718,8 @@
irq->irq_method == sip_method_invite &&
strcmp(irq->irq_call_id->i_id, i->i_id) == 0 &&
(irq->irq_to->a_tag == NULL ||
- str0casecmp(irq->irq_to->a_tag, sip->sip_to->a_tag) == 0) &&
- str0casecmp(irq->irq_from->a_tag, sip->sip_from->a_tag) == 0) {
+ su_casematch(irq->irq_to->a_tag, sip->sip_to->a_tag)) &&
+ su_casematch(irq->irq_from->a_tag, sip->sip_from->a_tag)) {
nta_reliable_t const *rel;
@@ -11146,8 +11143,8 @@
__func__, resp->sip_status->st_status));
return NULL;
}
- if (str0casecmp(resp->sip_to->a_tag, leg->leg_remote->a_tag) ||
- str0casecmp(resp->sip_to->a_tag, oorq->orq_to->a_tag)) {
+ if (su_strcasecmp(resp->sip_to->a_tag, leg->leg_remote->a_tag) ||
+ su_strcasecmp(resp->sip_to->a_tag, oorq->orq_to->a_tag)) {
SU_DEBUG_1(("%s: %u response To tag does not agree with dialog tag\n",
__func__, resp->sip_status->st_status));
return NULL;
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta_check.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta_check.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta_check.c Wed Feb 11 10:46:50 2009
@@ -219,14 +219,14 @@
if (sip->sip_payload == NULL)
return 0;
- if (cd == NULL || strcasecmp(cd->cd_type, "session") == 0) {
+ if (cd == NULL || su_casematch(cd->cd_type, "session")) {
sip_accept_t const *ab = session_accepts;
char const *c_type;
if (c)
c_type = c->c_type;
else if (sip->sip_payload->pl_len > 3 &&
- strncasecmp(sip->sip_payload->pl_data, "v=0", 3) == 0)
+ su_casenmatch(sip->sip_payload->pl_data, "v=0", 3))
/* Missing Content-Type, but it looks like SDP */
c_type = application_sdp;
else
@@ -234,7 +234,7 @@
ab = NULL, c_type = NULL;
for (; ab; ab = ab->ac_next) {
- if (strcasecmp(c_type, ab->ac_type) == 0)
+ if (su_casematch(c_type, ab->ac_type))
break;
}
@@ -311,7 +311,7 @@
method == sip_method_prack ||
method == sip_method_update)) {
for (ab = acceptable; ab; ab = ab->ac_next)
- if (strcasecmp(application_sdp, ab->ac_type) == 0) {
+ if (su_casematch(application_sdp, ab->ac_type)) {
if (return_acceptable) *return_acceptable = ab;
return 0;
}
@@ -322,7 +322,7 @@
continue;
for (ab = acceptable; ab; ab = ab->ac_next)
- if (strcasecmp(ac->ac_type, ab->ac_type) == 0) {
+ if (su_casematch(ac->ac_type, ab->ac_type)) {
if (return_acceptable) *return_acceptable = ab;
return 0;
}
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/sl_utils_log.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/sl_utils_log.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/sl_utils_log.c Wed Feb 11 10:46:50 2009
@@ -237,8 +237,8 @@
log = su_log_default;
while (s < end && *s != '\0') {
- size_t n = strncspn(s, end - s, "\r\n");
- size_t crlf = strnspn(s + n, end - s - n, "\r\n");
+ size_t n = su_strncspn(s, end - s, "\r\n");
+ size_t crlf = su_strnspn(s + n, end - s - n, "\r\n");
if (n < 70) {
memcpy(line, s, n);
line[n] = '\0';
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/sl_utils_print.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/sl_utils_print.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/sl_utils_print.c Wed Feb 11 10:46:50 2009
@@ -214,8 +214,8 @@
size_t n, total = 0, crlf = 1, actual;
while (s < end && *s != '\0') {
- n = strncspn(s, end - s, "\r\n");
- crlf = strnspn(s + n, end - s - n, "\r\n");
+ n = su_strncspn(s, end - s, "\r\n");
+ crlf = su_strnspn(s + n, end - s - n, "\r\n");
if (prefix)
fputs(prefix, stream), total += strlen(prefix);
actual = fwrite(s, 1, n + crlf, stream) ;
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/sofia-sip/sl_utils.h
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/sofia-sip/sl_utils.h (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/sofia-sip/sl_utils.h Wed Feb 11 10:46:50 2009
@@ -38,7 +38,7 @@
#include <stdio.h>
#ifndef STRING0_H
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
#endif
#ifndef SIP_H
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/test_nta.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/test_nta.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/test_nta.c Wed Feb 11 10:46:50 2009
@@ -62,7 +62,7 @@
#include <sofia-sip/hostdomain.h>
#include <sofia-sip/tport.h>
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
#include <stddef.h>
#include <stdlib.h>
@@ -564,7 +564,7 @@
TEST_1(ag->ag_mclass);
#if SU_HAVE_IN6
- if (str0cmp(getenv("ipv6"), "true") == 0) {
+ if (su_strmatch(getenv("ipv6"), "true")) {
contact = "sip:[::]:*;comp=sigcomp";
af = AF_INET6, sulen0 = sizeof (struct sockaddr_in6);
}
@@ -1075,22 +1075,22 @@
TEST_1(v = nta_agent_via(ag->ag_agent));
for (; v; v = v->v_next) {
- if (strcasecmp(v->v_protocol, sip_transport_udp) == 0) {
+ if (su_casematch(v->v_protocol, sip_transport_udp)) {
if (udp)
v_udp_only = v;
udp = 1;
if (udp_comp == NULL)
udp_comp = v->v_comp;
}
- else if (strcasecmp(v->v_protocol, sip_transport_tcp) == 0) {
+ else if (su_casematch(v->v_protocol, sip_transport_tcp)) {
tcp = 1;
if (tcp_comp == NULL)
tcp_comp = v->v_comp;
}
- else if (strcasecmp(v->v_protocol, sip_transport_sctp) == 0) {
+ else if (su_casematch(v->v_protocol, sip_transport_sctp)) {
sctp = 1;
}
- else if (strcasecmp(v->v_protocol, sip_transport_tls) == 0) {
+ else if (su_casematch(v->v_protocol, sip_transport_tls)) {
tls = 1;
}
}
@@ -1454,7 +1454,7 @@
TEST_P(ag->ag_latest_leg, ag->ag_default_leg);
TEST_1(ag->ag_in_via);
- TEST_1(strcasecmp(ag->ag_in_via->v_protocol, "SIP/2.0/UDP") == 0);
+ TEST_1(su_casematch(ag->ag_in_via->v_protocol, "SIP/2.0/UDP"));
su_free(ag->ag_home, ag->ag_in_via), ag->ag_in_via = NULL;
}
@@ -1787,13 +1787,13 @@
TEST_1(v = nta_agent_via(ag->ag_agent));
for (; v; v = v->v_next) {
- if (strcasecmp(v->v_protocol, sip_transport_udp) == 0)
+ if (su_casematch(v->v_protocol, sip_transport_udp))
udp = 1;
- else if (strcasecmp(v->v_protocol, sip_transport_tcp) == 0)
+ else if (su_casematch(v->v_protocol, sip_transport_tcp))
tcp = 1;
- else if (strcasecmp(v->v_protocol, sip_transport_sctp) == 0)
+ else if (su_casematch(v->v_protocol, sip_transport_sctp))
sctp = 1;
- else if (strcasecmp(v->v_protocol, sip_transport_tls) == 0)
+ else if (su_casematch(v->v_protocol, sip_transport_tls))
tls = 1;
}
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/test_nta_api.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/test_nta_api.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/test_nta_api.c Wed Feb 11 10:46:50 2009
@@ -59,6 +59,7 @@
#include <sofia-sip/msg_mclass.h>
#include <sofia-sip/sofia_features.h>
#include <sofia-sip/hostdomain.h>
+#include <sofia-sip/su_string.h>
#include <stddef.h>
#include <stdlib.h>
@@ -67,7 +68,6 @@
#include <stdio.h>
#include <assert.h>
#include <time.h>
-#include "sofia-sip/string0.h"
extern su_log_t nta_log[];
extern su_log_t tport_log[];
@@ -763,14 +763,14 @@
TEST_1(nta_agent_add_tport(agent, (url_string_t *)url, TAG_END()) == 0);
TEST_1(v = nta_agent_via(agent)); TEST_1(!v->v_next);
- TEST(strcasecmp(v->v_protocol, sip_transport_tcp), 0);
+ TEST(!su_casematch(v->v_protocol, sip_transport_tcp), 0);
TEST_1(m = nta_agent_contact(agent));
TEST_S(m->m_url->url_params, "transport=tcp");
TEST_1(nta_agent_add_tport(agent, (url_string_t *)url,
TPTAG_SERVER(0), TAG_END()) == 0);
TEST_1(v = nta_agent_public_via(agent)); TEST_1(!v->v_next);
- TEST(strcasecmp(v->v_protocol, sip_transport_tcp), 0);
+ TEST(!su_casematch(v->v_protocol, sip_transport_tcp), 0);
TEST_1(host_has_domain_invalid(v->v_host));
TEST_1(m = nta_agent_contact(agent));
TEST_S(m->m_url->url_params, "transport=tcp");
@@ -778,14 +778,14 @@
url->url_params = "transport=udp";
TEST_1(nta_agent_add_tport(agent, (url_string_t *)url, TAG_END()) == 0);
TEST_1(v = nta_agent_via(agent)); TEST_1(v = v->v_next);
- TEST(strcasecmp(v->v_protocol, sip_transport_udp), 0);
+ TEST(!su_casematch(v->v_protocol, sip_transport_udp), 0);
TEST_VOID(nta_agent_destroy(agent));
TEST_1(agent = nta_agent_create(ag->ag_root, NONE, NULL, NULL, TAG_END()));
TEST_1(nta_agent_add_tport(agent, (url_string_t *)url, TAG_END()) == 0);
TEST_1(v = nta_agent_via(agent)); TEST_1(!v->v_next);
- TEST(strcasecmp(v->v_protocol, sip_transport_udp), 0);
+ TEST(!su_casematch(v->v_protocol, sip_transport_udp), 0);
TEST_1(m = nta_agent_contact(agent));
TEST_S(m->m_url->url_params, "transport=udp");
TEST_VOID(nta_agent_destroy(agent));
@@ -795,9 +795,9 @@
TEST_1(agent = nta_agent_create(ag->ag_root, NONE, NULL, NULL, TAG_END()));
TEST_1(nta_agent_add_tport(agent, (url_string_t *)url, TAG_END()) == 0);
TEST_1(v = nta_agent_via(agent));
- TEST(strcasecmp(v->v_protocol, sip_transport_tcp), 0);
+ TEST(!su_casematch(v->v_protocol, sip_transport_tcp), 0);
TEST_1(v = v->v_next);
- TEST(strcasecmp(v->v_protocol, sip_transport_udp), 0);
+ TEST(!su_casematch(v->v_protocol, sip_transport_udp), 0);
TEST_1(m = nta_agent_contact(agent));
TEST_1(!m->m_url->url_params);
TEST_VOID(nta_agent_destroy(agent));
@@ -807,9 +807,9 @@
TEST_1(agent = nta_agent_create(ag->ag_root, NONE, NULL, NULL, TAG_END()));
TEST_1(nta_agent_add_tport(agent, (url_string_t *)url, TAG_END()) == 0);
TEST_1(v = nta_agent_via(agent));
- TEST(strcasecmp(v->v_protocol, sip_transport_udp), 0);
+ TEST(!su_casematch(v->v_protocol, sip_transport_udp), 0);
TEST_1(v = v->v_next);
- TEST(strcasecmp(v->v_protocol, sip_transport_tcp), 0);
+ TEST(!su_casematch(v->v_protocol, sip_transport_tcp), 0);
TEST_1(m = nta_agent_contact(agent));
TEST_1(!m->m_url->url_params);
TEST_VOID(nta_agent_destroy(agent));
@@ -866,7 +866,7 @@
/* Test that NULL host and/or port fields of user supplied Via header are
- filled in automaticaly */
+ filled in automatically */
int api_test_user_via_fillin(agent_t *ag)
{
su_home_t home[1];
@@ -879,7 +879,7 @@
sip_via_t *via0, *via1;
sip_via_t via[1];
static char *via_params[] = { "param1=value1", "param2=value2" };
- int i;
+ size_t i;
BEGIN();
@@ -912,30 +912,30 @@
/* create user Via template to be filled in by NTA */
sip_via_init(via);
via->v_protocol = "*";
- for (i = 0; i < sizeof(via_params)/sizeof(via_params[0]); i++)
- sip_via_add_param(home,via,via_params[i]); /* add param to the template */
+ for (i = 0; i < sizeof(via_params) / sizeof(via_params[0]); i++)
+ sip_via_add_param(home, via, via_params[i]); /* add param to the template */
/* This creates a delayed response message */
orq1 = nta_outgoing_tcreate(leg, outgoing_callback, ag, NULL,
- SIP_METHOD_MESSAGE,
- URL_STRING_MAKE("sip:foo.bar;transport=none"),
- SIPTAG_FROM_STR("<sip:bar.foo>"),
- SIPTAG_TO_STR("<sip:foo.bar>"),
- NTATAG_USER_VIA(1),
- SIPTAG_VIA(via),
- TAG_END());
+ SIP_METHOD_MESSAGE,
+ URL_STRING_MAKE("sip:foo.bar;transport=none"),
+ SIPTAG_FROM_STR("<sip:bar.foo>"),
+ SIPTAG_TO_STR("<sip:foo.bar>"),
+ NTATAG_USER_VIA(1),
+ SIPTAG_VIA(via),
+ TAG_END());
TEST_1(orq1);
TEST_1(msg1 = nta_outgoing_getrequest(orq1));
TEST_1(sip1 = sip_object(msg1));
TEST_1(via1 = sip1->sip_via);
/* check that template has been filled correctly */
- TEST_S(via0->v_protocol,via1->v_protocol);
- TEST_S(via0->v_host,via1->v_host);
- TEST_S(via0->v_port,via1->v_port);
+ TEST_S(via0->v_protocol, via1->v_protocol);
+ TEST_S(via0->v_host, via1->v_host);
+ TEST_S(via0->v_port, via1->v_port);
/* check that the parameter has been preserved */
for (i = 0; i < sizeof(via_params)/sizeof(via_params[0]); i++)
- TEST_S(via1->v_params[i],via_params[i]);
+ TEST_S(via1->v_params[i], via_params[i]);
TEST_VOID(nta_outgoing_destroy(orq0));
TEST_VOID(nta_outgoing_destroy(orq1));
1
0
[commit] r11793 - in freeswitch/trunk/libs/sofia-sip: . libsofia-sip-ua/http
by FreeSWITCH SVN 11 Feb '09
by FreeSWITCH SVN 11 Feb '09
11 Feb '09
Author: mikej
Date: Wed Feb 11 10:46:25 2009
New Revision: 11793
Log:
Thu Jan 8 12:14:14 CST 2009 Pekka Pessi <first.last(a)nokia.com>
* http: use <sofia-sip/su_string.h> functions
Modified:
freeswitch/trunk/libs/sofia-sip/.update
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/http/http_basic.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/http/http_extra.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/http/http_parser.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:46:25 2009
@@ -1 +1 @@
-Wed Feb 11 10:45:40 CST 2009
+Wed Feb 11 10:46:12 CST 2009
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/http/http_basic.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/http/http_basic.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/http/http_basic.c Wed Feb 11 10:46:25 2009
@@ -42,6 +42,7 @@
#define MSG_HDR_T union http_header_u
#include <sofia-sip/su_alloc.h>
+#include <sofia-sip/su_string.h>
#include <sofia-sip/http_parser.h>
#include <sofia-sip/http_header.h>
@@ -52,7 +53,6 @@
#include <stddef.h>
#include <stdlib.h>
-#include <string.h>
#include <assert.h>
#include <stdio.h>
#include <limits.h>
@@ -446,7 +446,7 @@
{
http_content_range_t *cr = h->sh_content_range;
- if (strncasecmp(s, "bytes", 5))
+ if (!su_casenmatch(s, "bytes", 5))
return -1;
s += 5; skip_lws(&s);
if (s[0] == '*') {
@@ -820,7 +820,7 @@
{
http_if_range_t *ifr = (http_if_range_t *)h;
- if (s[0] == '"' || strncasecmp(s, "W/\"", 3) == 0) {
+ if (s[0] == '"' || su_casenmatch(s, "W/\"", 3)) {
ifr->ifr_tag = s;
return 0;
} else {
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/http/http_extra.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/http/http_extra.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/http/http_extra.c Wed Feb 11 10:46:25 2009
@@ -33,12 +33,7 @@
#include "config.h"
-#include <stdio.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <string.h>
-#include <limits.h>
-#include <assert.h>
+#include <sofia-sip/su_string.h>
/* Avoid casting http_t to msg_pub_t and http_header_t to msg_header_t */
#define MSG_PUB_T struct http_s
@@ -46,6 +41,12 @@
#include "sofia-sip/http_parser.h"
+#include <stdio.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <limits.h>
+#include <assert.h>
+
/* ========================================================================== */
/**@HTTP_HEADER http_proxy_connection Proxy-Connection extension header. */
@@ -348,7 +349,7 @@
char *rest;
#define LOOKING_AT(s, what) \
- (strncasecmp((s), what, strlen(what)) == 0 && (rest = s + strlen(what)))
+ (su_casenmatch((s), what, strlen(what)) && (rest = s + strlen(what)))
/* Special cases from Netscape spec */
if (LOOKING_AT(s, "expires=")) {
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/http/http_parser.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/http/http_parser.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/http/http_parser.c Wed Feb 11 10:46:25 2009
@@ -38,6 +38,7 @@
#define MSG_HDR_T union http_header_u
#include <sofia-sip/su_alloc.h>
+#include <sofia-sip/su_string.h>
#include "sofia-sip/http_parser.h"
#include <sofia-sip/msg_parser.h>
#include <sofia-sip/http_header.h>
@@ -48,7 +49,6 @@
#include <stddef.h>
#include <stdlib.h>
-#include <string.h>
#include <stdio.h>
#include <assert.h>
#include <limits.h>
@@ -143,8 +143,7 @@
*/
http->http_transfer_encoding->k_items &&
http->http_transfer_encoding->k_items[0] &&
- strcasecmp(http->http_transfer_encoding->k_items[0],
- "identity") != 0) {
+ !su_casematch(http->http_transfer_encoding->k_items[0], "identity")) {
http->http_flags |= MSG_FLG_CHUNKS;
if (http->http_flags & MSG_FLG_STREAMING)
@@ -162,8 +161,7 @@
body_len = http->http_content_length->l_length;
/* We cannot parse multipart/byteranges ... */
else if (http->http_content_type && http->http_content_type->c_type &&
- strcasecmp(http->http_content_type->c_type, "multipart/byteranges")
- == 0)
+ su_casematch(http->http_content_type->c_type, "multipart/byteranges"))
return -1;
else if (MSG_IS_MAILBOX(flags)) /* message fragments */
body_len = 0;
@@ -312,12 +310,12 @@
char const *result;
int const version_size = sizeof(http_version_1_1) - 1;
- if (strncasecmp(s, http_version_1_1, version_size) == 0 &&
+ if (su_casenmatch(s, http_version_1_1, version_size) &&
!IS_TOKEN(s[version_size])) {
result = http_version_1_1;
s += version_size;
}
- else if (strncasecmp(s, http_version_1_0, version_size) == 0 &&
+ else if (su_casenmatch(s, http_version_1_0, version_size) &&
!IS_TOKEN(s[version_size])) {
result = http_version_1_0;
s += version_size;
@@ -349,9 +347,9 @@
s[l1 + 1 + l2] = 0;
/* Compare again with compacted version */
- if (strcasecmp(s, http_version_1_1) == 0)
+ if (su_casematch(s, http_version_1_1))
result = http_version_1_1;
- else if (strcasecmp(s, http_version_1_0) == 0)
+ else if (su_casematch(s, http_version_1_0))
result = http_version_1_0;
}
@@ -452,7 +450,7 @@
int code = http_method_unknown;
size_t n = 0;
-#define MATCH(s, m) (strncasecmp(s, m, n = sizeof(m) - 1) == 0)
+#define MATCH(s, m) (su_casenmatch(s, m, n = sizeof(m) - 1))
if (c >= 'a' && c <= 'z')
c += 'A' - 'a';
1
0
[commit] r11792 - in freeswitch/trunk/libs/sofia-sip: . libsofia-sip-ua/su
by FreeSWITCH SVN 11 Feb '09
by FreeSWITCH SVN 11 Feb '09
11 Feb '09
Author: mikej
Date: Wed Feb 11 10:45:51 2009
New Revision: 11792
Log:
Thu Jan 8 12:13:38 CST 2009 Pekka Pessi <first.last(a)nokia.com>
* su: using <sofia-sip/su_string.h>
Modified:
freeswitch/trunk/libs/sofia-sip/.update
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_localinfo.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_port.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_taglist.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:45:51 2009
@@ -1 +1 @@
-Wed Feb 11 10:27:42 CST 2009
+Wed Feb 11 10:45:40 CST 2009
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_localinfo.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_localinfo.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_localinfo.c Wed Feb 11 10:45:51 2009
@@ -41,6 +41,7 @@
#include <sofia-sip/su.h>
#include <sofia-sip/su_localinfo.h>
+#include <sofia-sip/su_string.h>
#include "su_module_debug.h"
#include <stdio.h>
@@ -1600,7 +1601,7 @@
return ELI_RESOLVER;
}
- if (hints->li_canonname && strcasecmp(name, hints->li_canonname))
+ if (hints->li_canonname && !su_casematch(name, hints->li_canonname))
return 1;
if (!(flags & LI_CANONNAME))
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_port.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_port.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_port.c Wed Feb 11 10:45:51 2009
@@ -139,7 +139,7 @@
}
#endif
#if HAVE_WIN32
- else if (strcasecmp(name, "wsaevent") == 0) {
+ else if (su_casematch(name, "wsaevent")) {
create = su_wsaevent_port_create;
start = su_wsaevent_clone_start;
}
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_taglist.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_taglist.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_taglist.c Wed Feb 11 10:45:51 2009
@@ -57,6 +57,7 @@
#include <sofia-sip/su_tag_class.h>
#include <sofia-sip/su_tag_inline.h>
#include <sofia-sip/su_tagarg.h>
+#include <sofia-sip/su_string.h>
#ifndef HAVE_STRTOULL
unsigned longlong strtoull(const char *, char **, int);
@@ -1399,10 +1400,10 @@
int retval;
int value = 0;
- if (strncasecmp(s, "true", 4) == 0
+ if (su_casenmatch(s, "true", 4)
&& strlen(s + 4) == strspn(s + 4, " \t\r\n")) {
value = 1, retval = 1;
- } else if (strncasecmp(s, "false", 5) == 0
+ } else if (su_casenmatch(s, "false", 5)
&& strlen(s + 5) == strspn(s + 5, " \t\r\n")) {
value = 0, retval = 1;
} else {
1
0