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
March 2009
- 16 participants
- 508 discussions
03 Mar '09
Author: brian
Date: Tue Mar 3 15:47:18 2009
New Revision: 12396
Log:
you can't join a detached thread later on
Modified:
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c Tue Mar 3 15:47:18 2009
@@ -669,7 +669,6 @@
int x = 0;
switch_threadattr_create(&thd_attr, profile->pool);
- switch_threadattr_detach_set(thd_attr, 1);
switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
switch_threadattr_priority_increase(thd_attr);
switch_thread_create(&thread, thd_attr, sofia_profile_worker_thread_run, profile, profile->pool);
1
0
03 Mar '09
Author: anthm
Date: Tue Mar 3 14:55:39 2009
New Revision: 12395
Log:
FSCORE-313
Modified:
freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
Modified: freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c Tue Mar 3 14:55:39 2009
@@ -2238,6 +2238,8 @@
unsigned int timelimit = 60;
switch_channel_t *new_channel = NULL;
switch_event_t *params = NULL;
+ char stupid[128] = "";
+
if (switch_strlen_zero(outbound_profile->destination_number)) {
goto done;
}
@@ -2357,7 +2359,11 @@
myflags |= SOF_NOBLOCK;
}
- if (switch_ivr_originate(session, new_session, &cause, d_dest, timelimit, NULL,
+ switch_snprintf(stupid, sizeof(stupid), "user/%s", user);
+ if (switch_stristr(stupid, d_dest)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Waddya Daft? You almost called '%s' in an infinate loop!\n", stupid);
+ cause = SWITCH_CAUSE_INVALID_IE_CONTENTS;
+ } else if (switch_ivr_originate(session, new_session, &cause, d_dest, timelimit, NULL,
cid_name_override, cid_num_override, NULL, var_event, myflags) == SWITCH_STATUS_SUCCESS) {
const char *context;
switch_caller_profile_t *cp;
1
0
[commit] r12393 - in freeswitch/trunk: conf/autoload_configs libs/esl/perl
by FreeSWITCH SVN 03 Mar '09
by FreeSWITCH SVN 03 Mar '09
03 Mar '09
Author: brian
Date: Tue Mar 3 14:20:27 2009
New Revision: 12393
Log:
revert
Modified:
freeswitch/trunk/conf/autoload_configs/xml_rpc.conf.xml
freeswitch/trunk/libs/esl/perl/ESL.pm
freeswitch/trunk/libs/esl/perl/esl_wrap.cpp
Modified: freeswitch/trunk/conf/autoload_configs/xml_rpc.conf.xml
==============================================================================
--- freeswitch/trunk/conf/autoload_configs/xml_rpc.conf.xml (original)
+++ freeswitch/trunk/conf/autoload_configs/xml_rpc.conf.xml Tue Mar 3 14:20:27 2009
@@ -3,8 +3,8 @@
<!-- The port where you want to run the http service (default 8080) -->
<param name="http-port" value="8080"/>
<!-- if all 3 of the following params exist all http traffic will require auth -->
- <!-- <param name="auth-realm" value="freeswitch"/> -->
- <!-- <param name="auth-user" value="freeswitch"/> -->
- <!-- <param name="auth-pass" value="works"/> -->
+ <param name="auth-realm" value="freeswitch"/>
+ <param name="auth-user" value="freeswitch"/>
+ <param name="auth-pass" value="works"/>
</settings>
</configuration>
Modified: freeswitch/trunk/libs/esl/perl/ESL.pm
==============================================================================
--- freeswitch/trunk/libs/esl/perl/ESL.pm (original)
+++ freeswitch/trunk/libs/esl/perl/ESL.pm Tue Mar 3 14:20:27 2009
@@ -1,5 +1,8 @@
-# This file was created automatically by SWIG 1.3.29.
+# This file was automatically generated by SWIG (http://www.swig.org)
+# Version 1.3.35
+#
# Don't modify this file, modify the SWIG interface instead.
+
package ESL;
require Exporter;
require DynaLoader;
Modified: freeswitch/trunk/libs/esl/perl/esl_wrap.cpp
==============================================================================
--- freeswitch/trunk/libs/esl/perl/esl_wrap.cpp (original)
+++ freeswitch/trunk/libs/esl/perl/esl_wrap.cpp Tue Mar 3 14:20:27 2009
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org)
- * Version 1.3.29
+ * Version 1.3.35
*
* This file is not intended to be easily readable and contains a number of
* coding conventions designed to improve portability and efficiency. Do not make
@@ -12,7 +12,7 @@
#define SWIG_CASTRANK_MODE
#ifdef __cplusplus
-template<class T> class SwigValueWrapper {
+template<typename T> class SwigValueWrapper {
T *tt;
public:
SwigValueWrapper() : tt(0) { }
@@ -25,6 +25,10 @@
private:
SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
};
+
+template <typename T> T SwigValueInit() {
+ return T();
+}
#endif
/* -----------------------------------------------------------------------------
@@ -34,14 +38,14 @@
/* template workaround for compilers that cannot correctly implement the C++ standard */
#ifndef SWIGTEMPLATEDISAMBIGUATOR
-# if defined(__SUNPRO_CC)
-# if (__SUNPRO_CC <= 0x560)
-# define SWIGTEMPLATEDISAMBIGUATOR template
-# else
-# define SWIGTEMPLATEDISAMBIGUATOR
-# endif
+# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
+# define SWIGTEMPLATEDISAMBIGUATOR template
+# elif defined(__HP_aCC)
+/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
+/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
+# define SWIGTEMPLATEDISAMBIGUATOR template
# else
-# define SWIGTEMPLATEDISAMBIGUATOR
+# define SWIGTEMPLATEDISAMBIGUATOR
# endif
#endif
@@ -120,10 +124,16 @@
#endif
/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
-#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER)
+#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
# define _CRT_SECURE_NO_DEPRECATE
#endif
+/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
+#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
+# define _SCL_SECURE_NO_DEPRECATE
+#endif
+
+
/* -----------------------------------------------------------------------------
* swigrun.swg
*
@@ -133,7 +143,7 @@
/* This should only be incremented when either the layout of swig_type_info changes,
or for whatever reason, the runtime changes incompatibly */
-#define SWIG_RUNTIME_VERSION "2"
+#define SWIG_RUNTIME_VERSION "4"
/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
#ifdef SWIG_TYPE_TABLE
@@ -168,6 +178,7 @@
/* Flags for pointer conversions */
#define SWIG_POINTER_DISOWN 0x1
+#define SWIG_CAST_NEW_MEMORY 0x2
/* Flags for new pointer objects */
#define SWIG_POINTER_OWN 0x1
@@ -308,10 +319,10 @@
extern "C" {
#endif
-typedef void *(*swig_converter_func)(void *);
+typedef void *(*swig_converter_func)(void *, int *);
typedef struct swig_type_info *(*swig_dycast_func)(void **);
-/* Structure to store inforomation on one type */
+/* Structure to store information on one type */
typedef struct swig_type_info {
const char *name; /* mangled name of this type */
const char *str; /* human readable name of this type */
@@ -356,7 +367,7 @@
while ((*f2 == ' ') && (f2 != l2)) ++f2;
if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
}
- return (l1 - f1) - (l2 - f2);
+ return (int)((l1 - f1) - (l2 - f2));
}
/*
@@ -438,8 +449,8 @@
Cast a pointer up an inheritance hierarchy
*/
SWIGRUNTIMEINLINE void *
-SWIG_TypeCast(swig_cast_info *ty, void *ptr) {
- return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr);
+SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
+ return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
}
/*
@@ -792,6 +803,10 @@
# endif
#endif /* !INT2PTR */
+#ifndef SvPV_nolen
+# define SvPV_nolen(x) SvPV(x,PL_na)
+#endif
+
#ifndef get_sv
# define get_sv perl_get_sv
#endif
@@ -940,6 +955,11 @@
/* SWIG Perl macros */
+/* Macro to declare an XS function */
+#ifndef XSPROTO
+# define XSPROTO(name) void name(pTHX_ CV* cv)
+#endif
+
/* Macro to call an XS function */
#ifdef PERL_OBJECT
# define SWIG_CALLXS(_name) _name(cv,pPerl)
@@ -951,51 +971,50 @@
# endif
#endif
-/* Note: SwigMagicFuncHack is a typedef used to get the C++ compiler to just shut up already */
-
#ifdef PERL_OBJECT
#define MAGIC_PPERL CPerlObj *pPerl = (CPerlObj *) this;
-typedef int (CPerlObj::*SwigMagicFunc)(SV *, MAGIC *);
#ifdef __cplusplus
extern "C" {
#endif
-typedef int (CPerlObj::*SwigMagicFuncHack)(SV *, MAGIC *);
+typedef int (CPerlObj::*SwigMagicFunc)(SV *, MAGIC *);
#ifdef __cplusplus
}
#endif
#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
#define SWIGCLASS_STATIC
-#else
+
+#else /* PERL_OBJECT */
+
#define MAGIC_PPERL
#define SWIGCLASS_STATIC static SWIGUNUSED
+
#ifndef MULTIPLICITY
#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
-typedef int (*SwigMagicFunc)(SV *, MAGIC *);
#ifdef __cplusplus
extern "C" {
#endif
-typedef int (*SwigMagicFuncHack)(SV *, MAGIC *);
+typedef int (*SwigMagicFunc)(SV *, MAGIC *);
#ifdef __cplusplus
}
#endif
+#else /* MULTIPLICITY */
-#else
#define SWIG_MAGIC(a,b) (struct interpreter *interp, SV *a, MAGIC *b)
-typedef int (*SwigMagicFunc)(struct interpreter *, SV *, MAGIC *);
+
#ifdef __cplusplus
extern "C" {
#endif
-typedef int (*SwigMagicFuncHack)(struct interpreter *, SV *, MAGIC *);
+typedef int (*SwigMagicFunc)(struct interpreter *, SV *, MAGIC *);
#ifdef __cplusplus
}
#endif
-#endif
-#endif
+#endif /* MULTIPLICITY */
+#endif /* PERL_OBJECT */
/* Workaround for bug in perl 5.6.x croak and earlier */
#if (PERL_VERSION < 8)
@@ -1019,6 +1038,35 @@
#endif
+/*
+ Define how strict is the cast between strings and integers/doubles
+ when overloading between these types occurs.
+
+ The default is making it as strict as possible by using SWIG_AddCast
+ when needed.
+
+ You can use -DSWIG_PERL_NO_STRICT_STR2NUM at compilation time to
+ disable the SWIG_AddCast, making the casting between string and
+ numbers less strict.
+
+ In the end, we try to solve the overloading between strings and
+ numerical types in the more natural way, but if you can avoid it,
+ well, avoid it using %rename, for example.
+*/
+#ifndef SWIG_PERL_NO_STRICT_STR2NUM
+# ifndef SWIG_PERL_STRICT_STR2NUM
+# define SWIG_PERL_STRICT_STR2NUM
+# endif
+#endif
+#ifdef SWIG_PERL_STRICT_STR2NUM
+/* string takes precedence */
+#define SWIG_Str2NumCast(x) SWIG_AddCast(x)
+#else
+/* number takes precedence */
+#define SWIG_Str2NumCast(x) x
+#endif
+
+
#include <stdlib.h>
@@ -1035,7 +1083,7 @@
SWIGRUNTIME swig_cast_info *
SWIG_TypeProxyCheck(const char *c, swig_type_info *ty) {
- SWIG_TypeCheck_Template(( (!iter->type->clientdata && (strcmp((char*)iter->type->name, c) == 0))
+ SWIG_TypeCheck_Template(( (!iter->type->clientdata && (strcmp(iter->type->name, c) == 0))
|| (iter->type->clientdata && (strcmp((char*)iter->type->clientdata, c) == 0))), ty);
}
@@ -1093,7 +1141,11 @@
if (!tc) {
return SWIG_ERROR;
}
- *ptr = SWIG_TypeCast(tc,voidptr);
+ {
+ int newmemory = 0;
+ *ptr = SWIG_TypeCast(tc,voidptr,&newmemory);
+ assert(!newmemory); /* newmemory handling not yet implemented */
+ }
} else {
*ptr = voidptr;
}
@@ -1183,7 +1235,7 @@
const char *c = 0;
if ((!obj) || (!SvOK(obj))) return SWIG_ERROR;
- c = SvPV(obj, PL_na);
+ c = SvPV_nolen(obj);
/* Pointer values must start with leading underscore */
if (*c != '_') return SWIG_ERROR;
c++;
@@ -1200,7 +1252,7 @@
#define SWIG_croak(x) { SWIG_Error(SWIG_RuntimeError, x); SWIG_fail; }
-typedef XS(SwigPerlWrapper);
+typedef XSPROTO(SwigPerlWrapper);
typedef SwigPerlWrapper *SwigPerlWrapperPtr;
/* Structure for command table */
@@ -1253,8 +1305,8 @@
sv_magic(sv,sv,'U',(char *) name,strlen(name));
mg = mg_find(sv,'U');
mg->mg_virtual = (MGVTBL *) malloc(sizeof(MGVTBL));
- mg->mg_virtual->svt_get = (SwigMagicFuncHack) get;
- mg->mg_virtual->svt_set = (SwigMagicFuncHack) set;
+ mg->mg_virtual->svt_get = (SwigMagicFunc) get;
+ mg->mg_virtual->svt_set = (SwigMagicFunc) set;
mg->mg_virtual->svt_len = 0;
mg->mg_virtual->svt_clear = 0;
mg->mg_virtual->svt_free = 0;
@@ -1268,7 +1320,7 @@
/* first check if pointer already created */
if (!type_pointer) {
- pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE);
+ pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE | GV_ADDMULTI);
if (pointer && SvOK(pointer)) {
type_pointer = INT2PTR(swig_type_info **, SvIV(pointer));
}
@@ -1282,7 +1334,7 @@
SV *pointer;
/* create a new pointer */
- pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE);
+ pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE | GV_ADDMULTI);
sv_setiv(pointer, PTR2IV(module));
}
@@ -1377,6 +1429,12 @@
#ifdef check
#undef check
#endif
+#ifdef seekdir
+ #undef seekdir
+#endif
+#ifdef open
+ #undef open
+#endif
@@ -1405,7 +1463,8 @@
#define SWIG_name "ESLc::boot_ESL"
#define SWIG_prefix "ESLc::"
-#define SWIGVERSION 0x010329
+#define SWIGVERSION 0x010335
+#define SWIG_VERSION SWIGVERSION
#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a))
@@ -1434,7 +1493,7 @@
SWIGINTERN swig_type_info*
-SWIG_pchar_descriptor()
+SWIG_pchar_descriptor(void)
{
static int init = 0;
static swig_type_info* info = 0;
@@ -1488,16 +1547,8 @@
SWIG_FromCharPtrAndSize(const char* carray, size_t size)
{
SV *obj = sv_newmortal();
- if (size && carray) {
- if (carray[size - 1] == 0) {
- sv_setpv(obj, carray);
- } else {
- char *tmp = (new char[size + 1]);
- memcpy(tmp, carray, size);
- tmp[size] = 0;
- sv_setpv(obj, tmp);
- delete[] tmp;
- }
+ if (carray) {
+ sv_setpvn(obj, carray, size);
} else {
sv_setsv(obj, &PL_sv_undef);
}
@@ -1513,14 +1564,12 @@
#include <limits.h>
-#ifndef LLONG_MIN
-# define LLONG_MIN LONG_LONG_MIN
-#endif
-#ifndef LLONG_MAX
-# define LLONG_MAX LONG_LONG_MAX
-#endif
-#ifndef ULLONG_MAX
-# define ULLONG_MAX ULONG_LONG_MAX
+#if !defined(SWIG_NO_LLONG_MAX)
+# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
+# define LLONG_MAX __LONG_LONG_MAX__
+# define LLONG_MIN (-LLONG_MAX - 1LL)
+# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
+# endif
#endif
@@ -1534,7 +1583,7 @@
if (val) *val = (double) SvIV(obj);
return SWIG_AddCast(SWIG_OK);
} else {
- const char *nptr = SvPV(obj, PL_na);
+ const char *nptr = SvPV_nolen(obj);
if (nptr) {
char *endptr;
double v = strtod(nptr, &endptr);
@@ -1544,7 +1593,7 @@
} else {
if (*endptr == '\0') {
if (val) *val = v;
- return SWIG_AddCast(SWIG_OK);
+ return SWIG_Str2NumCast(SWIG_OK);
}
}
}
@@ -1597,17 +1646,19 @@
return SWIG_OK;
} else {
int dispatch = 0;
- const char *nptr = SvPV(obj, PL_na);
+ const char *nptr = SvPV_nolen(obj);
if (nptr) {
char *endptr;
- long v = strtol(nptr, &endptr,0);
+ long v;
+ errno = 0;
+ v = strtol(nptr, &endptr,0);
if (errno == ERANGE) {
errno = 0;
return SWIG_OverflowError;
} else {
if (*endptr == '\0') {
if (val) *val = v;
- return SWIG_AddCast(SWIG_OK);
+ return SWIG_Str2NumCast(SWIG_OK);
}
}
}
@@ -1668,6 +1719,10 @@
return obj;
}
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#ifdef PERL_OBJECT
#define MAGIC_CLASS _wrap_ESL_var::
class _wrap_ESL_var : public CPerlObj {
@@ -1687,6 +1742,10 @@
#endif
#ifdef __cplusplus
+}
+#endif
+
+#ifdef __cplusplus
extern "C" {
#endif
XS(_wrap_ESLevent_event_set) {
@@ -1779,11 +1838,11 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_serialized_string_set" "', argument " "2"" of type '" "char *""'");
}
- arg2 = buf2;
+ arg2 = reinterpret_cast< char * >(buf2);
if (arg1->serialized_string) delete[] arg1->serialized_string;
if (arg2) {
- size_t size = strlen(arg2) + 1;
- arg1->serialized_string = reinterpret_cast< char* >(memcpy((new char[size]), arg2, sizeof(char)*(size)));
+ size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
+ arg1->serialized_string = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
} else {
arg1->serialized_string = 0;
}
@@ -1817,7 +1876,7 @@
}
arg1 = reinterpret_cast< ESLevent * >(argp1);
result = (char *) ((arg1)->serialized_string);
- ST(argvi) = SWIG_FromCharPtr(result); argvi++ ;
+ ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
XSRETURN(argvi);
fail:
@@ -1914,13 +1973,13 @@
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ESLevent" "', argument " "1"" of type '" "char const *""'");
}
- arg1 = buf1;
+ arg1 = reinterpret_cast< char * >(buf1);
if (items > 1) {
res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_ESLevent" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = buf2;
+ arg2 = reinterpret_cast< char * >(buf2);
}
result = (ESLevent *)new ESLevent((char const *)arg1,(char const *)arg2);
ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
@@ -2163,10 +2222,10 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_serialize" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = buf2;
+ arg2 = reinterpret_cast< char * >(buf2);
}
result = (char *)(arg1)->serialize((char const *)arg2);
- ST(argvi) = SWIG_FromCharPtr(result); argvi++ ;
+ ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
XSRETURN(argvi);
@@ -2247,9 +2306,9 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_getHeader" "', argument " "2"" of type '" "char *""'");
}
- arg2 = buf2;
+ arg2 = reinterpret_cast< char * >(buf2);
result = (char *)(arg1)->getHeader(arg2);
- ST(argvi) = SWIG_FromCharPtr(result); argvi++ ;
+ ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
XSRETURN(argvi);
@@ -2279,7 +2338,7 @@
}
arg1 = reinterpret_cast< ESLevent * >(argp1);
result = (char *)(arg1)->getBody();
- ST(argvi) = SWIG_FromCharPtr(result); argvi++ ;
+ ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
XSRETURN(argvi);
fail:
@@ -2307,7 +2366,7 @@
}
arg1 = reinterpret_cast< ESLevent * >(argp1);
result = (char *)(arg1)->getType();
- ST(argvi) = SWIG_FromCharPtr(result); argvi++ ;
+ ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
XSRETURN(argvi);
fail:
@@ -2342,7 +2401,7 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_addBody" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = buf2;
+ arg2 = reinterpret_cast< char * >(buf2);
result = (bool)(arg1)->addBody((char const *)arg2);
ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
@@ -2385,12 +2444,12 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_addHeader" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = buf2;
+ arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLevent_addHeader" "', argument " "3"" of type '" "char const *""'");
}
- arg3 = buf3;
+ arg3 = reinterpret_cast< char * >(buf3);
result = (bool)(arg1)->addHeader((char const *)arg2,(char const *)arg3);
ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
@@ -2431,7 +2490,7 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_delHeader" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = buf2;
+ arg2 = reinterpret_cast< char * >(buf2);
result = (bool)(arg1)->delHeader((char const *)arg2);
ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
@@ -2526,17 +2585,17 @@
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ESLconnection" "', argument " "1"" of type '" "char const *""'");
}
- arg1 = buf1;
+ arg1 = reinterpret_cast< char * >(buf1);
res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_ESLconnection" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = buf2;
+ arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "new_ESLconnection" "', argument " "3"" of type '" "char const *""'");
}
- arg3 = buf3;
+ arg3 = reinterpret_cast< char * >(buf3);
result = (ESLconnection *)new ESLconnection((char const *)arg1,(char const *)arg2,(char const *)arg3);
ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLconnection, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
@@ -2767,7 +2826,7 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_send" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = buf2;
+ arg2 = reinterpret_cast< char * >(buf2);
result = (int)(arg1)->send((char const *)arg2);
ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
@@ -2806,7 +2865,7 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_sendRecv" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = buf2;
+ arg2 = reinterpret_cast< char * >(buf2);
result = (ESLevent *)(arg1)->sendRecv((char const *)arg2);
ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, 0 | SWIG_SHADOW); argvi++ ;
@@ -3057,12 +3116,12 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_filter" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = buf2;
+ arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_filter" "', argument " "3"" of type '" "char const *""'");
}
- arg3 = buf3;
+ arg3 = reinterpret_cast< char * >(buf3);
result = (int)(arg1)->filter((char const *)arg2,(char const *)arg3);
ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
@@ -3107,12 +3166,12 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_events" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = buf2;
+ arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_events" "', argument " "3"" of type '" "char const *""'");
}
- arg3 = buf3;
+ arg3 = reinterpret_cast< char * >(buf3);
result = (int)(arg1)->events((char const *)arg2,(char const *)arg3);
ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
@@ -3161,20 +3220,20 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_execute" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = buf2;
+ arg2 = reinterpret_cast< char * >(buf2);
if (items > 2) {
res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_execute" "', argument " "3"" of type '" "char const *""'");
}
- arg3 = buf3;
+ arg3 = reinterpret_cast< char * >(buf3);
}
if (items > 3) {
res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
if (!SWIG_IsOK(res4)) {
SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "ESLconnection_execute" "', argument " "4"" of type '" "char const *""'");
}
- arg4 = buf4;
+ arg4 = reinterpret_cast< char * >(buf4);
}
result = (int)(arg1)->execute((char const *)arg2,(char const *)arg3,(char const *)arg4);
ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
@@ -3218,7 +3277,7 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_setBlockingExecute" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = buf2;
+ arg2 = reinterpret_cast< char * >(buf2);
result = (int)(arg1)->setBlockingExecute((char const *)arg2);
ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
@@ -3257,7 +3316,7 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_setEventLock" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = buf2;
+ arg2 = reinterpret_cast< char * >(buf2);
result = (int)(arg1)->setEventLock((char const *)arg2);
ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
@@ -3393,7 +3452,7 @@
* structures together.
*
* The generated swig_type_info structures are assigned staticly to an initial
- * array. We just loop though that array, and handle each type individually.
+ * array. We just loop through that array, and handle each type individually.
* First we lookup if this type has been already loaded, and if so, use the
* loaded structure instead of the generated one. Then we have to fill in the
* cast linked list. The cast data is initially stored in something like a
@@ -3431,32 +3490,58 @@
#define SWIGRUNTIME_DEBUG
#endif
+
SWIGRUNTIME void
SWIG_InitializeModule(void *clientdata) {
size_t i;
- swig_module_info *module_head;
- static int init_run = 0;
+ swig_module_info *module_head, *iter;
+ int found, init;
clientdata = clientdata;
- if (init_run) return;
- init_run = 1;
-
- /* Initialize the swig_module */
- swig_module.type_initial = swig_type_initial;
- swig_module.cast_initial = swig_cast_initial;
+ /* check to see if the circular list has been setup, if not, set it up */
+ if (swig_module.next==0) {
+ /* Initialize the swig_module */
+ swig_module.type_initial = swig_type_initial;
+ swig_module.cast_initial = swig_cast_initial;
+ swig_module.next = &swig_module;
+ init = 1;
+ } else {
+ init = 0;
+ }
/* Try and load any already created modules */
module_head = SWIG_GetModule(clientdata);
- if (module_head) {
+ if (!module_head) {
+ /* This is the first module loaded for this interpreter */
+ /* so set the swig module into the interpreter */
+ SWIG_SetModule(clientdata, &swig_module);
+ module_head = &swig_module;
+ } else {
+ /* the interpreter has loaded a SWIG module, but has it loaded this one? */
+ found=0;
+ iter=module_head;
+ do {
+ if (iter==&swig_module) {
+ found=1;
+ break;
+ }
+ iter=iter->next;
+ } while (iter!= module_head);
+
+ /* if the is found in the list, then all is done and we may leave */
+ if (found) return;
+ /* otherwise we must add out module into the list */
swig_module.next = module_head->next;
module_head->next = &swig_module;
- } else {
- /* This is the first module loaded */
- swig_module.next = &swig_module;
- SWIG_SetModule(clientdata, &swig_module);
}
+ /* When multiple interpeters are used, a module could have already been initialized in
+ a different interpreter, but not yet have a pointer in this interpreter.
+ In this case, we do not want to continue adding types... everything should be
+ set up already */
+ if (init == 0) return;
+
/* Now work on filling in swig_module.types */
#ifdef SWIGRUNTIME_DEBUG
printf("SWIG_InitializeModule: size %d\n", swig_module.size);
@@ -3610,7 +3695,7 @@
/* Install variables */
for (i = 0; swig_variables[i].name; i++) {
SV *sv;
- sv = get_sv((char*) swig_variables[i].name, TRUE | 0x2);
+ sv = get_sv((char*) swig_variables[i].name, TRUE | 0x2 | GV_ADDMULTI);
if (swig_variables[i].type) {
SWIG_MakePtr(sv,(void *)1, *swig_variables[i].type,0);
} else {
@@ -3622,7 +3707,7 @@
/* Install constant */
for (i = 0; swig_constants[i].type; i++) {
SV *sv;
- sv = get_sv((char*)swig_constants[i].name, TRUE | 0x2);
+ sv = get_sv((char*)swig_constants[i].name, TRUE | 0x2 | GV_ADDMULTI);
switch(swig_constants[i].type) {
case SWIG_INT:
sv_setiv(sv, (IV) swig_constants[i].lvalue);
1
0
[commit] r12392 - in freeswitch/trunk: . conf/autoload_configs libs/esl/perl src src/mod/applications/mod_enum src/mod/endpoints/mod_sofia
by FreeSWITCH SVN 03 Mar '09
by FreeSWITCH SVN 03 Mar '09
03 Mar '09
Author: anthm
Date: Tue Mar 3 14:16:05 2009
New Revision: 12392
Log:
FSCORE-297 FSCORE-305 FSCORE-315
Modified:
freeswitch/trunk/conf/autoload_configs/xml_rpc.conf.xml
freeswitch/trunk/libs/esl/perl/ESL.pm
freeswitch/trunk/libs/esl/perl/esl_wrap.cpp
freeswitch/trunk/src/mod/applications/mod_enum/mod_enum.c
freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
freeswitch/trunk/src/switch_core.c
freeswitch/trunk/src/switch_rtp.c
Changes in other areas also in this revision:
Modified:
freeswitch/trunk/ (props changed)
Modified: freeswitch/trunk/conf/autoload_configs/xml_rpc.conf.xml
==============================================================================
--- freeswitch/trunk/conf/autoload_configs/xml_rpc.conf.xml (original)
+++ freeswitch/trunk/conf/autoload_configs/xml_rpc.conf.xml Tue Mar 3 14:16:05 2009
@@ -3,8 +3,8 @@
<!-- The port where you want to run the http service (default 8080) -->
<param name="http-port" value="8080"/>
<!-- if all 3 of the following params exist all http traffic will require auth -->
- <param name="auth-realm" value="freeswitch"/>
- <param name="auth-user" value="freeswitch"/>
- <param name="auth-pass" value="works"/>
+ <!-- <param name="auth-realm" value="freeswitch"/> -->
+ <!-- <param name="auth-user" value="freeswitch"/> -->
+ <!-- <param name="auth-pass" value="works"/> -->
</settings>
</configuration>
Modified: freeswitch/trunk/libs/esl/perl/ESL.pm
==============================================================================
--- freeswitch/trunk/libs/esl/perl/ESL.pm (original)
+++ freeswitch/trunk/libs/esl/perl/ESL.pm Tue Mar 3 14:16:05 2009
@@ -1,8 +1,5 @@
-# This file was automatically generated by SWIG (http://www.swig.org)
-# Version 1.3.35
-#
+# This file was created automatically by SWIG 1.3.29.
# Don't modify this file, modify the SWIG interface instead.
-
package ESL;
require Exporter;
require DynaLoader;
Modified: freeswitch/trunk/libs/esl/perl/esl_wrap.cpp
==============================================================================
--- freeswitch/trunk/libs/esl/perl/esl_wrap.cpp (original)
+++ freeswitch/trunk/libs/esl/perl/esl_wrap.cpp Tue Mar 3 14:16:05 2009
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org)
- * Version 1.3.35
+ * Version 1.3.29
*
* This file is not intended to be easily readable and contains a number of
* coding conventions designed to improve portability and efficiency. Do not make
@@ -12,7 +12,7 @@
#define SWIG_CASTRANK_MODE
#ifdef __cplusplus
-template<typename T> class SwigValueWrapper {
+template<class T> class SwigValueWrapper {
T *tt;
public:
SwigValueWrapper() : tt(0) { }
@@ -25,10 +25,6 @@
private:
SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
};
-
-template <typename T> T SwigValueInit() {
- return T();
-}
#endif
/* -----------------------------------------------------------------------------
@@ -38,14 +34,14 @@
/* template workaround for compilers that cannot correctly implement the C++ standard */
#ifndef SWIGTEMPLATEDISAMBIGUATOR
-# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
-# define SWIGTEMPLATEDISAMBIGUATOR template
-# elif defined(__HP_aCC)
-/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
-/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
-# define SWIGTEMPLATEDISAMBIGUATOR template
+# if defined(__SUNPRO_CC)
+# if (__SUNPRO_CC <= 0x560)
+# define SWIGTEMPLATEDISAMBIGUATOR template
+# else
+# define SWIGTEMPLATEDISAMBIGUATOR
+# endif
# else
-# define SWIGTEMPLATEDISAMBIGUATOR
+# define SWIGTEMPLATEDISAMBIGUATOR
# endif
#endif
@@ -124,16 +120,10 @@
#endif
/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
-#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
+#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER)
# define _CRT_SECURE_NO_DEPRECATE
#endif
-/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
-#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
-# define _SCL_SECURE_NO_DEPRECATE
-#endif
-
-
/* -----------------------------------------------------------------------------
* swigrun.swg
*
@@ -143,7 +133,7 @@
/* This should only be incremented when either the layout of swig_type_info changes,
or for whatever reason, the runtime changes incompatibly */
-#define SWIG_RUNTIME_VERSION "4"
+#define SWIG_RUNTIME_VERSION "2"
/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
#ifdef SWIG_TYPE_TABLE
@@ -178,7 +168,6 @@
/* Flags for pointer conversions */
#define SWIG_POINTER_DISOWN 0x1
-#define SWIG_CAST_NEW_MEMORY 0x2
/* Flags for new pointer objects */
#define SWIG_POINTER_OWN 0x1
@@ -319,10 +308,10 @@
extern "C" {
#endif
-typedef void *(*swig_converter_func)(void *, int *);
+typedef void *(*swig_converter_func)(void *);
typedef struct swig_type_info *(*swig_dycast_func)(void **);
-/* Structure to store information on one type */
+/* Structure to store inforomation on one type */
typedef struct swig_type_info {
const char *name; /* mangled name of this type */
const char *str; /* human readable name of this type */
@@ -367,7 +356,7 @@
while ((*f2 == ' ') && (f2 != l2)) ++f2;
if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
}
- return (int)((l1 - f1) - (l2 - f2));
+ return (l1 - f1) - (l2 - f2);
}
/*
@@ -449,8 +438,8 @@
Cast a pointer up an inheritance hierarchy
*/
SWIGRUNTIMEINLINE void *
-SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
- return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
+SWIG_TypeCast(swig_cast_info *ty, void *ptr) {
+ return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr);
}
/*
@@ -803,10 +792,6 @@
# endif
#endif /* !INT2PTR */
-#ifndef SvPV_nolen
-# define SvPV_nolen(x) SvPV(x,PL_na)
-#endif
-
#ifndef get_sv
# define get_sv perl_get_sv
#endif
@@ -955,11 +940,6 @@
/* SWIG Perl macros */
-/* Macro to declare an XS function */
-#ifndef XSPROTO
-# define XSPROTO(name) void name(pTHX_ CV* cv)
-#endif
-
/* Macro to call an XS function */
#ifdef PERL_OBJECT
# define SWIG_CALLXS(_name) _name(cv,pPerl)
@@ -971,50 +951,51 @@
# endif
#endif
+/* Note: SwigMagicFuncHack is a typedef used to get the C++ compiler to just shut up already */
+
#ifdef PERL_OBJECT
#define MAGIC_PPERL CPerlObj *pPerl = (CPerlObj *) this;
+typedef int (CPerlObj::*SwigMagicFunc)(SV *, MAGIC *);
#ifdef __cplusplus
extern "C" {
#endif
-typedef int (CPerlObj::*SwigMagicFunc)(SV *, MAGIC *);
+typedef int (CPerlObj::*SwigMagicFuncHack)(SV *, MAGIC *);
#ifdef __cplusplus
}
#endif
#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
#define SWIGCLASS_STATIC
-
-#else /* PERL_OBJECT */
-
+#else
#define MAGIC_PPERL
#define SWIGCLASS_STATIC static SWIGUNUSED
-
#ifndef MULTIPLICITY
#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
+typedef int (*SwigMagicFunc)(SV *, MAGIC *);
#ifdef __cplusplus
extern "C" {
#endif
-typedef int (*SwigMagicFunc)(SV *, MAGIC *);
+typedef int (*SwigMagicFuncHack)(SV *, MAGIC *);
#ifdef __cplusplus
}
#endif
-#else /* MULTIPLICITY */
+#else
#define SWIG_MAGIC(a,b) (struct interpreter *interp, SV *a, MAGIC *b)
-
+typedef int (*SwigMagicFunc)(struct interpreter *, SV *, MAGIC *);
#ifdef __cplusplus
extern "C" {
#endif
-typedef int (*SwigMagicFunc)(struct interpreter *, SV *, MAGIC *);
+typedef int (*SwigMagicFuncHack)(struct interpreter *, SV *, MAGIC *);
#ifdef __cplusplus
}
#endif
-#endif /* MULTIPLICITY */
-#endif /* PERL_OBJECT */
+#endif
+#endif
/* Workaround for bug in perl 5.6.x croak and earlier */
#if (PERL_VERSION < 8)
@@ -1038,35 +1019,6 @@
#endif
-/*
- Define how strict is the cast between strings and integers/doubles
- when overloading between these types occurs.
-
- The default is making it as strict as possible by using SWIG_AddCast
- when needed.
-
- You can use -DSWIG_PERL_NO_STRICT_STR2NUM at compilation time to
- disable the SWIG_AddCast, making the casting between string and
- numbers less strict.
-
- In the end, we try to solve the overloading between strings and
- numerical types in the more natural way, but if you can avoid it,
- well, avoid it using %rename, for example.
-*/
-#ifndef SWIG_PERL_NO_STRICT_STR2NUM
-# ifndef SWIG_PERL_STRICT_STR2NUM
-# define SWIG_PERL_STRICT_STR2NUM
-# endif
-#endif
-#ifdef SWIG_PERL_STRICT_STR2NUM
-/* string takes precedence */
-#define SWIG_Str2NumCast(x) SWIG_AddCast(x)
-#else
-/* number takes precedence */
-#define SWIG_Str2NumCast(x) x
-#endif
-
-
#include <stdlib.h>
@@ -1083,7 +1035,7 @@
SWIGRUNTIME swig_cast_info *
SWIG_TypeProxyCheck(const char *c, swig_type_info *ty) {
- SWIG_TypeCheck_Template(( (!iter->type->clientdata && (strcmp(iter->type->name, c) == 0))
+ SWIG_TypeCheck_Template(( (!iter->type->clientdata && (strcmp((char*)iter->type->name, c) == 0))
|| (iter->type->clientdata && (strcmp((char*)iter->type->clientdata, c) == 0))), ty);
}
@@ -1141,11 +1093,7 @@
if (!tc) {
return SWIG_ERROR;
}
- {
- int newmemory = 0;
- *ptr = SWIG_TypeCast(tc,voidptr,&newmemory);
- assert(!newmemory); /* newmemory handling not yet implemented */
- }
+ *ptr = SWIG_TypeCast(tc,voidptr);
} else {
*ptr = voidptr;
}
@@ -1235,7 +1183,7 @@
const char *c = 0;
if ((!obj) || (!SvOK(obj))) return SWIG_ERROR;
- c = SvPV_nolen(obj);
+ c = SvPV(obj, PL_na);
/* Pointer values must start with leading underscore */
if (*c != '_') return SWIG_ERROR;
c++;
@@ -1252,7 +1200,7 @@
#define SWIG_croak(x) { SWIG_Error(SWIG_RuntimeError, x); SWIG_fail; }
-typedef XSPROTO(SwigPerlWrapper);
+typedef XS(SwigPerlWrapper);
typedef SwigPerlWrapper *SwigPerlWrapperPtr;
/* Structure for command table */
@@ -1305,8 +1253,8 @@
sv_magic(sv,sv,'U',(char *) name,strlen(name));
mg = mg_find(sv,'U');
mg->mg_virtual = (MGVTBL *) malloc(sizeof(MGVTBL));
- mg->mg_virtual->svt_get = (SwigMagicFunc) get;
- mg->mg_virtual->svt_set = (SwigMagicFunc) set;
+ mg->mg_virtual->svt_get = (SwigMagicFuncHack) get;
+ mg->mg_virtual->svt_set = (SwigMagicFuncHack) set;
mg->mg_virtual->svt_len = 0;
mg->mg_virtual->svt_clear = 0;
mg->mg_virtual->svt_free = 0;
@@ -1320,7 +1268,7 @@
/* first check if pointer already created */
if (!type_pointer) {
- pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE | GV_ADDMULTI);
+ pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE);
if (pointer && SvOK(pointer)) {
type_pointer = INT2PTR(swig_type_info **, SvIV(pointer));
}
@@ -1334,7 +1282,7 @@
SV *pointer;
/* create a new pointer */
- pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE | GV_ADDMULTI);
+ pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE);
sv_setiv(pointer, PTR2IV(module));
}
@@ -1429,12 +1377,6 @@
#ifdef check
#undef check
#endif
-#ifdef seekdir
- #undef seekdir
-#endif
-#ifdef open
- #undef open
-#endif
@@ -1463,8 +1405,7 @@
#define SWIG_name "ESLc::boot_ESL"
#define SWIG_prefix "ESLc::"
-#define SWIGVERSION 0x010335
-#define SWIG_VERSION SWIGVERSION
+#define SWIGVERSION 0x010329
#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a))
@@ -1493,7 +1434,7 @@
SWIGINTERN swig_type_info*
-SWIG_pchar_descriptor(void)
+SWIG_pchar_descriptor()
{
static int init = 0;
static swig_type_info* info = 0;
@@ -1547,8 +1488,16 @@
SWIG_FromCharPtrAndSize(const char* carray, size_t size)
{
SV *obj = sv_newmortal();
- if (carray) {
- sv_setpvn(obj, carray, size);
+ if (size && carray) {
+ if (carray[size - 1] == 0) {
+ sv_setpv(obj, carray);
+ } else {
+ char *tmp = (new char[size + 1]);
+ memcpy(tmp, carray, size);
+ tmp[size] = 0;
+ sv_setpv(obj, tmp);
+ delete[] tmp;
+ }
} else {
sv_setsv(obj, &PL_sv_undef);
}
@@ -1564,12 +1513,14 @@
#include <limits.h>
-#if !defined(SWIG_NO_LLONG_MAX)
-# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
-# define LLONG_MAX __LONG_LONG_MAX__
-# define LLONG_MIN (-LLONG_MAX - 1LL)
-# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
-# endif
+#ifndef LLONG_MIN
+# define LLONG_MIN LONG_LONG_MIN
+#endif
+#ifndef LLONG_MAX
+# define LLONG_MAX LONG_LONG_MAX
+#endif
+#ifndef ULLONG_MAX
+# define ULLONG_MAX ULONG_LONG_MAX
#endif
@@ -1583,7 +1534,7 @@
if (val) *val = (double) SvIV(obj);
return SWIG_AddCast(SWIG_OK);
} else {
- const char *nptr = SvPV_nolen(obj);
+ const char *nptr = SvPV(obj, PL_na);
if (nptr) {
char *endptr;
double v = strtod(nptr, &endptr);
@@ -1593,7 +1544,7 @@
} else {
if (*endptr == '\0') {
if (val) *val = v;
- return SWIG_Str2NumCast(SWIG_OK);
+ return SWIG_AddCast(SWIG_OK);
}
}
}
@@ -1646,19 +1597,17 @@
return SWIG_OK;
} else {
int dispatch = 0;
- const char *nptr = SvPV_nolen(obj);
+ const char *nptr = SvPV(obj, PL_na);
if (nptr) {
char *endptr;
- long v;
- errno = 0;
- v = strtol(nptr, &endptr,0);
+ long v = strtol(nptr, &endptr,0);
if (errno == ERANGE) {
errno = 0;
return SWIG_OverflowError;
} else {
if (*endptr == '\0') {
if (val) *val = v;
- return SWIG_Str2NumCast(SWIG_OK);
+ return SWIG_AddCast(SWIG_OK);
}
}
}
@@ -1719,10 +1668,6 @@
return obj;
}
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#ifdef PERL_OBJECT
#define MAGIC_CLASS _wrap_ESL_var::
class _wrap_ESL_var : public CPerlObj {
@@ -1742,10 +1687,6 @@
#endif
#ifdef __cplusplus
-}
-#endif
-
-#ifdef __cplusplus
extern "C" {
#endif
XS(_wrap_ESLevent_event_set) {
@@ -1838,11 +1779,11 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_serialized_string_set" "', argument " "2"" of type '" "char *""'");
}
- arg2 = reinterpret_cast< char * >(buf2);
+ arg2 = buf2;
if (arg1->serialized_string) delete[] arg1->serialized_string;
if (arg2) {
- size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
- arg1->serialized_string = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
+ size_t size = strlen(arg2) + 1;
+ arg1->serialized_string = reinterpret_cast< char* >(memcpy((new char[size]), arg2, sizeof(char)*(size)));
} else {
arg1->serialized_string = 0;
}
@@ -1876,7 +1817,7 @@
}
arg1 = reinterpret_cast< ESLevent * >(argp1);
result = (char *) ((arg1)->serialized_string);
- ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+ ST(argvi) = SWIG_FromCharPtr(result); argvi++ ;
XSRETURN(argvi);
fail:
@@ -1973,13 +1914,13 @@
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ESLevent" "', argument " "1"" of type '" "char const *""'");
}
- arg1 = reinterpret_cast< char * >(buf1);
+ arg1 = buf1;
if (items > 1) {
res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_ESLevent" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = reinterpret_cast< char * >(buf2);
+ arg2 = buf2;
}
result = (ESLevent *)new ESLevent((char const *)arg1,(char const *)arg2);
ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
@@ -2222,10 +2163,10 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_serialize" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = reinterpret_cast< char * >(buf2);
+ arg2 = buf2;
}
result = (char *)(arg1)->serialize((char const *)arg2);
- ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+ ST(argvi) = SWIG_FromCharPtr(result); argvi++ ;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
XSRETURN(argvi);
@@ -2306,9 +2247,9 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_getHeader" "', argument " "2"" of type '" "char *""'");
}
- arg2 = reinterpret_cast< char * >(buf2);
+ arg2 = buf2;
result = (char *)(arg1)->getHeader(arg2);
- ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+ ST(argvi) = SWIG_FromCharPtr(result); argvi++ ;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
XSRETURN(argvi);
@@ -2338,7 +2279,7 @@
}
arg1 = reinterpret_cast< ESLevent * >(argp1);
result = (char *)(arg1)->getBody();
- ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+ ST(argvi) = SWIG_FromCharPtr(result); argvi++ ;
XSRETURN(argvi);
fail:
@@ -2366,7 +2307,7 @@
}
arg1 = reinterpret_cast< ESLevent * >(argp1);
result = (char *)(arg1)->getType();
- ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+ ST(argvi) = SWIG_FromCharPtr(result); argvi++ ;
XSRETURN(argvi);
fail:
@@ -2401,7 +2342,7 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_addBody" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = reinterpret_cast< char * >(buf2);
+ arg2 = buf2;
result = (bool)(arg1)->addBody((char const *)arg2);
ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
@@ -2444,12 +2385,12 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_addHeader" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = reinterpret_cast< char * >(buf2);
+ arg2 = buf2;
res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLevent_addHeader" "', argument " "3"" of type '" "char const *""'");
}
- arg3 = reinterpret_cast< char * >(buf3);
+ arg3 = buf3;
result = (bool)(arg1)->addHeader((char const *)arg2,(char const *)arg3);
ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
@@ -2490,7 +2431,7 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_delHeader" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = reinterpret_cast< char * >(buf2);
+ arg2 = buf2;
result = (bool)(arg1)->delHeader((char const *)arg2);
ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
@@ -2585,17 +2526,17 @@
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ESLconnection" "', argument " "1"" of type '" "char const *""'");
}
- arg1 = reinterpret_cast< char * >(buf1);
+ arg1 = buf1;
res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_ESLconnection" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = reinterpret_cast< char * >(buf2);
+ arg2 = buf2;
res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "new_ESLconnection" "', argument " "3"" of type '" "char const *""'");
}
- arg3 = reinterpret_cast< char * >(buf3);
+ arg3 = buf3;
result = (ESLconnection *)new ESLconnection((char const *)arg1,(char const *)arg2,(char const *)arg3);
ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLconnection, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
@@ -2826,7 +2767,7 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_send" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = reinterpret_cast< char * >(buf2);
+ arg2 = buf2;
result = (int)(arg1)->send((char const *)arg2);
ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
@@ -2865,7 +2806,7 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_sendRecv" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = reinterpret_cast< char * >(buf2);
+ arg2 = buf2;
result = (ESLevent *)(arg1)->sendRecv((char const *)arg2);
ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, 0 | SWIG_SHADOW); argvi++ ;
@@ -3116,12 +3057,12 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_filter" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = reinterpret_cast< char * >(buf2);
+ arg2 = buf2;
res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_filter" "', argument " "3"" of type '" "char const *""'");
}
- arg3 = reinterpret_cast< char * >(buf3);
+ arg3 = buf3;
result = (int)(arg1)->filter((char const *)arg2,(char const *)arg3);
ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
@@ -3166,12 +3107,12 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_events" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = reinterpret_cast< char * >(buf2);
+ arg2 = buf2;
res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_events" "', argument " "3"" of type '" "char const *""'");
}
- arg3 = reinterpret_cast< char * >(buf3);
+ arg3 = buf3;
result = (int)(arg1)->events((char const *)arg2,(char const *)arg3);
ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
@@ -3220,20 +3161,20 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_execute" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = reinterpret_cast< char * >(buf2);
+ arg2 = buf2;
if (items > 2) {
res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_execute" "', argument " "3"" of type '" "char const *""'");
}
- arg3 = reinterpret_cast< char * >(buf3);
+ arg3 = buf3;
}
if (items > 3) {
res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
if (!SWIG_IsOK(res4)) {
SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "ESLconnection_execute" "', argument " "4"" of type '" "char const *""'");
}
- arg4 = reinterpret_cast< char * >(buf4);
+ arg4 = buf4;
}
result = (int)(arg1)->execute((char const *)arg2,(char const *)arg3,(char const *)arg4);
ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
@@ -3277,7 +3218,7 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_setBlockingExecute" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = reinterpret_cast< char * >(buf2);
+ arg2 = buf2;
result = (int)(arg1)->setBlockingExecute((char const *)arg2);
ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
@@ -3316,7 +3257,7 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_setEventLock" "', argument " "2"" of type '" "char const *""'");
}
- arg2 = reinterpret_cast< char * >(buf2);
+ arg2 = buf2;
result = (int)(arg1)->setEventLock((char const *)arg2);
ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
@@ -3452,7 +3393,7 @@
* structures together.
*
* The generated swig_type_info structures are assigned staticly to an initial
- * array. We just loop through that array, and handle each type individually.
+ * array. We just loop though that array, and handle each type individually.
* First we lookup if this type has been already loaded, and if so, use the
* loaded structure instead of the generated one. Then we have to fill in the
* cast linked list. The cast data is initially stored in something like a
@@ -3490,58 +3431,32 @@
#define SWIGRUNTIME_DEBUG
#endif
-
SWIGRUNTIME void
SWIG_InitializeModule(void *clientdata) {
size_t i;
- swig_module_info *module_head, *iter;
- int found, init;
+ swig_module_info *module_head;
+ static int init_run = 0;
clientdata = clientdata;
- /* check to see if the circular list has been setup, if not, set it up */
- if (swig_module.next==0) {
- /* Initialize the swig_module */
- swig_module.type_initial = swig_type_initial;
- swig_module.cast_initial = swig_cast_initial;
- swig_module.next = &swig_module;
- init = 1;
- } else {
- init = 0;
- }
+ if (init_run) return;
+ init_run = 1;
+
+ /* Initialize the swig_module */
+ swig_module.type_initial = swig_type_initial;
+ swig_module.cast_initial = swig_cast_initial;
/* Try and load any already created modules */
module_head = SWIG_GetModule(clientdata);
- if (!module_head) {
- /* This is the first module loaded for this interpreter */
- /* so set the swig module into the interpreter */
- SWIG_SetModule(clientdata, &swig_module);
- module_head = &swig_module;
- } else {
- /* the interpreter has loaded a SWIG module, but has it loaded this one? */
- found=0;
- iter=module_head;
- do {
- if (iter==&swig_module) {
- found=1;
- break;
- }
- iter=iter->next;
- } while (iter!= module_head);
-
- /* if the is found in the list, then all is done and we may leave */
- if (found) return;
- /* otherwise we must add out module into the list */
+ if (module_head) {
swig_module.next = module_head->next;
module_head->next = &swig_module;
+ } else {
+ /* This is the first module loaded */
+ swig_module.next = &swig_module;
+ SWIG_SetModule(clientdata, &swig_module);
}
- /* When multiple interpeters are used, a module could have already been initialized in
- a different interpreter, but not yet have a pointer in this interpreter.
- In this case, we do not want to continue adding types... everything should be
- set up already */
- if (init == 0) return;
-
/* Now work on filling in swig_module.types */
#ifdef SWIGRUNTIME_DEBUG
printf("SWIG_InitializeModule: size %d\n", swig_module.size);
@@ -3695,7 +3610,7 @@
/* Install variables */
for (i = 0; swig_variables[i].name; i++) {
SV *sv;
- sv = get_sv((char*) swig_variables[i].name, TRUE | 0x2 | GV_ADDMULTI);
+ sv = get_sv((char*) swig_variables[i].name, TRUE | 0x2);
if (swig_variables[i].type) {
SWIG_MakePtr(sv,(void *)1, *swig_variables[i].type,0);
} else {
@@ -3707,7 +3622,7 @@
/* Install constant */
for (i = 0; swig_constants[i].type; i++) {
SV *sv;
- sv = get_sv((char*)swig_constants[i].name, TRUE | 0x2 | GV_ADDMULTI);
+ sv = get_sv((char*)swig_constants[i].name, TRUE | 0x2);
switch(swig_constants[i].type) {
case SWIG_INT:
sv_setiv(sv, (IV) swig_constants[i].lvalue);
Modified: freeswitch/trunk/src/mod/applications/mod_enum/mod_enum.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_enum/mod_enum.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_enum/mod_enum.c Tue Mar 3 14:16:05 2009
@@ -93,9 +93,9 @@
route = switch_core_alloc(globals.pool, sizeof(*route));
- route->service = strdup(service);
- route->regex = strdup(regex);
- route->replace = strdup(replace);
+ route->service = switch_core_strdup(globals.pool, service);
+ route->regex = switch_core_strdup(globals.pool, regex);
+ route->replace = switch_core_strdup(globals.pool, replace);
switch_mutex_lock(MUTEX);
if (!globals.route_order) {
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c Tue Mar 3 14:16:05 2009
@@ -2964,12 +2964,12 @@
while (mod_sofia_globals.threads) {
switch_cond_next();
- if (++sanity >= 10000) {
+ if (++sanity >= 60000) {
break;
}
}
- switch_yield(1000000);
+ //switch_yield(1000000);
su_deinit();
switch_mutex_lock(mod_sofia_globals.hash_mutex);
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c Tue Mar 3 14:16:05 2009
@@ -662,7 +662,7 @@
return NULL;
}
-void launch_sofia_worker_thread(sofia_profile_t *profile)
+switch_thread_t *launch_sofia_worker_thread(sofia_profile_t *profile)
{
switch_thread_t *thread;
switch_threadattr_t *thd_attr = NULL;
@@ -680,6 +680,8 @@
break;
}
}
+
+ return thread;
}
void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void *obj)
@@ -693,6 +695,8 @@
int use_timer = !sofia_test_pflag(profile, PFLAG_DISABLE_TIMER);
const char *supported = NULL;
int sanity;
+ switch_thread_t *worker_thread;
+ switch_status_t st;
switch_mutex_lock(mod_sofia_globals.mutex);
mod_sofia_globals.threads++;
@@ -823,7 +827,7 @@
profile->started = switch_epoch_time_now(NULL);
sofia_set_pflag_locked(profile, PFLAG_RUNNING);
- launch_sofia_worker_thread(profile);
+ worker_thread = launch_sofia_worker_thread(profile);
switch_yield(1000000);
@@ -850,15 +854,11 @@
sofia_reg_unregister(profile);
nua_shutdown(profile->nua);
su_root_run(profile->s_root);
- nua_shutdown(profile->nua);
- su_root_run(profile->s_root);
-
+
sofia_clear_pflag_locked(profile, PFLAG_RUNNING);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Waiting for worker thread\n");
- while (sofia_test_pflag(profile, PFLAG_WORKER_RUNNING)) {
- switch_yield(100000);
- }
+ switch_thread_join(&st, worker_thread);
sanity = 4;
while (profile->inuse) {
@@ -3243,10 +3243,7 @@
case nua_callstate_terminating:
if (status == 488 || switch_channel_get_state(channel) == CS_HIBERNATE) {
tech_pvt->q850_cause = SWITCH_CAUSE_MANDATORY_IE_MISSING;
- } else if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
- sofia_set_flag_locked(tech_pvt, TFLAG_BYE);
}
- break;
case nua_callstate_terminated:
if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
sofia_set_flag_locked(tech_pvt, TFLAG_BYE);
@@ -3274,17 +3271,17 @@
switch_channel_hangup(channel, cause);
}
}
-
- if (tech_pvt->sofia_private) {
- tech_pvt->sofia_private = NULL;
- }
-
- tech_pvt->nh = NULL;
-
-
- if (nh) {
- nua_handle_bind(nh, NULL);
- nua_handle_destroy(nh);
+ if (ss_state == nua_callstate_terminated) {
+ if (tech_pvt->sofia_private) {
+ tech_pvt->sofia_private = NULL;
+ }
+
+ tech_pvt->nh = NULL;
+
+ if (nh) {
+ nua_handle_bind(nh, NULL);
+ nua_handle_destroy(nh);
+ }
}
break;
}
Modified: freeswitch/trunk/src/switch_core.c
==============================================================================
--- freeswitch/trunk/src/switch_core.c (original)
+++ freeswitch/trunk/src/switch_core.c Tue Mar 3 14:16:05 2009
@@ -249,6 +249,20 @@
return val;
}
+static void switch_core_unset_variables(void)
+{
+ switch_hash_index_t *hi;
+ const void *var;
+ void *val;
+
+ switch_mutex_lock(runtime.global_var_mutex);
+ for (hi = switch_hash_first(NULL, runtime.global_vars); hi; hi = switch_hash_next(hi)) {
+ switch_hash_this(hi, &var, NULL, &val);
+ free(val);
+ }
+ switch_mutex_unlock(runtime.global_var_mutex);
+}
+
SWITCH_DECLARE(void) switch_core_set_variable(const char *varname, const char *value)
{
char *val;
@@ -1488,6 +1502,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Finalizing Shutdown.\n");
switch_log_shutdown();
+ switch_core_unset_variables();
switch_core_memory_stop();
if (runtime.console && runtime.console != stdout && runtime.console != stderr) {
Modified: freeswitch/trunk/src/switch_rtp.c
==============================================================================
--- freeswitch/trunk/src/switch_rtp.c (original)
+++ freeswitch/trunk/src/switch_rtp.c Tue Mar 3 14:16:05 2009
@@ -409,7 +409,26 @@
SWITCH_DECLARE(void) switch_rtp_shutdown(void)
{
+ switch_core_port_allocator_t *alloc = NULL;
+ switch_hash_index_t *hi;
+ const void *var;
+ void *val;
+
+ switch_mutex_lock(port_lock);
+
+ for (hi = switch_hash_first(NULL, alloc_hash); hi; hi = switch_hash_next(hi)) {
+ switch_hash_this(hi, &var, NULL, &val);
+ if ((alloc = (switch_core_port_allocator_t *) val)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Destroy port allocator for %s\n", (char *)var);
+ switch_core_port_allocator_destroy(&alloc);
+ }
+ }
+
switch_core_hash_destroy(&alloc_hash);
+ switch_mutex_unlock(port_lock);
+
+ crypto_kernel_shutdown();
+
}
SWITCH_DECLARE(switch_port_t) switch_rtp_set_start_port(switch_port_t port)
1
0
Author: mrene
Date: Tue Mar 3 13:01:21 2009
New Revision: 12391
Log:
Add switch_vmprintf
Modified:
freeswitch/trunk/src/include/switch_core_db.h
freeswitch/trunk/src/switch_core_db.c
Modified: freeswitch/trunk/src/include/switch_core_db.h
==============================================================================
--- freeswitch/trunk/src/include/switch_core_db.h (original)
+++ freeswitch/trunk/src/include/switch_core_db.h Tue Mar 3 13:01:21 2009
@@ -541,6 +541,11 @@
*/
SWITCH_DECLARE(char *) switch_mprintf(const char *zFormat, ...);
+/*!
+ * \see switch_mprintf
+ */
+SWITCH_DECLARE(char *) switch_vmprintf(const char *zFormat, va_list ap);
+
SWITCH_END_EXTERN_C
#endif
/* For Emacs:
Modified: freeswitch/trunk/src/switch_core_db.c
==============================================================================
--- freeswitch/trunk/src/switch_core_db.c (original)
+++ freeswitch/trunk/src/switch_core_db.c Tue Mar 3 13:01:21 2009
@@ -180,6 +180,12 @@
return z;
}
+SWITCH_DECLARE(char *) switch_vmprintf(const char *zFormat, va_list ap)
+{
+
+ return sqlite3_vmprintf(zFormat, ap);
+}
+
SWITCH_DECLARE(switch_core_db_t *) switch_core_db_open_file(char *filename)
{
switch_core_db_t *db;
1
0
Author: brian
Date: Tue Mar 3 12:03:25 2009
New Revision: 12390
Log:
FSCORE-317
Modified:
freeswitch/trunk/src/switch_core_speech.c
Modified: freeswitch/trunk/src/switch_core_speech.c
==============================================================================
--- freeswitch/trunk/src/switch_core_speech.c (original)
+++ freeswitch/trunk/src/switch_core_speech.c Tue Mar 3 12:03:25 2009
@@ -154,7 +154,7 @@
if (switch_test_flag(sh, SWITCH_SPEECH_FLAG_DONE)) {
switch_clear_flag(sh, SWITCH_SPEECH_FLAG_DONE);
*datalen = 0;
- return SWITCH_STATUS_FALSE;
+ return SWITCH_STATUS_BREAK;
}
more:
1
0
03 Mar '09
Author: mikej
Date: Tue Mar 3 11:27:41 2009
New Revision: 12388
Log:
Tue Mar 3 10:37:30 CST 2009 Pekka Pessi <first.last(a)nokia.com>
* s2check: added s2base.[hc], s2sip.[hc]
Ignore-this: 6a32b36a47a6f9dd2b5fec7c7375c564
Moved nua/test_s2 code here.
Added:
freeswitch/trunk/libs/sofia-sip/s2check/s2base.c
freeswitch/trunk/libs/sofia-sip/s2check/s2base.h
freeswitch/trunk/libs/sofia-sip/s2check/s2sip.c
freeswitch/trunk/libs/sofia-sip/s2check/s2sip.h
Modified:
freeswitch/trunk/libs/sofia-sip/.update
freeswitch/trunk/libs/sofia-sip/s2check/Makefile.am
Modified: freeswitch/trunk/libs/sofia-sip/.update
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/.update (original)
+++ freeswitch/trunk/libs/sofia-sip/.update Tue Mar 3 11:27:41 2009
@@ -1 +1 @@
-Tue Mar 3 11:25:58 CST 2009
+Tue Mar 3 11:27:12 CST 2009
Modified: freeswitch/trunk/libs/sofia-sip/s2check/Makefile.am
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/s2check/Makefile.am (original)
+++ freeswitch/trunk/libs/sofia-sip/s2check/Makefile.am Tue Mar 3 11:27:41 2009
@@ -19,6 +19,8 @@
# Rules for building the targets
libs2_a_SOURCES = s2check.h s2tcase.c \
+ s2base.h s2base.c \
+ s2sip.c s2sip.h \
s2_localinfo.h s2_localinfo.c \
s2dns.h s2dns.c \
s2util.h s2time.c
Added: freeswitch/trunk/libs/sofia-sip/s2check/s2base.c
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/sofia-sip/s2check/s2base.c Tue Mar 3 11:27:41 2009
@@ -0,0 +1,198 @@
+/*
+ * This file is part of the Sofia-SIP package
+ *
+ * Copyright (C) 2008 Nokia Corporation.
+ *
+ * Contact: Pekka Pessi <pekka.pessi(a)nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+/**@CFILE s2base.c
+ * @brief Common check-based tester for Sofia SIP modules
+ *
+ * @author Pekka Pessi <Pekka.Pessi(a)nokia.com>
+ *
+ * @date Created: Wed Apr 30 12:48:27 EEST 2008 ppessi
+ */
+
+#include "config.h"
+
+#undef NDEBUG
+
+#define TP_MAGIC_T struct tp_magic_s
+
+#include "s2base.h"
+
+#include <sofia-sip/sip_header.h>
+#include <sofia-sip/sip_status.h>
+#include <sofia-sip/msg_addr.h>
+#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 <sofia-sip/sresolv.h>
+
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+#include <limits.h>
+#include <time.h>
+
+#if HAVE_SYS_TIME_H
+#include <sys/time.h> /* Get struct timeval */
+#endif
+
+#if HAVE_CLOCK_GETTIME
+static double
+now(void)
+{
+ struct timespec tv;
+
+#if CLOCK_MONOTONIC
+ if (clock_gettime(CLOCK_MONOTONIC, &tv) != 0)
+#endif
+ clock_gettime(CLOCK_REALTIME, &tv);
+
+ return tv.tv_sec * 1.0 + tv.tv_nsec * 1e-9;
+}
+#elif HAVE_GETTIMEOFDAY
+static double
+now(void)
+{
+ struct timespec tv;
+
+ gettimeofday(&tv, NULL);
+
+ return tv.tv_sec * 1.0 + tv.tv_usec * 1e-6;
+}
+
+#else
+#error no gettimeofday for test timing
+#endif
+
+/* -- Module globals ---------------------------------------------------- */
+
+struct s2base *s2base;
+
+char const *s2_tester = "s2_tester";
+int s2_start_stop;
+
+char const *_s2_suite = "X";
+char const *_s2_case = "0.0";
+
+static struct {
+ double setup, start, done, toredown;
+} stamps;
+
+void s2_suite(char const *name)
+{
+ _s2_suite = name;
+}
+
+/** Basic setup for test cases */
+void s2_setup(char const *label)
+{
+ assert(s2base == NULL);
+
+ stamps.setup = now();
+
+ if (s2_start_stop > 1) {
+ printf("%s - setup %s test case\n", s2_tester, label ? label : "next");
+ }
+
+ su_init();
+
+ s2base = su_home_new(sizeof *s2base);
+ assert(s2base != NULL);
+
+ s2base->root = su_root_create(s2base);
+ assert(s2base->root != NULL);
+}
+
+void s2_case(char const *number,
+ char const *title,
+ char const *description)
+{
+ stamps.start = now();
+
+ _s2_case = number;
+ if (s2_start_stop)
+ printf("%s - starting %s/%s-%s\n", s2_tester, _s2_suite, _s2_case, title);
+}
+
+SOFIAPUBVAR su_log_t nua_log[];
+SOFIAPUBVAR su_log_t soa_log[];
+SOFIAPUBVAR su_log_t nea_log[];
+SOFIAPUBVAR su_log_t nta_log[];
+SOFIAPUBVAR su_log_t tport_log[];
+SOFIAPUBVAR su_log_t su_log_default[];
+
+void
+s2_setup_logs(int level)
+{
+ assert(s2base);
+
+ su_log_soft_set_level(nua_log, level);
+ su_log_soft_set_level(soa_log, level);
+ su_log_soft_set_level(su_log_default, level);
+ su_log_soft_set_level(nea_log, level);
+ su_log_soft_set_level(nta_log, level);
+ su_log_soft_set_level(tport_log, level);
+}
+
+void s2_step(void)
+{
+ su_root_step(s2base->root, 10);
+}
+
+static char const *s2_teardown_label = NULL;
+
+void
+s2_teardown_started(char const *label)
+{
+ stamps.done = now();
+
+ if (!s2_teardown_label) {
+ s2_teardown_label = label;
+ if (s2_start_stop > 1) {
+ double ms = (stamps.done - stamps.start) * 1000.0;
+ printf("%s - tearing down %s test case (%g ms)\n", s2_tester, label, ms);
+ }
+ }
+}
+
+void
+s2_teardown(void)
+{
+ struct s2base *_zap = s2base;
+
+ s2base = NULL;
+
+ su_root_destroy(_zap->root);
+ su_deinit();
+
+ stamps.toredown = now();
+
+ if (s2_start_stop > 1) {
+ double ms = (stamps.toredown - stamps.setup) * 1000.0;
+ printf("%s - %s test case tore down (total %g ms)\n", s2_tester,
+ s2_teardown_label ? s2_teardown_label : "previous", ms);
+ }
+
+ s2_teardown_label = NULL;
+}
Added: freeswitch/trunk/libs/sofia-sip/s2check/s2base.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/sofia-sip/s2check/s2base.h Tue Mar 3 11:27:41 2009
@@ -0,0 +1,54 @@
+/*
+ * This file is part of the Sofia-SIP package
+ *
+ * Copyright (C) 2008 Nokia Corporation.
+ *
+ * Contact: Pekka Pessi <pekka.pessi(a)nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#ifndef S2BASE_H
+#define S2BASE_H
+
+#include <sofia-sip/su_wait.h>
+#include <sofia-sip/su_alloc.h>
+#include "s2util.h"
+
+extern struct s2base
+{
+ su_home_t home[1];
+ su_root_t *root;
+} *s2base;
+
+extern char const *s2_tester, *_s2_suite, *_s2_case;
+extern int s2_start_stop;
+
+void s2_suite(char const *label);
+void s2_setup(char const *label);
+
+void s2_setup_logs(int level);
+
+void s2_step(void);
+
+void s2_case(char const *tag,
+ char const *title,
+ char const *description);
+
+void s2_teardown_started(char const *label);
+void s2_teardown(void);
+
+#endif
Added: freeswitch/trunk/libs/sofia-sip/s2check/s2sip.c
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/sofia-sip/s2check/s2sip.c Tue Mar 3 11:27:41 2009
@@ -0,0 +1,815 @@
+/*
+ * This file is part of the Sofia-SIP package
+ *
+ * Copyright (C) 2008 Nokia Corporation.
+ *
+ * Contact: Pekka Pessi <pekka.pessi(a)nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+/**@CFILE s2sip.c
+ * @brief Check-Based Test Suite for Sofia SIP
+ *
+ * @author Pekka Pessi <Pekka.Pessi(a)nokia.com>
+ *
+ * @date Created: Wed Apr 30 12:48:27 EEST 2008 ppessi
+ */
+
+#include "config.h"
+
+#undef NDEBUG
+
+#define TP_STACK_T struct s2sip
+#define TP_MAGIC_T struct tp_magic_s
+#define SU_ROOT_MAGIC_T struct s2sip
+
+#include "s2sip.h"
+#include "s2base.h"
+#include "s2dns.h"
+
+#include <sofia-sip/sip_header.h>
+#include <sofia-sip/sip_status.h>
+#include <sofia-sip/msg_addr.h>
+#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 <sofia-sip/sresolv.h>
+
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+#include <limits.h>
+#include <time.h>
+
+
+/* -- Module types ------------------------------------------------------ */
+
+struct tp_magic_s
+{
+ sip_via_t *via;
+ sip_contact_t *contact;
+};
+
+/* -- Module prototypes ------------------------------------------------- */
+
+static msg_t *s2_msg(int flags);
+static int s2_complete_response(msg_t *response,
+ int status, char const *phrase,
+ msg_t *request);
+
+/* -- Module globals ---------------------------------------------------- */
+
+struct s2sip *s2sip;
+
+/* ---------------------------------------------------------------------- */
+
+char *
+s2_sip_generate_tag(su_home_t *home)
+{
+ static unsigned s2_tag_generator = 0;
+
+ return su_sprintf(home, "tag=%s-%s/%u", _s2_suite, _s2_case, ++s2_tag_generator);
+}
+
+/* ---------------------------------------------------------------------- */
+/* SIP messages */
+
+struct message *
+s2_sip_remove_message(struct message *m)
+{
+ if ((*m->prev = m->next))
+ m->next->prev = m->prev;
+
+ m->prev = NULL, m->next = NULL;
+
+ return m;
+}
+
+void
+s2_sip_free_message(struct message *m)
+{
+ if (m) {
+ if (m->prev) {
+ if ((*m->prev = m->next))
+ m->next->prev = m->prev;
+ }
+ msg_destroy(m->msg);
+ tport_unref(m->tport);
+ free(m);
+ }
+}
+
+void s2_sip_flush_messages(void)
+{
+ while (s2sip->received) {
+ s2_sip_free_message(s2sip->received);
+ }
+}
+
+struct message *
+s2_sip_next_response(void)
+{
+ struct message *m;
+
+ for (;;) {
+ for (m = s2sip->received; m; m = m->next) {
+ if (m->sip->sip_status)
+ return s2_sip_remove_message(m);
+ }
+ s2_step();
+ }
+}
+
+struct message *
+s2_sip_wait_for_response(int status, sip_method_t method, char const *name)
+{
+ struct message *m;
+
+ for (;;) {
+ for (m = s2sip->received; m; m = m->next) {
+ if (!m->sip->sip_status)
+ continue;
+
+ if (status != 0 && m->sip->sip_status->st_status != status)
+ continue;
+
+ if (method == sip_method_unknown && name == NULL)
+ break;
+
+ if (m->sip->sip_cseq == NULL)
+ continue;
+
+ if (m->sip->sip_cseq->cs_method != method)
+ continue;
+ if (name == NULL)
+ break;
+ if (strcmp(m->sip->sip_cseq->cs_method_name, name) == 0)
+ break;
+ }
+
+ if (m)
+ return s2_sip_remove_message(m);
+
+ s2_step();
+ }
+}
+
+int
+s2_sip_check_response(int status, sip_method_t method, char const *name)
+{
+ struct message *m = s2_sip_wait_for_response(status, method, name);
+ s2_sip_free_message(m);
+ return m != NULL;
+}
+
+int
+s2_check_in_response(struct dialog *dialog,
+ int status, sip_method_t method, char const *name)
+{
+ struct message *m = s2_sip_wait_for_response(status, method, name);
+ s2_sip_update_dialog(dialog, m);
+ s2_sip_free_message(m);
+ return m != NULL;
+}
+
+struct message *
+s2_sip_next_request(sip_method_t method, char const *name)
+{
+ struct message *m;
+
+ for (m = s2sip->received; m; m = m->next) {
+ if (m->sip->sip_request)
+ if (method == sip_method_unknown && name == NULL)
+ return s2_sip_remove_message(m);
+
+ if (m->sip->sip_request->rq_method == method &&
+ strcmp(m->sip->sip_request->rq_method_name, name) == 0)
+ return s2_sip_remove_message(m);
+ }
+
+ return NULL;
+}
+
+struct message *
+s2_sip_wait_for_request(sip_method_t method, char const *name)
+{
+ return s2_sip_wait_for_request_timeout(method, name, (unsigned)-1);
+}
+
+struct message *
+s2_sip_wait_for_request_timeout(sip_method_t method, char const *name, unsigned steps)
+{
+ struct message *m;
+
+ for (; steps > 0; steps--, s2_step()) {
+ for (m = s2sip->received; m; m = m->next) {
+ if (m->sip->sip_request) {
+ if (method == sip_method_unknown && name == NULL)
+ return s2_sip_remove_message(m);
+
+ if (m->sip->sip_request->rq_method == method &&
+ strcmp(m->sip->sip_request->rq_method_name, name) == 0)
+ return s2_sip_remove_message(m);
+ }
+ }
+ }
+
+ return NULL;
+}
+
+int
+s2_sip_check_request(sip_method_t method, char const *name)
+{
+ struct message *m = s2_sip_wait_for_request(method, name);
+ if (m) s2_sip_free_message(m);
+ return m != NULL;
+}
+
+int
+s2_sip_check_request_timeout(sip_method_t method,
+ char const *name,
+ unsigned timeout)
+{
+ struct message *m = s2_sip_wait_for_request_timeout(method, name, timeout);
+ if (m) s2_sip_free_message(m);
+ return m != NULL;
+}
+
+void
+s2_sip_save_uas_dialog(struct dialog *d, sip_t *sip)
+{
+ if (d && !d->local) {
+ assert(sip->sip_request);
+ d->local = sip_from_dup(d->home, sip->sip_to);
+ if (d->local->a_tag == NULL)
+ sip_from_tag(d->home, d->local, s2_sip_generate_tag(d->home));
+ d->remote = sip_to_dup(d->home, sip->sip_from);
+ d->call_id = sip_call_id_dup(d->home, sip->sip_call_id);
+ d->rseq = sip->sip_cseq->cs_seq;
+ /* d->route = sip_route_dup(d->home, sip->sip_record_route); */
+ d->target = sip_contact_dup(d->home, sip->sip_contact);
+ }
+}
+
+struct message *
+s2_sip_respond_to(struct message *m, struct dialog *d,
+ int status, char const *phrase,
+ tag_type_t tag, tag_value_t value, ...)
+{
+ ta_list ta;
+ msg_t *reply;
+ sip_t *sip;
+ su_home_t *home;
+ tp_name_t tpn[1];
+ char *rport;
+
+ assert(m); assert(m->msg); assert(m->tport);
+ assert(100 <= status && status < 700);
+
+ s2_sip_save_uas_dialog(d, m->sip);
+
+ ta_start(ta, tag, value);
+
+ reply = s2_msg(0); sip = sip_object(reply); home = msg_home(reply);
+
+ assert(reply && home && sip);
+
+ if (sip_add_tl(reply, sip, ta_tags(ta)) < 0) {
+ abort();
+ }
+
+ s2_complete_response(reply, status, phrase, m->msg);
+
+ if (sip->sip_status && sip->sip_status->st_status > 100 &&
+ sip->sip_to && !sip->sip_to->a_tag &&
+ sip->sip_cseq && sip->sip_cseq->cs_method != sip_method_cancel) {
+ char const *ltag = NULL;
+
+ if (d && d->local)
+ ltag = d->local->a_tag;
+
+ if (ltag == NULL)
+ ltag = s2_sip_generate_tag(home);
+
+ if (sip_to_tag(msg_home(reply), sip->sip_to, ltag) < 0) {
+ assert(!"add To tag");
+ }
+ }
+
+ if (d && !d->contact) {
+ d->contact = sip_contact_dup(d->home, sip->sip_contact);
+ }
+
+ *tpn = *tport_name(m->tport);
+
+ rport = su_sprintf(home, "rport=%u",
+ ntohs(((su_sockaddr_t *)
+ msg_addrinfo(m->msg)->ai_addr)->su_port));
+
+ if (s2sip->server_uses_rport &&
+ sip->sip_via->v_rport &&
+ sip->sip_via->v_rport[0] == '\0') {
+ msg_header_add_param(home, sip->sip_via->v_common, rport);
+ }
+
+ tpn->tpn_port = rport + strlen("rport=");
+
+ tport_tsend(m->tport, reply, tpn, TPTAG_MTU(INT_MAX), ta_tags(ta));
+ msg_destroy(reply);
+
+ ta_end(ta);
+
+ return m;
+}
+
+/** Add headers from the request to the response message. */
+static int
+s2_complete_response(msg_t *response,
+ int status, char const *phrase,
+ msg_t *request)
+{
+ su_home_t *home = msg_home(response);
+ sip_t *response_sip = sip_object(response);
+ sip_t const *request_sip = sip_object(request);
+
+ int incomplete = 0;
+
+ if (!response_sip || !request_sip || !request_sip->sip_request)
+ return -1;
+
+ if (!response_sip->sip_status)
+ response_sip->sip_status = sip_status_create(home, status, phrase, NULL);
+ if (!response_sip->sip_via)
+ response_sip->sip_via = sip_via_dup(home, request_sip->sip_via);
+ if (!response_sip->sip_from)
+ response_sip->sip_from = sip_from_dup(home, request_sip->sip_from);
+ if (!response_sip->sip_to)
+ response_sip->sip_to = sip_to_dup(home, request_sip->sip_to);
+ if (!response_sip->sip_call_id)
+ response_sip->sip_call_id =
+ sip_call_id_dup(home, request_sip->sip_call_id);
+ if (!response_sip->sip_cseq)
+ response_sip->sip_cseq = sip_cseq_dup(home, request_sip->sip_cseq);
+
+ if (!response_sip->sip_record_route && request_sip->sip_record_route)
+ sip_add_dup(response, response_sip, (void*)request_sip->sip_record_route);
+
+ incomplete = sip_complete_message(response) < 0;
+
+ msg_serialize(response, (msg_pub_t *)response_sip);
+
+ if (incomplete ||
+ !response_sip->sip_status ||
+ !response_sip->sip_via ||
+ !response_sip->sip_from ||
+ !response_sip->sip_to ||
+ !response_sip->sip_call_id ||
+ !response_sip->sip_cseq ||
+ !response_sip->sip_content_length ||
+ !response_sip->sip_separator ||
+ (request_sip->sip_record_route && !response_sip->sip_record_route))
+ return -1;
+
+ return 0;
+}
+
+/* Send request (updating dialog).
+ *
+ * Return zero upon success, nonzero upon failure.
+ */
+int
+s2_sip_request_to(struct dialog *d,
+ sip_method_t method, char const *name,
+ tport_t *tport,
+ tag_type_t tag, tag_value_t value, ...)
+{
+ ta_list ta;
+ tagi_t const *tags;
+
+ msg_t *msg = s2_msg(0);
+ sip_t *sip = sip_object(msg);
+ url_t const *target = NULL;
+ sip_cseq_t cseq[1];
+ sip_via_t via[1]; char const *v_params[8];
+ sip_content_length_t l[1];
+ tp_name_t tpn[1];
+ tp_magic_t *magic;
+ int user_via = 0;
+
+ ta_start(ta, tag, value);
+ tags = ta_args(ta);
+
+ if (sip_add_tagis(msg, sip, &tags) < 0)
+ goto error;
+
+ if (sip->sip_request)
+ target = sip->sip_request->rq_url;
+ else if (d->target)
+ target = d->target->m_url;
+ else if (s2sip->sut.contact)
+ target = s2sip->sut.contact->m_url;
+ else
+ target = NULL;
+
+ if (target == NULL)
+ goto error;
+
+ if (!sip->sip_request) {
+ sip_request_t *rq;
+ rq = sip_request_create(msg_home(msg), method, name,
+ (url_string_t *)target, NULL);
+ sip_header_insert(msg, sip, (sip_header_t *)rq);
+ }
+
+ if (!d->local && sip->sip_from)
+ d->local = sip_from_dup(d->home, sip->sip_from);
+ if (!d->contact && sip->sip_contact)
+ d->contact = sip_contact_dup(d->home, sip->sip_contact);
+ if (!d->remote && sip->sip_to)
+ d->remote = sip_to_dup(d->home, sip->sip_to);
+ if (!d->target && sip->sip_request)
+ d->target = sip_contact_create(d->home,
+ (url_string_t *)sip->sip_request->rq_url,
+ NULL);
+ if (!d->call_id && sip->sip_call_id)
+ d->call_id = sip_call_id_dup(d->home, sip->sip_call_id);
+ if (!d->lseq && sip->sip_cseq)
+ d->lseq = sip->sip_cseq->cs_seq;
+
+ if (!d->local)
+ d->local = sip_from_dup(d->home, s2sip->aor);
+ if (!d->contact)
+ d->contact = sip_contact_dup(d->home, s2sip->contact);
+ if (!d->remote)
+ d->remote = sip_to_dup(d->home, s2sip->sut.aor);
+ if (!d->call_id)
+ d->call_id = sip_call_id_create(d->home, NULL);
+ assert(d->local && d->contact);
+ assert(d->remote && d->target);
+ assert(d->call_id);
+
+ if (tport == NULL)
+ tport = d->tport;
+
+ if (tport == NULL)
+ tport = s2sip->sut.tport;
+
+ if (tport == NULL && d->target->m_url->url_type == url_sips)
+ tport = s2sip->tls.tport;
+
+ if (tport == NULL)
+ tport = s2sip->udp.tport;
+ else if (tport == NULL)
+ tport = s2sip->tcp.tport;
+ else if (tport == NULL)
+ tport = s2sip->tls.tport;
+
+ assert(tport);
+
+ *tpn = *tport_name(tport);
+
+ if (tport_is_primary(tport)) {
+ tpn->tpn_host = target->url_host;
+ tpn->tpn_port = url_port(target);
+ if (!tpn->tpn_port || !tpn->tpn_port[0])
+ tpn->tpn_port = url_port_default(target->url_type);
+ }
+
+ magic = tport_magic(tport);
+ assert(magic != NULL);
+
+ sip_cseq_init(cseq);
+ cseq->cs_method = method;
+ cseq->cs_method_name = name;
+
+ if (d->invite && (method == sip_method_ack || method == sip_method_cancel)) {
+ cseq->cs_seq = sip_object(d->invite)->sip_cseq->cs_seq;
+ }
+ else {
+ cseq->cs_seq = ++d->lseq;
+ }
+
+ if (sip->sip_via) {
+ user_via = 1;
+ }
+ else if (d->invite && method == sip_method_cancel) {
+ *via = *sip_object(d->invite)->sip_via;
+ }
+ else {
+ *via = *magic->via;
+ via->v_params = v_params;
+ v_params[0] = su_sprintf(msg_home(msg), "branch=z9hG4bK%lx", ++s2sip->tid);
+ v_params[1] = NULL;
+ }
+
+ sip_content_length_init(l);
+ if (sip->sip_payload)
+ l->l_length = sip->sip_payload->pl_len;
+
+ if (d->local->a_tag == NULL) {
+ char const *ltag = s2_sip_generate_tag(d->home);
+
+ if (sip_from_tag(d->home, d->local, ltag) < 0) {
+ assert(!"add To tag");
+ }
+
+ if (sip->sip_from && sip->sip_from->a_tag == NULL) {
+ if (sip_from_tag(msg_home(msg), sip->sip_from, ltag) < 0) {
+ assert(!"add To tag");
+ }
+ }
+ }
+
+ sip_add_tl(msg, sip,
+ TAG_IF(!sip->sip_from, SIPTAG_FROM(d->local)),
+ TAG_IF(!sip->sip_contact, SIPTAG_CONTACT(d->contact)),
+ TAG_IF(!sip->sip_to, SIPTAG_TO(d->remote)),
+ TAG_IF(!sip->sip_call_id, SIPTAG_CALL_ID(d->call_id)),
+ TAG_IF(!sip->sip_cseq, SIPTAG_CSEQ(cseq)),
+ TAG_IF(!user_via, SIPTAG_VIA(via)),
+ TAG_IF(!sip->sip_content_length, SIPTAG_CONTENT_LENGTH(l)),
+ TAG_IF(!sip->sip_separator, SIPTAG_SEPARATOR_STR("\r\n")),
+ TAG_END());
+
+ msg_serialize(msg, NULL);
+
+ if (method == sip_method_invite) {
+ msg_destroy(d->invite);
+ d->invite = msg_ref_create(msg);
+ }
+
+ tport = tport_tsend(tport, msg, tpn, ta_tags(ta));
+ ta_end(ta);
+
+ if (d->tport != tport) {
+ tport_unref(d->tport);
+ d->tport = tport_ref(tport);
+ }
+
+ return tport ? 0 : -1;
+
+ error:
+ ta_end(ta);
+ return -1;
+}
+
+/** Save information from response.
+ *
+ * Send ACK for error messages to INVITE.
+ */
+int s2_sip_update_dialog(struct dialog *d, struct message *m)
+{
+ int status = 0;
+
+ if (m->sip->sip_status)
+ status = m->sip->sip_status->st_status;
+
+ if (100 < status && status < 300) {
+ d->remote = sip_to_dup(d->home, m->sip->sip_to);
+ if (m->sip->sip_contact)
+ d->contact = sip_contact_dup(d->home, m->sip->sip_contact);
+ }
+
+ if (300 <= status && m->sip->sip_cseq &&
+ m->sip->sip_cseq->cs_method == sip_method_invite &&
+ d->invite) {
+ msg_t *ack = s2_msg(0);
+ sip_t *sip = sip_object(ack);
+ sip_t *invite = sip_object(d->invite);
+ sip_request_t rq[1];
+ sip_cseq_t cseq[1];
+ tp_name_t tpn[1];
+
+ *rq = *invite->sip_request;
+ rq->rq_method = sip_method_ack, rq->rq_method_name = "ACK";
+ *cseq = *invite->sip_cseq;
+ cseq->cs_method = sip_method_ack, cseq->cs_method_name = "ACK";
+
+ sip_add_tl(ack, sip,
+ SIPTAG_REQUEST(rq),
+ SIPTAG_VIA(invite->sip_via),
+ SIPTAG_FROM(invite->sip_from),
+ SIPTAG_TO(invite->sip_to),
+ SIPTAG_CALL_ID(invite->sip_call_id),
+ SIPTAG_CSEQ(cseq),
+ SIPTAG_CONTENT_LENGTH_STR("0"),
+ SIPTAG_SEPARATOR_STR("\r\n"),
+ TAG_END());
+
+ *tpn = *tport_name(d->tport);
+ if (!tport_is_secondary(d->tport) ||
+ !tport_is_clear_to_send(d->tport)) {
+ tpn->tpn_host = rq->rq_url->url_host;
+ tpn->tpn_port = rq->rq_url->url_port;
+ }
+
+ msg_serialize(ack, NULL);
+ tport_tsend(d->tport, ack, tpn, TAG_END());
+ }
+
+ return 0;
+}
+
+/* ---------------------------------------------------------------------- */
+/* tport interface */
+static void
+s2_sip_stack_recv(struct s2sip *s2,
+ tport_t *tp,
+ msg_t *msg,
+ tp_magic_t *magic,
+ su_time_t now)
+{
+ struct message *next = calloc(1, sizeof *next), **prev;
+
+ next->msg = msg;
+ next->sip = sip_object(msg);
+ next->when = now;
+ next->tport = tport_ref(tp);
+
+#if 0
+ if (next->sip->sip_request)
+ printf("%s: sent: %s\n", s2tester, next->sip->sip_request->rq_method_name);
+ else
+ printf("%s: sent: SIP/2.0 %u %s\n", s2tester,
+ next->sip->sip_status->st_status,
+ next->sip->sip_status->st_phrase);
+#endif
+
+ for (prev = &s2->received; *prev; prev = &(*prev)->next)
+ ;
+
+ next->prev = prev, *prev = next;
+}
+
+static void
+s2_sip_stack_error(struct s2sip *s2,
+ tport_t *tp,
+ int errcode,
+ char const *remote)
+{
+ fprintf(stderr, "%s(%p): error %d (%s) from %s\n",
+ "s2_sip_error",
+ (void *)tp, errcode, su_strerror(errcode),
+ remote ? remote : "<unknown destination>");
+}
+
+static msg_t *
+s2_sip_stack_alloc(struct s2sip *s2sip, int flags,
+ char const data[], usize_t size,
+ tport_t const *tport,
+ tp_client_t *tpc)
+{
+ return msg_create(s2sip->mclass, flags | s2sip->flags);
+}
+
+static msg_t *
+s2_msg(int flags)
+{
+ return msg_create(s2sip->mclass, flags | s2sip->flags);
+}
+
+tp_stack_class_t const s2_sip_stack[1] =
+ {{
+ /* tpac_size */ (sizeof s2_sip_stack),
+ /* tpac_recv */ s2_sip_stack_recv,
+ /* tpac_error */ s2_sip_stack_error,
+ /* tpac_alloc */ s2_sip_stack_alloc,
+ }};
+
+static char const *default_protocols[] = { "udp", "tcp", NULL };
+
+/** Setup for SIP transports */
+void s2_sip_setup(char const *hostname,
+ char const * const *protocols,
+ tag_type_t tag, tag_value_t value, ...)
+{
+ su_home_t *home;
+ ta_list ta;
+ tp_name_t tpn[1];
+ int bound;
+ tport_t *tp;
+
+ assert(s2base != NULL);
+ assert(s2sip == NULL);
+
+ s2sip = su_home_new(sizeof *s2sip);
+ home = s2sip->home;
+
+ s2sip->root = su_root_clone(s2base->root, s2sip);
+
+ s2sip->aor = sip_from_format(home, "Bob <sip:bob@%s>",
+ hostname ? hostname : "example.net");
+ if (hostname == NULL)
+ hostname = "127.0.0.1";
+ s2sip->hostname = hostname;
+ s2sip->tid = (unsigned long)time(NULL) * 510633671UL;
+
+ ta_start(ta, tag, value);
+
+ s2sip->master = tport_tcreate(s2sip, s2_sip_stack, s2sip->root,
+ TPTAG_LOG(getenv("S2_TPORT_LOG") != NULL),
+ ta_tags(ta));
+ assert(s2sip->master);
+ s2sip->mclass = sip_default_mclass();
+ s2sip->flags = 0;
+
+ memset(tpn, 0, (sizeof tpn));
+ tpn->tpn_proto = "*";
+ tpn->tpn_host = "*";
+ tpn->tpn_port = "*";
+
+ if (protocols == NULL)
+ protocols = default_protocols;
+
+ bound = tport_tbind(s2sip->master, tpn, protocols,
+ TPTAG_SERVER(1),
+ ta_tags(ta));
+ assert(bound != -1);
+
+ tp = tport_primaries(s2sip->master);
+
+ *tpn = *tport_name(tp);
+ s2sip->contact = sip_contact_format(home, "<sip:%s:%s>",
+ tpn->tpn_host,
+ tpn->tpn_port);
+
+ for (;tp; tp = tport_next(tp)) {
+ sip_via_t *v;
+ sip_contact_t *m;
+ tp_magic_t *magic;
+
+ if (tport_magic(tp))
+ continue;
+
+ *tpn = *tport_name(tp);
+
+ v = sip_via_format(home, "SIP/2.0/%s %s:%s",
+ tpn->tpn_proto,
+ tpn->tpn_host,
+ tpn->tpn_port);
+ assert(v != NULL);
+ if (!su_casenmatch(tpn->tpn_proto, "tls", 3)) {
+ m = sip_contact_format(home, "<sip:%s:%s;transport=%s>",
+ tpn->tpn_host,
+ tpn->tpn_port,
+ tpn->tpn_proto);
+ if (s2sip->udp.contact == NULL && su_casematch(tpn->tpn_proto, "udp")) {
+ s2sip->udp.tport = tport_ref(tp);
+ s2sip->udp.contact = m;
+ }
+ if (s2sip->tcp.contact == NULL && su_casematch(tpn->tpn_proto, "tcp")) {
+ s2sip->tcp.tport = tport_ref(tp);
+ s2sip->tcp.contact = m;
+ }
+ }
+ else if (!su_casematch(tpn->tpn_proto, "tls")) {
+ m = sip_contact_format(s2sip->home, "<sips:%s:%s;transport=%s>",
+ tpn->tpn_host,
+ tpn->tpn_port,
+ tpn->tpn_proto);
+ }
+ else {
+ m = sip_contact_format(s2sip->home, "<sips:%s:%s>",
+ tpn->tpn_host,
+ tpn->tpn_port);
+ if (s2sip->tls.contact == NULL) {
+ s2sip->tls.tport = tport_ref(tp);
+ s2sip->tls.contact = m;
+ }
+ }
+ assert(m != NULL);
+
+ magic = su_zalloc(home, (sizeof *magic));
+ magic->via = v, magic->contact = m;
+
+ if (s2sip->contact == NULL)
+ s2sip->contact = m;
+
+ tport_set_magic(tp, magic);
+ }
+}
+
+void
+s2_sip_teardown(void)
+{
+ if (s2sip) {
+ tport_destroy(s2sip->master), s2sip->master = NULL;
+ su_root_destroy(s2sip->root), s2sip->root = NULL;
+ }
+}
Added: freeswitch/trunk/libs/sofia-sip/s2check/s2sip.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/sofia-sip/s2check/s2sip.h Tue Mar 3 11:27:41 2009
@@ -0,0 +1,124 @@
+/*
+ * This file is part of the Sofia-SIP package
+ *
+ * Copyright (C) 2008 Nokia Corporation.
+ *
+ * Contact: Pekka Pessi <pekka.pessi(a)nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#ifndef S2SIP_H
+#define S2SIP_H
+
+#include <sofia-sip/su_wait.h>
+#include <sofia-sip/sip.h>
+#include <sofia-sip/tport.h>
+#include <sofia-sip/nua.h>
+
+#include "s2util.h"
+
+extern struct s2sip
+{
+ su_home_t home[1];
+
+ su_root_t *root;
+ msg_mclass_t const *mclass;
+ int flags;
+
+ int server_uses_rport;
+
+ char const *hostname;
+ tport_t *master;
+
+ sip_to_t *aor;
+ sip_contact_t *contact;
+
+ struct {
+ sip_contact_t *contact;
+ tport_t *tport;
+ } udp, tcp, tls;
+
+ struct {
+ sip_to_t *aor;
+ sip_contact_t *contact;
+ tport_t *tport;
+ } sut;
+
+ struct message {
+ struct message *next, **prev;
+ msg_t *msg;
+ sip_t *sip;
+ tport_t *tport;
+ su_time_t when;
+ } *received;
+
+ unsigned long tid;
+} *s2sip;
+
+struct dialog
+{
+ su_home_t home[1];
+ sip_from_t *local;
+ sip_to_t *remote;
+ sip_call_id_t *call_id;
+ uint32_t lseq, rseq;
+ sip_contact_t *target;
+ sip_route_t *route;
+ sip_contact_t *contact;
+
+ tport_t *tport;
+ msg_t *invite; /* latest invite sent */
+};
+
+extern tp_stack_class_t const s2_sip_stack[1];
+
+char *s2_sip_generate_tag(su_home_t *home);
+
+struct message *s2_sip_remove_message(struct message *m);
+void s2_sip_free_message(struct message *m);
+void s2_sip_flush_messages(void);
+
+struct message *s2_sip_next_response(void);
+struct message *s2_sip_wait_for_response(int status, sip_method_t , char const *);
+int s2_sip_check_response(int status, sip_method_t method, char const *name);
+
+struct message *s2_sip_next_request(sip_method_t method, char const *name);
+struct message *s2_sip_wait_for_request(sip_method_t method, char const *name);
+struct message *s2_sip_wait_for_request_timeout(sip_method_t, char const *,
+ unsigned timeout);
+int s2_sip_check_request(sip_method_t method, char const *name);
+int s2_sip_check_request_timeout(sip_method_t method, char const *, unsigned timeout);
+
+void s2_sip_save_uas_dialog(struct dialog *d, sip_t *sip);
+
+struct message *s2_sip_respond_to(struct message *m, struct dialog *d,
+ int status, char const *phrase,
+ tag_type_t tag, tag_value_t value, ...);
+
+int s2_sip_request_to(struct dialog *d,
+ sip_method_t method, char const *name,
+ tport_t *tport,
+ tag_type_t tag, tag_value_t value, ...);
+
+int s2_sip_update_dialog(struct dialog *d, struct message *response);
+
+void s2_sip_setup(char const *hostname,
+ char const * const *protocols,
+ tag_type_t tag, tag_value_t value, ...);
+void s2_sip_teardown(void);
+
+#endif
1
0
[commit] r12387 - in freeswitch/trunk/libs/sofia-sip: . libsofia-sip-ua/nta
by FreeSWITCH SVN 03 Mar '09
by FreeSWITCH SVN 03 Mar '09
03 Mar '09
Author: mikej
Date: Tue Mar 3 11:26:13 2009
New Revision: 12387
Log:
Tue Mar 3 07:47:19 CST 2009 Pekka Pessi <first.last(a)nokia.com>
* nta: calculate timer D correctly
Ignore-this: f43d9dcc11fb6a19c3674a6da35ee7ec
Timer D is either 32 seconds or 64 times T1, whichever is larger.
Modified:
freeswitch/trunk/libs/sofia-sip/.update
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.c
Modified: freeswitch/trunk/libs/sofia-sip/.update
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/.update (original)
+++ freeswitch/trunk/libs/sofia-sip/.update Tue Mar 3 11:26:13 2009
@@ -1 +1 @@
-Tue Mar 3 11:25:14 CST 2009
+Tue Mar 3 11:25:58 CST 2009
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.c Tue Mar 3 11:26:13 2009
@@ -860,7 +860,7 @@
ta_start(ta, tag, value);
if ((agent = su_home_new(sizeof(*agent)))) {
- unsigned timer_c;
+ unsigned timer_c = 0, timer_d = 32000;
agent->sa_root = root;
agent->sa_callback = callback;
@@ -925,6 +925,11 @@
agent->sa_out.re_t1 = &agent->sa_out.re_list;
+ if (agent->sa_use_timer_c || !agent->sa_is_a_uas)
+ timer_c = agent->sa_timer_c;
+ if (timer_d < agent->sa_t1x64)
+ timer_d = agent->sa_t1x64;
+
outgoing_queue_init(agent->sa_out.delayed, 0);
outgoing_queue_init(agent->sa_out.resolving, 0);
outgoing_queue_init(agent->sa_out.trying, agent->sa_t1x64); /* F */
@@ -932,10 +937,8 @@
outgoing_queue_init(agent->sa_out.terminated, 0);
/* Special queues (states) for outgoing INVITE transactions */
outgoing_queue_init(agent->sa_out.inv_calling, agent->sa_t1x64); /* B */
- timer_c = (agent->sa_use_timer_c || !agent->sa_is_a_uas)
- ? agent->sa_timer_c : 0;
outgoing_queue_init(agent->sa_out.inv_proceeding, timer_c); /* C */
- outgoing_queue_init(agent->sa_out.inv_completed, 32000); /* Timer D */
+ outgoing_queue_init(agent->sa_out.inv_completed, timer_d); /* D */
if (leg_htable_resize(agent->sa_home, agent->sa_dialogs, 0) < 0 ||
leg_htable_resize(agent->sa_home, agent->sa_defaults, 0) < 0 ||
@@ -1446,6 +1449,7 @@
unsigned sip_t4 = agent->sa_t4;
unsigned sip_t1x64 = agent->sa_t1x64;
unsigned timer_c = agent->sa_timer_c;
+ unsigned timer_d = 32000;
unsigned graylist = agent->sa_graylist;
unsigned blacklist = agent->sa_blacklist;
int ua = agent->sa_is_a_uas;
@@ -1646,6 +1650,9 @@
agent->sa_timer_c = timer_c;
outgoing_queue_adjust(agent, agent->sa_out.inv_proceeding, timer_c);
}
+ if (timer_d < sip_t1x64)
+ timer_d = sip_t1x64;
+ outgoing_queue_adjust(agent, agent->sa_out.inv_completed, timer_d);
if (graylist > 24 * 60 * 60)
graylist = 24 * 60 * 60;
1
0
03 Mar '09
Author: mikej
Date: Tue Mar 3 11:25:39 2009
New Revision: 12386
Log:
Tue Mar 3 11:04:23 CST 2009 Pekka Pessi <first.last(a)nokia.com>
* s2check/Makefile.am: more clue about name
Modified:
freeswitch/trunk/libs/sofia-sip/.update
freeswitch/trunk/libs/sofia-sip/s2check/Makefile.am
Modified: freeswitch/trunk/libs/sofia-sip/.update
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/.update (original)
+++ freeswitch/trunk/libs/sofia-sip/.update Tue Mar 3 11:25:39 2009
@@ -1 +1 @@
-Tue Mar 3 11:24:11 CST 2009
+Tue Mar 3 11:25:14 CST 2009
Modified: freeswitch/trunk/libs/sofia-sip/s2check/Makefile.am
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/s2check/Makefile.am (original)
+++ freeswitch/trunk/libs/sofia-sip/s2check/Makefile.am Tue Mar 3 11:25:39 2009
@@ -1,5 +1,5 @@
#
-# Makefile.am for Sofia-SIP module and unit testing
+# Makefile.am for "Sofia-SIP 2 Check", module and unit testing library
#
# Copyright (C) 2009 Nokia Corporation
# Contact: Pekka Pessi <pekka.pessi(a)nokia.com>
1
0
Author: mikej
Date: Tue Mar 3 11:25:03 2009
New Revision: 12385
Log:
Tue Mar 3 11:03:53 CST 2009 Pekka Pessi <first.last(a)nokia.com>
* RELEASE: describe nta changes with forking, timer C, timer D, and CANCEL
Modified:
freeswitch/trunk/libs/sofia-sip/.update
freeswitch/trunk/libs/sofia-sip/RELEASE
Modified: freeswitch/trunk/libs/sofia-sip/.update
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/.update (original)
+++ freeswitch/trunk/libs/sofia-sip/.update Tue Mar 3 11:25:03 2009
@@ -1 +1 @@
-Tue Mar 3 11:23:38 CST 2009
+Tue Mar 3 11:24:11 CST 2009
Modified: freeswitch/trunk/libs/sofia-sip/RELEASE
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/RELEASE (original)
+++ freeswitch/trunk/libs/sofia-sip/RELEASE Tue Mar 3 11:25:03 2009
@@ -25,6 +25,16 @@
libsofia-sip-ua:
- **template**: Added foobar() function (sofia-sip/foobar.h).
+- Timing out CANCELed INVITE client transactions is now done with timer D.
+ Previously, the INVITE client transactions were restarted instead of
+ timing out under certain circumstances.
+- An INVITE transaction that has been timed out with stack timer C is now
+ CANCELed automatically. Previously, such the INVITE client transactions
+ were restarted instead of timing out under certain circumstances.
+- Timing out forked INVITE client transactions is now done by stack.
+ The stack generates a 408 response to each INVITE transaction fork that
+ has not received a final response within 32 seconds (or 64 times SIP T1)
+ after first final response to the INVITE was received.
- The mp_len type was changed from usize_t to unsigned.
The change is binary-incompatible on 64-bit platforms when compiled with
the configure opetion --disable-size-compat
@@ -42,6 +52,7 @@
- t_next_next(), t_next_move(), t_next_len(), t_next_dup(), t_next_filter()
- t_filter_with(), t_any_filter()
- sres_record_class()
+ - u2s_alloc()
libsofia-sip-ua-glib:
- No ABI/API changes, compatible with 1.12.0. Note, libsofia-sip-ua-glib
1
0