[Freeswitch-svn] [commit] r11800 - in freeswitch/trunk/libs/sofia-sip: . libsofia-sip-ua/nua
FreeSWITCH SVN
mikej at freeswitch.org
Wed Feb 11 08:49:25 PST 2009
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 at 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,
More information about the Freeswitch-svn
mailing list