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
- 14172 discussions
[commit] r11804 - in freeswitch/trunk/libs/sofia-sip: . libsofia-sip-ua/nea
by FreeSWITCH SVN 11 Feb '09
by FreeSWITCH SVN 11 Feb '09
11 Feb '09
Author: mikej
Date: Wed Feb 11 10:51:14 2009
New Revision: 11804
Log:
Thu Jan 8 15:03:28 CST 2009 Pekka Pessi <first.last(a)nokia.com>
* nea: using <sofia-sip/su_string.h> functions
Modified:
freeswitch/trunk/libs/sofia-sip/.update
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nea/nea.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nea/nea_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:51:14 2009
@@ -1 +1 @@
-Wed Feb 11 10:50:46 CST 2009
+Wed Feb 11 10:51:07 CST 2009
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nea/nea.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nea/nea.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nea/nea.c Wed Feb 11 10:51:14 2009
@@ -39,6 +39,7 @@
#include <assert.h>
#include <sofia-sip/su_tagarg.h>
+#include <sofia-sip/su_string.h>
#include <sofia-sip/sip.h>
#include <sofia-sip/sip_header.h>
@@ -518,14 +519,14 @@
nea->nea_notify_received = 1;
nea->nea_callback(nea, nea->nea_context, sip);
- if (strcasecmp(ss->ss_substate, "terminated") == 0) {
+ if (su_casematch(ss->ss_substate, "terminated")) {
nta_leg_destroy(nea->nea_leg), nea->nea_leg = NULL;
nea->nea_state = nea_terminated;
- if (str0casecmp(ss->ss_reason, "deactivated") == 0) {
+ if (su_casematch(ss->ss_reason, "deactivated")) {
nea->nea_state = nea_embryonic;
nea->nea_deadline = sip_now();
- } else if (str0casecmp(ss->ss_reason, "probation") == 0) {
+ } else if (su_casematch(ss->ss_reason, "probation")) {
sip_time_t retry = sip_now() + NEA_TIMER_DELTA;
if (ss->ss_retry_after)
@@ -541,9 +542,9 @@
return 200;
}
}
- else if (strcasecmp(ss->ss_substate, "pending") == 0)
+ else if (su_casematch(ss->ss_substate, "pending"))
nea->nea_state = nea_pending;
- else if (strcasecmp(ss->ss_substate, "active") == 0)
+ else if (su_casematch(ss->ss_substate, "active"))
nea->nea_state = nea_active;
else
nea->nea_state = nea_extended;
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nea/nea_server.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nea/nea_server.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nea/nea_server.c Wed Feb 11 10:51:14 2009
@@ -752,7 +752,7 @@
/* Check if the payload type already exists */
for (i = 0; (evv = ev->ev_views[i]); i++)
- if (str0casecmp(cts, evv->evv_content_type->c_type) == 0)
+ if (su_casematch(cts, evv->evv_content_type->c_type))
break;
if (private && evv == NULL) /* No private view without primary view. */
@@ -916,7 +916,7 @@
/* Check if the payload type already exists */
for (i = 0; ev->ev_views[i]; i++)
- if (str0casecmp(content_type, ev->ev_views[i]->evv_content_type->c_type) == 0)
+ if (su_casematch(content_type, ev->ev_views[i]->evv_content_type->c_type))
break;
for (evv = ev->ev_views[i]; evv; evv = evv->evv_next)
@@ -1805,10 +1805,10 @@
type = evv->evv_content_type->c_type;
- if ((strcasecmp(ac->ac_type, type) == 0) ||
- (strcasecmp(ac->ac_subtype, "*") == 0 &&
- strncasecmp(ac->ac_type, type,
- ac->ac_subtype - ac->ac_type) == 0)) {
+ if ((su_casematch(ac->ac_type, type)) ||
+ (su_casematch(ac->ac_subtype, "*") &&
+ su_casenmatch(ac->ac_type, type,
+ ac->ac_subtype - ac->ac_type))) {
if (evv_maybe == NULL)
evv_maybe = evv;
}
@@ -2290,7 +2290,7 @@
tl_gets(ta_args(ta), NEATAG_REASON_REF(reason), TAG_END());
- rejected = reason && strcasecmp(reason, "rejected") == 0;
+ rejected = su_casematch(reason, "rejected");
if (state == nea_terminated && embryonic && rejected && s->s_irq)
retval = 0, s->s_rejected = 1;
1
0
[commit] r11803 - in freeswitch/trunk/libs/sofia-sip: . libsofia-sip-ua/tport
by FreeSWITCH SVN 11 Feb '09
by FreeSWITCH SVN 11 Feb '09
11 Feb '09
Author: mikej
Date: Wed Feb 11 10:50:52 2009
New Revision: 11803
Log:
Thu Jan 8 15:00:46 CST 2009 Pekka Pessi <first.last(a)nokia.com>
* tport: using <sofia-sip/su_string.h> functions
Modified:
freeswitch/trunk/libs/sofia-sip/.update
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_logging.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_sigcomp.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_stub_sigcomp.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tls.c
Modified: freeswitch/trunk/libs/sofia-sip/.update
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/.update (original)
+++ freeswitch/trunk/libs/sofia-sip/.update Wed Feb 11 10:50:52 2009
@@ -1 +1 @@
-Wed Feb 11 10:50:12 CST 2009
+Wed Feb 11 10:50:46 CST 2009
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport.c Wed Feb 11 10:50:52 2009
@@ -37,7 +37,7 @@
#include "config.h"
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
#include <sofia-sip/su.h>
#include <sofia-sip/su_errno.h>
#include <sofia-sip/su_alloc.h>
@@ -1404,7 +1404,7 @@
continue;
if (vtable->vtp_public != public)
continue;
- if (strcasecmp(vtable->vtp_name, protoname))
+ if (!su_casematch(protoname, vtable->vtp_name))
continue;
assert(vtable->vtp_pri_size >= sizeof (tport_primary_t));
@@ -1798,8 +1798,7 @@
for (i = 0, N = 0; transports[i] && N < TPORT_N; i++) {
su_addrinfo_t *ai = &hints[N];
- if (strcasecmp(transports[i], protocol) != 0 &&
- strcmp(protocol, tpn_any) != 0)
+ if (!su_casematch(protocol, transports[i]) && !su_strmatch(protocol, "*"))
continue;
/* Resolve protocol, skip unknown transport protocols. */
@@ -2418,25 +2417,25 @@
hints->ai_canonname = (char *)proto;
#if HAVE_TLS
- if (strcasecmp(proto, "tls") == 0)
+ if (su_casematch(proto, "tls"))
proto = "tcp";
#endif
#if HAVE_SCTP
- if (strcasecmp(proto, "sctp") == 0) {
+ if (su_casematch(proto, "sctp")) {
hints->ai_protocol = IPPROTO_SCTP;
hints->ai_socktype = SOCK_STREAM;
return 0;
}
#endif
- if (strcasecmp(proto, "udp") == 0) {
+ if (su_casematch(proto, "udp")) {
hints->ai_protocol = IPPROTO_UDP;
hints->ai_socktype = SOCK_DGRAM;
return 0;
}
- if (strcasecmp(proto, "tcp") == 0) {
+ if (su_casematch(proto, "tcp")) {
hints->ai_protocol = IPPROTO_TCP;
hints->ai_socktype = SOCK_STREAM;
return 0;
@@ -4327,7 +4326,7 @@
{
if (proto && strcmp(proto, tpn_any) != 0) {
for (; self; self = tport_next(self))
- if (strcasecmp(proto, self->tp_protoname) == 0)
+ if (su_casematch(proto, self->tp_protoname))
break;
}
@@ -4381,7 +4380,7 @@
continue;
#endif
}
- if (proto && strcasecmp(proto, tp->tp_protoname))
+ if (proto && !su_casematch(proto, tp->tp_protoname))
continue;
if (comp && comp != tp->tp_name->tpn_comp) {
@@ -4515,9 +4514,10 @@
SU_DEBUG_7(("tport(%p): found %p by name " TPN_FORMAT "\n",
(void *)self, (void *)sub, TPN_ARGS(tpn)));
}
- else if ((strcasecmp(canon, sub->tp_canon) &&
- strcasecmp(host, sub->tp_host)) ||
- strcmp(port, sub->tp_port))
+ else if (!su_casematch(port, sub->tp_port))
+ continue;
+ else if (!su_casematch(canon, sub->tp_canon) &&
+ !su_casematch(host, sub->tp_host))
continue;
return (tport_t *)sub;
@@ -4635,9 +4635,9 @@
for (b = (char *)url->url_params; b[0]; b += n) {
n = strcspn(b, ";");
- if (n > 10 && strncasecmp(b, "transport=", 10) == 0)
+ if (n > 10 && su_casenmatch(b, "transport=", 10))
tpn->tpn_proto = b + 10;
- else if (n > 6 && strncasecmp(b, "maddr=", 6) == 0)
+ else if (n > 6 && su_casenmatch(b, "maddr=", 6))
tpn->tpn_host = b + 6;
if (b[n])
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_logging.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_logging.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_logging.c Wed Feb 11 10:50:52 2009
@@ -36,7 +36,7 @@
#include "tport_internal.h"
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
#include <stdlib.h>
#include <time.h>
#include <assert.h>
@@ -245,7 +245,7 @@
break;
}
- n = strncspn(s, end - s, "\r\n");
+ n = su_strncspn(s, end - s, "\r\n");
if (linelen + n > MAX_LINELEN) {
n = MAX_LINELEN - linelen;
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_sigcomp.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_sigcomp.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_sigcomp.c Wed Feb 11 10:50:52 2009
@@ -38,7 +38,7 @@
#include "tport.h"
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
#include <stdlib.h>
#include <time.h>
#include <assert.h>
@@ -146,8 +146,7 @@
{
if (master_sc == NULL ||
master_sc->sc_cc == NULL ||
- compression == NULL ||
- strcasecmp(compression, tport_sigcomp_name))
+ !su_casematch(compression, tport_sigcomp_name))
return NULL;
return tport_sigcomp_name;
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_stub_sigcomp.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_stub_sigcomp.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_stub_sigcomp.c Wed Feb 11 10:50:52 2009
@@ -34,7 +34,7 @@
#include "tport_internal.h"
#include <string.h>
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
tport_comp_vtable_t const *tport_comp_vtable = NULL;
@@ -48,7 +48,7 @@
/** Canonize compression string */
char const *tport_canonize_comp(char const *comp)
{
- if (tport_comp_vtable && comp && strcasecmp(comp, tport_sigcomp_name) == 0)
+ if (tport_comp_vtable && su_casematch(comp, tport_sigcomp_name))
return tport_sigcomp_name;
return NULL;
}
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.c Wed Feb 11 10:50:52 2009
@@ -41,6 +41,7 @@
#include <sofia-sip/su.h>
#include <sofia-sip/su_alloc.h>
#include <sofia-sip/su_wait.h>
+#include <sofia-sip/su_string.h>
#include <openssl/lhash.h>
#include <openssl/bn.h>
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tls.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tls.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tls.c Wed Feb 11 10:50:52 2009
@@ -48,7 +48,7 @@
#include <errno.h>
#include <limits.h>
#include <string.h>
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
#if HAVE_FUNC
#elif HAVE_FUNCTION
1
0
[commit] r11802 - in freeswitch/trunk/libs/sofia-sip: . libsofia-sip-ua/msg
by FreeSWITCH SVN 11 Feb '09
by FreeSWITCH SVN 11 Feb '09
11 Feb '09
Author: mikej
Date: Wed Feb 11 10:50:29 2009
New Revision: 11802
Log:
Thu Jan 8 14:56:49 CST 2009 Pekka Pessi <first.last(a)nokia.com>
* msg: using <sofia-sip/su_string.h> functions
Modified:
freeswitch/trunk/libs/sofia-sip/.update
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/msg_date.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/msg_mclass.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/msg_mime.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/msg_parser_util.c
Modified: freeswitch/trunk/libs/sofia-sip/.update
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/.update (original)
+++ freeswitch/trunk/libs/sofia-sip/.update Wed Feb 11 10:50:29 2009
@@ -1 +1 @@
-Wed Feb 11 10:49:44 CST 2009
+Wed Feb 11 10:50:12 CST 2009
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/msg_date.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/msg_date.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/msg_date.c Wed Feb 11 10:50:29 2009
@@ -42,6 +42,7 @@
#include <string.h>
#include <assert.h>
+#include <sofia-sip/su_string.h>
#include <sofia-sip/msg_date.h>
#include <sofia-sip/bnf.h>
@@ -238,7 +239,7 @@
if (time_d(&s, &hour, &min, &sec) < 0) return -1;
if (*s) {
tz = s; skip_token(&s); skip_lws(&s);
- if (strncasecmp(tz, "GMT", 3) && strncasecmp(tz, "UCT", 3))
+ if (!su_casenmatch(tz, "GMT", 3) && !su_casenmatch(tz, "UCT", 3))
return -1;
}
}
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/msg_mclass.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/msg_mclass.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/msg_mclass.c Wed Feb 11 10:50:29 2009
@@ -47,6 +47,7 @@
#include <sofia-sip/su.h>
#include <sofia-sip/su_alloc.h>
+#include <sofia-sip/su_string.h>
#include "msg_internal.h"
#include "sofia-sip/msg_parser.h"
@@ -351,7 +352,7 @@
/* long form */
for (hr = NULL; (hc = mc->mc_hash[i].hr_class); i = (i + 1) % N) {
- if (m == hc->hc_len && strncasecmp(s, hc->hc_name, m) == 0) {
+ if (m == hc->hc_len && su_casenmatch(s, hc->hc_name, m)) {
hr = &mc->mc_hash[i];
break;
}
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/msg_mime.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/msg_mime.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/msg_mime.c Wed Feb 11 10:50:29 2009
@@ -38,14 +38,8 @@
#define _GNU_SOURCE 1
-#include <stddef.h>
-#include <stdlib.h>
-#include <string.h>
-#include <limits.h>
-#include <errno.h>
-#include <assert.h>
-
#include <sofia-sip/su_alloc.h>
+#include <sofia-sip/su_string.h>
#include "msg_internal.h"
#include "sofia-sip/msg.h"
@@ -54,16 +48,18 @@
#include <sofia-sip/su_uniqueid.h>
#include <sofia-sip/su_errno.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+#include <limits.h>
+#include <errno.h>
+#include <assert.h>
+
#if !HAVE_MEMMEM
void *memmem(const void *haystack, size_t haystacklen,
const void *needle, size_t needlelen);
#endif
-size_t memspn(const void *mem, size_t memlen,
- const void *accept, size_t acceptlen);
-size_t memcspn(const void *mem, size_t memlen,
- const void *reject, size_t rejectlen);
-
/** Protocol version of MIME */
char const msg_mime_version_1_0[] = "MIME/1.0";
@@ -154,7 +150,7 @@
* argument to msg_multipart_parse() function:
* @code
* if (sip->sip_content_type &&
- * strncasecmp(sip->sip_content_type, "multipart/", 10) == 0) {
+ * su_casenmatch(sip->sip_content_type, "multipart/", 10)) {
* msg_multipart_t *mp;
*
* if (sip->sip_multipart)
@@ -316,7 +312,7 @@
/* Boundary looks like LF -- string SP* [CR] LF */
if (memcmp("--", p, 2) == 0) {
/* We can be at boundary beginning, there is no CR LF */
- m = 2 + memspn(p + 2, len - 2, bchars, bchars_len);
+ m = 2 + su_memspn(p + 2, len - 2, bchars, bchars_len);
if (m + 2 >= len)
return NULL;
crlf = p[m] == '\r' ? 1 + (p[m + 1] == '\n') : (p[m] == '\n');
@@ -336,7 +332,7 @@
/* Look for LF -- */
for (;(p = memmem(p, end - p, LF "--", 3)); p += 3) {
len = end - p;
- m = 3 + memspn(p + 3, len - 3, bchars, bchars_len);
+ m = 3 + su_memspn(p + 3, len - 3, bchars, bchars_len);
if (m + 2 >= len)
return NULL;
crlf = p[m] == '\r' ? 1 + (p[m + 1] == '\n') : (p[m] == '\n');
@@ -1146,7 +1142,7 @@
if (name == NULL) {
ac->ac_q = NULL;
}
- else if (namelen == 1 && strncasecmp(name, "q", 1) == 0) {
+ else if (namelen == 1 && su_casenmatch(name, "q", 1)) {
/* XXX - check for invalid value? */
ac->ac_q = value;
}
@@ -1233,7 +1229,7 @@
if (name == NULL) {
aa->aa_q = NULL;
}
- else if (namelen == 1 && strncasecmp(name, "q", 1) == 0) {
+ else if (namelen == 1 && su_casenmatch(name, "q", 1)) {
aa->aa_q = value;
}
@@ -1523,10 +1519,10 @@
cd->cd_handling = NULL, cd->cd_required = 0, cd->cd_optional = 0;
}
else if (namelen == strlen("handling") &&
- strncasecmp(name, "handling", namelen) == 0) {
+ su_casenmatch(name, "handling", namelen)) {
cd->cd_handling = value;
- cd->cd_required = strcasecmp(value, "required") == 0;
- cd->cd_optional = strcasecmp(value, "optional") == 0;
+ cd->cd_required = su_casematch(value, "required");
+ cd->cd_optional = su_casematch(value, "optional");
}
return 0;
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/msg_parser_util.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/msg_parser_util.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/msg_parser_util.c Wed Feb 11 10:50:29 2009
@@ -47,6 +47,7 @@
#include <sofia-sip/su.h>
#include <sofia-sip/su_alloc.h>
+#include <sofia-sip/su_string.h>
#include "msg_internal.h"
#include "sofia-sip/msg_parser.h"
@@ -871,7 +872,7 @@
}
}
else {
- if (strncasecmp(maybe, param, plen) == 0 &&
+ if (su_casenmatch(maybe, param, plen) &&
(maybe[plen] == '=' || maybe[plen] == 0))
break;
}
@@ -1212,7 +1213,7 @@
for (i = 0; params[i]; i++) {
msg_param_t param = params[i];
- if (strncasecmp(param, token, n) == 0) {
+ if (su_casenmatch(param, token, n)) {
if (param[n] == '=')
return param + n + 1;
else if (param[n] == 0)
@@ -1246,7 +1247,7 @@
for (i = 0; params[i]; i++) {
msg_param_t param = params[i];
- if (strncasecmp(param, token, n) == 0) {
+ if (su_casenmatch(param, token, n)) {
if (param[n] == '=')
return params + i;
else if (param[n] == 0 || token[n - 1] == '=')
@@ -1295,7 +1296,7 @@
for (i = 0; params[i]; i++) {
msg_param_t maybe = params[i];
- if (!(strncasecmp(maybe, param, n))) {
+ if (su_casenmatch(maybe, param, n)) {
if (maybe[n] == '=' || maybe[n] == 0) {
params[i] = param;
return 1;
@@ -1327,7 +1328,7 @@
for (i = 0; params[i]; i++) {
msg_param_t maybe = params[i];
- if (strncasecmp(maybe, param, n) == 0) {
+ if (su_casenmatch(maybe, param, n)) {
if (maybe[n] == '=' || maybe[n] == 0) {
/* Remove */
do {
@@ -1415,10 +1416,10 @@
for (i = 0; d[i]; i++) {
if ((prune == 1 &&
- strncasecmp(p, d[i], nlen) == 0
+ su_casenmatch(p, d[i], nlen)
&& (d[i][nlen] == '=' || d[i][nlen] == '\0'))
||
- (prune == 2 && strcasecmp(p, d[i]) == 0)
+ (prune == 2 && su_casematch(p, d[i]))
||
(prune == 3 && strcmp(p, d[i]) == 0))
return 1;
@@ -1649,7 +1650,7 @@
if (*a == NULL || *b == NULL)
return (*a != NULL) - (*b != NULL);
nlen = strcspn(*a, "=");
- if ((c = strncasecmp(*a, *b, nlen)))
+ if ((c = su_strncasecmp(*a, *b, nlen)))
return c;
if ((c = strcmp(*a + nlen, *b + nlen)))
return c;
1
0
[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