[Freeswitch-branches] [commit] r4961 - in freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua: nta nua sdp sip sip/sofia-sip sresolv su
Freeswitch SVN
mikej at freeswitch.org
Tue Apr 17 08:56:58 EDT 2007
Author: mikej
Date: Tue Apr 17 08:56:58 2007
New Revision: 4961
Modified:
freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nta/run_test_nta_api
freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_cancel_bye.c
freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_ops.c
freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/sdp/torture_sdp.c
freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/sip/run_test_sip_msg
freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/sip/sip_pref_util.c
freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip_util.h
freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/sip/torture_sip.c
freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/sresolv/run_test_sresolv
freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/su/run_test_su
freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/su/run_test_su_osx
Log:
sync with sofia-sip darcs tree
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nta/run_test_nta_api
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nta/run_test_nta_api (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nta/run_test_nta_api Tue Apr 17 08:56:58 2007
@@ -1,4 +1,4 @@
-#! /bin/bash
+#! /bin/sh
#
# Run test_nta_api
#
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_cancel_bye.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_cancel_bye.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_cancel_bye.c Tue Apr 17 08:56:58 2007
@@ -1135,7 +1135,7 @@
INVITE(b, b_call, b_call->nh,
SIPTAG_SUBJECT_STR("NUA-6.3 re-INVITE"),
TAG_END());
- run_ab_until(ctx, -1, reject_reinvite_401, -1, until_final_response);
+ run_ab_until(ctx, -1, reject_reinvite_401, -1, save_until_final_response);
TEST_1(nua_handle_has_active_call(a_call->nh));
TEST_1(nua_handle_has_active_call(b_call->nh));
@@ -1210,7 +1210,7 @@
INVITE(b, b_call, b_call->nh,
SIPTAG_SUBJECT_STR("NUA-6.4.1 re-INVITE"),
TAG_END());
- run_ab_until(ctx, -1, reject_reinvite_401, -1, until_final_response);
+ run_ab_until(ctx, -1, reject_reinvite_401, -1, save_until_final_response);
TEST_1(nua_handle_has_active_call(a_call->nh));
TEST_1(nua_handle_has_active_call(b_call->nh));
@@ -1286,7 +1286,7 @@
SIPTAG_SUBJECT_STR("NUA-6.4.2 UPDATE"),
TAG_END());
BYE(b, b_call, b_call->nh, TAG_END()); /* Queued until nua_authenticate */
- run_ab_until(ctx, -1, reject_reinvite_401, -1, until_final_response);
+ run_ab_until(ctx, -1, reject_reinvite_401, -1, save_until_final_response);
TEST_1(nua_handle_has_active_call(a_call->nh));
TEST_1(nua_handle_has_active_call(b_call->nh));
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_ops.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_ops.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_ops.c Tue Apr 17 08:56:58 2007
@@ -55,7 +55,9 @@
int save_until_final_response(CONDITION_PARAMS)
{
save_event_in_list(ctx, event, ep, call);
- return event >= nua_r_set_params && status >= 200;
+ return
+ nua_r_set_params <= event && event < nua_i_network_changed
+ && status >= 200;
}
/** Save events.
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/sdp/torture_sdp.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/sdp/torture_sdp.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/sdp/torture_sdp.c Tue Apr 17 08:56:58 2007
@@ -460,7 +460,7 @@
su_home_check(home); TEST_1(home);
- TEST_1((parser = sdp_parse(home, s3_msg, sizeof(s1_msg), 0)));
+ TEST_1((parser = sdp_parse(home, s3_msg, sizeof(s3_msg) - 1, 0)));
TEST_1(sdp_sanity_check(parser) == 0);
@@ -469,6 +469,52 @@
END();
}
+static char const pint_msg[] =
+ "v=0\r\n"
+ "o=- 2353687640 2353687640 IN IP4 128.3.4.5\r\n"
+ "s=marketing\r\n"
+ "e=john.jones.3 at chinet.net\r\n"
+ "c= TN RFC2543 +1-201-406-4090\r\n"
+ "t=2353687640 0\r\n"
+ "m=audio 1 voice -\r\n"
+ ;
+
+static char const pint_torture_msg[] =
+ "v=0\r\n"
+ "o=- 2353687640 2353687640 IN IP4 128.3.4.5\r\n"
+ "s=marketing\r\n"
+
+ "c= TN RFC2543 123\r\n"
+ "a=phone-context:+97252\r\n"
+ "t=2353687640 0\r\n"
+ "m= text 1 fax plain\r\n"
+ "a=fmtp:plain spr:fi6MeoclEjaF3EDfYHlkqx1zn8A1lMoiJFUHpQ5Xo\r\n"
+ ;
+
+static int test_pint(void)
+{
+ su_home_t *home = su_home_create();
+ sdp_parser_t *parser;
+ sdp_session_t *sdp;
+
+ BEGIN();
+
+ su_home_check(home); TEST_1(home);
+
+ TEST_1((parser = sdp_parse(home, pint_msg, sizeof(pint_msg) - 1, sdp_f_anynet)));
+ TEST_1((sdp = sdp_session(parser)));
+
+ TEST_1((parser = sdp_parse(home, pint_torture_msg, sizeof(pint_torture_msg) - 1,
+ sdp_f_anynet)));
+ TEST_1((sdp = sdp_session(parser)));
+
+ su_home_check(home);
+ su_home_unref(home);
+
+ END();
+}
+
+
static sdp_list_t const l0[1] = {{ sizeof(l0), NULL, "foo" }};
static sdp_list_t const l1[1] = {{ sizeof(l1), (sdp_list_t *)l0, "bar" }};
@@ -873,6 +919,7 @@
retval |= test_error(); fflush(stdout);
retval |= test_session(); fflush(stdout);
retval |= test_session2(); fflush(stdout);
+ retval |= test_pint(); fflush(stdout);
retval |= test_sanity(); fflush(stdout);
retval |= test_list(); fflush(stdout);
retval |= test_rtpmap(); fflush(stdout);
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/sip/run_test_sip_msg
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/sip/run_test_sip_msg (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/sip/run_test_sip_msg Tue Apr 17 08:56:58 2007
@@ -1,4 +1,4 @@
-#! /bin/bash
+#! /bin/sh
#
# Run the parser tests
#
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/sip/sip_pref_util.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/sip/sip_pref_util.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/sip/sip_pref_util.c Tue Apr 17 08:56:58 2007
@@ -44,6 +44,8 @@
#include <sofia-sip/sip_util.h>
#include <sofia-sip/sip_status.h>
+static double parse_number(char const *str, char **return_end);
+
/** Parse a single preference */
int sip_prefs_parse(union sip_pref *sp,
char const **in_out_s,
@@ -107,16 +109,16 @@
s0 = s[0];
if (s0 == '=')
- sp->sp_type = sp_range, n1 = n2 = strtod(s = s + 1, &e);
+ sp->sp_type = sp_range, n1 = n2 = parse_number(s = s + 1, &e);
else if (s0 == '<' && s[1] == '=')
- sp->sp_type = sp_range, n1 = DBL_MIN, n2 = strtod(s = s + 2, &e);
+ sp->sp_type = sp_range, n1 = -DBL_MAX, n2 = parse_number(s = s + 2, &e);
else if (s0 == '>' && s[1] == '=')
- sp->sp_type = sp_range, n1 = strtod(s = s + 2, &e), n2 = DBL_MAX;
- else if (((n1 = strtod(s, &e)) != 0.0 || s != e) && e[0] == ':')
- sp->sp_type = sp_range, n2 = strtod(s = e + 1, &e);
+ sp->sp_type = sp_range, n1 = parse_number(s = s + 2, &e), n2 = DBL_MAX;
+ else if (((n1 = parse_number(s, &e)) != 0.0 || s != e) && e[0] == ':')
+ sp->sp_type = sp_range, n2 = parse_number(s = e + 1, &e);
else
/* Error in conversion */
- sp->sp_type = sp_error, n1 = DBL_MAX, n2 = DBL_MIN;
+ sp->sp_type = sp_error, n1 = DBL_MAX, n2 = -DBL_MAX;
if (s == e && (n1 == 0.0 || n2 == 0.0))
sp->sp_type = sp_error; /* Error in conversion */
@@ -155,6 +157,46 @@
return sp->sp_type != sp_error;
}
+/** Parse number:
+ * number = [ "+" / "-" ] 1*DIGIT ["." 0*DIGIT]
+ */
+static double parse_number(char const *str, char **return_end)
+{
+ double value = 0.0;
+ double decimal = 0.1;
+ char d, sign = '+';
+
+ if (return_end)
+ *return_end = (char *)str;
+
+ d = *str;
+
+ if (d == '+' || d == '-')
+ sign = d, d = *++str;
+
+ if (!('0' <= d && d <= '9'))
+ return value;
+
+ for (; '0' <= d && d <= '9'; d = *++str)
+ value = value * 10 + (d - '0');
+
+ if (d == '.') for (d = *++str; '0' <= d && d <= '9'; d = *++str) {
+ value += (d - '0') * decimal; decimal *= 0.1;
+ }
+
+ if (value > DBL_MAX)
+ value = DBL_MAX;
+
+ if (sign == '-')
+ value = -value;
+
+ if (return_end)
+ *return_end = (char *)str;
+
+ return value;
+}
+
+
/** Return true if preferences match */
int sip_prefs_match(union sip_pref const *a,
union sip_pref const *b)
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip_util.h
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip_util.h (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip_util.h Tue Apr 17 08:56:58 2007
@@ -149,8 +149,8 @@
*/
struct sp_range {
enum sp_type spr_type;
- double spr_lower;
- double spr_upper;
+ double spr_lower; /**< Lower limit. Lowest value is -DBL_MAX. */
+ double spr_upper; /**< Upper limit. Highest value is DBL_MAX. */
} sp_range;
};
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/sip/torture_sip.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/sip/torture_sip.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/sip/torture_sip.c Tue Apr 17 08:56:58 2007
@@ -2535,6 +2535,7 @@
}
#include <float.h>
+#include <math.h>
int test_caller_prefs(void)
{
@@ -2650,7 +2651,7 @@
TEST_1(sip_prefs_parse(sp, &s, &negate));
TEST(sp->sp_type, sp_range);
- TEST_D(sp->sp_range.spr_lower, DBL_MIN);
+ TEST_D(sp->sp_range.spr_lower, -DBL_MAX);
TEST_D(sp->sp_range.spr_upper, 3.0);
TEST_1(sip_prefs_match(sp, sp));
TEST_1(!negate);
@@ -2668,7 +2669,7 @@
TEST_1(sip_prefs_parse(sp, &s, &negate));
TEST(sp->sp_type, sp_range);
- TEST_D(sp->sp_range.spr_lower, DBL_MIN);
+ TEST_D(sp->sp_range.spr_lower, -DBL_MAX);
TEST_D(sp->sp_range.spr_upper, 6.0);
TEST_1(sip_prefs_match(sp, sp));
TEST_1(negate);
@@ -2687,6 +2688,46 @@
TEST_1(!sip_prefs_parse(sp, &s, &negate));
TEST(sp->sp_type, sp_init);
+ /* Numeric */
+ s = "\" !#="
+ "1111111111111111111111111111111111111111"
+ "1111111111111111111111111111111111111111"
+ "1111111111111111111111111111111111111111"
+ "1111111111111111111111111111111111111111"
+
+ "1111111111111111111111111111111111111111"
+ "1111111111111111111111111111111111111111"
+ "1111111111111111111111111111111111111111"
+ "1111111111111111111111111111111111111111."
+
+ "1111111111111111111111111111111111111111"
+ "1111111111111111111111111111111111111111"
+ "1111111111111111111111111111111111111111"
+ "1111111111111111111111111111111111111111"
+
+ "1111111111111111111111111111111111111111"
+ "1111111111111111111111111111111111111111"
+ "1111111111111111111111111111111111111111"
+ "1111111111111111111111111111111111111111,"
+ " #<=-16"
+ "\"";
+
+ negate = 0; memset(sp, 0, sizeof sp);
+
+ TEST_1(sip_prefs_parse(sp, &s, &negate));
+ TEST(sp->sp_type, sp_range);
+ TEST_D(sp->sp_range.spr_lower, DBL_MAX);
+ TEST_D(sp->sp_range.spr_upper, DBL_MAX);
+ TEST_1(sip_prefs_match(sp, sp));
+ TEST_1(negate);
+
+ TEST_1(sip_prefs_parse(sp, &s, &negate));
+ TEST(sp->sp_type, sp_range);
+ TEST_D(sp->sp_range.spr_lower, -DBL_MAX);
+ TEST_D(sp->sp_range.spr_upper, -16.0);
+ TEST_1(sip_prefs_match(sp, sp));
+ TEST_1(!negate);
+
error = 12;
TEST_1(sip_prefs_matching("\"INVITE,MESSAGE,SUBSCRIBE\"",
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/sresolv/run_test_sresolv
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/sresolv/run_test_sresolv (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/sresolv/run_test_sresolv Tue Apr 17 08:56:58 2007
@@ -1,4 +1,4 @@
-#! /bin/bash
+#! /bin/sh
#
# Run sresolv_test using our own name server
#
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/su/run_test_su
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/su/run_test_su (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/su/run_test_su Tue Apr 17 08:56:58 2007
@@ -1,4 +1,4 @@
-#! /bin/bash
+#! /bin/sh
rc=0
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/su/run_test_su_osx
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/su/run_test_su_osx (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/su/run_test_su_osx Tue Apr 17 08:56:58 2007
@@ -1,4 +1,4 @@
-#! /bin/bash
+#! /bin/sh
rc=0
More information about the Freeswitch-branches
mailing list