Merge remote-tracking branch 'origin/master' into ftdm_em_playback

This commit is contained in:
Moises Silva committed 2013-08-14 15:57:15 -04:00
commit 10908a0a8d
535 files changed
+16828 -11569

No files matched your search

+44 -1
View File
@@ -238,16 +238,48 @@ opal
/ldns/Makefile
/ldns/packaging/ldns-config
/libcodec2/src/c2dec
/libcodec2/src/c2demo
/libcodec2/src/c2enc
/libcodec2/src/c2sim
/libcodec2/src/codebook.c
/libcodec2/src/codebookd.c
/libcodec2/src/codebookdt.c
/libcodec2/src/codebookge.c
/libcodec2/src/codebookjnd.c
/libcodec2/src/codebookjvm.c
/libcodec2/src/codebookvqanssi.c
/libcodec2/src/fdmdv_demod
/libcodec2/src/fdmdv_get_test_bits
/libcodec2/src/fdmdv_interleave
/libcodec2/src/fdmdv_mod
/libcodec2/src/fdmdv_put_test_bits
/libcodec2/src/generate_codebook
/libcodec2/src/genlspdtcb
/libcodec2/unittest/create_interleaver
/libcodec2/unittest/de
/libcodec2/unittest/extract
/libcodec2/unittest/genampdata
/libcodec2/unittest/genlsp
/libcodec2/unittest/genphdata
/libcodec2/unittest/genres
/libcodec2/unittest/lspsync
/libcodec2/unittest/polar2rect
/libcodec2/unittest/pre
/libcodec2/unittest/scalarlsptest
/libcodec2/unittest/t48_8
/libcodec2/unittest/tcodec2
/libcodec2/unittest/tfdmdv
/libcodec2/unittest/tfifo
/libcodec2/unittest/tinterp
/libcodec2/unittest/tlspsens
/libcodec2/unittest/tnlp
/libcodec2/unittest/tprede
/libcodec2/unittest/tquant
/libcodec2/unittest/vq_train_jvm
/libcodec2/unittest/vqtrain
/libcodec2/unittest/vqtrainjnd
/libcodec2/unittest/vqtrainph
/libcodec2/unittest/vqtrainsp
/libdingaling/build/compile
/libdingaling/Makefile
/libdingaling/Makefile.in
@@ -355,6 +387,11 @@ opal
/libwebsockets/compile
/libwebsockets/test-server/Makefile
/libwebsockets/test-server/Makefile.in
/libwebsockets/test-server/libwebsockets-test-client
/libwebsockets/test-server/libwebsockets-test-fraggle
/libwebsockets/test-server/libwebsockets-test-ping
/libwebsockets/test-server/libwebsockets-test-server
/libwebsockets/test-server/libwebsockets-test-server-extpoll
/mongo-cxx-driver-v*/
/mpg123/
/libmpg123/
@@ -558,11 +595,13 @@ opal
/spandsp/src/Makefile.in
/spandsp/src/make_math_fixed_tables
/spandsp/src/make_modem_filter
/spandsp/src/make_t43_gray_code_tables
/spandsp/src/math_fixed_tables.h
/spandsp/src/msvc/All/BuildLog make_at_dictionary.htm
/spandsp/src/msvc/All/BuildLog make_modem_filter.htm
/spandsp/src/spandsp.h
/spandsp/src/stamp-h1
/spandsp/src/t43_gray_code_tables.h
/spandsp/src/v17_v32bis_rx_fixed_rrc.h
/spandsp/src/v17_v32bis_rx_floating_rrc.h
/spandsp/src/v17_v32bis_tx_fixed_rrc.h
@@ -923,9 +962,12 @@ opal
/sipcc/Makefile
/sipcc/Makefile.in
/yaml/
/yaml/Makefile
/yaml/config.h
/yaml/include/Makefile
/yaml/src/Makefile
/yaml/stamp-h1
/yaml/tests/Makefile
/yaml/tests/example-deconstructor
/yaml/tests/example-deconstructor-alt
/yaml/tests/example-reformatter
@@ -935,6 +977,7 @@ opal
/yaml/tests/run-loader
/yaml/tests/run-parser
/yaml/tests/run-scanner
/zeromq-*/
/jpeg-8d/
+25 -5
View File
@@ -57,6 +57,7 @@ typedef struct {
int debug;
const char *console_fnkeys[12];
char loglevel[128];
int log_uuid;
int quiet;
int batch_mode;
char prompt_color[12];
@@ -595,6 +596,7 @@ static const char *usage_str =
" -i, --interrupt Allow Control-c to interrupt\n"
" -x, --execute=command Execute Command and Exit\n"
" -l, --loglevel=command Log Level\n"
" -U, --log-uuid Include UUID in log output\n"
" -q, --quiet Disable logging\n"
" -r, --retry Retry connection on failure\n"
" -R, --reconnect Reconnect if disconnected\n"
@@ -745,10 +747,14 @@ static void *msg_thread_run(esl_thread_t *me, void *obj)
if (aok) {
if (feature_level) clear_line();
if(!(global_profile->batch_mode)) {
printf("%s%s", colors[level], handle->last_event->body);
printf("%s", colors[level]);
}
if (global_profile->log_uuid && !esl_strlen_zero(userdata)) {
printf("%s ", userdata);
}
printf("%s", handle->last_event->body);
if(!(global_profile->batch_mode)) {
if (!feature_level) printf("%s", ESL_SEQ_DEFAULT_COLOR);
} else {
printf("%s", handle->last_event->body);
}
if (feature_level) redisplay();
}
@@ -757,6 +763,10 @@ static void *msg_thread_run(esl_thread_t *me, void *obj)
if(!(global_profile->batch_mode)) {
SetConsoleTextAttribute(hStdout, colors[level]);
}
if (global_profile->log_uuid && !esl_strlen_zero(userdata)) {
WriteFile(hStdout, userdata, (DWORD)strlen(userdata), &outbytes, NULL);
WriteFile(hStdout, " ", (DWORD)strlen(" "), &outbytes, NULL);
}
WriteFile(hStdout, handle->last_event->body, len, &outbytes, NULL);
if(!(global_profile->batch_mode)) {
SetConsoleTextAttribute(hStdout, wOldColorAttrs);
@@ -1191,7 +1201,7 @@ static void read_config(const char *dft_cfile, const char *cfile) {
if (strcmp(cur_cat, cfg.category)) {
esl_set_string(cur_cat, cfg.category);
esl_set_string(profiles[pcount].name, cur_cat);
esl_set_string(profiles[pcount].host, "localhost");
esl_set_string(profiles[pcount].host, "127.0.0.1");
esl_set_string(profiles[pcount].pass, "ClueCon");
profiles[pcount].port = 8021;
set_fn_keys(&profiles[pcount]);
@@ -1221,6 +1231,8 @@ static void read_config(const char *dft_cfile, const char *cfile) {
}
} else if(!strcasecmp(var, "loglevel")) {
esl_set_string(profiles[pcount-1].loglevel, val);
} else if(!strcasecmp(var, "log-uuid")) {
profiles[pcount-1].log_uuid = esl_true(val);
} else if(!strcasecmp(var, "quiet")) {
profiles[pcount-1].quiet = esl_true(val);
} else if(!strcasecmp(var, "prompt-color")) {
@@ -1282,6 +1294,7 @@ int main(int argc, char *argv[])
{"debug", 1, 0, 'd'},
{"execute", 1, 0, 'x'},
{"loglevel", 1, 0, 'l'},
{"log-uuid", 0, 0, 'U'},
{"quiet", 0, 0, 'q'},
{"batchmode", 0, 0, 'b'},
{"retry", 0, 0, 'r'},
@@ -1303,6 +1316,7 @@ int main(int argc, char *argv[])
int argv_exec = 0;
char argv_command[1024] = "";
char argv_loglevel[128] = "";
int argv_log_uuid = 0;
int argv_quiet = 0;
int argv_batch = 0;
int loops = 2, reconnect = 0, timeout = 0;
@@ -1340,7 +1354,7 @@ int main(int argc, char *argv[])
esl_global_set_default_logger(6); /* default debug level to 6 (info) */
for(;;) {
int option_index = 0;
opt = getopt_long(argc, argv, "H:U:P:S:u:p:d:x:l:t:qrRhib?n", options, &option_index);
opt = getopt_long(argc, argv, "H:P:S:u:p:d:x:l:Ut:qrRhib?n", options, &option_index);
if (opt == -1) break;
switch (opt) {
case 'H':
@@ -1383,6 +1397,9 @@ int main(int argc, char *argv[])
case 'l':
esl_set_string(argv_loglevel, optarg);
break;
case 'U':
argv_log_uuid = 1;
break;
case 'q':
argv_quiet = 1;
break;
@@ -1445,6 +1462,9 @@ int main(int argc, char *argv[])
esl_set_string(profile->loglevel, argv_loglevel);
profile->quiet = 0;
}
if (argv_log_uuid) {
profile->log_uuid = 1;
}
esl_log(ESL_LOG_DEBUG, "Using profile %s [%s]\n", profile->name, profile->host);
esl_set_string(prompt_color, profile->prompt_color);
esl_set_string(input_text_color, profile->input_text_color);
+66 -3
View File
@@ -634,7 +634,70 @@ SWIGEXPORT jstring JNICALL Java_org_freeswitch_esl_eslJNI_ESLevent_1nextHeader(J
}
SWIGEXPORT jlong JNICALL Java_org_freeswitch_esl_eslJNI_new_1ESLconnection_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1, jstring jarg2, jstring jarg3, jstring jarg4) {
SWIGEXPORT jlong JNICALL Java_org_freeswitch_esl_eslJNI_new_1ESLconnection_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1, jint jarg2, jstring jarg3, jstring jarg4) {
jlong jresult = 0 ;
char *arg1 = (char *) 0 ;
int arg2 ;
char *arg3 = (char *) 0 ;
char *arg4 = (char *) 0 ;
ESLconnection *result = 0 ;
(void)jenv;
(void)jcls;
arg1 = 0;
if (jarg1) {
arg1 = (char *)jenv->GetStringUTFChars(jarg1, 0);
if (!arg1) return 0;
}
arg2 = (int)jarg2;
arg3 = 0;
if (jarg3) {
arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
if (!arg3) return 0;
}
arg4 = 0;
if (jarg4) {
arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0);
if (!arg4) return 0;
}
result = (ESLconnection *)new ESLconnection((char const *)arg1,arg2,(char const *)arg3,(char const *)arg4);
*(ESLconnection **)&jresult = result;
if (arg1) jenv->ReleaseStringUTFChars(jarg1, (const char *)arg1);
if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4);
return jresult;
}
SWIGEXPORT jlong JNICALL Java_org_freeswitch_esl_eslJNI_new_1ESLconnection_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jstring jarg1, jint jarg2, jstring jarg3) {
jlong jresult = 0 ;
char *arg1 = (char *) 0 ;
int arg2 ;
char *arg3 = (char *) 0 ;
ESLconnection *result = 0 ;
(void)jenv;
(void)jcls;
arg1 = 0;
if (jarg1) {
arg1 = (char *)jenv->GetStringUTFChars(jarg1, 0);
if (!arg1) return 0;
}
arg2 = (int)jarg2;
arg3 = 0;
if (jarg3) {
arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
if (!arg3) return 0;
}
result = (ESLconnection *)new ESLconnection((char const *)arg1,arg2,(char const *)arg3);
*(ESLconnection **)&jresult = result;
if (arg1) jenv->ReleaseStringUTFChars(jarg1, (const char *)arg1);
if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
return jresult;
}
SWIGEXPORT jlong JNICALL Java_org_freeswitch_esl_eslJNI_new_1ESLconnection_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jstring jarg1, jstring jarg2, jstring jarg3, jstring jarg4) {
jlong jresult = 0 ;
char *arg1 = (char *) 0 ;
char *arg2 = (char *) 0 ;
@@ -674,7 +737,7 @@ SWIGEXPORT jlong JNICALL Java_org_freeswitch_esl_eslJNI_new_1ESLconnection_1_1SW
}
SWIGEXPORT jlong JNICALL Java_org_freeswitch_esl_eslJNI_new_1ESLconnection_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jstring jarg1, jstring jarg2, jstring jarg3) {
SWIGEXPORT jlong JNICALL Java_org_freeswitch_esl_eslJNI_new_1ESLconnection_1_1SWIG_13(JNIEnv *jenv, jclass jcls, jstring jarg1, jstring jarg2, jstring jarg3) {
jlong jresult = 0 ;
char *arg1 = (char *) 0 ;
char *arg2 = (char *) 0 ;
@@ -707,7 +770,7 @@ SWIGEXPORT jlong JNICALL Java_org_freeswitch_esl_eslJNI_new_1ESLconnection_1_1SW
}
SWIGEXPORT jlong JNICALL Java_org_freeswitch_esl_eslJNI_new_1ESLconnection_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jint jarg1) {
SWIGEXPORT jlong JNICALL Java_org_freeswitch_esl_eslJNI_new_1ESLconnection_1_1SWIG_14(JNIEnv *jenv, jclass jcls, jint jarg1) {
jlong jresult = 0 ;
int arg1 ;
ESLconnection *result = 0 ;
@@ -33,16 +33,24 @@ public class ESLconnection {
swigCPtr = 0;
}
public ESLconnection(String host, String port, String user, String password) {
public ESLconnection(String host, int port, String user, String password) {
this(eslJNI.new_ESLconnection__SWIG_0(host, port, user, password), true);
}
public ESLconnection(String host, String port, String password) {
public ESLconnection(String host, int port, String password) {
this(eslJNI.new_ESLconnection__SWIG_1(host, port, password), true);
}
public ESLconnection(String host, String port, String user, String password) {
this(eslJNI.new_ESLconnection__SWIG_2(host, port, user, password), true);
}
public ESLconnection(String host, String port, String password) {
this(eslJNI.new_ESLconnection__SWIG_3(host, port, password), true);
}
public ESLconnection(int socket) {
this(eslJNI.new_ESLconnection__SWIG_2(socket), true);
this(eslJNI.new_ESLconnection__SWIG_4(socket), true);
}
public int socketDescriptor() {
+5 -3
View File
@@ -31,9 +31,11 @@ class eslJNI {
public final static native boolean ESLevent_delHeader(long jarg1, ESLevent jarg1_, String jarg2);
public final static native String ESLevent_firstHeader(long jarg1, ESLevent jarg1_);
public final static native String ESLevent_nextHeader(long jarg1, ESLevent jarg1_);
public final static native long new_ESLconnection__SWIG_0(String jarg1, String jarg2, String jarg3, String jarg4);
public final static native long new_ESLconnection__SWIG_1(String jarg1, String jarg2, String jarg3);
public final static native long new_ESLconnection__SWIG_2(int jarg1);
public final static native long new_ESLconnection__SWIG_0(String jarg1, int jarg2, String jarg3, String jarg4);
public final static native long new_ESLconnection__SWIG_1(String jarg1, int jarg2, String jarg3);
public final static native long new_ESLconnection__SWIG_2(String jarg1, String jarg2, String jarg3, String jarg4);
public final static native long new_ESLconnection__SWIG_3(String jarg1, String jarg2, String jarg3);
public final static native long new_ESLconnection__SWIG_4(int jarg1);
public final static native void delete_ESLconnection(long jarg1);
public final static native int ESLconnection_socketDescriptor(long jarg1, ESLconnection jarg1_);
public final static native int ESLconnection_connected(long jarg1, ESLconnection jarg1_);
+105 -5
View File
@@ -2231,6 +2231,63 @@ static const char *swig_ESLevent_base_names[] = {0};
static swig_lua_class _wrap_class_ESLevent = { "ESLevent", &SWIGTYPE_p_ESLevent,_wrap_new_ESLevent, swig_delete_ESLevent, swig_ESLevent_methods, swig_ESLevent_attributes, swig_ESLevent_bases, swig_ESLevent_base_names };
static int _wrap_new_ESLconnection__SWIG_0(lua_State* L) {
int SWIG_arg = -1;
char *arg1 = (char *) 0 ;
int arg2 ;
char *arg3 = (char *) 0 ;
char *arg4 = (char *) 0 ;
ESLconnection *result = 0 ;
SWIG_check_num_args("ESLconnection",4,4)
if(!lua_isstring(L,1)) SWIG_fail_arg("ESLconnection",1,"char const *");
if(!lua_isnumber(L,2)) SWIG_fail_arg("ESLconnection",2,"int const");
if(!lua_isstring(L,3)) SWIG_fail_arg("ESLconnection",3,"char const *");
if(!lua_isstring(L,4)) SWIG_fail_arg("ESLconnection",4,"char const *");
arg1 = (char *)lua_tostring(L, 1);
arg2 = (int const)lua_tonumber(L, 2);
arg3 = (char *)lua_tostring(L, 3);
arg4 = (char *)lua_tostring(L, 4);
result = (ESLconnection *)new ESLconnection((char const *)arg1,arg2,(char const *)arg3,(char const *)arg4);
SWIG_arg=0;
SWIG_NewPointerObj(L,result,SWIGTYPE_p_ESLconnection,1); SWIG_arg++;
return SWIG_arg;
if(0) SWIG_fail;
fail:
lua_error(L);
return SWIG_arg;
}
static int _wrap_new_ESLconnection__SWIG_1(lua_State* L) {
int SWIG_arg = -1;
char *arg1 = (char *) 0 ;
int arg2 ;
char *arg3 = (char *) 0 ;
ESLconnection *result = 0 ;
SWIG_check_num_args("ESLconnection",3,3)
if(!lua_isstring(L,1)) SWIG_fail_arg("ESLconnection",1,"char const *");
if(!lua_isnumber(L,2)) SWIG_fail_arg("ESLconnection",2,"int const");
if(!lua_isstring(L,3)) SWIG_fail_arg("ESLconnection",3,"char const *");
arg1 = (char *)lua_tostring(L, 1);
arg2 = (int const)lua_tonumber(L, 2);
arg3 = (char *)lua_tostring(L, 3);
result = (ESLconnection *)new ESLconnection((char const *)arg1,arg2,(char const *)arg3);
SWIG_arg=0;
SWIG_NewPointerObj(L,result,SWIGTYPE_p_ESLconnection,1); SWIG_arg++;
return SWIG_arg;
if(0) SWIG_fail;
fail:
lua_error(L);
return SWIG_arg;
}
static int _wrap_new_ESLconnection__SWIG_2(lua_State* L) {
int SWIG_arg = -1;
char *arg1 = (char *) 0 ;
char *arg2 = (char *) 0 ;
@@ -2260,7 +2317,7 @@ fail:
}
static int _wrap_new_ESLconnection__SWIG_1(lua_State* L) {
static int _wrap_new_ESLconnection__SWIG_3(lua_State* L) {
int SWIG_arg = -1;
char *arg1 = (char *) 0 ;
char *arg2 = (char *) 0 ;
@@ -2287,7 +2344,7 @@ fail:
}
static int _wrap_new_ESLconnection__SWIG_2(lua_State* L) {
static int _wrap_new_ESLconnection__SWIG_4(lua_State* L) {
int SWIG_arg = -1;
int arg1 ;
ESLconnection *result = 0 ;
@@ -2321,7 +2378,26 @@ static int _wrap_new_ESLconnection(lua_State* L) {
_v = lua_isnumber(L,argv[0]);
}
if (_v) {
return _wrap_new_ESLconnection__SWIG_2(L);
return _wrap_new_ESLconnection__SWIG_4(L);
}
}
if (argc == 3) {
int _v;
{
_v = lua_isstring(L,argv[0]);
}
if (_v) {
{
_v = lua_isnumber(L,argv[1]);
}
if (_v) {
{
_v = lua_isstring(L,argv[2]);
}
if (_v) {
return _wrap_new_ESLconnection__SWIG_1(L);
}
}
}
}
if (argc == 3) {
@@ -2338,7 +2414,31 @@ static int _wrap_new_ESLconnection(lua_State* L) {
_v = lua_isstring(L,argv[2]);
}
if (_v) {
return _wrap_new_ESLconnection__SWIG_1(L);
return _wrap_new_ESLconnection__SWIG_3(L);
}
}
}
}
if (argc == 4) {
int _v;
{
_v = lua_isstring(L,argv[0]);
}
if (_v) {
{
_v = lua_isnumber(L,argv[1]);
}
if (_v) {
{
_v = lua_isstring(L,argv[2]);
}
if (_v) {
{
_v = lua_isstring(L,argv[3]);
}
if (_v) {
return _wrap_new_ESLconnection__SWIG_0(L);
}
}
}
}
@@ -2361,7 +2461,7 @@ static int _wrap_new_ESLconnection(lua_State* L) {
_v = lua_isstring(L,argv[3]);
}
if (_v) {
return _wrap_new_ESLconnection__SWIG_0(L);
return _wrap_new_ESLconnection__SWIG_2(L);
}
}
}
+9 -3
View File
@@ -251,13 +251,19 @@ class ESLPINVOKE {
public static extern string ESLevent_NextHeader(HandleRef jarg1);
[DllImport("ESL", EntryPoint="CSharp_new_ESLconnection__SWIG_0")]
public static extern IntPtr new_ESLconnection__SWIG_0(string jarg1, string jarg2, string jarg3, string jarg4);
public static extern IntPtr new_ESLconnection__SWIG_0(string jarg1, int jarg2, string jarg3, string jarg4);
[DllImport("ESL", EntryPoint="CSharp_new_ESLconnection__SWIG_1")]
public static extern IntPtr new_ESLconnection__SWIG_1(string jarg1, string jarg2, string jarg3);
public static extern IntPtr new_ESLconnection__SWIG_1(string jarg1, int jarg2, string jarg3);
[DllImport("ESL", EntryPoint="CSharp_new_ESLconnection__SWIG_2")]
public static extern IntPtr new_ESLconnection__SWIG_2(int jarg1);
public static extern IntPtr new_ESLconnection__SWIG_2(string jarg1, string jarg2, string jarg3, string jarg4);
[DllImport("ESL", EntryPoint="CSharp_new_ESLconnection__SWIG_3")]
public static extern IntPtr new_ESLconnection__SWIG_3(string jarg1, string jarg2, string jarg3);
[DllImport("ESL", EntryPoint="CSharp_new_ESLconnection__SWIG_4")]
public static extern IntPtr new_ESLconnection__SWIG_4(int jarg1);
[DllImport("ESL", EntryPoint="CSharp_delete_ESLconnection")]
public static extern void delete_ESLconnection(HandleRef jarg1);
+9 -3
View File
@@ -38,13 +38,19 @@ public class ESLconnection : IDisposable {
}
}
public ESLconnection(string host, string port, string user, string password) : this(ESLPINVOKE.new_ESLconnection__SWIG_0(host, port, user, password), true) {
public ESLconnection(string host, int port, string user, string password) : this(ESLPINVOKE.new_ESLconnection__SWIG_0(host, port, user, password), true) {
}
public ESLconnection(string host, string port, string password) : this(ESLPINVOKE.new_ESLconnection__SWIG_1(host, port, password), true) {
public ESLconnection(string host, int port, string password) : this(ESLPINVOKE.new_ESLconnection__SWIG_1(host, port, password), true) {
}
public ESLconnection(int socket) : this(ESLPINVOKE.new_ESLconnection__SWIG_2(socket), true) {
public ESLconnection(string host, string port, string user, string password) : this(ESLPINVOKE.new_ESLconnection__SWIG_2(host, port, user, password), true) {
}
public ESLconnection(string host, string port, string password) : this(ESLPINVOKE.new_ESLconnection__SWIG_3(host, port, password), true) {
}
public ESLconnection(int socket) : this(ESLPINVOKE.new_ESLconnection__SWIG_4(socket), true) {
}
public int SocketDescriptor() {
+37 -3
View File
@@ -576,7 +576,41 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_ESLevent_NextHeader(void * jarg1) {
}
SWIGEXPORT void * SWIGSTDCALL CSharp_new_ESLconnection__SWIG_0(char * jarg1, char * jarg2, char * jarg3, char * jarg4) {
SWIGEXPORT void * SWIGSTDCALL CSharp_new_ESLconnection__SWIG_0(char * jarg1, int jarg2, char * jarg3, char * jarg4) {
void * jresult ;
char *arg1 = (char *) 0 ;
int arg2 ;
char *arg3 = (char *) 0 ;
char *arg4 = (char *) 0 ;
ESLconnection *result = 0 ;
arg1 = (char *)jarg1;
arg2 = (int)jarg2;
arg3 = (char *)jarg3;
arg4 = (char *)jarg4;
result = (ESLconnection *)new ESLconnection((char const *)arg1,arg2,(char const *)arg3,(char const *)arg4);
jresult = (void *)result;
return jresult;
}
SWIGEXPORT void * SWIGSTDCALL CSharp_new_ESLconnection__SWIG_1(char * jarg1, int jarg2, char * jarg3) {
void * jresult ;
char *arg1 = (char *) 0 ;
int arg2 ;
char *arg3 = (char *) 0 ;
ESLconnection *result = 0 ;
arg1 = (char *)jarg1;
arg2 = (int)jarg2;
arg3 = (char *)jarg3;
result = (ESLconnection *)new ESLconnection((char const *)arg1,arg2,(char const *)arg3);
jresult = (void *)result;
return jresult;
}
SWIGEXPORT void * SWIGSTDCALL CSharp_new_ESLconnection__SWIG_2(char * jarg1, char * jarg2, char * jarg3, char * jarg4) {
void * jresult ;
char *arg1 = (char *) 0 ;
char *arg2 = (char *) 0 ;
@@ -594,7 +628,7 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_new_ESLconnection__SWIG_0(char * jarg1, cha
}
SWIGEXPORT void * SWIGSTDCALL CSharp_new_ESLconnection__SWIG_1(char * jarg1, char * jarg2, char * jarg3) {
SWIGEXPORT void * SWIGSTDCALL CSharp_new_ESLconnection__SWIG_3(char * jarg1, char * jarg2, char * jarg3) {
void * jresult ;
char *arg1 = (char *) 0 ;
char *arg2 = (char *) 0 ;
@@ -610,7 +644,7 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_new_ESLconnection__SWIG_1(char * jarg1, cha
}
SWIGEXPORT void * SWIGSTDCALL CSharp_new_ESLconnection__SWIG_2(int jarg1) {
SWIGEXPORT void * SWIGSTDCALL CSharp_new_ESLconnection__SWIG_4(int jarg1) {
void * jresult ;
int arg1 ;
ESLconnection *result = 0 ;
+213 -14
View File
@@ -2673,6 +2673,117 @@ XS(_wrap_ESLevent_nextHeader) {
XS(_wrap_new_ESLconnection__SWIG_0) {
{
char *arg1 = (char *) 0 ;
int arg2 ;
char *arg3 = (char *) 0 ;
char *arg4 = (char *) 0 ;
ESLconnection *result = 0 ;
int res1 ;
char *buf1 = 0 ;
int alloc1 = 0 ;
int val2 ;
int ecode2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
int res4 ;
char *buf4 = 0 ;
int alloc4 = 0 ;
int argvi = 0;
dXSARGS;
if ((items < 4) || (items > 4)) {
SWIG_croak("Usage: new_ESLconnection(host,port,user,password);");
}
res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
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);
ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_ESLconnection" "', argument " "2"" of type '" "int""'");
}
arg2 = static_cast< int >(val2);
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);
res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
if (!SWIG_IsOK(res4)) {
SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "new_ESLconnection" "', argument " "4"" of type '" "char const *""'");
}
arg4 = reinterpret_cast< char * >(buf4);
result = (ESLconnection *)new ESLconnection((char const *)arg1,arg2,(char const *)arg3,(char const *)arg4);
ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLconnection, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
XSRETURN(argvi);
fail:
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
SWIG_croak_null();
}
}
XS(_wrap_new_ESLconnection__SWIG_1) {
{
char *arg1 = (char *) 0 ;
int arg2 ;
char *arg3 = (char *) 0 ;
ESLconnection *result = 0 ;
int res1 ;
char *buf1 = 0 ;
int alloc1 = 0 ;
int val2 ;
int ecode2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
int argvi = 0;
dXSARGS;
if ((items < 3) || (items > 3)) {
SWIG_croak("Usage: new_ESLconnection(host,port,password);");
}
res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
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);
ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_ESLconnection" "', argument " "2"" of type '" "int""'");
}
arg2 = static_cast< int >(val2);
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);
result = (ESLconnection *)new ESLconnection((char const *)arg1,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;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
XSRETURN(argvi);
fail:
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
SWIG_croak_null();
}
}
XS(_wrap_new_ESLconnection__SWIG_2) {
{
char *arg1 = (char *) 0 ;
char *arg2 = (char *) 0 ;
@@ -2734,7 +2845,7 @@ XS(_wrap_new_ESLconnection__SWIG_0) {
}
XS(_wrap_new_ESLconnection__SWIG_1) {
XS(_wrap_new_ESLconnection__SWIG_3) {
{
char *arg1 = (char *) 0 ;
char *arg2 = (char *) 0 ;
@@ -2785,7 +2896,7 @@ XS(_wrap_new_ESLconnection__SWIG_1) {
}
XS(_wrap_new_ESLconnection__SWIG_2) {
XS(_wrap_new_ESLconnection__SWIG_4) {
{
int arg1 ;
ESLconnection *result = 0 ;
@@ -2855,8 +2966,10 @@ XS(_wrap_new_ESLconnection) {
_rankm += _pi;
_pi *= SWIG_MAXCASTRANK;
{
int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
_v = SWIG_CheckState(res);
{
int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
_v = SWIG_CheckState(res);
}
}
if (!_v) goto check_2;
_ranki += _v*_pi;
@@ -2877,7 +2990,7 @@ XS(_wrap_new_ESLconnection) {
}
check_2:
if (items == 4) {
if (items == 3) {
SWIG_TypeRank _ranki = 0;
SWIG_TypeRank _rankm = 0;
SWIG_TypeRank _pi = 1;
@@ -2906,14 +3019,6 @@ XS(_wrap_new_ESLconnection) {
_ranki += _v*_pi;
_rankm += _pi;
_pi *= SWIG_MAXCASTRANK;
{
int res = SWIG_AsCharPtrAndSize(ST(3), 0, NULL, 0);
_v = SWIG_CheckState(res);
}
if (!_v) goto check_3;
_ranki += _v*_pi;
_rankm += _pi;
_pi *= SWIG_MAXCASTRANK;
if (!_index || (_ranki < _rank)) {
_rank = _ranki; _index = 3;
if (_rank == _rankm) goto dispatch;
@@ -2921,14 +3026,108 @@ XS(_wrap_new_ESLconnection) {
}
check_3:
if (items == 4) {
SWIG_TypeRank _ranki = 0;
SWIG_TypeRank _rankm = 0;
SWIG_TypeRank _pi = 1;
int _v = 0;
{
int res = SWIG_AsCharPtrAndSize(ST(0), 0, NULL, 0);
_v = SWIG_CheckState(res);
}
if (!_v) goto check_4;
_ranki += _v*_pi;
_rankm += _pi;
_pi *= SWIG_MAXCASTRANK;
{
{
int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
_v = SWIG_CheckState(res);
}
}
if (!_v) goto check_4;
_ranki += _v*_pi;
_rankm += _pi;
_pi *= SWIG_MAXCASTRANK;
{
int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
_v = SWIG_CheckState(res);
}
if (!_v) goto check_4;
_ranki += _v*_pi;
_rankm += _pi;
_pi *= SWIG_MAXCASTRANK;
{
int res = SWIG_AsCharPtrAndSize(ST(3), 0, NULL, 0);
_v = SWIG_CheckState(res);
}
if (!_v) goto check_4;
_ranki += _v*_pi;
_rankm += _pi;
_pi *= SWIG_MAXCASTRANK;
if (!_index || (_ranki < _rank)) {
_rank = _ranki; _index = 4;
if (_rank == _rankm) goto dispatch;
}
}
check_4:
if (items == 4) {
SWIG_TypeRank _ranki = 0;
SWIG_TypeRank _rankm = 0;
SWIG_TypeRank _pi = 1;
int _v = 0;
{
int res = SWIG_AsCharPtrAndSize(ST(0), 0, NULL, 0);
_v = SWIG_CheckState(res);
}
if (!_v) goto check_5;
_ranki += _v*_pi;
_rankm += _pi;
_pi *= SWIG_MAXCASTRANK;
{
int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
_v = SWIG_CheckState(res);
}
if (!_v) goto check_5;
_ranki += _v*_pi;
_rankm += _pi;
_pi *= SWIG_MAXCASTRANK;
{
int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
_v = SWIG_CheckState(res);
}
if (!_v) goto check_5;
_ranki += _v*_pi;
_rankm += _pi;
_pi *= SWIG_MAXCASTRANK;
{
int res = SWIG_AsCharPtrAndSize(ST(3), 0, NULL, 0);
_v = SWIG_CheckState(res);
}
if (!_v) goto check_5;
_ranki += _v*_pi;
_rankm += _pi;
_pi *= SWIG_MAXCASTRANK;
if (!_index || (_ranki < _rank)) {
_rank = _ranki; _index = 5;
if (_rank == _rankm) goto dispatch;
}
}
check_5:
dispatch:
switch(_index) {
case 1:
++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_ESLconnection__SWIG_2); return;
++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_ESLconnection__SWIG_4); return;
case 2:
++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_ESLconnection__SWIG_1); return;
case 3:
++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_ESLconnection__SWIG_3); return;
case 4:
++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_ESLconnection__SWIG_0); return;
case 5:
++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_ESLconnection__SWIG_2); return;
}
}
+121 -5
View File
@@ -1796,6 +1796,93 @@ fail:
ZEND_NAMED_FUNCTION(_wrap_new_ESLconnection__SWIG_0) {
char *arg1 = (char *) 0 ;
int arg2 ;
char *arg3 = (char *) 0 ;
char *arg4 = (char *) 0 ;
ESLconnection *result = 0 ;
zval **args[4];
SWIG_ResetError();
if(ZEND_NUM_ARGS() != 4 || zend_get_parameters_array_ex(4, args) != SUCCESS) {
WRONG_PARAM_COUNT;
}
/*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
convert_to_string_ex(args[0]);
arg1 = (char *) Z_STRVAL_PP(args[0]);
/*@SWIG@*/;
/*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,7,CONVERT_INT_IN@*/
convert_to_long_ex(args[1]);
arg2 = (int) Z_LVAL_PP(args[1]);
/*@SWIG@*/;
/*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
convert_to_string_ex(args[2]);
arg3 = (char *) Z_STRVAL_PP(args[2]);
/*@SWIG@*/;
/*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
convert_to_string_ex(args[3]);
arg4 = (char *) Z_STRVAL_PP(args[3]);
/*@SWIG@*/;
result = (ESLconnection *)new ESLconnection((char const *)arg1,arg2,(char const *)arg3,(char const *)arg4);
{
SWIG_SetPointerZval(return_value, (void *)result, SWIGTYPE_p_ESLconnection, 1);
}
return;
fail:
zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
}
ZEND_NAMED_FUNCTION(_wrap_new_ESLconnection__SWIG_1) {
char *arg1 = (char *) 0 ;
int arg2 ;
char *arg3 = (char *) 0 ;
ESLconnection *result = 0 ;
zval **args[3];
SWIG_ResetError();
if(ZEND_NUM_ARGS() != 3 || zend_get_parameters_array_ex(3, args) != SUCCESS) {
WRONG_PARAM_COUNT;
}
/*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
convert_to_string_ex(args[0]);
arg1 = (char *) Z_STRVAL_PP(args[0]);
/*@SWIG@*/;
/*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,7,CONVERT_INT_IN@*/
convert_to_long_ex(args[1]);
arg2 = (int) Z_LVAL_PP(args[1]);
/*@SWIG@*/;
/*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
convert_to_string_ex(args[2]);
arg3 = (char *) Z_STRVAL_PP(args[2]);
/*@SWIG@*/;
result = (ESLconnection *)new ESLconnection((char const *)arg1,arg2,(char const *)arg3);
{
SWIG_SetPointerZval(return_value, (void *)result, SWIGTYPE_p_ESLconnection, 1);
}
return;
fail:
zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
}
ZEND_NAMED_FUNCTION(_wrap_new_ESLconnection__SWIG_2) {
char *arg1 = (char *) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
@@ -1842,7 +1929,7 @@ fail:
}
ZEND_NAMED_FUNCTION(_wrap_new_ESLconnection__SWIG_1) {
ZEND_NAMED_FUNCTION(_wrap_new_ESLconnection__SWIG_3) {
char *arg1 = (char *) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
@@ -1882,7 +1969,7 @@ fail:
}
ZEND_NAMED_FUNCTION(_wrap_new_ESLconnection__SWIG_2) {
ZEND_NAMED_FUNCTION(_wrap_new_ESLconnection__SWIG_4) {
int arg1 ;
ESLconnection *result = 0 ;
zval **args[1];
@@ -1918,7 +2005,20 @@ ZEND_NAMED_FUNCTION(_wrap_new_ESLconnection) {
int _v;
_v = (Z_TYPE_PP(argv[0]) == IS_LONG);
if (_v) {
return _wrap_new_ESLconnection__SWIG_2(INTERNAL_FUNCTION_PARAM_PASSTHRU);
return _wrap_new_ESLconnection__SWIG_4(INTERNAL_FUNCTION_PARAM_PASSTHRU);
}
}
if (argc == 3) {
int _v;
_v = (Z_TYPE_PP(argv[0]) == IS_STRING);
if (_v) {
_v = (Z_TYPE_PP(argv[1]) == IS_LONG);
if (_v) {
_v = (Z_TYPE_PP(argv[2]) == IS_STRING);
if (_v) {
return _wrap_new_ESLconnection__SWIG_1(INTERNAL_FUNCTION_PARAM_PASSTHRU);
}
}
}
}
if (argc == 3) {
@@ -1929,7 +2029,23 @@ ZEND_NAMED_FUNCTION(_wrap_new_ESLconnection) {
if (_v) {
_v = (Z_TYPE_PP(argv[2]) == IS_STRING);
if (_v) {
return _wrap_new_ESLconnection__SWIG_1(INTERNAL_FUNCTION_PARAM_PASSTHRU);
return _wrap_new_ESLconnection__SWIG_3(INTERNAL_FUNCTION_PARAM_PASSTHRU);
}
}
}
}
if (argc == 4) {
int _v;
_v = (Z_TYPE_PP(argv[0]) == IS_STRING);
if (_v) {
_v = (Z_TYPE_PP(argv[1]) == IS_LONG);
if (_v) {
_v = (Z_TYPE_PP(argv[2]) == IS_STRING);
if (_v) {
_v = (Z_TYPE_PP(argv[3]) == IS_STRING);
if (_v) {
return _wrap_new_ESLconnection__SWIG_0(INTERNAL_FUNCTION_PARAM_PASSTHRU);
}
}
}
}
@@ -1944,7 +2060,7 @@ ZEND_NAMED_FUNCTION(_wrap_new_ESLconnection) {
if (_v) {
_v = (Z_TYPE_PP(argv[3]) == IS_STRING);
if (_v) {
return _wrap_new_ESLconnection__SWIG_0(INTERNAL_FUNCTION_PARAM_PASSTHRU);
return _wrap_new_ESLconnection__SWIG_2(INTERNAL_FUNCTION_PARAM_PASSTHRU);
}
}
}
+167 -5
View File
@@ -3786,6 +3786,124 @@ SWIGINTERN PyObject *ESLevent_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObj
}
SWIGINTERN PyObject *_wrap_new_ESLconnection__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
char *arg1 = (char *) 0 ;
int arg2 ;
char *arg3 = (char *) 0 ;
char *arg4 = (char *) 0 ;
ESLconnection *result = 0 ;
int res1 ;
char *buf1 = 0 ;
int alloc1 = 0 ;
int val2 ;
int ecode2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
int res4 ;
char *buf4 = 0 ;
int alloc4 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
PyObject * obj3 = 0 ;
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
if (!PyArg_ParseTuple(args,(char *)"OOOO:new_ESLconnection",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
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);
ecode2 = SWIG_AsVal_int(obj1, &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_ESLconnection" "', argument " "2"" of type '" "int""'");
}
arg2 = static_cast< int >(val2);
res3 = SWIG_AsCharPtrAndSize(obj2, &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);
res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
if (!SWIG_IsOK(res4)) {
SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "new_ESLconnection" "', argument " "4"" of type '" "char const *""'");
}
arg4 = reinterpret_cast< char * >(buf4);
{
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
result = (ESLconnection *)new ESLconnection((char const *)arg1,arg2,(char const *)arg3,(char const *)arg4);
SWIG_PYTHON_THREAD_END_ALLOW;
}
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLconnection, SWIG_POINTER_NEW | 0 );
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
SWIG_PYTHON_THREAD_END_BLOCK;
return resultobj;
fail:
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
SWIG_PYTHON_THREAD_END_BLOCK;
return NULL;
}
SWIGINTERN PyObject *_wrap_new_ESLconnection__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
char *arg1 = (char *) 0 ;
int arg2 ;
char *arg3 = (char *) 0 ;
ESLconnection *result = 0 ;
int res1 ;
char *buf1 = 0 ;
int alloc1 = 0 ;
int val2 ;
int ecode2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
if (!PyArg_ParseTuple(args,(char *)"OOO:new_ESLconnection",&obj0,&obj1,&obj2)) SWIG_fail;
res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
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);
ecode2 = SWIG_AsVal_int(obj1, &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_ESLconnection" "', argument " "2"" of type '" "int""'");
}
arg2 = static_cast< int >(val2);
res3 = SWIG_AsCharPtrAndSize(obj2, &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);
{
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
result = (ESLconnection *)new ESLconnection((char const *)arg1,arg2,(char const *)arg3);
SWIG_PYTHON_THREAD_END_ALLOW;
}
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLconnection, SWIG_POINTER_NEW | 0 );
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
SWIG_PYTHON_THREAD_END_BLOCK;
return resultobj;
fail:
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
SWIG_PYTHON_THREAD_END_BLOCK;
return NULL;
}
SWIGINTERN PyObject *_wrap_new_ESLconnection__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
char *arg1 = (char *) 0 ;
char *arg2 = (char *) 0 ;
@@ -3853,7 +3971,7 @@ fail:
}
SWIGINTERN PyObject *_wrap_new_ESLconnection__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
SWIGINTERN PyObject *_wrap_new_ESLconnection__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
char *arg1 = (char *) 0 ;
char *arg2 = (char *) 0 ;
@@ -3909,7 +4027,7 @@ fail:
}
SWIGINTERN PyObject *_wrap_new_ESLconnection__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
SWIGINTERN PyObject *_wrap_new_ESLconnection__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
int arg1 ;
ESLconnection *result = 0 ;
@@ -3957,7 +4075,26 @@ SWIGINTERN PyObject *_wrap_new_ESLconnection(PyObject *self, PyObject *args) {
}
if (_v) {
SWIG_PYTHON_THREAD_END_BLOCK;
return _wrap_new_ESLconnection__SWIG_2(self, args);
return _wrap_new_ESLconnection__SWIG_4(self, args);
}
}
if (argc == 3) {
int _v;
int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
_v = SWIG_CheckState(res);
if (_v) {
{
int res = SWIG_AsVal_int(argv[1], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
_v = SWIG_CheckState(res);
if (_v) {
SWIG_PYTHON_THREAD_END_BLOCK;
return _wrap_new_ESLconnection__SWIG_1(self, args);
}
}
}
}
if (argc == 3) {
@@ -3972,7 +4109,30 @@ SWIGINTERN PyObject *_wrap_new_ESLconnection(PyObject *self, PyObject *args) {
_v = SWIG_CheckState(res);
if (_v) {
SWIG_PYTHON_THREAD_END_BLOCK;
return _wrap_new_ESLconnection__SWIG_1(self, args);
return _wrap_new_ESLconnection__SWIG_3(self, args);
}
}
}
}
if (argc == 4) {
int _v;
int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
_v = SWIG_CheckState(res);
if (_v) {
{
int res = SWIG_AsVal_int(argv[1], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
_v = SWIG_CheckState(res);
if (_v) {
int res = SWIG_AsCharPtrAndSize(argv[3], 0, NULL, 0);
_v = SWIG_CheckState(res);
if (_v) {
SWIG_PYTHON_THREAD_END_BLOCK;
return _wrap_new_ESLconnection__SWIG_0(self, args);
}
}
}
}
@@ -3992,7 +4152,7 @@ SWIGINTERN PyObject *_wrap_new_ESLconnection(PyObject *self, PyObject *args) {
_v = SWIG_CheckState(res);
if (_v) {
SWIG_PYTHON_THREAD_END_BLOCK;
return _wrap_new_ESLconnection__SWIG_0(self, args);
return _wrap_new_ESLconnection__SWIG_2(self, args);
}
}
}
@@ -4003,6 +4163,8 @@ SWIGINTERN PyObject *_wrap_new_ESLconnection(PyObject *self, PyObject *args) {
fail:
SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_ESLconnection'.\n"
" Possible C/C++ prototypes are:\n"
" ESLconnection(char const *,int const,char const *,char const *)\n"
" ESLconnection(char const *,int const,char const *)\n"
" ESLconnection(char const *,char const *,char const *,char const *)\n"
" ESLconnection(char const *,char const *,char const *)\n"
" ESLconnection(int)\n");
+148 -5
View File
@@ -2745,6 +2745,107 @@ swig_class cESLconnection;
SWIGINTERN VALUE
_wrap_new_ESLconnection__SWIG_0(int argc, VALUE *argv, VALUE self) {
char *arg1 = (char *) 0 ;
int arg2 ;
char *arg3 = (char *) 0 ;
char *arg4 = (char *) 0 ;
ESLconnection *result = 0 ;
int res1 ;
char *buf1 = 0 ;
int alloc1 = 0 ;
int val2 ;
int ecode2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
int res4 ;
char *buf4 = 0 ;
int alloc4 = 0 ;
if ((argc < 4) || (argc > 4)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 4)",argc); SWIG_fail;
}
res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char const *","ESLconnection", 1, argv[0] ));
}
arg1 = reinterpret_cast< char * >(buf1);
ecode2 = SWIG_AsVal_int(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","ESLconnection", 2, argv[1] ));
}
arg2 = static_cast< int >(val2);
res3 = SWIG_AsCharPtrAndSize(argv[2], &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "char const *","ESLconnection", 3, argv[2] ));
}
arg3 = reinterpret_cast< char * >(buf3);
res4 = SWIG_AsCharPtrAndSize(argv[3], &buf4, NULL, &alloc4);
if (!SWIG_IsOK(res4)) {
SWIG_exception_fail(SWIG_ArgError(res4), Ruby_Format_TypeError( "", "char const *","ESLconnection", 4, argv[3] ));
}
arg4 = reinterpret_cast< char * >(buf4);
result = (ESLconnection *)new ESLconnection((char const *)arg1,arg2,(char const *)arg3,(char const *)arg4);DATA_PTR(self) = result;
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
return self;
fail:
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
return Qnil;
}
SWIGINTERN VALUE
_wrap_new_ESLconnection__SWIG_1(int argc, VALUE *argv, VALUE self) {
char *arg1 = (char *) 0 ;
int arg2 ;
char *arg3 = (char *) 0 ;
ESLconnection *result = 0 ;
int res1 ;
char *buf1 = 0 ;
int alloc1 = 0 ;
int val2 ;
int ecode2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
if ((argc < 3) || (argc > 3)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
}
res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char const *","ESLconnection", 1, argv[0] ));
}
arg1 = reinterpret_cast< char * >(buf1);
ecode2 = SWIG_AsVal_int(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","ESLconnection", 2, argv[1] ));
}
arg2 = static_cast< int >(val2);
res3 = SWIG_AsCharPtrAndSize(argv[2], &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "char const *","ESLconnection", 3, argv[2] ));
}
arg3 = reinterpret_cast< char * >(buf3);
result = (ESLconnection *)new ESLconnection((char const *)arg1,arg2,(char const *)arg3);DATA_PTR(self) = result;
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
return self;
fail:
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
return Qnil;
}
SWIGINTERN VALUE
_wrap_new_ESLconnection__SWIG_2(int argc, VALUE *argv, VALUE self) {
char *arg1 = (char *) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
@@ -2803,7 +2904,7 @@ fail:
SWIGINTERN VALUE
_wrap_new_ESLconnection__SWIG_1(int argc, VALUE *argv, VALUE self) {
_wrap_new_ESLconnection__SWIG_3(int argc, VALUE *argv, VALUE self) {
char *arg1 = (char *) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
@@ -2868,7 +2969,7 @@ _wrap_ESLconnection_allocate(VALUE self) {
SWIGINTERN VALUE
_wrap_new_ESLconnection__SWIG_2(int argc, VALUE *argv, VALUE self) {
_wrap_new_ESLconnection__SWIG_4(int argc, VALUE *argv, VALUE self) {
int arg1 ;
ESLconnection *result = 0 ;
int val1 ;
@@ -2907,7 +3008,25 @@ SWIGINTERN VALUE _wrap_new_ESLconnection(int nargs, VALUE *args, VALUE self) {
_v = SWIG_CheckState(res);
}
if (_v) {
return _wrap_new_ESLconnection__SWIG_2(nargs, args, self);
return _wrap_new_ESLconnection__SWIG_4(nargs, args, self);
}
}
if (argc == 3) {
int _v;
int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
_v = SWIG_CheckState(res);
if (_v) {
{
int res = SWIG_AsVal_int(argv[1], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_new_ESLconnection__SWIG_1(nargs, args, self);
}
}
}
}
if (argc == 3) {
@@ -2921,7 +3040,29 @@ SWIGINTERN VALUE _wrap_new_ESLconnection(int nargs, VALUE *args, VALUE self) {
int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_new_ESLconnection__SWIG_1(nargs, args, self);
return _wrap_new_ESLconnection__SWIG_3(nargs, args, self);
}
}
}
}
if (argc == 4) {
int _v;
int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
_v = SWIG_CheckState(res);
if (_v) {
{
int res = SWIG_AsVal_int(argv[1], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
_v = SWIG_CheckState(res);
if (_v) {
int res = SWIG_AsCharPtrAndSize(argv[3], 0, NULL, 0);
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_new_ESLconnection__SWIG_0(nargs, args, self);
}
}
}
}
@@ -2940,7 +3081,7 @@ SWIGINTERN VALUE _wrap_new_ESLconnection(int nargs, VALUE *args, VALUE self) {
int res = SWIG_AsCharPtrAndSize(argv[3], 0, NULL, 0);
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_new_ESLconnection__SWIG_0(nargs, args, self);
return _wrap_new_ESLconnection__SWIG_2(nargs, args, self);
}
}
}
@@ -2949,6 +3090,8 @@ SWIGINTERN VALUE _wrap_new_ESLconnection(int nargs, VALUE *args, VALUE self) {
fail:
Ruby_Format_OverloadedError( argc, 4, "ESLconnection.new",
" ESLconnection.new(char const *host, int const port, char const *user, char const *password)\n"
" ESLconnection.new(char const *host, int const port, char const *password)\n"
" ESLconnection.new(char const *host, char const *port, char const *user, char const *password)\n"
" ESLconnection.new(char const *host, char const *port, char const *password)\n"
" ESLconnection.new(int socket)\n");
+1 -1
View File
@@ -445,7 +445,7 @@ static esl_status_t esl_event_base_add_header(esl_event_t *event, esl_stack_t st
fly++;
}
if ((header = esl_event_get_header_ptr(event, header_name))) {
if (header || (header = esl_event_get_header_ptr(event, header_name))) {
if (index_ptr) {
if (index > -1 && index <= 4000) {
+14
View File
@@ -9,6 +9,20 @@ void eslSetLogLevel(int level)
esl_global_set_default_logger(level);
}
ESLconnection::ESLconnection(const char *host, const int port, const char *password)
{
connection_construct_common();
esl_connect(&handle, host, port, NULL, password);
}
ESLconnection::ESLconnection(const char *host, const int port, const char *user, const char *password)
{
connection_construct_common();
esl_connect(&handle, host, port, user, password);
}
ESLconnection::ESLconnection(const char *host, const char *port, const char *password)
{
connection_construct_common();
+2
View File
@@ -74,6 +74,8 @@ class ESLconnection {
private:
esl_handle_t handle;
public:
ESLconnection(const char *host, const int port, const char *user, const char *password);
ESLconnection(const char *host, const int port, const char *password);
ESLconnection(const char *host, const char *port, const char *user, const char *password);
ESLconnection(const char *host, const char *port, const char *password);
ESLconnection(int socket);
+3
View File
@@ -26,6 +26,9 @@ testr2
testsangomaboost
testtones
!/msvc/testanalog/
!/msvc/testboost/
!/sample/boost/Makefile
!/sample/dso/Makefile
+6 -2
View File
@@ -382,9 +382,12 @@ TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cm
break;
case 'L':
if (!LOOPING) {
ts->LOOPS = atoi(cur + 2);
int L;
if ((L = atoi(cur + 2)) > 0) {
ts->LOOPS = L;
LOOPING++;
}
}
LOOPING++;
break;
}
} else {
@@ -480,6 +483,7 @@ TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cm
bottom:
free(data);
data = NULL;
if (ts->LOOPS > 0) {
ts->LOOPS--;
}
+1 -1
View File
@@ -1 +1 @@
Tue May 14 07:44:21 CDT 2013
Mon Jul 15 16:57:11 CDT 2013
+1
View File
@@ -226,6 +226,7 @@ void iks_disconnect (iksparser *prs);
int iks_has_tls (void);
int iks_is_secure (iksparser *prs);
int iks_start_tls (iksparser *prs);
int iks_proceed_tls (iksparser *prs, const char *cert_file, const char *key_file, int use_ssl);
int iks_start_sasl (iksparser *prs, enum ikssasltype type, char *username, char *pass);
/***** jabber *****/
+69 -5
View File
@@ -35,6 +35,8 @@ typedef unsigned __int32 uint32_t;
#define SF_FOREIGN 1
#define SF_TRY_SECURE 2
#define SF_SECURE 4
#define SF_SERVER 8
#define SF_SSLv23 16
struct stream_data {
iksparser *prs;
@@ -51,6 +53,8 @@ struct stream_data {
unsigned int flags;
char *auth_username;
char *auth_pass;
char *cert_file;
char *key_file;
#ifdef HAVE_GNUTLS
gnutls_session sess;
gnutls_certificate_credentials cred;
@@ -201,6 +205,7 @@ handshake (struct stream_data *data)
gnutls_certificate_free_credentials (data->cred);
return IKS_NOMEM;
}
gnutls_protocol_set_priority (data->sess, protocol_priority);
gnutls_cipher_set_priority(data->sess, cipher_priority);
gnutls_compression_set_priority(data->sess, comp_priority);
@@ -224,7 +229,9 @@ handshake (struct stream_data *data)
data->flags &= (~SF_TRY_SECURE);
data->flags |= SF_SECURE;
iks_send_header (data->prs, data->server);
if (!(data->flags & SF_SERVER)) {
iks_send_header (data->prs, data->server);
}
return IKS_OK;
} // HAVE_GNUTLS
@@ -311,8 +318,25 @@ handshake (struct stream_data *data)
SSL_library_init();
SSL_load_error_strings();
data->ssl_ctx = SSL_CTX_new(TLSv1_method());
if(!data->ssl_ctx) return IKS_NOMEM;
if (data->flags & SF_SERVER) {
if (data->flags & SF_SSLv23) {
data->ssl_ctx = SSL_CTX_new(SSLv23_server_method());
} else {
data->ssl_ctx = SSL_CTX_new(TLSv1_server_method());
}
if(!data->ssl_ctx) return IKS_NOMEM;
if (SSL_CTX_use_certificate_file(data->ssl_ctx, data->cert_file, SSL_FILETYPE_PEM) <= 0) {
return IKS_NET_TLSFAIL;
}
if (SSL_CTX_use_PrivateKey_file(data->ssl_ctx, data->key_file, SSL_FILETYPE_PEM) <= 0) {
return IKS_NET_TLSFAIL;
}
SSL_CTX_set_verify(data->ssl_ctx, SSL_VERIFY_NONE, NULL);
} else {
data->ssl_ctx = SSL_CTX_new(TLSv1_method());
if(!data->ssl_ctx) return IKS_NOMEM;
}
data->ssl = SSL_new(data->ssl_ctx);
if(!data->ssl) return IKS_NOMEM;
@@ -329,7 +353,11 @@ handshake (struct stream_data *data)
do
{
ret = SSL_connect(data->ssl);
if (data->flags & SF_SERVER) {
ret = SSL_accept(data->ssl);
} else {
ret = SSL_connect(data->ssl);
}
if( ret != 1 )
{
@@ -346,7 +374,9 @@ handshake (struct stream_data *data)
data->flags &= (~SF_TRY_SECURE);
data->flags |= SF_SECURE;
iks_send_header (data->prs, data->server);
if (!(data->flags & SF_SERVER)) {
iks_send_header (data->prs, data->server);
}
}
return ret == 1 ? IKS_OK : IKS_NET_TLSFAIL;
@@ -954,6 +984,40 @@ iks_start_tls (iksparser *prs)
#endif
}
int
iks_proceed_tls (iksparser *prs, const char *cert_file, const char *key_file, int use_ssl)
{
#ifdef HAVE_GNUTLS
int ret;
struct stream_data *data = iks_user_data (prs);
ret = iks_send_raw (prs, "<proceed xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>");
if (ret) return ret;
data->cert_file = iks_stack_strdup(data->s, cert_file, 0);
data->key_file = iks_stack_strdup(data->s, key_file, 0);
data->flags |= SF_TRY_SECURE | SF_SERVER;
if (use_ssl) {
data->flags |= SF_SSLv23;
}
return handshake (data);
#elif HAVE_SSL
int ret;
struct stream_data *data = iks_user_data (prs);
ret = iks_send_raw (prs, "<proceed xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>");
if (ret) return ret;
data->cert_file = iks_stack_strdup(data->s, cert_file, 0);
data->key_file = iks_stack_strdup(data->s, key_file, 0);
data->flags |= SF_TRY_SECURE | SF_SERVER;
if (use_ssl) {
data->flags |= SF_SSLv23;
}
return handshake (data);
#else
return IKS_NET_NOTSUPP;
#endif
}
/***** sasl *****/
int
+6 -2
View File
@@ -382,9 +382,12 @@ TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cm
break;
case 'L':
if (!LOOPING) {
ts->LOOPS = atoi(cur + 2);
int L;
if ((L = atoi(cur + 2)) > 0) {
ts->LOOPS = L;
LOOPING++;
}
}
LOOPING++;
break;
}
} else {
@@ -480,6 +483,7 @@ TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cm
bottom:
free(data);
data = NULL;
if (ts->LOOPS > 0) {
ts->LOOPS--;
}
+3
View File
@@ -22,3 +22,6 @@ testisdn
testpri
testr2
testtones
!/msvc/testanalog/
!/msvc/testisdn/
+1 -1
View File
@@ -1 +1 @@
Tue Jun 25 09:28:40 CDT 2013
Mon Jul 29 16:07:25 CDT 2013
+25 -20
View File
@@ -152,9 +152,7 @@ struct nta_agent_s
nta_error_magic_t *sa_error_magic;
nta_error_tport_f *sa_error_tport;
su_time_t sa_now; /**< Timestamp in microsecond resolution. */
uint32_t sa_next; /**< Timestamp for next agent_timer. */
uint32_t sa_millisec; /**< Timestamp in milliseconds. */
msg_mclass_t const *sa_mclass;
uint32_t sa_flags; /**< SIP message flags */
@@ -1242,15 +1240,12 @@ void agent_timer(su_root_magic_t *rm, su_timer_t *timer, nta_agent_t *agent)
agent->sa_next = 0;
agent->sa_now = stamp;
agent->sa_millisec = now;
agent->sa_in_timer = 1;
_nta_outgoing_timer(agent);
_nta_incoming_timer(agent);
/* agent->sa_now is used only if sa_millisec != 0 */
agent->sa_millisec = 0;
agent->sa_in_timer = 0;
/* Calculate next timeout */
@@ -1335,12 +1330,12 @@ uint32_t set_timeout(nta_agent_t *agent, uint32_t offset)
if (offset == 0)
return 0;
if (agent->sa_millisec) /* Avoid expensive call to su_now() */
now = agent->sa_now, ms = agent->sa_millisec;
else
now = su_now(), ms = su_time_ms(now);
now = su_now();
ms = su_time_ms(now);
next = ms + offset; if (next == 0) next = 1;
next = ms + offset;
if (next == 0) next = 1;
if (agent->sa_in_timer) /* Currently executing timer */
return next;
@@ -1365,9 +1360,6 @@ uint32_t set_timeout(nta_agent_t *agent, uint32_t offset)
static
su_time_t agent_now(nta_agent_t const *agent)
{
if (agent && agent->sa_millisec != 0)
return agent->sa_now;
else
return su_now();
}
@@ -2784,8 +2776,6 @@ void agent_recv_message(nta_agent_t *agent,
{
sip_t *sip = sip_object(msg);
agent->sa_millisec = su_time_ms(agent->sa_now = now);
if (sip && sip->sip_request) {
agent_recv_request(agent, msg, sip, tport);
}
@@ -2795,8 +2785,6 @@ void agent_recv_message(nta_agent_t *agent,
else {
agent_recv_garbage(agent, msg, tport);
}
agent->sa_millisec = 0;
}
/** @internal Handle incoming requests. */
@@ -6869,7 +6857,7 @@ enum {
static void
_nta_incoming_timer(nta_agent_t *sa)
{
uint32_t now = sa->sa_millisec;
uint32_t now = su_time_ms(su_now());
nta_incoming_t *irq, *irq_next;
size_t retransmitted = 0, timeout = 0, terminated = 0, destroyed = 0;
size_t unconfirmed =
@@ -6886,6 +6874,9 @@ _nta_incoming_timer(nta_agent_t *sa)
/* Handle retry queue */
while ((irq = sa->sa_in.re_list)) {
now = su_time_ms(su_now());
if ((int32_t)(irq->irq_retry - now) > 0)
break;
if (retransmitted >= timer_max_retransmit)
@@ -6943,6 +6934,8 @@ _nta_incoming_timer(nta_agent_t *sa)
}
while ((irq = sa->sa_in.final_failed->q_head)) {
incoming_remove(irq);
irq->irq_final_failed = 0;
@@ -6974,6 +6967,8 @@ _nta_incoming_timer(nta_agent_t *sa)
assert(irq->irq_status < 200);
assert(irq->irq_timeout);
now = su_time_ms(su_now());
if ((int32_t)(irq->irq_timeout - now) > 0)
break;
if (timeout >= timer_max_timeout)
@@ -6994,6 +6989,8 @@ _nta_incoming_timer(nta_agent_t *sa)
assert(irq->irq_timeout);
assert(irq->irq_method == sip_method_invite);
now = su_time_ms(su_now());
if ((int32_t)(irq->irq_timeout - now) > 0 ||
timeout >= timer_max_timeout ||
terminated >= timer_max_terminate)
@@ -7022,6 +7019,8 @@ _nta_incoming_timer(nta_agent_t *sa)
assert(irq->irq_status >= 200);
assert(irq->irq_method == sip_method_invite);
now = su_time_ms(su_now());
if ((int32_t)(irq->irq_timeout - now) > 0 ||
terminated >= timer_max_terminate)
break;
@@ -7044,6 +7043,8 @@ _nta_incoming_timer(nta_agent_t *sa)
assert(irq->irq_timeout);
assert(irq->irq_method != sip_method_invite);
now = su_time_ms(su_now());
if ((int32_t)(irq->irq_timeout - now) > 0 ||
terminated >= timer_max_terminate)
break;
@@ -7063,6 +7064,7 @@ _nta_incoming_timer(nta_agent_t *sa)
}
for (irq = sa->sa_in.terminated->q_head; irq; irq = irq_next) {
irq_next = irq->irq_next;
if (irq->irq_destroyed)
incoming_free_queue(rq, irq);
@@ -8727,7 +8729,7 @@ void outgoing_destroy(nta_outgoing_t *orq)
static void
_nta_outgoing_timer(nta_agent_t *sa)
{
uint32_t now = sa->sa_millisec;
uint32_t now = su_time_ms(su_now());
nta_outgoing_t *orq;
outgoing_queue_t rq[1];
size_t retransmitted = 0, terminated = 0, timeout = 0, destroyed;
@@ -8741,6 +8743,9 @@ _nta_outgoing_timer(nta_agent_t *sa)
outgoing_queue_init(sa->sa_out.free = rq, 0);
while ((orq = sa->sa_out.re_list)) {
now = su_time_ms(su_now());
if ((int32_t)(orq->orq_retry - now) > 0)
break;
if (retransmitted >= timer_max_retransmit)
@@ -1062,11 +1062,15 @@ int nua_client_response(nua_client_request_t *cr,
sip_method_t method = cr->cr_method;
int terminated, graceful = 1;
if (status < 700)
terminated = sip_response_terminates_dialog(status, method, &graceful);
else
/* XXX - terminate usage by all internal error responses */
terminated = 0, graceful = 1;
if (status < 700) {
terminated = sip_response_terminates_dialog(status, method, &graceful);
if (terminated && !cr->cr_initial) {
terminated = 0, graceful = 1;
}
} else {
/* XXX - terminate usage by all internal error responses */
terminated = 0, graceful = 1;
}
if (terminated < 0)
cr->cr_terminated = terminated;
@@ -590,7 +590,7 @@ static void print_media(sdp_printer_t *p,
case sdp_proto_udp: proto = "udp"; break;
case sdp_proto_rtp: proto = "RTP/AVP"; break;
case sdp_proto_srtp: proto = "RTP/SAVP"; break;
case sdp_proto_extended_srtp: proto = "RTP/SAVPF"; break;
//case sdp_proto_extended_srtp: proto = "RTP/SAVPF"; break;
case sdp_proto_udptl: proto = "udptl"; break;
case sdp_proto_msrp: proto = "TCP/MSRP"; break;
case sdp_proto_msrps: proto = "TCP/TLS/MSRP"; break;
@@ -85,6 +85,11 @@ typedef uint64_t su_nanotime_t;
#define SU_E9 (1000000000U)
typedef void (*su_time_func_t)(su_time_t *tv);
SOFIAPUBFUN void su_set_time_func(su_time_func_t func);
SOFIAPUBFUN su_nanotime_t su_nanotime(su_nanotime_t *return_time);
SOFIAPUBFUN su_nanotime_t su_monotime(su_nanotime_t *return_time);
@@ -138,7 +143,7 @@ su_inline uint32_t su_ntp_fraq(su_time_t t)
/** Time as milliseconds. */
su_inline uint32_t su_time_ms(su_time_t t)
{
return t.tv_sec * 1000 + (t.tv_usec + 500) / 1000;
return (t.tv_sec * 1000) + ((t.tv_usec + 500) / 1000);
}
#endif
+20 -4
View File
@@ -69,6 +69,13 @@
void (*_su_time)(su_time_t *tv);
uint64_t (*_su_nanotime)(uint64_t *);
static su_time_func_t custom_time_func = NULL;
void su_set_time_func(su_time_func_t func) {
custom_time_func = func;
}
/** Get current time.
*
* The function @c su_time() fills its argument with the current NTP
@@ -78,7 +85,20 @@ uint64_t (*_su_nanotime)(uint64_t *);
*/
void su_time(su_time_t *tv)
{
#if HAVE_FILETIME
union {
FILETIME ft[1];
ULARGE_INTEGER ull[1];
} date;
#endif
su_time_t ltv = {0,0};
if (custom_time_func) {
custom_time_func(&ltv);
if (tv) *tv = ltv;
return;
}
#if HAVE_CLOCK_GETTIME
struct timespec ctv = {0};
if (clock_gettime(CLOCK_REALTIME, &ctv) == 0) {
@@ -91,10 +111,6 @@ void su_time(su_time_t *tv)
ltv.tv_sec += NTP_EPOCH;
#elif HAVE_FILETIME
union {
FILETIME ft[1];
ULARGE_INTEGER ull[1];
} date;
GetSystemTimeAsFileTime(date.ft);
+10 -6
View File
@@ -885,12 +885,16 @@ tport_t *tport_alloc_secondary(tport_primary_t *pri,
self->tp_stime = self->tp_ktime = self->tp_rtime = su_now();
if (pri->pri_vtable->vtp_init_secondary &&
pri->pri_vtable->vtp_init_secondary(self, socket, accepted,
return_reason) < 0) {
if (pri->pri_vtable->vtp_deinit_secondary)
pri->pri_vtable->vtp_deinit_secondary(self);
su_home_zap(self->tp_home);
return NULL;
pri->pri_vtable->vtp_init_secondary(self, socket, accepted, return_reason) < 0) {
if (pri->pri_vtable->vtp_deinit_secondary) {
pri->pri_vtable->vtp_deinit_secondary(self);
}
su_timer_destroy(self->tp_timer);
su_home_zap(self->tp_home);
return NULL;
}
/* Set IP TOS if it is set in primary */
@@ -207,23 +207,14 @@ int tport_recv_stream_ws(tport_t *self)
int err;
msg_iovec_t iovec[msg_n_fragments] = {{ 0 }};
tport_ws_t *wstp = (tport_ws_t *)self;
wsh_t *ws = wstp->ws;
tport_ws_primary_t *wspri = (tport_ws_primary_t *)self->tp_pri;
uint8_t *data;
ws_opcode_t oc;
if (wstp->ws_initialized < 0) {
return -1;
} else if (wstp->ws_initialized == 0) {
if (ws_init(ws, self->tp_socket, 65336, wstp->ws_secure ? wspri->ssl_ctx : NULL, 0) == -2) {
return 2;
}
wstp->ws_initialized = 1;
self->tp_pre_framed = 1;
return 1;
}
N = ws_read_frame(ws, &oc, &data);
N = ws_read_frame(&wstp->ws, &oc, &data);
if (N == -2) {
return 2;
@@ -276,7 +267,6 @@ ssize_t tport_send_stream_ws(tport_t const *self, msg_t *msg,
size_t i, j, n, m, size = 0;
ssize_t nerror;
tport_ws_t *wstp = (tport_ws_t *)self;
wsh_t *ws = wstp->ws;
enum { WSBUFSIZE = 2048 };
@@ -311,10 +301,10 @@ ssize_t tport_send_stream_ws(tport_t const *self, msg_t *msg,
iov[j].siv_base = buf, iov[j].siv_len = m;
}
nerror = ws_feed_buf(ws, buf, m);
nerror = ws_feed_buf(&wstp->ws, buf, m);
SU_DEBUG_9(("tport_ws_writevec: vec %p %p %lu ("MOD_ZD")\n",
(void *)ws, (void *)iov[i].siv_base, (LU)iov[i].siv_len,
(void *)&wstp->ws, (void *)iov[i].siv_base, (LU)iov[i].siv_len,
nerror));
if (nerror == -1) {
@@ -333,7 +323,7 @@ ssize_t tport_send_stream_ws(tport_t const *self, msg_t *msg,
break;
}
ws_send_buf(ws, WSOC_TEXT);
ws_send_buf(&wstp->ws, WSOC_TEXT);
return size;
@@ -446,13 +436,39 @@ int tport_ws_init_secondary(tport_t *self, int socket, int accepted,
self->tp_has_connection = 1;
if (setsockopt(socket, SOL_TCP, TCP_NODELAY, (void *)&one, sizeof one) == -1)
return *return_reason = "TCP_NODELAY", -1;
return *return_reason = "TCP_NODELAY", -1;
#if defined(SO_KEEPALIVE)
setsockopt(socket, SOL_SOCKET, SO_KEEPALIVE, (void *)&one, sizeof one);
#endif
one = 30;
#if defined(TCP_KEEPIDLE)
setsockopt(socket, SOL_TCP, TCP_KEEPIDLE, (void *)&one, sizeof one);
#endif
#if defined(TCP_KEEPINTVL)
setsockopt(socket, SOL_TCP, TCP_KEEPINTVL, (void *)&one, sizeof one);
#endif
if (!accepted)
tport_ws_setsndbuf(socket, 64 * 1024);
if ( wspri->ws_secure ) wstp->ws_secure = 1;
memset(&wstp->ws, 0, sizeof(wstp->ws));
if (ws_init(&wstp->ws, socket, wstp->ws_secure ? wspri->ssl_ctx : NULL, 0) < 0) {
ws_destroy(&wstp->ws);
su_close(socket);
wstp->ws_initialized = -1;
return *return_reason = "WS_INIT", -1;
}
wstp->ws_initialized = 1;
self->tp_pre_framed = 1;
return 0;
}
@@ -461,10 +477,9 @@ static void tport_ws_deinit_secondary(tport_t *self)
tport_ws_t *wstp = (tport_ws_t *)self;
if (wstp->ws_initialized == 1) {
wsh_t *wsh = wstp->ws;
SU_DEBUG_1(("%p destroy ws%s transport %p.\n", (void *) self, wstp->ws_secure ? "s" : "", (void *) wsh));
ws_destroy(&wsh);
wstp->ws_initialized = 1;
SU_DEBUG_1(("%p destroy ws%s transport %p.\n", (void *) self, wstp->ws_secure ? "s" : "", (void *) &wstp->ws));
ws_destroy(&wstp->ws);
wstp->ws_initialized = -1;
}
}
@@ -55,7 +55,7 @@ typedef enum {
typedef struct tport_ws_s {
tport_t wstp_tp[1];
wsh_t ws[1];
wsh_t ws;
char *wstp_buffer;
SU_S8_T ws_initialized;
unsigned ws_secure:1;
+105 -44
View File
@@ -1,5 +1,10 @@
#include "ws.h"
#include <pthread.h>
#ifndef _MSC_VER
#include <fcntl.h>
#endif
#define SHA1_HASH_SIZE 20
struct globals_s globals;
@@ -237,6 +242,10 @@ int ws_handshake(wsh_t *wsh)
}
}
if (bytes > sizeof(wsh->buffer)) {
goto err;
}
*(wsh->buffer+bytes) = '\0';
if (strncasecmp(wsh->buffer, "GET ", 4)) {
@@ -316,16 +325,17 @@ issize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes)
do {
r = recv(wsh->sock, data, bytes, 0);
#ifndef _MSC_VER
if (x++) usleep(10000);
if (x++) usleep(10000);
#else
if (x++) Sleep(10);
if (x++) Sleep(10);
#endif
} while (r == -1 && (errno == EAGAIN || errno == EINTR) && x < 100);
//if (r<0) {
// printf("READ FAIL: %s\n", strerror(errno));
//}
} while (r == -1 && (errno == EAGAIN || errno == EINTR || errno == EWOULDBLOCK ||
errno == 35 || errno == 730035 || errno == 2 || errno == 60) && x < 100);
if (x >= 100) {
r = -1;
}
return r;
}
@@ -352,7 +362,54 @@ issize_t ws_raw_write(wsh_t *wsh, void *data, size_t bytes)
return r;
}
int ws_init(wsh_t *wsh, ws_socket_t sock, size_t buflen, SSL_CTX *ssl_ctx, int close_sock)
#ifdef _MSC_VER
static int setup_socket(ws_socket_t sock)
{
unsigned long v = 1;
if (ioctlsocket(sock, FIONBIO, &v) == SOCKET_ERROR) {
return -1;
}
return 0;
}
static int restore_socket(ws_socket_t sock)
{
unsigned long v = 0;
if (ioctlsocket(sock, FIONBIO, &v) == SOCKET_ERROR) {
return -1;
}
return 0;
}
#else
static int setup_socket(ws_socket_t sock)
{
int flags = fcntl(sock, F_GETFL, 0);
return fcntl(sock, F_SETFL, flags | O_NONBLOCK);
}
static int restore_socket(ws_socket_t sock)
{
int flags = fcntl(sock, F_GETFL, 0);
flags &= ~O_NONBLOCK;
return fcntl(sock, F_SETFL, flags);
}
#endif
int ws_init(wsh_t *wsh, ws_socket_t sock, SSL_CTX *ssl_ctx, int close_sock)
{
memset(wsh, 0, sizeof(*wsh));
wsh->sock = sock;
@@ -365,21 +422,15 @@ int ws_init(wsh_t *wsh, ws_socket_t sock, size_t buflen, SSL_CTX *ssl_ctx, int c
wsh->close_sock = 1;
}
if (buflen > MAXLEN) {
buflen = MAXLEN;
}
wsh->buflen = buflen;
wsh->buflen = sizeof(wsh->buffer);
wsh->secure = ssl_ctx ? 1 : 0;
if (!wsh->buffer) {
wsh->buffer = malloc(wsh->buflen);
assert(wsh->buffer);
}
setup_socket(sock);
if (wsh->secure) {
int code;
int sanity = 500;
wsh->ssl = SSL_new(ssl_ctx);
assert(wsh->ssl);
@@ -387,12 +438,41 @@ int ws_init(wsh_t *wsh, ws_socket_t sock, size_t buflen, SSL_CTX *ssl_ctx, int c
do {
code = SSL_accept(wsh->ssl);
} while (code == -1 && SSL_get_error(wsh->ssl, code) == SSL_ERROR_WANT_READ);
if (code == 1) {
break;
}
if (code == 0) {
return -1;
}
if (code < 0) {
if (code == -1 && SSL_get_error(wsh->ssl, code) != SSL_ERROR_WANT_READ) {
return -1;
}
}
#ifndef _MSC_VER
usleep(10000);
#else
Sleep(10);
#endif
} while (--sanity > 0);
if (!sanity) {
return -1;
}
}
while (!wsh->down && !wsh->handshake) {
ws_handshake(wsh);
int r = ws_handshake(wsh);
if (r < 0) {
wsh->down = 1;
return -1;
}
}
if (wsh->down) {
@@ -402,17 +482,13 @@ int ws_init(wsh_t *wsh, ws_socket_t sock, size_t buflen, SSL_CTX *ssl_ctx, int c
return 0;
}
void ws_destroy(wsh_t **wshp)
void ws_destroy(wsh_t *wsh)
{
wsh_t *wsh;
if (!wshp || ! *wshp) {
if (!wsh) {
return;
}
wsh = *wshp;
*wshp = NULL;
if (!wsh->down) {
ws_close(wsh, WS_NONE);
}
@@ -432,16 +508,6 @@ void ws_destroy(wsh_t **wshp)
SSL_free(wsh->ssl);
wsh->ssl = NULL;
}
if (wsh->buffer) {
free(wsh->buffer);
wsh->buffer = NULL;
}
if (wsh->wbuffer) {
free(wsh->wbuffer);
wsh->wbuffer = NULL;
}
}
issize_t ws_close(wsh_t *wsh, int16_t reason)
@@ -462,6 +528,8 @@ issize_t ws_close(wsh_t *wsh, int16_t reason)
ws_raw_write(wsh, fr, 4);
}
restore_socket(wsh->sock);
if (wsh->close_sock) {
close(wsh->sock);
}
@@ -632,13 +700,6 @@ issize_t ws_feed_buf(wsh_t *wsh, void *data, size_t bytes)
return -1;
}
if (!wsh->wbuffer) {
wsh->wbuffer = malloc(wsh->buflen);
assert(wsh->wbuffer);
}
memcpy(wsh->wbuffer + wsh->wdatalen, data, bytes);
wsh->wdatalen += bytes;
+5 -7
View File
@@ -3,7 +3,6 @@
//#define WSS_STANDALONE 1
#define MAXLEN 0x10000
#define WEBSOCKET_GUID "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"
#define B64BUFFLEN 1024
@@ -59,8 +58,8 @@ typedef enum {
typedef struct wsh_s {
ws_socket_t sock;
char *buffer;
char *wbuffer;
char buffer[65536];
char wbuffer[65536];
size_t buflen;
issize_t datalen;
issize_t wdatalen;
@@ -71,8 +70,7 @@ typedef struct wsh_s {
int handshake;
uint8_t down;
int secure;
unsigned close_sock:1;
unsigned :0;
uint8_t close_sock;
} wsh_t;
issize_t ws_send_buf(wsh_t *wsh, ws_opcode_t oc);
@@ -83,9 +81,9 @@ issize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes);
issize_t ws_raw_write(wsh_t *wsh, void *data, size_t bytes);
issize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data);
issize_t ws_write_frame(wsh_t *wsh, ws_opcode_t oc, void *data, size_t bytes);
int ws_init(wsh_t *wsh, ws_socket_t sock, size_t buflen, SSL_CTX *ssl_ctx, int close_sock);
int ws_init(wsh_t *wsh, ws_socket_t sock, SSL_CTX *ssl_ctx, int close_sock);
issize_t ws_close(wsh_t *wsh, int16_t reason);
void ws_destroy(wsh_t **wshp);
void ws_destroy(wsh_t *wsh);
void init_ssl(void);
void deinit_ssl(void);
+256 -141
View File
@@ -1,121 +1,80 @@
Building and installing spandsp
===============================
A number of distributions include spandsp, but they usually use older versions
of the library, which lack a lot of the features of the current version. Before
installing spandsp, make sure there are no older versions already on your
machine. Make sure libtiff is installed on your machine. Versions 3.5.7,
3.6.0, 3.7.1 and 3.8.2 seem to work OK. There have been several bugs related
to FAX document handling in some versions of libtiff. Also, some people have
had trouble using spandsp because they had more than one version of libtiff
on their machine. Take care with this. If you are using an RPM based system,
such as RedHat or Fedora, you will need the libtiff and libtiff-devel RPMs
installed to be able to build spandsp.
You can use the usual:
./configure
make
make install
process to build the spandsp library. Note that if you use configure in this
way, the software will be installed in /usr/local. In this case make sure your
/etc/ld.so.conf file has an entry for /usr/local/lib. If you wish the software
to be installed in /usr, you should build it with the commands.
./configure --prefix=/usr
make
make install
Building the programming documentation
======================================
If you wish to build the programming documentation for spandsp, configure
spandsp with:
./configure --enable-doc
You need doxygen installed on your machine.
Building the test suite
=======================
Most sections of the spandsp library have an accompanying test program in the
test directory. If you wish to build these test programs, configure spandsp
with:
./configure --enable-tests
To build these tests you will need libaudiofile installed on your machine. To
build the modem tests, with the GUI monitoring feature you will need Fltk 1.1.4
or later, an audio meter module and a cartesian plotting module. Fltk may be
obtained from http://www.fltk.org. The audio meter module may be obtained from
http://www.soft-switch.org/downloads/Fl_Audio_Meter.tgz . The cartesian plotting
module may be obtained from http://134.226.68.29/fltk. However, there is no
suitable makefile supplied with that. You can find a version at
http://www.soft-switch.org/downloads/Fl_Cartesian.tgz which will build as a
Linux library. The actual code in both these versions is identical.
You need to have Fltk 1.1.4 or later installed before building the plotting
library.
Applications
============
Applications support for spandsp is built into packages such as Callweaver,
FreeSwitch and iaxmodem. Code to add spandsp based FAX support to Asterisk may
be found at http://sourceforge.net/projects/agx-ast-addons.
Installation Instructions
*************************
Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation,
Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved. This file is offered as-is,
without warranty of any kind.
Basic Installation
==================
These are generic installation instructions.
Briefly, the shell commands `./configure; make; make install' should
configure, build, and install this package. The following
more-detailed instructions are generic; see the `README' file for
instructions specific to this package. Some packages provide this
`INSTALL' file but do not implement all of the features documented
below. The lack of an optional feature in a given package is not
necessarily a bug. More recommendations for GNU packages can be found
in *note Makefile Conventions: (standards)Makefile Conventions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, a file
`config.cache' that saves the results of its tests to speed up
reconfiguring, and a file `config.log' containing compiler output
(useful mainly for debugging `configure').
you can run in the future to recreate the current configuration, and a
file `config.log' containing compiler output (useful mainly for
debugging `configure').
It can also use an optional file (typically called `config.cache'
and enabled with `--cache-file=config.cache' or simply `-C') that saves
the results of its tests to speed up reconfiguring. Caching is
disabled by default to prevent problems with accidental use of stale
cache files.
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If at some point `config.cache'
contains results you don't want to keep, you may remove or edit it.
be considered for the next release. If you are using the cache, and at
some point `config.cache' contains results you don't want to keep, you
may remove or edit it.
The file `configure.ac' is used to create `configure' by a program
called `autoconf'. You only need `configure.ac' if you want to change
it or regenerate `configure' using a newer version of `autoconf'.
The file `configure.ac' (or `configure.in') is used to create
`configure' by a program called `autoconf'. You need `configure.ac' if
you want to change it or regenerate `configure' using a newer version
of `autoconf'.
The simplest way to compile this package is:
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
`./configure' to configure the package for your system.
Running `configure' takes awhile. While running, it prints some
messages telling which features it is checking for.
Running `configure' might take a while. While running, it prints
some messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package.
the package, generally using the just-built uninstalled binaries.
4. Type `make install' to install the programs and any data files and
documentation.
documentation. When installing into a prefix owned by root, it is
recommended that the package be configured and built as a regular
user, and only the `make install' phase executed with root
privileges.
5. You can remove the program binaries and object files from the
5. Optionally, type `make installcheck' to repeat any self-tests, but
this time using the binaries in their final installed location.
This target does not install anything. Running this target as a
regular user, particularly if the prior `make install' required
root privileges, verifies that the installation completed
correctly.
6. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
@@ -124,62 +83,119 @@ The simplest way to compile this package is:
all sorts of other programs in order to regenerate files that came
with the distribution.
7. Often, you can also type `make uninstall' to remove the installed
files again. In practice, not all packages have tested that
uninstallation works correctly, even though it is required by the
GNU Coding Standards.
8. Some packages, particularly those that use Automake, provide `make
distcheck', which can by used by developers to test that all other
targets like `make install' and `make uninstall' work correctly.
This target is generally not run by end users.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. You can give `configure'
initial values for variables by setting them in the environment. Using
a Bourne-compatible shell, you can do that on the command line like
this:
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
the `configure' script does not know about. Run `./configure --help'
for details on some of the pertinent environment variables.
Or on systems that have the `env' program, you can do it like this:
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
You can give `configure' initial values for configuration parameters
by setting variables in the command line or in the environment. Here
is an example:
./configure CC=c99 CFLAGS=-g LIBS=-lposix
*Note Defining Variables::, for more details.
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
own directory. To do this, you can use GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
source code in the directory that `configure' is in and in `..'. This
is known as a "VPATH" build.
If you have to use a `make' that does not supports the `VPATH'
variable, you have to compile the package for one architecture at a time
in the source code directory. After you have installed the package for
one architecture, use `make distclean' before reconfiguring for another
architecture.
With a non-GNU `make', it is safer to compile the package for one
architecture at a time in the source code directory. After you have
installed the package for one architecture, use `make distclean' before
reconfiguring for another architecture.
On MacOS X 10.5 and later systems, you can create libraries and
executables that work on multiple system types--known as "fat" or
"universal" binaries--by specifying multiple `-arch' options to the
compiler but only a single `-arch' option to the preprocessor. Like
this:
./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
CPP="gcc -E" CXXCPP="g++ -E"
This is not guaranteed to produce working output in all cases, you
may have to build one architecture at a time and combine the results
using the `lipo' tool if you have problems.
Installation Names
==================
By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. You can specify an
installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PATH'.
By default, `make install' installs the package's commands under
`/usr/local/bin', include files under `/usr/local/include', etc. You
can specify an installation prefix other than `/usr/local' by giving
`configure' the option `--prefix=PREFIX', where PREFIX must be an
absolute file name.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PATH', the package will use
PATH as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.
pass the option `--exec-prefix=PREFIX' to `configure', the package uses
PREFIX as the prefix for installing programs and libraries.
Documentation and other data files still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=PATH' to specify different values for particular
options like `--bindir=DIR' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
you can set and what kinds of files go in them. In general, the
default for these options is expressed in terms of `${prefix}', so that
specifying just `--prefix' will affect all of the other directory
specifications that were not explicitly provided.
The most portable way to affect installation locations is to pass the
correct locations to `configure'; however, many packages provide one or
both of the following shortcuts of passing variable assignments to the
`make install' command line to change installation locations without
having to reconfigure or recompile.
The first method involves providing an override variable for each
affected directory. For example, `make install
prefix=/alternate/directory' will choose an alternate location for all
directory configuration variables that were expressed in terms of
`${prefix}'. Any directories that were specified during `configure',
but not in terms of `${prefix}', must each be overridden at install
time for the entire installation to be relocated. The approach of
makefile variable overrides for each directory variable is required by
the GNU Coding Standards, and ideally causes no recompilation.
However, some platforms have known limitations with the semantics of
shared libraries that end up requiring recompilation when using this
method, particularly noticeable in packages that use GNU Libtool.
The second method involves providing the `DESTDIR' variable. For
example, `make install DESTDIR=/alternate/directory' will prepend
`/alternate/directory' before all installation names. The approach of
`DESTDIR' overrides is not required by the GNU Coding Standards, and
does not work on platforms that have drive letters. On the other hand,
it does better at avoiding recompilation issues, and works well even
when some directory options were not specified in terms of `${prefix}'
at `configure' time.
Optional Features
=================
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
@@ -192,25 +208,80 @@ find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Some packages offer the ability to configure how verbose the
execution of `make' will be. For these packages, running `./configure
--enable-silent-rules' sets the default to minimal output, which can be
overridden with `make V=1'; while running `./configure
--disable-silent-rules' sets the default to verbose, which can be
overridden with `make V=0'.
Particular systems
==================
On HP-UX, the default C compiler is not ANSI C compatible. If GNU
CC is not installed, it is recommended to use the following options in
order to use an ANSI C compiler:
./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
and if that doesn't work, install pre-built binaries of GCC for HP-UX.
HP-UX `make' updates targets which have the same time stamps as
their prerequisites, which makes it generally unusable when shipped
generated files such as `configure' are involved. Use GNU `make'
instead.
On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
parse its `<wchar.h>' header file. The option `-nodtk' can be used as
a workaround. If GNU CC is not installed, it is therefore recommended
to try
./configure CC="cc"
and if that doesn't work, try
./configure CC="cc -nodtk"
On Solaris, don't put `/usr/ucb' early in your `PATH'. This
directory contains several dysfunctional programs; working variants of
these programs are available in `/usr/bin'. So, if you need `/usr/ucb'
in your `PATH', put it _after_ `/usr/bin'.
On Haiku, software installed for all users goes in `/boot/common',
not `/usr/local'. It is recommended to use the following options:
./configure --prefix=/boot/common
Specifying the System Type
==========================
There may be some features `configure' can not figure out
automatically, but needs to determine by the type of host the package
will run on. Usually `configure' can figure that out, but if it prints
a message saying it can not guess the host type, give it the
`--host=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name with three fields:
There may be some features `configure' cannot figure out
automatically, but needs to determine by the type of machine the package
will run on. Usually, assuming the package is built to be run on the
_same_ architectures, `configure' can figure that out, but if it prints
a message saying it cannot guess the machine type, give it the
`--build=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name which has the form:
CPU-COMPANY-SYSTEM
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the host type.
where SYSTEM can have one of these forms:
If you are building compiler tools for cross-compiling, you can also
use the `--target=TYPE' option to select the type of system they will
produce code for and the `--build=TYPE' option to select the type of
system on which you are compiling the package.
OS
KERNEL-OS
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the machine type.
If you are _building_ compiler tools for cross-compiling, you should
use the option `--target=TYPE' to select the type of system they will
produce code for.
If you want to _use_ a cross compiler, that generates code for a
platform different from the build platform, you should specify the
"host" platform (i.e., that on which the generated programs will
eventually be run) with `--host=TYPE'.
Sharing Defaults
================
@@ -223,19 +294,56 @@ default values for variables like `CC', `cache_file', and `prefix'.
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Operation Controls
Defining Variables
==================
Variables not defined in a site shell script can be set in the
environment passed to `configure'. However, some packages may run
configure again during the build, and the customized values of these
variables may be lost. In order to avoid this problem, you should set
them in the `configure' command line, using `VAR=value'. For example:
./configure CC=/usr/local2/bin/gcc
causes the specified `gcc' to be used as the C compiler (unless it is
overridden in the site shell script).
Unfortunately, this technique does not work for `CONFIG_SHELL' due to
an Autoconf limitation. Until the limitation is lifted, you can use
this workaround:
CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
`configure' Invocation
======================
`configure' recognizes the following options to control how it
operates.
`--cache-file=FILE'
Use and save the results of the tests in FILE instead of
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
debugging `configure'.
`--help'
Print a summary of the options to `configure', and exit.
`-h'
Print a summary of all of the options to `configure', and exit.
`--help=short'
`--help=recursive'
Print a summary of the options unique to this package's
`configure', and exit. The `short' variant lists options used
only in the top level, while the `recursive' variant lists options
also present in any nested packages.
`--version'
`-V'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`--cache-file=FILE'
Enable the cache: use and save the results of the tests in FILE,
traditionally `config.cache'. FILE defaults to `/dev/null' to
disable caching.
`--config-cache'
`-C'
Alias for `--cache-file=config.cache'.
`--quiet'
`--silent'
@@ -248,8 +356,15 @@ operates.
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`--version'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`--prefix=DIR'
Use DIR as the installation prefix. *note Installation Names::
for more details, including other options available for fine-tuning
the installation locations.
`configure' also accepts some other, not widely useful, options.
`--no-create'
`-n'
Run the configure checks, but stop before creating any output
files.
`configure' also accepts some other, not widely useful, options. Run
`configure --help' for more details.
+7
View File
@@ -138,6 +138,7 @@ AC_ARG_ENABLE(avx, [ --enable-avx Enable AVX support])
AC_ARG_ENABLE(avx2, [ --enable-avx2 Enable AVX2 support])
AC_ARG_ENABLE(neon, [ --enable-neon Enable NEON support])
AC_ARG_ENABLE(fixed_point, [ --enable-fixed-point Enable fixed point support])
# The following is for MSVC, where we may be using a local copy of libtiff, built alongside spandsp
AC_ARG_ENABLE(builtin_tiff,
[AC_HELP_STRING([--enable-builtin-tiff],[build with builtin libtiff])],[enable_builtin_tiff="$enableval"],[enable_builtin_tiff="no"])
@@ -164,6 +165,8 @@ fi
AX_C99_FLEXIBLE_ARRAY
AC_CHECK_FUNCS([aligned_alloc])
AC_CHECK_FUNCS([memalign])
AC_CHECK_FUNCS([posix_memalign])
AC_CHECK_FUNCS([memmove])
AC_CHECK_FUNCS([memset])
AC_CHECK_FUNCS([select])
@@ -184,6 +187,9 @@ AC_HEADER_TIME
AC_CHECK_HEADERS([socket.h])
AC_CHECK_HEADERS([inttypes.h], [INSERT_INTTYPES_HEADER="#include <inttypes.h>"])
AC_CHECK_HEADERS([stdint.h], [INSERT_STDINT_HEADER="#include <stdint.h>"])
AC_CHECK_HEADERS([stdatomic.h])
AC_CHECK_HEADERS([stdbool.h], [INSERT_STDBOOL_HEADER="#include <stdbool.h>"], [INSERT_STDBOOL_HEADER="#include <spandsp/stdbool.h>"])
AC_CHECK_HEADERS([stdfix.h])
AC_CHECK_HEADERS([unistd.h])
AC_CHECK_HEADERS([stdlib.h])
AC_CHECK_HEADERS([string.h])
@@ -589,6 +595,7 @@ AC_SUBST(INSERT_INTTYPES_HEADER)
AC_SUBST(INSERT_STDINT_HEADER)
AC_SUBST(INSERT_TGMATH_HEADER)
AC_SUBST(INSERT_MATH_HEADER)
AC_SUBST(INSERT_STDBOOL_HEADER)
AC_CONFIG_FILES([Makefile
doc/Makefile
+1 -1
View File
@@ -34,7 +34,7 @@ EXTRA_DIST = libspandsp_sim.dsp \
msvc/vc9proj.head \
msvc/vc9proj.foot
INCLUDES = -I$(top_builddir) -I$(top_builddir)/src -DDATADIR="\"$(pkgdatadir)\""
AM_CPPFLAGS = -I$(top_builddir) -I$(top_builddir)/src -DDATADIR="\"$(pkgdatadir)\""
noinst_PROGRAMS = make_line_models
+4 -1
View File
@@ -78,12 +78,13 @@ EXTRA_DIST = floating_fudge.h \
spandsp/private/README \
spandsp/version.h.in
INCLUDES = -I$(top_builddir)
AM_CPPFLAGS = -I$(top_builddir)
lib_LTLIBRARIES = libspandsp.la
libspandsp_la_SOURCES = ademco_contactid.c \
adsi.c \
alloc.c \
async.c \
at_interpreter.c \
awgn.c \
@@ -178,6 +179,7 @@ libspandsp_la_LDFLAGS = -version-info @SPANDSP_LT_CURRENT@:@SPANDSP_LT_REVISION@
nobase_include_HEADERS = spandsp/ademco_contactid.h \
spandsp/adsi.h \
spandsp/alloc.h \
spandsp/async.h \
spandsp/arctan2.h \
spandsp/at_interpreter.h \
@@ -222,6 +224,7 @@ nobase_include_HEADERS = spandsp/ademco_contactid.h \
spandsp/queue.h \
spandsp/saturated.h \
spandsp/schedule.h \
spandsp/stdbool.h \
spandsp/sig_tone.h \
spandsp/silence_gen.h \
spandsp/super_tone_rx.h \
+22 -16
View File
@@ -39,6 +39,11 @@
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include <memory.h>
#include <string.h>
@@ -46,6 +51,7 @@
#include <assert.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/logging.h"
#include "spandsp/queue.h"
@@ -447,7 +453,7 @@ static const struct ademco_code_s ademco_codes[] =
#define TONE_TO_TOTAL_ENERGY 45.2233f /* -0.85dB [GOERTZEL_SAMPLES_PER_BLOCK*10^(-0.85/10.0)] */
#endif
static int tone_rx_init = FALSE;
static int tone_rx_init = false;
static goertzel_descriptor_t tone_1400_desc;
static goertzel_descriptor_t tone_2300_desc;
@@ -749,7 +755,7 @@ SPAN_DECLARE(ademco_contactid_receiver_state_t *) ademco_contactid_receiver_init
{
if (s == NULL)
{
if ((s = (ademco_contactid_receiver_state_t *) malloc(sizeof (*s))) == NULL)
if ((s = (ademco_contactid_receiver_state_t *) span_alloc(sizeof (*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -776,7 +782,7 @@ SPAN_DECLARE(int) ademco_contactid_receiver_release(ademco_contactid_receiver_st
SPAN_DECLARE(int) ademco_contactid_receiver_free(ademco_contactid_receiver_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -793,7 +799,7 @@ SPAN_DECLARE(int) ademco_contactid_sender_tx(ademco_contactid_sender_state_t *s,
case 0:
if (!s->clear_to_send)
return 0;
s->clear_to_send = FALSE;
s->clear_to_send = false;
s->step++;
s->remaining_samples = ms_to_samples(250);
/* Fall through */
@@ -810,7 +816,7 @@ SPAN_DECLARE(int) ademco_contactid_sender_tx(ademco_contactid_sender_state_t *s,
samples = dtmf_tx(&s->dtmf, &amp[sample], max_samples - sample);
if (samples == 0)
{
s->clear_to_send = FALSE;
s->clear_to_send = false;
s->step = 0;
return sample;
}
@@ -947,7 +953,7 @@ SPAN_DECLARE(int) ademco_contactid_sender_rx(ademco_contactid_sender_state_t *s,
s->callback(s->callback_user_data, -1, 0, 0);
s->tone_state = 4;
/* Release the transmit side, and it will time the 250ms post tone delay */
s->clear_to_send = TRUE;
s->clear_to_send = true;
s->tries = 0;
if (s->tx_digits_len)
s->timer = ms_to_samples(3000);
@@ -968,7 +974,7 @@ SPAN_DECLARE(int) ademco_contactid_sender_rx(ademco_contactid_sender_state_t *s,
case 5:
if (hit == 0)
{
s->busy = FALSE;
s->busy = false;
if (s->duration < ms_to_samples(400) || s->duration > ms_to_samples(1500))
{
span_log(&s->logging, SPAN_LOG_FLOW, "Bad kissoff duration %d\n", s->duration);
@@ -982,18 +988,18 @@ SPAN_DECLARE(int) ademco_contactid_sender_rx(ademco_contactid_sender_state_t *s,
{
s->timer = 0;
if (s->callback)
s->callback(s->callback_user_data, FALSE, 0, 0);
s->callback(s->callback_user_data, false, 0, 0);
}
}
else
{
span_log(&s->logging, SPAN_LOG_FLOW, "Received good kissoff\n");
s->clear_to_send = TRUE;
s->clear_to_send = true;
s->tx_digits_len = 0;
if (s->callback)
s->callback(s->callback_user_data, TRUE, 0, 0);
s->callback(s->callback_user_data, true, 0, 0);
s->tone_state = 4;
s->clear_to_send = TRUE;
s->clear_to_send = true;
s->tries = 0;
if (s->tx_digits_len)
s->timer = ms_to_samples(3000);
@@ -1023,7 +1029,7 @@ SPAN_DECLARE(int) ademco_contactid_sender_rx(ademco_contactid_sender_state_t *s,
{
s->timer = 0;
if (s->callback)
s->callback(s->callback_user_data, FALSE, 0, 0);
s->callback(s->callback_user_data, false, 0, 0);
}
}
}
@@ -1058,7 +1064,7 @@ SPAN_DECLARE(int) ademco_contactid_sender_put(ademco_contactid_sender_state_t *s
return -1;
if ((s->tx_digits_len = encode_msg(s->tx_digits, report)) < 0)
return -1;
s->busy = TRUE;
s->busy = true;
return dtmf_tx_put(&s->dtmf, s->tx_digits, s->tx_digits_len);
}
/*- End of function --------------------------------------------------------*/
@@ -1084,7 +1090,7 @@ SPAN_DECLARE(ademco_contactid_sender_state_t *) ademco_contactid_sender_init(ade
{
if (s == NULL)
{
if ((s = (ademco_contactid_sender_state_t *) malloc(sizeof (*s))) == NULL)
if ((s = (ademco_contactid_sender_state_t *) span_alloc(sizeof (*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -1095,7 +1101,7 @@ SPAN_DECLARE(ademco_contactid_sender_state_t *) ademco_contactid_sender_init(ade
{
make_goertzel_descriptor(&tone_1400_desc, 1400.0f, GOERTZEL_SAMPLES_PER_BLOCK);
make_goertzel_descriptor(&tone_2300_desc, 2300.0f, GOERTZEL_SAMPLES_PER_BLOCK);
tone_rx_init = TRUE;
tone_rx_init = true;
}
goertzel_init(&s->tone_1400, &tone_1400_desc);
goertzel_init(&s->tone_2300, &tone_2300_desc);
@@ -1121,7 +1127,7 @@ SPAN_DECLARE(int) ademco_contactid_sender_release(ademco_contactid_sender_state_
SPAN_DECLARE(int) ademco_contactid_sender_free(ademco_contactid_sender_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+19 -12
View File
@@ -40,10 +40,16 @@
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include <assert.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/logging.h"
#include "spandsp/queue.h"
@@ -63,6 +69,7 @@
#include "spandsp/private/queue.h"
#include "spandsp/private/tone_generate.h"
#include "spandsp/private/async.h"
#include "spandsp/private/power_meter.h"
#include "spandsp/private/fsk.h"
#include "spandsp/private/dtmf.h"
#include "spandsp/private/adsi.h"
@@ -150,7 +157,7 @@ static int adsi_tx_get_bit(void *user_data)
if (s->tx_signal_on)
{
/* The FSK should now be switched off. */
s->tx_signal_on = FALSE;
s->tx_signal_on = false;
s->msg_len = 0;
}
}
@@ -169,7 +176,7 @@ static int adsi_tdd_get_async_byte(void *user_data)
if (s->tx_signal_on)
{
/* The FSK should now be switched off. */
s->tx_signal_on = FALSE;
s->tx_signal_on = false;
s->msg_len = 0;
}
return 0x1F;
@@ -384,13 +391,13 @@ static void start_tx(adsi_tx_state_t *s)
dtmf_tx_init(&s->dtmftx, NULL, NULL);
break;
case ADSI_STANDARD_TDD:
fsk_tx_init(&s->fsktx, &preset_fsk_specs[FSK_WEITBRECHT], async_tx_get_bit, &s->asynctx);
async_tx_init(&s->asynctx, 5, ASYNC_PARITY_NONE, 2, FALSE, adsi_tdd_get_async_byte, s);
fsk_tx_init(&s->fsktx, &preset_fsk_specs[FSK_WEITBRECHT_4545], async_tx_get_bit, &s->asynctx);
async_tx_init(&s->asynctx, 5, ASYNC_PARITY_NONE, 2, false, adsi_tdd_get_async_byte, s);
/* Schedule an explicit shift at the start of baudot transmission */
s->baudot_shift = 2;
break;
}
s->tx_signal_on = TRUE;
s->tx_signal_on = true;
}
/*- End of function --------------------------------------------------------*/
@@ -426,7 +433,7 @@ SPAN_DECLARE(adsi_rx_state_t *) adsi_rx_init(adsi_rx_state_t *s,
{
if (s == NULL)
{
if ((s = (adsi_rx_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (adsi_rx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -448,7 +455,7 @@ SPAN_DECLARE(adsi_rx_state_t *) adsi_rx_init(adsi_rx_state_t *s,
case ADSI_STANDARD_TDD:
/* TDD uses 5 bit data, no parity and 1.5 stop bits. We scan for the first stop bit, and
ride over the fraction. */
fsk_rx_init(&s->fskrx, &preset_fsk_specs[FSK_WEITBRECHT], FSK_FRAME_MODE_5N1_FRAMES, adsi_tdd_put_async_byte, s);
fsk_rx_init(&s->fskrx, &preset_fsk_specs[FSK_WEITBRECHT_4545], FSK_FRAME_MODE_5N1_FRAMES, adsi_tdd_put_async_byte, s);
break;
}
s->standard = standard;
@@ -465,7 +472,7 @@ SPAN_DECLARE(int) adsi_rx_release(adsi_rx_state_t *s)
SPAN_DECLARE(int) adsi_rx_free(adsi_rx_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -488,7 +495,7 @@ SPAN_DECLARE(int) adsi_tx(adsi_tx_state_t *s, int16_t amp[], int max_len)
if (len < max_len)
{
if ((lenx = fsk_tx(&s->fsktx, amp + len, max_len - len)) <= 0)
s->tx_signal_on = FALSE;
s->tx_signal_on = false;
len += lenx;
}
break;
@@ -658,7 +665,7 @@ SPAN_DECLARE(adsi_tx_state_t *) adsi_tx_init(adsi_tx_state_t *s, int standard)
{
if (s == NULL)
{
if ((s = (adsi_tx_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (adsi_tx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -671,7 +678,7 @@ SPAN_DECLARE(adsi_tx_state_t *) adsi_tx_init(adsi_tx_state_t *s, int standard)
60,
0,
0,
FALSE);
false);
s->standard = standard;
adsi_tx_set_preamble(s, -1, -1, -1, -1);
span_log_init(&s->logging, SPAN_LOG_NONE, NULL);
@@ -688,7 +695,7 @@ SPAN_DECLARE(int) adsi_tx_release(adsi_tx_state_t *s)
SPAN_DECLARE(int) adsi_tx_free(adsi_tx_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+145
View File
@@ -0,0 +1,145 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* alloc.c - memory allocation handling.
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2013 Steve Underwood
*
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 2.1,
* as published by the Free Software Foundation.
*
* This program 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 program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*! \file */
#if defined(HAVE_CONFIG_H)
#include "config.h"
#endif
#include <limits.h>
#include <stdio.h>
#include <stdarg.h>
#include <fcntl.h>
#if !defined(__USE_ISOC11)
#define __USE_ISOC11
#endif
#include <stdlib.h>
#if defined(HAVE_MALLOC_H)
#include <malloc.h>
#endif
#include <inttypes.h>
#include <string.h>
#include <errno.h>
#include <signal.h>
#include <sys/time.h>
#include <time.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable:4232) /* address of dllimport is not static, identity not guaranteed */
#endif
#if defined(HAVE_ALIGNED_ALLOC)
static span_aligned_alloc_t __span_aligned_alloc = aligned_alloc;
#elif defined(HAVE_MEMALIGN)
static span_aligned_alloc_t __span_aligned_alloc = memalign;
#elif defined(HAVE_POSIX_MEMALIGN)
static void *fake_posix_memalign(size_t alignment, size_t size);
static span_aligned_alloc_t __span_aligned_alloc = fake_posix_memalign;
#else
static void *fake_aligned_alloc(size_t alignment, size_t size);
static span_aligned_alloc_t __span_aligned_alloc = fake_aligned_alloc;
#endif
static span_alloc_t __span_alloc = malloc;
static span_realloc_t __span_realloc = realloc;
static span_free_t __span_free = free;
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#if defined(HAVE_ALIGNED_ALLOC)
#elif defined(HAVE_MEMALIGN)
#elif defined(HAVE_POSIX_MEMALIGN)
static void *fake_posix_memalign(size_t alignment, size_t size)
{
void *ptr;
/* Make posix_memalign look like the more modern aligned_alloc */
posix_memalign(&ptr, alignment, size);
return ptr;
}
/*- End of function --------------------------------------------------------*/
#else
static void *fake_aligned_alloc(size_t alignment, size_t size)
{
return malloc(size);
}
/*- End of function --------------------------------------------------------*/
#endif
SPAN_DECLARE(void *) span_aligned_alloc(size_t alignment, size_t size)
{
return __span_aligned_alloc(alignment, size);
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(void *) span_alloc(size_t size)
{
return __span_alloc(size);
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(void *) span_realloc(void *ptr, size_t size)
{
return __span_realloc(ptr, size);
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(void) span_free(void *ptr)
{
__span_free(ptr);
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) span_mem_allocators(span_aligned_alloc_t custom_aligned_alloc,
span_alloc_t custom_alloc,
span_realloc_t custom_realloc,
span_free_t custom_free)
{
__span_aligned_alloc = (custom_aligned_alloc)
?
custom_aligned_alloc
:
#if defined(HAVE_ALIGNED_ALLOC)
aligned_alloc;
#elif defined(HAVE_MEMALIGN)
memalign;
#elif defined(HAVE_POSIX_MEMALIGN)
fake_posix_memalign;
#else
fake_aligned_alloc;
#endif
__span_alloc = (custom_alloc) ? custom_alloc : malloc;
__span_realloc = (custom_realloc) ? custom_realloc : realloc;
__span_free = (custom_free) ? custom_free : free;
return 0;
}
/*- End of function --------------------------------------------------------*/
/*- End of file ------------------------------------------------------------*/
+12 -6
View File
@@ -33,8 +33,14 @@
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/bit_operations.h"
#include "spandsp/async.h"
@@ -168,13 +174,13 @@ SPAN_DECLARE(async_rx_state_t *) async_rx_init(async_rx_state_t *s,
int data_bits,
int parity,
int stop_bits,
int use_v14,
bool use_v14,
put_byte_func_t put_byte,
void *user_data)
{
if (s == NULL)
{
if ((s = (async_rx_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (async_rx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
s->data_bits = data_bits;
@@ -203,7 +209,7 @@ SPAN_DECLARE(int) async_rx_release(async_rx_state_t *s)
SPAN_DECLARE(int) async_rx_free(async_rx_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -268,13 +274,13 @@ SPAN_DECLARE(async_tx_state_t *) async_tx_init(async_tx_state_t *s,
int data_bits,
int parity,
int stop_bits,
int use_v14,
bool use_v14,
get_byte_func_t get_byte,
void *user_data)
{
if (s == NULL)
{
if ((s = (async_tx_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (async_tx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
/* We have a use_v14 parameter for completeness, but right now V.14 only
@@ -304,7 +310,7 @@ SPAN_DECLARE(int) async_tx_release(async_tx_state_t *s)
SPAN_DECLARE(int) async_tx_free(async_tx_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+68 -62
View File
@@ -43,9 +43,15 @@
#include <memory.h>
#include <string.h>
#include <ctype.h>
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include <assert.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/queue.h"
#include "spandsp/power_meter.h"
@@ -77,20 +83,20 @@ static at_profile_t profiles[3] =
{
{
#if defined(_MSC_VER) || defined(__sunos) || defined(__solaris) || defined(__sun)
/*.echo =*/ TRUE,
/*.verbose =*/ TRUE,
/*.echo =*/ true,
/*.verbose =*/ true,
/*.result_code_format =*/ ASCII_RESULT_CODES,
/*.pulse_dial =*/ FALSE,
/*.double_escape =*/ FALSE,
/*.adaptive_receive =*/ FALSE,
/*.pulse_dial =*/ false,
/*.double_escape =*/ false,
/*.adaptive_receive =*/ false,
/*.s_regs[100] =*/ {0, 0, 0, '\r', '\n', '\b', 1, 60, 5, 0, 0}
#else
.echo = TRUE,
.verbose = TRUE,
.echo = true,
.verbose = true,
.result_code_format = ASCII_RESULT_CODES,
.pulse_dial = FALSE,
.double_escape = FALSE,
.adaptive_receive = FALSE,
.pulse_dial = false,
.double_escape = false,
.adaptive_receive = false,
.s_regs[0] = 0,
.s_regs[3] = '\r',
.s_regs[4] = '\n',
@@ -255,11 +261,11 @@ SPAN_DECLARE(void) at_put_response_code(at_state_t *s, int code)
static int answer_call(at_state_t *s)
{
if (at_modem_control(s, AT_MODEM_CONTROL_ANSWER, NULL) < 0)
return FALSE;
return false;
/* Answering should now be in progress. No AT response should be
issued at this point. */
s->do_hangup = FALSE;
return TRUE;
s->do_hangup = false;
return true;
}
/*- End of function --------------------------------------------------------*/
@@ -318,7 +324,7 @@ SPAN_DECLARE(void) at_call_event(at_state_t *s, int event)
at_modem_control(s, AT_MODEM_CONTROL_RESTART, (void *) FAX_MODEM_NOCNG_TONE_TX);
else
at_modem_control(s, AT_MODEM_CONTROL_RESTART, (void *) FAX_MODEM_CNG_TONE_TX);
s->dte_is_waiting = TRUE;
s->dte_is_waiting = true;
}
}
break;
@@ -342,13 +348,13 @@ SPAN_DECLARE(void) at_call_event(at_state_t *s, int event)
if (s->ok_is_pending)
{
at_put_response_code(s, AT_RESPONSE_CODE_OK);
s->ok_is_pending = FALSE;
s->ok_is_pending = false;
}
else
{
at_put_response_code(s, AT_RESPONSE_CODE_NO_CARRIER);
}
s->dte_is_waiting = FALSE;
s->dte_is_waiting = false;
at_set_at_rx_mode(s, AT_MODE_ONHOOK_COMMAND);
}
else if (s->fclass_mode && s->rx_signal_present)
@@ -360,7 +366,7 @@ SPAN_DECLARE(void) at_call_event(at_state_t *s, int event)
}
if (s->at_rx_mode != AT_MODE_OFFHOOK_COMMAND && s->at_rx_mode != AT_MODE_ONHOOK_COMMAND)
at_put_response_code(s, AT_RESPONSE_CODE_NO_CARRIER);
s->rx_signal_present = FALSE;
s->rx_signal_present = false;
at_modem_control(s, AT_MODEM_CONTROL_RNG, (void *) 0);
at_set_at_rx_mode(s, AT_MODE_ONHOOK_COMMAND);
break;
@@ -379,11 +385,11 @@ SPAN_DECLARE(void) at_reset_call_info(at_state_t *s)
for (call_id = s->call_id; call_id; call_id = next)
{
next = call_id->next;
free(call_id);
span_free(call_id);
}
s->call_id = NULL;
s->rings_indicated = 0;
s->call_info_displayed = FALSE;
s->call_info_displayed = false;
}
/*- End of function --------------------------------------------------------*/
@@ -392,8 +398,8 @@ SPAN_DECLARE(void) at_set_call_info(at_state_t *s, char const *id, char const *v
at_call_id_t *new_call_id;
at_call_id_t *call_id;
/* TODO: We should really not merely ignore a failure to malloc */
if ((new_call_id = (at_call_id_t *) malloc(sizeof(*new_call_id))) == NULL)
/* TODO: We should really not merely ignore a failure to allocate */
if ((new_call_id = (at_call_id_t *) span_alloc(sizeof(*new_call_id))) == NULL)
return;
call_id = s->call_id;
/* If these strdups fail its pretty harmless. We just appear to not
@@ -430,7 +436,7 @@ SPAN_DECLARE(void) at_display_call_info(at_state_t *s)
at_put_response(s, buf);
call_id = call_id->next;
}
s->call_info_displayed = TRUE;
s->call_info_displayed = true;
}
/*- End of function --------------------------------------------------------*/
@@ -525,7 +531,7 @@ static int parse_out(at_state_t *s, const char **t, int *target, int max_value,
default:
/* Set value */
if ((val = parse_num(t, max_value)) < 0)
return FALSE;
return false;
if (target)
*target = val;
break;
@@ -538,9 +544,9 @@ static int parse_out(at_state_t *s, const char **t, int *target, int max_value,
at_put_response(s, buf);
break;
default:
return FALSE;
return false;
}
return TRUE;
return true;
}
/*- End of function --------------------------------------------------------*/
@@ -564,14 +570,14 @@ static int parse_2_out(at_state_t *s, const char **t, int *target1, int max_valu
default:
/* Set value */
if ((val1 = parse_num(t, max_value1)) < 0)
return FALSE;
return false;
if (target1)
*target1 = val1;
if (**t == ',')
{
(*t)++;
if ((val2 = parse_num(t, max_value2)) < 0)
return FALSE;
return false;
if (target2)
*target2 = val2;
}
@@ -586,9 +592,9 @@ static int parse_2_out(at_state_t *s, const char **t, int *target1, int max_valu
at_put_response(s, buf);
break;
default:
return FALSE;
return false;
}
return TRUE;
return true;
}
/*- End of function --------------------------------------------------------*/
@@ -621,7 +627,7 @@ static int parse_n_out(at_state_t *s,
for (i = 0; i < entries; i++)
{
if ((val = parse_num(t, max_values[i])) < 0)
return FALSE;
return false;
if (targets[i])
*targets[i] = val;
if (**t != ',')
@@ -644,9 +650,9 @@ static int parse_n_out(at_state_t *s,
at_put_response(s, buf);
break;
default:
return FALSE;
return false;
}
return TRUE;
return true;
}
/*- End of function --------------------------------------------------------*/
@@ -669,7 +675,7 @@ static int parse_hex_out(at_state_t *s, const char **t, int *target, int max_val
default:
/* Set value */
if ((val = parse_hex_num(t, max_value)) < 0)
return FALSE;
return false;
if (target)
*target = val;
break;
@@ -682,9 +688,9 @@ static int parse_hex_out(at_state_t *s, const char **t, int *target, int max_val
at_put_response(s, buf);
break;
default:
return FALSE;
return false;
}
return TRUE;
return true;
}
/*- End of function --------------------------------------------------------*/
@@ -709,7 +715,7 @@ static int parse_string_list_out(at_state_t *s, const char **t, int *target, int
default:
/* Set value */
if ((val = match_element(t, def)) < 0)
return FALSE;
return false;
if (target)
*target = val;
break;
@@ -728,9 +734,9 @@ static int parse_string_list_out(at_state_t *s, const char **t, int *target, int
at_put_response(s, buf);
break;
default:
return FALSE;
return false;
}
return TRUE;
return true;
}
/*- End of function --------------------------------------------------------*/
@@ -752,7 +758,7 @@ static int parse_string_out(at_state_t *s, const char **t, char **target, const
default:
/* Set value */
if (*target)
free(*target);
span_free(*target);
/* If this strdup fails, it should be harmless */
*target = strdup(*t);
break;
@@ -763,11 +769,11 @@ static int parse_string_out(at_state_t *s, const char **t, char **target, const
at_put_response(s, (*target) ? *target : "");
break;
default:
return FALSE;
return false;
}
while (*t)
t++;
return TRUE;
return true;
}
/*- End of function --------------------------------------------------------*/
@@ -862,18 +868,18 @@ static int process_class1_cmd(at_state_t *s, const char **t)
val = -1;
if (!parse_out(s, t, &val, 255, NULL, allowed))
return TRUE;
return true;
if (val < 0)
{
/* It was just a query */
return TRUE;
return true;
}
/* All class 1 FAX commands are supposed to give an ERROR response, if the phone
is on-hook. */
if (s->at_rx_mode == AT_MODE_ONHOOK_COMMAND)
return FALSE;
return false;
result = TRUE;
result = true;
if (s->class1_handler)
result = s->class1_handler(s, s->class1_user_data, direction, operation, val);
switch (result)
@@ -881,11 +887,11 @@ static int process_class1_cmd(at_state_t *s, const char **t)
case 0:
/* Inhibit an immediate response. (These commands should not be part of a multi-command entry.) */
*t = (const char *) -1;
return TRUE;
return true;
case -1:
return FALSE;
return false;
}
return TRUE;
return true;
}
/*- End of function --------------------------------------------------------*/
@@ -915,11 +921,11 @@ static const char *at_cmd_D(at_state_t *s, const char *t)
/* V.250 6.3.1 - Dial (abortable) */
at_reset_call_info(s);
s->do_hangup = FALSE;
s->silent_dial = FALSE;
s->command_dial = FALSE;
s->do_hangup = false;
s->silent_dial = false;
s->command_dial = false;
t += 1;
ok = FALSE;
ok = false;
/* There are a numbers of options in a dial command string.
Many are completely irrelevant in this application. */
u = num;
@@ -961,11 +967,11 @@ static const char *at_cmd_D(at_state_t *s, const char *t)
break;
case 'T':
/* V.250 6.3.1.3 Tone dial */
s->p.pulse_dial = FALSE;
s->p.pulse_dial = false;
break;
case 'P':
/* V.250 6.3.1.4 Pulse dial */
s->p.pulse_dial = TRUE;
s->p.pulse_dial = true;
break;
case '!':
/* V.250 6.3.1.5 Hook flash, register recall */
@@ -977,7 +983,7 @@ static const char *at_cmd_D(at_state_t *s, const char *t)
break;
case '@':
/* V.250 6.3.1.7 Wait for quiet answer */
s->silent_dial = TRUE;
s->silent_dial = true;
break;
case 'S':
/* V.250 6.3.1.8 Invoke stored string */
@@ -998,7 +1004,7 @@ static const char *at_cmd_D(at_state_t *s, const char *t)
break;
case ';':
/* V.250 6.3.1 - Dial string terminator - make voice call and remain in command mode */
s->command_dial = TRUE;
s->command_dial = true;
break;
case '>':
/* GSM07.07 6.2 - Direct dialling from phone book supplementary service subscription
@@ -1054,7 +1060,7 @@ static const char *at_cmd_H(at_state_t *s, const char *t)
{
/* Push out the last of the audio (probably by sending a short silence). */
at_modem_control(s, AT_MODEM_CONTROL_RESTART, (void *) FAX_MODEM_FLUSH);
s->do_hangup = TRUE;
s->do_hangup = true;
at_set_at_rx_mode(s, AT_MODE_CONNECTED);
return (const char *) -1;
}
@@ -1137,7 +1143,7 @@ static const char *at_cmd_P(at_state_t *s, const char *t)
{
/* V.250 6.3.3 - Select pulse dialling (command) */
t += 1;
s->p.pulse_dial = TRUE;
s->p.pulse_dial = true;
return t;
}
/*- End of function --------------------------------------------------------*/
@@ -1231,7 +1237,7 @@ static const char *at_cmd_T(at_state_t *s, const char *t)
{
/* V.250 6.3.2 - Select tone dialling (command) */
t += 1;
s->p.pulse_dial = FALSE;
s->p.pulse_dial = false;
return t;
}
/*- End of function --------------------------------------------------------*/
@@ -5590,7 +5596,7 @@ SPAN_DECLARE(at_state_t *) at_init(at_state_t *s,
{
if (s == NULL)
{
if ((s = (at_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (at_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, '\0', sizeof(*s));
@@ -5615,7 +5621,7 @@ SPAN_DECLARE(int) at_release(at_state_t *s)
{
at_reset_call_info(s);
if (s->local_id)
free(s->local_id);
span_free(s->local_id);
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -5625,7 +5631,7 @@ SPAN_DECLARE(int) at_free(at_state_t *s)
int ret;
ret = at_release(s);
free(s);
span_free(s);
return ret;
}
/*- End of function --------------------------------------------------------*/
+3 -2
View File
@@ -55,6 +55,7 @@
#include "floating_fudge.h"
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/saturated.h"
#include "spandsp/awgn.h"
@@ -100,7 +101,7 @@ SPAN_DECLARE(awgn_state_t *) awgn_init_dbov(awgn_state_t *s, int idum, float lev
if (s == NULL)
{
if ((s = (awgn_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (awgn_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
if (idum < 0)
@@ -140,7 +141,7 @@ SPAN_DECLARE(int) awgn_release(awgn_state_t *s)
SPAN_DECLARE(int) awgn_free(awgn_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+28 -22
View File
@@ -40,9 +40,15 @@
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/fast_convert.h"
#include "spandsp/queue.h"
@@ -77,10 +83,10 @@ typedef struct
uint8_t off_time; /* Minimum post tone silence (ms) */
} mf_digit_tones_t;
int bell_mf_gen_inited = FALSE;
int bell_mf_gen_inited = false;
tone_gen_descriptor_t bell_mf_digit_tones[15];
int r2_mf_gen_inited = FALSE;
int r2_mf_gen_inited = false;
tone_gen_descriptor_t r2_mf_fwd_digit_tones[15];
tone_gen_descriptor_t r2_mf_back_digit_tones[15];
@@ -270,10 +276,10 @@ static void bell_mf_gen_init(void)
tones->off_time,
0,
0,
FALSE);
false);
tones++;
}
bell_mf_gen_inited = TRUE;
bell_mf_gen_inited = true;
}
/*- End of function --------------------------------------------------------*/
@@ -325,7 +331,7 @@ SPAN_DECLARE(bell_mf_tx_state_t *) bell_mf_tx_init(bell_mf_tx_state_t *s)
{
if (s == NULL)
{
if ((s = (bell_mf_tx_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (bell_mf_tx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -348,7 +354,7 @@ SPAN_DECLARE(int) bell_mf_tx_release(bell_mf_tx_state_t *s)
SPAN_DECLARE(int) bell_mf_tx_free(bell_mf_tx_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -390,14 +396,14 @@ SPAN_DECLARE(int) r2_mf_tx_put(r2_mf_tx_state_t *s, char digit)
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(r2_mf_tx_state_t *) r2_mf_tx_init(r2_mf_tx_state_t *s, int fwd)
SPAN_DECLARE(r2_mf_tx_state_t *) r2_mf_tx_init(r2_mf_tx_state_t *s, bool fwd)
{
int i;
const mf_digit_tones_t *tones;
if (s == NULL)
{
if ((s = (r2_mf_tx_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (r2_mf_tx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -436,7 +442,7 @@ SPAN_DECLARE(r2_mf_tx_state_t *) r2_mf_tx_init(r2_mf_tx_state_t *s, int fwd)
(tones->off_time == 0));
tones++;
}
r2_mf_gen_inited = TRUE;
r2_mf_gen_inited = true;
}
s->fwd = fwd;
return s;
@@ -451,7 +457,7 @@ SPAN_DECLARE(int) r2_mf_tx_release(r2_mf_tx_state_t *s)
SPAN_DECLARE(int) r2_mf_tx_free(r2_mf_tx_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -629,11 +635,11 @@ SPAN_DECLARE(bell_mf_rx_state_t *) bell_mf_rx_init(bell_mf_rx_state_t *s,
void *user_data)
{
int i;
static int initialised = FALSE;
static int initialised = false;
if (s == NULL)
{
if ((s = (bell_mf_rx_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (bell_mf_rx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -642,7 +648,7 @@ SPAN_DECLARE(bell_mf_rx_state_t *) bell_mf_rx_init(bell_mf_rx_state_t *s,
{
for (i = 0; i < 6; i++)
make_goertzel_descriptor(&bell_mf_detect_desc[i], (float) bell_mf_frequencies[i], BELL_MF_SAMPLES_PER_BLOCK);
initialised = TRUE;
initialised = true;
}
s->digits_callback = callback;
s->digits_callback_data = user_data;
@@ -671,7 +677,7 @@ SPAN_DECLARE(int) bell_mf_rx_release(bell_mf_rx_state_t *s)
SPAN_DECLARE(int) bell_mf_rx_free(bell_mf_rx_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -745,7 +751,7 @@ SPAN_DECLARE(int) r2_mf_rx(r2_mf_rx_state_t *s, const int16_t amp[], int samples
}
}
/* Basic signal level and twist tests */
hit = FALSE;
hit = false;
if (energy[best] >= R2_MF_THRESHOLD
&&
energy[second_best] >= R2_MF_THRESHOLD
@@ -755,7 +761,7 @@ SPAN_DECLARE(int) r2_mf_rx(r2_mf_rx_state_t *s, const int16_t amp[], int samples
energy[best]*R2_MF_TWIST > energy[second_best])
{
/* Relative peak test */
hit = TRUE;
hit = true;
for (i = 0; i < 6; i++)
{
if (i != best && i != second_best)
@@ -763,7 +769,7 @@ SPAN_DECLARE(int) r2_mf_rx(r2_mf_rx_state_t *s, const int16_t amp[], int samples
if (energy[i]*R2_MF_RELATIVE_PEAK >= energy[second_best])
{
/* The best two are not clearly the best */
hit = FALSE;
hit = false;
break;
}
}
@@ -804,16 +810,16 @@ SPAN_DECLARE(int) r2_mf_rx_get(r2_mf_rx_state_t *s)
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(r2_mf_rx_state_t *) r2_mf_rx_init(r2_mf_rx_state_t *s,
int fwd,
bool fwd,
tone_report_func_t callback,
void *user_data)
{
int i;
static int initialised = FALSE;
static int initialised = false;
if (s == NULL)
{
if ((s = (r2_mf_rx_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (r2_mf_rx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -827,7 +833,7 @@ SPAN_DECLARE(r2_mf_rx_state_t *) r2_mf_rx_init(r2_mf_rx_state_t *s,
make_goertzel_descriptor(&mf_fwd_detect_desc[i], (float) r2_mf_fwd_frequencies[i], R2_MF_SAMPLES_PER_BLOCK);
make_goertzel_descriptor(&mf_back_detect_desc[i], (float) r2_mf_back_frequencies[i], R2_MF_SAMPLES_PER_BLOCK);
}
initialised = TRUE;
initialised = true;
}
if (fwd)
{
@@ -855,7 +861,7 @@ SPAN_DECLARE(int) r2_mf_rx_release(r2_mf_rx_state_t *s)
SPAN_DECLARE(int) r2_mf_rx_free(r2_mf_rx_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+11 -5
View File
@@ -33,8 +33,14 @@
#include <string.h>
#include <assert.h>
#include <time.h>
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/async.h"
#include "spandsp/bert.h"
@@ -136,14 +142,14 @@ static void assess_error_rate(bert_state_t *s)
int i;
int j;
int sum;
int test;
bool test;
/* We assess the error rate in decadic steps. For each decade we assess the error over 10 times
the number of bits, to smooth the result. This means we assess the 1 in 100 rate based on 1000 bits
(i.e. we look for >=10 errors in 1000 bits). We make an assessment every 100 bits, using a sliding
window over the last 1000 bits. We assess the 1 in 1000 rate over 10000 bits in a similar way, and
so on for the lower error rates. */
test = TRUE;
test = false;
for (i = 2; i <= 7; i++)
{
if (++s->decade_ptr[i] < 10)
@@ -156,7 +162,7 @@ static void assess_error_rate(bert_state_t *s)
if (test && sum > 10)
{
/* We overflow into the next decade */
test = FALSE;
test = false;
if (s->error_rate != i && s->reporter)
s->reporter(s->user_data, BERT_REPORT_GT_10_2 + i - 2, &s->results);
s->error_rate = i;
@@ -350,7 +356,7 @@ SPAN_DECLARE(bert_state_t *) bert_init(bert_state_t *s, int limit, int pattern,
if (s == NULL)
{
if ((s = (bert_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (bert_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -503,7 +509,7 @@ SPAN_DECLARE(int) bert_release(bert_state_t *s)
SPAN_DECLARE(int) bert_free(bert_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+8 -2
View File
@@ -33,8 +33,14 @@
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/bitstream.h"
#include "spandsp/private/bitstream.h"
@@ -132,7 +138,7 @@ SPAN_DECLARE(bitstream_state_t *) bitstream_init(bitstream_state_t *s, int lsb_f
{
if (s == NULL)
{
if ((s = (bitstream_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (bitstream_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
s->bitstream = 0;
@@ -151,7 +157,7 @@ SPAN_DECLARE(int) bitstream_release(bitstream_state_t *s)
SPAN_DECLARE(int) bitstream_free(bitstream_state_t *s)
{
if (s)
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
File diff suppressed because it is too large. Load diff
+7 -6
View File
@@ -32,6 +32,7 @@
#include <inttypes.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/complex.h"
#include "spandsp/complex_filters.h"
@@ -40,7 +41,7 @@ SPAN_DECLARE(filter_t *) filter_create(fspec_t *fs)
int i;
filter_t *fi;
if ((fi = (filter_t *) malloc(sizeof(*fi) + sizeof(float)*(fs->np + 1))))
if ((fi = (filter_t *) span_alloc(sizeof(*fi) + sizeof(float)*(fs->np + 1))))
{
fi->fs = fs;
fi->sum = 0.0;
@@ -56,7 +57,7 @@ SPAN_DECLARE(filter_t *) filter_create(fspec_t *fs)
SPAN_DECLARE(void) filter_delete(filter_t *fi)
{
if (fi)
free(fi);
span_free(fi);
}
/*- End of function --------------------------------------------------------*/
@@ -70,17 +71,17 @@ SPAN_DECLARE(cfilter_t *) cfilter_create(fspec_t *fs)
{
cfilter_t *cfi;
if ((cfi = (cfilter_t *) malloc(sizeof(*cfi))))
if ((cfi = (cfilter_t *) span_alloc(sizeof(*cfi))))
{
if ((cfi->ref = filter_create(fs)) == NULL)
{
free(cfi);
span_free(cfi);
return NULL;
}
if ((cfi->imf = filter_create(fs)) == NULL)
{
free(cfi->ref);
free(cfi);
span_free(cfi->ref);
span_free(cfi);
return NULL;
}
}
+5
View File
@@ -39,6 +39,11 @@
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include <assert.h>
#include "floating_fudge.h"
+5
View File
@@ -39,6 +39,11 @@
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include <assert.h>
#include "floating_fudge.h"
+7 -2
View File
@@ -32,6 +32,11 @@
#include <inttypes.h>
#include <stdio.h>
#include <string.h>
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "spandsp/telephony.h"
#include "spandsp/crc.h"
@@ -102,7 +107,7 @@ SPAN_DECLARE(int) crc_itu32_append(uint8_t *buf, int len)
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) crc_itu32_check(const uint8_t *buf, int len)
SPAN_DECLARE(bool) crc_itu32_check(const uint8_t *buf, int len)
{
uint32_t crc;
int i;
@@ -193,7 +198,7 @@ SPAN_DECLARE(int) crc_itu16_append(uint8_t *buf, int len)
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) crc_itu16_check(const uint8_t *buf, int len)
SPAN_DECLARE(bool) crc_itu16_check(const uint8_t *buf, int len)
{
uint16_t crc;
int i;
+19 -13
View File
@@ -31,18 +31,24 @@
#include <stdlib.h>
#include <inttypes.h>
#include <memory.h>
#include <string.h>
#include <limits.h>
#if defined(HAVE_TGMATH_H)
#include <tgmath.h>
#endif
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include <memory.h>
#include <string.h>
#include <limits.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/fast_convert.h"
#include "spandsp/queue.h"
@@ -93,11 +99,11 @@ static const float dtmf_col[] =
static const char dtmf_positions[] = "123A" "456B" "789C" "*0#D";
static int dtmf_rx_inited = FALSE;
static bool dtmf_rx_inited = false;
static goertzel_descriptor_t dtmf_detect_row[4];
static goertzel_descriptor_t dtmf_detect_col[4];
static int dtmf_tx_inited = FALSE;
static bool dtmf_tx_inited = false;
static tone_gen_descriptor_t dtmf_digit_tones[16];
SPAN_DECLARE(int) dtmf_rx(dtmf_rx_state_t *s, const int16_t amp[], int samples)
@@ -413,7 +419,7 @@ SPAN_DECLARE(dtmf_rx_state_t *) dtmf_rx_init(dtmf_rx_state_t *s,
if (s == NULL)
{
if ((s = (dtmf_rx_state_t *) malloc(sizeof (*s))) == NULL)
if ((s = (dtmf_rx_state_t *) span_alloc(sizeof (*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -423,7 +429,7 @@ SPAN_DECLARE(dtmf_rx_state_t *) dtmf_rx_init(dtmf_rx_state_t *s,
s->digits_callback_data = user_data;
s->realtime_callback = NULL;
s->realtime_callback_data = NULL;
s->filter_dialtone = FALSE;
s->filter_dialtone = false;
s->normal_twist = DTMF_NORMAL_TWIST;
s->reverse_twist = DTMF_REVERSE_TWIST;
s->threshold = DTMF_THRESHOLD;
@@ -438,7 +444,7 @@ SPAN_DECLARE(dtmf_rx_state_t *) dtmf_rx_init(dtmf_rx_state_t *s,
make_goertzel_descriptor(&dtmf_detect_row[i], dtmf_row[i], DTMF_SAMPLES_PER_BLOCK);
make_goertzel_descriptor(&dtmf_detect_col[i], dtmf_col[i], DTMF_SAMPLES_PER_BLOCK);
}
dtmf_rx_inited = TRUE;
dtmf_rx_inited = true;
}
for (i = 0; i < 4; i++)
{
@@ -466,7 +472,7 @@ SPAN_DECLARE(int) dtmf_rx_release(dtmf_rx_state_t *s)
SPAN_DECLARE(int) dtmf_rx_free(dtmf_rx_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -491,10 +497,10 @@ static void dtmf_tx_initialise(void)
DEFAULT_DTMF_TX_OFF_TIME,
0,
0,
FALSE);
false);
}
}
dtmf_tx_inited = TRUE;
dtmf_tx_inited = true;
}
/*- End of function --------------------------------------------------------*/
@@ -578,7 +584,7 @@ SPAN_DECLARE(dtmf_tx_state_t *) dtmf_tx_init(dtmf_tx_state_t *s,
{
if (s == NULL)
{
if ((s = (dtmf_tx_state_t *) malloc(sizeof (*s))) == NULL)
if ((s = (dtmf_tx_state_t *) span_alloc(sizeof (*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -603,7 +609,7 @@ SPAN_DECLARE(int) dtmf_tx_release(dtmf_tx_state_t *s)
SPAN_DECLARE(int) dtmf_tx_free(dtmf_tx_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+23 -23
View File
@@ -88,11 +88,17 @@
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include <string.h>
#include <stdio.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/logging.h"
#include "spandsp/saturated.h"
@@ -105,12 +111,6 @@
#if !defined(NULL)
#define NULL (void *) 0
#endif
#if !defined(FALSE)
#define FALSE 0
#endif
#if !defined(TRUE)
#define TRUE (!FALSE)
#endif
#define NONUPDATE_DWELL_TIME 600 /* 600 samples, or 75ms */
@@ -244,26 +244,26 @@ SPAN_DECLARE(echo_can_state_t *) echo_can_init(int len, int adaption_mode)
int i;
int j;
if ((ec = (echo_can_state_t *) malloc(sizeof(*ec))) == NULL)
if ((ec = (echo_can_state_t *) span_alloc(sizeof(*ec))) == NULL)
return NULL;
memset(ec, 0, sizeof(*ec));
ec->taps = len;
ec->curr_pos = ec->taps - 1;
ec->tap_mask = ec->taps - 1;
if ((ec->fir_taps32 = (int32_t *) malloc(ec->taps*sizeof(int32_t))) == NULL)
if ((ec->fir_taps32 = (int32_t *) span_alloc(ec->taps*sizeof(int32_t))) == NULL)
{
free(ec);
span_free(ec);
return NULL;
}
memset(ec->fir_taps32, 0, ec->taps*sizeof(int32_t));
for (i = 0; i < 4; i++)
{
if ((ec->fir_taps16[i] = (int16_t *) malloc(ec->taps*sizeof(int16_t))) == NULL)
if ((ec->fir_taps16[i] = (int16_t *) span_alloc(ec->taps*sizeof(int16_t))) == NULL)
{
for (j = 0; j < i; j++)
free(ec->fir_taps16[j]);
free(ec->fir_taps32);
free(ec);
span_free(ec->fir_taps16[j]);
span_free(ec->fir_taps32);
span_free(ec);
return NULL;
}
memset(ec->fir_taps16[i], 0, ec->taps*sizeof(int16_t));
@@ -274,7 +274,7 @@ SPAN_DECLARE(echo_can_state_t *) echo_can_init(int len, int adaption_mode)
ec->rx_power_threshold = 10000000;
ec->geigel_max = 0;
ec->geigel_lag = 0;
ec->dtd_onset = FALSE;
ec->dtd_onset = false;
ec->tap_set = 0;
ec->tap_rotate_counter = 1600;
ec->cng_level = 1000;
@@ -294,10 +294,10 @@ SPAN_DECLARE(int) echo_can_free(echo_can_state_t *ec)
int i;
fir16_free(&ec->fir_state);
free(ec->fir_taps32);
span_free(ec->fir_taps32);
for (i = 0; i < 4; i++)
free(ec->fir_taps16[i]);
free(ec);
span_free(ec->fir_taps16[i]);
span_free(ec);
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -337,7 +337,7 @@ SPAN_DECLARE(void) echo_can_flush(echo_can_state_t *ec)
ec->geigel_max = 0;
ec->geigel_lag = 0;
ec->dtd_onset = FALSE;
ec->dtd_onset = false;
ec->tap_set = 0;
ec->tap_rotate_counter = 1600;
@@ -485,7 +485,7 @@ printf("Revert to %d at %d\n", (ec->tap_set + 1)%3, sample_no);
ec->narrowband_score = 0;
}
}
ec->dtd_onset = FALSE;
ec->dtd_onset = false;
if (--ec->tap_rotate_counter <= 0)
{
printf("Rotate to %d at %d\n", ec->tap_set, sample_no);
@@ -532,7 +532,7 @@ printf("Revert to %d at %d\n", (ec->tap_set + 1)%3, sample_no);
for (i = 0; i < ec->taps; i++)
ec->fir_taps32[i] = ec->fir_taps16[(ec->tap_set + 1)%3][i] << 15;
ec->tap_rotate_counter = 1600;
ec->dtd_onset = TRUE;
ec->dtd_onset = true;
}
ec->nonupdate_dwell = NONUPDATE_DWELL_TIME;
}
@@ -575,7 +575,7 @@ printf("Revert to %d at %d\n", (ec->tap_set + 1)%3, sample_no);
if (!ec->cng)
{
ec->cng_level = ec->clean_rx_power;
ec->cng = TRUE;
ec->cng = true;
}
if ((ec->adaption_mode & ECHO_CAN_USE_CNG))
{
@@ -594,12 +594,12 @@ printf("Revert to %d at %d\n", (ec->tap_set + 1)%3, sample_no);
}
else
{
ec->cng = FALSE;
ec->cng = false;
}
}
else
{
ec->cng = FALSE;
ec->cng = false;
}
printf("Narrowband score %4d %5d at %d\n", ec->narrowband_score, score, sample_no);
+19 -12
View File
@@ -40,6 +40,11 @@
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include <assert.h>
#include <fcntl.h>
@@ -50,6 +55,7 @@
#include <tiffio.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/queue.h"
#include "spandsp/dc_restore.h"
@@ -95,6 +101,7 @@
#include "spandsp/private/logging.h"
#include "spandsp/private/silence_gen.h"
#include "spandsp/private/power_meter.h"
#include "spandsp/private/fsk.h"
#include "spandsp/private/modem_connect_tones.h"
#include "spandsp/private/v8.h"
@@ -209,7 +216,7 @@ static int set_next_tx_type(fax_state_t *s)
silence_gen_alter(&t->silence_gen, 0);
fax_modems_set_tx_handler(t, (span_tx_handler_t) &silence_gen, &t->silence_gen);
fax_modems_set_next_tx_handler(t, (span_tx_handler_t) NULL, NULL);
t->transmit = FALSE;
t->transmit = false;
return -1;
}
/*- End of function --------------------------------------------------------*/
@@ -276,7 +283,7 @@ static void fax_set_rx_type(void *user_data, int type, int bit_rate, int short_t
t->current_rx_type = type;
t->rx_bit_rate = bit_rate;
if (use_hdlc)
hdlc_rx_init(&t->hdlc_rx, FALSE, TRUE, HDLC_FRAMING_OK_THRESHOLD, t30_hdlc_accept, &s->t30);
hdlc_rx_init(&t->hdlc_rx, false, true, HDLC_FRAMING_OK_THRESHOLD, t30_hdlc_accept, &s->t30);
switch (type)
{
@@ -319,14 +326,14 @@ static void fax_set_tx_type(void *user_data, int type, int bit_rate, int short_t
silence_gen_alter(&t->silence_gen, ms_to_samples(short_train));
fax_modems_set_tx_handler(t, (span_tx_handler_t) &silence_gen, &t->silence_gen);
fax_modems_set_next_tx_handler(t, (span_tx_handler_t) NULL, NULL);
t->transmit = TRUE;
t->transmit = true;
break;
case T30_MODEM_CED:
case T30_MODEM_CNG:
tone = (type == T30_MODEM_CED) ? FAX_MODEM_CED_TONE_TX : FAX_MODEM_CNG_TONE_TX;
fax_modems_start_slow_modem(t, tone);
fax_modems_set_next_tx_handler(t, (span_tx_handler_t) NULL, NULL);
t->transmit = TRUE;
t->transmit = true;
break;
case T30_MODEM_V21:
fax_modems_start_slow_modem(t, FAX_MODEM_V21_TX);
@@ -339,7 +346,7 @@ static void fax_set_tx_type(void *user_data, int type, int bit_rate, int short_t
silence_gen_alter(&t->silence_gen, ms_to_samples(75));
fax_modems_set_tx_handler(t, (span_tx_handler_t) &silence_gen, &t->silence_gen);
fax_modems_set_next_tx_handler(t, (span_tx_handler_t) &fsk_tx, &t->v21_tx);
t->transmit = TRUE;
t->transmit = true;
break;
case T30_MODEM_V17:
silence_gen_alter(&t->silence_gen, ms_to_samples(75));
@@ -348,7 +355,7 @@ static void fax_set_tx_type(void *user_data, int type, int bit_rate, int short_t
fax_modems_start_fast_modem(t, FAX_MODEM_V17_TX, bit_rate, short_train, use_hdlc);
fax_modems_set_tx_handler(t, (span_tx_handler_t) &silence_gen, &t->silence_gen);
fax_modems_set_next_tx_handler(t, (span_tx_handler_t) &v17_tx, &t->fast_modems.v17_tx);
t->transmit = TRUE;
t->transmit = true;
break;
case T30_MODEM_V27TER:
silence_gen_alter(&t->silence_gen, ms_to_samples(75));
@@ -357,7 +364,7 @@ static void fax_set_tx_type(void *user_data, int type, int bit_rate, int short_t
fax_modems_start_fast_modem(t, FAX_MODEM_V27TER_TX, bit_rate, short_train, use_hdlc);
fax_modems_set_tx_handler(t, (span_tx_handler_t) &silence_gen, &t->silence_gen);
fax_modems_set_next_tx_handler(t, (span_tx_handler_t) &v27ter_tx, &t->fast_modems.v27ter_tx);
t->transmit = TRUE;
t->transmit = true;
break;
case T30_MODEM_V29:
silence_gen_alter(&t->silence_gen, ms_to_samples(75));
@@ -366,7 +373,7 @@ static void fax_set_tx_type(void *user_data, int type, int bit_rate, int short_t
fax_modems_start_fast_modem(t, FAX_MODEM_V29_TX, bit_rate, short_train, use_hdlc);
fax_modems_set_tx_handler(t, (span_tx_handler_t) &silence_gen, &t->silence_gen);
fax_modems_set_next_tx_handler(t, (span_tx_handler_t) &v29_tx, &t->fast_modems.v29_tx);
t->transmit = TRUE;
t->transmit = true;
break;
case T30_MODEM_DONE:
span_log(&s->logging, SPAN_LOG_FLOW, "FAX exchange complete\n");
@@ -375,7 +382,7 @@ static void fax_set_tx_type(void *user_data, int type, int bit_rate, int short_t
silence_gen_alter(&t->silence_gen, 0);
fax_modems_set_tx_handler(t, (span_tx_handler_t) &silence_gen, &t->silence_gen);
fax_modems_set_next_tx_handler(t, (span_tx_handler_t) NULL, NULL);
t->transmit = FALSE;
t->transmit = false;
break;
}
t->tx_bit_rate = bit_rate;
@@ -470,14 +477,14 @@ SPAN_DECLARE(fax_state_t *) fax_init(fax_state_t *s, int calling_party)
if (s == NULL)
{
if ((s = (fax_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (fax_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
span_log_init(&s->logging, SPAN_LOG_NONE, NULL);
span_log_set_protocol(&s->logging, "FAX");
fax_modems_init(&s->modems,
FALSE,
false,
t30_hdlc_accept,
hdlc_underflow_handler,
t30_non_ecm_put_bit,
@@ -525,7 +532,7 @@ SPAN_DECLARE(int) fax_release(fax_state_t *s)
SPAN_DECLARE(int) fax_free(fax_state_t *s)
{
t30_release(&s->t30);
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+18 -11
View File
@@ -39,6 +39,11 @@
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include <assert.h>
#include <fcntl.h>
@@ -48,6 +53,7 @@
#endif
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/bit_operations.h"
#include "spandsp/dc_restore.h"
@@ -73,6 +79,7 @@
#include "spandsp/private/logging.h"
#include "spandsp/private/silence_gen.h"
#include "spandsp/private/power_meter.h"
#include "spandsp/private/fsk.h"
#include "spandsp/private/v17tx.h"
#include "spandsp/private/v17rx.h"
@@ -92,7 +99,7 @@ static void fax_modems_hdlc_accept(void *user_data, const uint8_t *msg, int len,
s = (fax_modems_state_t *) user_data;
if (ok)
s->rx_frame_received = TRUE;
s->rx_frame_received = false;
if (s->hdlc_accept)
s->hdlc_accept(s->hdlc_accept_user_data, msg, len, ok);
}
@@ -263,7 +270,7 @@ SPAN_DECLARE(void) fax_modems_start_slow_modem(fax_modems_state_t *s, int which)
fsk_rx_init(&s->v21_rx, &preset_fsk_specs[FSK_V21CH2], FSK_FRAME_MODE_SYNC, (put_bit_func_t) hdlc_rx_put_bit, &s->hdlc_rx);
fax_modems_set_rx_handler(s, (span_rx_handler_t) &fsk_rx, &s->v21_rx, (span_rx_fillin_handler_t) &fsk_rx_fillin, &s->v21_rx);
fsk_rx_signal_cutoff(&s->v21_rx, -39.09f);
s->rx_frame_received = FALSE;
s->rx_frame_received = false;
break;
case FAX_MODEM_CED_TONE_RX:
modem_connect_tones_rx_init(&s->connect_rx, MODEM_CONNECT_TONES_FAX_CED, s->tone_callback, s->tone_callback_user_data);
@@ -321,10 +328,10 @@ SPAN_DECLARE(void) fax_modems_start_fast_modem(fax_modems_state_t *s, int which,
if (s->fast_modem != which)
{
s->current_rx_type = which;
s->short_train = FALSE;
s->short_train = false;
s->fast_modem = which;
if (hdlc_mode)
s->rx_frame_received = FALSE;
s->rx_frame_received = false;
switch (s->fast_modem)
{
case FAX_MODEM_V27TER_RX:
@@ -367,13 +374,13 @@ SPAN_DECLARE(void) fax_modems_start_fast_modem(fax_modems_state_t *s, int which,
switch (s->fast_modem)
{
case FAX_MODEM_V27TER_RX:
v27ter_rx_restart(&s->fast_modems.v27ter_rx, s->bit_rate, FALSE);
v27ter_rx_restart(&s->fast_modems.v27ter_rx, s->bit_rate, false);
v27ter_rx_set_put_bit(&s->fast_modems.v27ter_rx, put_bit, put_bit_user_data);
v27ter_rx_set_modem_status_handler(&s->fast_modems.v27ter_rx, v27ter_rx_status_handler, s);
fax_modems_set_rx_handler(s, (span_rx_handler_t) &fax_modems_v27ter_v21_rx, s, (span_rx_fillin_handler_t) &fax_modems_v27ter_v21_rx_fillin, s);
break;
case FAX_MODEM_V29_RX:
v29_rx_restart(&s->fast_modems.v29_rx, s->bit_rate, FALSE);
v29_rx_restart(&s->fast_modems.v29_rx, s->bit_rate, false);
v29_rx_set_put_bit(&s->fast_modems.v29_rx, put_bit, put_bit_user_data);
v29_rx_set_modem_status_handler(&s->fast_modems.v29_rx, v29_rx_status_handler, s);
fax_modems_set_rx_handler(s, (span_rx_handler_t) &fax_modems_v29_v21_rx, s, (span_rx_fillin_handler_t) &fax_modems_v29_v21_rx_fillin, s);
@@ -503,7 +510,7 @@ SPAN_DECLARE(fax_modems_state_t *) fax_modems_init(fax_modems_state_t *s,
{
if (s == NULL)
{
if ((s = (fax_modems_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (fax_modems_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
/*endif*/
@@ -534,15 +541,15 @@ SPAN_DECLARE(fax_modems_state_t *) fax_modems_init(fax_modems_state_t *s,
s->hdlc_accept = hdlc_accept;
s->hdlc_accept_user_data = user_data;
hdlc_rx_init(&s->hdlc_rx, FALSE, FALSE, HDLC_FRAMING_OK_THRESHOLD, fax_modems_hdlc_accept, s);
hdlc_tx_init(&s->hdlc_tx, FALSE, 2, FALSE, hdlc_tx_underflow, user_data);
hdlc_rx_init(&s->hdlc_rx, false, false, HDLC_FRAMING_OK_THRESHOLD, fax_modems_hdlc_accept, s);
hdlc_tx_init(&s->hdlc_tx, false, 2, false, hdlc_tx_underflow, user_data);
fax_modems_start_slow_modem(s, FAX_MODEM_V21_RX);
fsk_tx_init(&s->v21_tx, &preset_fsk_specs[FSK_V21CH2], (get_bit_func_t) hdlc_tx_get_bit, &s->hdlc_tx);
silence_gen_init(&s->silence_gen, 0);
s->rx_signal_present = FALSE;
s->rx_signal_present = false;
s->rx_handler = (span_rx_handler_t) &span_dummy_rx;
s->rx_fillin_handler = (span_rx_fillin_handler_t) &span_dummy_rx;
s->rx_user_data = NULL;
@@ -562,7 +569,7 @@ SPAN_DECLARE(int) fax_modems_release(fax_modems_state_t *s)
SPAN_DECLARE(int) fax_modems_free(fax_modems_state_t *s)
{
if (s)
free(s);
span_free(s);
/*endif*/
return 0;
}
+9 -11
View File
@@ -32,29 +32,27 @@
#include <inttypes.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <time.h>
#include <fcntl.h>
#if defined(HAVE_TGMATH_H)
#include <tgmath.h>
#endif
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include <string.h>
#include <stdio.h>
#include <time.h>
#include <fcntl.h>
#include "spandsp/telephony.h"
#include "spandsp/complex.h"
#include "filter_tools.h"
#if !defined(FALSE)
#define FALSE 0
#endif
#if !defined(TRUE)
#define TRUE (!FALSE)
#endif
#define MAXPZ 8192
#define SEQ_LEN 8192
#define MAX_FFT_LEN SEQ_LEN
+22 -6
View File
@@ -38,16 +38,23 @@
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include <assert.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/complex.h"
#include "spandsp/dds.h"
#include "spandsp/power_meter.h"
#include "spandsp/async.h"
#include "spandsp/fsk.h"
#include "spandsp/private/power_meter.h"
#include "spandsp/private/fsk.h"
const fsk_spec_t preset_fsk_specs[] =
@@ -69,6 +76,7 @@ const fsk_spec_t preset_fsk_specs[] =
300*100
},
{
/* This is mode 2 of the V.23 spec. Mode 1 (the 600baud mode) is not defined here */
"V23 ch 1",
1700 + 400,
1700 - 400,
@@ -124,6 +132,14 @@ const fsk_spec_t preset_fsk_specs[] =
-30,
50*100
},
{
"Weitbrecht 47.6", /* Used for V.18 probing */
1600 + 200,
1600 - 200,
-14,
-30,
4760
},
{
"V21 (110bps) ch 1",
1080 + 100,
@@ -145,7 +161,7 @@ SPAN_DECLARE(int) fsk_tx_restart(fsk_tx_state_t *s, const fsk_spec_t *spec)
s->baud_frac = 0;
s->current_phase_rate = s->phase_rates[1];
s->shutdown = FALSE;
s->shutdown = false;
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -157,7 +173,7 @@ SPAN_DECLARE(fsk_tx_state_t *) fsk_tx_init(fsk_tx_state_t *s,
{
if (s == NULL)
{
if ((s = (fsk_tx_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (fsk_tx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -177,7 +193,7 @@ SPAN_DECLARE(int) fsk_tx_release(fsk_tx_state_t *s)
SPAN_DECLARE(int) fsk_tx_free(fsk_tx_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -204,7 +220,7 @@ SPAN_DECLARE_NONSTD(int) fsk_tx(fsk_tx_state_t *s, int16_t amp[], int len)
s->status_handler(s->status_user_data, SIG_STATUS_END_OF_DATA);
if (s->status_handler)
s->status_handler(s->status_user_data, SIG_STATUS_SHUTDOWN_COMPLETE);
s->shutdown = TRUE;
s->shutdown = true;
break;
}
s->current_phase_rate = s->phase_rates[bit & 1];
@@ -319,7 +335,7 @@ SPAN_DECLARE(fsk_rx_state_t *) fsk_rx_init(fsk_rx_state_t *s,
{
if (s == NULL)
{
if ((s = (fsk_rx_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (fsk_rx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -339,7 +355,7 @@ SPAN_DECLARE(int) fsk_rx_release(fsk_rx_state_t *s)
SPAN_DECLARE(int) fsk_rx_free(fsk_rx_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+3 -2
View File
@@ -35,6 +35,7 @@
#include <assert.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/bit_operations.h"
#include "spandsp/g711.h"
#include "spandsp/private/g711.h"
@@ -171,7 +172,7 @@ SPAN_DECLARE(g711_state_t *) g711_init(g711_state_t *s, int mode)
{
if (s == NULL)
{
if ((s = (g711_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (g711_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
s->mode = mode;
@@ -187,7 +188,7 @@ SPAN_DECLARE(int) g711_release(g711_state_t *s)
SPAN_DECLARE(int) g711_free(g711_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+16 -10
View File
@@ -38,9 +38,15 @@
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/saturated.h"
#include "spandsp/vector_int.h"
@@ -251,7 +257,7 @@ SPAN_DECLARE(g722_decode_state_t *) g722_decode_init(g722_decode_state_t *s, int
{
if (s == NULL)
{
if ((s = (g722_decode_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (g722_decode_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -262,11 +268,11 @@ SPAN_DECLARE(g722_decode_state_t *) g722_decode_init(g722_decode_state_t *s, int
else
s->bits_per_sample = 8;
if ((options & G722_SAMPLE_RATE_8000))
s->eight_k = TRUE;
s->eight_k = true;
if ((options & G722_PACKED) && s->bits_per_sample != 8)
s->packed = TRUE;
s->packed = true;
else
s->packed = FALSE;
s->packed = false;
s->band[0].det = 32;
s->band[1].det = 8;
return s;
@@ -281,7 +287,7 @@ SPAN_DECLARE(int) g722_decode_release(g722_decode_state_t *s)
SPAN_DECLARE(int) g722_decode_free(g722_decode_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -432,7 +438,7 @@ SPAN_DECLARE(g722_encode_state_t *) g722_encode_init(g722_encode_state_t *s, int
{
if (s == NULL)
{
if ((s = (g722_encode_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (g722_encode_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -443,11 +449,11 @@ SPAN_DECLARE(g722_encode_state_t *) g722_encode_init(g722_encode_state_t *s, int
else
s->bits_per_sample = 8;
if ((options & G722_SAMPLE_RATE_8000))
s->eight_k = TRUE;
s->eight_k = true;
if ((options & G722_PACKED) && s->bits_per_sample != 8)
s->packed = TRUE;
s->packed = true;
else
s->packed = FALSE;
s->packed = false;
s->band[0].det = 32;
s->band[1].det = 8;
return s;
@@ -462,7 +468,7 @@ SPAN_DECLARE(int) g722_encode_release(g722_encode_state_t *s)
SPAN_DECLARE(int) g722_encode_free(g722_encode_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+16 -10
View File
@@ -64,9 +64,15 @@
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/bitstream.h"
#include "spandsp/bit_operations.h"
#include "spandsp/g711.h"
@@ -393,7 +399,7 @@ static void update(g726_state_t *s,
int16_t thr;
int16_t pk0;
int i;
int tr;
bool tr;
a2p = 0;
/* Needed in updating predictor poles */
@@ -408,11 +414,11 @@ static void update(g726_state_t *s,
thr = (ylint > 9) ? (31 << 10) : ((32 + ylfrac) << ylint);
dqthr = (thr + (thr >> 1)) >> 1; /* dqthr = 0.75 * thr */
if (!s->td) /* signal supposed voice */
tr = FALSE;
tr = false;
else if (mag <= dqthr) /* supposed data, but small mag */
tr = FALSE; /* treated as voice */
tr = false; /* treated as voice */
else /* signal is data (modem) */
tr = TRUE;
tr = true;
/*
* Quantizer scale factor adaptation.
@@ -563,11 +569,11 @@ static void update(g726_state_t *s,
/* TONE */
if (tr) /* this sample has been treated as data */
s->td = FALSE; /* next one will be treated as voice */
s->td = false; /* next one will be treated as voice */
else if (a2p < -11776) /* small sample-to-sample correlation */
s->td = TRUE; /* signal may be data */
s->td = true; /* signal may be data */
else /* signal is voice */
s->td = FALSE;
s->td = false;
/* Adaptation speed control. */
/* FILTA */
@@ -1002,7 +1008,7 @@ SPAN_DECLARE(g726_state_t *) g726_init(g726_state_t *s, int bit_rate, int ext_co
return NULL;
if (s == NULL)
{
if ((s = (g726_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (g726_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
s->yl = 34816;
@@ -1024,7 +1030,7 @@ SPAN_DECLARE(g726_state_t *) g726_init(g726_state_t *s, int bit_rate, int ext_co
s->b[i] = 0;
s->dq[i] = 32;
}
s->td = FALSE;
s->td = false;
switch (bit_rate)
{
case 16000:
@@ -1062,7 +1068,7 @@ SPAN_DECLARE(int) g726_release(g726_state_t *s)
SPAN_DECLARE(int) g726_free(g726_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+3 -2
View File
@@ -45,6 +45,7 @@
#include <memory.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/bitstream.h"
#include "spandsp/saturated.h"
@@ -115,7 +116,7 @@ SPAN_DECLARE(gsm0610_state_t *) gsm0610_init(gsm0610_state_t *s, int packing)
{
if (s == NULL)
{
if ((s = (gsm0610_state_t *) malloc(sizeof (*s))) == NULL)
if ((s = (gsm0610_state_t *) span_alloc(sizeof (*s))) == NULL)
return NULL;
/*endif*/
}
@@ -136,7 +137,7 @@ SPAN_DECLARE(int) gsm0610_release(gsm0610_state_t *s)
SPAN_DECLARE(int) gsm0610_free(gsm0610_state_t *s)
{
if (s)
free(s);
span_free(s);
/*endif*/
return 0;
}
+1 -1
View File
@@ -59,7 +59,7 @@
static void weighting_filter(int16_t x[40],
const int16_t *e) // signal [-5..0.39.44] IN)
{
#if defined(__GNUC__) && defined(SPANDSP_USE_MMX) && defined(__x86_64__) && !(defined(__APPLE_CC__) && __APPLE_CC__ >= 5448)
#if defined(__GNUC__) && defined(SPANDSP_USE_MMX) && defined(__x86_64__)
/* Table 4.4 Coefficients of the weighting filter */
/* This must be padded to a multiple of 4 for MMX to work */
static const union
+29 -23
View File
@@ -33,8 +33,14 @@
#include <inttypes.h>
#include <string.h>
#include <stdio.h>
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/async.h"
#include "spandsp/crc.h"
#include "spandsp/bit_operations.h"
@@ -46,7 +52,7 @@ static void report_status_change(hdlc_rx_state_t *s, int status)
if (s->status_handler)
s->status_handler(s->status_user_data, status);
else if (s->frame_handler)
s->frame_handler(s->frame_user_data, NULL, status, TRUE);
s->frame_handler(s->frame_user_data, NULL, status, true);
}
/*- End of function --------------------------------------------------------*/
@@ -62,7 +68,7 @@ static void rx_special_condition(hdlc_rx_state_t *s, int status)
s->len = 0;
s->num_bits = 0;
s->flags_seen = 0;
s->framing_ok_announced = FALSE;
s->framing_ok_announced = false;
/* Fall through */
case SIG_STATUS_TRAINING_IN_PROGRESS:
case SIG_STATUS_TRAINING_FAILED:
@@ -94,7 +100,7 @@ static __inline__ void octet_set_and_count(hdlc_rx_state_t *s)
}
else
{
s->octet_counting_mode = TRUE;
s->octet_counting_mode = true;
s->octet_count = s->octet_count_report_interval;
}
}
@@ -139,7 +145,7 @@ static void rx_flag_or_abort(hdlc_rx_state_t *s)
{
/* Hit HDLC flag */
/* A flag clears octet counting */
s->octet_counting_mode = FALSE;
s->octet_counting_mode = false;
if (s->flags_seen >= s->framing_ok_threshold)
{
/* We may have a frame, or we may have back to back flags */
@@ -155,7 +161,7 @@ static void rx_flag_or_abort(hdlc_rx_state_t *s)
s->rx_bytes += s->len - s->crc_bytes;
s->len -= s->crc_bytes;
if (s->frame_handler)
s->frame_handler(s->frame_user_data, s->buffer, s->len, TRUE);
s->frame_handler(s->frame_user_data, s->buffer, s->len, true);
}
else
{
@@ -164,7 +170,7 @@ static void rx_flag_or_abort(hdlc_rx_state_t *s)
{
s->len -= s->crc_bytes;
if (s->frame_handler)
s->frame_handler(s->frame_user_data, s->buffer, s->len, FALSE);
s->frame_handler(s->frame_user_data, s->buffer, s->len, false);
}
}
}
@@ -180,7 +186,7 @@ static void rx_flag_or_abort(hdlc_rx_state_t *s)
else
s->len = 0;
if (s->frame_handler)
s->frame_handler(s->frame_user_data, s->buffer, s->len, FALSE);
s->frame_handler(s->frame_user_data, s->buffer, s->len, false);
}
s->rx_length_errors++;
}
@@ -205,7 +211,7 @@ static void rx_flag_or_abort(hdlc_rx_state_t *s)
if (++s->flags_seen >= s->framing_ok_threshold && !s->framing_ok_announced)
{
report_status_change(s, SIG_STATUS_FRAMING_OK);
s->framing_ok_announced = TRUE;
s->framing_ok_announced = true;
}
}
}
@@ -306,15 +312,15 @@ SPAN_DECLARE(void) hdlc_rx_set_octet_counting_report_interval(hdlc_rx_state_t *s
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(hdlc_rx_state_t *) hdlc_rx_init(hdlc_rx_state_t *s,
int crc32,
int report_bad_frames,
bool crc32,
bool report_bad_frames,
int framing_ok_threshold,
hdlc_frame_handler_t handler,
void *user_data)
{
if (s == NULL)
{
if ((s = (hdlc_rx_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (hdlc_rx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -350,7 +356,7 @@ SPAN_DECLARE(int) hdlc_rx_release(hdlc_rx_state_t *s)
SPAN_DECLARE(int) hdlc_rx_free(hdlc_rx_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -371,7 +377,7 @@ SPAN_DECLARE(int) hdlc_tx_frame(hdlc_tx_state_t *s, const uint8_t *frame, size_t
{
if (len <= 0)
{
s->tx_end = TRUE;
s->tx_end = true;
return 0;
}
if (s->len + len > s->max_frame_len)
@@ -397,7 +403,7 @@ SPAN_DECLARE(int) hdlc_tx_frame(hdlc_tx_state_t *s, const uint8_t *frame, size_t
s->len += len;
else
s->len = len;
s->tx_end = FALSE;
s->tx_end = false;
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -412,8 +418,8 @@ SPAN_DECLARE(int) hdlc_tx_flags(hdlc_tx_state_t *s, int len)
s->flag_octets += -len;
else
s->flag_octets = len;
s->report_flag_underflow = TRUE;
s->tx_end = FALSE;
s->report_flag_underflow = true;
s->tx_end = false;
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -452,7 +458,7 @@ SPAN_DECLARE_NONSTD(int) hdlc_tx_get_byte(hdlc_tx_state_t *s)
/* We are in a timed flag section (preamble, inter frame gap, etc.) */
if (--s->flag_octets <= 0 && s->report_flag_underflow)
{
s->report_flag_underflow = FALSE;
s->report_flag_underflow = false;
if (s->len == 0)
{
/* The timed flags have finished, there is nothing else queued to go,
@@ -508,7 +514,7 @@ SPAN_DECLARE_NONSTD(int) hdlc_tx_get_byte(hdlc_tx_state_t *s)
s->crc = 0xFFFFFFFF;
/* Report the underflow now. If there are timed flags still in progress, loading the
next frame right now will be harmless. */
s->report_flag_underflow = FALSE;
s->report_flag_underflow = false;
if (s->underflow_handler)
s->underflow_handler(s->user_data);
/* Make sure we finish off with at least one flag octet, if the underflow report did not result
@@ -539,7 +545,7 @@ SPAN_DECLARE_NONSTD(int) hdlc_tx_get_byte(hdlc_tx_state_t *s)
/* Untimed idling on flags */
if (s->tx_end)
{
s->tx_end = FALSE;
s->tx_end = false;
return SIG_STATUS_END_OF_DATA;
}
return s->idle_octet;
@@ -584,15 +590,15 @@ SPAN_DECLARE(void) hdlc_tx_set_max_frame_len(hdlc_tx_state_t *s, size_t max_len)
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(hdlc_tx_state_t *) hdlc_tx_init(hdlc_tx_state_t *s,
int crc32,
bool crc32,
int inter_frame_flags,
int progressive,
bool progressive,
hdlc_underflow_handler_t handler,
void *user_data)
{
if (s == NULL)
{
if ((s = (hdlc_tx_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (hdlc_tx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -624,7 +630,7 @@ SPAN_DECLARE(int) hdlc_tx_release(hdlc_tx_state_t *s)
SPAN_DECLARE(int) hdlc_tx_free(hdlc_tx_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+3 -2
View File
@@ -42,6 +42,7 @@
#include "floating_fudge.h"
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/saturated.h"
#include "spandsp/ima_adpcm.h"
@@ -282,7 +283,7 @@ SPAN_DECLARE(ima_adpcm_state_t *) ima_adpcm_init(ima_adpcm_state_t *s,
{
if (s == NULL)
{
if ((s = (ima_adpcm_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (ima_adpcm_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
/*endif*/
@@ -301,7 +302,7 @@ SPAN_DECLARE(int) ima_adpcm_release(ima_adpcm_state_t *s)
SPAN_DECLARE(int) ima_adpcm_free(ima_adpcm_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+12 -6
View File
@@ -47,11 +47,17 @@
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include <tiffio.h>
#include <assert.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/logging.h"
#include "spandsp/saturated.h"
@@ -712,7 +718,7 @@ SPAN_DECLARE(int) image_translate_restart(image_translate_state_t *s, int input_
{
if (s->raw_pixel_row[i] == NULL)
{
if ((s->raw_pixel_row[i] = (uint8_t *) malloc(raw_row_size)) == NULL)
if ((s->raw_pixel_row[i] = (uint8_t *) span_alloc(raw_row_size)) == NULL)
return -1;
}
memset(s->raw_pixel_row[i], 0, raw_row_size);
@@ -729,7 +735,7 @@ SPAN_DECLARE(int) image_translate_restart(image_translate_state_t *s, int input_
{
if (s->pixel_row[i] == NULL)
{
if ((s->pixel_row[i] = (uint8_t *) malloc(raw_row_size)) == NULL)
if ((s->pixel_row[i] = (uint8_t *) span_alloc(raw_row_size)) == NULL)
return -1;
}
memset(s->pixel_row[i], 0, raw_row_size);
@@ -757,7 +763,7 @@ SPAN_DECLARE(image_translate_state_t *) image_translate_init(image_translate_sta
{
if (s == NULL)
{
if ((s = (image_translate_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (image_translate_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -794,12 +800,12 @@ SPAN_DECLARE(int) image_translate_release(image_translate_state_t *s)
{
if (s->raw_pixel_row[i])
{
free(s->raw_pixel_row[i]);
span_free(s->raw_pixel_row[i]);
s->raw_pixel_row[i] = NULL;
}
if (s->pixel_row[i])
{
free(s->pixel_row[i]);
span_free(s->pixel_row[i]);
s->pixel_row[i] = NULL;
}
}
@@ -812,7 +818,7 @@ SPAN_DECLARE(int) image_translate_free(image_translate_state_t *s)
int res;
res = image_translate_release(s);
free(s);
span_free(s);
return res;
}
/*- End of function --------------------------------------------------------*/
+4
View File
@@ -157,6 +157,7 @@
<ItemGroup>
<ClCompile Include="ademco_contactid.c" />
<ClCompile Include="adsi.c" />
<ClCompile Include="alloc.c" />
<ClCompile Include="async.c" />
<ClCompile Include="at_interpreter.c" />
<ClCompile Include="awgn.c" />
@@ -427,6 +428,9 @@
<Project>{dee932ab-5911-4700-9eeb-8c7090a0a330}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="msvc\make_cielab_luts.2010.vcxproj">
<Project>{85f0cf8c-c7ab-48f6-ba19-cc94cf87f981}</Project>
</ProjectReference>
<ProjectReference Include="msvc\make_math_fixed_tables.2010.vcxproj">
<Project>{9d04a840-ce18-4ff5-a6d3-0a2bb92ff2e6}</Project>
</ProjectReference>
@@ -283,6 +283,9 @@
<ClCompile Include="math_fixed.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="alloc.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="spandsp\adsi.h">
+4
View File
@@ -161,6 +161,7 @@
<ItemGroup>
<ClCompile Include="ademco_contactid.c" />
<ClCompile Include="adsi.c" />
<ClCompile Include="alloc.c" />
<ClCompile Include="async.c" />
<ClCompile Include="at_interpreter.c" />
<ClCompile Include="awgn.c" />
@@ -431,6 +432,9 @@
<Project>{dee932ab-5911-4700-9eeb-8c7090a0a330}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="msvc\make_cielab_luts.2012.vcxproj">
<Project>{85f0cf8c-c7ab-48f6-ba19-cc94cf87f981}</Project>
</ProjectReference>
<ProjectReference Include="msvc\make_math_fixed_tables.2012.vcxproj">
<Project>{2386b892-35f5-46cf-a0f0-10394d2fbf9b}</Project>
</ProjectReference>
@@ -283,6 +283,9 @@
<ClCompile Include="math_fixed.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="alloc.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="spandsp\adsi.h">
+11 -5
View File
@@ -40,8 +40,14 @@
#include <signal.h>
#include <sys/time.h>
#include <time.h>
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/private/logging.h"
@@ -73,11 +79,11 @@ static void default_message_handler(void *user_data, int level, const char *text
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) span_log_test(logging_state_t *s, int level)
SPAN_DECLARE(bool) span_log_test(logging_state_t *s, int level)
{
if (s && (s->level & SPAN_LOG_SEVERITY_MASK) >= (level & SPAN_LOG_SEVERITY_MASK))
return TRUE;
return FALSE;
return true;
return false;
}
/*- End of function --------------------------------------------------------*/
@@ -229,7 +235,7 @@ SPAN_DECLARE(logging_state_t *) span_log_init(logging_state_t *s, int level, con
{
if (s == NULL)
{
if ((s = (logging_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (logging_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
s->span_message = __span_message;
@@ -252,7 +258,7 @@ SPAN_DECLARE(int) span_log_release(logging_state_t *s)
SPAN_DECLARE(int) span_log_free(logging_state_t *s)
{
if (s)
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+7 -2
View File
@@ -41,6 +41,11 @@
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include "spandsp/telephony.h"
@@ -349,7 +354,7 @@ static void onset(lpc10_encode_state_t *s,
osbuf[*osptr - 1] = i - 9;
(*osptr)++;
}
s->hyst = TRUE;
s->hyst = true;
}
s->lasti = i;
/* After one onset detection, at least OSHYST sample times must go */
@@ -357,7 +362,7 @@ static void onset(lpc10_encode_state_t *s,
}
else if (s->hyst && i - s->lasti >= 10)
{
s->hyst = FALSE;
s->hyst = false;
}
}
}
+14 -8
View File
@@ -34,16 +34,22 @@
#include <stdlib.h>
#include <stdio.h>
#include <inttypes.h>
#include <memory.h>
#if defined(HAVE_TGMATH_H)
#include <tgmath.h>
#endif
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include <memory.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/lpc10.h"
#include "spandsp/private/lpc10.h"
@@ -279,7 +285,7 @@ static int pitsyn(lpc10_decode_state_t *s,
ipiti[i] = *pitch;
rmsi[i] = *rms;
}
s->first_pitsyn = FALSE;
s->first_pitsyn = false;
}
else
{
@@ -406,7 +412,7 @@ static int pitsyn(lpc10_decode_state_t *s,
/* NOUT | -- -- -- -- ?? ?? */
/* IVOICE | -- -- -- -- 0 0 */
/* UVPIT is always 0.0 on the first pass through the DO WHILE (TRUE)
/* UVPIT is always 0.0 on the first pass through the DO WHILE (true)
loop below. */
/* The only possible non-0 value of SLOPE (in column 111) is
@@ -857,7 +863,7 @@ static void decode(lpc10_decode_state_t *s,
/* Skip decoding on first frame because present data not yet available */
if (s->first)
{
s->first = FALSE;
s->first = false;
/* Assign PITCH a "default" value on the first call, since */
/* otherwise it would be left uninitialized. The two lines */
/* below were copied from above, since it seemed like a */
@@ -1016,7 +1022,7 @@ SPAN_DECLARE(lpc10_decode_state_t *) lpc10_decode_init(lpc10_decode_state_t *s,
if (s == NULL)
{
if ((s = (lpc10_decode_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (lpc10_decode_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
@@ -1024,7 +1030,7 @@ SPAN_DECLARE(lpc10_decode_state_t *) lpc10_decode_init(lpc10_decode_state_t *s,
/* State used by function decode */
s->iptold = 60;
s->first = TRUE;
s->first = true;
s->ivp2h = 0;
s->iovoic = 0;
s->iavgp = 60;
@@ -1044,7 +1050,7 @@ SPAN_DECLARE(lpc10_decode_state_t *) lpc10_decode_init(lpc10_decode_state_t *s,
/* State used by function pitsyn */
s->rmso = 1.0f;
s->first_pitsyn = TRUE;
s->first_pitsyn = true;
/* State used by function bsynz */
s->ipo = 0;
@@ -1084,7 +1090,7 @@ SPAN_DECLARE(int) lpc10_decode_release(lpc10_decode_state_t *s)
SPAN_DECLARE(int) lpc10_decode_free(lpc10_decode_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+9 -3
View File
@@ -41,9 +41,15 @@
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/lpc10.h"
#include "spandsp/private/lpc10.h"
@@ -269,7 +275,7 @@ SPAN_DECLARE(lpc10_encode_state_t *) lpc10_encode_init(lpc10_encode_state_t *s,
if (s == NULL)
{
if ((s = (lpc10_encode_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (lpc10_encode_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
@@ -321,7 +327,7 @@ SPAN_DECLARE(lpc10_encode_state_t *) lpc10_encode_init(lpc10_encode_state_t *s,
s->l2sum1 = 0.0f;
s->l2ptr1 = 1;
s->l2ptr2 = 9;
s->hyst = FALSE;
s->hyst = false;
/* State used by function lpc10_voicing */
s->dither = 20.0f;
@@ -367,7 +373,7 @@ SPAN_DECLARE(int) lpc10_encode_release(lpc10_encode_state_t *s)
SPAN_DECLARE(int) lpc10_encode_free(lpc10_encode_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+11 -6
View File
@@ -41,6 +41,11 @@
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include "spandsp/telephony.h"
@@ -67,7 +72,7 @@ void lpc10_placea(int32_t *ipitch,
int32_t k;
int32_t l;
int32_t hrange;
int ephase;
bool ephase;
int32_t lrange;
lrange = (af - 2)*lframe + 1;
@@ -148,14 +153,14 @@ void lpc10_placea(int32_t *ipitch,
awin[af - 1][1] += *ipitch;
}
/* Make energy window be phase-synchronous. */
ephase = TRUE;
ephase = true;
}
else
{
/* Case 3 */
awin[af - 1][0] = vwin[af - 1][0];
awin[af - 1][1] = vwin[af - 1][1];
ephase = FALSE;
ephase = false;
}
/* RMS is computed over an integer number of pitch periods in the analysis
window. When it is not placed phase-synchronously, it is placed as close
@@ -193,7 +198,7 @@ void lpc10_placev(int32_t *osbuf,
{
int32_t i1;
int32_t i2;
int crit;
bool crit;
int32_t q;
int32_t osptr1;
int32_t hrange;
@@ -286,12 +291,12 @@ void lpc10_placev(int32_t *osbuf,
q++;
/* Check for case 2 (placement before onset): */
/* Check for critical region exception: */
crit = FALSE;
crit = false;
for (i = q + 1; i < osptr1; i++)
{
if (osbuf[i - 1] - osbuf[q - 1] >= minwin)
{
crit = TRUE;
crit = true;
break;
}
}
+5
View File
@@ -41,6 +41,11 @@
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include "spandsp/telephony.h"
+14 -16
View File
@@ -31,17 +31,22 @@
#include <inttypes.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <time.h>
#include <fcntl.h>
#if defined(HAVE_TGMATH_H)
#include <tgmath.h>
#endif
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include <string.h>
#include <stdio.h>
#include <time.h>
#include <fcntl.h>
#if defined(__sunos) || defined(__solaris) || defined(__sun)
#include <getopt.h>
#endif
@@ -50,13 +55,6 @@
#include "spandsp/complex.h"
#include "filter_tools.h"
#if !defined(FALSE)
#define FALSE 0
#endif
#if !defined(TRUE)
#define TRUE (!FALSE)
#endif
//#define SAMPLE_RATE 8000.0
#define MAX_COEFFS_PER_FILTER 128
#define MAX_COEFF_SETS 384
@@ -84,7 +82,7 @@ static void make_tx_filter(int coeff_sets,
alpha = baud_rate/(2.0*(double) (coeff_sets*baud_rate));
beta = excess_bandwidth;
compute_raised_cosine_filter(coeffs, total_coeffs, TRUE, FALSE, alpha, beta);
compute_raised_cosine_filter(coeffs, total_coeffs, true, false, alpha, beta);
/* Find the DC gain of the filter, and adjust the filter to unity gain. */
floating_gain = 0.0;
@@ -180,7 +178,7 @@ static void make_rx_filter(int coeff_sets,
beta = excess_bandwidth;
carrier *= 2.0*3.1415926535/SAMPLE_RATE;
compute_raised_cosine_filter(coeffs, total_coeffs, TRUE, FALSE, alpha, beta);
compute_raised_cosine_filter(coeffs, total_coeffs, true, false, alpha, beta);
/* Find the DC gain of the filter, and adjust the filter to unity gain. */
floating_gain = 0.0;
@@ -284,7 +282,7 @@ int main(int argc, char **argv)
const char *tx_tag;
const char *modem;
transmit_modem = FALSE;
transmit_modem = false;
modem = "";
while ((opt = getopt(argc, argv, "m:rt")) != -1)
{
@@ -294,10 +292,10 @@ int main(int argc, char **argv)
modem = optarg;
break;
case 'r':
transmit_modem = FALSE;
transmit_modem = false;
break;
case 't':
transmit_modem = TRUE;
transmit_modem = true;
break;
default:
usage();
+22 -15
View File
@@ -53,10 +53,16 @@
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include <stdio.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/logging.h"
#include "spandsp/complex.h"
@@ -69,6 +75,7 @@
#include "spandsp/fsk.h"
#include "spandsp/modem_connect_tones.h"
#include "spandsp/private/power_meter.h"
#include "spandsp/private/fsk.h"
#include "spandsp/private/modem_connect_tones.h"
@@ -255,12 +262,12 @@ SPAN_DECLARE(modem_connect_tones_tx_state_t *) modem_connect_tones_tx_init(modem
{
int alloced;
alloced = FALSE;
alloced = false;
if (s == NULL)
{
if ((s = (modem_connect_tones_tx_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (modem_connect_tones_tx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
alloced = TRUE;
alloced = true;
}
s->tone_type = tone_type;
switch (s->tone_type)
@@ -341,7 +348,7 @@ SPAN_DECLARE(modem_connect_tones_tx_state_t *) modem_connect_tones_tx_init(modem
break;
default:
if (alloced)
free(s);
span_free(s);
return NULL;
}
return s;
@@ -356,7 +363,7 @@ SPAN_DECLARE(int) modem_connect_tones_tx_release(modem_connect_tones_tx_state_t
SPAN_DECLARE(int) modem_connect_tones_tx_free(modem_connect_tones_tx_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -398,7 +405,7 @@ static void v21_put_bit(void *user_data, int bit)
s->raw_bit_stream = 0;
s->num_bits = 0;
s->flags_seen = 0;
s->framing_ok_announced = FALSE;
s->framing_ok_announced = false;
break;
}
return;
@@ -429,7 +436,7 @@ static void v21_put_bit(void *user_data, int bit)
if (++s->flags_seen >= HDLC_FRAMING_OK_THRESHOLD && !s->framing_ok_announced)
{
report_tone_state(s, MODEM_CONNECT_TONES_FAX_PREAMBLE, lfastrintf(fsk_rx_signal_power(&(s->v21rx))));
s->framing_ok_announced = TRUE;
s->framing_ok_announced = true;
}
}
}
@@ -441,7 +448,7 @@ static void v21_put_bit(void *user_data, int bit)
{
if (s->num_bits == 8)
{
s->framing_ok_announced = FALSE;
s->framing_ok_announced = false;
s->flags_seen = 0;
}
}
@@ -547,7 +554,7 @@ SPAN_DECLARE_NONSTD(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t *
report_tone_state(s, MODEM_CONNECT_TONES_NONE, -99);
s->tone_cycle_duration = 0;
s->good_cycles = 0;
s->tone_on = FALSE;
s->tone_on = false;
continue;
}
/* There is adequate energy in the channel. Is it mostly at 2100Hz? */
@@ -589,7 +596,7 @@ SPAN_DECLARE_NONSTD(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t *
s->tone_cycle_duration = ms_to_samples(450 + 100);
}
}
s->tone_on = TRUE;
s->tone_on = true;
}
else if (s->notch_level*5 > s->channel_level)
{
@@ -608,7 +615,7 @@ SPAN_DECLARE_NONSTD(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t *
s->good_cycles = 0;
}
}
s->tone_on = FALSE;
s->tone_on = false;
}
}
break;
@@ -716,7 +723,7 @@ SPAN_DECLARE(modem_connect_tones_rx_state_t *) modem_connect_tones_rx_init(modem
{
if (s == NULL)
{
if ((s = (modem_connect_tones_rx_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (modem_connect_tones_rx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
@@ -742,7 +749,7 @@ SPAN_DECLARE(modem_connect_tones_rx_state_t *) modem_connect_tones_rx_init(modem
s->tone_cycle_duration = 0;
s->good_cycles = 0;
s->hit = MODEM_CONNECT_TONES_NONE;
s->tone_on = FALSE;
s->tone_on = false;
s->tone_callback = tone_callback;
s->callback_data = user_data;
s->znotch_1 = 0.0f;
@@ -751,7 +758,7 @@ SPAN_DECLARE(modem_connect_tones_rx_state_t *) modem_connect_tones_rx_init(modem
s->z15hz_2 = 0.0f;
s->num_bits = 0;
s->flags_seen = 0;
s->framing_ok_announced = FALSE;
s->framing_ok_announced = false;
s->raw_bit_stream = 0;
return s;
}
@@ -765,7 +772,7 @@ SPAN_DECLARE(int) modem_connect_tones_rx_release(modem_connect_tones_rx_state_t
SPAN_DECLARE(int) modem_connect_tones_rx_free(modem_connect_tones_rx_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+13 -12
View File
@@ -47,6 +47,7 @@
#include "floating_fudge.h"
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/bit_operations.h"
#include "spandsp/dc_restore.h"
#include "spandsp/modem_echo.h"
@@ -56,9 +57,9 @@
SPAN_DECLARE(void) modem_echo_can_free(modem_echo_can_state_t *ec)
{
fir16_free(&ec->fir_state);
free(ec->fir_taps32);
free(ec->fir_taps16);
free(ec);
span_free(ec->fir_taps32);
span_free(ec->fir_taps16);
span_free(ec);
}
/*- End of function --------------------------------------------------------*/
@@ -66,29 +67,29 @@ SPAN_DECLARE(modem_echo_can_state_t *) modem_echo_can_init(int len)
{
modem_echo_can_state_t *ec;
if ((ec = (modem_echo_can_state_t *) malloc(sizeof(*ec))) == NULL)
if ((ec = (modem_echo_can_state_t *) span_alloc(sizeof(*ec))) == NULL)
return NULL;
memset(ec, 0, sizeof(*ec));
ec->taps = len;
ec->curr_pos = ec->taps - 1;
if ((ec->fir_taps32 = (int32_t *) malloc(ec->taps*sizeof(int32_t))) == NULL)
if ((ec->fir_taps32 = (int32_t *) span_alloc(ec->taps*sizeof(int32_t))) == NULL)
{
free(ec);
span_free(ec);
return NULL;
}
memset(ec->fir_taps32, 0, ec->taps*sizeof(int32_t));
if ((ec->fir_taps16 = (int16_t *) malloc(ec->taps*sizeof(int16_t))) == NULL)
if ((ec->fir_taps16 = (int16_t *) span_alloc(ec->taps*sizeof(int16_t))) == NULL)
{
free(ec->fir_taps32);
free(ec);
span_free(ec->fir_taps32);
span_free(ec);
return NULL;
}
memset(ec->fir_taps16, 0, ec->taps*sizeof(int16_t));
if (fir16_create(&ec->fir_state, ec->fir_taps16, ec->taps) == NULL)
{
free(ec->fir_taps16);
free(ec->fir_taps32);
free(ec);
span_free(ec->fir_taps16);
span_free(ec->fir_taps32);
span_free(ec);
return NULL;
}
return ec;
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="All|Win32">
<Configuration>All</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectName>make_cielab_luts</ProjectName>
<ProjectGuid>{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}</ProjectGuid>
<RootNamespace>make_cielab_luts</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='All|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='All|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='All|Win32'">$(PlatformName)\$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='All|Win32'">$(PlatformName)\make_cielab_luts\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='All|Win32'">false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='All|Win32'">
<BuildLog>
<Path>$(IntDir)BuildLog $(ProjectName).htm</Path>
</BuildLog>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.;.\spandsp;.\msvc;..\..\tiff-4.0.2\libtiff;.\generated;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>
<PostBuildEvent>
<Command>"$(TargetPath)" &gt;"$(ProjectDir)..\cielab_luts.h"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\make_cielab_luts.c" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="All|Win32">
<Configuration>All</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectName>make_cielab_luts</ProjectName>
<ProjectGuid>{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}</ProjectGuid>
<RootNamespace>make_cielab_luts</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='All|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='All|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='All|Win32'">$(PlatformName)\$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='All|Win32'">$(PlatformName)\make_cielab_luts\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='All|Win32'">false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='All|Win32'">
<BuildLog>
<Path>$(IntDir)BuildLog $(ProjectName).htm</Path>
</BuildLog>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.;.\spandsp;.\msvc;..\..\tiff-4.0.2\libtiff;.\generated;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>
<PostBuildEvent>
<Command>"$(TargetPath)" &gt;"$(ProjectDir)..\cielab_luts.h"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\make_cielab_luts.c" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
@@ -27,7 +27,7 @@
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='All|Win32'">$(PlatformName)\$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='All|Win32'">$(PlatformName)\make_at_dictionary\$(Configuration)\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='All|Win32'">$(PlatformName)\make_math_fixed_tables\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='All|Win32'">false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='All|Win32'">
@@ -28,7 +28,7 @@
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='All|Win32'">$(PlatformName)\$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='All|Win32'">$(PlatformName)\make_at_dictionary\$(Configuration)\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='All|Win32'">$(PlatformName)\make_math_fixed_tables\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='All|Win32'">false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='All|Win32'">
+3 -2
View File
@@ -43,6 +43,7 @@
#include "floating_fudge.h"
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/saturated.h"
#include "spandsp/noise.h"
@@ -84,7 +85,7 @@ SPAN_DECLARE(noise_state_t *) noise_init_dbov(noise_state_t *s, int seed, float
if (s == NULL)
{
if ((s = (noise_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (noise_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -121,7 +122,7 @@ SPAN_DECLARE(int) noise_release(noise_state_t *s)
SPAN_DECLARE(int) noise_free(noise_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+3 -2
View File
@@ -39,6 +39,7 @@
#include <string.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/oki_adpcm.h"
#include "spandsp/private/oki_adpcm.h"
@@ -246,7 +247,7 @@ SPAN_DECLARE(oki_adpcm_state_t *) oki_adpcm_init(oki_adpcm_state_t *s, int bit_r
return NULL;
if (s == NULL)
{
if ((s = (oki_adpcm_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (oki_adpcm_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -264,7 +265,7 @@ SPAN_DECLARE(int) oki_adpcm_release(oki_adpcm_state_t *s)
SPAN_DECLARE(int) oki_adpcm_free(oki_adpcm_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+17 -9
View File
@@ -39,10 +39,18 @@
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/playout.h"
#include "spandsp/private/playout.h"
static playout_frame_t *queue_get(playout_state_t *s, timestamp_t sender_stamp)
{
playout_frame_t *frame;
@@ -120,7 +128,7 @@ SPAN_DECLARE(int) playout_get(playout_state_t *s, playout_frame_t *frameout, tim
if (!s->not_first)
{
/* Prime things the first time through */
s->not_first = TRUE;
s->not_first = true;
s->latest_expected = frame->receiver_stamp + s->min_length;
}
/* Leaky integrate the rate of occurance of frames received just in time and late */
@@ -236,7 +244,7 @@ SPAN_DECLARE(int) playout_put(playout_state_t *s, void *data, int type, timestam
}
else
{
if ((frame = (playout_frame_t *) malloc(sizeof(*frame))) == NULL)
if ((frame = (playout_frame_t *) span_alloc(sizeof(*frame))) == NULL)
return PLAYOUT_ERROR;
}
@@ -296,7 +304,7 @@ SPAN_DECLARE(int) playout_put(playout_state_t *s, void *data, int type, timestam
{
s->last_speech_sender_stamp = sender_stamp - sender_len - s->min_length;
s->last_speech_sender_len = sender_len;
s->start = FALSE;
s->start = false;
}
return PLAYOUT_OK;
@@ -312,7 +320,7 @@ SPAN_DECLARE(void) playout_restart(playout_state_t *s, int min_length, int max_l
for (frame = s->free_frames; frame; frame = next)
{
next = frame->later;
free(frame);
span_free(frame);
}
memset(s, 0, sizeof(*s));
@@ -320,7 +328,7 @@ SPAN_DECLARE(void) playout_restart(playout_state_t *s, int min_length, int max_l
s->min_length = min_length;
s->max_length = (max_length > min_length) ? max_length : min_length;
s->dropable_threshold = 1*0x10000000/100;
s->start = TRUE;
s->start = true;
s->since_last_step = 0x7FFFFFFF;
/* Start with the minimum buffer length allowed, and work from there */
s->actual_buffer_length =
@@ -332,7 +340,7 @@ SPAN_DECLARE(playout_state_t *) playout_init(int min_length, int max_length)
{
playout_state_t *s;
if ((s = (playout_state_t *) malloc(sizeof(playout_state_t))) == NULL)
if ((s = (playout_state_t *) span_alloc(sizeof(playout_state_t))) == NULL)
return NULL;
memset(s, 0, sizeof(*s));
playout_restart(s, min_length, max_length);
@@ -350,13 +358,13 @@ SPAN_DECLARE(int) playout_release(playout_state_t *s)
for (frame = s->first_frame; frame; frame = next)
{
next = frame->later;
free(frame);
span_free(frame);
}
/* Free all the frames on the free list */
for (frame = s->free_frames; frame; frame = next)
{
next = frame->later;
free(frame);
span_free(frame);
}
return 0;
}
@@ -368,7 +376,7 @@ SPAN_DECLARE(int) playout_free(playout_state_t *s)
{
playout_release(s);
/* Finally, free ourselves! */
free(s);
span_free(s);
}
return 0;
}
+5 -2
View File
@@ -43,10 +43,13 @@
#include <limits.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/saturated.h"
#include "spandsp/plc.h"
#include "spandsp/private/plc.h"
/* We do a straight line fade to zero volume in 50ms when we are filling in for missing data. */
#define ATTENUATION_INCREMENT 0.0025f /* Attenuation per sample */
@@ -234,7 +237,7 @@ SPAN_DECLARE(plc_state_t *) plc_init(plc_state_t *s)
{
if (s == NULL)
{
if ((s = (plc_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (plc_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -251,7 +254,7 @@ SPAN_DECLARE(int) plc_release(plc_state_t *s)
SPAN_DECLARE(int) plc_free(plc_state_t *s)
{
if (s)
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+14 -6
View File
@@ -41,17 +41,25 @@
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include <assert.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/power_meter.h"
#include "spandsp/private/power_meter.h"
SPAN_DECLARE(power_meter_t *) power_meter_init(power_meter_t *s, int shift)
{
if (s == NULL)
{
if ((s = (power_meter_t *) malloc(sizeof(*s))) == NULL)
if ((s = (power_meter_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
s->shift = shift;
@@ -69,7 +77,7 @@ SPAN_DECLARE(int) power_meter_release(power_meter_t *s)
SPAN_DECLARE(int) power_meter_free(power_meter_t *s)
{
if (s)
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -147,14 +155,14 @@ SPAN_DECLARE(int32_t) power_surge_detector(power_surge_detector_state_t *s, int1
{
if (pow_short <= s->surge*(pow_medium >> 10))
return 0;
s->signal_present = TRUE;
s->signal_present = true;
s->medium_term.reading = s->short_term.reading;
}
else
{
if (pow_short < s->sag*(pow_medium >> 10))
{
s->signal_present = FALSE;
s->signal_present = false;
s->medium_term.reading = s->short_term.reading;
return 0;
}
@@ -181,7 +189,7 @@ SPAN_DECLARE(power_surge_detector_state_t *) power_surge_detector_init(power_sur
if (s == NULL)
{
if ((s = (power_surge_detector_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (power_surge_detector_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -205,7 +213,7 @@ SPAN_DECLARE(int) power_surge_detector_release(power_surge_detector_state_t *s)
SPAN_DECLARE(int) power_surge_detector_free(power_surge_detector_state_t *s)
{
if (s)
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+12 -3
View File
@@ -35,15 +35,24 @@
#include <ctype.h>
#include <stdlib.h>
#include <inttypes.h>
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#if defined(HAVE_STDATOMIC_H)
#include <stdatomic.h>
#endif
#include <sys/types.h>
#define SPANDSP_FULLY_DEFINE_QUEUE_STATE_T
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/queue.h"
#include "spandsp/private/queue.h"
SPAN_DECLARE(int) queue_empty(queue_state_t *s)
SPAN_DECLARE(bool) queue_empty(queue_state_t *s)
{
return (s->iptr == s->optr);
}
@@ -395,7 +404,7 @@ SPAN_DECLARE(queue_state_t *) queue_init(queue_state_t *s, int len, int flags)
{
if (s == NULL)
{
if ((s = (queue_state_t *) malloc(sizeof(*s) + len + 1)) == NULL)
if ((s = (queue_state_t *) span_alloc(sizeof(*s) + len + 1)) == NULL)
return NULL;
}
s->iptr =
@@ -414,7 +423,7 @@ SPAN_DECLARE(int) queue_release(queue_state_t *s)
SPAN_DECLARE(int) queue_free(queue_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+9 -3
View File
@@ -31,8 +31,14 @@
#include <inttypes.h>
#include <stdlib.h>
#include <memory.h>
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/schedule.h"
@@ -53,7 +59,7 @@ SPAN_DECLARE(int) span_schedule_event(span_sched_state_t *s, int us, span_sched_
if (i >= s->allocated)
{
s->allocated += 5;
s->sched = (span_sched_t *) realloc(s->sched, sizeof(span_sched_t)*s->allocated);
s->sched = (span_sched_t *) span_realloc(s->sched, sizeof(span_sched_t)*s->allocated);
}
/*endif*/
if (i >= s->max_to_date)
@@ -141,7 +147,7 @@ SPAN_DECLARE(int) span_schedule_release(span_sched_state_t *s)
{
if (s->sched)
{
free(s->sched);
span_free(s->sched);
s->sched = NULL;
}
return 0;
@@ -152,7 +158,7 @@ SPAN_DECLARE(int) span_schedule_free(span_sched_state_t *s)
{
span_schedule_release(s);
if (s)
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+17 -10
View File
@@ -38,12 +38,18 @@
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include <memory.h>
#include <string.h>
#include <limits.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/saturated.h"
#include "spandsp/vector_int.h"
@@ -53,6 +59,7 @@
#include "spandsp/super_tone_rx.h"
#include "spandsp/sig_tone.h"
#include "spandsp/private/power_meter.h"
#include "spandsp/private/sig_tone.h"
/*! PI */
@@ -225,7 +232,7 @@ SPAN_DECLARE(int) sig_tone_tx(sig_tone_tx_state_t *s, int16_t amp[], int len)
int k;
int n;
int16_t tone;
int need_update;
bool need_update;
int high_low;
for (i = 0; i < len; i += n)
@@ -235,19 +242,19 @@ SPAN_DECLARE(int) sig_tone_tx(sig_tone_tx_state_t *s, int16_t amp[], int len)
if (s->current_tx_timeout <= len - i)
{
n = s->current_tx_timeout;
need_update = TRUE;
need_update = true;
}
else
{
n = len - i;
need_update = FALSE;
need_update = false;
}
s->current_tx_timeout -= n;
}
else
{
n = len - i;
need_update = FALSE;
need_update = false;
}
if (!(s->current_tx_tone & SIG_TONE_TX_PASSTHROUGH))
vec_zeroi16(&amp[i], n);
@@ -325,7 +332,7 @@ SPAN_DECLARE(sig_tone_tx_state_t *) sig_tone_tx_init(sig_tone_tx_state_t *s, int
if (s == NULL)
{
if ((s = (sig_tone_tx_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (sig_tone_tx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -357,7 +364,7 @@ SPAN_DECLARE(int) sig_tone_tx_release(sig_tone_tx_state_t *s)
SPAN_DECLARE(int) sig_tone_tx_free(sig_tone_tx_state_t *s)
{
if (s)
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -448,13 +455,13 @@ SPAN_DECLARE(int) sig_tone_rx(sig_tone_rx_state_t *s, int16_t amp[], int len)
if ((s->signalling_state & (SIG_TONE_1_PRESENT | SIG_TONE_2_PRESENT)))
{
if (s->flat_mode_timeout && --s->flat_mode_timeout == 0)
s->flat_mode = TRUE;
s->flat_mode = true;
/*endif*/
}
else
{
s->flat_mode_timeout = s->desc->sharp_flat_timeout;
s->flat_mode = FALSE;
s->flat_mode = false;
}
/*endif*/
@@ -641,7 +648,7 @@ SPAN_DECLARE(sig_tone_rx_state_t *) sig_tone_rx_init(sig_tone_rx_state_t *s, int
if (s == NULL)
{
if ((s = (sig_tone_rx_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (sig_tone_rx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -685,7 +692,7 @@ SPAN_DECLARE(int) sig_tone_rx_release(sig_tone_rx_state_t *s)
SPAN_DECLARE(int) sig_tone_rx_free(sig_tone_rx_state_t *s)
{
if (s)
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+8 -2
View File
@@ -40,11 +40,17 @@
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include <assert.h>
#include <limits.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/async.h"
#include "spandsp/silence_gen.h"
@@ -119,7 +125,7 @@ SPAN_DECLARE(silence_gen_state_t *) silence_gen_init(silence_gen_state_t *s, int
{
if (s == NULL)
{
if ((s = (silence_gen_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (silence_gen_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -137,7 +143,7 @@ SPAN_DECLARE(int) silence_gen_release(silence_gen_state_t *s)
SPAN_DECLARE(int) silence_gen_free(silence_gen_state_t *s)
{
if (s)
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+2
View File
@@ -45,9 +45,11 @@
#include <limits.h>
#include <time.h>
@INSERT_MATH_HEADER@
@INSERT_STDBOOL_HEADER@
#include <tiffio.h>
#include <spandsp/telephony.h>
#include <spandsp/alloc.h>
#include <spandsp/fast_convert.h>
#include <spandsp/logging.h>
#include <spandsp/complex.h>
+63
View File
@@ -0,0 +1,63 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* alloc.h - memory allocation handling.
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2013 Steve Underwood
*
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 2.1,
* as published by the Free Software Foundation.
*
* This program 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 program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*! \file */
#if !defined(_SPANDSP_ALLOC_H_)
#define _SPANDSP_ALLOC_H_
typedef void *(*span_aligned_alloc_t)(size_t alignment, size_t size);
typedef void *(*span_alloc_t)(size_t size);
typedef void *(*span_realloc_t)(void *ptr, size_t size);
typedef void (*span_free_t)(void *ptr);
#if defined(__cplusplus)
extern "C"
{
#endif
/* Allocate size bytes allocated to ALIGNMENT bytes. */
SPAN_DECLARE(void *) span_aligned_alloc(size_t alignment, size_t size);
/* Allocate size bytes of memory. */
SPAN_DECLARE(void *) span_alloc(size_t size);
/* Re-allocate the previously allocated block in ptr, making the new block size bytes long. */
SPAN_DECLARE(void *) span_realloc(void *ptr, size_t size);
/* Free a block allocated by span_alloc, span_aligned_alloc, or span_realloc. */
SPAN_DECLARE(void) span_free(void *ptr);
SPAN_DECLARE(int) span_mem_allocators(span_aligned_alloc_t custom_aligned_alloc,
span_alloc_t custom_alloc,
span_realloc_t custom_realloc,
span_free_t custom_free);
#if defined(__cplusplus)
}
#endif
#endif
/*- End of file ------------------------------------------------------------*/
+4 -4
View File
@@ -164,7 +164,7 @@ SPAN_DECLARE_NONSTD(void) async_rx_put_bit(void *user_data, int bit);
\param data_bits The number of data bits.
\param parity_bits The type of parity.
\param stop_bits The number of stop bits.
\param use_v14 TRUE if V.14 rate adaption processing should be used.
\param use_v14 True if V.14 rate adaption processing should be used.
\param put_byte The callback routine used to put the received data.
\param user_data An opaque pointer.
\return A pointer to the initialised context, or NULL if there was a problem. */
@@ -172,7 +172,7 @@ SPAN_DECLARE(async_rx_state_t *) async_rx_init(async_rx_state_t *s,
int data_bits,
int parity_bits,
int stop_bits,
int use_v14,
bool use_v14,
put_byte_func_t put_byte,
void *user_data);
@@ -198,7 +198,7 @@ SPAN_DECLARE_NONSTD(int) async_tx_get_bit(void *user_data);
\param data_bits The number of data bit.
\param parity_bits The type of parity.
\param stop_bits The number of stop bits.
\param use_v14 TRUE if V.14 rate adaption processing should be used.
\param use_v14 True if V.14 rate adaption processing should be used.
\param get_byte The callback routine used to get the data to be transmitted.
\param user_data An opaque pointer.
\return A pointer to the initialised context, or NULL if there was a problem. */
@@ -206,7 +206,7 @@ SPAN_DECLARE(async_tx_state_t *) async_tx_init(async_tx_state_t *s,
int data_bits,
int parity_bits,
int stop_bits,
int use_v14,
bool use_v14,
get_byte_func_t get_byte,
void *user_data);
+7 -7
View File
@@ -115,14 +115,14 @@ enum
*/
typedef struct
{
/*! TRUE if character echo is enabled */
int echo;
/*! TRUE if verbose reporting is enabled */
int verbose;
/*! TRUE if result codes are verbose */
/*! True if character echo is enabled */
bool echo;
/*! True if verbose reporting is enabled */
bool verbose;
/*! Result code format code - numeic or verbose */
int result_code_format;
/*! TRUE if pulse dialling is the default */
int pulse_dial;
/*! True if pulse dialling is the default */
bool pulse_dial;
/*! ??? */
int double_escape;
/*! ??? */
+4 -4
View File
@@ -175,10 +175,10 @@ SPAN_DECLARE(int) r2_mf_tx_put(r2_mf_tx_state_t *s, char digit);
/*! \brief Initialise an R2 MF tone generator context.
\param s The R2 MF generator context.
\param fwd TRUE if the context is for forward signals. FALSE if the
\param fwd True if the context is for forward signals. False if the
context is for backward signals.
\return A pointer to the MFC/R2 generator context.*/
SPAN_DECLARE(r2_mf_tx_state_t *) r2_mf_tx_init(r2_mf_tx_state_t *s, int fwd);
SPAN_DECLARE(r2_mf_tx_state_t *) r2_mf_tx_init(r2_mf_tx_state_t *s, bool fwd);
/*! \brief Release an R2 MF tone generator context.
\param s The R2 MF tone generator context.
@@ -242,7 +242,7 @@ SPAN_DECLARE(int) r2_mf_rx_get(r2_mf_rx_state_t *s);
/*! \brief Initialise an R2 MF receiver context.
\param s The R2 MF receiver context.
\param fwd TRUE if the context is for forward signals. FALSE if the
\param fwd True if the context is for forward signals. False if the
context is for backward signals.
\param callback An optional callback routine, used to report received digits. If
no callback routine is set, digits may be collected, using the r2_mf_rx_get()
@@ -251,7 +251,7 @@ SPAN_DECLARE(int) r2_mf_rx_get(r2_mf_rx_state_t *s);
and supplied in callbacks.
\return A pointer to the R2 MF receiver context. */
SPAN_DECLARE(r2_mf_rx_state_t *) r2_mf_rx_init(r2_mf_rx_state_t *s,
int fwd,
bool fwd,
tone_report_func_t callback,
void *user_data);
+1 -1
View File
@@ -71,7 +71,7 @@ SPAN_DECLARE(void) bitstream_flush(bitstream_state_t *s, uint8_t **c);
/*! \brief Initialise a bitstream context.
\param s A pointer to the bitstream context.
\param lsb_first TRUE if the bit stream is LSB first, else its MSB first.
\param lsb_first True if the bit stream is LSB first, else its MSB first.
\return A pointer to the bitstream context. */
SPAN_DECLARE(bitstream_state_t *) bitstream_init(bitstream_state_t *s, int direction);
+4 -4
View File
@@ -60,9 +60,9 @@ SPAN_DECLARE(int) crc_itu32_append(uint8_t *buf, int len);
/*! \brief Check the ITU/CCITT CRC-32 value in a frame.
\param buf The buffer containing the frame.
\param len The length of the frame.
\return TRUE if the CRC is OK, else FALSE.
\return True if the CRC is OK, else false.
*/
SPAN_DECLARE(int) crc_itu32_check(const uint8_t *buf, int len);
SPAN_DECLARE(bool) crc_itu32_check(const uint8_t *buf, int len);
/*! \brief Calculate the ITU/CCITT CRC-16 value in buffer by whole bytes.
\param buf The buffer containing the data.
@@ -93,9 +93,9 @@ SPAN_DECLARE(int) crc_itu16_append(uint8_t *buf, int len);
/*! \brief Check the ITU/CCITT CRC-16 value in a frame.
\param buf The buffer containing the frame.
\param len The length of the frame.
\return TRUE if the CRC is OK, else FALSE.
\return True if the CRC is OK, else false.
*/
SPAN_DECLARE(int) crc_itu16_check(const uint8_t *buf, int len);
SPAN_DECLARE(bool) crc_itu16_check(const uint8_t *buf, int len);
#if defined(__cplusplus)
}
+1 -1
View File
@@ -156,7 +156,7 @@ SPAN_DECLARE(void) dtmf_rx_set_realtime_callback(dtmf_rx_state_t *s,
/*! \brief Adjust a DTMF receiver context.
\param s The DTMF receiver context.
\param filter_dialtone TRUE to enable filtering of dialtone, FALSE
\param filter_dialtone True to enable filtering of dialtone, false
to disable, < 0 to leave unchanged.
\param twist Acceptable twist, in dB. < 0.0 to leave unchanged.
\param reverse_twist Acceptable reverse twist, in dB. < 0.0 to leave unchanged.
Loaded 100 of 535 files, more files were not shown because too many files have changed in this diff. Show more