diff --git a/.gitignore b/.gitignore
index 766adfb371..514e756904 100644
--- a/.gitignore
+++ b/.gitignore
@@ -36,13 +36,16 @@
*.xz
*.bz2
*.tbz2
+*.deb
*.swp
+*.serial
aclocal.m4
autom4te.cache
config.cache
configure.lineno
config.log
config.status
+test-driver
core.*
TAGS
*.2010.log
@@ -151,7 +154,8 @@ Release/
/src/mod/applications/mod_osp/Makefile.in
/src/mod/applications/mod_rss/Makefile
/src/mod/applications/mod_snipe_hunt/Makefile
-/src/mod/codecs/mod_com_g729/
+/src/mod/codecs/mod_com_g729/Makefile
+/src/mod/codecs/mod_com_g729/Makefile.in
/src/mod/codecs/mod_dahdi_codec/Makefile
/src/mod/dialplans/mod_dialplan_directory/Makefile
/src/mod/formats/mod_shell_stream/Makefile
@@ -168,8 +172,6 @@ Release/
BuildLog.htm
-Win32/
-win32/
!/libs/win32/
!/libs/speex/win32/
!/src/mod/endpoints/mod_gsmopen/gsmlib/gsmlib-1.10-patched-13ubuntu/win32/
diff --git a/Freeswitch.2010.express.sln b/Freeswitch.2010.express.sln
index 4749470674..e554a13076 100644
--- a/Freeswitch.2010.express.sln
+++ b/Freeswitch.2010.express.sln
@@ -38,6 +38,11 @@ EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_console", "src\mod\loggers\mod_console\mod_console.2010.vcxproj", "{1C453396-D912-4213-89FD-9B489162B7B5}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_xml_rpc", "src\mod\xml_int\mod_xml_rpc\mod_xml_rpc.2010.vcxproj", "{CBEC7225-0C21-4DA8-978E-1F158F8AD950}"
+ ProjectSection(ProjectDependencies) = postProject
+ {9D04A840-CE18-4FF5-A6D3-0A2BB92FF2E6} = {9D04A840-CE18-4FF5-A6D3-0A2BB92FF2E6}
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981} = {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}
+ {329A6FA0-0FCC-4435-A950-E670AEFA9838} = {329A6FA0-0FCC-4435-A950-E670AEFA9838}
+ EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_rss", "src\mod\applications\mod_rss\mod_rss.2010.vcxproj", "{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}"
EndProject
@@ -221,6 +226,7 @@ EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspandsp", "libs\spandsp\src\libspandsp.2010.vcxproj", "{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}"
ProjectSection(ProjectDependencies) = postProject
{019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1} = {019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1}
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981} = {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspeex", "libs\speex\win32\VS2008\libspeex\libspeex.vcxproj", "{E972C52F-9E85-4D65-B19C-031E511E9DB4}"
@@ -338,6 +344,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gennmtab", "libs\win32\xmlr
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_math_fixed_tables", "libs\spandsp\src\msvc\make_math_fixed_tables.2010.vcxproj", "{9D04A840-CE18-4FF5-A6D3-0A2BB92FF2E6}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_cielab_luts", "libs\spandsp\src\msvc\make_cielab_luts.2010.vcxproj", "{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
All|Win32 = All|Win32
@@ -2067,6 +2075,17 @@ Global
{9D04A840-CE18-4FF5-A6D3-0A2BB92FF2E6}.Release|Win32.Build.0 = All|Win32
{9D04A840-CE18-4FF5-A6D3-0A2BB92FF2E6}.Release|x64.ActiveCfg = All|Win32
{9D04A840-CE18-4FF5-A6D3-0A2BB92FF2E6}.Release|x64.Build.0 = All|Win32
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.All|Win32.ActiveCfg = All|Win32
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.All|Win32.Build.0 = All|Win32
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.All|x64.ActiveCfg = All|Win32
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Debug|Win32.ActiveCfg = All|Win32
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Debug|Win32.Build.0 = All|Win32
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Debug|x64.ActiveCfg = All|Win32
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Debug|x64.Build.0 = All|Win32
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|Win32.ActiveCfg = All|Win32
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|Win32.Build.0 = All|Win32
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|x64.ActiveCfg = All|Win32
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|x64.Build.0 = All|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/Freeswitch.2010.sln b/Freeswitch.2010.sln
index d620087405..4148d2ddc5 100644
--- a/Freeswitch.2010.sln
+++ b/Freeswitch.2010.sln
@@ -570,6 +570,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_math_fixed_tables", "l
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcbt", "libs\win32\libcbt\libcbt.2010.vcxproj", "{77BC1DD2-C9A1-44D7-BFFA-1320370CACB9}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_cielab_luts", "libs\spandsp\src\msvc\make_cielab_luts.2010.vcxproj", "{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
All|Win32 = All|Win32
@@ -3791,6 +3793,23 @@ Global
{77BC1DD2-C9A1-44D7-BFFA-1320370CACB9}.Release|x64.Build.0 = Release|x64
{77BC1DD2-C9A1-44D7-BFFA-1320370CACB9}.Release|x64 Setup.ActiveCfg = Release|Win32
{77BC1DD2-C9A1-44D7-BFFA-1320370CACB9}.Release|x86 Setup.ActiveCfg = Release|Win32
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.All|Win32.ActiveCfg = All|Win32
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.All|Win32.Build.0 = All|Win32
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.All|x64.ActiveCfg = All|Win32
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.All|x64 Setup.ActiveCfg = All|Win32
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.All|x86 Setup.ActiveCfg = All|Win32
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Debug|Win32.ActiveCfg = All|Win32
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Debug|Win32.Build.0 = All|Win32
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Debug|x64.ActiveCfg = All|Win32
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Debug|x64.Build.0 = All|Win32
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Debug|x64 Setup.ActiveCfg = All|Win32
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Debug|x86 Setup.ActiveCfg = All|Win32
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|Win32.ActiveCfg = All|Win32
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|Win32.Build.0 = All|Win32
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|x64.ActiveCfg = All|Win32
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|x64.Build.0 = All|Win32
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|x64 Setup.ActiveCfg = All|Win32
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|x86 Setup.ActiveCfg = All|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -3907,6 +3926,7 @@ Global
{019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
{9D04A840-CE18-4FF5-A6D3-0A2BB92FF2E6} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
{77BC1DD2-C9A1-44D7-BFFA-1320370CACB9} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
{EC3E5C7F-EE09-47E2-80FE-546363D14A98} = {B8F5B47B-8568-46EB-B320-64C17D2A98BC}
{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {0C808854-54D1-4230-BFF5-77B5FD905000}
{ACFFF684-4D19-4D48-AF12-88EA1D778BDF} = {0C808854-54D1-4230-BFF5-77B5FD905000}
diff --git a/Freeswitch.2012.sln b/Freeswitch.2012.sln
index 7e2d13e128..346914e690 100644
--- a/Freeswitch.2012.sln
+++ b/Freeswitch.2012.sln
@@ -575,6 +575,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_math_fixed_tables", "l
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcbt", "libs\win32\libcbt\libcbt.2012.vcxproj", "{77BC1DD2-C9A1-44D7-BFFA-1320370CACB9}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_cielab_luts", "libs\spandsp\src\msvc\make_cielab_luts.2012.vcxproj", "{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
All|Win32 = All|Win32
@@ -3801,6 +3803,23 @@ Global
{77BC1DD2-C9A1-44D7-BFFA-1320370CACB9}.Release|x64.Build.0 = Release|x64
{77BC1DD2-C9A1-44D7-BFFA-1320370CACB9}.Release|x64 Setup.ActiveCfg = Release|Win32
{77BC1DD2-C9A1-44D7-BFFA-1320370CACB9}.Release|x86 Setup.ActiveCfg = Release|Win32
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.All|Win32.ActiveCfg = All|Win32
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.All|Win32.Build.0 = All|Win32
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.All|x64.ActiveCfg = All|Win32
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.All|x64 Setup.ActiveCfg = All|Win32
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.All|x86 Setup.ActiveCfg = All|Win32
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Debug|Win32.ActiveCfg = All|Win32
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Debug|Win32.Build.0 = All|Win32
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Debug|x64.ActiveCfg = All|Win32
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Debug|x64.Build.0 = All|Win32
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Debug|x64 Setup.ActiveCfg = All|Win32
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Debug|x86 Setup.ActiveCfg = All|Win32
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|Win32.ActiveCfg = All|Win32
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|Win32.Build.0 = All|Win32
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|x64.ActiveCfg = All|Win32
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|x64.Build.0 = All|Win32
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|x64 Setup.ActiveCfg = All|Win32
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|x86 Setup.ActiveCfg = All|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -3915,8 +3934,9 @@ Global
{26C82FCE-E0CF-4D10-A00C-D8E582FFEB53} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
{C13CC324-0032-4492-9A30-310A6BD64FF5} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
{019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
- {77BC1DD2-C9A1-44D7-BFFA-1320370CACB9} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
{2386B892-35F5-46CF-A0F0-10394D2FBF9B} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
+ {77BC1DD2-C9A1-44D7-BFFA-1320370CACB9} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
{EC3E5C7F-EE09-47E2-80FE-546363D14A98} = {B8F5B47B-8568-46EB-B320-64C17D2A98BC}
{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {0C808854-54D1-4230-BFF5-77B5FD905000}
{ACFFF684-4D19-4D48-AF12-88EA1D778BDF} = {0C808854-54D1-4230-BFF5-77B5FD905000}
diff --git a/Makefile.am b/Makefile.am
index 145733e636..91d949b359 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -291,6 +291,7 @@ libfreeswitch_la_SOURCES = \
libs/libnatpmp/natpmp.c \
libs/libnatpmp/getgateway.c\
libs/spandsp/src/plc.c \
+ libs/spandsp/src/alloc.c \
libs/spandsp/src/bit_operations.c
if ENABLE_CPP
diff --git a/acinclude.m4 b/acinclude.m4
index aeba17b5c3..58b5500a80 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -6,6 +6,7 @@ m4_include([build/config/ac_gcc_archflag.m4])
m4_include([build/config/ac_gcc_x86_cpuid.m4])
m4_include([build/config/ax_lib_mysql.m4])
m4_include([build/config/ax_check_java.m4])
+m4_include([build/config/uuid.m4])
m4_include([build/config/erlang.m4])
m4_include([build/config/odbc.m4])
m4_include([build/config/sched_setaffinity.m4])
diff --git a/build/config/uuid.m4 b/build/config/uuid.m4
new file mode 100644
index 0000000000..7f37c23c66
--- /dev/null
+++ b/build/config/uuid.m4
@@ -0,0 +1,17 @@
+AC_DEFUN([CHECK_LIBUUID],
+ [
+ PKG_CHECK_MODULES([LIBUUID], [uuid >= 1.41.2],
+ [LIBUUID_FOUND=yes], [LIBUUID_FOUND=no])
+ if test "$LIBUUID_FOUND" = "no" ; then
+ PKG_CHECK_MODULES([LIBUUID], [uuid],
+ [LIBUUID_FOUND=yes], [LIBUUID_FOUND=no])
+ if test "$LIBUUID_FOUND" = "no" ; then
+ AC_MSG_WARN([libuuid development package highly recommended!])
+ else
+ LIBUUID_INCLUDEDIR=$(pkg-config --variable=includedir uuid)
+ LIBUUID_CFLAGS+=" -I$LIBUUID_INCLUDEDIR/uuid "
+ fi
+ fi
+ AC_SUBST([LIBUUID_CFLAGS])
+ AC_SUBST([LIBUUID_LIBS])
+ ])
diff --git a/build/modules.conf.in b/build/modules.conf.in
index 81ae32f4c2..d60b1211ef 100644
--- a/build/modules.conf.in
+++ b/build/modules.conf.in
@@ -26,10 +26,14 @@ applications/mod_httapi
#applications/mod_lcr
#applications/mod_memcache
#applications/mod_mongo
+#applications/mod_mp4
#applications/mod_nibblebill
+#applications/mod_oreka
#applications/mod_osp
+#applications/mod_rad_auth
#applications/mod_redis
#applications/mod_rss
+#applications/mod_sonar
applications/mod_sms
#applications/mod_snapshot
#applications/mod_snipe_hunt
@@ -63,17 +67,20 @@ codecs/mod_h26x
codecs/mod_vp8
#codecs/mod_ilbc
#codecs/mod_isac
+#codecs/mod_mp4v
#codecs/mod_opus
#codecs/mod_sangoma_codec
#codecs/mod_silk
#codecs/mod_siren
codecs/mod_speex
+#codecs/mod_theora
dialplans/mod_dialplan_asterisk
#dialplans/mod_dialplan_directory
dialplans/mod_dialplan_xml
#directories/mod_ldap
#endpoints/mod_alsa
#endpoints/mod_dingaling
+#endpoints/mod_gsmopen
#endpoints/mod_h323
#endpoints/mod_html5
#endpoints/mod_khomp
@@ -81,9 +88,10 @@ endpoints/mod_loopback
#endpoints/mod_opal
#endpoints/mod_portaudio
#endpoints/mod_rtmp
-#endpoints/mod_skinny
+endpoints/mod_skinny
#endpoints/mod_skypopen
endpoints/mod_sofia
+#endpoints/mod_unicall
event_handlers/mod_cdr_csv
#event_handlers/mod_cdr_mongodb
#event_handlers/mod_cdr_pg_csv
@@ -92,6 +100,7 @@ event_handlers/mod_cdr_sqlite
#event_handlers/mod_event_multicast
event_handlers/mod_event_socket
#event_handlers/mod_event_zmq
+#event_handlers/mod_json_cdr
#event_handlers/mod_radius_cdr
#event_handlers/mod_rayo
#event_handlers/mod_snmp
@@ -117,10 +126,13 @@ loggers/mod_syslog
#say/mod_say_de
say/mod_say_en
#say/mod_say_es
+#say/mod_say_fa
#say/mod_say_fr
#say/mod_say_he
+#say/mod_say_hr
#say/mod_say_hu
#say/mod_say_it
+#say/mod_say_ja
#say/mod_say_nl
#say/mod_say_pl
#say/mod_say_pt
@@ -140,4 +152,4 @@ xml_int/mod_xml_scgi
#../../libs/openzap/mod_openzap
## Experimental Modules (don't cry if they're broken)
-#../../contrib/mod/xml_int/mod_xml_odbc
+#../../contrib/mod/xml_int/mod_xml_odbc
\ No newline at end of file
diff --git a/src/mod/event_handlers/mod_rayo/conf/autoload_configs/acl.conf.xml b/conf/rayo/autoload_configs/acl.conf.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/autoload_configs/acl.conf.xml
rename to conf/rayo/autoload_configs/acl.conf.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/autoload_configs/cdr_csv.conf.xml b/conf/rayo/autoload_configs/cdr_csv.conf.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/autoload_configs/cdr_csv.conf.xml
rename to conf/rayo/autoload_configs/cdr_csv.conf.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/autoload_configs/conference.conf.xml b/conf/rayo/autoload_configs/conference.conf.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/autoload_configs/conference.conf.xml
rename to conf/rayo/autoload_configs/conference.conf.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/autoload_configs/console.conf.xml b/conf/rayo/autoload_configs/console.conf.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/autoload_configs/console.conf.xml
rename to conf/rayo/autoload_configs/console.conf.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/autoload_configs/distributor.conf.xml b/conf/rayo/autoload_configs/distributor.conf.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/autoload_configs/distributor.conf.xml
rename to conf/rayo/autoload_configs/distributor.conf.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/autoload_configs/event_socket.conf.xml b/conf/rayo/autoload_configs/event_socket.conf.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/autoload_configs/event_socket.conf.xml
rename to conf/rayo/autoload_configs/event_socket.conf.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/autoload_configs/hash.conf.xml b/conf/rayo/autoload_configs/hash.conf.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/autoload_configs/hash.conf.xml
rename to conf/rayo/autoload_configs/hash.conf.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/autoload_configs/http_cache.conf.xml b/conf/rayo/autoload_configs/http_cache.conf.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/autoload_configs/http_cache.conf.xml
rename to conf/rayo/autoload_configs/http_cache.conf.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/autoload_configs/local_stream.conf.xml b/conf/rayo/autoload_configs/local_stream.conf.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/autoload_configs/local_stream.conf.xml
rename to conf/rayo/autoload_configs/local_stream.conf.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/autoload_configs/logfile.conf.xml b/conf/rayo/autoload_configs/logfile.conf.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/autoload_configs/logfile.conf.xml
rename to conf/rayo/autoload_configs/logfile.conf.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/autoload_configs/lua.conf.xml b/conf/rayo/autoload_configs/lua.conf.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/autoload_configs/lua.conf.xml
rename to conf/rayo/autoload_configs/lua.conf.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/autoload_configs/memcache.conf.xml b/conf/rayo/autoload_configs/memcache.conf.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/autoload_configs/memcache.conf.xml
rename to conf/rayo/autoload_configs/memcache.conf.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/autoload_configs/modules.conf.xml b/conf/rayo/autoload_configs/modules.conf.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/autoload_configs/modules.conf.xml
rename to conf/rayo/autoload_configs/modules.conf.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/autoload_configs/pocketsphinx.conf.xml b/conf/rayo/autoload_configs/pocketsphinx.conf.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/autoload_configs/pocketsphinx.conf.xml
rename to conf/rayo/autoload_configs/pocketsphinx.conf.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/autoload_configs/post_load_modules.conf.xml b/conf/rayo/autoload_configs/post_load_modules.conf.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/autoload_configs/post_load_modules.conf.xml
rename to conf/rayo/autoload_configs/post_load_modules.conf.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/autoload_configs/presence_map.conf.xml b/conf/rayo/autoload_configs/presence_map.conf.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/autoload_configs/presence_map.conf.xml
rename to conf/rayo/autoload_configs/presence_map.conf.xml
diff --git a/conf/rayo/autoload_configs/rayo.conf.xml b/conf/rayo/autoload_configs/rayo.conf.xml
new file mode 100644
index 0000000000..248fd47ccf
--- /dev/null
+++ b/conf/rayo/autoload_configs/rayo.conf.xml
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/mod/event_handlers/mod_rayo/conf/autoload_configs/shout.conf.xml b/conf/rayo/autoload_configs/shout.conf.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/autoload_configs/shout.conf.xml
rename to conf/rayo/autoload_configs/shout.conf.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/autoload_configs/sofia.conf.xml b/conf/rayo/autoload_configs/sofia.conf.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/autoload_configs/sofia.conf.xml
rename to conf/rayo/autoload_configs/sofia.conf.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/autoload_configs/spandsp.conf.xml b/conf/rayo/autoload_configs/spandsp.conf.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/autoload_configs/spandsp.conf.xml
rename to conf/rayo/autoload_configs/spandsp.conf.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/autoload_configs/ssml.conf.xml b/conf/rayo/autoload_configs/ssml.conf.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/autoload_configs/ssml.conf.xml
rename to conf/rayo/autoload_configs/ssml.conf.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/autoload_configs/switch.conf.xml b/conf/rayo/autoload_configs/switch.conf.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/autoload_configs/switch.conf.xml
rename to conf/rayo/autoload_configs/switch.conf.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/autoload_configs/timezones.conf.xml b/conf/rayo/autoload_configs/timezones.conf.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/autoload_configs/timezones.conf.xml
rename to conf/rayo/autoload_configs/timezones.conf.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/cacert.pem b/conf/rayo/cacert.pem
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/cacert.pem
rename to conf/rayo/cacert.pem
diff --git a/src/mod/event_handlers/mod_rayo/conf/dialplan/public.xml b/conf/rayo/dialplan/public.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/dialplan/public.xml
rename to conf/rayo/dialplan/public.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/directory/default.xml b/conf/rayo/directory/default.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/directory/default.xml
rename to conf/rayo/directory/default.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/directory/default/usera.xml b/conf/rayo/directory/default/usera.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/directory/default/usera.xml
rename to conf/rayo/directory/default/usera.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/directory/default/userb.xml b/conf/rayo/directory/default/userb.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/directory/default/userb.xml
rename to conf/rayo/directory/default/userb.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/directory/default/userc.xml b/conf/rayo/directory/default/userc.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/directory/default/userc.xml
rename to conf/rayo/directory/default/userc.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/directory/default/userd.xml b/conf/rayo/directory/default/userd.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/directory/default/userd.xml
rename to conf/rayo/directory/default/userd.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/freeswitch.xml b/conf/rayo/freeswitch.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/freeswitch.xml
rename to conf/rayo/freeswitch.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/de/de.xml b/conf/rayo/lang/de/de.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/de/de.xml
rename to conf/rayo/lang/de/de.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/de/demo/demo.xml b/conf/rayo/lang/de/demo/demo.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/de/demo/demo.xml
rename to conf/rayo/lang/de/demo/demo.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/de/vm/sounds.xml b/conf/rayo/lang/de/vm/sounds.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/de/vm/sounds.xml
rename to conf/rayo/lang/de/vm/sounds.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/de/vm/tts.xml b/conf/rayo/lang/de/vm/tts.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/de/vm/tts.xml
rename to conf/rayo/lang/de/vm/tts.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/en/demo/demo-ivr.xml b/conf/rayo/lang/en/demo/demo-ivr.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/en/demo/demo-ivr.xml
rename to conf/rayo/lang/en/demo/demo-ivr.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/en/demo/demo.xml b/conf/rayo/lang/en/demo/demo.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/en/demo/demo.xml
rename to conf/rayo/lang/en/demo/demo.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/en/demo/funnies.xml b/conf/rayo/lang/en/demo/funnies.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/en/demo/funnies.xml
rename to conf/rayo/lang/en/demo/funnies.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/en/demo/new-demo-ivr.xml b/conf/rayo/lang/en/demo/new-demo-ivr.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/en/demo/new-demo-ivr.xml
rename to conf/rayo/lang/en/demo/new-demo-ivr.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/en/dir/sounds.xml b/conf/rayo/lang/en/dir/sounds.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/en/dir/sounds.xml
rename to conf/rayo/lang/en/dir/sounds.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/en/dir/tts.xml b/conf/rayo/lang/en/dir/tts.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/en/dir/tts.xml
rename to conf/rayo/lang/en/dir/tts.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/en/en.xml b/conf/rayo/lang/en/en.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/en/en.xml
rename to conf/rayo/lang/en/en.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/en/ivr/sounds.xml b/conf/rayo/lang/en/ivr/sounds.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/en/ivr/sounds.xml
rename to conf/rayo/lang/en/ivr/sounds.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/en/vm/sounds.xml b/conf/rayo/lang/en/vm/sounds.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/en/vm/sounds.xml
rename to conf/rayo/lang/en/vm/sounds.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/en/vm/tts.xml b/conf/rayo/lang/en/vm/tts.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/en/vm/tts.xml
rename to conf/rayo/lang/en/vm/tts.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/en/vm/voicemail_ivr.xml b/conf/rayo/lang/en/vm/voicemail_ivr.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/en/vm/voicemail_ivr.xml
rename to conf/rayo/lang/en/vm/voicemail_ivr.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/es/demo/demo-es-ES.xml b/conf/rayo/lang/es/demo/demo-es-ES.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/es/demo/demo-es-ES.xml
rename to conf/rayo/lang/es/demo/demo-es-ES.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/es/demo/demo-es-MX.xml b/conf/rayo/lang/es/demo/demo-es-MX.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/es/demo/demo-es-MX.xml
rename to conf/rayo/lang/es/demo/demo-es-MX.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/es/demo/demo-ivr-es-ES.xml b/conf/rayo/lang/es/demo/demo-ivr-es-ES.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/es/demo/demo-ivr-es-ES.xml
rename to conf/rayo/lang/es/demo/demo-ivr-es-ES.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/es/demo/demo-ivr-es-MX.xml b/conf/rayo/lang/es/demo/demo-ivr-es-MX.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/es/demo/demo-ivr-es-MX.xml
rename to conf/rayo/lang/es/demo/demo-ivr-es-MX.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/es/dir/sounds-es-ES.xml b/conf/rayo/lang/es/dir/sounds-es-ES.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/es/dir/sounds-es-ES.xml
rename to conf/rayo/lang/es/dir/sounds-es-ES.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/es/dir/sounds-es-MX.xml b/conf/rayo/lang/es/dir/sounds-es-MX.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/es/dir/sounds-es-MX.xml
rename to conf/rayo/lang/es/dir/sounds-es-MX.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/es/dir/tts-es-ES.xml b/conf/rayo/lang/es/dir/tts-es-ES.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/es/dir/tts-es-ES.xml
rename to conf/rayo/lang/es/dir/tts-es-ES.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/es/dir/tts-es-MX.xml b/conf/rayo/lang/es/dir/tts-es-MX.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/es/dir/tts-es-MX.xml
rename to conf/rayo/lang/es/dir/tts-es-MX.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/es/es_ES.xml b/conf/rayo/lang/es/es_ES.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/es/es_ES.xml
rename to conf/rayo/lang/es/es_ES.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/es/es_MX.xml b/conf/rayo/lang/es/es_MX.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/es/es_MX.xml
rename to conf/rayo/lang/es/es_MX.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/es/vm/sounds-es-ES.xml b/conf/rayo/lang/es/vm/sounds-es-ES.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/es/vm/sounds-es-ES.xml
rename to conf/rayo/lang/es/vm/sounds-es-ES.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/es/vm/sounds-es-MX.xml b/conf/rayo/lang/es/vm/sounds-es-MX.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/es/vm/sounds-es-MX.xml
rename to conf/rayo/lang/es/vm/sounds-es-MX.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/es/vm/tts-es-ES.xml b/conf/rayo/lang/es/vm/tts-es-ES.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/es/vm/tts-es-ES.xml
rename to conf/rayo/lang/es/vm/tts-es-ES.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/es/vm/tts-es-MX.xml b/conf/rayo/lang/es/vm/tts-es-MX.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/es/vm/tts-es-MX.xml
rename to conf/rayo/lang/es/vm/tts-es-MX.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/fr/demo/demo.xml b/conf/rayo/lang/fr/demo/demo.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/fr/demo/demo.xml
rename to conf/rayo/lang/fr/demo/demo.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/fr/dir/sounds.xml b/conf/rayo/lang/fr/dir/sounds.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/fr/dir/sounds.xml
rename to conf/rayo/lang/fr/dir/sounds.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/fr/dir/tts.xml b/conf/rayo/lang/fr/dir/tts.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/fr/dir/tts.xml
rename to conf/rayo/lang/fr/dir/tts.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/fr/fr.xml b/conf/rayo/lang/fr/fr.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/fr/fr.xml
rename to conf/rayo/lang/fr/fr.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/fr/vm/sounds.xml b/conf/rayo/lang/fr/vm/sounds.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/fr/vm/sounds.xml
rename to conf/rayo/lang/fr/vm/sounds.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/he/demo/demo-ivr.xml b/conf/rayo/lang/he/demo/demo-ivr.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/he/demo/demo-ivr.xml
rename to conf/rayo/lang/he/demo/demo-ivr.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/he/demo/demo.xml b/conf/rayo/lang/he/demo/demo.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/he/demo/demo.xml
rename to conf/rayo/lang/he/demo/demo.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/he/dir/sounds.xml b/conf/rayo/lang/he/dir/sounds.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/he/dir/sounds.xml
rename to conf/rayo/lang/he/dir/sounds.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/he/he.xml b/conf/rayo/lang/he/he.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/he/he.xml
rename to conf/rayo/lang/he/he.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/he/vm/sounds.xml b/conf/rayo/lang/he/vm/sounds.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/he/vm/sounds.xml
rename to conf/rayo/lang/he/vm/sounds.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/pt/demo/demo-ivr-pt-BR.xml b/conf/rayo/lang/pt/demo/demo-ivr-pt-BR.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/pt/demo/demo-ivr-pt-BR.xml
rename to conf/rayo/lang/pt/demo/demo-ivr-pt-BR.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/pt/demo/demo-ivr-pt-PT.xml b/conf/rayo/lang/pt/demo/demo-ivr-pt-PT.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/pt/demo/demo-ivr-pt-PT.xml
rename to conf/rayo/lang/pt/demo/demo-ivr-pt-PT.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/pt/demo/demo-pt-BR.xml b/conf/rayo/lang/pt/demo/demo-pt-BR.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/pt/demo/demo-pt-BR.xml
rename to conf/rayo/lang/pt/demo/demo-pt-BR.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/pt/demo/demo-pt-PT.xml b/conf/rayo/lang/pt/demo/demo-pt-PT.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/pt/demo/demo-pt-PT.xml
rename to conf/rayo/lang/pt/demo/demo-pt-PT.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/pt/dir/sounds-pt-BR.xml b/conf/rayo/lang/pt/dir/sounds-pt-BR.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/pt/dir/sounds-pt-BR.xml
rename to conf/rayo/lang/pt/dir/sounds-pt-BR.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/pt/dir/sounds-pt-PT.xml b/conf/rayo/lang/pt/dir/sounds-pt-PT.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/pt/dir/sounds-pt-PT.xml
rename to conf/rayo/lang/pt/dir/sounds-pt-PT.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/pt/dir/tts-pt-BR.xml b/conf/rayo/lang/pt/dir/tts-pt-BR.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/pt/dir/tts-pt-BR.xml
rename to conf/rayo/lang/pt/dir/tts-pt-BR.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/pt/dir/tts-pt-PT.xml b/conf/rayo/lang/pt/dir/tts-pt-PT.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/pt/dir/tts-pt-PT.xml
rename to conf/rayo/lang/pt/dir/tts-pt-PT.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/pt/pt_BR.xml b/conf/rayo/lang/pt/pt_BR.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/pt/pt_BR.xml
rename to conf/rayo/lang/pt/pt_BR.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/pt/pt_PT.xml b/conf/rayo/lang/pt/pt_PT.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/pt/pt_PT.xml
rename to conf/rayo/lang/pt/pt_PT.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/pt/vm/sounds-pt-BR.xml b/conf/rayo/lang/pt/vm/sounds-pt-BR.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/pt/vm/sounds-pt-BR.xml
rename to conf/rayo/lang/pt/vm/sounds-pt-BR.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/pt/vm/sounds-pt-PT.xml b/conf/rayo/lang/pt/vm/sounds-pt-PT.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/pt/vm/sounds-pt-PT.xml
rename to conf/rayo/lang/pt/vm/sounds-pt-PT.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/pt/vm/tts-pt-BR.xml b/conf/rayo/lang/pt/vm/tts-pt-BR.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/pt/vm/tts-pt-BR.xml
rename to conf/rayo/lang/pt/vm/tts-pt-BR.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/pt/vm/tts-pt-PT.xml b/conf/rayo/lang/pt/vm/tts-pt-PT.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/pt/vm/tts-pt-PT.xml
rename to conf/rayo/lang/pt/vm/tts-pt-PT.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/ru/demo/demo-ivr.xml b/conf/rayo/lang/ru/demo/demo-ivr.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/ru/demo/demo-ivr.xml
rename to conf/rayo/lang/ru/demo/demo-ivr.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/ru/demo/demo.xml b/conf/rayo/lang/ru/demo/demo.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/ru/demo/demo.xml
rename to conf/rayo/lang/ru/demo/demo.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/ru/dir/sounds.xml b/conf/rayo/lang/ru/dir/sounds.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/ru/dir/sounds.xml
rename to conf/rayo/lang/ru/dir/sounds.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/ru/dir/tts.xml b/conf/rayo/lang/ru/dir/tts.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/ru/dir/tts.xml
rename to conf/rayo/lang/ru/dir/tts.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/ru/ru.xml b/conf/rayo/lang/ru/ru.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/ru/ru.xml
rename to conf/rayo/lang/ru/ru.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/ru/vm/sounds.xml b/conf/rayo/lang/ru/vm/sounds.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/ru/vm/sounds.xml
rename to conf/rayo/lang/ru/vm/sounds.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/ru/vm/tts.xml b/conf/rayo/lang/ru/vm/tts.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/lang/ru/vm/tts.xml
rename to conf/rayo/lang/ru/vm/tts.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/mime.types b/conf/rayo/mime.types
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/mime.types
rename to conf/rayo/mime.types
diff --git a/src/mod/event_handlers/mod_rayo/conf/sip_profiles/external.xml b/conf/rayo/sip_profiles/external.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/sip_profiles/external.xml
rename to conf/rayo/sip_profiles/external.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/sip_profiles/external/example.xml b/conf/rayo/sip_profiles/external/example.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/sip_profiles/external/example.xml
rename to conf/rayo/sip_profiles/external/example.xml
diff --git a/src/mod/event_handlers/mod_rayo/conf/vars.xml b/conf/rayo/vars.xml
similarity index 100%
rename from src/mod/event_handlers/mod_rayo/conf/vars.xml
rename to conf/rayo/vars.xml
diff --git a/conf/vanilla/autoload_configs/lua.conf.xml b/conf/vanilla/autoload_configs/lua.conf.xml
index 1eb594f0b5..f50307ea89 100644
--- a/conf/vanilla/autoload_configs/lua.conf.xml
+++ b/conf/vanilla/autoload_configs/lua.conf.xml
@@ -26,5 +26,7 @@
-->
+
+
diff --git a/conf/vanilla/autoload_configs/modules.conf.xml b/conf/vanilla/autoload_configs/modules.conf.xml
index 9f4168f803..0ca6bc5b34 100644
--- a/conf/vanilla/autoload_configs/modules.conf.xml
+++ b/conf/vanilla/autoload_configs/modules.conf.xml
@@ -48,7 +48,7 @@
-
+
diff --git a/conf/vanilla/lang/en/vm/sounds.xml b/conf/vanilla/lang/en/vm/sounds.xml
index fdef472a5b..fae8acefaa 100644
--- a/conf/vanilla/lang/en/vm/sounds.xml
+++ b/conf/vanilla/lang/en/vm/sounds.xml
@@ -334,12 +334,15 @@
-
+
+
+
+
-
+
diff --git a/conf/vanilla/mrcp_profiles/vestec-mrcp-v1.xml b/conf/vanilla/mrcp_profiles/vestec-mrcp-v1.xml
new file mode 100644
index 0000000000..cbde87ca5a
--- /dev/null
+++ b/conf/vanilla/mrcp_profiles/vestec-mrcp-v1.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/conf/vanilla/sip_profiles/internal.xml b/conf/vanilla/sip_profiles/internal.xml
index df838406d1..c813d99c67 100644
--- a/conf/vanilla/sip_profiles/internal.xml
+++ b/conf/vanilla/sip_profiles/internal.xml
@@ -178,6 +178,10 @@
+
+
+
+
@@ -311,6 +315,10 @@
+
+
+
+
diff --git a/configure.in b/configure.in
index fd52b959ff..7ee37860a8 100644
--- a/configure.in
+++ b/configure.in
@@ -3,10 +3,10 @@
# Must change all of the below together
# For a release, set revision for that tagged release as well and uncomment
-AC_INIT([freeswitch], [1.5.3b], bugs@freeswitch.org)
+AC_INIT([freeswitch], [1.5.5b], bugs@freeswitch.org)
AC_SUBST(SWITCH_VERSION_MAJOR, [1])
AC_SUBST(SWITCH_VERSION_MINOR, [5])
-AC_SUBST(SWITCH_VERSION_MICRO, [3b])
+AC_SUBST(SWITCH_VERSION_MICRO, [5b])
AC_SUBST(SWITCH_VERSION_REVISION, [])
AC_SUBST(SWITCH_VERSION_REVISION_HUMAN, [])
@@ -405,6 +405,10 @@ if test "x$enable_core_odbc_support" != "xno"; then
AC_CHECK_LIB([odbc], [SQLDisconnect],, AC_MSG_ERROR([no usable libodbc; please install unixodbc devel package or equivalent]))
fi
+CHECK_LIBUUID
+SWITCH_AM_LDFLAGS="$LIBUUID_LIBS $SWITCH_AM_LDFLAGS"
+SWITCH_AM_CFLAGS="$LIBUUID_CFLAGS $SWITCH_AM_CFLAGS"
+
AC_ARG_ENABLE(core-pgsql-support,
[AS_HELP_STRING([--enable-core-pgsql-support], [Compile with PGSQL Support])],,[enable_core_pgsql_support="no"])
@@ -414,7 +418,7 @@ AC_PATH_PROG([PG_CONFIG], [pg_config], [no])
if test "$PG_CONFIG" != "no"; then
AC_MSG_CHECKING([for PostgreSQL libraries])
POSTGRESQL_CXXFLAGS="`$PG_CONFIG --cppflags` -I`$PG_CONFIG --includedir`"
- POSTGRESQL_LDFLAGS="`$PG_CONFIG --ldflags` -L`$PG_CONFIG --libdir` -lpq"
+ POSTGRESQL_LDFLAGS="`$PG_CONFIG --ldflags|sed 's/ -Wl,--as-needed//g'` -L`$PG_CONFIG --libdir` -lpq"
POSTGRESQL_VERSION=`$PG_CONFIG --version | sed -e 's#PostgreSQL ##'`
POSTGRESQL_MAJOR_VERSION=`$PG_CONFIG --version | sed -re 's#PostgreSQL ([0-9]+).[0-9]+.[0-9]+#\1#'`
POSTGRESQL_MINOR_VERSION=`$PG_CONFIG --version | sed -re 's#PostgreSQL [0-9]+.([0-9]+).[0-9]+#\1#'`
diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh
index 473bae5539..5843872904 100755
--- a/debian/bootstrap.sh
+++ b/debian/bootstrap.sh
@@ -179,7 +179,7 @@ Build-Depends:
# bootstrapping
automake (>= 1.9), autoconf, libtool,
# core build
- dpkg-dev (>= 1.15.8.12), gcc (>= 4:4.4.5) , g++ (>= 4:4.4.5),
+ dpkg-dev (>= 1.15.8.12), gcc (>= 4:4.4.5), g++ (>= 4:4.4.5),
libc6-dev (>= 2.11.3), make (>= 3.81),
wget, pkg-config,
# configure options
diff --git a/debian/control-modules b/debian/control-modules
index 188f17ff96..ec291c71b6 100644
--- a/debian/control-modules
+++ b/debian/control-modules
@@ -227,9 +227,9 @@ Description: Voicemail detection
This module detects voicemail beeps at any frequency in O(1) time.
Module: applications/mod_voicemail
-Depends: mail-transport-agent
Description: Voicemail
This module provides a voicemail system.
+Depends: mail-transport-agent
Module: applications/mod_voicemail_ivr
Description: Voicemail IVR
@@ -490,6 +490,10 @@ Module: event_handlers/mod_radius_cdr
Description: mod_radius_cdr
Adds mod_radius_cdr.
+Module: event_handlers/mod_rayo
+Description: mod_rayo
+ Adds mod_rayo.
+
Module: event_handlers/mod_snmp
Description: mod_snmp
Adds mod_snmp.
@@ -523,6 +527,10 @@ Description: mod_sndfile
Adds mod_sndfile.
Build-Depends: libflac-dev, libogg-dev, libvorbis-dev
+Module: formats/mod_ssml
+Description: mod_ssml
+ Adds mod_ssml.
+
Module: formats/mod_tone_stream
Description: mod_tone_stream
Adds mod_tone_stream.
diff --git a/debian/freeswitch-mod-managed.install.tmpl b/debian/freeswitch-mod-managed.install.tmpl
new file mode 100644
index 0000000000..fb30d673f8
--- /dev/null
+++ b/debian/freeswitch-mod-managed.install.tmpl
@@ -0,0 +1 @@
+/usr/lib/freeswitch/mod/FreeSWITCH.Managed.dll
diff --git a/debian/freeswitch-mod-spidermonkey.install.tmpl b/debian/freeswitch-mod-spidermonkey.install.tmpl
new file mode 100644
index 0000000000..cb98d43c5d
--- /dev/null
+++ b/debian/freeswitch-mod-spidermonkey.install.tmpl
@@ -0,0 +1,5 @@
+/usr/lib/freeswitch/mod/mod_spidermonkey_core_db.so
+/usr/lib/freeswitch/mod/mod_spidermonkey_curl.so
+/usr/lib/freeswitch/mod/mod_spidermonkey_odbc.so
+/usr/lib/freeswitch/mod/mod_spidermonkey_socket.so
+/usr/lib/freeswitch/mod/mod_spidermonkey_teletone.so
diff --git a/docs/SubmittingPatches b/docs/SubmittingPatches
new file mode 100644
index 0000000000..e839ff128d
--- /dev/null
+++ b/docs/SubmittingPatches
@@ -0,0 +1,117 @@
+How to Contribute Patches to FreeSWITCH
+=======================================
+
+Download the Source Code
+------------------------
+
+ git clone git://git.freeswitch.org/freeswitch.git
+ cd freeswitch
+
+Create Your Patch
+-----------------
+
+ # create a topic/feature branch in your local repository
+ git checkout -b myfeature
+
+ # make your change
+ emacs .
+
+ # commit the results locally; see below for how to write a good
+ # commit message
+ git commit -va
+
+ # create more commits as needed such that each commit represents a
+ # logically separate change
+ #while true; do emacs .; git commit -va; done
+
+ # create patch files
+ git format-patch origin/master..HEAD
+
+ # you'll now have a number of *.patch files in your current
+ # directory
+
+ # navigate to the FreeSWITCH JIRA
+ chromium http://jira.freeswitch.org/
+
+ # create an account in JIRA and create a new issue;
+ # attach the patch file(s) you created to the issue
+
+Writing a Good Commit Message
+-----------------------------
+
+Your commit message consists of two parts: the subject and the body.
+
+The subject is like the subject in an email message. It should be
+short -- typically less than 50 characters -- and it should concisely
+describe the purpose or effect of your change.
+
+If you're having a difficult time writing a short subject for your
+commit, perhaps your commit should be broken into smaller separate
+commits.
+
+The commit body can be longer and can consist of multiple paragraphs.
+The text of the body should be hard wrapped to 68-72 characters.
+
+When writing the commit body, describe in detail the problem that your
+commit aims to solve, how your commit solves the problem, and any
+changes in behavior that result from your change, such as new
+variables, command flags, or breaks in backward compatibility.
+
+Your commit message should be written in the present tense in
+imperative style. Your message should talk about what the patch
+*does*, not what you *did* to write it.
+
+The commit subject is the first line of your commit message, then
+there is an empty line, then your commit body starts. A good commit
+message might look like this:
+
+> Add frobinator support to mod_sofia
+>
+> Without proper frobinator support users had to make multiple calls
+> to shell scripts to do the sort of frobbing needed in high call
+> volume environments.
+>
+> With this change, we now link to libfrob and support the IETF
+> draft-cross-voip-frobbing API.
+>
+> After appropriate amounts of frobbing have been done, a new variable
+> `frobbing_done` is set in the caller's channel.
+>
+> FS-XXXX --resolve
+
+Patches Related to JIRA Issues
+------------------------------
+
+When your patch is related to an issue logged in JIRA, add the
+identifier for the issue (e.g. FS-XXXX) to the body of your commit
+message at the beginning of a line, typically the last line or just
+before "Signed-off-by:" and "Thanks-to:" lines. This helps our JIRA
+bot do useful things by relating the commit to the issue.
+
+If you believe your patch resolves the issue in question, follow the
+issue number with a space and the "--resolve" directive as in the
+example above.
+
+Where to Go for Help
+--------------------
+
+If you have any questions or run into any roadblocks please reach out
+to us. You can send an email to our development mailing list:
+
+> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
+
+Note that while you're free to send a patch to that list for questions
+or for review, patches sent to the mailing list will not be considered
+for inclusion. Patches that you want included in FreeSWITCH must be
+submitted to JIRA.
+
+You can also reach us on freenode.net at:
+
+> #freeswitch-dev
+
+Finally, feel free to join us in our weekly conference call. Many of
+the core developers are often on the call and you'll have an
+opportunity at the beginning or end of the call to ask your questions:
+
+> http://wiki.freeswitch.org/wiki/Weekly_Conference_Call
+
diff --git a/freeswitch.spec b/freeswitch.spec
index 0e638daf66..1454aa6779 100644
--- a/freeswitch.spec
+++ b/freeswitch.spec
@@ -116,14 +116,14 @@ Source2: http://files.freeswitch.org/downloads/libs/flite-1.5.1-current.tar.bz2
Source3: http://files.freeswitch.org/downloads/libs/lame-3.97.tar.gz
Source4: http://files.freeswitch.org/downloads/libs/libshout-2.2.2.tar.gz
Source5: http://files.freeswitch.org/downloads/libs/mpg123-1.13.2.tar.gz
-Source6: http://files.freeswitch.org/downloads/libs/openldap-2.4.11.tar.gz
-Source7: http://files.freeswitch.org/downloads/libs/pocketsphinx-0.7.tar.gz
-Source8: http://files.freeswitch.org/downloads/libs/soundtouch-1.6.0.tar.gz
-Source9: http://files.freeswitch.org/downloads/libs/sphinxbase-0.7.tar.gz
-Source10: http://files.freeswitch.org/downloads/libs/communicator_semi_6000_20080321.tar.gz
-Source11: http://files.freeswitch.org/downloads/libs/libmemcached-0.32.tar.gz
-Source12: http://files.freeswitch.org/downloads/libs/json-c-0.9.tar.gz
-Source13: http://files.freeswitch.org/downloads/libs/opus-0.9.0.tar.gz
+#Source6: http://files.freeswitch.org/downloads/libs/openldap-2.4.11.tar.gz
+Source6: http://files.freeswitch.org/downloads/libs/pocketsphinx-0.7.tar.gz
+Source7: http://files.freeswitch.org/downloads/libs/soundtouch-1.6.0.tar.gz
+Source8: http://files.freeswitch.org/downloads/libs/sphinxbase-0.7.tar.gz
+Source9: http://files.freeswitch.org/downloads/libs/communicator_semi_6000_20080321.tar.gz
+Source10: http://files.freeswitch.org/downloads/libs/libmemcached-0.32.tar.gz
+Source11: http://files.freeswitch.org/downloads/libs/json-c-0.9.tar.gz
+Source12: http://files.freeswitch.org/downloads/libs/opus-0.9.0.tar.gz
Prefix: %{prefix}
@@ -137,7 +137,7 @@ Prefix: %{prefix}
#BuildRequires: openldap2-devel
BuildRequires: lzo-devel
%else
-BuildRequires: openldap-devel
+#BuildRequires: openldap-devel
%endif
BuildRequires: autoconf
BuildRequires: automake
@@ -182,7 +182,7 @@ Requires: ncurses
Requires: openssl
Requires: unixODBC
Requires: libjpeg
-Requires: openldap
+#Requires: openldap
Requires: db4
Requires: gdbm
Requires: zlib
@@ -700,6 +700,14 @@ Requires: %{name} = %{version}-%{release}
%description codec-isac
iSAC Codec support for FreeSWITCH open source telephony platform
+%package codec-vp8
+Summary: vp8 Codec support for FreeSWITCH open source telephony platform
+Group: System/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description codec-vp8
+iSAC Codec support for FreeSWITCH open source telephony platform
+
%package codec-mp4v
Summary: MP4V Video Codec support for FreeSWITCH open source telephony platform
Group: System/Libraries
@@ -770,13 +778,13 @@ Theora Video Codec support for FreeSWITCH open source telephony platform.
# FreeSWITCH Directory Modules
######################################################################################################################
-%package directory-ldap
-Summary: LDAP Directory support for FreeSWITCH open source telephony platform
-Group: System/Libraries
-Requires: %{name} = %{version}-%{release}
+#%package directory-ldap
+#Summary: LDAP Directory support for FreeSWITCH open source telephony platform
+#Group: System/Libraries
+#Requires: %{name} = %{version}-%{release}
-%description directory-ldap
-LDAP Directory support for FreeSWITCH open source telephony platform.
+#%description directory-ldap
+#LDAP Directory support for FreeSWITCH open source telephony platform.
######################################################################################################################
# FreeSWITCH Endpoint Modules
@@ -1266,7 +1274,6 @@ cp %{SOURCE9} libs/
cp %{SOURCE10} libs/
cp %{SOURCE11} libs/
cp %{SOURCE12} libs/
-cp %{SOURCE13} libs/
######################################################################################################################
#
@@ -1329,7 +1336,7 @@ ASR_TTS_MODULES="asr_tts/mod_flite asr_tts/mod_pocketsphinx asr_tts/mod_tts_comm
######################################################################################################################
CODECS_MODULES="codecs/mod_amr codecs/mod_amrwb codecs/mod_bv codecs/mod_celt codecs/mod_codec2 codecs/mod_g723_1 \
codecs/mod_g729 codecs/mod_h26x codecs/mod_ilbc codecs/mod_isac codecs/mod_mp4v codecs/mod_opus codecs/mod_silk \
- codecs/mod_siren codecs/mod_speex codecs/mod_theora "
+ codecs/mod_siren codecs/mod_speex codecs/mod_theora codecs/mod_vp8"
#
%if %{build_sng_tc}
CODECS_MODULES+="codecs/mod_sangoma_codec"
@@ -2040,6 +2047,10 @@ fi
%defattr(-,freeswitch,daemon)
%{MODINSTDIR}/mod_mp4v.so*
+%files codec-vp8
+%defattr(-,freeswitch,daemon)
+%{MODINSTDIR}/mod_vp8.so*
+
%files codec-opus
%defattr(-,freeswitch,daemon)
%{MODINSTDIR}/mod_opus.so*
@@ -2072,9 +2083,9 @@ fi
#
######################################################################################################################
-%files directory-ldap
-%defattr(-,freeswitch,daemon)
-%{MODINSTDIR}/mod_theora.so*
+#%files directory-ldap
+#%defattr(-,freeswitch,daemon)
+#%{MODINSTDIR}/mod_theora.so*
######################################################################################################################
#
@@ -2374,7 +2385,9 @@ fi
#
######################################################################################################################
%changelog
-* Thu June 19 2013 - krice@freeswitch.org
+* Thu Jun 28 2013 - krice@freeswitch.org
+- Add module for VP8
+* Thu Jun 19 2013 - krice@freeswitch.org
- tweak files included for vanilla configs
* Thu Sep 19 2012 - krice@freeswitch.org
- Add support for Spanish and Portugese say language modules
diff --git a/fscomm/conf/freeswitch.serial b/fscomm/conf/freeswitch.serial
deleted file mode 100644
index 1ed5449607..0000000000
Binary files a/fscomm/conf/freeswitch.serial and /dev/null differ
diff --git a/htdocs/portal/assets/js/fsportal.js b/htdocs/portal/assets/js/fsportal.js
index 32c3b24703..d002cac4d1 100644
--- a/htdocs/portal/assets/js/fsportal.js
+++ b/htdocs/portal/assets/js/fsportal.js
@@ -154,6 +154,12 @@ App.ShowSaysRoute = Ember.Route.extend({
}
});
+App.ShowNatMapsRoute = Ember.Route.extend({
+ setupController: function(controller) {
+ App.showNatMapsController.load();
+ }
+});
+
App.ShowChatsRoute = Ember.Route.extend({
setupController: function(controller) {
App.showChatsController.load();
@@ -203,6 +209,7 @@ App.Router.map(function(){
this.route("showAliases");
this.route("showCompletes");
this.route("showManagements");
+ this.route("showNatMaps");
this.route("showSays");
this.route("showChats");
this.route("showInterfaces");
@@ -256,6 +263,10 @@ App.callsController = Ember.ArrayController.create({
});
},
+ delete: function(uuid) {
+ var obj = this.content.findProperty("uuid", uuid);
+ if (obj) this.content.removeObject(obj);// else alert(uuid);
+ },
dump: function(uuid) {
var obj = this.content.findProperty("uuid", uuid);
console.log(obj.getProperties(["uuid", "cid_num"]));
@@ -550,6 +561,23 @@ App.showManagementsController = Ember.ArrayController.create({
}
});
+App.showNatMapsController = Ember.ArrayController.create({
+ content: [],
+ init: function(){
+ },
+ load: function() {
+ var me = this;
+ $.getJSON("/txtapi/show?nat_map%20as%20json", function(data){
+ me.set('total', data.row_count);
+ me.content.clear();
+ if (data.row_count == 0) return;
+
+ me.pushObjects(data.rows);
+
+ });
+ }
+});
+
App.showSaysController = Ember.ArrayController.create({
content: [],
init: function(){
@@ -687,10 +715,17 @@ App.usersController = Ember.ArrayController.create({
});
App.initialize();
-
+var global_debug_event = false;
+var global_background_job = false;
function eventCallback(data) {
console.log(data["Event-Name"]);
+
+ if (global_debug_event ||
+ (global_background_job && data["Event-Name"] == "BACKGROUND_JOB")) {
+ console.log(data);
+ }
+
if (data["Event-Name"] == "CHANNEL_CREATE") {
var channel = {
uuid: data["Unique-ID"],
@@ -700,8 +735,47 @@ function eventCallback(data) {
direction: data["Call-Direction"]
}
App.channelsController.pushObject(App.Channel.create(channel));
+
+ var x = $('#auto_update_calls')[0];
+ if (typeof x != "undefined" && x.checked) {
+ return;
+ }
+
+ App.callsController.pushObject(App.Call.create(channel));
} else if (data["Event-Name"] == "CHANNEL_HANGUP_COMPLETE") {
App.channelsController.delete(data["Unique-ID"]);
+
+ var x = $('#auto_update_calls')[0];
+ if (typeof x != "undefined" && x.checked) {
+ return;
+ }
+
+ App.callsController.delete(data["Unique-ID"]);
+ } else if (data["Event-Name"] == "CHANNEL_BRIDGE") {
+ var x = $('#auto_update_calls')[0];
+ if (typeof x != "undefined" && x.checked) {
+ return;
+ }
+
+ App.callsController.delete(data["Unique-ID"]);
+ App.callsController.delete(data["Other-Leg-Unique-ID"]);
+
+ var call = {
+ uuid: data["Unique-ID"],
+ b_uuid: data["Other-Leg-Unique-ID"],
+ cid_num: data["Caller-Caller-ID-Number"],
+ b_cid_num: data["Other-Leg-Caller-ID-Number"],
+ dest: data["Caller-Destination-Number"],
+ b_dest: data["Other-Leg-Destination-Number"],
+ callstate: data["Channel-Call-State"],
+ b_callstate: data["Channel-Call-State"],
+ direction: data["Call-Direction"],
+ b_direction: data["Other-Leg-Direction"],
+ created: data["Caller-Channel-Created-Time"]
+ };
+
+ App.callsController.pushObject(App.Call.create(call));
+
} else if (data["Event-Name"] == "CHANNEL_CALLSTATE") {
var obj = App.channelsController.content.findProperty("uuid", data["Unique-ID"]);
if (obj) {
@@ -711,3 +785,34 @@ function eventCallback(data) {
}
}
+// execute api
+function api(cmdstr)
+{
+ cmdarr = cmdstr.split(" ");
+ cmd = cmdarr.shift();
+ arg = escape(cmdarr.join(" "));
+ arg = arg ? "?" + arg : "";
+ url = "/txtapi/" + cmd + arg;
+ $.get(url, function(data){
+ console.log(data);
+ });
+ return url;
+}
+
+//execute bgapi
+function bgapi(cmd)
+{
+ if (!global_background_job) {
+ socket.send("event json BACKGROUND_JOB");
+ global_background_job = true;
+ }
+ api("bgapi " + cmd);
+}
+
+// subscribe event
+function event(e)
+{
+ cmd = "event json " + e;
+ socket.send(cmd);
+ return cmd;
+}
diff --git a/htdocs/portal/assets/js/ie-console.js b/htdocs/portal/assets/js/ie-console.js
new file mode 100644
index 0000000000..60f73cceec
--- /dev/null
+++ b/htdocs/portal/assets/js/ie-console.js
@@ -0,0 +1,19 @@
+// var ie_console_alertFallback = true;
+// var ie_console_divFallback = true;
+
+if (typeof console === "undefined" || typeof console.log === "undefined") {
+ console = {};
+
+ if (typeof ie_console_divFallback != "undefined") {
+ console.log = function(msg) {
+ $('#ie_console_debug_div').append(msg);
+ $('#ie_console_debug_div').append("
");
+ }
+ } else if (typeof ie_console_alertFallback != "undefined" ) {
+ console.log = function(msg) {
+ alert(msg);
+ };
+ } else {
+ console.log = function() {};
+ }
+}
diff --git a/htdocs/portal/index.html b/htdocs/portal/index.html
index 47270e6814..351b09590e 100644
--- a/htdocs/portal/index.html
+++ b/htdocs/portal/index.html
@@ -357,6 +357,28 @@
+
+
@@ -687,6 +770,7 @@
$('#ws-status').html('Socket Connected').css("color", "green");
// socket.send("event json all");
socket.send("event json CHANNEL_CREATE");
+ socket.send("event json CHANNEL_BRIDGE");
socket.send("event json CHANNEL_HANGUP_COMPLETE");
socket.send("event json CHANNEL_CALLSTATE");
}
@@ -694,7 +778,6 @@
socket.onmessage =function(msg) {
// console.log(msg.data);
var data = JSON.parse(msg.data);
- console.log(data["Event-Name"]);
eventCallback(data);
}
diff --git a/libs/.gitignore b/libs/.gitignore
index 093c5bdf10..8fca0c8c42 100644
--- a/libs/.gitignore
+++ b/libs/.gitignore
@@ -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/
diff --git a/libs/esl/fs_cli.c b/libs/esl/fs_cli.c
index 0e6521908c..05286ecc49 100644
--- a/libs/esl/fs_cli.c
+++ b/libs/esl/fs_cli.c
@@ -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);
diff --git a/libs/esl/java/esl_wrap.cpp b/libs/esl/java/esl_wrap.cpp
index 0550231dde..c5c4fa60c2 100644
--- a/libs/esl/java/esl_wrap.cpp
+++ b/libs/esl/java/esl_wrap.cpp
@@ -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 ;
diff --git a/libs/esl/java/org/freeswitch/esl/ESLconnection.java b/libs/esl/java/org/freeswitch/esl/ESLconnection.java
index 588cefcc99..a45613473d 100644
--- a/libs/esl/java/org/freeswitch/esl/ESLconnection.java
+++ b/libs/esl/java/org/freeswitch/esl/ESLconnection.java
@@ -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() {
diff --git a/libs/esl/java/org/freeswitch/esl/eslJNI.java b/libs/esl/java/org/freeswitch/esl/eslJNI.java
index ff3744e9df..e7da6f5fdf 100644
--- a/libs/esl/java/org/freeswitch/esl/eslJNI.java
+++ b/libs/esl/java/org/freeswitch/esl/eslJNI.java
@@ -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_);
diff --git a/libs/esl/lua/esl_wrap.cpp b/libs/esl/lua/esl_wrap.cpp
index 9420f853bb..9dac86544d 100644
--- a/libs/esl/lua/esl_wrap.cpp
+++ b/libs/esl/lua/esl_wrap.cpp
@@ -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);
}
}
}
diff --git a/libs/esl/managed/ESLPINVOKE.cs b/libs/esl/managed/ESLPINVOKE.cs
index 5ada2c148d..749ebeabfe 100644
--- a/libs/esl/managed/ESLPINVOKE.cs
+++ b/libs/esl/managed/ESLPINVOKE.cs
@@ -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);
diff --git a/libs/esl/managed/ESLconnection.cs b/libs/esl/managed/ESLconnection.cs
index 2d1e6d4dc3..82efb907ed 100644
--- a/libs/esl/managed/ESLconnection.cs
+++ b/libs/esl/managed/ESLconnection.cs
@@ -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() {
diff --git a/libs/esl/managed/esl_wrap.cpp b/libs/esl/managed/esl_wrap.cpp
index 65da98a15a..010ece83e2 100644
--- a/libs/esl/managed/esl_wrap.cpp
+++ b/libs/esl/managed/esl_wrap.cpp
@@ -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 ;
diff --git a/libs/esl/perl/esl_wrap.cpp b/libs/esl/perl/esl_wrap.cpp
index 832289f156..e2b7eec88c 100644
--- a/libs/esl/perl/esl_wrap.cpp
+++ b/libs/esl/perl/esl_wrap.cpp
@@ -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;
}
}
diff --git a/libs/esl/php/esl_wrap.cpp b/libs/esl/php/esl_wrap.cpp
index b5fd7a7d52..8c91f25452 100644
--- a/libs/esl/php/esl_wrap.cpp
+++ b/libs/esl/php/esl_wrap.cpp
@@ -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);
}
}
}
diff --git a/libs/esl/python/esl_wrap.cpp b/libs/esl/python/esl_wrap.cpp
index 35d600e0b0..b12f21cab0 100644
--- a/libs/esl/python/esl_wrap.cpp
+++ b/libs/esl/python/esl_wrap.cpp
@@ -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");
diff --git a/libs/esl/ruby/esl_wrap.cpp b/libs/esl/ruby/esl_wrap.cpp
index 223ba3ea34..2d7e906402 100644
--- a/libs/esl/ruby/esl_wrap.cpp
+++ b/libs/esl/ruby/esl_wrap.cpp
@@ -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");
diff --git a/libs/esl/src/esl_event.c b/libs/esl/src/esl_event.c
index 19cb6708a5..910180f47e 100644
--- a/libs/esl/src/esl_event.c
+++ b/libs/esl/src/esl_event.c
@@ -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) {
diff --git a/libs/esl/src/esl_oop.cpp b/libs/esl/src/esl_oop.cpp
index 3fa4dcce56..9c202f2160 100644
--- a/libs/esl/src/esl_oop.cpp
+++ b/libs/esl/src/esl_oop.cpp
@@ -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();
diff --git a/libs/esl/src/include/esl_oop.h b/libs/esl/src/include/esl_oop.h
index 450b047afc..93ce487965 100644
--- a/libs/esl/src/include/esl_oop.h
+++ b/libs/esl/src/include/esl_oop.h
@@ -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);
diff --git a/libs/freetdm/.gitignore b/libs/freetdm/.gitignore
index ff2a46a071..da2caa7d87 100644
--- a/libs/freetdm/.gitignore
+++ b/libs/freetdm/.gitignore
@@ -26,6 +26,9 @@ testr2
testsangomaboost
testtones
+!/msvc/testanalog/
+!/msvc/testboost/
+
!/sample/boost/Makefile
!/sample/dso/Makefile
diff --git a/libs/freetdm/src/libteletone_generate.c b/libs/freetdm/src/libteletone_generate.c
index 3654d1ec34..ef7a7e03ec 100644
--- a/libs/freetdm/src/libteletone_generate.c
+++ b/libs/freetdm/src/libteletone_generate.c
@@ -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--;
}
diff --git a/libs/iksemel/.update b/libs/iksemel/.update
index b391edc878..a3a56a0ec9 100644
--- a/libs/iksemel/.update
+++ b/libs/iksemel/.update
@@ -1 +1 @@
-Tue May 14 07:44:21 CDT 2013
+Mon Jul 15 16:57:11 CDT 2013
diff --git a/libs/iksemel/include/iksemel.h b/libs/iksemel/include/iksemel.h
index 9ef479a9ee..2b11070671 100644
--- a/libs/iksemel/include/iksemel.h
+++ b/libs/iksemel/include/iksemel.h
@@ -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 *****/
diff --git a/libs/iksemel/src/stream.c b/libs/iksemel/src/stream.c
index 559335b16e..658c40207c 100644
--- a/libs/iksemel/src/stream.c
+++ b/libs/iksemel/src/stream.c
@@ -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, "");
+ 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, "");
+ 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
diff --git a/libs/libteletone/src/libteletone_generate.c b/libs/libteletone/src/libteletone_generate.c
index 3654d1ec34..ef7a7e03ec 100644
--- a/libs/libteletone/src/libteletone_generate.c
+++ b/libs/libteletone/src/libteletone_generate.c
@@ -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--;
}
diff --git a/libs/openzap/.gitignore b/libs/openzap/.gitignore
index b0dc177c9a..48d9684d18 100644
--- a/libs/openzap/.gitignore
+++ b/libs/openzap/.gitignore
@@ -22,3 +22,6 @@ testisdn
testpri
testr2
testtones
+
+!/msvc/testanalog/
+!/msvc/testisdn/
diff --git a/libs/sofia-sip/.update b/libs/sofia-sip/.update
index 91bc2e3e8a..eba02f5caf 100644
--- a/libs/sofia-sip/.update
+++ b/libs/sofia-sip/.update
@@ -1 +1 @@
-Tue Jun 25 09:28:40 CDT 2013
+Mon Jul 29 16:07:25 CDT 2013
diff --git a/libs/sofia-sip/libsofia-sip-ua/nta/nta.c b/libs/sofia-sip/libsofia-sip-ua/nta/nta.c
index f5d61e4530..68563978cd 100644
--- a/libs/sofia-sip/libsofia-sip-ua/nta/nta.c
+++ b/libs/sofia-sip/libsofia-sip-ua/nta/nta.c
@@ -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)
diff --git a/libs/sofia-sip/libsofia-sip-ua/nua/nua_client.c b/libs/sofia-sip/libsofia-sip-ua/nua/nua_client.c
index a9fed48ffe..c5400dd4ca 100644
--- a/libs/sofia-sip/libsofia-sip-ua/nua/nua_client.c
+++ b/libs/sofia-sip/libsofia-sip-ua/nua/nua_client.c
@@ -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;
diff --git a/libs/sofia-sip/libsofia-sip-ua/sdp/sdp_print.c b/libs/sofia-sip/libsofia-sip-ua/sdp/sdp_print.c
index c912dd3b59..b587aa5cc1 100644
--- a/libs/sofia-sip/libsofia-sip-ua/sdp/sdp_print.c
+++ b/libs/sofia-sip/libsofia-sip-ua/sdp/sdp_print.c
@@ -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;
diff --git a/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_time.h b/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_time.h
index b4acba6a7d..ea347e80a0 100644
--- a/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_time.h
+++ b/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_time.h
@@ -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
diff --git a/libs/sofia-sip/libsofia-sip-ua/su/su_time0.c b/libs/sofia-sip/libsofia-sip-ua/su/su_time0.c
index 0543e45aa0..cae14a35a8 100644
--- a/libs/sofia-sip/libsofia-sip-ua/su/su_time0.c
+++ b/libs/sofia-sip/libsofia-sip-ua/su/su_time0.c
@@ -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(<v);
+ 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);
diff --git a/libs/sofia-sip/libsofia-sip-ua/tport/tport.c b/libs/sofia-sip/libsofia-sip-ua/tport/tport.c
index 6cbb4336ce..50050e2289 100644
--- a/libs/sofia-sip/libsofia-sip-ua/tport/tport.c
+++ b/libs/sofia-sip/libsofia-sip-ua/tport/tport.c
@@ -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 */
diff --git a/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_ws.c b/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_ws.c
index c6846be1e1..67f78148fb 100644
--- a/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_ws.c
+++ b/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_ws.c
@@ -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;
}
}
diff --git a/libs/sofia-sip/libsofia-sip-ua/tport/tport_ws.h b/libs/sofia-sip/libsofia-sip-ua/tport/tport_ws.h
index 034b6f8fde..b4a5d42b5a 100644
--- a/libs/sofia-sip/libsofia-sip-ua/tport/tport_ws.h
+++ b/libs/sofia-sip/libsofia-sip-ua/tport/tport_ws.h
@@ -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;
diff --git a/libs/sofia-sip/libsofia-sip-ua/tport/ws.c b/libs/sofia-sip/libsofia-sip-ua/tport/ws.c
index 938b3f6d04..35fb4c0f22 100644
--- a/libs/sofia-sip/libsofia-sip-ua/tport/ws.c
+++ b/libs/sofia-sip/libsofia-sip-ua/tport/ws.c
@@ -1,5 +1,10 @@
#include "ws.h"
#include
+
+#ifndef _MSC_VER
+#include
+#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;
diff --git a/libs/sofia-sip/libsofia-sip-ua/tport/ws.h b/libs/sofia-sip/libsofia-sip-ua/tport/ws.h
index 2182960c14..81368158b3 100644
--- a/libs/sofia-sip/libsofia-sip-ua/tport/ws.h
+++ b/libs/sofia-sip/libsofia-sip-ua/tport/ws.h
@@ -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);
diff --git a/libs/spandsp/INSTALL b/libs/spandsp/INSTALL
index 2abc70492a..007e9396d0 100644
--- a/libs/spandsp/INSTALL
+++ b/libs/spandsp/INSTALL
@@ -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 `' 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.
diff --git a/libs/spandsp/configure.ac b/libs/spandsp/configure.ac
index dacc3ae4ed..13e31152a4 100644
--- a/libs/spandsp/configure.ac
+++ b/libs/spandsp/configure.ac
@@ -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 "])
AC_CHECK_HEADERS([stdint.h], [INSERT_STDINT_HEADER="#include "])
+AC_CHECK_HEADERS([stdatomic.h])
+AC_CHECK_HEADERS([stdbool.h], [INSERT_STDBOOL_HEADER="#include "], [INSERT_STDBOOL_HEADER="#include "])
+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
diff --git a/libs/spandsp/spandsp-sim/Makefile.am b/libs/spandsp/spandsp-sim/Makefile.am
index d33575a55c..4eb86c4b49 100644
--- a/libs/spandsp/spandsp-sim/Makefile.am
+++ b/libs/spandsp/spandsp-sim/Makefile.am
@@ -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
diff --git a/libs/spandsp/src/Makefile.am b/libs/spandsp/src/Makefile.am
index 3d63ae7274..812100f9cb 100644
--- a/libs/spandsp/src/Makefile.am
+++ b/libs/spandsp/src/Makefile.am
@@ -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 \
diff --git a/libs/spandsp/src/ademco_contactid.c b/libs/spandsp/src/ademco_contactid.c
index 6aaf99c382..453ccc0394 100644
--- a/libs/spandsp/src/ademco_contactid.c
+++ b/libs/spandsp/src/ademco_contactid.c
@@ -39,6 +39,11 @@
#if defined(HAVE_MATH_H)
#include
#endif
+#if defined(HAVE_STDBOOL_H)
+#include
+#else
+#include "spandsp/stdbool.h"
+#endif
#include "floating_fudge.h"
#include
#include
@@ -46,6 +51,7 @@
#include
#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, &[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 --------------------------------------------------------*/
diff --git a/libs/spandsp/src/adsi.c b/libs/spandsp/src/adsi.c
index 44add41be0..1f711bf44f 100644
--- a/libs/spandsp/src/adsi.c
+++ b/libs/spandsp/src/adsi.c
@@ -40,10 +40,16 @@
#if defined(HAVE_MATH_H)
#include
#endif
+#if defined(HAVE_STDBOOL_H)
+#include
+#else
+#include "spandsp/stdbool.h"
+#endif
#include "floating_fudge.h"
#include
#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 --------------------------------------------------------*/
diff --git a/libs/spandsp/src/alloc.c b/libs/spandsp/src/alloc.c
new file mode 100644
index 0000000000..06600adb30
--- /dev/null
+++ b/libs/spandsp/src/alloc.c
@@ -0,0 +1,145 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * alloc.c - memory allocation handling.
+ *
+ * Written by Steve Underwood
+ *
+ * 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
+#include
+#include
+#include
+#if !defined(__USE_ISOC11)
+#define __USE_ISOC11
+#endif
+#include
+#if defined(HAVE_MALLOC_H)
+#include
+#endif
+#include
+#include
+#include
+#include
+#include
+#include
+
+#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 ------------------------------------------------------------*/
diff --git a/libs/spandsp/src/async.c b/libs/spandsp/src/async.c
index fb381bb7bc..d1bf5bda5b 100644
--- a/libs/spandsp/src/async.c
+++ b/libs/spandsp/src/async.c
@@ -33,8 +33,14 @@
#include
#include
#include
+#if defined(HAVE_STDBOOL_H)
+#include
+#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 --------------------------------------------------------*/
diff --git a/libs/spandsp/src/at_interpreter.c b/libs/spandsp/src/at_interpreter.c
index 2ecdbb866d..d43ffb3671 100644
--- a/libs/spandsp/src/at_interpreter.c
+++ b/libs/spandsp/src/at_interpreter.c
@@ -43,9 +43,15 @@
#include
#include
#include
+#if defined(HAVE_STDBOOL_H)
+#include
+#else
+#include "spandsp/stdbool.h"
+#endif
#include
#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 --------------------------------------------------------*/
diff --git a/libs/spandsp/src/awgn.c b/libs/spandsp/src/awgn.c
index 582959cc93..fa33b1b4c5 100644
--- a/libs/spandsp/src/awgn.c
+++ b/libs/spandsp/src/awgn.c
@@ -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 --------------------------------------------------------*/
diff --git a/libs/spandsp/src/bell_r2_mf.c b/libs/spandsp/src/bell_r2_mf.c
index dba407cddd..8f74b7a86a 100644
--- a/libs/spandsp/src/bell_r2_mf.c
+++ b/libs/spandsp/src/bell_r2_mf.c
@@ -40,9 +40,15 @@
#if defined(HAVE_MATH_H)
#include
#endif
+#if defined(HAVE_STDBOOL_H)
+#include
+#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 --------------------------------------------------------*/
diff --git a/libs/spandsp/src/bert.c b/libs/spandsp/src/bert.c
index a8ad5ad6b7..728476d65e 100644
--- a/libs/spandsp/src/bert.c
+++ b/libs/spandsp/src/bert.c
@@ -33,8 +33,14 @@
#include
#include
#include
+#if defined(HAVE_STDBOOL_H)
+#include
+#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 --------------------------------------------------------*/
diff --git a/libs/spandsp/src/bitstream.c b/libs/spandsp/src/bitstream.c
index 9a8c0bc9dd..6c0b9dde4b 100644
--- a/libs/spandsp/src/bitstream.c
+++ b/libs/spandsp/src/bitstream.c
@@ -33,8 +33,14 @@
#include
#include
#include
+#if defined(HAVE_STDBOOL_H)
+#include
+#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 --------------------------------------------------------*/
diff --git a/libs/spandsp/src/cielab_luts.h b/libs/spandsp/src/cielab_luts.h
deleted file mode 100644
index 0a3c697915..0000000000
--- a/libs/spandsp/src/cielab_luts.h
+++ /dev/null
@@ -1,4358 +0,0 @@
-static const float srgb_to_linear[256] =
-{
- 0.000000,
- 0.000302,
- 0.000605,
- 0.000907,
- 0.001209,
- 0.001512,
- 0.001814,
- 0.002116,
- 0.002419,
- 0.002721,
- 0.003023,
- 0.003333,
- 0.003661,
- 0.004007,
- 0.004371,
- 0.004754,
- 0.005156,
- 0.005577,
- 0.006017,
- 0.006477,
- 0.006957,
- 0.007457,
- 0.007977,
- 0.008518,
- 0.009080,
- 0.009663,
- 0.010267,
- 0.010893,
- 0.011540,
- 0.012209,
- 0.012900,
- 0.013614,
- 0.014350,
- 0.015109,
- 0.015890,
- 0.016695,
- 0.017523,
- 0.018375,
- 0.019250,
- 0.020149,
- 0.021072,
- 0.022019,
- 0.022991,
- 0.023987,
- 0.025008,
- 0.026054,
- 0.027125,
- 0.028221,
- 0.029343,
- 0.030490,
- 0.031663,
- 0.032862,
- 0.034087,
- 0.035338,
- 0.036616,
- 0.037920,
- 0.039250,
- 0.040608,
- 0.041993,
- 0.043404,
- 0.044844,
- 0.046310,
- 0.047804,
- 0.049326,
- 0.050876,
- 0.052454,
- 0.054060,
- 0.055694,
- 0.057357,
- 0.059049,
- 0.060769,
- 0.062518,
- 0.064296,
- 0.066103,
- 0.067940,
- 0.069806,
- 0.071701,
- 0.073626,
- 0.075581,
- 0.077566,
- 0.079581,
- 0.081627,
- 0.083702,
- 0.085808,
- 0.087945,
- 0.090112,
- 0.092311,
- 0.094540,
- 0.096800,
- 0.099092,
- 0.101414,
- 0.103769,
- 0.106155,
- 0.108572,
- 0.111021,
- 0.113503,
- 0.116016,
- 0.118562,
- 0.121139,
- 0.123750,
- 0.126392,
- 0.129068,
- 0.131776,
- 0.134517,
- 0.137291,
- 0.140098,
- 0.142938,
- 0.145812,
- 0.148719,
- 0.151659,
- 0.154633,
- 0.157641,
- 0.160683,
- 0.163758,
- 0.166868,
- 0.170012,
- 0.173190,
- 0.176403,
- 0.179650,
- 0.182932,
- 0.186248,
- 0.189599,
- 0.192985,
- 0.196407,
- 0.199863,
- 0.203354,
- 0.206881,
- 0.210443,
- 0.214041,
- 0.217675,
- 0.221344,
- 0.225049,
- 0.228789,
- 0.232566,
- 0.236379,
- 0.240229,
- 0.244114,
- 0.248036,
- 0.251995,
- 0.255990,
- 0.260022,
- 0.264090,
- 0.268196,
- 0.272338,
- 0.276518,
- 0.280734,
- 0.284988,
- 0.289280,
- 0.293609,
- 0.297975,
- 0.302379,
- 0.306821,
- 0.311301,
- 0.315818,
- 0.320374,
- 0.324967,
- 0.329599,
- 0.334269,
- 0.338978,
- 0.343725,
- 0.348510,
- 0.353334,
- 0.358197,
- 0.363099,
- 0.368040,
- 0.373019,
- 0.378038,
- 0.383096,
- 0.388193,
- 0.393329,
- 0.398505,
- 0.403721,
- 0.408976,
- 0.414270,
- 0.419605,
- 0.424979,
- 0.430393,
- 0.435848,
- 0.441342,
- 0.446877,
- 0.452452,
- 0.458067,
- 0.463722,
- 0.469419,
- 0.475156,
- 0.480933,
- 0.486751,
- 0.492610,
- 0.498510,
- 0.504452,
- 0.510434,
- 0.516457,
- 0.522522,
- 0.528628,
- 0.534775,
- 0.540964,
- 0.547194,
- 0.553466,
- 0.559780,
- 0.566136,
- 0.572533,
- 0.578973,
- 0.585455,
- 0.591978,
- 0.598544,
- 0.605152,
- 0.611803,
- 0.618496,
- 0.625232,
- 0.632010,
- 0.638831,
- 0.645694,
- 0.652600,
- 0.659550,
- 0.666542,
- 0.673577,
- 0.680656,
- 0.687777,
- 0.694942,
- 0.702151,
- 0.709402,
- 0.716698,
- 0.724036,
- 0.731419,
- 0.738845,
- 0.746315,
- 0.753829,
- 0.761386,
- 0.768988,
- 0.776634,
- 0.784324,
- 0.792058,
- 0.799837,
- 0.807660,
- 0.815527,
- 0.823439,
- 0.831396,
- 0.839397,
- 0.847443,
- 0.855534,
- 0.863669,
- 0.871850,
- 0.880075,
- 0.888346,
- 0.896662,
- 0.905023,
- 0.913429,
- 0.921881,
- 0.930378,
- 0.938921,
- 0.947509,
- 0.956143,
- 0.964823,
- 0.973548,
- 0.982319,
- 0.991137
-};
-static const uint8_t linear_to_srgb[4096] =
-{
- 0,
- 0,
- 1,
- 2,
- 3,
- 4,
- 4,
- 5,
- 6,
- 7,
- 8,
- 8,
- 9,
- 10,
- 11,
- 12,
- 12,
- 13,
- 14,
- 14,
- 15,
- 15,
- 16,
- 17,
- 17,
- 18,
- 18,
- 19,
- 19,
- 20,
- 20,
- 21,
- 21,
- 22,
- 22,
- 23,
- 23,
- 23,
- 24,
- 24,
- 25,
- 25,
- 25,
- 26,
- 26,
- 27,
- 27,
- 27,
- 28,
- 28,
- 28,
- 29,
- 29,
- 30,
- 30,
- 30,
- 31,
- 31,
- 31,
- 32,
- 32,
- 32,
- 33,
- 33,
- 33,
- 33,
- 34,
- 34,
- 34,
- 35,
- 35,
- 35,
- 36,
- 36,
- 36,
- 36,
- 37,
- 37,
- 37,
- 38,
- 38,
- 38,
- 38,
- 39,
- 39,
- 39,
- 39,
- 40,
- 40,
- 40,
- 40,
- 41,
- 41,
- 41,
- 41,
- 42,
- 42,
- 42,
- 42,
- 43,
- 43,
- 43,
- 43,
- 44,
- 44,
- 44,
- 44,
- 45,
- 45,
- 45,
- 45,
- 45,
- 46,
- 46,
- 46,
- 46,
- 47,
- 47,
- 47,
- 47,
- 47,
- 48,
- 48,
- 48,
- 48,
- 49,
- 49,
- 49,
- 49,
- 49,
- 50,
- 50,
- 50,
- 50,
- 50,
- 51,
- 51,
- 51,
- 51,
- 51,
- 52,
- 52,
- 52,
- 52,
- 52,
- 53,
- 53,
- 53,
- 53,
- 53,
- 54,
- 54,
- 54,
- 54,
- 54,
- 54,
- 55,
- 55,
- 55,
- 55,
- 55,
- 56,
- 56,
- 56,
- 56,
- 56,
- 56,
- 57,
- 57,
- 57,
- 57,
- 57,
- 57,
- 58,
- 58,
- 58,
- 58,
- 58,
- 59,
- 59,
- 59,
- 59,
- 59,
- 59,
- 60,
- 60,
- 60,
- 60,
- 60,
- 60,
- 61,
- 61,
- 61,
- 61,
- 61,
- 61,
- 62,
- 62,
- 62,
- 62,
- 62,
- 62,
- 62,
- 63,
- 63,
- 63,
- 63,
- 63,
- 63,
- 64,
- 64,
- 64,
- 64,
- 64,
- 64,
- 65,
- 65,
- 65,
- 65,
- 65,
- 65,
- 65,
- 66,
- 66,
- 66,
- 66,
- 66,
- 66,
- 66,
- 67,
- 67,
- 67,
- 67,
- 67,
- 67,
- 68,
- 68,
- 68,
- 68,
- 68,
- 68,
- 68,
- 69,
- 69,
- 69,
- 69,
- 69,
- 69,
- 69,
- 70,
- 70,
- 70,
- 70,
- 70,
- 70,
- 70,
- 70,
- 71,
- 71,
- 71,
- 71,
- 71,
- 71,
- 71,
- 72,
- 72,
- 72,
- 72,
- 72,
- 72,
- 72,
- 73,
- 73,
- 73,
- 73,
- 73,
- 73,
- 73,
- 73,
- 74,
- 74,
- 74,
- 74,
- 74,
- 74,
- 74,
- 75,
- 75,
- 75,
- 75,
- 75,
- 75,
- 75,
- 75,
- 76,
- 76,
- 76,
- 76,
- 76,
- 76,
- 76,
- 76,
- 77,
- 77,
- 77,
- 77,
- 77,
- 77,
- 77,
- 77,
- 78,
- 78,
- 78,
- 78,
- 78,
- 78,
- 78,
- 78,
- 79,
- 79,
- 79,
- 79,
- 79,
- 79,
- 79,
- 79,
- 80,
- 80,
- 80,
- 80,
- 80,
- 80,
- 80,
- 80,
- 80,
- 81,
- 81,
- 81,
- 81,
- 81,
- 81,
- 81,
- 81,
- 82,
- 82,
- 82,
- 82,
- 82,
- 82,
- 82,
- 82,
- 82,
- 83,
- 83,
- 83,
- 83,
- 83,
- 83,
- 83,
- 83,
- 83,
- 84,
- 84,
- 84,
- 84,
- 84,
- 84,
- 84,
- 84,
- 84,
- 85,
- 85,
- 85,
- 85,
- 85,
- 85,
- 85,
- 85,
- 85,
- 86,
- 86,
- 86,
- 86,
- 86,
- 86,
- 86,
- 86,
- 86,
- 87,
- 87,
- 87,
- 87,
- 87,
- 87,
- 87,
- 87,
- 87,
- 88,
- 88,
- 88,
- 88,
- 88,
- 88,
- 88,
- 88,
- 88,
- 89,
- 89,
- 89,
- 89,
- 89,
- 89,
- 89,
- 89,
- 89,
- 89,
- 90,
- 90,
- 90,
- 90,
- 90,
- 90,
- 90,
- 90,
- 90,
- 90,
- 91,
- 91,
- 91,
- 91,
- 91,
- 91,
- 91,
- 91,
- 91,
- 92,
- 92,
- 92,
- 92,
- 92,
- 92,
- 92,
- 92,
- 92,
- 92,
- 93,
- 93,
- 93,
- 93,
- 93,
- 93,
- 93,
- 93,
- 93,
- 93,
- 94,
- 94,
- 94,
- 94,
- 94,
- 94,
- 94,
- 94,
- 94,
- 94,
- 95,
- 95,
- 95,
- 95,
- 95,
- 95,
- 95,
- 95,
- 95,
- 95,
- 95,
- 96,
- 96,
- 96,
- 96,
- 96,
- 96,
- 96,
- 96,
- 96,
- 96,
- 97,
- 97,
- 97,
- 97,
- 97,
- 97,
- 97,
- 97,
- 97,
- 97,
- 97,
- 98,
- 98,
- 98,
- 98,
- 98,
- 98,
- 98,
- 98,
- 98,
- 98,
- 99,
- 99,
- 99,
- 99,
- 99,
- 99,
- 99,
- 99,
- 99,
- 99,
- 99,
- 100,
- 100,
- 100,
- 100,
- 100,
- 100,
- 100,
- 100,
- 100,
- 100,
- 100,
- 101,
- 101,
- 101,
- 101,
- 101,
- 101,
- 101,
- 101,
- 101,
- 101,
- 101,
- 102,
- 102,
- 102,
- 102,
- 102,
- 102,
- 102,
- 102,
- 102,
- 102,
- 102,
- 103,
- 103,
- 103,
- 103,
- 103,
- 103,
- 103,
- 103,
- 103,
- 103,
- 103,
- 103,
- 104,
- 104,
- 104,
- 104,
- 104,
- 104,
- 104,
- 104,
- 104,
- 104,
- 104,
- 105,
- 105,
- 105,
- 105,
- 105,
- 105,
- 105,
- 105,
- 105,
- 105,
- 105,
- 105,
- 106,
- 106,
- 106,
- 106,
- 106,
- 106,
- 106,
- 106,
- 106,
- 106,
- 106,
- 106,
- 107,
- 107,
- 107,
- 107,
- 107,
- 107,
- 107,
- 107,
- 107,
- 107,
- 107,
- 107,
- 108,
- 108,
- 108,
- 108,
- 108,
- 108,
- 108,
- 108,
- 108,
- 108,
- 108,
- 108,
- 109,
- 109,
- 109,
- 109,
- 109,
- 109,
- 109,
- 109,
- 109,
- 109,
- 109,
- 109,
- 110,
- 110,
- 110,
- 110,
- 110,
- 110,
- 110,
- 110,
- 110,
- 110,
- 110,
- 110,
- 111,
- 111,
- 111,
- 111,
- 111,
- 111,
- 111,
- 111,
- 111,
- 111,
- 111,
- 111,
- 111,
- 112,
- 112,
- 112,
- 112,
- 112,
- 112,
- 112,
- 112,
- 112,
- 112,
- 112,
- 112,
- 113,
- 113,
- 113,
- 113,
- 113,
- 113,
- 113,
- 113,
- 113,
- 113,
- 113,
- 113,
- 113,
- 114,
- 114,
- 114,
- 114,
- 114,
- 114,
- 114,
- 114,
- 114,
- 114,
- 114,
- 114,
- 114,
- 115,
- 115,
- 115,
- 115,
- 115,
- 115,
- 115,
- 115,
- 115,
- 115,
- 115,
- 115,
- 115,
- 116,
- 116,
- 116,
- 116,
- 116,
- 116,
- 116,
- 116,
- 116,
- 116,
- 116,
- 116,
- 116,
- 117,
- 117,
- 117,
- 117,
- 117,
- 117,
- 117,
- 117,
- 117,
- 117,
- 117,
- 117,
- 117,
- 118,
- 118,
- 118,
- 118,
- 118,
- 118,
- 118,
- 118,
- 118,
- 118,
- 118,
- 118,
- 118,
- 118,
- 119,
- 119,
- 119,
- 119,
- 119,
- 119,
- 119,
- 119,
- 119,
- 119,
- 119,
- 119,
- 119,
- 120,
- 120,
- 120,
- 120,
- 120,
- 120,
- 120,
- 120,
- 120,
- 120,
- 120,
- 120,
- 120,
- 120,
- 121,
- 121,
- 121,
- 121,
- 121,
- 121,
- 121,
- 121,
- 121,
- 121,
- 121,
- 121,
- 121,
- 121,
- 122,
- 122,
- 122,
- 122,
- 122,
- 122,
- 122,
- 122,
- 122,
- 122,
- 122,
- 122,
- 122,
- 122,
- 123,
- 123,
- 123,
- 123,
- 123,
- 123,
- 123,
- 123,
- 123,
- 123,
- 123,
- 123,
- 123,
- 123,
- 124,
- 124,
- 124,
- 124,
- 124,
- 124,
- 124,
- 124,
- 124,
- 124,
- 124,
- 124,
- 124,
- 124,
- 125,
- 125,
- 125,
- 125,
- 125,
- 125,
- 125,
- 125,
- 125,
- 125,
- 125,
- 125,
- 125,
- 125,
- 125,
- 126,
- 126,
- 126,
- 126,
- 126,
- 126,
- 126,
- 126,
- 126,
- 126,
- 126,
- 126,
- 126,
- 126,
- 127,
- 127,
- 127,
- 127,
- 127,
- 127,
- 127,
- 127,
- 127,
- 127,
- 127,
- 127,
- 127,
- 127,
- 127,
- 128,
- 128,
- 128,
- 128,
- 128,
- 128,
- 128,
- 128,
- 128,
- 128,
- 128,
- 128,
- 128,
- 128,
- 128,
- 129,
- 129,
- 129,
- 129,
- 129,
- 129,
- 129,
- 129,
- 129,
- 129,
- 129,
- 129,
- 129,
- 129,
- 129,
- 130,
- 130,
- 130,
- 130,
- 130,
- 130,
- 130,
- 130,
- 130,
- 130,
- 130,
- 130,
- 130,
- 130,
- 130,
- 131,
- 131,
- 131,
- 131,
- 131,
- 131,
- 131,
- 131,
- 131,
- 131,
- 131,
- 131,
- 131,
- 131,
- 131,
- 131,
- 132,
- 132,
- 132,
- 132,
- 132,
- 132,
- 132,
- 132,
- 132,
- 132,
- 132,
- 132,
- 132,
- 132,
- 132,
- 133,
- 133,
- 133,
- 133,
- 133,
- 133,
- 133,
- 133,
- 133,
- 133,
- 133,
- 133,
- 133,
- 133,
- 133,
- 133,
- 134,
- 134,
- 134,
- 134,
- 134,
- 134,
- 134,
- 134,
- 134,
- 134,
- 134,
- 134,
- 134,
- 134,
- 134,
- 135,
- 135,
- 135,
- 135,
- 135,
- 135,
- 135,
- 135,
- 135,
- 135,
- 135,
- 135,
- 135,
- 135,
- 135,
- 135,
- 136,
- 136,
- 136,
- 136,
- 136,
- 136,
- 136,
- 136,
- 136,
- 136,
- 136,
- 136,
- 136,
- 136,
- 136,
- 136,
- 137,
- 137,
- 137,
- 137,
- 137,
- 137,
- 137,
- 137,
- 137,
- 137,
- 137,
- 137,
- 137,
- 137,
- 137,
- 137,
- 137,
- 138,
- 138,
- 138,
- 138,
- 138,
- 138,
- 138,
- 138,
- 138,
- 138,
- 138,
- 138,
- 138,
- 138,
- 138,
- 138,
- 139,
- 139,
- 139,
- 139,
- 139,
- 139,
- 139,
- 139,
- 139,
- 139,
- 139,
- 139,
- 139,
- 139,
- 139,
- 139,
- 139,
- 140,
- 140,
- 140,
- 140,
- 140,
- 140,
- 140,
- 140,
- 140,
- 140,
- 140,
- 140,
- 140,
- 140,
- 140,
- 140,
- 141,
- 141,
- 141,
- 141,
- 141,
- 141,
- 141,
- 141,
- 141,
- 141,
- 141,
- 141,
- 141,
- 141,
- 141,
- 141,
- 141,
- 142,
- 142,
- 142,
- 142,
- 142,
- 142,
- 142,
- 142,
- 142,
- 142,
- 142,
- 142,
- 142,
- 142,
- 142,
- 142,
- 142,
- 143,
- 143,
- 143,
- 143,
- 143,
- 143,
- 143,
- 143,
- 143,
- 143,
- 143,
- 143,
- 143,
- 143,
- 143,
- 143,
- 143,
- 144,
- 144,
- 144,
- 144,
- 144,
- 144,
- 144,
- 144,
- 144,
- 144,
- 144,
- 144,
- 144,
- 144,
- 144,
- 144,
- 144,
- 145,
- 145,
- 145,
- 145,
- 145,
- 145,
- 145,
- 145,
- 145,
- 145,
- 145,
- 145,
- 145,
- 145,
- 145,
- 145,
- 145,
- 145,
- 146,
- 146,
- 146,
- 146,
- 146,
- 146,
- 146,
- 146,
- 146,
- 146,
- 146,
- 146,
- 146,
- 146,
- 146,
- 146,
- 146,
- 147,
- 147,
- 147,
- 147,
- 147,
- 147,
- 147,
- 147,
- 147,
- 147,
- 147,
- 147,
- 147,
- 147,
- 147,
- 147,
- 147,
- 147,
- 148,
- 148,
- 148,
- 148,
- 148,
- 148,
- 148,
- 148,
- 148,
- 148,
- 148,
- 148,
- 148,
- 148,
- 148,
- 148,
- 148,
- 148,
- 149,
- 149,
- 149,
- 149,
- 149,
- 149,
- 149,
- 149,
- 149,
- 149,
- 149,
- 149,
- 149,
- 149,
- 149,
- 149,
- 149,
- 149,
- 150,
- 150,
- 150,
- 150,
- 150,
- 150,
- 150,
- 150,
- 150,
- 150,
- 150,
- 150,
- 150,
- 150,
- 150,
- 150,
- 150,
- 150,
- 151,
- 151,
- 151,
- 151,
- 151,
- 151,
- 151,
- 151,
- 151,
- 151,
- 151,
- 151,
- 151,
- 151,
- 151,
- 151,
- 151,
- 151,
- 151,
- 152,
- 152,
- 152,
- 152,
- 152,
- 152,
- 152,
- 152,
- 152,
- 152,
- 152,
- 152,
- 152,
- 152,
- 152,
- 152,
- 152,
- 152,
- 153,
- 153,
- 153,
- 153,
- 153,
- 153,
- 153,
- 153,
- 153,
- 153,
- 153,
- 153,
- 153,
- 153,
- 153,
- 153,
- 153,
- 153,
- 153,
- 154,
- 154,
- 154,
- 154,
- 154,
- 154,
- 154,
- 154,
- 154,
- 154,
- 154,
- 154,
- 154,
- 154,
- 154,
- 154,
- 154,
- 154,
- 154,
- 155,
- 155,
- 155,
- 155,
- 155,
- 155,
- 155,
- 155,
- 155,
- 155,
- 155,
- 155,
- 155,
- 155,
- 155,
- 155,
- 155,
- 155,
- 155,
- 156,
- 156,
- 156,
- 156,
- 156,
- 156,
- 156,
- 156,
- 156,
- 156,
- 156,
- 156,
- 156,
- 156,
- 156,
- 156,
- 156,
- 156,
- 156,
- 157,
- 157,
- 157,
- 157,
- 157,
- 157,
- 157,
- 157,
- 157,
- 157,
- 157,
- 157,
- 157,
- 157,
- 157,
- 157,
- 157,
- 157,
- 157,
- 158,
- 158,
- 158,
- 158,
- 158,
- 158,
- 158,
- 158,
- 158,
- 158,
- 158,
- 158,
- 158,
- 158,
- 158,
- 158,
- 158,
- 158,
- 158,
- 159,
- 159,
- 159,
- 159,
- 159,
- 159,
- 159,
- 159,
- 159,
- 159,
- 159,
- 159,
- 159,
- 159,
- 159,
- 159,
- 159,
- 159,
- 159,
- 159,
- 160,
- 160,
- 160,
- 160,
- 160,
- 160,
- 160,
- 160,
- 160,
- 160,
- 160,
- 160,
- 160,
- 160,
- 160,
- 160,
- 160,
- 160,
- 160,
- 160,
- 161,
- 161,
- 161,
- 161,
- 161,
- 161,
- 161,
- 161,
- 161,
- 161,
- 161,
- 161,
- 161,
- 161,
- 161,
- 161,
- 161,
- 161,
- 161,
- 161,
- 162,
- 162,
- 162,
- 162,
- 162,
- 162,
- 162,
- 162,
- 162,
- 162,
- 162,
- 162,
- 162,
- 162,
- 162,
- 162,
- 162,
- 162,
- 162,
- 162,
- 163,
- 163,
- 163,
- 163,
- 163,
- 163,
- 163,
- 163,
- 163,
- 163,
- 163,
- 163,
- 163,
- 163,
- 163,
- 163,
- 163,
- 163,
- 163,
- 163,
- 164,
- 164,
- 164,
- 164,
- 164,
- 164,
- 164,
- 164,
- 164,
- 164,
- 164,
- 164,
- 164,
- 164,
- 164,
- 164,
- 164,
- 164,
- 164,
- 164,
- 165,
- 165,
- 165,
- 165,
- 165,
- 165,
- 165,
- 165,
- 165,
- 165,
- 165,
- 165,
- 165,
- 165,
- 165,
- 165,
- 165,
- 165,
- 165,
- 165,
- 165,
- 166,
- 166,
- 166,
- 166,
- 166,
- 166,
- 166,
- 166,
- 166,
- 166,
- 166,
- 166,
- 166,
- 166,
- 166,
- 166,
- 166,
- 166,
- 166,
- 166,
- 166,
- 167,
- 167,
- 167,
- 167,
- 167,
- 167,
- 167,
- 167,
- 167,
- 167,
- 167,
- 167,
- 167,
- 167,
- 167,
- 167,
- 167,
- 167,
- 167,
- 167,
- 167,
- 168,
- 168,
- 168,
- 168,
- 168,
- 168,
- 168,
- 168,
- 168,
- 168,
- 168,
- 168,
- 168,
- 168,
- 168,
- 168,
- 168,
- 168,
- 168,
- 168,
- 168,
- 169,
- 169,
- 169,
- 169,
- 169,
- 169,
- 169,
- 169,
- 169,
- 169,
- 169,
- 169,
- 169,
- 169,
- 169,
- 169,
- 169,
- 169,
- 169,
- 169,
- 169,
- 170,
- 170,
- 170,
- 170,
- 170,
- 170,
- 170,
- 170,
- 170,
- 170,
- 170,
- 170,
- 170,
- 170,
- 170,
- 170,
- 170,
- 170,
- 170,
- 170,
- 170,
- 171,
- 171,
- 171,
- 171,
- 171,
- 171,
- 171,
- 171,
- 171,
- 171,
- 171,
- 171,
- 171,
- 171,
- 171,
- 171,
- 171,
- 171,
- 171,
- 171,
- 171,
- 171,
- 172,
- 172,
- 172,
- 172,
- 172,
- 172,
- 172,
- 172,
- 172,
- 172,
- 172,
- 172,
- 172,
- 172,
- 172,
- 172,
- 172,
- 172,
- 172,
- 172,
- 172,
- 173,
- 173,
- 173,
- 173,
- 173,
- 173,
- 173,
- 173,
- 173,
- 173,
- 173,
- 173,
- 173,
- 173,
- 173,
- 173,
- 173,
- 173,
- 173,
- 173,
- 173,
- 173,
- 174,
- 174,
- 174,
- 174,
- 174,
- 174,
- 174,
- 174,
- 174,
- 174,
- 174,
- 174,
- 174,
- 174,
- 174,
- 174,
- 174,
- 174,
- 174,
- 174,
- 174,
- 174,
- 175,
- 175,
- 175,
- 175,
- 175,
- 175,
- 175,
- 175,
- 175,
- 175,
- 175,
- 175,
- 175,
- 175,
- 175,
- 175,
- 175,
- 175,
- 175,
- 175,
- 175,
- 175,
- 176,
- 176,
- 176,
- 176,
- 176,
- 176,
- 176,
- 176,
- 176,
- 176,
- 176,
- 176,
- 176,
- 176,
- 176,
- 176,
- 176,
- 176,
- 176,
- 176,
- 176,
- 176,
- 176,
- 177,
- 177,
- 177,
- 177,
- 177,
- 177,
- 177,
- 177,
- 177,
- 177,
- 177,
- 177,
- 177,
- 177,
- 177,
- 177,
- 177,
- 177,
- 177,
- 177,
- 177,
- 177,
- 178,
- 178,
- 178,
- 178,
- 178,
- 178,
- 178,
- 178,
- 178,
- 178,
- 178,
- 178,
- 178,
- 178,
- 178,
- 178,
- 178,
- 178,
- 178,
- 178,
- 178,
- 178,
- 178,
- 179,
- 179,
- 179,
- 179,
- 179,
- 179,
- 179,
- 179,
- 179,
- 179,
- 179,
- 179,
- 179,
- 179,
- 179,
- 179,
- 179,
- 179,
- 179,
- 179,
- 179,
- 179,
- 179,
- 180,
- 180,
- 180,
- 180,
- 180,
- 180,
- 180,
- 180,
- 180,
- 180,
- 180,
- 180,
- 180,
- 180,
- 180,
- 180,
- 180,
- 180,
- 180,
- 180,
- 180,
- 180,
- 180,
- 181,
- 181,
- 181,
- 181,
- 181,
- 181,
- 181,
- 181,
- 181,
- 181,
- 181,
- 181,
- 181,
- 181,
- 181,
- 181,
- 181,
- 181,
- 181,
- 181,
- 181,
- 181,
- 181,
- 182,
- 182,
- 182,
- 182,
- 182,
- 182,
- 182,
- 182,
- 182,
- 182,
- 182,
- 182,
- 182,
- 182,
- 182,
- 182,
- 182,
- 182,
- 182,
- 182,
- 182,
- 182,
- 182,
- 183,
- 183,
- 183,
- 183,
- 183,
- 183,
- 183,
- 183,
- 183,
- 183,
- 183,
- 183,
- 183,
- 183,
- 183,
- 183,
- 183,
- 183,
- 183,
- 183,
- 183,
- 183,
- 183,
- 183,
- 184,
- 184,
- 184,
- 184,
- 184,
- 184,
- 184,
- 184,
- 184,
- 184,
- 184,
- 184,
- 184,
- 184,
- 184,
- 184,
- 184,
- 184,
- 184,
- 184,
- 184,
- 184,
- 184,
- 185,
- 185,
- 185,
- 185,
- 185,
- 185,
- 185,
- 185,
- 185,
- 185,
- 185,
- 185,
- 185,
- 185,
- 185,
- 185,
- 185,
- 185,
- 185,
- 185,
- 185,
- 185,
- 185,
- 185,
- 186,
- 186,
- 186,
- 186,
- 186,
- 186,
- 186,
- 186,
- 186,
- 186,
- 186,
- 186,
- 186,
- 186,
- 186,
- 186,
- 186,
- 186,
- 186,
- 186,
- 186,
- 186,
- 186,
- 186,
- 187,
- 187,
- 187,
- 187,
- 187,
- 187,
- 187,
- 187,
- 187,
- 187,
- 187,
- 187,
- 187,
- 187,
- 187,
- 187,
- 187,
- 187,
- 187,
- 187,
- 187,
- 187,
- 187,
- 187,
- 188,
- 188,
- 188,
- 188,
- 188,
- 188,
- 188,
- 188,
- 188,
- 188,
- 188,
- 188,
- 188,
- 188,
- 188,
- 188,
- 188,
- 188,
- 188,
- 188,
- 188,
- 188,
- 188,
- 188,
- 188,
- 189,
- 189,
- 189,
- 189,
- 189,
- 189,
- 189,
- 189,
- 189,
- 189,
- 189,
- 189,
- 189,
- 189,
- 189,
- 189,
- 189,
- 189,
- 189,
- 189,
- 189,
- 189,
- 189,
- 189,
- 190,
- 190,
- 190,
- 190,
- 190,
- 190,
- 190,
- 190,
- 190,
- 190,
- 190,
- 190,
- 190,
- 190,
- 190,
- 190,
- 190,
- 190,
- 190,
- 190,
- 190,
- 190,
- 190,
- 190,
- 190,
- 191,
- 191,
- 191,
- 191,
- 191,
- 191,
- 191,
- 191,
- 191,
- 191,
- 191,
- 191,
- 191,
- 191,
- 191,
- 191,
- 191,
- 191,
- 191,
- 191,
- 191,
- 191,
- 191,
- 191,
- 191,
- 192,
- 192,
- 192,
- 192,
- 192,
- 192,
- 192,
- 192,
- 192,
- 192,
- 192,
- 192,
- 192,
- 192,
- 192,
- 192,
- 192,
- 192,
- 192,
- 192,
- 192,
- 192,
- 192,
- 192,
- 192,
- 193,
- 193,
- 193,
- 193,
- 193,
- 193,
- 193,
- 193,
- 193,
- 193,
- 193,
- 193,
- 193,
- 193,
- 193,
- 193,
- 193,
- 193,
- 193,
- 193,
- 193,
- 193,
- 193,
- 193,
- 193,
- 194,
- 194,
- 194,
- 194,
- 194,
- 194,
- 194,
- 194,
- 194,
- 194,
- 194,
- 194,
- 194,
- 194,
- 194,
- 194,
- 194,
- 194,
- 194,
- 194,
- 194,
- 194,
- 194,
- 194,
- 194,
- 195,
- 195,
- 195,
- 195,
- 195,
- 195,
- 195,
- 195,
- 195,
- 195,
- 195,
- 195,
- 195,
- 195,
- 195,
- 195,
- 195,
- 195,
- 195,
- 195,
- 195,
- 195,
- 195,
- 195,
- 195,
- 195,
- 196,
- 196,
- 196,
- 196,
- 196,
- 196,
- 196,
- 196,
- 196,
- 196,
- 196,
- 196,
- 196,
- 196,
- 196,
- 196,
- 196,
- 196,
- 196,
- 196,
- 196,
- 196,
- 196,
- 196,
- 196,
- 197,
- 197,
- 197,
- 197,
- 197,
- 197,
- 197,
- 197,
- 197,
- 197,
- 197,
- 197,
- 197,
- 197,
- 197,
- 197,
- 197,
- 197,
- 197,
- 197,
- 197,
- 197,
- 197,
- 197,
- 197,
- 197,
- 198,
- 198,
- 198,
- 198,
- 198,
- 198,
- 198,
- 198,
- 198,
- 198,
- 198,
- 198,
- 198,
- 198,
- 198,
- 198,
- 198,
- 198,
- 198,
- 198,
- 198,
- 198,
- 198,
- 198,
- 198,
- 198,
- 199,
- 199,
- 199,
- 199,
- 199,
- 199,
- 199,
- 199,
- 199,
- 199,
- 199,
- 199,
- 199,
- 199,
- 199,
- 199,
- 199,
- 199,
- 199,
- 199,
- 199,
- 199,
- 199,
- 199,
- 199,
- 199,
- 199,
- 200,
- 200,
- 200,
- 200,
- 200,
- 200,
- 200,
- 200,
- 200,
- 200,
- 200,
- 200,
- 200,
- 200,
- 200,
- 200,
- 200,
- 200,
- 200,
- 200,
- 200,
- 200,
- 200,
- 200,
- 200,
- 200,
- 201,
- 201,
- 201,
- 201,
- 201,
- 201,
- 201,
- 201,
- 201,
- 201,
- 201,
- 201,
- 201,
- 201,
- 201,
- 201,
- 201,
- 201,
- 201,
- 201,
- 201,
- 201,
- 201,
- 201,
- 201,
- 201,
- 201,
- 202,
- 202,
- 202,
- 202,
- 202,
- 202,
- 202,
- 202,
- 202,
- 202,
- 202,
- 202,
- 202,
- 202,
- 202,
- 202,
- 202,
- 202,
- 202,
- 202,
- 202,
- 202,
- 202,
- 202,
- 202,
- 202,
- 203,
- 203,
- 203,
- 203,
- 203,
- 203,
- 203,
- 203,
- 203,
- 203,
- 203,
- 203,
- 203,
- 203,
- 203,
- 203,
- 203,
- 203,
- 203,
- 203,
- 203,
- 203,
- 203,
- 203,
- 203,
- 203,
- 203,
- 204,
- 204,
- 204,
- 204,
- 204,
- 204,
- 204,
- 204,
- 204,
- 204,
- 204,
- 204,
- 204,
- 204,
- 204,
- 204,
- 204,
- 204,
- 204,
- 204,
- 204,
- 204,
- 204,
- 204,
- 204,
- 204,
- 204,
- 205,
- 205,
- 205,
- 205,
- 205,
- 205,
- 205,
- 205,
- 205,
- 205,
- 205,
- 205,
- 205,
- 205,
- 205,
- 205,
- 205,
- 205,
- 205,
- 205,
- 205,
- 205,
- 205,
- 205,
- 205,
- 205,
- 205,
- 206,
- 206,
- 206,
- 206,
- 206,
- 206,
- 206,
- 206,
- 206,
- 206,
- 206,
- 206,
- 206,
- 206,
- 206,
- 206,
- 206,
- 206,
- 206,
- 206,
- 206,
- 206,
- 206,
- 206,
- 206,
- 206,
- 206,
- 206,
- 207,
- 207,
- 207,
- 207,
- 207,
- 207,
- 207,
- 207,
- 207,
- 207,
- 207,
- 207,
- 207,
- 207,
- 207,
- 207,
- 207,
- 207,
- 207,
- 207,
- 207,
- 207,
- 207,
- 207,
- 207,
- 207,
- 207,
- 208,
- 208,
- 208,
- 208,
- 208,
- 208,
- 208,
- 208,
- 208,
- 208,
- 208,
- 208,
- 208,
- 208,
- 208,
- 208,
- 208,
- 208,
- 208,
- 208,
- 208,
- 208,
- 208,
- 208,
- 208,
- 208,
- 208,
- 208,
- 209,
- 209,
- 209,
- 209,
- 209,
- 209,
- 209,
- 209,
- 209,
- 209,
- 209,
- 209,
- 209,
- 209,
- 209,
- 209,
- 209,
- 209,
- 209,
- 209,
- 209,
- 209,
- 209,
- 209,
- 209,
- 209,
- 209,
- 209,
- 210,
- 210,
- 210,
- 210,
- 210,
- 210,
- 210,
- 210,
- 210,
- 210,
- 210,
- 210,
- 210,
- 210,
- 210,
- 210,
- 210,
- 210,
- 210,
- 210,
- 210,
- 210,
- 210,
- 210,
- 210,
- 210,
- 210,
- 210,
- 211,
- 211,
- 211,
- 211,
- 211,
- 211,
- 211,
- 211,
- 211,
- 211,
- 211,
- 211,
- 211,
- 211,
- 211,
- 211,
- 211,
- 211,
- 211,
- 211,
- 211,
- 211,
- 211,
- 211,
- 211,
- 211,
- 211,
- 211,
- 211,
- 212,
- 212,
- 212,
- 212,
- 212,
- 212,
- 212,
- 212,
- 212,
- 212,
- 212,
- 212,
- 212,
- 212,
- 212,
- 212,
- 212,
- 212,
- 212,
- 212,
- 212,
- 212,
- 212,
- 212,
- 212,
- 212,
- 212,
- 212,
- 213,
- 213,
- 213,
- 213,
- 213,
- 213,
- 213,
- 213,
- 213,
- 213,
- 213,
- 213,
- 213,
- 213,
- 213,
- 213,
- 213,
- 213,
- 213,
- 213,
- 213,
- 213,
- 213,
- 213,
- 213,
- 213,
- 213,
- 213,
- 213,
- 214,
- 214,
- 214,
- 214,
- 214,
- 214,
- 214,
- 214,
- 214,
- 214,
- 214,
- 214,
- 214,
- 214,
- 214,
- 214,
- 214,
- 214,
- 214,
- 214,
- 214,
- 214,
- 214,
- 214,
- 214,
- 214,
- 214,
- 214,
- 215,
- 215,
- 215,
- 215,
- 215,
- 215,
- 215,
- 215,
- 215,
- 215,
- 215,
- 215,
- 215,
- 215,
- 215,
- 215,
- 215,
- 215,
- 215,
- 215,
- 215,
- 215,
- 215,
- 215,
- 215,
- 215,
- 215,
- 215,
- 215,
- 216,
- 216,
- 216,
- 216,
- 216,
- 216,
- 216,
- 216,
- 216,
- 216,
- 216,
- 216,
- 216,
- 216,
- 216,
- 216,
- 216,
- 216,
- 216,
- 216,
- 216,
- 216,
- 216,
- 216,
- 216,
- 216,
- 216,
- 216,
- 216,
- 216,
- 217,
- 217,
- 217,
- 217,
- 217,
- 217,
- 217,
- 217,
- 217,
- 217,
- 217,
- 217,
- 217,
- 217,
- 217,
- 217,
- 217,
- 217,
- 217,
- 217,
- 217,
- 217,
- 217,
- 217,
- 217,
- 217,
- 217,
- 217,
- 217,
- 218,
- 218,
- 218,
- 218,
- 218,
- 218,
- 218,
- 218,
- 218,
- 218,
- 218,
- 218,
- 218,
- 218,
- 218,
- 218,
- 218,
- 218,
- 218,
- 218,
- 218,
- 218,
- 218,
- 218,
- 218,
- 218,
- 218,
- 218,
- 218,
- 218,
- 219,
- 219,
- 219,
- 219,
- 219,
- 219,
- 219,
- 219,
- 219,
- 219,
- 219,
- 219,
- 219,
- 219,
- 219,
- 219,
- 219,
- 219,
- 219,
- 219,
- 219,
- 219,
- 219,
- 219,
- 219,
- 219,
- 219,
- 219,
- 219,
- 220,
- 220,
- 220,
- 220,
- 220,
- 220,
- 220,
- 220,
- 220,
- 220,
- 220,
- 220,
- 220,
- 220,
- 220,
- 220,
- 220,
- 220,
- 220,
- 220,
- 220,
- 220,
- 220,
- 220,
- 220,
- 220,
- 220,
- 220,
- 220,
- 220,
- 221,
- 221,
- 221,
- 221,
- 221,
- 221,
- 221,
- 221,
- 221,
- 221,
- 221,
- 221,
- 221,
- 221,
- 221,
- 221,
- 221,
- 221,
- 221,
- 221,
- 221,
- 221,
- 221,
- 221,
- 221,
- 221,
- 221,
- 221,
- 221,
- 221,
- 222,
- 222,
- 222,
- 222,
- 222,
- 222,
- 222,
- 222,
- 222,
- 222,
- 222,
- 222,
- 222,
- 222,
- 222,
- 222,
- 222,
- 222,
- 222,
- 222,
- 222,
- 222,
- 222,
- 222,
- 222,
- 222,
- 222,
- 222,
- 222,
- 222,
- 223,
- 223,
- 223,
- 223,
- 223,
- 223,
- 223,
- 223,
- 223,
- 223,
- 223,
- 223,
- 223,
- 223,
- 223,
- 223,
- 223,
- 223,
- 223,
- 223,
- 223,
- 223,
- 223,
- 223,
- 223,
- 223,
- 223,
- 223,
- 223,
- 223,
- 223,
- 224,
- 224,
- 224,
- 224,
- 224,
- 224,
- 224,
- 224,
- 224,
- 224,
- 224,
- 224,
- 224,
- 224,
- 224,
- 224,
- 224,
- 224,
- 224,
- 224,
- 224,
- 224,
- 224,
- 224,
- 224,
- 224,
- 224,
- 224,
- 224,
- 224,
- 225,
- 225,
- 225,
- 225,
- 225,
- 225,
- 225,
- 225,
- 225,
- 225,
- 225,
- 225,
- 225,
- 225,
- 225,
- 225,
- 225,
- 225,
- 225,
- 225,
- 225,
- 225,
- 225,
- 225,
- 225,
- 225,
- 225,
- 225,
- 225,
- 225,
- 225,
- 226,
- 226,
- 226,
- 226,
- 226,
- 226,
- 226,
- 226,
- 226,
- 226,
- 226,
- 226,
- 226,
- 226,
- 226,
- 226,
- 226,
- 226,
- 226,
- 226,
- 226,
- 226,
- 226,
- 226,
- 226,
- 226,
- 226,
- 226,
- 226,
- 226,
- 226,
- 227,
- 227,
- 227,
- 227,
- 227,
- 227,
- 227,
- 227,
- 227,
- 227,
- 227,
- 227,
- 227,
- 227,
- 227,
- 227,
- 227,
- 227,
- 227,
- 227,
- 227,
- 227,
- 227,
- 227,
- 227,
- 227,
- 227,
- 227,
- 227,
- 227,
- 227,
- 228,
- 228,
- 228,
- 228,
- 228,
- 228,
- 228,
- 228,
- 228,
- 228,
- 228,
- 228,
- 228,
- 228,
- 228,
- 228,
- 228,
- 228,
- 228,
- 228,
- 228,
- 228,
- 228,
- 228,
- 228,
- 228,
- 228,
- 228,
- 228,
- 228,
- 228,
- 228,
- 229,
- 229,
- 229,
- 229,
- 229,
- 229,
- 229,
- 229,
- 229,
- 229,
- 229,
- 229,
- 229,
- 229,
- 229,
- 229,
- 229,
- 229,
- 229,
- 229,
- 229,
- 229,
- 229,
- 229,
- 229,
- 229,
- 229,
- 229,
- 229,
- 229,
- 229,
- 230,
- 230,
- 230,
- 230,
- 230,
- 230,
- 230,
- 230,
- 230,
- 230,
- 230,
- 230,
- 230,
- 230,
- 230,
- 230,
- 230,
- 230,
- 230,
- 230,
- 230,
- 230,
- 230,
- 230,
- 230,
- 230,
- 230,
- 230,
- 230,
- 230,
- 230,
- 230,
- 231,
- 231,
- 231,
- 231,
- 231,
- 231,
- 231,
- 231,
- 231,
- 231,
- 231,
- 231,
- 231,
- 231,
- 231,
- 231,
- 231,
- 231,
- 231,
- 231,
- 231,
- 231,
- 231,
- 231,
- 231,
- 231,
- 231,
- 231,
- 231,
- 231,
- 231,
- 231,
- 232,
- 232,
- 232,
- 232,
- 232,
- 232,
- 232,
- 232,
- 232,
- 232,
- 232,
- 232,
- 232,
- 232,
- 232,
- 232,
- 232,
- 232,
- 232,
- 232,
- 232,
- 232,
- 232,
- 232,
- 232,
- 232,
- 232,
- 232,
- 232,
- 232,
- 232,
- 232,
- 233,
- 233,
- 233,
- 233,
- 233,
- 233,
- 233,
- 233,
- 233,
- 233,
- 233,
- 233,
- 233,
- 233,
- 233,
- 233,
- 233,
- 233,
- 233,
- 233,
- 233,
- 233,
- 233,
- 233,
- 233,
- 233,
- 233,
- 233,
- 233,
- 233,
- 233,
- 233,
- 234,
- 234,
- 234,
- 234,
- 234,
- 234,
- 234,
- 234,
- 234,
- 234,
- 234,
- 234,
- 234,
- 234,
- 234,
- 234,
- 234,
- 234,
- 234,
- 234,
- 234,
- 234,
- 234,
- 234,
- 234,
- 234,
- 234,
- 234,
- 234,
- 234,
- 234,
- 234,
- 235,
- 235,
- 235,
- 235,
- 235,
- 235,
- 235,
- 235,
- 235,
- 235,
- 235,
- 235,
- 235,
- 235,
- 235,
- 235,
- 235,
- 235,
- 235,
- 235,
- 235,
- 235,
- 235,
- 235,
- 235,
- 235,
- 235,
- 235,
- 235,
- 235,
- 235,
- 235,
- 235,
- 236,
- 236,
- 236,
- 236,
- 236,
- 236,
- 236,
- 236,
- 236,
- 236,
- 236,
- 236,
- 236,
- 236,
- 236,
- 236,
- 236,
- 236,
- 236,
- 236,
- 236,
- 236,
- 236,
- 236,
- 236,
- 236,
- 236,
- 236,
- 236,
- 236,
- 236,
- 236,
- 236,
- 237,
- 237,
- 237,
- 237,
- 237,
- 237,
- 237,
- 237,
- 237,
- 237,
- 237,
- 237,
- 237,
- 237,
- 237,
- 237,
- 237,
- 237,
- 237,
- 237,
- 237,
- 237,
- 237,
- 237,
- 237,
- 237,
- 237,
- 237,
- 237,
- 237,
- 237,
- 237,
- 237,
- 238,
- 238,
- 238,
- 238,
- 238,
- 238,
- 238,
- 238,
- 238,
- 238,
- 238,
- 238,
- 238,
- 238,
- 238,
- 238,
- 238,
- 238,
- 238,
- 238,
- 238,
- 238,
- 238,
- 238,
- 238,
- 238,
- 238,
- 238,
- 238,
- 238,
- 238,
- 238,
- 238,
- 239,
- 239,
- 239,
- 239,
- 239,
- 239,
- 239,
- 239,
- 239,
- 239,
- 239,
- 239,
- 239,
- 239,
- 239,
- 239,
- 239,
- 239,
- 239,
- 239,
- 239,
- 239,
- 239,
- 239,
- 239,
- 239,
- 239,
- 239,
- 239,
- 239,
- 239,
- 239,
- 239,
- 240,
- 240,
- 240,
- 240,
- 240,
- 240,
- 240,
- 240,
- 240,
- 240,
- 240,
- 240,
- 240,
- 240,
- 240,
- 240,
- 240,
- 240,
- 240,
- 240,
- 240,
- 240,
- 240,
- 240,
- 240,
- 240,
- 240,
- 240,
- 240,
- 240,
- 240,
- 240,
- 240,
- 240,
- 241,
- 241,
- 241,
- 241,
- 241,
- 241,
- 241,
- 241,
- 241,
- 241,
- 241,
- 241,
- 241,
- 241,
- 241,
- 241,
- 241,
- 241,
- 241,
- 241,
- 241,
- 241,
- 241,
- 241,
- 241,
- 241,
- 241,
- 241,
- 241,
- 241,
- 241,
- 241,
- 241,
- 242,
- 242,
- 242,
- 242,
- 242,
- 242,
- 242,
- 242,
- 242,
- 242,
- 242,
- 242,
- 242,
- 242,
- 242,
- 242,
- 242,
- 242,
- 242,
- 242,
- 242,
- 242,
- 242,
- 242,
- 242,
- 242,
- 242,
- 242,
- 242,
- 242,
- 242,
- 242,
- 242,
- 242,
- 243,
- 243,
- 243,
- 243,
- 243,
- 243,
- 243,
- 243,
- 243,
- 243,
- 243,
- 243,
- 243,
- 243,
- 243,
- 243,
- 243,
- 243,
- 243,
- 243,
- 243,
- 243,
- 243,
- 243,
- 243,
- 243,
- 243,
- 243,
- 243,
- 243,
- 243,
- 243,
- 243,
- 243,
- 244,
- 244,
- 244,
- 244,
- 244,
- 244,
- 244,
- 244,
- 244,
- 244,
- 244,
- 244,
- 244,
- 244,
- 244,
- 244,
- 244,
- 244,
- 244,
- 244,
- 244,
- 244,
- 244,
- 244,
- 244,
- 244,
- 244,
- 244,
- 244,
- 244,
- 244,
- 244,
- 244,
- 244,
- 245,
- 245,
- 245,
- 245,
- 245,
- 245,
- 245,
- 245,
- 245,
- 245,
- 245,
- 245,
- 245,
- 245,
- 245,
- 245,
- 245,
- 245,
- 245,
- 245,
- 245,
- 245,
- 245,
- 245,
- 245,
- 245,
- 245,
- 245,
- 245,
- 245,
- 245,
- 245,
- 245,
- 245,
- 245,
- 246,
- 246,
- 246,
- 246,
- 246,
- 246,
- 246,
- 246,
- 246,
- 246,
- 246,
- 246,
- 246,
- 246,
- 246,
- 246,
- 246,
- 246,
- 246,
- 246,
- 246,
- 246,
- 246,
- 246,
- 246,
- 246,
- 246,
- 246,
- 246,
- 246,
- 246,
- 246,
- 246,
- 246,
- 246,
- 247,
- 247,
- 247,
- 247,
- 247,
- 247,
- 247,
- 247,
- 247,
- 247,
- 247,
- 247,
- 247,
- 247,
- 247,
- 247,
- 247,
- 247,
- 247,
- 247,
- 247,
- 247,
- 247,
- 247,
- 247,
- 247,
- 247,
- 247,
- 247,
- 247,
- 247,
- 247,
- 247,
- 247,
- 248,
- 248,
- 248,
- 248,
- 248,
- 248,
- 248,
- 248,
- 248,
- 248,
- 248,
- 248,
- 248,
- 248,
- 248,
- 248,
- 248,
- 248,
- 248,
- 248,
- 248,
- 248,
- 248,
- 248,
- 248,
- 248,
- 248,
- 248,
- 248,
- 248,
- 248,
- 248,
- 248,
- 248,
- 248,
- 249,
- 249,
- 249,
- 249,
- 249,
- 249,
- 249,
- 249,
- 249,
- 249,
- 249,
- 249,
- 249,
- 249,
- 249,
- 249,
- 249,
- 249,
- 249,
- 249,
- 249,
- 249,
- 249,
- 249,
- 249,
- 249,
- 249,
- 249,
- 249,
- 249,
- 249,
- 249,
- 249,
- 249,
- 249,
- 250,
- 250,
- 250,
- 250,
- 250,
- 250,
- 250,
- 250,
- 250,
- 250,
- 250,
- 250,
- 250,
- 250,
- 250,
- 250,
- 250,
- 250,
- 250,
- 250,
- 250,
- 250,
- 250,
- 250,
- 250,
- 250,
- 250,
- 250,
- 250,
- 250,
- 250,
- 250,
- 250,
- 250,
- 250,
- 250,
- 251,
- 251,
- 251,
- 251,
- 251,
- 251,
- 251,
- 251,
- 251,
- 251,
- 251,
- 251,
- 251,
- 251,
- 251,
- 251,
- 251,
- 251,
- 251,
- 251,
- 251,
- 251,
- 251,
- 251,
- 251,
- 251,
- 251,
- 251,
- 251,
- 251,
- 251,
- 251,
- 251,
- 251,
- 251,
- 252,
- 252,
- 252,
- 252,
- 252,
- 252,
- 252,
- 252,
- 252,
- 252,
- 252,
- 252,
- 252,
- 252,
- 252,
- 252,
- 252,
- 252,
- 252,
- 252,
- 252,
- 252,
- 252,
- 252,
- 252,
- 252,
- 252,
- 252,
- 252,
- 252,
- 252,
- 252,
- 252,
- 252,
- 252,
- 252,
- 253,
- 253,
- 253,
- 253,
- 253,
- 253,
- 253,
- 253,
- 253,
- 253,
- 253,
- 253,
- 253,
- 253,
- 253,
- 253,
- 253,
- 253,
- 253,
- 253,
- 253,
- 253,
- 253,
- 253,
- 253,
- 253,
- 253,
- 253,
- 253,
- 253,
- 253,
- 253,
- 253,
- 253,
- 253,
- 253,
- 254,
- 254,
- 254,
- 254,
- 254,
- 254,
- 254,
- 254,
- 254,
- 254,
- 254,
- 254,
- 254,
- 254,
- 254,
- 254,
- 254,
- 254,
- 254,
- 254,
- 254,
- 254,
- 254,
- 254,
- 254,
- 254,
- 254,
- 254,
- 254,
- 254,
- 254,
- 254,
- 254,
- 254,
- 254,
- 254,
- 255,
- 255,
- 255,
- 255,
- 255,
- 255,
- 255,
- 255,
- 255,
- 255,
- 255,
- 255,
- 255,
- 255,
- 255,
- 255,
- 255,
- 255,
- 255,
- 255,
- 255,
- 255,
- 255,
- 255,
- 255,
- 255,
- 255,
- 255,
- 255,
- 255,
- 255,
- 255,
- 255,
- 255,
- 255,
- 255
-};
diff --git a/libs/spandsp/src/complex_filters.c b/libs/spandsp/src/complex_filters.c
index d54e55818a..22cf4ac9b8 100644
--- a/libs/spandsp/src/complex_filters.c
+++ b/libs/spandsp/src/complex_filters.c
@@ -32,6 +32,7 @@
#include
#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;
}
}
diff --git a/libs/spandsp/src/complex_vector_float.c b/libs/spandsp/src/complex_vector_float.c
index ebb6accba4..710cbef435 100644
--- a/libs/spandsp/src/complex_vector_float.c
+++ b/libs/spandsp/src/complex_vector_float.c
@@ -39,6 +39,11 @@
#if defined(HAVE_MATH_H)
#include
#endif
+#if defined(HAVE_STDBOOL_H)
+#include
+#else
+#include "spandsp/stdbool.h"
+#endif
#include
#include "floating_fudge.h"
diff --git a/libs/spandsp/src/complex_vector_int.c b/libs/spandsp/src/complex_vector_int.c
index 0bf7eb8a98..66a0cd62cd 100644
--- a/libs/spandsp/src/complex_vector_int.c
+++ b/libs/spandsp/src/complex_vector_int.c
@@ -39,6 +39,11 @@
#if defined(HAVE_MATH_H)
#include
#endif
+#if defined(HAVE_STDBOOL_H)
+#include
+#else
+#include "spandsp/stdbool.h"
+#endif
#include
#include "floating_fudge.h"
diff --git a/libs/spandsp/src/crc.c b/libs/spandsp/src/crc.c
index f7407eda1f..cf4dd0cd0f 100644
--- a/libs/spandsp/src/crc.c
+++ b/libs/spandsp/src/crc.c
@@ -32,6 +32,11 @@
#include
#include
#include
+#if defined(HAVE_STDBOOL_H)
+#include
+#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;
diff --git a/libs/spandsp/src/dtmf.c b/libs/spandsp/src/dtmf.c
index 991f3d6a85..9f6401028c 100644
--- a/libs/spandsp/src/dtmf.c
+++ b/libs/spandsp/src/dtmf.c
@@ -31,18 +31,24 @@
#include
#include
+#include
+#include
+#include
#if defined(HAVE_TGMATH_H)
#include
#endif
#if defined(HAVE_MATH_H)
#include
#endif
+#if defined(HAVE_STDBOOL_H)
+#include
+#else
+#include "spandsp/stdbool.h"
+#endif
#include "floating_fudge.h"
-#include
-#include
-#include
#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 --------------------------------------------------------*/
diff --git a/libs/spandsp/src/echo.c b/libs/spandsp/src/echo.c
index 84926fa3c4..5d6a1cadd2 100644
--- a/libs/spandsp/src/echo.c
+++ b/libs/spandsp/src/echo.c
@@ -88,11 +88,17 @@
#if defined(HAVE_MATH_H)
#include
#endif
+#if defined(HAVE_STDBOOL_H)
+#include
+#else
+#include "spandsp/stdbool.h"
+#endif
#include "floating_fudge.h"
#include
#include
#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);
diff --git a/libs/spandsp/src/fax.c b/libs/spandsp/src/fax.c
index ef7e33433a..a220c4f818 100644
--- a/libs/spandsp/src/fax.c
+++ b/libs/spandsp/src/fax.c
@@ -40,6 +40,11 @@
#if defined(HAVE_MATH_H)
#include
#endif
+#if defined(HAVE_STDBOOL_H)
+#include
+#else
+#include "spandsp/stdbool.h"
+#endif
#include "floating_fudge.h"
#include
#include
@@ -50,6 +55,7 @@
#include
#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 --------------------------------------------------------*/
diff --git a/libs/spandsp/src/fax_modems.c b/libs/spandsp/src/fax_modems.c
index 3cf658e4df..9f6cc4ba4c 100644
--- a/libs/spandsp/src/fax_modems.c
+++ b/libs/spandsp/src/fax_modems.c
@@ -39,6 +39,11 @@
#if defined(HAVE_MATH_H)
#include
#endif
+#if defined(HAVE_STDBOOL_H)
+#include
+#else
+#include "spandsp/stdbool.h"
+#endif
#include "floating_fudge.h"
#include
#include
@@ -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;
}
diff --git a/libs/spandsp/src/filter_tools.c b/libs/spandsp/src/filter_tools.c
index 88967e93ed..ff625bb13d 100644
--- a/libs/spandsp/src/filter_tools.c
+++ b/libs/spandsp/src/filter_tools.c
@@ -32,29 +32,27 @@
#include
#include
+#include
+#include
+#include
+#include
#if defined(HAVE_TGMATH_H)
#include
#endif
#if defined(HAVE_MATH_H)
#include
#endif
+#if defined(HAVE_STDBOOL_H)
+#include
+#else
+#include "spandsp/stdbool.h"
+#endif
#include "floating_fudge.h"
-#include
-#include
-#include
-#include
#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
diff --git a/libs/spandsp/src/fsk.c b/libs/spandsp/src/fsk.c
index 56f155169e..29b32c65ea 100644
--- a/libs/spandsp/src/fsk.c
+++ b/libs/spandsp/src/fsk.c
@@ -38,16 +38,23 @@
#if defined(HAVE_MATH_H)
#include
#endif
+#if defined(HAVE_STDBOOL_H)
+#include
+#else
+#include "spandsp/stdbool.h"
+#endif
#include "floating_fudge.h"
#include
#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 --------------------------------------------------------*/
diff --git a/libs/spandsp/src/g711.c b/libs/spandsp/src/g711.c
index 173bd2ae53..edccd27bb1 100644
--- a/libs/spandsp/src/g711.c
+++ b/libs/spandsp/src/g711.c
@@ -35,6 +35,7 @@
#include
#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 --------------------------------------------------------*/
diff --git a/libs/spandsp/src/g722.c b/libs/spandsp/src/g722.c
index 22715cfa4a..2f11715c10 100644
--- a/libs/spandsp/src/g722.c
+++ b/libs/spandsp/src/g722.c
@@ -38,9 +38,15 @@
#if defined(HAVE_MATH_H)
#include
#endif
+#if defined(HAVE_STDBOOL_H)
+#include
+#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 --------------------------------------------------------*/
diff --git a/libs/spandsp/src/g726.c b/libs/spandsp/src/g726.c
index 6be385fc5f..4f3bea3b6b 100644
--- a/libs/spandsp/src/g726.c
+++ b/libs/spandsp/src/g726.c
@@ -64,9 +64,15 @@
#if defined(HAVE_MATH_H)
#include
#endif
+#if defined(HAVE_STDBOOL_H)
+#include
+#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 --------------------------------------------------------*/
diff --git a/libs/spandsp/src/gsm0610_encode.c b/libs/spandsp/src/gsm0610_encode.c
index 2c359688fe..eeac7d2881 100644
--- a/libs/spandsp/src/gsm0610_encode.c
+++ b/libs/spandsp/src/gsm0610_encode.c
@@ -45,6 +45,7 @@
#include
#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;
}
diff --git a/libs/spandsp/src/gsm0610_rpe.c b/libs/spandsp/src/gsm0610_rpe.c
index 68ddff3e1e..387ef1493b 100644
--- a/libs/spandsp/src/gsm0610_rpe.c
+++ b/libs/spandsp/src/gsm0610_rpe.c
@@ -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
diff --git a/libs/spandsp/src/hdlc.c b/libs/spandsp/src/hdlc.c
index 7733aa8280..7a20bf2451 100644
--- a/libs/spandsp/src/hdlc.c
+++ b/libs/spandsp/src/hdlc.c
@@ -33,8 +33,14 @@
#include
#include
#include
+#if defined(HAVE_STDBOOL_H)
+#include
+#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 --------------------------------------------------------*/
diff --git a/libs/spandsp/src/ima_adpcm.c b/libs/spandsp/src/ima_adpcm.c
index 6c4cc16370..fbd59df621 100644
--- a/libs/spandsp/src/ima_adpcm.c
+++ b/libs/spandsp/src/ima_adpcm.c
@@ -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 --------------------------------------------------------*/
diff --git a/libs/spandsp/src/image_translate.c b/libs/spandsp/src/image_translate.c
index b504ca9074..442d188be5 100644
--- a/libs/spandsp/src/image_translate.c
+++ b/libs/spandsp/src/image_translate.c
@@ -47,11 +47,17 @@
#if defined(HAVE_MATH_H)
#include
#endif
+#if defined(HAVE_STDBOOL_H)
+#include
+#else
+#include "spandsp/stdbool.h"
+#endif
#include "floating_fudge.h"
#include
#include
#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 --------------------------------------------------------*/
diff --git a/libs/spandsp/src/libspandsp.2010.vcxproj b/libs/spandsp/src/libspandsp.2010.vcxproj
index d3793f5b18..8bb87b58c6 100644
--- a/libs/spandsp/src/libspandsp.2010.vcxproj
+++ b/libs/spandsp/src/libspandsp.2010.vcxproj
@@ -157,6 +157,7 @@
+
@@ -427,6 +428,9 @@
{dee932ab-5911-4700-9eeb-8c7090a0a330}
false
+
+ {85f0cf8c-c7ab-48f6-ba19-cc94cf87f981}
+
{9d04a840-ce18-4ff5-a6d3-0a2bb92ff2e6}
diff --git a/libs/spandsp/src/libspandsp.2010.vcxproj.filters b/libs/spandsp/src/libspandsp.2010.vcxproj.filters
index 05763b180c..cc34e6c278 100644
--- a/libs/spandsp/src/libspandsp.2010.vcxproj.filters
+++ b/libs/spandsp/src/libspandsp.2010.vcxproj.filters
@@ -283,6 +283,9 @@
Source Files
+
+ Source Files
+
diff --git a/libs/spandsp/src/libspandsp.2012.vcxproj b/libs/spandsp/src/libspandsp.2012.vcxproj
index 1c5ce3c257..dd99dbc2d9 100644
--- a/libs/spandsp/src/libspandsp.2012.vcxproj
+++ b/libs/spandsp/src/libspandsp.2012.vcxproj
@@ -161,6 +161,7 @@
+
@@ -431,6 +432,9 @@
{dee932ab-5911-4700-9eeb-8c7090a0a330}
false
+
+ {85f0cf8c-c7ab-48f6-ba19-cc94cf87f981}
+
{2386b892-35f5-46cf-a0f0-10394d2fbf9b}
diff --git a/libs/spandsp/src/libspandsp.2012.vcxproj.filters b/libs/spandsp/src/libspandsp.2012.vcxproj.filters
index 05763b180c..cc34e6c278 100644
--- a/libs/spandsp/src/libspandsp.2012.vcxproj.filters
+++ b/libs/spandsp/src/libspandsp.2012.vcxproj.filters
@@ -283,6 +283,9 @@
Source Files
+
+ Source Files
+
diff --git a/libs/spandsp/src/logging.c b/libs/spandsp/src/logging.c
index 3f9aa58f17..09bc29b6c6 100644
--- a/libs/spandsp/src/logging.c
+++ b/libs/spandsp/src/logging.c
@@ -40,8 +40,14 @@
#include
#include
#include
+#if defined(HAVE_STDBOOL_H)
+#include
+#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 --------------------------------------------------------*/
diff --git a/libs/spandsp/src/lpc10_analyse.c b/libs/spandsp/src/lpc10_analyse.c
index e809d41ec8..082dbbb3ac 100644
--- a/libs/spandsp/src/lpc10_analyse.c
+++ b/libs/spandsp/src/lpc10_analyse.c
@@ -41,6 +41,11 @@
#if defined(HAVE_MATH_H)
#include
#endif
+#if defined(HAVE_STDBOOL_H)
+#include
+#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;
}
}
}
diff --git a/libs/spandsp/src/lpc10_decode.c b/libs/spandsp/src/lpc10_decode.c
index 19860e149d..2242133591 100644
--- a/libs/spandsp/src/lpc10_decode.c
+++ b/libs/spandsp/src/lpc10_decode.c
@@ -34,16 +34,22 @@
#include
#include
#include
+#include
#if defined(HAVE_TGMATH_H)
#include
#endif
#if defined(HAVE_MATH_H)
#include
#endif
+#if defined(HAVE_STDBOOL_H)
+#include
+#else
+#include "spandsp/stdbool.h"
+#endif
#include "floating_fudge.h"
-#include
#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 --------------------------------------------------------*/
diff --git a/libs/spandsp/src/lpc10_encode.c b/libs/spandsp/src/lpc10_encode.c
index 739734f866..27bf10c9b1 100644
--- a/libs/spandsp/src/lpc10_encode.c
+++ b/libs/spandsp/src/lpc10_encode.c
@@ -41,9 +41,15 @@
#if defined(HAVE_MATH_H)
#include
#endif
+#if defined(HAVE_STDBOOL_H)
+#include
+#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 --------------------------------------------------------*/
diff --git a/libs/spandsp/src/lpc10_placev.c b/libs/spandsp/src/lpc10_placev.c
index f728d6fa63..339e241563 100644
--- a/libs/spandsp/src/lpc10_placev.c
+++ b/libs/spandsp/src/lpc10_placev.c
@@ -41,6 +41,11 @@
#if defined(HAVE_MATH_H)
#include
#endif
+#if defined(HAVE_STDBOOL_H)
+#include
+#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;
}
}
diff --git a/libs/spandsp/src/lpc10_voicing.c b/libs/spandsp/src/lpc10_voicing.c
index 90891f9cca..fdb1b3f7c5 100644
--- a/libs/spandsp/src/lpc10_voicing.c
+++ b/libs/spandsp/src/lpc10_voicing.c
@@ -41,6 +41,11 @@
#if defined(HAVE_MATH_H)
#include
#endif
+#if defined(HAVE_STDBOOL_H)
+#include
+#else
+#include "spandsp/stdbool.h"
+#endif
#include "floating_fudge.h"
#include "spandsp/telephony.h"
diff --git a/libs/spandsp/src/make_modem_filter.c b/libs/spandsp/src/make_modem_filter.c
index 8ceac8aab9..b0faed4a02 100644
--- a/libs/spandsp/src/make_modem_filter.c
+++ b/libs/spandsp/src/make_modem_filter.c
@@ -31,17 +31,22 @@
#include
#include
#include
+#include
+#include
+#include
+#include
#if defined(HAVE_TGMATH_H)
#include
#endif
#if defined(HAVE_MATH_H)
#include
#endif
+#if defined(HAVE_STDBOOL_H)
+#include
+#else
+#include "spandsp/stdbool.h"
+#endif
#include "floating_fudge.h"
-#include
-#include
-#include
-#include
#if defined(__sunos) || defined(__solaris) || defined(__sun)
#include
#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();
diff --git a/libs/spandsp/src/modem_connect_tones.c b/libs/spandsp/src/modem_connect_tones.c
index 76b42a23fc..9c030ad0ed 100644
--- a/libs/spandsp/src/modem_connect_tones.c
+++ b/libs/spandsp/src/modem_connect_tones.c
@@ -53,10 +53,16 @@
#if defined(HAVE_MATH_H)
#include
#endif
+#if defined(HAVE_STDBOOL_H)
+#include
+#else
+#include "spandsp/stdbool.h"
+#endif
#include "floating_fudge.h"
#include
#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 --------------------------------------------------------*/
diff --git a/libs/spandsp/src/modem_echo.c b/libs/spandsp/src/modem_echo.c
index 14257c7eb7..622c201279 100644
--- a/libs/spandsp/src/modem_echo.c
+++ b/libs/spandsp/src/modem_echo.c
@@ -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;
diff --git a/libs/spandsp/src/msvc/make_cielab_luts.2010.vcxproj b/libs/spandsp/src/msvc/make_cielab_luts.2010.vcxproj
new file mode 100644
index 0000000000..de83ac7306
--- /dev/null
+++ b/libs/spandsp/src/msvc/make_cielab_luts.2010.vcxproj
@@ -0,0 +1,65 @@
+
+
+
+
+ All
+ Win32
+
+
+
+ make_cielab_luts
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}
+ make_cielab_luts
+ Win32Proj
+
+
+
+ Application
+ Unicode
+
+
+
+
+
+
+
+
+
+ <_ProjectFileVersion>10.0.30319.1
+ $(PlatformName)\$(Configuration)\
+ $(PlatformName)\make_cielab_luts\$(Configuration)\
+ false
+
+
+
+ $(IntDir)BuildLog $(ProjectName).htm
+
+
+ Disabled
+ .;.\spandsp;.\msvc;..\..\tiff-4.0.2\libtiff;.\generated;%(AdditionalIncludeDirectories)
+ WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions)
+ true
+ EnableFastChecks
+ MultiThreadedDebugDLL
+
+
+ $(IntDir)$(TargetName).pdb
+ Level3
+ ProgramDatabase
+
+
+ true
+ Console
+ MachineX86
+
+
+ "$(TargetPath)" >"$(ProjectDir)..\cielab_luts.h"
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/libs/spandsp/src/msvc/make_cielab_luts.2012.vcxproj b/libs/spandsp/src/msvc/make_cielab_luts.2012.vcxproj
new file mode 100644
index 0000000000..d7c54ca97f
--- /dev/null
+++ b/libs/spandsp/src/msvc/make_cielab_luts.2012.vcxproj
@@ -0,0 +1,66 @@
+
+
+
+
+ All
+ Win32
+
+
+
+ make_cielab_luts
+ {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}
+ make_cielab_luts
+ Win32Proj
+
+
+
+ Application
+ Unicode
+ v110
+
+
+
+
+
+
+
+
+
+ <_ProjectFileVersion>10.0.30319.1
+ $(PlatformName)\$(Configuration)\
+ $(PlatformName)\make_cielab_luts\$(Configuration)\
+ false
+
+
+
+ $(IntDir)BuildLog $(ProjectName).htm
+
+
+ Disabled
+ .;.\spandsp;.\msvc;..\..\tiff-4.0.2\libtiff;.\generated;%(AdditionalIncludeDirectories)
+ WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions)
+ true
+ EnableFastChecks
+ MultiThreadedDebugDLL
+
+
+ $(IntDir)$(TargetName).pdb
+ Level3
+ ProgramDatabase
+
+
+ true
+ Console
+ MachineX86
+
+
+ "$(TargetPath)" >"$(ProjectDir)..\cielab_luts.h"
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/libs/spandsp/src/msvc/make_math_fixed_tables.2010.vcxproj b/libs/spandsp/src/msvc/make_math_fixed_tables.2010.vcxproj
index a71f70e556..61465917f1 100644
--- a/libs/spandsp/src/msvc/make_math_fixed_tables.2010.vcxproj
+++ b/libs/spandsp/src/msvc/make_math_fixed_tables.2010.vcxproj
@@ -27,7 +27,7 @@
<_ProjectFileVersion>10.0.30319.1
$(PlatformName)\$(Configuration)\
- $(PlatformName)\make_at_dictionary\$(Configuration)\
+ $(PlatformName)\make_math_fixed_tables\$(Configuration)\
false
diff --git a/libs/spandsp/src/msvc/make_math_fixed_tables.2012.vcxproj b/libs/spandsp/src/msvc/make_math_fixed_tables.2012.vcxproj
index 610bb28625..ab6b648bcb 100644
--- a/libs/spandsp/src/msvc/make_math_fixed_tables.2012.vcxproj
+++ b/libs/spandsp/src/msvc/make_math_fixed_tables.2012.vcxproj
@@ -28,7 +28,7 @@
<_ProjectFileVersion>10.0.30319.1
$(PlatformName)\$(Configuration)\
- $(PlatformName)\make_at_dictionary\$(Configuration)\
+ $(PlatformName)\make_math_fixed_tables\$(Configuration)\
false
diff --git a/libs/spandsp/src/noise.c b/libs/spandsp/src/noise.c
index 5d7fe23aad..3ad164cf7f 100644
--- a/libs/spandsp/src/noise.c
+++ b/libs/spandsp/src/noise.c
@@ -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 --------------------------------------------------------*/
diff --git a/libs/spandsp/src/oki_adpcm.c b/libs/spandsp/src/oki_adpcm.c
index f6d54b804c..0e5e8f6659 100644
--- a/libs/spandsp/src/oki_adpcm.c
+++ b/libs/spandsp/src/oki_adpcm.c
@@ -39,6 +39,7 @@
#include
#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 --------------------------------------------------------*/
diff --git a/libs/spandsp/src/playout.c b/libs/spandsp/src/playout.c
index e98e48d70c..9ad0d8dcf2 100644
--- a/libs/spandsp/src/playout.c
+++ b/libs/spandsp/src/playout.c
@@ -39,10 +39,18 @@
#include
#include
#include
+#if defined(HAVE_STDBOOL_H)
+#include
+#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;
}
diff --git a/libs/spandsp/src/plc.c b/libs/spandsp/src/plc.c
index dcb07120e1..7b45dad988 100644
--- a/libs/spandsp/src/plc.c
+++ b/libs/spandsp/src/plc.c
@@ -43,10 +43,13 @@
#include
#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 --------------------------------------------------------*/
diff --git a/libs/spandsp/src/power_meter.c b/libs/spandsp/src/power_meter.c
index f4fb2afa8f..147fb47029 100644
--- a/libs/spandsp/src/power_meter.c
+++ b/libs/spandsp/src/power_meter.c
@@ -41,17 +41,25 @@
#if defined(HAVE_MATH_H)
#include
#endif
+#if defined(HAVE_STDBOOL_H)
+#include
+#else
+#include "spandsp/stdbool.h"
+#endif
#include "floating_fudge.h"
#include
#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 --------------------------------------------------------*/
diff --git a/libs/spandsp/src/queue.c b/libs/spandsp/src/queue.c
index 264cee0c87..d569039969 100644
--- a/libs/spandsp/src/queue.c
+++ b/libs/spandsp/src/queue.c
@@ -35,15 +35,24 @@
#include
#include
#include
+#if defined(HAVE_STDBOOL_H)
+#include
+#else
+#include "spandsp/stdbool.h"
+#endif
+#if defined(HAVE_STDATOMIC_H)
+#include
+#endif
#include
#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 --------------------------------------------------------*/
diff --git a/libs/spandsp/src/schedule.c b/libs/spandsp/src/schedule.c
index 60ba12bc1f..6e38e6bd94 100644
--- a/libs/spandsp/src/schedule.c
+++ b/libs/spandsp/src/schedule.c
@@ -31,8 +31,14 @@
#include
#include
#include
+#if defined(HAVE_STDBOOL_H)
+#include
+#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 --------------------------------------------------------*/
diff --git a/libs/spandsp/src/sig_tone.c b/libs/spandsp/src/sig_tone.c
index 5e4e180178..e40d39ac37 100644
--- a/libs/spandsp/src/sig_tone.c
+++ b/libs/spandsp/src/sig_tone.c
@@ -38,12 +38,18 @@
#if defined(HAVE_MATH_H)
#include
#endif
+#if defined(HAVE_STDBOOL_H)
+#include
+#else
+#include "spandsp/stdbool.h"
+#endif
#include "floating_fudge.h"
#include
#include
#include
#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(&[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 --------------------------------------------------------*/
diff --git a/libs/spandsp/src/silence_gen.c b/libs/spandsp/src/silence_gen.c
index ad7d7caed0..7c24f4334e 100644
--- a/libs/spandsp/src/silence_gen.c
+++ b/libs/spandsp/src/silence_gen.c
@@ -40,11 +40,17 @@
#if defined(HAVE_MATH_H)
#include
#endif
+#if defined(HAVE_STDBOOL_H)
+#include
+#else
+#include "spandsp/stdbool.h"
+#endif
#include "floating_fudge.h"
#include
#include
#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 --------------------------------------------------------*/
diff --git a/libs/spandsp/src/spandsp.h.in b/libs/spandsp/src/spandsp.h.in
index 2764aa4289..6ed699f3b4 100644
--- a/libs/spandsp/src/spandsp.h.in
+++ b/libs/spandsp/src/spandsp.h.in
@@ -45,9 +45,11 @@
#include
#include
@INSERT_MATH_HEADER@
+@INSERT_STDBOOL_HEADER@
#include
#include
+#include
#include
#include
#include
diff --git a/libs/spandsp/src/spandsp/alloc.h b/libs/spandsp/src/spandsp/alloc.h
new file mode 100644
index 0000000000..6ad81aa9be
--- /dev/null
+++ b/libs/spandsp/src/spandsp/alloc.h
@@ -0,0 +1,63 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * alloc.h - memory allocation handling.
+ *
+ * Written by Steve Underwood
+ *
+ * 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 ------------------------------------------------------------*/
diff --git a/libs/spandsp/src/spandsp/async.h b/libs/spandsp/src/spandsp/async.h
index 1b22cd5caf..eabb41d3f1 100644
--- a/libs/spandsp/src/spandsp/async.h
+++ b/libs/spandsp/src/spandsp/async.h
@@ -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);
diff --git a/libs/spandsp/src/spandsp/at_interpreter.h b/libs/spandsp/src/spandsp/at_interpreter.h
index 7f8ebbb16b..aa390d509b 100644
--- a/libs/spandsp/src/spandsp/at_interpreter.h
+++ b/libs/spandsp/src/spandsp/at_interpreter.h
@@ -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;
/*! ??? */
diff --git a/libs/spandsp/src/spandsp/bell_r2_mf.h b/libs/spandsp/src/spandsp/bell_r2_mf.h
index 98d9f749e8..2d40848a34 100644
--- a/libs/spandsp/src/spandsp/bell_r2_mf.h
+++ b/libs/spandsp/src/spandsp/bell_r2_mf.h
@@ -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);
diff --git a/libs/spandsp/src/spandsp/bitstream.h b/libs/spandsp/src/spandsp/bitstream.h
index b55e4afd16..edbaedb48f 100644
--- a/libs/spandsp/src/spandsp/bitstream.h
+++ b/libs/spandsp/src/spandsp/bitstream.h
@@ -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);
diff --git a/libs/spandsp/src/spandsp/crc.h b/libs/spandsp/src/spandsp/crc.h
index a4d9b8040a..9d02355621 100644
--- a/libs/spandsp/src/spandsp/crc.h
+++ b/libs/spandsp/src/spandsp/crc.h
@@ -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)
}
diff --git a/libs/spandsp/src/spandsp/dtmf.h b/libs/spandsp/src/spandsp/dtmf.h
index df9660feee..15915f75a6 100644
--- a/libs/spandsp/src/spandsp/dtmf.h
+++ b/libs/spandsp/src/spandsp/dtmf.h
@@ -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.
diff --git a/libs/spandsp/src/spandsp/expose.h b/libs/spandsp/src/spandsp/expose.h
index 5424b7c67e..a6ca48e5a5 100644
--- a/libs/spandsp/src/spandsp/expose.h
+++ b/libs/spandsp/src/spandsp/expose.h
@@ -40,6 +40,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -49,6 +50,8 @@
#include
#include
#include
+#include
+#include
#include
#include
#include
@@ -70,11 +73,10 @@
#include
#include
#include
-/*#include */
-/*#include */
#include
#include
#include
+//#include
#include
#include
#include
diff --git a/libs/spandsp/src/spandsp/fax.h b/libs/spandsp/src/spandsp/fax.h
index 9d268770bc..01dbb80d80 100644
--- a/libs/spandsp/src/spandsp/fax.h
+++ b/libs/spandsp/src/spandsp/fax.h
@@ -75,16 +75,16 @@ SPAN_DECLARE_NONSTD(int) fax_tx(fax_state_t *s, int16_t *amp, int max_len);
/*! Select whether silent audio will be sent when FAX transmit is idle.
\brief Select whether silent audio will be sent when FAX transmit is idle.
\param s The FAX context.
- \param transmit_on_idle TRUE if silent audio should be output when the FAX transmitter is
- idle. FALSE to transmit zero length audio when the FAX transmitter is idle. The default
- behaviour is FALSE.
+ \param transmit_on_idle True if silent audio should be output when the FAX transmitter is
+ idle. False to transmit zero length audio when the FAX transmitter is idle. The default
+ behaviour is false.
*/
SPAN_DECLARE(void) fax_set_transmit_on_idle(fax_state_t *s, int transmit_on_idle);
/*! Select whether talker echo protection tone will be sent for the image modems.
\brief Select whether TEP will be sent for the image modems.
\param s The FAX context.
- \param use_tep TRUE if TEP should be sent.
+ \param use_tep True if TEP should be sent.
*/
SPAN_DECLARE(void) fax_set_tep_mode(fax_state_t *s, int use_tep);
@@ -105,7 +105,7 @@ SPAN_DECLARE(logging_state_t *) fax_get_logging_state(fax_state_t *s);
/*! Restart a FAX context.
\brief Restart a FAX context.
\param s The FAX context.
- \param calling_party TRUE if the context is for a calling party. FALSE if the
+ \param calling_party True if the context is for a calling party. False if the
context is for an answering party.
\return 0 for OK, else -1. */
SPAN_DECLARE(int) fax_restart(fax_state_t *s, int calling_party);
@@ -113,7 +113,7 @@ SPAN_DECLARE(int) fax_restart(fax_state_t *s, int calling_party);
/*! Initialise a FAX context.
\brief Initialise a FAX context.
\param s The FAX context.
- \param calling_party TRUE if the context is for a calling party. FALSE if the
+ \param calling_party True if the context is for a calling party. False if the
context is for an answering party.
\return A pointer to the FAX context, or NULL if there was a problem.
*/
diff --git a/libs/spandsp/src/spandsp/fsk.h b/libs/spandsp/src/spandsp/fsk.h
index bcb8df1de7..b65cd7842f 100644
--- a/libs/spandsp/src/spandsp/fsk.h
+++ b/libs/spandsp/src/spandsp/fsk.h
@@ -109,9 +109,10 @@ enum
FSK_BELL103CH1,
FSK_BELL103CH2,
FSK_BELL202,
- FSK_WEITBRECHT, /* 45.45 baud version, used for TDD (Telecom Device for the Deaf) */
- FSK_WEITBRECHT50, /* 50 baud version, used for TDD (Telecom Device for the Deaf) */
- FSK_V21CH1_110 /* 110 bps version of V.21 channel 1, as used by V.18 */
+ FSK_WEITBRECHT_4545, /* 45.45 baud version, used for TDD (Telecom Device for the Deaf) */
+ FSK_WEITBRECHT_50, /* 50 baud version, used for TDD (Telecom Device for the Deaf) */
+ FSK_WEITBRECHT_476, /* 47.6 baud version, used for V.18 probing */
+ FSK_V21CH1_110 /* 110 bps version of V.21 channel 1, as used by V.18 */
};
enum
diff --git a/libs/spandsp/src/spandsp/hdlc.h b/libs/spandsp/src/spandsp/hdlc.h
index cf5efe4330..a0916d1d5f 100644
--- a/libs/spandsp/src/spandsp/hdlc.h
+++ b/libs/spandsp/src/spandsp/hdlc.h
@@ -83,8 +83,8 @@ extern "C"
/*! \brief Initialise an HDLC receiver context.
\param s A pointer to an HDLC receiver context.
- \param crc32 TRUE to use ITU CRC32. FALSE to use ITU CRC16.
- \param report_bad_frames TRUE to request the reporting of bad frames.
+ \param crc32 True to use ITU CRC32. False to use ITU CRC16.
+ \param report_bad_frames True to request the reporting of bad frames.
\param framing_ok_threshold The number of back-to-back flags needed to
start the framing OK condition. This may be used where a series of
flag octets is used as a preamble, such as in the T.30 protocol.
@@ -93,8 +93,8 @@ extern "C"
\return A pointer to the HDLC receiver context.
*/
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);
@@ -169,17 +169,17 @@ SPAN_DECLARE_NONSTD(void) hdlc_rx_put(hdlc_rx_state_t *s, const uint8_t buf[], i
/*! \brief Initialise an HDLC transmitter context.
\param s A pointer to an HDLC transmitter context.
- \param crc32 TRUE to use ITU CRC32. FALSE to use ITU CRC16.
+ \param crc32 True to use ITU CRC32. False to use ITU CRC16.
\param inter_frame_flags The minimum flag octets to insert between frames (usually one).
- \param progressive TRUE if frame creation works in progressive mode.
+ \param progressive True if frame creation works in progressive mode.
\param handler The callback function called when the HDLC transmitter underflows.
\param user_data An opaque parameter for the callback routine.
\return A pointer to the HDLC transmitter context.
*/
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);
diff --git a/libs/spandsp/src/spandsp/logging.h b/libs/spandsp/src/spandsp/logging.h
index 2de8eb8767..78db086ef0 100644
--- a/libs/spandsp/src/spandsp/logging.h
+++ b/libs/spandsp/src/spandsp/logging.h
@@ -80,9 +80,9 @@ extern "C"
\brief Test if logging of a specified severity level is enabled.
\param s The logging context.
\param level The severity level to be tested.
- \return TRUE if logging is enable, else FALSE.
+ \return True if logging is enable.
*/
-SPAN_DECLARE(int) span_log_test(logging_state_t *s, int level);
+SPAN_DECLARE(bool) span_log_test(logging_state_t *s, int level);
/*! Generate a log entry.
\brief Generate a log entry.
diff --git a/libs/spandsp/src/spandsp/modem_connect_tones.h b/libs/spandsp/src/spandsp/modem_connect_tones.h
index 7c2b980753..713f813bbb 100644
--- a/libs/spandsp/src/spandsp/modem_connect_tones.h
+++ b/libs/spandsp/src/spandsp/modem_connect_tones.h
@@ -153,7 +153,7 @@ SPAN_DECLARE_NONSTD(int) modem_connect_tones_rx_fillin(modem_connect_tones_rx_st
/*! \brief Test if a modem_connect tone has been detected.
\param s The context.
- \return TRUE if tone is detected, else FALSE.
+ \return The code for the detected tone.
*/
SPAN_DECLARE(int) modem_connect_tones_rx_get(modem_connect_tones_rx_state_t *s);
diff --git a/libs/spandsp/src/spandsp/playout.h b/libs/spandsp/src/spandsp/playout.h
index 582fcb2c51..8e038086df 100644
--- a/libs/spandsp/src/spandsp/playout.h
+++ b/libs/spandsp/src/spandsp/playout.h
@@ -56,80 +56,13 @@ enum
typedef int timestamp_t;
-typedef struct playout_frame_s
-{
- /*! The actual frame data */
- void *data;
- /*! The type of frame */
- int type;
- /*! The timestamp assigned by the sending end */
- timestamp_t sender_stamp;
- /*! The timespan covered by the data in this frame */
- timestamp_t sender_len;
- /*! The timestamp assigned by the receiving end */
- timestamp_t receiver_stamp;
- /*! Pointer to the next earlier frame */
- struct playout_frame_s *earlier;
- /*! Pointer to the next later frame */
- struct playout_frame_s *later;
-} playout_frame_t;
+typedef struct playout_frame_s playout_frame_t;
/*!
Playout (jitter buffer) descriptor. This defines the working state
for a single instance of playout buffering.
*/
-typedef struct
-{
- /*! TRUE if the buffer is dynamically sized */
- int dynamic;
- /*! The minimum length (dynamic) or fixed length (static) of the buffer */
- int min_length;
- /*! The maximum length (dynamic) or fixed length (static) of the buffer */
- int max_length;
- /*! The target filter threshold for adjusting dynamic buffering. */
- int dropable_threshold;
-
- int start;
-
- /*! The queued frame list */
- playout_frame_t *first_frame;
- playout_frame_t *last_frame;
- /*! The free frame pool */
- playout_frame_t *free_frames;
-
- /*! The total frames input to the buffer, to date. */
- int frames_in;
- /*! The total frames output from the buffer, to date. */
- int frames_out;
- /*! The number of frames received out of sequence. */
- int frames_oos;
- /*! The number of frames which were discarded, due to late arrival. */
- int frames_late;
- /*! The number of frames which were never received. */
- int frames_missing;
- /*! The number of frames trimmed from the stream, due to buffer shrinkage. */
- int frames_trimmed;
-
- timestamp_t latest_expected;
- /*! The present jitter adjustment */
- timestamp_t current;
- /*! The sender_stamp of the last speech frame */
- timestamp_t last_speech_sender_stamp;
- /*! The duration of the last speech frame */
- timestamp_t last_speech_sender_len;
-
- int not_first;
- /*! The time since the target buffer length was last changed. */
- timestamp_t since_last_step;
- /*! Filter state for tracking the packets arriving just in time */
- int32_t state_just_in_time;
- /*! Filter state for tracking the packets arriving late */
- int32_t state_late;
- /*! The current target length of the buffer */
- int target_buffer_length;
- /*! The current actual length of the buffer, which may lag behind the target value */
- int actual_buffer_length;
-} playout_state_t;
+typedef struct playout_state_s playout_state_t;
#if defined(__cplusplus)
extern "C"
diff --git a/libs/spandsp/src/spandsp/plc.h b/libs/spandsp/src/spandsp/plc.h
index 801c6ac65f..6d5c301073 100644
--- a/libs/spandsp/src/spandsp/plc.h
+++ b/libs/spandsp/src/spandsp/plc.h
@@ -109,21 +109,7 @@ That's it!
/*!
The generic packet loss concealer context.
*/
-typedef struct
-{
- /*! Consecutive erased samples */
- int missing_samples;
- /*! Current offset into pitch period */
- int pitch_offset;
- /*! Pitch estimate */
- int pitch;
- /*! Buffer for a cycle of speech */
- float pitchbuf[PLC_PITCH_MIN];
- /*! History buffer */
- int16_t history[PLC_HISTORY_LEN];
- /*! Current pointer into the history buffer */
- int buf_ptr;
-} plc_state_t;
+typedef struct plc_state_s plc_state_t;
#if defined(__cplusplus)
diff --git a/libs/spandsp/src/spandsp/power_meter.h b/libs/spandsp/src/spandsp/power_meter.h
index 5eff21fccd..e949858607 100644
--- a/libs/spandsp/src/spandsp/power_meter.h
+++ b/libs/spandsp/src/spandsp/power_meter.h
@@ -23,8 +23,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#if !defined(_POWER_METER_H_)
-#define _POWER_METER_H_
+#if !defined(_SPANDSP_POWER_METER_H_)
+#define _SPANDSP_POWER_METER_H_
/*! \page power_meter_page Power metering
@@ -45,24 +45,9 @@ values +/-8031, and this square wave represents 0dBov. This translates into 6.1
Power meter descriptor. This defines the working state for a
single instance of a power measurement device.
*/
-typedef struct
-{
- /*! The shift factor, which controls the damping of the power meter. */
- int shift;
+typedef struct power_meter_s power_meter_t;
- /*! The current power reading. */
- int32_t reading;
-} power_meter_t;
-
-typedef struct
-{
- power_meter_t short_term;
- power_meter_t medium_term;
- int signal_present;
- int32_t surge;
- int32_t sag;
- int32_t min;
-} power_surge_detector_state_t;
+typedef struct power_surge_detector_state_s power_surge_detector_state_t;
#if defined(__cplusplus)
extern "C"
diff --git a/libs/spandsp/src/spandsp/private/async.h b/libs/spandsp/src/spandsp/private/async.h
index 39bb1d4a44..1c9c926595 100644
--- a/libs/spandsp/src/spandsp/private/async.h
+++ b/libs/spandsp/src/spandsp/private/async.h
@@ -69,8 +69,8 @@ struct async_rx_state_s
int parity;
/*! \brief The number of stop bits per character. */
int stop_bits;
- /*! \brief TRUE if V.14 rate adaption processing should be performed. */
- int use_v14;
+ /*! \brief True if V.14 rate adaption processing should be performed. */
+ bool use_v14;
/*! \brief A pointer to the callback routine used to handle received characters. */
put_byte_func_t put_byte;
/*! \brief An opaque pointer passed when calling put_byte. */
diff --git a/libs/spandsp/src/spandsp/private/at_interpreter.h b/libs/spandsp/src/spandsp/private/at_interpreter.h
index a60a9aa46e..3ddade99c5 100644
--- a/libs/spandsp/src/spandsp/private/at_interpreter.h
+++ b/libs/spandsp/src/spandsp/private/at_interpreter.h
@@ -106,10 +106,10 @@ struct at_state_s
int command_dial;
int ok_is_pending;
int dte_is_waiting;
- /*! \brief TRUE if a carrier is presnt. Otherwise FALSE. */
- int rx_signal_present;
- /*! \brief TRUE if a modem has trained, Otherwise FALSE. */
- int rx_trained;
+ /*! \brief True if a carrier is presnt. Otherwise false. */
+ bool rx_signal_present;
+ /*! \brief True if a modem has trained, Otherwise false. */
+ bool rx_trained;
int transmit;
char line[256];
diff --git a/libs/spandsp/src/spandsp/private/bell_r2_mf.h b/libs/spandsp/src/spandsp/private/bell_r2_mf.h
index 234e4c9ba0..d0681be23f 100644
--- a/libs/spandsp/src/spandsp/private/bell_r2_mf.h
+++ b/libs/spandsp/src/spandsp/private/bell_r2_mf.h
@@ -73,8 +73,8 @@ struct r2_mf_tx_state_s
{
/*! The tone generator. */
tone_gen_state_t tone;
- /*! TRUE if generating forward tones, otherwise generating reverse tones. */
- int fwd;
+ /*! True if generating forward tones, otherwise generating reverse tones. */
+ bool fwd;
/*! The current digit being generated. */
int digit;
};
@@ -88,8 +88,8 @@ struct r2_mf_rx_state_s
tone_report_func_t callback;
/*! An opaque pointer passed to the callback function. */
void *callback_data;
- /*! TRUE is we are detecting forward tones. FALSE if we are detecting backward tones */
- int fwd;
+ /*! Tue is we are detecting forward tones. False if we are detecting backward tones */
+ bool fwd;
/*! Tone detector working states */
goertzel_state_t out[6];
/*! The current sample number within a processing block. */
diff --git a/libs/spandsp/src/spandsp/private/bitstream.h b/libs/spandsp/src/spandsp/private/bitstream.h
index aec8d5e124..e957eabd61 100644
--- a/libs/spandsp/src/spandsp/private/bitstream.h
+++ b/libs/spandsp/src/spandsp/private/bitstream.h
@@ -33,8 +33,8 @@ struct bitstream_state_s
uint32_t bitstream;
/*! The residual bits in bitstream. */
int residue;
- /*! TRUE if the stream is LSB first, else MSB first */
- int lsb_first;
+ /*! True if the stream is LSB first, else MSB first */
+ bool lsb_first;
};
diff --git a/libs/spandsp/src/spandsp/private/dtmf.h b/libs/spandsp/src/spandsp/private/dtmf.h
index c773ee61ee..37450fdba5 100644
--- a/libs/spandsp/src/spandsp/private/dtmf.h
+++ b/libs/spandsp/src/spandsp/private/dtmf.h
@@ -61,8 +61,8 @@ struct dtmf_rx_state_s
tone_report_func_t realtime_callback;
/*! An opaque pointer passed to the real time callback function. */
void *realtime_callback_data;
- /*! TRUE if dialtone should be filtered before processing */
- int filter_dialtone;
+ /*! True if dialtone should be filtered before processing */
+ bool filter_dialtone;
#if defined(SPANDSP_USE_FIXED_POINT)
/*! 350Hz filter state for the optional dialtone filter. */
float z350[2];
diff --git a/libs/spandsp/src/spandsp/private/fax_modems.h b/libs/spandsp/src/spandsp/private/fax_modems.h
index cb66c2f576..373a692994 100644
--- a/libs/spandsp/src/spandsp/private/fax_modems.h
+++ b/libs/spandsp/src/spandsp/private/fax_modems.h
@@ -33,14 +33,14 @@
*/
struct fax_modems_state_s
{
- /*! TRUE is talker echo protection should be sent for the image modems */
- int use_tep;
+ /*! True is talker echo protection should be sent for the image modems */
+ bool use_tep;
/*! \brief The callback function used to report detected tones. */
tone_report_func_t tone_callback;
/*! \brief A user specified opaque pointer passed to the tone_callback function. */
void *tone_callback_user_data;
- /*! If TRUE, transmit silence when there is nothing else to transmit. If FALSE return only
+ /*! If true, transmit silence when there is nothing else to transmit. If false return only
the actual generated audio. Note that this only affects untimed silences. Timed silences
(e.g. the 75ms silence between V.21 and a high speed modem) will alway be transmitted as
silent audio. */
@@ -110,12 +110,12 @@ struct fax_modems_state_s
hdlc_frame_handler_t hdlc_accept;
void *hdlc_accept_user_data;
- /*! \brief TRUE if a carrier is present. Otherwise FALSE. */
- int rx_signal_present;
- /*! \brief TRUE if a modem has trained correctly. */
- int rx_trained;
- /*! \brief TRUE if an HDLC frame has been received correctly. */
- int rx_frame_received;
+ /*! \brief True if a carrier is present. Otherwise false. */
+ bool rx_signal_present;
+ /*! \brief True if a modem has trained correctly. */
+ bool rx_trained;
+ /*! \brief True if an HDLC frame has been received correctly. */
+ bool rx_frame_received;
int deferred_rx_handler_updates;
/*! \brief The current receive signal handler */
@@ -145,8 +145,8 @@ struct fax_modems_state_s
/*! \brief The current bit rate of the receiver. */
int rx_bit_rate;
- /*! \brief If TRUE, transmission is in progress */
- int transmit;
+ /*! \brief If True, transmission is in progress */
+ bool transmit;
/*! \brief Audio logging file handle for received audio. */
int audio_rx_log;
/*! \brief Audio logging file handle for transmitted audio. */
diff --git a/libs/spandsp/src/spandsp/private/g722.h b/libs/spandsp/src/spandsp/private/g722.h
index 74ee517f3f..47b2abaa2f 100644
--- a/libs/spandsp/src/spandsp/private/g722.h
+++ b/libs/spandsp/src/spandsp/private/g722.h
@@ -21,15 +21,8 @@
* 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.
- *
- * Based on a single channel G.722 codec which is:
- *
- ***** Copyright (c) CMU 1993 *****
- * Computer Science, Speech Group
- * Chengxiang Lu and Alex Hauptmann
*/
-
/*! \file */
#if !defined(_SPANDSP_PRIVATE_G722_H_)
@@ -54,13 +47,13 @@ typedef struct
*/
struct g722_encode_state_s
{
- /*! TRUE if the operating in the special ITU test mode, with the band split filters
+ /*! True if the operating in the special ITU test mode, with the band split filters
disabled. */
- int itu_test_mode;
- /*! TRUE if the G.722 data is packed */
- int packed;
- /*! TRUE if encode from 8k samples/second */
- int eight_k;
+ bool itu_test_mode;
+ /*! True if the G.722 data is packed */
+ bool packed;
+ /*! True if encode from 8k samples/second */
+ bool eight_k;
/*! 6 for 48000kbps, 7 for 56000kbps, or 8 for 64000kbps. */
int bits_per_sample;
@@ -82,13 +75,13 @@ struct g722_encode_state_s
*/
struct g722_decode_state_s
{
- /*! TRUE if the operating in the special ITU test mode, with the band split filters
+ /*! True if the operating in the special ITU test mode, with the band split filters
disabled. */
- int itu_test_mode;
- /*! TRUE if the G.722 data is packed */
- int packed;
- /*! TRUE if decode to 8k samples/second */
- int eight_k;
+ bool itu_test_mode;
+ /*! True if the G.722 data is packed */
+ bool packed;
+ /*! True if decode to 8k samples/second */
+ bool eight_k;
/*! 6 for 48000kbps, 7 for 56000kbps, or 8 for 64000kbps. */
int bits_per_sample;
diff --git a/libs/spandsp/src/spandsp/private/hdlc.h b/libs/spandsp/src/spandsp/private/hdlc.h
index de87394daf..6390a52f08 100644
--- a/libs/spandsp/src/spandsp/private/hdlc.h
+++ b/libs/spandsp/src/spandsp/private/hdlc.h
@@ -43,24 +43,24 @@ struct hdlc_rx_state_s
modem_status_func_t status_handler;
/*! \brief An opaque parameter passed to the status callback routine. */
void *status_user_data;
- /*! \brief TRUE if bad frames are to be reported. */
- int report_bad_frames;
+ /*! \brief True if bad frames are to be reported. */
+ bool report_bad_frames;
/*! \brief The number of consecutive flags which must be seen before framing is
declared OK. */
int framing_ok_threshold;
- /*! \brief TRUE if framing OK has been announced. */
- int framing_ok_announced;
+ /*! \brief True if framing OK has been announced. */
+ bool framing_ok_announced;
/*! \brief Number of consecutive flags seen so far. */
int flags_seen;
/*! \brief The raw (stuffed) bit stream buffer. */
- unsigned int raw_bit_stream;
+ uint32_t raw_bit_stream;
/*! \brief The destuffed bit stream buffer. */
- unsigned int byte_in_progress;
+ uint32_t byte_in_progress;
/*! \brief The current number of bits in byte_in_progress. */
int num_bits;
- /*! \brief TRUE if in octet counting mode (e.g. for MTP). */
- int octet_counting_mode;
+ /*! \brief True if in octet counting mode (e.g. for MTP). */
+ bool octet_counting_mode;
/*! \brief Octet count, to achieve the functionality needed for things
like MTP. */
int octet_count;
@@ -98,8 +98,8 @@ struct hdlc_tx_state_s
void *user_data;
/*! \brief The minimum flag octets to insert between frames. */
int inter_frame_flags;
- /*! \brief TRUE if frame creation works in progressive mode. */
- int progressive;
+ /*! \brief True if frame creation works in progressive mode. */
+ bool progressive;
/*! \brief Maximum permitted frame length. */
size_t max_frame_len;
@@ -113,8 +113,8 @@ struct hdlc_tx_state_s
int flag_octets;
/*! \brief The number of abort octets to send for a timed burst of aborts. */
int abort_octets;
- /*! \brief TRUE if the next underflow of timed flag octets should be reported */
- int report_flag_underflow;
+ /*! \brief True if the next underflow of timed flag octets should be reported */
+ bool report_flag_underflow;
/*! \brief The current message being transmitted, with its CRC attached. */
uint8_t buffer[HDLC_MAXFRAME_LEN + 4];
@@ -130,8 +130,8 @@ struct hdlc_tx_state_s
/*! \brief The number of bits remaining in byte. */
int bits;
- /*! \brief TRUE if transmission should end on buffer underflow .*/
- int tx_end;
+ /*! \brief True if transmission should end on buffer underflow .*/
+ bool tx_end;
};
#endif
diff --git a/libs/spandsp/src/spandsp/private/lpc10.h b/libs/spandsp/src/spandsp/private/lpc10.h
index b61893637c..e02096e6d5 100644
--- a/libs/spandsp/src/spandsp/private/lpc10.h
+++ b/libs/spandsp/src/spandsp/private/lpc10.h
@@ -92,8 +92,8 @@ struct lpc10_encode_state_s
int32_t l2ptr2;
/*! \brief No initial value necessary */
int32_t lasti;
- /*! \brief Initial value FALSE */
- int hyst;
+ /*! \brief Initial value false */
+ bool hyst;
/* State used by function lpc10_voicing */
/*! \brief Initial value 20.0f */
@@ -148,8 +148,8 @@ struct lpc10_decode_state_s
/* State used by function decode */
/*! \brief Initial value 60 */
int32_t iptold;
- /*! \brief Initial value TRUE */
- int first;
+ /*! \brief Initial value true */
+ bool first;
/*! \brief ??? */
int32_t ivp2h;
/*! \brief ??? */
@@ -172,18 +172,18 @@ struct lpc10_decode_state_s
int32_t buflen;
/* State used by function pitsyn */
- /*! \brief No initial value necessary as long as first_pitsyn is initially TRUE */
+ /*! \brief No initial value necessary as long as first_pitsyn is initially true */
int32_t ivoico;
- /*! \brief No initial value necessary as long as first_pitsyn is initially TRUE */
+ /*! \brief No initial value necessary as long as first_pitsyn is initially true */
int32_t ipito;
/*! \brief Initial value 1.0f */
float rmso;
- /*! \brief No initial value necessary as long as first_pitsyn is initially TRUE */
+ /*! \brief No initial value necessary as long as first_pitsyn is initially true */
float rco[10];
- /*! \brief No initial value necessary as long as first_pitsyn is initially TRUE */
+ /*! \brief No initial value necessary as long as first_pitsyn is initially true */
int32_t jsamp;
- /*! \brief Initial value TRUE */
- int first_pitsyn;
+ /*! \brief Initial value true */
+ bool first_pitsyn;
/* State used by function bsynz */
/*! \brief ??? */
diff --git a/libs/spandsp/src/spandsp/private/modem_connect_tones.h b/libs/spandsp/src/spandsp/private/modem_connect_tones.h
index c1c33d25a4..d76faf1de3 100644
--- a/libs/spandsp/src/spandsp/private/modem_connect_tones.h
+++ b/libs/spandsp/src/spandsp/private/modem_connect_tones.h
@@ -77,7 +77,7 @@ struct modem_connect_tones_rx_state_s
int32_t am_level;
/*! \brief Sample counter for the small chunks of samples, after which a test is conducted. */
int chunk_remainder;
- /*! \brief TRUE is the tone is currently confirmed present in the audio. */
+ /*! \brief The code for the tone currently confirmed present in the audio. */
int tone_present;
/*! \brief */
int tone_on;
@@ -85,7 +85,7 @@ struct modem_connect_tones_rx_state_s
int tone_cycle_duration;
/*! \brief A count of the number of good cycles of tone reversal seen. */
int good_cycles;
- /*! \brief TRUE if the tone has been seen since the last time the user tested for it */
+ /*! \brief The confirmed tone code. */
int hit;
/*! \brief A V.21 FSK modem context used when searching for FAX preamble. */
fsk_rx_state_t v21rx;
@@ -95,8 +95,8 @@ struct modem_connect_tones_rx_state_s
int num_bits;
/*! \brief Number of consecutive flags seen so far. */
int flags_seen;
- /*! \brief TRUE if framing OK has been announced. */
- int framing_ok_announced;
+ /*! \brief True if framing OK has been announced. */
+ bool framing_ok_announced;
};
#endif
diff --git a/libs/spandsp/src/spandsp/private/playout.h b/libs/spandsp/src/spandsp/private/playout.h
new file mode 100644
index 0000000000..dd8c9a53e9
--- /dev/null
+++ b/libs/spandsp/src/spandsp/private/playout.h
@@ -0,0 +1,105 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/playout.h
+ *
+ * Written by Steve Underwood
+ *
+ * Copyright (C) 2005 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.
+ */
+
+#if !defined(_SPANDSP_PRIVATE_PLAYOUT_H_)
+#define _SPANDSP_PRIVATE_PLAYOUT_H_
+
+struct playout_frame_s
+{
+ /*! The actual frame data */
+ void *data;
+ /*! The type of frame */
+ int type;
+ /*! The timestamp assigned by the sending end */
+ timestamp_t sender_stamp;
+ /*! The timespan covered by the data in this frame */
+ timestamp_t sender_len;
+ /*! The timestamp assigned by the receiving end */
+ timestamp_t receiver_stamp;
+ /*! Pointer to the next earlier frame */
+ struct playout_frame_s *earlier;
+ /*! Pointer to the next later frame */
+ struct playout_frame_s *later;
+};
+
+/*!
+ Playout (jitter buffer) descriptor. This defines the working state
+ for a single instance of playout buffering.
+*/
+struct playout_state_s
+{
+ /*! True if the buffer is dynamically sized */
+ bool dynamic;
+ /*! The minimum length (dynamic) or fixed length (static) of the buffer */
+ int min_length;
+ /*! The maximum length (dynamic) or fixed length (static) of the buffer */
+ int max_length;
+ /*! The target filter threshold for adjusting dynamic buffering. */
+ int dropable_threshold;
+
+ int start;
+
+ /*! The queued frame list */
+ playout_frame_t *first_frame;
+ playout_frame_t *last_frame;
+ /*! The free frame pool */
+ playout_frame_t *free_frames;
+
+ /*! The total frames input to the buffer, to date. */
+ int frames_in;
+ /*! The total frames output from the buffer, to date. */
+ int frames_out;
+ /*! The number of frames received out of sequence. */
+ int frames_oos;
+ /*! The number of frames which were discarded, due to late arrival. */
+ int frames_late;
+ /*! The number of frames which were never received. */
+ int frames_missing;
+ /*! The number of frames trimmed from the stream, due to buffer shrinkage. */
+ int frames_trimmed;
+
+ timestamp_t latest_expected;
+ /*! The present jitter adjustment */
+ timestamp_t current;
+ /*! The sender_stamp of the last speech frame */
+ timestamp_t last_speech_sender_stamp;
+ /*! The duration of the last speech frame */
+ timestamp_t last_speech_sender_len;
+
+ int not_first;
+ /*! The time since the target buffer length was last changed. */
+ timestamp_t since_last_step;
+ /*! Filter state for tracking the packets arriving just in time */
+ int32_t state_just_in_time;
+ /*! Filter state for tracking the packets arriving late */
+ int32_t state_late;
+ /*! The current target length of the buffer */
+ int target_buffer_length;
+ /*! The current actual length of the buffer, which may lag behind the target value */
+ int actual_buffer_length;
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/
diff --git a/libs/spandsp/src/spandsp/private/plc.h b/libs/spandsp/src/spandsp/private/plc.h
new file mode 100644
index 0000000000..79975b02f1
--- /dev/null
+++ b/libs/spandsp/src/spandsp/private/plc.h
@@ -0,0 +1,64 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/plc.h
+ *
+ * Written by Steve Underwood
+ *
+ * Copyright (C) 2004 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_PRIVATE_PLC_H_)
+#define _SPANDSP_PRIVATE_PLC_H_
+
+/*! Minimum allowed pitch (66 Hz) */
+#define PLC_PITCH_MIN 120
+/*! Maximum allowed pitch (200 Hz) */
+#define PLC_PITCH_MAX 40
+/*! Maximum pitch OLA window */
+#define PLC_PITCH_OVERLAP_MAX (PLC_PITCH_MIN >> 2)
+/*! The length over which the AMDF function looks for similarity (20 ms) */
+#define CORRELATION_SPAN 160
+/*! History buffer length. The buffer much also be at leat 1.25 times
+ PLC_PITCH_MIN, but that is much smaller than the buffer needs to be for
+ the pitch assessment. */
+#define PLC_HISTORY_LEN (CORRELATION_SPAN + PLC_PITCH_MIN)
+
+/*!
+ The generic packet loss concealer context.
+*/
+struct plc_state_s
+{
+ /*! Consecutive erased samples */
+ int missing_samples;
+ /*! Current offset into pitch period */
+ int pitch_offset;
+ /*! Pitch estimate */
+ int pitch;
+ /*! Buffer for a cycle of speech */
+ float pitchbuf[PLC_PITCH_MIN];
+ /*! History buffer */
+ int16_t history[PLC_HISTORY_LEN];
+ /*! Current pointer into the history buffer */
+ int buf_ptr;
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/
diff --git a/libs/spandsp/src/spandsp/private/power_meter.h b/libs/spandsp/src/spandsp/private/power_meter.h
new file mode 100644
index 0000000000..64b8ec3f45
--- /dev/null
+++ b/libs/spandsp/src/spandsp/private/power_meter.h
@@ -0,0 +1,53 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/power_meter.h
+ *
+ * Written by Steve Underwood
+ *
+ * Copyright (C) 2003 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.
+ */
+
+#if !defined(_SPANDSP_PRIVATE_POWER_METER_H_)
+#define _SPANDSP_PRIVATE_POWER_METER_H_
+
+/*!
+ Power meter descriptor. This defines the working state for a
+ single instance of a power measurement device.
+*/
+struct power_meter_s
+{
+ /*! The shift factor, which controls the damping of the power meter. */
+ int shift;
+
+ /*! The current power reading. */
+ int32_t reading;
+};
+
+struct power_surge_detector_state_s
+{
+ power_meter_t short_term;
+ power_meter_t medium_term;
+ int signal_present;
+ int32_t surge;
+ int32_t sag;
+ int32_t min;
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/
diff --git a/libs/spandsp/src/spandsp/private/sig_tone.h b/libs/spandsp/src/spandsp/private/sig_tone.h
index e7c6217051..3ec02d9bf9 100644
--- a/libs/spandsp/src/spandsp/private/sig_tone.h
+++ b/libs/spandsp/src/spandsp/private/sig_tone.h
@@ -210,10 +210,10 @@ struct sig_tone_rx_state_s
/*! \brief The minimum ratio between notched power and total power for detection */
int32_t detection_ratio;
- /*! \brief TRUE if in flat mode. FALSE if in sharp mode. */
- int flat_mode;
- /*! \brief TRUE if the notch filter is enabled in the media path */
- int notch_enabled;
+ /*! \brief True if in flat mode. False if in sharp mode. */
+ bool flat_mode;
+ /*! \brief True if the notch filter is enabled in the media path */
+ bool notch_enabled;
/*! \brief ??? */
int flat_mode_timeout;
/*! \brief ??? */
diff --git a/libs/spandsp/src/spandsp/private/t30.h b/libs/spandsp/src/spandsp/private/t30.h
index 786fd4f0d2..06b35b67a2 100644
--- a/libs/spandsp/src/spandsp/private/t30.h
+++ b/libs/spandsp/src/spandsp/private/t30.h
@@ -43,8 +43,8 @@ struct t30_state_s
/*! \brief The type of FAX operation currently in progress */
int operation_in_progress;
- /*! \brief TRUE if behaving as the calling party */
- int calling_party;
+ /*! \brief True if behaving as the calling party */
+ bool calling_party;
/*! \brief Internet aware FAX mode bit mask. */
int iaf;
@@ -64,10 +64,10 @@ struct t30_state_s
int supported_image_sizes;
/*! \brief A bit mask of the currently supported T.30 special features. */
int supported_t30_features;
- /*! \brief TRUE is ECM mode handling is enabled. */
- int ecm_allowed;
- /*! \brief TRUE if we are capable of retransmitting pages */
- int retransmit_capable;
+ /*! \brief True is ECM mode handling is enabled. */
+ bool ecm_allowed;
+ /*! \brief True if we are capable of retransmitting pages */
+ bool retransmit_capable;
/*! \brief The received DCS, formatted as an ASCII string, for inclusion
in the TIFF file. */
@@ -75,17 +75,17 @@ struct t30_state_s
/*! \brief The text which will be used in FAX page header. No text results
in no header line. */
char header_info[T30_MAX_PAGE_HEADER_INFO + 1];
- /*! \brief TRUE for FAX page headers to overlay (i.e. replace) the beginning of the
- page image. FALSE for FAX page headers to add to the overall length of
+ /*! \brief True for FAX page headers to overlay (i.e. replace) the beginning of the
+ page image. False for FAX page headers to add to the overall length of
the page. */
- int header_overlays_image;
- /*! \brief Use private timezone if TRUE */
- int use_own_tz;
+ bool header_overlays_image;
+ /*! \brief Use private timezone if true */
+ bool use_own_tz;
/*! \brief Optional per instance time zone for the FAX page header timestamp. */
tz_t tz;
- /*! \brief TRUE if remote T.30 procedural interrupts are allowed. */
- int remote_interrupts_allowed;
+ /*! \brief True if remote T.30 procedural interrupts are allowed. */
+ bool remote_interrupts_allowed;
/*! \brief The information fields received. */
t30_exchanged_info_t rx_info;
@@ -163,11 +163,11 @@ struct t30_state_s
int local_dis_dtc_len;
/*! \brief The last DIS or DTC message received form the far end. */
uint8_t far_dis_dtc_frame[T30_MAX_DIS_DTC_DCS_LEN];
- /*! \brief TRUE if a valid DIS has been received from the far end. */
- int dis_received;
+ /*! \brief True if a valid DIS has been received from the far end. */
+ bool dis_received;
- /*! \brief TRUE if the short training sequence should be used. */
- int short_train;
+ /*! \brief True if the short training sequence should be used. */
+ bool short_train;
/*! \brief A count of the number of bits in the trainability test. This counts down to zero when
sending TCF, and counts up when receiving it. */
@@ -181,12 +181,12 @@ struct t30_state_s
int current_fallback;
/*! \brief The subset of supported modems allowed at the current time, allowing for negotiation. */
int current_permitted_modems;
- /*! \brief TRUE if a carrier is present. Otherwise FALSE. */
- int rx_signal_present;
- /*! \brief TRUE if a modem has trained correctly. */
- int rx_trained;
- /*! \brief TRUE if a valid HDLC frame has been received in the current reception period. */
- int rx_frame_received;
+ /*! \brief True if a carrier is present. Otherwise false. */
+ bool rx_signal_present;
+ /*! \brief True if a modem has trained correctly. */
+ bool rx_trained;
+ /*! \brief True if a valid HDLC frame has been received in the current reception period. */
+ bool rx_frame_received;
/*! \brief Current reception mode. */
int current_rx_type;
@@ -214,14 +214,14 @@ struct t30_state_s
/*! \brief This is only used in full duplex (e.g. ISDN) modes. */
int timer_t8;
- /*! \brief TRUE once the far end FAX entity has been detected. */
- int far_end_detected;
+ /*! \brief True once the far end FAX entity has been detected. */
+ bool far_end_detected;
- /*! \brief TRUE once the end of procedure condition has been detected. */
- int end_of_procedure_detected;
+ /*! \brief True once the end of procedure condition has been detected. */
+ bool end_of_procedure_detected;
- /*! \brief TRUE if a local T.30 interrupt is pending. */
- int local_interrupt_pending;
+ /*! \brief True if a local T.30 interrupt is pending. */
+ bool local_interrupt_pending;
/*! \brief The common ground in compression schemes between the local and far ends. */
int mutual_compressions;
/*! \brief The common group of supported bi-level image resolutions. */
@@ -248,8 +248,8 @@ struct t30_state_s
t4_image_width_t image_width;
/*! \brief Current number of retries of the action in progress. */
int retries;
- /*! \brief TRUE if error correcting mode is used. */
- int error_correcting_mode;
+ /*! \brief True if error correcting mode is used. */
+ bool error_correcting_mode;
/*! \brief The number of HDLC frame retries, if error correcting mode is used. */
int error_correcting_mode_retries;
/*! \brief The current count of consecutive T30_PPR messages. */
@@ -277,9 +277,9 @@ struct t30_state_s
int ecm_frames_this_tx_burst;
/*! \brief The current ECM frame, during ECM transmission. */
int ecm_current_tx_frame;
- /*! \brief TRUE if we are at the end of an ECM page to se sent - i.e. there are no more
+ /*! \brief True if we are at the end of an ECM page to se sent - i.e. there are no more
partial pages still to come. */
- int ecm_at_page_end;
+ bool ecm_at_page_end;
/*! \brief The transmission step queued to follow the one in progress. */
int next_tx_step;
@@ -305,8 +305,8 @@ struct t30_state_s
/*! \brief the FCF2 field of the last PPS message we received. */
uint8_t last_pps_fcf2;
- /*! \brief TRUE if all frames of the current received ECM block are now OK */
- int rx_ecm_block_ok;
+ /*! \brief True if all frames of the current received ECM block are now OK */
+ bool rx_ecm_block_ok;
/*! \brief A count of successfully received ECM frames, to assess progress as a basis for
deciding whether to continue error correction when PPRs keep repeating. */
int ecm_progress;
diff --git a/libs/spandsp/src/spandsp/private/t31.h b/libs/spandsp/src/spandsp/private/t31.h
index 2686b5f503..1f7de41f99 100644
--- a/libs/spandsp/src/spandsp/private/t31.h
+++ b/libs/spandsp/src/spandsp/private/t31.h
@@ -108,8 +108,8 @@ typedef struct
/*! \brief The current transmit step being timed */
int timed_step;
- /*! \brief TRUE is there has been some T.38 data missed */
- int rx_data_missing;
+ /*! \brief True is there has been some T.38 data missed */
+ bool rx_data_missing;
/*! \brief The number of octets to send in each image packet (non-ECM or ECM) at the current
rate and the current specified packet interval. */
@@ -138,9 +138,9 @@ typedef struct
t31_hdlc_state_t hdlc_from_t31;
- /*! \brief TRUE if we are using ECM mode. This is used to select HDLC faking, necessary
+ /*! \brief True if we are using ECM mode. This is used to select HDLC faking, necessary
with clunky class 1 modems. */
- int ecm_mode;
+ bool ecm_mode;
/*! \brief Counter for trailing non-ECM bytes, used to flush out the far end's modem. */
int non_ecm_trailer_bytes;
@@ -179,8 +179,8 @@ struct t31_state_s
t31_audio_front_end_state_t audio;
t31_t38_front_end_state_t t38_fe;
- /*! TRUE if working in T.38 mode. */
- int t38_mode;
+ /*! True if working in T.38 mode. */
+ bool t38_mode;
/*! HDLC buffer, for composing an HDLC frame from the computer to the channel. */
struct
@@ -189,8 +189,8 @@ struct t31_state_s
uint8_t buf[T31_MAX_HDLC_LEN];
int len;
int ptr;
- /*! \brief TRUE when the end of HDLC data from the computer has been detected. */
- int final;
+ /*! \brief True when the end of HDLC data from the computer has been detected. */
+ bool final;
} hdlc_tx;
/*! Buffer for data from the computer to the channel. */
struct
@@ -201,24 +201,24 @@ struct t31_state_s
int in_bytes;
/*! \brief The number of bytes sent from the transmit buffer. */
int out_bytes;
- /*! \brief TRUE if the flow of real data has started. */
- int data_started;
- /*! \brief TRUE if holding up further data into the buffer, for flow control. */
- int holding;
- /*! \brief TRUE when the end of non-ECM data from the computer has been detected. */
- int final;
+ /*! \brief True if the flow of real data has started. */
+ bool data_started;
+ /*! \brief True if holding up further data into the buffer, for flow control. */
+ bool holding;
+ /*! \brief True when the end of non-ECM data from the computer has been detected. */
+ bool final;
} non_ecm_tx;
- /*! TRUE if DLE prefix just used */
- int dled;
+ /*! True if DLE prefix just used */
+ bool dled;
/*! \brief Samples of silence awaited, as specified in a "wait for silence" command */
int silence_awaited;
/*! \brief The current bit rate for the FAX fast message transfer modem. */
int bit_rate;
- /*! \brief TRUE if a valid HDLC frame has been received in the current reception period. */
- int rx_frame_received;
+ /*! \brief True if a valid HDLC frame has been received in the current reception period. */
+ bool rx_frame_received;
/*! \brief Samples elapsed in the current call */
int64_t call_samples;
@@ -226,8 +226,8 @@ struct t31_state_s
/*! \brief The currently queued modem type. */
int modem;
- /*! \brief TRUE when short training mode has been selected by the computer. */
- int short_train;
+ /*! \brief True when short training mode has been selected by the computer. */
+ bool short_train;
queue_state_t *rx_queue;
/*! \brief Error and flow logging control */
diff --git a/libs/spandsp/src/spandsp/private/t38_core.h b/libs/spandsp/src/spandsp/private/t38_core.h
index 40123128af..6d29957067 100644
--- a/libs/spandsp/src/spandsp/private/t38_core.h
+++ b/libs/spandsp/src/spandsp/private/t38_core.h
@@ -98,9 +98,9 @@ struct t38_core_state_s
/*! \brief Pace transmission */
int pace_transmission;
- /*! \brief TRUE if IFP packet sequence numbers are relevant. For some transports, like TPKT
+ /*! \brief True if IFP packet sequence numbers are relevant. For some transports, like TPKT
over TCP they are not relevent. */
- int check_sequence_numbers;
+ bool check_sequence_numbers;
/*! \brief The number of times each packet type will be sent (low byte). The
depth of redundancy (2nd byte). Higher numbers may increase reliability
diff --git a/libs/spandsp/src/spandsp/private/t38_gateway.h b/libs/spandsp/src/spandsp/private/t38_gateway.h
index 075a9b221c..23c6dd59bf 100644
--- a/libs/spandsp/src/spandsp/private/t38_gateway.h
+++ b/libs/spandsp/src/spandsp/private/t38_gateway.h
@@ -43,12 +43,12 @@ typedef struct
/*! \brief Core T.38 IFP support */
t38_core_state_t t38;
- /*! \brief TRUE if the NSF, NSC, and NSS are to be suppressed by altering
- their contents to something the far end will not recognise. */
+ /*! \brief If NSF, NSC, and NSS are to be suppressed by altering their contents to
+ something the far end will not recognise, this is the amount to overwrite. */
int suppress_nsx_len[2];
- /*! \brief TRUE if we need to corrupt the HDLC frame in progress, so the receiver cannot
+ /*! \brief True if we need to corrupt the HDLC frame in progress, so the receiver cannot
interpret it. The two values are for the two directions. */
- int corrupt_current_frame[2];
+ bool corrupt_current_frame[2];
/*! \brief the current class of field being received - i.e. none, non-ECM or HDLC */
int current_rx_field_class;
@@ -87,8 +87,8 @@ typedef struct
int bit_no;
/*! \brief Progressively calculated CRC for HDLC messages received from a modem. */
uint16_t crc;
- /*! \brief TRUE if non-ECM fill bits are to be stripped when sending image data. */
- int fill_bit_removal;
+ /*! \brief True if non-ECM fill bits are to be stripped when sending image data. */
+ bool fill_bit_removal;
/*! \brief The number of octets to send in each image packet (non-ECM or ECM) at
the current rate and the current specified packet interval. */
int octets_per_data_packet;
@@ -134,27 +134,27 @@ typedef struct
{
/*! \brief A bit mask of the currently supported modem types. */
int supported_modems;
- /*! \brief TRUE if ECM FAX mode is allowed through the gateway. */
- int ecm_allowed;
+ /*! \brief True if ECM FAX mode is allowed through the gateway. */
+ bool ecm_allowed;
/*! \brief Required time between T.38 transmissions, in ms. */
int ms_per_tx_chunk;
- /*! \brief TRUE if in image data modem is to use short training. This usually
+ /*! \brief True if in image data modem is to use short training. This usually
follows image_data_mode, but in ECM mode T.30 defines recovery
conditions in which long training is used for image data. */
- int short_train;
- /*! \brief TRUE if in image data mode, as opposed to TCF mode. */
- int image_data_mode;
+ bool short_train;
+ /*! \brief True if in image data mode, as opposed to TCF mode. */
+ bool image_data_mode;
/*! \brief The minimum permitted bits per FAX scan line row. */
int min_row_bits;
- /*! \brief TRUE if we should count the next MCF as a page end, else FALSE */
- int count_page_on_mcf;
+ /*! \brief True if we should count the next MCF as a page end, else false */
+ bool count_page_on_mcf;
/*! \brief The number of pages for which a confirm (MCF) message was returned. */
int pages_confirmed;
- /*! \brief TRUE if we are in error correcting (ECM) mode */
- int ecm_mode;
+ /*! \brief True if we are in error correcting (ECM) mode */
+ bool ecm_mode;
/*! \brief The current bit rate for the fast modem. */
int fast_bit_rate;
/*! \brief The current fast receive modem type. */
diff --git a/libs/spandsp/src/spandsp/private/t38_non_ecm_buffer.h b/libs/spandsp/src/spandsp/private/t38_non_ecm_buffer.h
index 78604420a9..9220f78af1 100644
--- a/libs/spandsp/src/spandsp/private/t38_non_ecm_buffer.h
+++ b/libs/spandsp/src/spandsp/private/t38_non_ecm_buffer.h
@@ -55,14 +55,14 @@ struct t38_non_ecm_buffer_state_s
uint8_t flow_control_fill_octet;
/*! \brief A code for the phase of input buffering, from initial all ones to completion. */
int input_phase;
- /*! \brief TRUE is the end of non-ECM data indication has been received. */
- int data_finished;
+ /*! \brief True is the end of non-ECM data indication has been received. */
+ bool data_finished;
/*! \brief The current octet being transmitted from the buffer. */
unsigned int octet;
/*! \brief The current bit number in the current non-ECM octet. */
int bit_no;
- /*! \brief TRUE if in image data mode, as opposed to TCF mode. */
- int image_data_mode;
+ /*! \brief True if in image data mode, as opposed to TCF mode. */
+ bool image_data_mode;
/*! \brief The number of octets input to the buffer. */
int in_octets;
diff --git a/libs/spandsp/src/spandsp/private/t38_terminal.h b/libs/spandsp/src/spandsp/private/t38_terminal.h
index 0bd75a6cfb..219b1e3cf7 100644
--- a/libs/spandsp/src/spandsp/private/t38_terminal.h
+++ b/libs/spandsp/src/spandsp/private/t38_terminal.h
@@ -46,9 +46,9 @@ typedef struct
/*! \brief The timed step to go to when we reach idle from the current timed step */
int queued_timed_step;
- /*! \brief TRUE is there has been some T.38 data missed (i.e. lost packets) in the current
+ /*! \brief True is there has been some T.38 data missed (i.e. lost packets) in the current
reception period. */
- int rx_data_missing;
+ bool rx_data_missing;
/*! \brief The number of octets to send in each image packet (non-ECM or ECM) at the current
rate and the current specified packet interval. */
@@ -84,8 +84,8 @@ typedef struct
/*! \brief The current T.38 data type being transmitted. */
int current_tx_data_type;
- /*! \brief TRUE if a carrier is present. Otherwise FALSE. */
- int rx_signal_present;
+ /*! \brief True if a carrier is present. Otherwise false. */
+ bool rx_signal_present;
/*! \brief The current operating mode of the receiver. */
int current_rx_type;
diff --git a/libs/spandsp/src/spandsp/private/t4_rx.h b/libs/spandsp/src/spandsp/private/t4_rx.h
index e896869e7a..99a3e5ef55 100644
--- a/libs/spandsp/src/spandsp/private/t4_rx.h
+++ b/libs/spandsp/src/spandsp/private/t4_rx.h
@@ -26,6 +26,8 @@
#if !defined(_SPANDSP_PRIVATE_T4_RX_H_)
#define _SPANDSP_PRIVATE_T4_RX_H_
+typedef int (*t4_image_put_handler_t)(void *user_data, const uint8_t buf[], size_t len);
+
/*!
TIFF specific state information to go with T.4 compression or decompression handling.
*/
@@ -125,6 +127,9 @@ struct t4_rx_state_s
t45_decode_state_t t45;
#endif
} decoder;
+
+ t4_image_put_handler_t image_put_handler;
+
int current_decoder;
uint8_t *pre_encoded_buf;
diff --git a/libs/spandsp/src/spandsp/private/t4_t6_decode.h b/libs/spandsp/src/spandsp/private/t4_t6_decode.h
index 90b4e72d66..616e1be879 100644
--- a/libs/spandsp/src/spandsp/private/t4_t6_decode.h
+++ b/libs/spandsp/src/spandsp/private/t4_t6_decode.h
@@ -81,8 +81,8 @@ struct t4_t6_decode_state_s
int run_length;
/*! \brief 2D horizontal mode control. */
int black_white;
- /*! \brief TRUE if the current run is black */
- int in_black;
+ /*! \brief True if the current run is black */
+ bool in_black;
/*! \brief The current step into the current row run-lengths buffer. */
int a_cursor;
diff --git a/libs/spandsp/src/spandsp/private/t4_t6_encode.h b/libs/spandsp/src/spandsp/private/t4_t6_encode.h
index ea080109aa..4ac35f76a9 100644
--- a/libs/spandsp/src/spandsp/private/t4_t6_encode.h
+++ b/libs/spandsp/src/spandsp/private/t4_t6_encode.h
@@ -59,7 +59,7 @@ struct t4_t6_encode_state_s
/*! \brief This variable is set if we are treating the current row as a 2D encoded
one. */
- int row_is_2d;
+ bool row_is_2d;
/*! \brief Encoded data bits buffer. */
uint32_t tx_bitstream;
diff --git a/libs/spandsp/src/spandsp/private/t4_tx.h b/libs/spandsp/src/spandsp/private/t4_tx.h
index e691758fc5..5ff0d2ea27 100644
--- a/libs/spandsp/src/spandsp/private/t4_tx.h
+++ b/libs/spandsp/src/spandsp/private/t4_tx.h
@@ -26,6 +26,8 @@
#if !defined(_SPANDSP_PRIVATE_T4_TX_H_)
#define _SPANDSP_PRIVATE_T4_TX_H_
+typedef int (*t4_image_get_handler_t)(void *user_data, uint8_t buf[], size_t len);
+
/*!
TIFF specific state information to go with T.4 compression or decompression handling.
*/
@@ -45,6 +47,17 @@ typedef struct
/*! \brief The TIFF fill order setting for the current page. */
uint16_t fill_order;
+ /*! \brief Width of the image in the file. */
+ uint32_t image_width;
+ /*! \brief Length of the image in the file. */
+ uint32_t image_length;
+ /*! \brief Column-to-column (X) resolution in pixels per metre of the image in the file. */
+ int x_resolution;
+ /*! \brief Row-to-row (Y) resolution in pixels per metre of the image in the file. */
+ int y_resolution;
+ /*! \brief Code for the combined X and Y resolution of the image in the file. */
+ int resolution_code;
+
/*! \brief The number of pages in the current image file. */
int pages_in_file;
@@ -56,18 +69,6 @@ typedef struct
int image_buffer_size;
/*! \brief Row counter for playing out the rows of the image. */
int row;
-
- /*! \brief Width of the image in the file. */
- uint32_t image_width;
- /*! \brief Length of the image in the file. */
- uint32_t image_length;
- /*! \brief Column-to-column (X) resolution in pixels per metre of the image in the file. */
- int image_x_resolution;
- /*! \brief Row-to-row (Y) resolution in pixels per metre of the image in the file. */
- int image_y_resolution;
- /*! \brief Code for the combined X and Y resolution of the image in the file. */
- int resolution_code;
-
/*! \brief Row counter used when the image is resized or dithered flat. */
int raw_row;
} t4_tx_tiff_state_t;
@@ -123,10 +124,10 @@ struct t4_tx_state_s
/*! \brief The last page to transfer. -1 to continue to the end of the file. */
int stop_page;
- /*! \brief TRUE for FAX page headers to overlay (i.e. replace) the beginning of the
- page image. FALSE for FAX page headers to add to the overall length of
+ /*! \brief True for FAX page headers to overlay (i.e. replace) the beginning of the
+ page image. False for FAX page headers to add to the overall length of
the page. */
- int header_overlays_image;
+ bool header_overlays_image;
/*! \brief The text which will be used in FAX page header. No text results
in no header line. */
const char *header_info;
@@ -162,23 +163,25 @@ struct t4_tx_state_s
#endif
} encoder;
- image_translate_state_t translator;
- uint8_t *pack_buf;
- int pack_ptr;
- int pack_row;
- int pack_bit_mask;
+ t4_image_get_handler_t image_get_handler;
int apply_lab;
lab_params_t lab_params;
uint8_t *colour_map;
int colour_map_entries;
+ image_translate_state_t translator;
+ uint8_t *pack_buf;
+ int pack_ptr;
+ int pack_row;
+ int pack_bit_mask;
+
uint8_t *pre_encoded_buf;
int pre_encoded_len;
int pre_encoded_ptr;
int pre_encoded_bit;
- /* Supporting information, like resolutions, which the backend may want. */
+ /*! \brief Supporting information, like resolutions, which the backend may want. */
t4_tx_metadata_t metadata;
/*! \brief All TIFF file specific state information for the T.4 context. */
diff --git a/libs/spandsp/src/spandsp/private/t85.h b/libs/spandsp/src/spandsp/private/t85.h
index 586a5cc22f..5eb2b50676 100644
--- a/libs/spandsp/src/spandsp/private/t85.h
+++ b/libs/spandsp/src/spandsp/private/t85.h
@@ -89,8 +89,8 @@ struct t85_encode_state_s
uint32_t c[128];
/*! New TX value, or <0 for analysis in progress */
int32_t new_tx;
- /*! TRUE if previous row was typical */
- int prev_ltp;
+ /*! True if previous row was typical */
+ bool prev_ltp;
/*! Pointers to the 3 row buffers */
uint8_t *prev_row[3];
/*! Pointer to a block of allocated memory 3 rows long, which
diff --git a/libs/spandsp/src/spandsp/private/timezone.h b/libs/spandsp/src/spandsp/private/timezone.h
index 9f28cc3d2b..87c67978a7 100644
--- a/libs/spandsp/src/spandsp/private/timezone.h
+++ b/libs/spandsp/src/spandsp/private/timezone.h
@@ -54,8 +54,8 @@ struct tz_ttinfo_s
int32_t gmtoff; /* UTC offset in seconds */
int isdst; /* Used to set tm_isdst */
int abbrind; /* Abbreviation list index */
- int ttisstd; /* TRUE if transition is std time */
- int ttisgmt; /* TRUE if transition is UTC */
+ bool ttisstd; /* True if transition is std time */
+ bool ttisgmt; /* True if transition is UTC */
};
/* Leap second information */
diff --git a/libs/spandsp/src/spandsp/private/v17rx.h b/libs/spandsp/src/spandsp/private/v17rx.h
index 2082722fd6..f6f847c553 100644
--- a/libs/spandsp/src/spandsp/private/v17rx.h
+++ b/libs/spandsp/src/spandsp/private/v17rx.h
@@ -156,8 +156,8 @@ struct v17_rx_state_s
/*! \brief Scrambler tap */
int scrambler_tap;
- /*! \brief TRUE if the short training sequence is to be used. */
- int short_train;
+ /*! \brief True if the short training sequence is to be used. */
+ bool short_train;
/*! \brief The section of the training data we are currently in. */
int training_stage;
/*! \brief A count of how far through the current training step we are. */
diff --git a/libs/spandsp/src/spandsp/private/v17tx.h b/libs/spandsp/src/spandsp/private/v17tx.h
index 3e2fff6d2c..acf2819371 100644
--- a/libs/spandsp/src/spandsp/private/v17tx.h
+++ b/libs/spandsp/src/spandsp/private/v17tx.h
@@ -81,10 +81,10 @@ struct v17_tx_state_s
uint32_t scramble_reg;
/*! \brief Scrambler tap */
int scrambler_tap;
- /*! \brief TRUE if transmitting the training sequence. FALSE if transmitting user data. */
- int in_training;
- /*! \brief TRUE if the short training sequence is to be used. */
- int short_train;
+ /*! \brief True if transmitting the training sequence. False if transmitting user data. */
+ bool in_training;
+ /*! \brief True if the short training sequence is to be used. */
+ bool short_train;
/*! \brief A counter used to track progress through sending the training sequence. */
int training_step;
diff --git a/libs/spandsp/src/spandsp/private/v18.h b/libs/spandsp/src/spandsp/private/v18.h
index a991cc5107..a7575b870b 100644
--- a/libs/spandsp/src/spandsp/private/v18.h
+++ b/libs/spandsp/src/spandsp/private/v18.h
@@ -28,9 +28,10 @@
struct v18_state_s
{
- /*! \brief TRUE if we are the calling modem */
- int calling_party;
+ /*! \brief True if we are the calling modem */
+ bool calling_party;
int mode;
+ int nation;
put_msg_func_t put_msg;
void *user_data;
int repeat_shifts;
@@ -42,15 +43,15 @@ struct v18_state_s
} queue;
tone_gen_descriptor_t alert_tone_desc;
tone_gen_state_t alert_tone_gen;
- fsk_tx_state_t fsktx;
- dtmf_tx_state_t dtmftx;
- async_tx_state_t asynctx;
+ fsk_tx_state_t fsk_tx;
+ dtmf_tx_state_t dtmf_tx;
+ async_tx_state_t async_tx;
int baudot_tx_shift;
int tx_signal_on;
uint8_t next_byte;
- fsk_rx_state_t fskrx;
- dtmf_rx_state_t dtmfrx;
+ fsk_rx_state_t fsk_rx;
+ dtmf_rx_state_t dtmf_rx;
int baudot_rx_shift;
int consecutive_ones;
uint8_t rx_msg[256 + 1];
diff --git a/libs/spandsp/src/spandsp/private/v22bis.h b/libs/spandsp/src/spandsp/private/v22bis.h
index c0da6b0aa6..dac5becb68 100644
--- a/libs/spandsp/src/spandsp/private/v22bis.h
+++ b/libs/spandsp/src/spandsp/private/v22bis.h
@@ -79,8 +79,8 @@ struct v22bis_state_s
{
/*! \brief The maximum permitted bit rate of the modem. Valid values are 1200 and 2400. */
int bit_rate;
- /*! \brief TRUE is this is the calling side modem. */
- int calling_party;
+ /*! \brief True is this is the calling side modem. */
+ bool calling_party;
/*! \brief The callback function used to get the next bit to be transmitted. */
get_bit_func_t get_bit;
/*! \brief A user specified opaque pointer passed to the get_bit callback routine. */
diff --git a/libs/spandsp/src/spandsp/private/v27ter_rx.h b/libs/spandsp/src/spandsp/private/v27ter_rx.h
index fbec14c5ed..fc7912febc 100644
--- a/libs/spandsp/src/spandsp/private/v27ter_rx.h
+++ b/libs/spandsp/src/spandsp/private/v27ter_rx.h
@@ -130,8 +130,8 @@ struct v27ter_rx_state_s
int scrambler_pattern_count;
/*! \brief The current step in the table of BC constellation positions. */
int training_bc;
- /*! \brief TRUE if the previous trained values are to be reused. */
- int old_train;
+ /*! \brief True if the previous trained values are to be reused. */
+ bool old_train;
/*! \brief The section of the training data we are currently in. */
int training_stage;
/*! \brief A count of how far through the current training step we are. */
diff --git a/libs/spandsp/src/spandsp/private/v27ter_tx.h b/libs/spandsp/src/spandsp/private/v27ter_tx.h
index ba9ab8b5aa..add5b36979 100644
--- a/libs/spandsp/src/spandsp/private/v27ter_tx.h
+++ b/libs/spandsp/src/spandsp/private/v27ter_tx.h
@@ -73,9 +73,9 @@ struct v27ter_tx_state_s
/*! \brief A counter for the number of consecutive bits of repeating pattern through
the scrambler. */
int scrambler_pattern_count;
- /*! \brief TRUE if transmitting the training sequence, or shutting down transmission.
- FALSE if transmitting user data. */
- int in_training;
+ /*! \brief True if transmitting the training sequence, or shutting down transmission.
+ False if transmitting user data. */
+ bool in_training;
/*! \brief A counter used to track progress through sending the training sequence. */
int training_step;
diff --git a/libs/spandsp/src/spandsp/private/v29rx.h b/libs/spandsp/src/spandsp/private/v29rx.h
index fd931af0f8..8b38b467bf 100644
--- a/libs/spandsp/src/spandsp/private/v29rx.h
+++ b/libs/spandsp/src/spandsp/private/v29rx.h
@@ -139,8 +139,8 @@ struct v29_rx_state_s
uint8_t training_scramble_reg;
/*! \brief The current step in the table of CD constellation positions. */
int training_cd;
- /*! \brief TRUE if the previous trained values are to be reused. */
- int old_train;
+ /*! \brief True if the previous trained values are to be reused. */
+ bool old_train;
/*! \brief The section of the training data we are currently in. */
int training_stage;
/*! \brief A count of how far through the current training step we are. */
diff --git a/libs/spandsp/src/spandsp/private/v29tx.h b/libs/spandsp/src/spandsp/private/v29tx.h
index 67c2b7098d..58f86a2af7 100644
--- a/libs/spandsp/src/spandsp/private/v29tx.h
+++ b/libs/spandsp/src/spandsp/private/v29tx.h
@@ -76,9 +76,9 @@ struct v29_tx_state_s
uint32_t scramble_reg;
/*! \brief The register for the training scrambler. */
uint8_t training_scramble_reg;
- /*! \brief TRUE if transmitting the training sequence, or shutting down transmission.
- FALSE if transmitting user data. */
- int in_training;
+ /*! \brief True if transmitting the training sequence, or shutting down transmission.
+ False if transmitting user data. */
+ bool in_training;
/*! \brief A counter used to track progress through sending the training sequence. */
int training_step;
/*! \brief An offset value into the table of training parameters, used to match the
diff --git a/libs/spandsp/src/spandsp/private/v42.h b/libs/spandsp/src/spandsp/private/v42.h
index b45b716349..5eac89f873 100644
--- a/libs/spandsp/src/spandsp/private/v42.h
+++ b/libs/spandsp/src/spandsp/private/v42.h
@@ -92,9 +92,9 @@ typedef struct
uint8_t vr;
int state;
int configuring;
- int local_busy;
- int far_busy;
- int rejected;
+ bool local_busy;
+ bool far_busy;
+ bool rejected;
int retry_count;
/* The control frame buffer, and its pointers */
@@ -131,11 +131,11 @@ typedef struct
*/
struct v42_state_s
{
- /*! TRUE if we are the calling party, otherwise FALSE. */
- int calling_party;
- /*! TRUE if we should detect whether the far end is V.42 capable. FALSE if we go
+ /*! True if we are the calling party, otherwise false. */
+ bool calling_party;
+ /*! True if we should detect whether the far end is V.42 capable. false if we go
directly to protocol establishment. */
- int detect;
+ bool detect;
/*! The bit rate, used to time events */
int tx_bit_rate;
diff --git a/libs/spandsp/src/spandsp/private/v42bis.h b/libs/spandsp/src/spandsp/private/v42bis.h
index 967b1fd909..216199d79b 100644
--- a/libs/spandsp/src/spandsp/private/v42bis.h
+++ b/libs/spandsp/src/spandsp/private/v42bis.h
@@ -60,8 +60,8 @@ typedef struct
/*! \brief The maximum amount to be passed to the data handler. */
int max_output_len;
- /*! \brief TRUE if we are in transparent (i.e. uncompressable) mode */
- int transparent;
+ /*! \brief True if we are in transparent (i.e. uncompressable) mode */
+ bool transparent;
/*! \brief Next empty dictionary entry */
uint16_t v42bis_parm_c1;
/*! \brief Current codeword size */
@@ -104,8 +104,8 @@ typedef struct
/*! \brief The current value of the escape code */
uint8_t escape_code;
- /*! \brief TRUE if we just hit an escape code, and are waiting for the following octet */
- int escaped;
+ /*! \brief True if we just hit an escape code, and are waiting for the following octet */
+ bool escaped;
} v42bis_comp_state_t;
/*!
diff --git a/libs/spandsp/src/spandsp/private/v8.h b/libs/spandsp/src/spandsp/private/v8.h
index 213d445f52..3c07b0e3bc 100644
--- a/libs/spandsp/src/spandsp/private/v8.h
+++ b/libs/spandsp/src/spandsp/private/v8.h
@@ -28,8 +28,8 @@
struct v8_state_s
{
- /*! \brief TRUE if we are the calling party */
- int calling_party;
+ /*! \brief True if we are the calling party */
+ bool calling_party;
/*! \brief A handler to process the V.8 signals */
v8_result_handler_t result_handler;
@@ -38,7 +38,7 @@ struct v8_state_s
/*! \brief The current state of the V.8 protocol */
int state;
- int fsk_tx_on;
+ bool fsk_tx_on;
int modem_connect_tone_tx_on;
int negotiation_timer;
int ci_timer;
@@ -67,8 +67,8 @@ struct v8_state_s
testing for matches. */
uint8_t cm_jm_data[64];
int cm_jm_len;
- int got_cm_jm;
- int got_cj;
+ bool got_cm_jm;
+ bool got_cj;
int zero_byte_count;
/*! \brief Error and flow logging control */
logging_state_t logging;
diff --git a/libs/spandsp/src/spandsp/queue.h b/libs/spandsp/src/spandsp/queue.h
index cbb4357916..7e56a59fc7 100644
--- a/libs/spandsp/src/spandsp/queue.h
+++ b/libs/spandsp/src/spandsp/queue.h
@@ -63,8 +63,8 @@ extern "C"
/*! Check if a queue is empty.
\brief Check if a queue is empty.
\param s The queue context.
- \return TRUE if empty, else FALSE. */
-SPAN_DECLARE(int) queue_empty(queue_state_t *s);
+ \return True if empty, else false. */
+SPAN_DECLARE(bool) queue_empty(queue_state_t *s);
/*! Check the available free space in a queue's buffer.
\brief Check available free space.
diff --git a/libs/spandsp/src/spandsp/stdbool.h b/libs/spandsp/src/spandsp/stdbool.h
new file mode 100644
index 0000000000..8c722fad17
--- /dev/null
+++ b/libs/spandsp/src/spandsp/stdbool.h
@@ -0,0 +1,55 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * stdbool.h - A version for systems which lack their own stdbool.h
+ *
+ * Written by Steve Underwood
+ *
+ * Copyright (C) 2003 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 */
+
+
+/*
+ * ISO C Standard: 7.16 Boolean type and values
+ */
+
+#if !defined(_STDBOOL_H)
+#define _STDBOOL_H
+
+#if !defined(__cplusplus)
+
+#define _Bool int
+#define bool int
+#define false 0
+#define true (!false)
+
+#else
+
+#define _Bool bool
+#define bool bool
+#define false false
+#define true true
+
+#endif
+
+/* Signal that all the definitions are present. */
+#define __bool_true_false_are_defined 1
+
+#endif
diff --git a/libs/spandsp/src/spandsp/t30.h b/libs/spandsp/src/spandsp/t30.h
index 2ba1330538..e4d734a8e4 100644
--- a/libs/spandsp/src/spandsp/t30.h
+++ b/libs/spandsp/src/spandsp/t30.h
@@ -32,7 +32,7 @@
\section t30_page_sec_1 What does it do?
The T.30 protocol is the core protocol used for FAX transmission. This module
-implements most of its key featrues. It does not interface to the outside work.
+implements most of its key features. It does not interface to the outside work.
Seperate modules do that for T.38, analogue line, and other forms of FAX
communication.
@@ -184,13 +184,13 @@ typedef void (*t30_phase_e_handler_t)(t30_state_t *s, void *user_data, int compl
\brief T.30 real time frame handler.
\param s The T.30 context.
\param user_data An opaque pointer.
- \param direction TRUE for incoming, FALSE for outgoing.
+ \param incoming True for incoming, false for outgoing.
\param msg The HDLC message.
\param len The length of the message.
*/
typedef void (*t30_real_time_frame_handler_t)(t30_state_t *s,
void *user_data,
- int direction,
+ bool direction,
const uint8_t msg[],
int len);
@@ -209,8 +209,8 @@ typedef int (*t30_document_handler_t)(t30_state_t *s, void *user_data, int statu
\param user_data An opaque pointer.
\param type The modem, tone or silence to be sent or received.
\param bit_rate The bit rate of the modem to be sent or received.
- \param short_train TRUE if the short training sequence should be used (where one exists).
- \param use_hdlc FALSE for bit stream, TRUE for HDLC framing.
+ \param short_train True if the short training sequence should be used (where one exists).
+ \param use_hdlc False for bit stream, true for HDLC framing.
*/
typedef void (*t30_set_handler_t)(void *user_data, int type, int bit_rate, int short_train, int use_hdlc);
@@ -448,7 +448,7 @@ typedef struct
{
/*! \brief The current bit rate for image transfer. */
int bit_rate;
- /*! \brief TRUE if error correcting mode is used. */
+ /*! \brief True if error correcting mode is used. */
int error_correcting_mode;
/*! \brief The number of pages sent so far. */
int pages_tx;
@@ -502,7 +502,7 @@ extern "C"
/*! Initialise a T.30 context.
\brief Initialise a T.30 context.
\param s The T.30 context.
- \param calling_party TRUE if the context is for a calling party. FALSE if the
+ \param calling_party True if the context is for a calling party. False if the
context is for an answering party.
\param set_rx_type_handler
\param set_rx_type_user_data
@@ -542,7 +542,7 @@ SPAN_DECLARE(int) t30_restart(t30_state_t *s);
if the job has finished.
\brief Check if a T.30 call is still active.
\param s The T.30 context.
- \return TRUE for call still active, or FALSE for call completed. */
+ \return True for call still active, or false for call completed. */
SPAN_DECLARE(int) t30_call_active(t30_state_t *s);
/*! Cleanup a T.30 context if the call terminates.
@@ -588,7 +588,7 @@ SPAN_DECLARE(void) t30_non_ecm_put(void *user_data, const uint8_t buf[], int len
\param user_data The T.30 context.
\param msg The HDLC message.
\param len The length of the message, in octets.
- \param ok TRUE if the frame was received without error. */
+ \param ok True if the frame was received without error. */
SPAN_DECLARE_NONSTD(void) t30_hdlc_accept(void *user_data, const uint8_t msg[], int len, int ok);
/*! Report the passage of time to the T.30 engine.
@@ -606,13 +606,13 @@ SPAN_DECLARE(void) t30_get_transfer_statistics(t30_state_t *s, t30_stats_t *t);
/*! Request a local interrupt of FAX exchange.
\brief Request a local interrupt of FAX exchange.
\param s The T.30 context.
- \param state TRUE to enable interrupt request, else FALSE. */
+ \param state True to enable interrupt request, else false. */
SPAN_DECLARE(void) t30_local_interrupt_request(t30_state_t *s, int state);
/*! Allow remote interrupts of FAX exchange.
\brief Allow remote interrupts of FAX exchange.
\param s The T.30 context.
- \param state TRUE to allow interruptd, else FALSE. */
+ \param state True to allow interruptd, else false. */
SPAN_DECLARE(void) t30_remote_interrupts_allowed(t30_state_t *s, int state);
#if defined(__cplusplus)
diff --git a/libs/spandsp/src/spandsp/t30_api.h b/libs/spandsp/src/spandsp/t30_api.h
index da3ef01a30..1c9a6e51de 100644
--- a/libs/spandsp/src/spandsp/t30_api.h
+++ b/libs/spandsp/src/spandsp/t30_api.h
@@ -363,8 +363,8 @@ SPAN_DECLARE(size_t) t30_get_rx_csa(t30_state_t *s, int *type, const char *addre
/*! Set page header extends or overlays the image mode.
\brief Set page header overlay mode.
\param s The T.30 context.
- \param header_overlays_image TRUE for overlay, or FALSE for extend the page. */
-SPAN_DECLARE(int) t30_set_tx_page_header_overlays_image(t30_state_t *s, int header_overlays_image);
+ \param header_overlays_image True for overlay, or false for extend the page. */
+SPAN_DECLARE(int) t30_set_tx_page_header_overlays_image(t30_state_t *s, bool header_overlays_image);
/*! Set the transmitted header information associated with a T.30 context.
\brief Set the transmitted header information associated with a T.30 context.
@@ -426,15 +426,15 @@ SPAN_DECLARE(void) t30_set_tx_file(t30_state_t *s, const char *file, int start_p
/*! Set Internet aware FAX (IAF) mode.
\brief Set Internet aware FAX (IAF) mode.
\param s The T.30 context.
- \param iaf TRUE for IAF, or FALSE for non-IAF. */
-SPAN_DECLARE(void) t30_set_iaf_mode(t30_state_t *s, int iaf);
+ \param iaf True for IAF, or false for non-IAF. */
+SPAN_DECLARE(void) t30_set_iaf_mode(t30_state_t *s, bool iaf);
/*! Specify if error correction mode (ECM) is allowed by a T.30 context.
\brief Select ECM capability.
\param s The T.30 context.
- \param enabled TRUE for ECM capable, FALSE for not ECM capable.
+ \param enabled True for ECM capable, or false for not ECM capable.
\return 0 if OK, else -1. */
-SPAN_DECLARE(int) t30_set_ecm_capability(t30_state_t *s, int enabled);
+SPAN_DECLARE(int) t30_set_ecm_capability(t30_state_t *s, bool enabled);
/*! Specify the output encoding for TIFF files created during FAX reception.
\brief Specify the output encoding for TIFF files created during FAX reception.
diff --git a/libs/spandsp/src/spandsp/t31.h b/libs/spandsp/src/spandsp/t31.h
index 4e8452e497..b61a4142f9 100644
--- a/libs/spandsp/src/spandsp/t31.h
+++ b/libs/spandsp/src/spandsp/t31.h
@@ -89,33 +89,33 @@ SPAN_DECLARE(int) t31_t38_send_timeout(t31_state_t *s, int samples);
/*! Select whether silent audio will be sent when transmit is idle.
\brief Select whether silent audio will be sent when transmit is idle.
\param s The T.31 modem context.
- \param transmit_on_idle TRUE if silent audio should be output when the transmitter is
- idle. FALSE to transmit zero length audio when the transmitter is idle. The default
- behaviour is FALSE.
+ \param transmit_on_idle True if silent audio should be output when the transmitter is
+ idle. False to transmit zero length audio when the transmitter is idle. The default
+ behaviour is false.
*/
-SPAN_DECLARE(void) t31_set_transmit_on_idle(t31_state_t *s, int transmit_on_idle);
+SPAN_DECLARE(void) t31_set_transmit_on_idle(t31_state_t *s, bool transmit_on_idle);
/*! Select whether TEP mode will be used (or time allowed for it (when transmitting).
\brief Select whether TEP mode will be used.
\param s The T.31 modem context.
- \param use_tep TRUE if TEP is to be ised.
+ \param use_tep True if TEP is to be used.
*/
-SPAN_DECLARE(void) t31_set_tep_mode(t31_state_t *s, int use_tep);
+SPAN_DECLARE(void) t31_set_tep_mode(t31_state_t *s, bool use_tep);
/*! Select whether T.38 data will be paced as it is transmitted.
\brief Select whether T.38 data will be paced.
\param s The T.31 modem context.
- \param without_pacing TRUE if data is to be sent as fast as possible. FALSE if it is
+ \param without_pacing True if data is to be sent as fast as possible. False if it is
to be paced.
*/
-SPAN_DECLARE(void) t31_set_t38_config(t31_state_t *s, int without_pacing);
+SPAN_DECLARE(void) t31_set_t38_config(t31_state_t *s, bool without_pacing);
/*! Set audio or T.38 mode.
\brief Set audio or T.38 mode.
\param s The T.31 modem context.
- \param t38_mode TRUE for T.38 mode operation. FALSE for audio mode operation.
+ \param t38_mode True for T.38 mode operation. False for audio mode operation.
*/
-SPAN_DECLARE(void) t31_set_mode(t31_state_t *s, int t38_mode);
+SPAN_DECLARE(void) t31_set_mode(t31_state_t *s, bool t38_mode);
/*! Get a pointer to the logging context associated with a T.31 context.
\brief Get a pointer to the logging context associated with a T.31 context.
diff --git a/libs/spandsp/src/spandsp/t35.h b/libs/spandsp/src/spandsp/t35.h
index efd644b390..fdef41fdf2 100644
--- a/libs/spandsp/src/spandsp/t35.h
+++ b/libs/spandsp/src/spandsp/t35.h
@@ -83,9 +83,9 @@ SPAN_DECLARE(const char *) t35_vendor_to_str(const uint8_t *msg, int len);
\param model A pointer which will be pointed to the identified model.
If a NULL pointer is given, the model will not be returned.
If the model is not identified, NULL will be returned.
- \return TRUE if the machine was identified, otherwise FALSE.
+ \return True if the machine was identified.
*/
-SPAN_DECLARE(int) t35_decode(const uint8_t *msg, int len, const char **country, const char **vendor, const char **model);
+SPAN_DECLARE(bool) t35_decode(const uint8_t *msg, int len, const char **country, const char **vendor, const char **model);
#if defined(__cplusplus)
}
diff --git a/libs/spandsp/src/spandsp/t38_core.h b/libs/spandsp/src/spandsp/t38_core.h
index 662cf8d37e..86e45089ac 100644
--- a/libs/spandsp/src/spandsp/t38_core.h
+++ b/libs/spandsp/src/spandsp/t38_core.h
@@ -312,21 +312,21 @@ SPAN_DECLARE(void) t38_set_data_transport_protocol(t38_core_state_t *s, int data
/*! Set the non-ECM fill bit removal mode.
\param s The T.38 context.
- \param fill_bit_removal TRUE to remove fill bits across the T.38 link, else FALSE.
+ \param fill_bit_removal True to remove fill bits across the T.38 link.
*/
-SPAN_DECLARE(void) t38_set_fill_bit_removal(t38_core_state_t *s, int fill_bit_removal);
+SPAN_DECLARE(void) t38_set_fill_bit_removal(t38_core_state_t *s, bool fill_bit_removal);
/*! Set the MMR transcoding mode.
\param s The T.38 context.
- \param mmr_transcoding TRUE to transcode to MMR across the T.38 link, else FALSE.
+ \param mmr_transcoding True to transcode to MMR across the T.38 link.
*/
-SPAN_DECLARE(void) t38_set_mmr_transcoding(t38_core_state_t *s, int mmr_transcoding);
+SPAN_DECLARE(void) t38_set_mmr_transcoding(t38_core_state_t *s, bool mmr_transcoding);
/*! Set the JBIG transcoding mode.
\param s The T.38 context.
- \param jbig_transcoding TRUE to transcode to JBIG across the T.38 link, else FALSE.
+ \param jbig_transcoding True to transcode to JBIG across the T.38 link.
*/
-SPAN_DECLARE(void) t38_set_jbig_transcoding(t38_core_state_t *s, int jbig_transcoding);
+SPAN_DECLARE(void) t38_set_jbig_transcoding(t38_core_state_t *s, bool jbig_transcoding);
/*! Set the maximum buffer size for received data at the far end.
\param s The T.38 context.
@@ -363,16 +363,16 @@ SPAN_DECLARE(void) t38_set_t38_version(t38_core_state_t *s, int t38_version);
/*! Set the sequence number handling option.
\param s The T.38 context.
- \param check TRUE to check sequence numbers, and handle gaps reasonably. FALSE
+ \param check True to check sequence numbers, and handle gaps reasonably. False
for no sequence number processing (e.g. for TPKT over TCP transport).
*/
-SPAN_DECLARE(void) t38_set_sequence_number_handling(t38_core_state_t *s, int check);
+SPAN_DECLARE(void) t38_set_sequence_number_handling(t38_core_state_t *s, bool check);
/*! Set the TEP handling option.
\param s The T.38 context.
- \param allow_for_tep TRUE to allow for TEP playout, else FALSE.
+ \param allow_for_tep True to allow for TEP playout.
*/
-SPAN_DECLARE(void) t38_set_tep_handling(t38_core_state_t *s, int allow_for_tep);
+SPAN_DECLARE(void) t38_set_tep_handling(t38_core_state_t *s, bool allow_for_tep);
/*! Get a pointer to the logging context associated with a T.38 context.
\brief Get a pointer to the logging context associated with a T.38 context.
diff --git a/libs/spandsp/src/spandsp/t38_gateway.h b/libs/spandsp/src/spandsp/t38_gateway.h
index 4971e8d4bf..89bd9b116d 100644
--- a/libs/spandsp/src/spandsp/t38_gateway.h
+++ b/libs/spandsp/src/spandsp/t38_gateway.h
@@ -45,13 +45,13 @@ typedef struct t38_gateway_state_s t38_gateway_state_t;
\brief T.30 real time frame handler.
\param s The T.30 context.
\param user_data An opaque pointer.
- \param direction TRUE for incoming, FALSE for outgoing.
+ \param incoming True for incoming, false for outgoing.
\param msg The HDLC message.
\param len The length of the message.
*/
typedef void (*t38_gateway_real_time_frame_handler_t)(t38_gateway_state_t *s,
void *user_data,
- int direction,
+ bool incoming,
const uint8_t *msg,
int len);
@@ -62,8 +62,8 @@ typedef struct
{
/*! \brief The current bit rate for image transfer. */
int bit_rate;
- /*! \brief TRUE if error correcting mode is used. */
- int error_correcting_mode;
+ /*! \brief True if error correcting mode is used. */
+ bool error_correcting_mode;
/*! \brief The number of pages transferred so far. */
int pages_transferred;
} t38_stats_t;
@@ -124,18 +124,18 @@ SPAN_DECLARE_NONSTD(int) t38_gateway_tx(t38_gateway_state_t *s, int16_t amp[], i
/*! Control whether error correcting mode (ECM) is allowed.
\brief Control whether error correcting mode (ECM) is allowed.
\param s The T.38 context.
- \param ecm_allowed TRUE is ECM is to be allowed.
+ \param ecm_allowed True is ECM is to be allowed.
*/
-SPAN_DECLARE(void) t38_gateway_set_ecm_capability(t38_gateway_state_t *s, int ecm_allowed);
+SPAN_DECLARE(void) t38_gateway_set_ecm_capability(t38_gateway_state_t *s, bool ecm_allowed);
/*! Select whether silent audio will be sent when transmit is idle.
\brief Select whether silent audio will be sent when transmit is idle.
\param s The T.38 context.
- \param transmit_on_idle TRUE if silent audio should be output when the FAX transmitter is
- idle. FALSE to transmit zero length audio when the FAX transmitter is idle. The default
- behaviour is FALSE.
+ \param transmit_on_idle True if silent audio should be output when the FAX transmitter is
+ idle. False to transmit zero length audio when the FAX transmitter is idle. The default
+ behaviour is false.
*/
-SPAN_DECLARE(void) t38_gateway_set_transmit_on_idle(t38_gateway_state_t *s, int transmit_on_idle);
+SPAN_DECLARE(void) t38_gateway_set_transmit_on_idle(t38_gateway_state_t *s, bool transmit_on_idle);
/*! Specify which modem types are supported by a T.30 context.
\brief Specify supported modems.
@@ -165,16 +165,16 @@ SPAN_DECLARE(void) t38_gateway_set_nsx_suppression(t38_gateway_state_t *s,
/*! Select whether talker echo protection tone will be sent for the image modems.
\brief Select whether TEP will be sent for the image modems.
\param s The T.38 context.
- \param use_tep TRUE if TEP should be sent.
+ \param use_tep True if TEP should be sent.
*/
-SPAN_DECLARE(void) t38_gateway_set_tep_mode(t38_gateway_state_t *s, int use_tep);
+SPAN_DECLARE(void) t38_gateway_set_tep_mode(t38_gateway_state_t *s, bool use_tep);
/*! Select whether non-ECM fill bits are to be removed during transmission.
\brief Select whether non-ECM fill bits are to be removed during transmission.
\param s The T.38 context.
- \param remove TRUE if fill bits are to be removed.
+ \param remove True if fill bits are to be removed.
*/
-SPAN_DECLARE(void) t38_gateway_set_fill_bit_removal(t38_gateway_state_t *s, int remove);
+SPAN_DECLARE(void) t38_gateway_set_fill_bit_removal(t38_gateway_state_t *s, bool remove);
/*! Get the current transfer statistics for the current T.38 session.
\brief Get the current transfer statistics.
diff --git a/libs/spandsp/src/spandsp/t38_non_ecm_buffer.h b/libs/spandsp/src/spandsp/t38_non_ecm_buffer.h
index 0b1bee6af6..3ca28c3d12 100644
--- a/libs/spandsp/src/spandsp/t38_non_ecm_buffer.h
+++ b/libs/spandsp/src/spandsp/t38_non_ecm_buffer.h
@@ -83,10 +83,10 @@ extern "C"
/*! \brief Initialise a T.38 rate adapting non-ECM buffer context.
\param s The buffer context.
- \param mode TRUE for image data mode, or FALSE for TCF mode.
+ \param image_mode True for image data mode, or false for TCF mode.
\param bits The minimum number of bits per FAX image row.
\return A pointer to the buffer context, or NULL if there was a problem. */
-SPAN_DECLARE(t38_non_ecm_buffer_state_t *) t38_non_ecm_buffer_init(t38_non_ecm_buffer_state_t *s, int mode, int min_row_bits);
+SPAN_DECLARE(t38_non_ecm_buffer_state_t *) t38_non_ecm_buffer_init(t38_non_ecm_buffer_state_t *s, bool image_mode, int min_row_bits);
SPAN_DECLARE(int) t38_non_ecm_buffer_release(t38_non_ecm_buffer_state_t *s);
@@ -94,9 +94,9 @@ SPAN_DECLARE(int) t38_non_ecm_buffer_free(t38_non_ecm_buffer_state_t *s);
/*! \brief Set the mode of a T.38 rate adapting non-ECM buffer context.
\param s The buffer context.
- \param mode TRUE for image data mode, or FALSE for TCF mode.
+ \param mode True for image data mode, or false for TCF mode.
\param bits The minimum number of bits per FAX image row. */
-SPAN_DECLARE(void) t38_non_ecm_buffer_set_mode(t38_non_ecm_buffer_state_t *s, int mode, int min_row_bits);
+SPAN_DECLARE(void) t38_non_ecm_buffer_set_mode(t38_non_ecm_buffer_state_t *s, bool image_mode, int min_row_bits);
/*! \brief Inject data to T.38 rate adapting non-ECM buffer context.
\param s The buffer context.
diff --git a/libs/spandsp/src/spandsp/t38_terminal.h b/libs/spandsp/src/spandsp/t38_terminal.h
index dbf0dca9cb..630fbb80bc 100644
--- a/libs/spandsp/src/spandsp/t38_terminal.h
+++ b/libs/spandsp/src/spandsp/t38_terminal.h
@@ -72,16 +72,16 @@ SPAN_DECLARE(void) t38_terminal_set_config(t38_terminal_state_t *s, int config);
/*! Select whether the time for talker echo protection tone will be allowed for when sending.
\brief Select whether TEP time will be allowed for.
\param s The T.38 context.
- \param use_tep TRUE if TEP should be allowed for.
+ \param use_tep True if TEP should be allowed for.
*/
-SPAN_DECLARE(void) t38_terminal_set_tep_mode(t38_terminal_state_t *s, int use_tep);
+SPAN_DECLARE(void) t38_terminal_set_tep_mode(t38_terminal_state_t *s, bool use_tep);
/*! Select whether non-ECM fill bits are to be removed during transmission.
\brief Select whether non-ECM fill bits are to be removed during transmission.
\param s The T.38 context.
- \param remove TRUE if fill bits are to be removed.
+ \param remove True if fill bits are to be removed.
*/
-SPAN_DECLARE(void) t38_terminal_set_fill_bit_removal(t38_terminal_state_t *s, int remove);
+SPAN_DECLARE(void) t38_terminal_set_fill_bit_removal(t38_terminal_state_t *s, bool remove);
/*! Get a pointer to the T.30 engine associated with a termination mode T.38 context.
\brief Get a pointer to the T.30 engine associated with a T.38 context.
@@ -108,21 +108,21 @@ SPAN_DECLARE(logging_state_t *) t38_terminal_get_logging_state(t38_terminal_stat
/*! \brief Reinitialise a termination mode T.38 context.
\param s The T.38 context.
- \param calling_party TRUE if the context is for a calling party. FALSE if the
+ \param calling_party True if the context is for a calling party. False if the
context is for an answering party.
\return 0 for OK, else -1. */
SPAN_DECLARE(int) t38_terminal_restart(t38_terminal_state_t *s,
- int calling_party);
+ bool calling_party);
/*! \brief Initialise a termination mode T.38 context.
\param s The T.38 context.
- \param calling_party TRUE if the context is for a calling party. FALSE if the
+ \param calling_party True if the context is for a calling party. False if the
context is for an answering party.
\param tx_packet_handler A callback routine to encapsulate and transmit T.38 packets.
\param tx_packet_user_data An opaque pointer passed to the tx_packet_handler routine.
\return A pointer to the termination mode T.38 context, or NULL if there was a problem. */
SPAN_DECLARE(t38_terminal_state_t *) t38_terminal_init(t38_terminal_state_t *s,
- int calling_party,
+ bool calling_party,
t38_tx_packet_handler_t tx_packet_handler,
void *tx_packet_user_data);
diff --git a/libs/spandsp/src/spandsp/t42.h b/libs/spandsp/src/spandsp/t42.h
index 343780b9fe..17c4758a7f 100644
--- a/libs/spandsp/src/spandsp/t42.h
+++ b/libs/spandsp/src/spandsp/t42.h
@@ -76,16 +76,6 @@ SPAN_DECLARE(void) set_lab_gamut2(lab_params_t *s, int L_P, int L_Q, int a_P, in
SPAN_DECLARE(void) get_lab_gamut2(lab_params_t *s, int *L_P, int *L_Q, int *a_P, int *a_Q, int *b_P, int *b_Q);
-SPAN_DECLARE(int) t42_itulab_to_itulab(logging_state_t *logging, tdata_t *dst, tsize_t *dstlen, tdata_t src, tsize_t srclen, uint32_t width, uint32_t height);
-
-SPAN_DECLARE(int) t42_itulab_to_jpeg(logging_state_t *logging, lab_params_t *s, tdata_t *dst, tsize_t *dstlen, tdata_t src, tsize_t srclen);
-
-SPAN_DECLARE(int) t42_jpeg_to_itulab(logging_state_t *logging, lab_params_t *s, tdata_t *dst, tsize_t *dstlen, tdata_t src, tsize_t srclen);
-
-SPAN_DECLARE(int) t42_srgb_to_itulab(logging_state_t *logging, lab_params_t *s, tdata_t *dst, tsize_t *dstlen, tdata_t src, tsize_t srclen, uint32_t width, uint32_t height);
-
-SPAN_DECLARE(int) t42_itulab_to_srgb(logging_state_t *logging, lab_params_t *s, tdata_t dst, tsize_t *dstlen, tdata_t src, tsize_t srclen, uint32_t *width, uint32_t *height);
-
SPAN_DECLARE(void) t42_encode_set_options(t42_encode_state_t *s, uint32_t l0, int quality, int options);
SPAN_DECLARE(int) t42_encode_set_image_width(t42_encode_state_t *s, uint32_t image_width);
diff --git a/libs/spandsp/src/spandsp/t4_rx.h b/libs/spandsp/src/spandsp/t4_rx.h
index ed56cbcf8f..0401d10823 100644
--- a/libs/spandsp/src/spandsp/t4_rx.h
+++ b/libs/spandsp/src/spandsp/t4_rx.h
@@ -49,68 +49,44 @@ typedef int (*t4_row_write_handler_t)(void *user_data, const uint8_t buf[], size
typedef enum
{
/*! No compression */
- T4_COMPRESSION_NONE = 0,
- /*! T.1 1D compression */
- T4_COMPRESSION_T4_1D = 1,
+ T4_COMPRESSION_NONE = 0x01,
+ /*! T.4 1D compression */
+ T4_COMPRESSION_T4_1D = 0x02,
/*! T.4 2D compression */
- T4_COMPRESSION_T4_2D = 2,
+ T4_COMPRESSION_T4_2D = 0x04,
/*! T.6 2D compression */
- T4_COMPRESSION_T6 = 3,
+ T4_COMPRESSION_T6 = 0x08,
/*! T.85 monochrome JBIG coding with L0 fixed. */
- T4_COMPRESSION_T85 = 4,
+ T4_COMPRESSION_T85 = 0x10,
/*! T.85 monochrome JBIG coding with L0 variable. */
- T4_COMPRESSION_T85_L0 = 5,
+ T4_COMPRESSION_T85_L0 = 0x20,
/*! T.43 gray-scale/colour JBIG coding */
- T4_COMPRESSION_T43 = 6,
+ T4_COMPRESSION_T43 = 0x40,
/*! T.45 run length colour compression */
- T4_COMPRESSION_T45 = 7,
+ T4_COMPRESSION_T45 = 0x80,
/*! T.42 + T.81 + T.30 Annex E colour JPEG coding */
- T4_COMPRESSION_T42_T81 = 8,
+ T4_COMPRESSION_T42_T81 = 0x100,
/*! T.42 + T.81 + T.30 Annex K colour sYCC-JPEG coding */
- T4_COMPRESSION_SYCC_T81 = 9,
+ T4_COMPRESSION_SYCC_T81 = 0x200,
/*! T.88 monochrome JBIG2 compression */
- T4_COMPRESSION_T88 = 10
-} t4_image_compression_t;
-
-enum
-{
- /*! No compression */
- T4_SUPPORT_COMPRESSION_NONE = 0x01,
- /*! T.1 1D compression */
- T4_SUPPORT_COMPRESSION_T4_1D = 0x02,
- /*! T.4 2D compression */
- T4_SUPPORT_COMPRESSION_T4_2D = 0x04,
- /*! T.6 2D compression */
- T4_SUPPORT_COMPRESSION_T6 = 0x08,
- /*! T.85 monochrome JBIG compression, with fixed L0 */
- T4_SUPPORT_COMPRESSION_T85 = 0x10,
- /*! T.85 monochrome JBIG compression, with variable L0 */
- T4_SUPPORT_COMPRESSION_T85_L0 = 0x20,
- /*! T.43 colour JBIG compression */
- T4_SUPPORT_COMPRESSION_T43 = 0x40,
- /*! T.45 run length colour compression */
- T4_SUPPORT_COMPRESSION_T45 = 0x80,
- /*! T.81 + T.30 Annex E colour JPEG compression */
- T4_SUPPORT_COMPRESSION_T42_T81 = 0x100,
- /*! T.81 + T.30 Annex K colour sYCC-JPEG compression */
- T4_SUPPORT_COMPRESSION_SYCC_T81 = 0x200,
- /*! T.88 monochrome JBIG2 compression */
- T4_SUPPORT_COMPRESSION_T88 = 0x400,
+ T4_COMPRESSION_T88 = 0x400,
+ /*! Support solour compression without sub-sampling */
+ T4_COMPRESSION_NO_SUBSAMPLING = 0x800000,
/*! Gray-scale support by multi-level codecs */
- T4_SUPPORT_COMPRESSION_GRAYSCALE = 0x1000000,
+ T4_COMPRESSION_GRAYSCALE = 0x1000000,
/*! Colour support by multi-level codecs */
- T4_SUPPORT_COMPRESSION_COLOUR = 0x2000000,
+ T4_COMPRESSION_COLOUR = 0x2000000,
/*! 12 bit mode for gray-scale and colour */
- T4_SUPPORT_COMPRESSION_12BIT = 0x4000000,
+ T4_COMPRESSION_12BIT = 0x4000000,
/*! Convert a colour image to a gray-scale one */
- T4_SUPPORT_COMPRESSION_COLOUR_TO_GRAY = 0x8000000,
+ T4_COMPRESSION_COLOUR_TO_GRAY = 0x8000000,
/*! Dither a gray-scale image down a simple bilevel image, with rescaling to fit a FAX page */
- T30_SUPPORT_GRAY_TO_BILEVEL = 0x10000000,
+ T4_COMPRESSION_GRAY_TO_BILEVEL = 0x10000000,
/*! Dither a colour image down a simple bilevel image, with rescaling to fit a FAX page */
- T30_SUPPORT_COLOUR_TO_BILEVEL = 0x20000000,
+ T4_COMPRESSION_COLOUR_TO_BILEVEL = 0x20000000,
/*! Rescale an image (except a bi-level image) to fit a permitted FAX width when necessary */
- T4_SUPPORT_COMPRESSION_RESCALING = 0x40000000
-};
+ T4_COMPRESSION_RESCALING = 0x40000000
+} t4_image_compression_t;
/*! Image type */
typedef enum
@@ -169,71 +145,36 @@ typedef enum
enum
{
/*! Standard FAX resolution 204dpi x 98dpi - bi-level only */
- T4_RESOLUTION_R8_STANDARD = 1,
+ T4_RESOLUTION_R8_STANDARD = 0x1,
/*! Fine FAX resolution 204dpi x 196dpi - bi-level only */
- T4_RESOLUTION_R8_FINE = 2,
+ T4_RESOLUTION_R8_FINE = 0x2,
/*! Super-fine FAX resolution 204dpi x 391dpi - bi-level only */
- T4_RESOLUTION_R8_SUPERFINE = 3,
+ T4_RESOLUTION_R8_SUPERFINE = 0x4,
/*! Double FAX resolution 408dpi x 391dpi - bi-level only */
- T4_RESOLUTION_R16_SUPERFINE = 4,
+ T4_RESOLUTION_R16_SUPERFINE = 0x8,
/*! 100dpi x 100dpi - gray-scale and colour only */
- T4_RESOLUTION_100_100 = 5,
+ T4_RESOLUTION_100_100 = 0x10,
/*! 200dpi x 100dpi - bi-level only */
- T4_RESOLUTION_200_100 = 6,
+ T4_RESOLUTION_200_100 = 0x20,
/*! 200dpi x 200dpi */
- T4_RESOLUTION_200_200 = 7,
+ T4_RESOLUTION_200_200 = 0x40,
/*! 200dpi x 400dpi - bi-level only */
- T4_RESOLUTION_200_400 = 8,
+ T4_RESOLUTION_200_400 = 0x80,
/*! 300dpi x 300dpi */
- T4_RESOLUTION_300_300 = 9,
+ T4_RESOLUTION_300_300 = 0x100,
/*! 300dpi x 600dpi - bi-level only */
- T4_RESOLUTION_300_600 = 10,
+ T4_RESOLUTION_300_600 = 0x200,
/*! 400dpi x 400dpi */
- T4_RESOLUTION_400_400 = 11,
+ T4_RESOLUTION_400_400 = 0x400,
/*! 400dpi x 800dpi - bi-level only */
- T4_RESOLUTION_400_800 = 12,
+ T4_RESOLUTION_400_800 = 0x800,
/*! 600dpi x 600dpi */
- T4_RESOLUTION_600_600 = 13,
+ T4_RESOLUTION_600_600 = 0x1000,
/*! 600dpi x 1200dpi - bi-level only */
- T4_RESOLUTION_600_1200 = 14,
+ T4_RESOLUTION_600_1200 = 0x2000,
/*! 1200dpi x 1200dpi */
- T4_RESOLUTION_1200_1200 = 15
-};
-
-enum
-{
- /*! Support standard FAX resolution 204dpi x 98dpi - bi-level only */
- T4_SUPPORT_RESOLUTION_R8_STANDARD = 0x1,
- /*! Support fine FAX resolution 204dpi x 196dpi - bi-level only */
- T4_SUPPORT_RESOLUTION_R8_FINE = 0x2,
- /*! Support super-fine FAX resolution 204dpi x 391dpi - bi-level only */
- T4_SUPPORT_RESOLUTION_R8_SUPERFINE = 0x4,
- /*! Support double FAX resolution 408dpi x 391dpi - bi-level only */
- T4_SUPPORT_RESOLUTION_R16_SUPERFINE = 0x8,
-
- /*! Support 100dpi x 100dpi - gray-scale and colour only */
- T4_SUPPORT_RESOLUTION_100_100 = 0x10,
- /*! Support 200dpi x 100dpi - bi-level only */
- T4_SUPPORT_RESOLUTION_200_100 = 0x20,
- /*! Support 200dpi x 200dpi */
- T4_SUPPORT_RESOLUTION_200_200 = 0x40,
- /*! Support 200dpi x 400dpi - bi-level only */
- T4_SUPPORT_RESOLUTION_200_400 = 0x80,
- /*! Support 300dpi x 300dpi */
- T4_SUPPORT_RESOLUTION_300_300 = 0x100,
- /*! Support 300dpi x 600dpi - bi-level only */
- T4_SUPPORT_RESOLUTION_300_600 = 0x200,
- /*! Support 400dpi x 400dpi */
- T4_SUPPORT_RESOLUTION_400_400 = 0x400,
- /*! Support 400dpi x 800dpi - bi-level only */
- T4_SUPPORT_RESOLUTION_400_800 = 0x800,
- /*! Support 600dpi x 600dpi */
- T4_SUPPORT_RESOLUTION_600_600 = 0x1000,
- /*! Support 600dpi x 1200dpi - bi-level only */
- T4_SUPPORT_RESOLUTION_600_1200 = 0x2000,
- /*! Support 1200dpi x 1200dpi */
- T4_SUPPORT_RESOLUTION_1200_1200 = 0x4000
+ T4_RESOLUTION_1200_1200 = 0x4000
};
/*!
@@ -461,14 +402,14 @@ SPAN_DECLARE(int) t4_rx_start_page(t4_rx_state_t *s);
/*! \brief Put a bit of the current document page.
\param s The T.4 context.
\param bit The data bit.
- \return TRUE when the bit ends the document page, otherwise FALSE. */
+ \return Decode status. */
SPAN_DECLARE(int) t4_rx_put_bit(t4_rx_state_t *s, int bit);
/*! \brief Put a byte of the current document page.
\param s The T.4 context.
\param buf The buffer containing the chunk.
\param len The length of the chunk.
- \return TRUE when the byte ends the document page, otherwise FALSE. */
+ \return Decode status. */
SPAN_DECLARE(int) t4_rx_put(t4_rx_state_t *s, const uint8_t buf[], size_t len);
/*! \brief Complete the reception of a page.
diff --git a/libs/spandsp/src/spandsp/t4_t6_decode.h b/libs/spandsp/src/spandsp/t4_t6_decode.h
index 16e2348fbc..aa50e5ee60 100644
--- a/libs/spandsp/src/spandsp/t4_t6_decode.h
+++ b/libs/spandsp/src/spandsp/t4_t6_decode.h
@@ -48,7 +48,7 @@ extern "C" {
/*! \brief Put a bit of the current document page.
\param s The T.4/T.6 context.
\param bit The data bit.
- \return TRUE when the bit ends the document page, otherwise FALSE. */
+ \return Decode status. */
SPAN_DECLARE(int) t4_t6_decode_put_bit(t4_t6_decode_state_t *s, int bit);
/*! \brief Put a byte of the current document page.
diff --git a/libs/spandsp/src/spandsp/t4_t6_encode.h b/libs/spandsp/src/spandsp/t4_t6_encode.h
index a157b444b9..81c6ddb3e4 100644
--- a/libs/spandsp/src/spandsp/t4_t6_encode.h
+++ b/libs/spandsp/src/spandsp/t4_t6_encode.h
@@ -77,6 +77,12 @@ SPAN_DECLARE(int) t4_t6_encode_set_encoding(t4_t6_encode_state_t *s, int encodin
\return 0 for success, otherwise -1. */
SPAN_DECLARE(int) t4_t6_encode_set_image_width(t4_t6_encode_state_t *s, int image_width);
+/*! \brief Set the length of the image.
+ \param s The T.4/T.6 context.
+ \param image_length The image length, in pixels.
+ \return 0 for success, otherwise -1. */
+SPAN_DECLARE(int) t4_t6_encode_set_image_length(t4_t6_encode_state_t *s, int image_length);
+
/*! \brief Get the width of the image.
\param s The T.4/T.6 context.
\return The width of the image, in pixels. */
diff --git a/libs/spandsp/src/spandsp/t4_tx.h b/libs/spandsp/src/spandsp/t4_tx.h
index bcf75d6c02..019e2e6cd5 100644
--- a/libs/spandsp/src/spandsp/t4_tx.h
+++ b/libs/spandsp/src/spandsp/t4_tx.h
@@ -212,6 +212,14 @@ ImageLayer(34732) LONG
#define COMPRESSION_T43 10
#endif
+typedef enum
+{
+ T4_IMAGE_FORMAT_OK = 0,
+ T4_IMAGE_FORMAT_INCOMPATIBLE = -1,
+ T4_IMAGE_FORMAT_NOSIZESUPPORT = -2,
+ T4_IMAGE_FORMAT_NORESSUPPORT = -3
+} t4_image_format_status_t;
+
#if defined(__cplusplus)
extern "C" {
#endif
@@ -267,11 +275,53 @@ SPAN_DECLARE(int) t4_tx_get_bit(t4_tx_state_t *s);
indicates that the end of the document has been reached. */
SPAN_DECLARE(int) t4_tx_get(t4_tx_state_t *s, uint8_t buf[], size_t max_len);
-/*! \brief Set the encoding for the encoded data.
+/*! \brief Get the compression for the encoded data.
\param s The T.4 context.
- \param encoding The encoding.
- \return 0 for success, otherwise -1. */
-SPAN_DECLARE(int) t4_tx_set_tx_encoding(t4_tx_state_t *s, int encoding);
+ \return the chosen compression for success, otherwise -1. */
+SPAN_DECLARE(int) t4_tx_get_tx_compression(t4_tx_state_t *s);
+
+/*! \brief Get the image type of the encoded data.
+ \param s The T.4 context.
+ \return the chosen image type for success, otherwise -1. */
+SPAN_DECLARE(int) t4_tx_get_tx_image_type(t4_tx_state_t *s);
+
+/*! \brief Get the X and Y resolution code of the current page.
+ \param s The T.4 context.
+ \return The resolution code,. */
+SPAN_DECLARE(int) t4_tx_get_tx_resolution(t4_tx_state_t *s);
+
+/*! \brief Get the column-to-column (x) resolution of the current page.
+ \param s The T.4 context.
+ \return The resolution, in pixels per metre. */
+SPAN_DECLARE(int) t4_tx_get_tx_x_resolution(t4_tx_state_t *s);
+
+/*! \brief Get the row-to-row (y) resolution of the current page.
+ \param s The T.4 context.
+ \return The resolution, in pixels per metre. */
+SPAN_DECLARE(int) t4_tx_get_tx_y_resolution(t4_tx_state_t *s);
+
+/*! \brief Get the width of the encoded data.
+ \param s The T.4 context.
+ \return the width, in pixels, for success, otherwise -1. */
+SPAN_DECLARE(int) t4_tx_get_tx_image_width(t4_tx_state_t *s);
+
+/*! \brief Get the width code of the encoded data.
+ \param s The T.4 context.
+ \return the width code, for success, otherwise -1. */
+SPAN_DECLARE(int) t4_tx_get_tx_image_width_code(t4_tx_state_t *s);
+
+/*! \brief Auto-select the format in which to send the image.
+ \param s The T.4 context.
+ \param supported_compressions The set of compressions supported for this transmission
+ \param supported_image_sizes The set of image sizes supported for this transmission
+ \param supported_bilevel_resolutions The set of bi-level resolutions supported for this transmission
+ \param supported_colour_resolutions The set of gray scale and colour resolutions supported for this transmission
+ \return A t4_image_format_status_t result code */
+SPAN_DECLARE(int) t4_tx_set_tx_image_format(t4_tx_state_t *s,
+ int supported_compressions,
+ int supported_image_sizes,
+ int supported_bilevel_resolutions,
+ int supported_colour_resolutions);
/*! \brief Set the minimum number of encoded bits per row. This allows the
makes the encoding process to be set to comply with the minimum row
@@ -280,11 +330,6 @@ SPAN_DECLARE(int) t4_tx_set_tx_encoding(t4_tx_state_t *s, int encoding);
\param bits The minimum number of bits per row. */
SPAN_DECLARE(void) t4_tx_set_min_bits_per_row(t4_tx_state_t *s, int bits);
-/*! \brief Set the width of the image.
- \param s The T.4 context.
- \param image_width The image width, in pixels. */
-SPAN_DECLARE(void) t4_tx_set_image_width(t4_tx_state_t *s, int image_width);
-
/*! \brief Set the maximum number of 2D encoded rows between 1D encoded rows. This
is only valid for T.4 2D encoding.
\param s The T.4 context.
@@ -315,8 +360,8 @@ SPAN_DECLARE(void) t4_tx_set_header_tz(t4_tx_state_t *s, tz_t *tz);
/*! Set page header extends or overlays the image mode.
\brief Set page header overlay mode.
\param s The T.4 context.
- \param header_overlays_image TRUE for overlay, or FALSE for extend the page. */
-SPAN_DECLARE(void) t4_tx_set_header_overlays_image(t4_tx_state_t *s, int header_overlays_image);
+ \param header_overlays_image True for overlay, or false to extend the page. */
+SPAN_DECLARE(void) t4_tx_set_header_overlays_image(t4_tx_state_t *s, bool header_overlays_image);
/*! \brief Set the row read handler for a T.4 transmit context.
\param s The T.4 transmit context.
@@ -325,37 +370,6 @@ SPAN_DECLARE(void) t4_tx_set_header_overlays_image(t4_tx_state_t *s, int header_
\return 0 for success, otherwise -1. */
SPAN_DECLARE(int) t4_tx_set_row_read_handler(t4_tx_state_t *s, t4_row_read_handler_t handler, void *user_data);
-/*! \brief Set the row squashing ratio, for adjusting row-to-row (y) resolution of bi-level
- images for a T.4 transmit context.
- \param s The T.4 transmit context.
- \param row_squashing_ratio Vertical squashing ratio. */
-SPAN_DECLARE(void) t4_tx_set_row_squashing_ratio(t4_tx_state_t *s, int row_squashing_ratio);
-
-/*! \brief Get the row-to-row (y) resolution of the current page.
- \param s The T.4 context.
- \return The resolution, in pixels per metre. */
-SPAN_DECLARE(int) t4_tx_get_y_resolution(t4_tx_state_t *s);
-
-/*! \brief Get the column-to-column (x) resolution of the current page.
- \param s The T.4 context.
- \return The resolution, in pixels per metre. */
-SPAN_DECLARE(int) t4_tx_get_x_resolution(t4_tx_state_t *s);
-
-/*! \brief Get the X and Y resolution code of the current page.
- \param s The T.4 context.
- \return The resolution code,. */
-SPAN_DECLARE(int) t4_tx_get_resolution(t4_tx_state_t *s);
-
-/*! \brief Get the width of the current page, in pixel columns.
- \param s The T.4 context.
- \return The number of columns. */
-SPAN_DECLARE(int) t4_tx_get_image_width(t4_tx_state_t *s);
-
-/*! \brief Get the type of the current page, in pixel columns.
- \param s The T.4 context.
- \return The type. */
-SPAN_DECLARE(int) t4_tx_get_image_type(t4_tx_state_t *s);
-
/*! \brief Get the number of pages in the file.
\param s The T.4 context.
\return The number of pages, or -1 if there is an error. */
diff --git a/libs/spandsp/src/spandsp/telephony.h b/libs/spandsp/src/spandsp/telephony.h
index 132cce9bf8..b32ecfa0f5 100644
--- a/libs/spandsp/src/spandsp/telephony.h
+++ b/libs/spandsp/src/spandsp/telephony.h
@@ -70,13 +70,6 @@ typedef int (*span_tx_handler_t)(void *s, int16_t amp[], int max_len);
#define ms_to_samples(t) ((t)*(SAMPLE_RATE/1000))
#define us_to_samples(t) ((t)/(1000000/SAMPLE_RATE))
-#if !defined(FALSE)
-#define FALSE 0
-#endif
-#if !defined(TRUE)
-#define TRUE (!FALSE)
-#endif
-
/* Fixed point constant macros */
#define FP_Q_9_7(x) ((int16_t) (128.0*x + ((x >= 0.0) ? 0.5 : -0.5)))
#define FP_Q_8_8(x) ((int16_t) (256.0*x + ((x >= 0.0) ? 0.5 : -0.5)))
diff --git a/libs/spandsp/src/spandsp/v17rx.h b/libs/spandsp/src/spandsp/v17rx.h
index 21c34f5b29..74c4b1dd8e 100644
--- a/libs/spandsp/src/spandsp/v17rx.h
+++ b/libs/spandsp/src/spandsp/v17rx.h
@@ -239,9 +239,9 @@ SPAN_DECLARE(v17_rx_state_t *) v17_rx_init(v17_rx_state_t *s, int bit_rate, put_
\brief Reinitialise an existing V.17 modem receive context.
\param s The modem context.
\param bit_rate The bit rate of the modem. Valid values are 7200, 9600, 12000 and 14400.
- \param short_train TRUE if a short training sequence is expected.
+ \param short_train True if a short training sequence is expected.
\return 0 for OK, -1 for bad parameter */
-SPAN_DECLARE(int) v17_rx_restart(v17_rx_state_t *s, int bit_rate, int short_train);
+SPAN_DECLARE(int) v17_rx_restart(v17_rx_state_t *s, int bit_rate, bool short_train);
/*! Release a V.17 modem receive context.
\brief Release a V.17 modem receive context.
diff --git a/libs/spandsp/src/spandsp/v17tx.h b/libs/spandsp/src/spandsp/v17tx.h
index 0d98cc7010..02fb7309ad 100644
--- a/libs/spandsp/src/spandsp/v17tx.h
+++ b/libs/spandsp/src/spandsp/v17tx.h
@@ -101,20 +101,20 @@ SPAN_DECLARE(void) v17_tx_power(v17_tx_state_t *s, float power);
\brief Initialise a V.17 modem transmit context.
\param s The modem context.
\param bit_rate The bit rate of the modem. Valid values are 7200, 9600, 12000 and 14400.
- \param tep TRUE is the optional TEP tone is to be transmitted.
+ \param tep True is the optional TEP tone is to be transmitted.
\param get_bit The callback routine used to get the data to be transmitted.
\param user_data An opaque pointer.
\return A pointer to the modem context, or NULL if there was a problem. */
-SPAN_DECLARE(v17_tx_state_t *) v17_tx_init(v17_tx_state_t *s, int bit_rate, int tep, get_bit_func_t get_bit, void *user_data);
+SPAN_DECLARE(v17_tx_state_t *) v17_tx_init(v17_tx_state_t *s, int bit_rate, bool tep, get_bit_func_t get_bit, void *user_data);
/*! Reinitialise an existing V.17 modem transmit context, so it may be reused.
\brief Reinitialise an existing V.17 modem transmit context.
\param s The modem context.
\param bit_rate The bit rate of the modem. Valid values are 7200, 9600, 12000 and 14400.
- \param tep TRUE is the optional TEP tone is to be transmitted.
- \param short_train TRUE if the short training sequence should be used.
+ \param tep True is the optional TEP tone is to be transmitted.
+ \param short_train True if the short training sequence should be used.
\return 0 for OK, -1 for parameter error. */
-SPAN_DECLARE(int) v17_tx_restart(v17_tx_state_t *s, int bit_rate, int tep, int short_train);
+SPAN_DECLARE(int) v17_tx_restart(v17_tx_state_t *s, int bit_rate, bool tep, bool short_train);
/*! Release a V.17 modem transmit context.
\brief Release a V.17 modem transmit context.
diff --git a/libs/spandsp/src/spandsp/v18.h b/libs/spandsp/src/spandsp/v18.h
index fbd4994a59..04c0db7c15 100644
--- a/libs/spandsp/src/spandsp/v18.h
+++ b/libs/spandsp/src/spandsp/v18.h
@@ -38,28 +38,34 @@ typedef struct v18_state_s v18_state_t;
enum
{
- V18_MODE_NONE = 0,
+ V18_MODE_NONE = 0x0001,
/* V.18 Annex A - Weitbrecht TDD at 45.45bps (US TTY), half-duplex, 5 bit baudot (USA). */
- V18_MODE_5BIT_45 = 1,
+ V18_MODE_5BIT_4545 = 0x0002,
/* V.18 Annex A - Weitbrecht TDD at 50bps (International TTY), half-duplex, 5 bit baudot (UK, Australia and others). */
- V18_MODE_5BIT_50 = 2,
+ V18_MODE_5BIT_50 = 0x0004,
/* V.18 Annex B - DTMF encoding of ASCII (Denmark, Holland and others). */
- V18_MODE_DTMF = 3,
+ V18_MODE_DTMF = 0x0008,
/* V.18 Annex C - EDT (European Deaf Telephone) 110bps, V.21, half-duplex, ASCII (Germany, Austria, Switzerland and others). */
- V18_MODE_EDT = 4,
+ V18_MODE_EDT = 0x0010,
/* V.18 Annex D - 300bps, Bell 103, duplex, ASCII (USA). */
- V18_MODE_BELL103 = 5,
+ V18_MODE_BELL103 = 0x0020,
/* V.18 Annex E - 1200bps Videotex terminals, ASCII (France). */
- V18_MODE_V23VIDEOTEX = 6,
+ V18_MODE_V23VIDEOTEX = 0x0040,
/* V.18 Annex F - V.21 text telephone, V.21, duplex, ASCII (Sweden, Norway and Finland). */
- V18_MODE_V21TEXTPHONE = 7,
+ V18_MODE_V21TEXTPHONE = 0x0080,
/* V.18 Annex G - V.18 text telephone mode. */
- V18_MODE_V18TEXTPHONE = 8
+ V18_MODE_V18TEXTPHONE = 0x0100,
+ /* V.18 Annex A - Used during probing. */
+ V18_MODE_5BIT_476 = 0x0200,
+ /* Use repetitive shift characters where character set shifts are used */
+ V18_MODE_REPETITIVE_SHIFTS_OPTION = 0x1000
};
/* Automoding sequences for different countries */
enum
{
+ V18_AUTOMODING_GLOBAL = 0,
+
/* 5-bit, V.21, V.23, EDT, DTMF, Bell 103 */
V18_AUTOMODING_AUSTRALIA,
V18_AUTOMODING_IRELAND,
@@ -89,7 +95,9 @@ enum
/* V.23, EDT, DTMF, 5-bit, V.21, Bell 103 */
V18_AUTOMODING_FRANCE,
- V18_AUTOMODING_BELGIUM
+ V18_AUTOMODING_BELGIUM,
+
+ V18_AUTOMODING_END
};
#if defined(__cplusplus)
@@ -102,15 +110,17 @@ SPAN_DECLARE(logging_state_t *) v18_get_logging_state(v18_state_t *s);
/*! Initialise a V.18 context.
\brief Initialise a V.18 context.
\param s The V.18 context.
- \param calling_party TRUE if caller mode, else answerer mode.
+ \param calling_party True if caller mode, else answerer mode.
\param mode Mode of operation.
+ \param nation National variant for automoding.
\param put_msg A callback routine called to deliver the received text
to the application.
\param user_data An opaque pointer for the callback routine.
\return A pointer to the V.18 context, or NULL if there was a problem. */
SPAN_DECLARE(v18_state_t *) v18_init(v18_state_t *s,
- int calling_party,
+ bool calling_party,
int mode,
+ int nation,
put_msg_func_t put_msg,
void *user_data);
@@ -163,28 +173,6 @@ SPAN_DECLARE_NONSTD(int) v18_rx_fillin(v18_state_t *s, int len);
invalid, this function will return -1. */
SPAN_DECLARE(int) v18_put(v18_state_t *s, const char msg[], int len);
-/*! Convert a text string to a V.18 DTMF string.
- \brief Convert a text string to a V.18 DTMF string.
- \param s The V.18 context.
- \param dtmf The resulting DTMF string.
- \param msg The text string to be converted.
- \return The length of the DTMF string.
-*/
-SPAN_DECLARE(int) v18_encode_dtmf(v18_state_t *s, char dtmf[], const char msg[]);
-
-/*! Convert a V.18 DTMF string to a text string.
- \brief Convert a V.18 DTMF string to a text string.
- \param s The V.18 context.
- \param msg The resulting test string.
- \param dtmf The DTMF string to be converted.
- \return The length of the text string.
-*/
-SPAN_DECLARE(int) v18_decode_dtmf(v18_state_t *s, char msg[], const char dtmf[]);
-
-SPAN_DECLARE(uint16_t) v18_encode_baudot(v18_state_t *s, uint8_t ch);
-
-SPAN_DECLARE(uint8_t) v18_decode_baudot(v18_state_t *s, uint8_t ch);
-
/*! \brief Return a short name for an V.18 mode
\param mode The code for the V.18 mode.
\return A pointer to the name.
diff --git a/libs/spandsp/src/spandsp/v22bis.h b/libs/spandsp/src/spandsp/v22bis.h
index 6361c05841..f20656919f 100644
--- a/libs/spandsp/src/spandsp/v22bis.h
+++ b/libs/spandsp/src/spandsp/v22bis.h
@@ -155,9 +155,9 @@ SPAN_DECLARE(int) v22bis_request_retrain(v22bis_state_t *s, int bit_rate);
/*! Request a loopback 2 for a V.22bis modem context.
\brief Request a loopback 2 for a V.22bis modem context.
\param s The modem context.
- \param enable TRUE to enable loopback, or FALSE to disable it.
+ \param enable True to enable loopback, or false to disable it.
\return 0 for OK, -1 for request reject. */
-SPAN_DECLARE(int) v22bis_remote_loopback(v22bis_state_t *s, int enable);
+SPAN_DECLARE(int) v22bis_remote_loopback(v22bis_state_t *s, bool enable);
/*! Report the current operating bit rate of a V.22bis modem context.
\brief Report the current operating bit rate of a V.22bis modem context
@@ -170,7 +170,7 @@ SPAN_DECLARE(int) v22bis_get_current_bit_rate(v22bis_state_t *s);
\param s The modem context.
\param bit_rate The bit rate of the modem. Valid values are 1200 and 2400.
\param guard The guard tone option. 0 = none, 1 = 550Hz, 2 = 1800Hz.
- \param calling_party TRUE if this is the calling modem.
+ \param calling_party True if this is the calling modem.
\param get_bit The callback routine used to get the data to be transmitted.
\param put_bit The callback routine used to get the data to be transmitted.
\param user_data An opaque pointer, passed in calls to the get and put routines.
@@ -178,7 +178,7 @@ SPAN_DECLARE(int) v22bis_get_current_bit_rate(v22bis_state_t *s);
SPAN_DECLARE(v22bis_state_t *) v22bis_init(v22bis_state_t *s,
int bit_rate,
int guard,
- int calling_party,
+ bool calling_party,
get_bit_func_t get_bit,
void *get_bit_user_data,
put_bit_func_t put_bit,
diff --git a/libs/spandsp/src/spandsp/v27ter_rx.h b/libs/spandsp/src/spandsp/v27ter_rx.h
index 5881f4cf02..80fdb3655f 100644
--- a/libs/spandsp/src/spandsp/v27ter_rx.h
+++ b/libs/spandsp/src/spandsp/v27ter_rx.h
@@ -74,9 +74,9 @@ SPAN_DECLARE(v27ter_rx_state_t *) v27ter_rx_init(v27ter_rx_state_t *s, int bit_r
\brief Reinitialise an existing V.27ter modem receive context.
\param s The modem context.
\param bit_rate The bit rate of the modem. Valid values are 2400 and 4800.
- \param old_train TRUE if a previous trained values are to be reused.
+ \param old_train True if a previous trained values are to be reused.
\return 0 for OK, -1 for bad parameter */
-SPAN_DECLARE(int) v27ter_rx_restart(v27ter_rx_state_t *s, int bit_rate, int old_train);
+SPAN_DECLARE(int) v27ter_rx_restart(v27ter_rx_state_t *s, int bit_rate, bool old_train);
/*! Release a V.27ter modem receive context.
\brief Release a V.27ter modem receive context.
diff --git a/libs/spandsp/src/spandsp/v27ter_tx.h b/libs/spandsp/src/spandsp/v27ter_tx.h
index e785c889ec..fba064fea0 100644
--- a/libs/spandsp/src/spandsp/v27ter_tx.h
+++ b/libs/spandsp/src/spandsp/v27ter_tx.h
@@ -83,19 +83,19 @@ SPAN_DECLARE(void) v27ter_tx_power(v27ter_tx_state_t *s, float power);
\brief Initialise a V.27ter modem transmit context.
\param s The modem context.
\param bit_rate The bit rate of the modem. Valid values are 2400 and 4800.
- \param tep TRUE is the optional TEP tone is to be transmitted.
+ \param tep True is the optional TEP tone is to be transmitted.
\param get_bit The callback routine used to get the data to be transmitted.
\param user_data An opaque pointer.
\return A pointer to the modem context, or NULL if there was a problem. */
-SPAN_DECLARE(v27ter_tx_state_t *) v27ter_tx_init(v27ter_tx_state_t *s, int bit_rate, int tep, get_bit_func_t get_bit, void *user_data);
+SPAN_DECLARE(v27ter_tx_state_t *) v27ter_tx_init(v27ter_tx_state_t *s, int bit_rate, bool tep, get_bit_func_t get_bit, void *user_data);
/*! Reinitialise an existing V.27ter modem transmit context, so it may be reused.
\brief Reinitialise an existing V.27ter modem transmit context.
\param s The modem context.
\param bit_rate The bit rate of the modem. Valid values are 2400 and 4800.
- \param tep TRUE is the optional TEP tone is to be transmitted.
+ \param tep True is the optional TEP tone is to be transmitted.
\return 0 for OK, -1 for bad parameter */
-SPAN_DECLARE(int) v27ter_tx_restart(v27ter_tx_state_t *s, int bit_rate, int tep);
+SPAN_DECLARE(int) v27ter_tx_restart(v27ter_tx_state_t *s, int bit_rate, bool tep);
/*! Release a V.27ter modem transmit context.
\brief Release a V.27ter modem transmit context.
diff --git a/libs/spandsp/src/spandsp/v29rx.h b/libs/spandsp/src/spandsp/v29rx.h
index ec3a945ad4..378d4fe955 100644
--- a/libs/spandsp/src/spandsp/v29rx.h
+++ b/libs/spandsp/src/spandsp/v29rx.h
@@ -154,9 +154,9 @@ SPAN_DECLARE(v29_rx_state_t *) v29_rx_init(v29_rx_state_t *s, int bit_rate, put_
\brief Reinitialise an existing V.29 modem receive context.
\param s The modem context.
\param bit_rate The bit rate of the modem. Valid values are 4800, 7200 and 9600.
- \param old_train TRUE if a previous trained values are to be reused.
+ \param old_train True if a previous trained values are to be reused.
\return 0 for OK, -1 for bad parameter */
-SPAN_DECLARE(int) v29_rx_restart(v29_rx_state_t *s, int bit_rate, int old_train);
+SPAN_DECLARE(int) v29_rx_restart(v29_rx_state_t *s, int bit_rate, bool old_train);
/*! Release a V.29 modem receive context.
\brief Release a V.29 modem receive context.
diff --git a/libs/spandsp/src/spandsp/v29tx.h b/libs/spandsp/src/spandsp/v29tx.h
index 86737d1ba3..18bcf66b6a 100644
--- a/libs/spandsp/src/spandsp/v29tx.h
+++ b/libs/spandsp/src/spandsp/v29tx.h
@@ -114,19 +114,19 @@ SPAN_DECLARE(void) v29_tx_power(v29_tx_state_t *s, float power);
\brief Initialise a V.29 modem transmit context.
\param s The modem context.
\param bit_rate The bit rate of the modem. Valid values are 4800, 7200 and 9600.
- \param tep TRUE is the optional TEP tone is to be transmitted.
+ \param tep True is the optional TEP tone is to be transmitted.
\param get_bit The callback routine used to get the data to be transmitted.
\param user_data An opaque pointer.
\return A pointer to the modem context, or NULL if there was a problem. */
-SPAN_DECLARE(v29_tx_state_t *) v29_tx_init(v29_tx_state_t *s, int bit_rate, int tep, get_bit_func_t get_bit, void *user_data);
+SPAN_DECLARE(v29_tx_state_t *) v29_tx_init(v29_tx_state_t *s, int bit_rate, bool tep, get_bit_func_t get_bit, void *user_data);
/*! Reinitialise an existing V.29 modem transmit context, so it may be reused.
\brief Reinitialise an existing V.29 modem transmit context.
\param s The modem context.
\param bit_rate The bit rate of the modem. Valid values are 4800, 7200 and 9600.
- \param tep TRUE is the optional TEP tone is to be transmitted.
+ \param tep True is the optional TEP tone is to be transmitted.
\return 0 for OK, -1 for bad parameter */
-SPAN_DECLARE(int) v29_tx_restart(v29_tx_state_t *s, int bit_rate, int tep);
+SPAN_DECLARE(int) v29_tx_restart(v29_tx_state_t *s, int bit_rate, bool tep);
/*! Release a V.29 modem transmit context.
\brief Release a V.29 modem transmit context.
diff --git a/libs/spandsp/src/spandsp/v42.h b/libs/spandsp/src/spandsp/v42.h
index 6332e5cd61..8002d43eed 100644
--- a/libs/spandsp/src/spandsp/v42.h
+++ b/libs/spandsp/src/spandsp/v42.h
@@ -78,16 +78,16 @@ SPAN_DECLARE(logging_state_t *) v42_get_logging_state(v42_state_t *s);
/*! Initialise a V.42 context.
\param s The V.42 context.
- \param calling_party TRUE if caller mode, else answerer mode.
- \param detect TRUE to perform the V.42 detection, else go straight into LAP.M
+ \param calling_party True if caller mode, else answerer mode.
+ \param detect True to perform the V.42 detection, else go straight into LAP.M
\param iframe_get A callback function to handle received frames of data.
\param iframe_put A callback function to get frames of data for transmission.
\param user_data An opaque pointer passed to the frame handler routines.
\return ???
*/
SPAN_DECLARE(v42_state_t *) v42_init(v42_state_t *s,
- int calling_party,
- int detect,
+ bool calling_party,
+ bool detect,
get_msg_func_t iframe_get,
put_msg_func_t iframe_put,
void *user_data);
diff --git a/libs/spandsp/src/spandsp/v8.h b/libs/spandsp/src/spandsp/v8.h
index 0c1924c1e8..9ded271aec 100644
--- a/libs/spandsp/src/spandsp/v8.h
+++ b/libs/spandsp/src/spandsp/v8.h
@@ -135,19 +135,19 @@ extern "C"
#endif
SPAN_DECLARE(int) v8_restart(v8_state_t *s,
- int calling_party,
+ bool calling_party,
v8_parms_t *parms);
/*! Initialise a V.8 context.
\brief Initialise a V.8 context.
\param s The V.8 context.
- \param calling_party TRUE if caller mode, else answerer mode.
+ \param calling_party True if caller mode, else answerer mode.
\param parms The allowed parameters for the call.
\param result_handler The callback routine used to handle the results of negotiation.
\param user_data An opaque pointer passed to the result_handler routine.
\return A pointer to the V.8 context, or NULL if there was a problem. */
SPAN_DECLARE(v8_state_t *) v8_init(v8_state_t *s,
- int calling_party,
+ bool calling_party,
v8_parms_t *parms,
v8_result_handler_t result_handler,
void *user_data);
diff --git a/libs/spandsp/src/super_tone_rx.c b/libs/spandsp/src/super_tone_rx.c
index e46faa8148..eabebe6a30 100644
--- a/libs/spandsp/src/super_tone_rx.c
+++ b/libs/spandsp/src/super_tone_rx.c
@@ -45,6 +45,7 @@
#include "floating_fudge.h"
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/complex.h"
#include "spandsp/vector_float.h"
@@ -95,7 +96,7 @@ static int add_super_tone_freq(super_tone_rx_descriptor_t *desc, int freq)
desc->pitches[i][1] = desc->monitored_frequencies;
if (desc->monitored_frequencies%5 == 0)
{
- desc->desc = (goertzel_descriptor_t *) realloc(desc->desc, (desc->monitored_frequencies + 5)*sizeof(goertzel_descriptor_t));
+ desc->desc = (goertzel_descriptor_t *) span_realloc(desc->desc, (desc->monitored_frequencies + 5)*sizeof(goertzel_descriptor_t));
}
make_goertzel_descriptor(&desc->desc[desc->monitored_frequencies++], (float) freq, SUPER_TONE_BINS);
desc->used_frequencies++;
@@ -107,8 +108,8 @@ SPAN_DECLARE(int) super_tone_rx_add_tone(super_tone_rx_descriptor_t *desc)
{
if (desc->tones%5 == 0)
{
- desc->tone_list = (super_tone_rx_segment_t **) realloc(desc->tone_list, (desc->tones + 5)*sizeof(super_tone_rx_segment_t *));
- desc->tone_segs = (int *) realloc(desc->tone_segs, (desc->tones + 5)*sizeof(int));
+ desc->tone_list = (super_tone_rx_segment_t **) span_realloc(desc->tone_list, (desc->tones + 5)*sizeof(super_tone_rx_segment_t *));
+ desc->tone_segs = (int *) span_realloc(desc->tone_segs, (desc->tones + 5)*sizeof(int));
}
desc->tone_list[desc->tones] = NULL;
desc->tone_segs[desc->tones] = 0;
@@ -129,7 +130,7 @@ SPAN_DECLARE(int) super_tone_rx_add_element(super_tone_rx_descriptor_t *desc,
step = desc->tone_segs[tone];
if (step%5 == 0)
{
- desc->tone_list[tone] = (super_tone_rx_segment_t *) realloc(desc->tone_list[tone], (step + 5)*sizeof(super_tone_rx_segment_t));
+ desc->tone_list[tone] = (super_tone_rx_segment_t *) span_realloc(desc->tone_list[tone], (step + 5)*sizeof(super_tone_rx_segment_t));
}
desc->tone_list[tone][step].f1 = add_super_tone_freq(desc, f1);
desc->tone_list[tone][step].f2 = add_super_tone_freq(desc, f2);
@@ -199,7 +200,7 @@ SPAN_DECLARE(super_tone_rx_descriptor_t *) super_tone_rx_make_descriptor(super_t
{
if (desc == NULL)
{
- if ((desc = (super_tone_rx_descriptor_t *) malloc(sizeof(*desc))) == NULL)
+ if ((desc = (super_tone_rx_descriptor_t *) span_alloc(sizeof(*desc))) == NULL)
return NULL;
}
desc->tone_list = NULL;
@@ -222,15 +223,15 @@ SPAN_DECLARE(int) super_tone_rx_free_descriptor(super_tone_rx_descriptor_t *desc
for (i = 0; i < desc->tones; i++)
{
if (desc->tone_list[i])
- free(desc->tone_list[i]);
+ span_free(desc->tone_list[i]);
}
if (desc->tone_list)
- free(desc->tone_list);
+ span_free(desc->tone_list);
if (desc->tone_segs)
- free(desc->tone_segs);
+ span_free(desc->tone_segs);
if (desc->desc)
- free(desc->desc);
- free(desc);
+ span_free(desc->desc);
+ span_free(desc);
}
return 0;
}
@@ -265,7 +266,7 @@ SPAN_DECLARE(super_tone_rx_state_t *) super_tone_rx_init(super_tone_rx_state_t *
return NULL;
if (s == NULL)
{
- if ((s = (super_tone_rx_state_t *) malloc(sizeof(*s) + desc->monitored_frequencies*sizeof(goertzel_state_t))) == NULL)
+ if ((s = (super_tone_rx_state_t *) span_alloc(sizeof(*s) + desc->monitored_frequencies*sizeof(goertzel_state_t))) == NULL)
return NULL;
}
@@ -301,7 +302,7 @@ SPAN_DECLARE(int) super_tone_rx_release(super_tone_rx_state_t *s)
SPAN_DECLARE(int) super_tone_rx_free(super_tone_rx_state_t *s)
{
if (s)
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
diff --git a/libs/spandsp/src/super_tone_tx.c b/libs/spandsp/src/super_tone_tx.c
index 3809bb4bf8..5b8ab4303d 100644
--- a/libs/spandsp/src/super_tone_tx.c
+++ b/libs/spandsp/src/super_tone_tx.c
@@ -45,6 +45,7 @@
#include "floating_fudge.h"
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/complex.h"
#include "spandsp/dds.h"
@@ -78,7 +79,7 @@ SPAN_DECLARE(super_tone_tx_step_t *) super_tone_tx_make_step(super_tone_tx_step_
{
if (s == NULL)
{
- if ((s = (super_tone_tx_step_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (super_tone_tx_step_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
if (f1 >= 1.0f)
@@ -121,7 +122,7 @@ SPAN_DECLARE(int) super_tone_tx_free_tone(super_tone_tx_step_t *s)
super_tone_tx_free_tone(s->nest);
t = s;
s = s->next;
- free(t);
+ span_free(t);
}
return 0;
}
@@ -133,7 +134,7 @@ SPAN_DECLARE(super_tone_tx_state_t *) super_tone_tx_init(super_tone_tx_state_t *
return NULL;
if (s == NULL)
{
- if ((s = (super_tone_tx_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (super_tone_tx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -155,7 +156,7 @@ SPAN_DECLARE(int) super_tone_tx_release(super_tone_tx_state_t *s)
SPAN_DECLARE(int) super_tone_tx_free(super_tone_tx_state_t *s)
{
if (s)
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
diff --git a/libs/spandsp/src/swept_tone.c b/libs/spandsp/src/swept_tone.c
index f5ccc9bed8..d371bb2828 100644
--- a/libs/spandsp/src/swept_tone.c
+++ b/libs/spandsp/src/swept_tone.c
@@ -39,9 +39,15 @@
#if defined(HAVE_MATH_H)
#include
#endif
+#if defined(HAVE_STDBOOL_H)
+#include
+#else
+#include "spandsp/stdbool.h"
+#endif
#include "floating_fudge.h"
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/complex.h"
#include "spandsp/vector_float.h"
@@ -59,7 +65,7 @@ SPAN_DECLARE(swept_tone_state_t *) swept_tone_init(swept_tone_state_t *s, float
{
if (s == NULL)
{
- if ((s = (swept_tone_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (swept_tone_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -119,7 +125,7 @@ SPAN_DECLARE(int) swept_tone_release(swept_tone_state_t *s)
SPAN_DECLARE(int) swept_tone_free(swept_tone_state_t *s)
{
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
diff --git a/libs/spandsp/src/t30.c b/libs/spandsp/src/t30.c
index 66a5271bf3..1d3555a97d 100644
--- a/libs/spandsp/src/t30.c
+++ b/libs/spandsp/src/t30.c
@@ -41,10 +41,16 @@
#if defined(HAVE_MATH_H)
#include
#endif
+#if defined(HAVE_STDBOOL_H)
+#include
+#else
+#include "spandsp/stdbool.h"
+#endif
#include "floating_fudge.h"
#include
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/bit_operations.h"
#include "spandsp/queue.h"
@@ -434,8 +440,7 @@ static void disconnect(t30_state_t *s);
static void decode_20digit_msg(t30_state_t *s, char *msg, const uint8_t *pkt, int len);
static void decode_url_msg(t30_state_t *s, char *msg, const uint8_t *pkt, int len);
static int decode_nsf_nss_nsc(t30_state_t *s, uint8_t *msg[], const uint8_t *pkt, int len);
-static int set_min_scan_time_code(t30_state_t *s);
-static int send_cfr_sequence(t30_state_t *s, int start);
+static void set_min_scan_time(t30_state_t *s);
static void timer_t2_start(t30_state_t *s);
static void timer_t2a_start(t30_state_t *s);
static void timer_t2b_start(t30_state_t *s);
@@ -637,89 +642,89 @@ static void release_resources(t30_state_t *s)
{
if (s->tx_info.nsf)
{
- free(s->tx_info.nsf);
+ span_free(s->tx_info.nsf);
s->tx_info.nsf = NULL;
}
s->tx_info.nsf_len = 0;
if (s->tx_info.nsc)
{
- free(s->tx_info.nsc);
+ span_free(s->tx_info.nsc);
s->tx_info.nsc = NULL;
}
s->tx_info.nsc_len = 0;
if (s->tx_info.nss)
{
- free(s->tx_info.nss);
+ span_free(s->tx_info.nss);
s->tx_info.nss = NULL;
}
s->tx_info.nss_len = 0;
if (s->tx_info.tsa)
{
- free(s->tx_info.tsa);
+ span_free(s->tx_info.tsa);
s->tx_info.tsa = NULL;
}
if (s->tx_info.ira)
{
- free(s->tx_info.ira);
+ span_free(s->tx_info.ira);
s->tx_info.ira = NULL;
}
if (s->tx_info.cia)
{
- free(s->tx_info.cia);
+ span_free(s->tx_info.cia);
s->tx_info.cia = NULL;
}
if (s->tx_info.isp)
{
- free(s->tx_info.isp);
+ span_free(s->tx_info.isp);
s->tx_info.isp = NULL;
}
if (s->tx_info.csa)
{
- free(s->tx_info.csa);
+ span_free(s->tx_info.csa);
s->tx_info.csa = NULL;
}
if (s->rx_info.nsf)
{
- free(s->rx_info.nsf);
+ span_free(s->rx_info.nsf);
s->rx_info.nsf = NULL;
}
s->rx_info.nsf_len = 0;
if (s->rx_info.nsc)
{
- free(s->rx_info.nsc);
+ span_free(s->rx_info.nsc);
s->rx_info.nsc = NULL;
}
s->rx_info.nsc_len = 0;
if (s->rx_info.nss)
{
- free(s->rx_info.nss);
+ span_free(s->rx_info.nss);
s->rx_info.nss = NULL;
}
s->rx_info.nss_len = 0;
if (s->rx_info.tsa)
{
- free(s->rx_info.tsa);
+ span_free(s->rx_info.tsa);
s->rx_info.tsa = NULL;
}
if (s->rx_info.ira)
{
- free(s->rx_info.ira);
+ span_free(s->rx_info.ira);
s->rx_info.ira = NULL;
}
if (s->rx_info.cia)
{
- free(s->rx_info.cia);
+ span_free(s->rx_info.cia);
s->rx_info.cia = NULL;
}
if (s->rx_info.isp)
{
- free(s->rx_info.isp);
+ span_free(s->rx_info.isp);
s->rx_info.isp = NULL;
}
if (s->rx_info.csa)
{
- free(s->rx_info.csa);
+ span_free(s->rx_info.csa);
s->rx_info.csa = NULL;
}
}
@@ -748,7 +753,7 @@ static uint8_t check_next_tx_step(t30_state_t *s)
if (s->document_handler)
more = s->document_handler(s, s->document_user_data, 0);
else
- more = FALSE;
+ more = false;
if (more)
{
span_log(&s->logging, SPAN_LOG_FLOW, "Another document to send\n");
@@ -795,7 +800,7 @@ static int get_partial_ecm_page(t30_state_t *s)
}
s->ecm_frames = i;
span_log(&s->logging, SPAN_LOG_FLOW, "Partial page buffer contains %d frames (%d per frame)\n", i, s->octets_per_ecm_frame);
- s->ecm_at_page_end = TRUE;
+ s->ecm_at_page_end = true;
return i;
}
s->ecm_len[i] = (int16_t) (4 + len);
@@ -844,7 +849,7 @@ static int send_next_ecm_frame(t30_state_t *s)
send_frame(s, frame, 3);
/* In case we are just after a CTC/CTR exchange, which kicked us back
to long training */
- s->short_train = TRUE;
+ s->short_train = true;
return 0;
}
return -1;
@@ -892,7 +897,7 @@ static void send_frame(t30_state_t *s, const uint8_t *msg, int len)
print_frame(s, "Tx: ", msg, len);
if (s->real_time_frame_handler)
- s->real_time_frame_handler(s, s->real_time_frame_user_data, FALSE, msg, len);
+ s->real_time_frame_handler(s, s->real_time_frame_user_data, false, msg, len);
if (s->send_hdlc_handler)
s->send_hdlc_handler(s->send_hdlc_user_data, msg, len);
}
@@ -939,9 +944,9 @@ static int send_nsf_frame(t30_state_t *s)
s->tx_info.nsf[1] = CONTROL_FIELD_NON_FINAL_FRAME;
s->tx_info.nsf[2] = (uint8_t) (T30_NSF | s->dis_received);
send_frame(s, s->tx_info.nsf, s->tx_info.nsf_len + 3);
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
/*- End of function --------------------------------------------------------*/
@@ -955,9 +960,9 @@ static int send_nss_frame(t30_state_t *s)
s->tx_info.nss[1] = CONTROL_FIELD_NON_FINAL_FRAME;
s->tx_info.nss[2] = (uint8_t) (T30_NSS | s->dis_received);
send_frame(s, s->tx_info.nss, s->tx_info.nss_len + 3);
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
/*- End of function --------------------------------------------------------*/
@@ -971,9 +976,9 @@ static int send_nsc_frame(t30_state_t *s)
s->tx_info.nsc[1] = CONTROL_FIELD_NON_FINAL_FRAME;
s->tx_info.nsc[2] = (uint8_t) (T30_NSC | s->dis_received);
send_frame(s, s->tx_info.nsc, s->tx_info.nsc_len + 3);
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
/*- End of function --------------------------------------------------------*/
@@ -984,9 +989,9 @@ static int send_ident_frame(t30_state_t *s, uint8_t cmd)
span_log(&s->logging, SPAN_LOG_FLOW, "Sending ident '%s'\n", s->tx_info.ident);
/* 'cmd' should be T30_TSI, T30_CIG or T30_CSI */
send_20digit_msg_frame(s, cmd, s->tx_info.ident);
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
/*- End of function --------------------------------------------------------*/
@@ -997,10 +1002,10 @@ static int send_psa_frame(t30_state_t *s)
span_log(&s->logging, SPAN_LOG_FLOW, "Sending polled sub-address '%s'\n", s->tx_info.polled_sub_address);
send_20digit_msg_frame(s, T30_PSA, s->tx_info.polled_sub_address);
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_POLLED_SUBADDRESSING_CAPABLE);
- return TRUE;
+ return true;
}
clr_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_POLLED_SUBADDRESSING_CAPABLE);
- return FALSE;
+ return false;
}
/*- End of function --------------------------------------------------------*/
@@ -1011,10 +1016,10 @@ static int send_sep_frame(t30_state_t *s)
span_log(&s->logging, SPAN_LOG_FLOW, "Sending selective polling address '%s'\n", s->tx_info.selective_polling_address);
send_20digit_msg_frame(s, T30_SEP, s->tx_info.selective_polling_address);
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_SELECTIVE_POLLING_CAPABLE);
- return TRUE;
+ return true;
}
clr_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_SELECTIVE_POLLING_CAPABLE);
- return FALSE;
+ return false;
}
/*- End of function --------------------------------------------------------*/
@@ -1026,10 +1031,10 @@ static int send_sid_frame(t30_state_t *s)
span_log(&s->logging, SPAN_LOG_FLOW, "Sending sender identification '%s'\n", s->tx_info.sender_ident);
send_20digit_msg_frame(s, T30_SID, s->tx_info.sender_ident);
set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_SENDER_ID_TRANSMISSION);
- return TRUE;
+ return true;
}
clr_ctrl_bit(s->dcs_frame, T30_DCS_BIT_SENDER_ID_TRANSMISSION);
- return FALSE;
+ return false;
}
/*- End of function --------------------------------------------------------*/
@@ -1041,10 +1046,10 @@ static int send_pwd_frame(t30_state_t *s)
span_log(&s->logging, SPAN_LOG_FLOW, "Sending password '%s'\n", s->tx_info.password);
send_20digit_msg_frame(s, T30_PWD, s->tx_info.password);
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_PASSWORD);
- return TRUE;
+ return true;
}
clr_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_PASSWORD);
- return FALSE;
+ return false;
}
/*- End of function --------------------------------------------------------*/
@@ -1056,10 +1061,10 @@ static int send_sub_frame(t30_state_t *s)
span_log(&s->logging, SPAN_LOG_FLOW, "Sending sub-address '%s'\n", s->tx_info.sub_address);
send_20digit_msg_frame(s, T30_SUB, s->tx_info.sub_address);
set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_SUBADDRESS_TRANSMISSION);
- return TRUE;
+ return true;
}
clr_ctrl_bit(s->dcs_frame, T30_DCS_BIT_SUBADDRESS_TRANSMISSION);
- return FALSE;
+ return false;
}
/*- End of function --------------------------------------------------------*/
@@ -1068,9 +1073,9 @@ static int send_tsa_frame(t30_state_t *s)
if ((test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T37) || test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T38)) && 0)
{
span_log(&s->logging, SPAN_LOG_FLOW, "Sending transmitting subscriber internet address '%s'\n", "");
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
/*- End of function --------------------------------------------------------*/
@@ -1080,10 +1085,10 @@ static int send_ira_frame(t30_state_t *s)
{
span_log(&s->logging, SPAN_LOG_FLOW, "Sending internet routing address '%s'\n", "");
set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_INTERNET_ROUTING_ADDRESS_TRANSMISSION);
- return TRUE;
+ return true;
}
clr_ctrl_bit(s->dcs_frame, T30_DCS_BIT_INTERNET_ROUTING_ADDRESS_TRANSMISSION);
- return FALSE;
+ return false;
}
/*- End of function --------------------------------------------------------*/
@@ -1092,9 +1097,9 @@ static int send_cia_frame(t30_state_t *s)
if ((test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T37) || test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T38)) && 0)
{
span_log(&s->logging, SPAN_LOG_FLOW, "Sending calling subscriber internet address '%s'\n", "");
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
/*- End of function --------------------------------------------------------*/
@@ -1104,10 +1109,10 @@ static int send_isp_frame(t30_state_t *s)
{
span_log(&s->logging, SPAN_LOG_FLOW, "Sending internet selective polling address '%s'\n", "");
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_INTERNET_SELECTIVE_POLLING_ADDRESS);
- return TRUE;
+ return true;
}
clr_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_INTERNET_SELECTIVE_POLLING_ADDRESS);
- return FALSE;
+ return false;
}
/*- End of function --------------------------------------------------------*/
@@ -1117,10 +1122,10 @@ static int send_csa_frame(t30_state_t *s)
if (("in T.37 mode" || "in T.38 mode") && 0)
{
span_log(&s->logging, SPAN_LOG_FLOW, "Sending called subscriber internet address '%s'\n", "");
- return TRUE;
+ return true;
}
#endif
- return FALSE;
+ return false;
}
/*- End of function --------------------------------------------------------*/
@@ -1195,9 +1200,9 @@ int t30_build_dis_or_dtc(t30_state_t *s)
/* No scan-line padding required, but some may be specified by the application. */
set_ctrl_bits(s->local_dis_dtc_frame, s->local_min_scan_time_code, T30_DIS_BIT_MIN_SCAN_LINE_TIME_CAPABILITY_1);
- if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T4_2D))
+ if ((s->supported_compressions & T4_COMPRESSION_T4_2D))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_2D_CAPABLE);
- if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_NONE))
+ if ((s->supported_compressions & T4_COMPRESSION_NONE))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_UNCOMPRESSED_CAPABLE);
if (s->ecm_allowed)
{
@@ -1206,50 +1211,55 @@ int t30_build_dis_or_dtc(t30_state_t *s)
/* Only offer the option of fancy compression schemes, if we are
also offering the ECM option needed to support them. */
- if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T6))
+ if ((s->supported_compressions & T4_COMPRESSION_T6))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T6_CAPABLE);
- if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T85))
+ if ((s->supported_compressions & T4_COMPRESSION_T85))
{
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T85_CAPABLE);
/* Bit 79 set with bit 78 clear is invalid, so only check for L0
support here. */
- if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T85_L0))
+ if ((s->supported_compressions & T4_COMPRESSION_T85_L0))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T85_L0_CAPABLE);
}
- if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_COLOUR))
- set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_FULL_COLOUR_CAPABLE);
-
- if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T42_T81))
- set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T81_CAPABLE);
- if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T43))
- {
- /* Note 25 of table 2/T.30 */
- set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T43_CAPABLE);
- set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T81_CAPABLE);
- }
- if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T45))
- set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T45_CAPABLE);
- if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_SYCC_T81))
- {
- set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T81_CAPABLE);
- set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_SYCC_T81_CAPABLE);
- }
- //if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T88))
+ //if ((s->supported_compressions & T4_COMPRESSION_T88))
//{
// set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T88_CAPABILITY_1);
// set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T88_CAPABILITY_2);
// set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T88_CAPABILITY_3);
//}
- if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_12BIT))
- set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_12BIT_CAPABLE);
+ if ((s->supported_compressions & (T4_COMPRESSION_COLOUR | T4_COMPRESSION_GRAYSCALE)))
+ {
+ if ((s->supported_compressions & T4_COMPRESSION_COLOUR))
+ set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_FULL_COLOUR_CAPABLE);
- //if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_NO_SUBSAMPLING))
- // set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_NO_SUBSAMPLING);
+ if ((s->supported_compressions & T4_COMPRESSION_T42_T81))
+ set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T81_CAPABLE);
+ if ((s->supported_compressions & T4_COMPRESSION_T43))
+ {
+ /* Note 25 of table 2/T.30 */
+ set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T81_CAPABLE);
+ set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T43_CAPABLE);
+ /* No plane interleave */
+ }
+ if ((s->supported_compressions & T4_COMPRESSION_T45))
+ set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T45_CAPABLE);
+ if ((s->supported_compressions & T4_COMPRESSION_SYCC_T81))
+ {
+ set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T81_CAPABLE);
+ set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_SYCC_T81_CAPABLE);
+ }
- /* No custom illuminant */
- /* No custom gamut range */
+ if ((s->supported_compressions & T4_COMPRESSION_12BIT))
+ set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_12BIT_CAPABLE);
+
+ if ((s->supported_compressions & T4_COMPRESSION_NO_SUBSAMPLING))
+ set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_NO_SUBSAMPLING);
+
+ /* No custom illuminant */
+ /* No custom gamut range */
+ }
}
if ((s->supported_t30_features & T30_SUPPORT_FIELD_NOT_VALID))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_FNV_CAPABLE);
@@ -1257,12 +1267,6 @@ int t30_build_dis_or_dtc(t30_state_t *s)
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_MULTIPLE_SELECTIVE_POLLING_CAPABLE);
if ((s->supported_t30_features & T30_SUPPORT_POLLED_SUB_ADDRESSING))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_POLLED_SUBADDRESSING_CAPABLE);
-
- /* No plane interleave */
- /* No G.726 */
- /* No extended voice coding */
- /* Superfine minimum scan line time pattern follows fine */
-
if ((s->supported_t30_features & T30_SUPPORT_SELECTIVE_POLLING))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_SELECTIVE_POLLING_CAPABLE);
if ((s->supported_t30_features & T30_SUPPORT_SUB_ADDRESSING))
@@ -1270,10 +1274,16 @@ int t30_build_dis_or_dtc(t30_state_t *s)
if ((s->supported_t30_features & T30_SUPPORT_IDENTIFICATION))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_PASSWORD);
+ /* No G.726 */
+ /* No extended voice coding */
+ /* Superfine minimum scan line time pattern follows fine */
+
/* Ready to transmit a data file (polling) */
if (s->tx_file[0])
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_READY_TO_TRANSMIT_DATA_FILE);
+ /* No simple phase C BFT negotiations */
+ /* No extended BFT negotiations */
/* No Binary file transfer (BFT) */
/* No Document transfer mode (DTM) */
/* No Electronic data interchange (EDI) */
@@ -1295,67 +1305,65 @@ int t30_build_dis_or_dtc(t30_state_t *s)
/* No HFX40-I hashing */
/* No alternative hashing system number 2 */
/* No alternative hashing system number 3 */
- /* No T.44 (mixed raster content) */
+ /* No T.44 (mixed raster content) */
/* No page length maximum strip size for T.44 (mixed raster content) */
- /* No simple phase C BFT negotiations */
- /* No extended BFT negotiations */
if ((s->supported_t30_features & T30_SUPPORT_INTERNET_SELECTIVE_POLLING_ADDRESS))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_INTERNET_SELECTIVE_POLLING_ADDRESS);
if ((s->supported_t30_features & T30_SUPPORT_INTERNET_ROUTING_ADDRESS))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_INTERNET_ROUTING_ADDRESS);
- if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_1200_1200))
+ if ((s->supported_bilevel_resolutions & T4_RESOLUTION_1200_1200))
{
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_1200_1200_CAPABLE);
- if ((s->supported_colour_resolutions & T4_SUPPORT_RESOLUTION_1200_1200))
+ if ((s->supported_colour_resolutions & T4_RESOLUTION_1200_1200))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_1200_1200_CAPABLE);
}
- if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_600_1200))
+ if ((s->supported_bilevel_resolutions & T4_RESOLUTION_600_1200))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_600_1200_CAPABLE);
- if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_600_600))
+ if ((s->supported_bilevel_resolutions & T4_RESOLUTION_600_600))
{
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_600_600_CAPABLE);
- if ((s->supported_colour_resolutions & T4_SUPPORT_RESOLUTION_600_600))
+ if ((s->supported_colour_resolutions & T4_RESOLUTION_600_600))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_600_600_CAPABLE);
}
- if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_400_800))
+ if ((s->supported_bilevel_resolutions & T4_RESOLUTION_400_800))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_400_800_CAPABLE);
- if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_R16_SUPERFINE))
+ if ((s->supported_bilevel_resolutions & T4_RESOLUTION_R16_SUPERFINE))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_400_400_CAPABLE);
- if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_400_400))
+ if ((s->supported_bilevel_resolutions & T4_RESOLUTION_400_400))
{
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_400_400_CAPABLE);
- if ((s->supported_colour_resolutions & T4_SUPPORT_RESOLUTION_400_400))
+ if ((s->supported_colour_resolutions & T4_RESOLUTION_400_400))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_300_300_400_400_CAPABLE);
}
- if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_300_600))
+ if ((s->supported_bilevel_resolutions & T4_RESOLUTION_300_600))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_300_600_CAPABLE);
- if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_300_300))
+ if ((s->supported_bilevel_resolutions & T4_RESOLUTION_300_300))
{
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_300_300_CAPABLE);
- if ((s->supported_colour_resolutions & T4_SUPPORT_RESOLUTION_300_300))
+ if ((s->supported_colour_resolutions & T4_RESOLUTION_300_300))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_300_300_400_400_CAPABLE);
}
- if ((s->supported_bilevel_resolutions & (T4_SUPPORT_RESOLUTION_200_400 | T4_SUPPORT_RESOLUTION_R8_SUPERFINE)))
+ if ((s->supported_bilevel_resolutions & (T4_RESOLUTION_200_400 | T4_RESOLUTION_R8_SUPERFINE)))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_200_400_CAPABLE);
- if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_R8_FINE))
+ if ((s->supported_bilevel_resolutions & T4_RESOLUTION_R8_FINE))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_200_200_CAPABLE);
- if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_200_200))
+ if ((s->supported_bilevel_resolutions & T4_RESOLUTION_200_200))
{
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_200_200_CAPABLE);
- if ((s->supported_colour_resolutions & T4_SUPPORT_RESOLUTION_200_200))
+ if ((s->supported_colour_resolutions & T4_RESOLUTION_200_200))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_FULL_COLOUR_CAPABLE);
}
/* Standard FAX resolution bi-level image support goes without saying */
- if ((s->supported_colour_resolutions & T4_SUPPORT_RESOLUTION_100_100))
+ if ((s->supported_colour_resolutions & T4_RESOLUTION_100_100))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_100_100_CAPABLE);
- if ((s->supported_bilevel_resolutions & (T4_SUPPORT_RESOLUTION_R8_STANDARD | T4_SUPPORT_RESOLUTION_R8_FINE | T4_SUPPORT_RESOLUTION_R8_SUPERFINE | T4_SUPPORT_RESOLUTION_R16_SUPERFINE)))
- set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_INCH_RESOLUTION_PREFERRED);
- if ((s->supported_bilevel_resolutions & (T4_SUPPORT_RESOLUTION_200_100 | T4_SUPPORT_RESOLUTION_200_200 | T4_SUPPORT_RESOLUTION_200_400 | T4_SUPPORT_RESOLUTION_300_300 | T4_SUPPORT_RESOLUTION_300_600 | T4_SUPPORT_RESOLUTION_400_400 | T4_SUPPORT_RESOLUTION_400_800 | T4_SUPPORT_RESOLUTION_600_600 | T4_SUPPORT_RESOLUTION_600_1200 | T4_SUPPORT_RESOLUTION_1200_1200)))
+ if ((s->supported_bilevel_resolutions & (T4_RESOLUTION_R8_STANDARD | T4_RESOLUTION_R8_FINE | T4_RESOLUTION_R8_SUPERFINE | T4_RESOLUTION_R16_SUPERFINE)))
set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_METRIC_RESOLUTION_PREFERRED);
+ if ((s->supported_bilevel_resolutions & (T4_RESOLUTION_200_100 | T4_RESOLUTION_200_200 | T4_RESOLUTION_200_400 | T4_RESOLUTION_300_300 | T4_RESOLUTION_300_600 | T4_RESOLUTION_400_400 | T4_RESOLUTION_400_800 | T4_RESOLUTION_600_600 | T4_RESOLUTION_600_1200 | T4_RESOLUTION_1200_1200)))
+ set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_INCH_RESOLUTION_PREFERRED);
/* No double sided printing (alternate mode) */
/* No double sided printing (continuous mode) */
@@ -1420,17 +1428,15 @@ static int prune_dis_dtc(t30_state_t *s)
static int build_dcs(t30_state_t *s)
{
int i;
- int bad;
- int row_squashing_ratio;
int use_bilevel;
int image_type;
/* Reacquire page information, in case the image was resized, flattened, etc. */
- s->x_resolution = t4_tx_get_x_resolution(&s->t4.tx);
- s->y_resolution = t4_tx_get_y_resolution(&s->t4.tx);
- s->current_page_resolution = t4_tx_get_resolution(&s->t4.tx);
- s->image_width = t4_tx_get_image_width(&s->t4.tx);
- image_type = t4_tx_get_image_type(&s->t4.tx);
+ s->current_page_resolution = t4_tx_get_tx_resolution(&s->t4.tx);
+ s->x_resolution = t4_tx_get_tx_x_resolution(&s->t4.tx);
+ s->y_resolution = t4_tx_get_tx_y_resolution(&s->t4.tx);
+ s->image_width = t4_tx_get_tx_image_width(&s->t4.tx);
+ image_type = t4_tx_get_tx_image_type(&s->t4.tx);
/* Make a DCS frame based on local issues and the latest received DIS/DTC frame.
Negotiate the result based on what both parties can do. */
@@ -1456,7 +1462,7 @@ static int build_dcs(t30_state_t *s)
s->dcs_frame[4] |= fallback_sequence[s->current_fallback].dcs_code;
/* Select the compression to use. */
- use_bilevel = TRUE;
+ use_bilevel = true;
set_ctrl_bits(s->dcs_frame, s->min_scan_time_code, T30_DCS_BIT_MIN_SCAN_LINE_TIME_1);
switch (s->line_compression)
{
@@ -1490,7 +1496,7 @@ static int build_dcs(t30_state_t *s)
//if (???????? & T4_COMPRESSION_?????))
// set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_PREFERRED_HUFFMAN_TABLES);
set_ctrl_bits(s->dcs_frame, T30_MIN_SCAN_0MS, T30_DCS_BIT_MIN_SCAN_LINE_TIME_1);
- use_bilevel = FALSE;
+ use_bilevel = false;
break;
#if defined(SPANDSP_SUPPORT_T43)
case T4_COMPRESSION_T43:
@@ -1502,17 +1508,17 @@ static int build_dcs(t30_state_t *s)
//if (???????? & T4_COMPRESSION_NO_SUBSAMPLING))
// set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_NO_SUBSAMPLING);
set_ctrl_bits(s->dcs_frame, T30_MIN_SCAN_0MS, T30_DCS_BIT_MIN_SCAN_LINE_TIME_1);
- use_bilevel = FALSE;
+ use_bilevel = false;
break;
#endif
#if defined(SPANDSP_SUPPORT_T45)
case T4_COMPRESSION_T45:
- use_bilevel = FALSE;
+ use_bilevel = false;
break;
#endif
#if defined(SPANDSP_SUPPORT_SYCC_T81)
case T4_COMPRESSION_SYCC_T81:
- use_bilevel = FALSE;
+ use_bilevel = false;
break;
#endif
default:
@@ -1520,229 +1526,21 @@ static int build_dcs(t30_state_t *s)
break;
}
- /* Set the Y resolution bits */
- row_squashing_ratio = 1;
- bad = T30_ERR_NORESSUPPORT;
- if ((use_bilevel && (s->current_page_resolution & s->mutual_bilevel_resolutions))
- ||
- (!use_bilevel && (s->current_page_resolution & s->mutual_colour_resolutions)))
+ /* Set the image width */
+ switch (s->line_width_code)
{
- /* The resolution is supported by both parties */
- switch (s->current_page_resolution)
- {
- case T4_RESOLUTION_1200_1200:
- set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_1200_1200);
- set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_INCH_RESOLUTION);
- if (!use_bilevel)
- set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_COLOUR_GRAY_1200_1200);
- break;
- case T4_RESOLUTION_600_1200:
- set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_600_1200);
- set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_INCH_RESOLUTION);
- break;
- case T4_RESOLUTION_600_600:
- set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_600_600);
- set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_INCH_RESOLUTION);
- if (!use_bilevel)
- set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_COLOUR_GRAY_600_600);
- break;
- case T4_RESOLUTION_400_800:
- set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_400_800);
- set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_INCH_RESOLUTION);
- break;
- case T4_RESOLUTION_400_400:
- set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_400_400);
- set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_INCH_RESOLUTION);
- if (!use_bilevel)
- set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_COLOUR_GRAY_300_300_400_400);
- break;
- case T4_RESOLUTION_300_600:
- set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_300_600);
- set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_INCH_RESOLUTION);
- break;
- case T4_RESOLUTION_300_300:
- set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_300_300);
- set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_INCH_RESOLUTION);
- if (!use_bilevel)
- set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_COLOUR_GRAY_300_300_400_400);
- break;
- case T4_RESOLUTION_200_400:
- set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_200_400);
- set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_INCH_RESOLUTION);
- break;
- case T4_RESOLUTION_200_200:
- set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_200_200);
- set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_INCH_RESOLUTION);
- if (!use_bilevel)
- set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_FULL_COLOUR_MODE);
- break;
- case T4_RESOLUTION_200_100:
- set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_INCH_RESOLUTION);
- break;
- case T4_RESOLUTION_100_100:
- set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_INCH_RESOLUTION);
- if (!use_bilevel)
- set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_COLOUR_GRAY_100_100);
- break;
- case T4_RESOLUTION_R16_SUPERFINE:
- set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_400_400);
- break;
- case T4_RESOLUTION_R8_SUPERFINE:
- set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_200_400);
- break;
- case T4_RESOLUTION_R8_FINE:
- set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_200_200);
- break;
- case T4_RESOLUTION_R8_STANDARD:
- /* Nothing special to set */
- break;
- }
- bad = T30_ERR_OK;
- }
- else
- {
-#if 0
- /* Deal with resolution fudging */
- if ((s->current_page_resolution & (T4_RESOLUTION_R16_SUPERFINE | T4_RESOLUTION_R8_SUPERFINE | T4_RESOLUTION_R8_FINE | T4_RESOLUTION_R8_STANDARD)))
- {
- if ((s->mutual_bilevel_resolutions & (T4_RESOLUTION_400_400 | T4_RESOLUTION_200_400 | T4_RESOLUTION_200_200 | T4_RESOLUTION_200_100)))
- {
- /* Fudge between imperial and metric */
- }
- }
- else if ((s->current_page_resolution & (T4_RESOLUTION_400_400 | T4_RESOLUTION_200_400 | T4_RESOLUTION_200_200 | T4_RESOLUTION_200_100))
- {
- if ((s->mutual_bilevel_resolutions & (T4_RESOLUTION_R16_SUPERFINE | T4_RESOLUTION_R8_SUPERFINE | T4_RESOLUTION_R8_FINE | T4_RESOLUTION_R8_STANDARD)))
- {
- /* Fudge between imperial and metric */
- }
- }
-#endif
- /* Deal with squashing options */
- if ((s->current_page_resolution & T4_RESOLUTION_R8_SUPERFINE))
- {
- if ((s->mutual_bilevel_resolutions & T4_RESOLUTION_R8_FINE))
- {
- set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_200_200);
- row_squashing_ratio = 2;
- bad = T30_ERR_OK;
- }
- else if ((s->mutual_bilevel_resolutions & T4_RESOLUTION_R8_STANDARD))
- {
- row_squashing_ratio = 4;
- bad = T30_ERR_OK;
- }
- }
- else if ((s->current_page_resolution & T4_RESOLUTION_R8_FINE) && (s->mutual_bilevel_resolutions & T4_RESOLUTION_R8_STANDARD))
- {
- row_squashing_ratio = 2;
- bad = T30_ERR_OK;
- }
- else if ((s->current_page_resolution & T4_RESOLUTION_200_400))
- {
- if ((s->mutual_bilevel_resolutions & T4_RESOLUTION_200_200))
- {
- set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_200_200);
- row_squashing_ratio = 2;
- bad = T30_ERR_OK;
- }
- else if ((s->mutual_bilevel_resolutions & T4_RESOLUTION_200_100))
- {
- row_squashing_ratio = 4;
- bad = T30_ERR_OK;
- }
- }
- else if ((s->current_page_resolution & T4_RESOLUTION_200_200) && (s->mutual_bilevel_resolutions & T4_RESOLUTION_200_100))
- {
- row_squashing_ratio = 2;
- bad = T30_ERR_OK;
- }
- }
-
- t4_tx_set_row_squashing_ratio(&s->t4.tx, row_squashing_ratio);
- if (bad != T30_ERR_OK)
- {
- t30_set_status(s, bad);
- span_log(&s->logging, SPAN_LOG_FLOW, "Image resolution (%d x %d) not acceptable\n", s->x_resolution, s->y_resolution);
- return -1;
- }
-
- /* Deal with the image width. */
- /* Low (R4) res widths are not supported in recent versions of T.30 */
- bad = T30_ERR_OK;
- /* The following treats a width field of 11 like 10, which does what note 6 of Table 2/T.30
- says we should do with the invalid value 11. */
- if (((s->image_width == T4_WIDTH_200_A4) && (s->x_resolution == T4_X_RESOLUTION_200 || s->x_resolution == T4_X_RESOLUTION_R8))
- ||
- ((s->image_width == T4_WIDTH_300_A4) && (s->x_resolution == T4_X_RESOLUTION_300))
- ||
- ((s->image_width == T4_WIDTH_400_A4) && (s->x_resolution == T4_X_RESOLUTION_400 || s->x_resolution == T4_X_RESOLUTION_R16))
- ||
- ((s->image_width == T4_WIDTH_600_A4) && (s->x_resolution == T4_X_RESOLUTION_600))
- ||
- ((s->image_width == T4_WIDTH_1200_A4) && (s->x_resolution == T4_X_RESOLUTION_1200)))
- {
- span_log(&s->logging, SPAN_LOG_FLOW, "Image width is A4 at %ddpi x %ddpi\n", s->x_resolution, s->y_resolution);
+ case T4_SUPPORT_WIDTH_215MM:
+ span_log(&s->logging, SPAN_LOG_FLOW, "Image width is A4 at %ddpm x %ddpm\n", s->x_resolution, s->y_resolution);
/* No width related bits need to be set. */
- }
- else if (((s->image_width == T4_WIDTH_200_B4) && (s->x_resolution == T4_X_RESOLUTION_200 || s->x_resolution == T4_X_RESOLUTION_R8))
- ||
- ((s->image_width == T4_WIDTH_300_B4) && (s->x_resolution == T4_X_RESOLUTION_300))
- ||
- ((s->image_width == T4_WIDTH_400_B4) && (s->x_resolution == T4_X_RESOLUTION_400 || s->x_resolution == T4_X_RESOLUTION_R16))
- ||
- ((s->image_width == T4_WIDTH_600_B4) && (s->x_resolution == T4_X_RESOLUTION_600))
- ||
- ((s->image_width == T4_WIDTH_1200_B4) && (s->x_resolution == T4_X_RESOLUTION_1200)))
- {
- if ((s->mutual_image_sizes & T4_SUPPORT_WIDTH_255MM))
- {
- span_log(&s->logging, SPAN_LOG_FLOW, "Image width is B4 at %ddpi x %ddpi\n", s->x_resolution, s->y_resolution);
- set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_255MM_WIDTH);
- }
- else
- {
- /* We do not support this width and resolution combination */
- bad = T30_ERR_NOSIZESUPPORT;
- }
- }
- else if (((s->image_width == T4_WIDTH_200_A3) && (s->x_resolution == T4_X_RESOLUTION_200 || s->x_resolution == T4_X_RESOLUTION_R8))
- ||
- ((s->image_width == T4_WIDTH_300_A3) && (s->x_resolution == T4_X_RESOLUTION_300))
- ||
- ((s->image_width == T4_WIDTH_400_A3) && (s->x_resolution == T4_X_RESOLUTION_400 || s->x_resolution == T4_X_RESOLUTION_R16))
- ||
- ((s->image_width == T4_WIDTH_600_A3) && (s->x_resolution == T4_X_RESOLUTION_600))
- ||
- ((s->image_width == T4_WIDTH_1200_A3) && (s->x_resolution == T4_X_RESOLUTION_1200)))
- {
- if ((s->mutual_image_sizes & T4_SUPPORT_WIDTH_303MM))
- {
- span_log(&s->logging, SPAN_LOG_FLOW, "Image width is A3 at %ddpi x %ddpi\n", s->x_resolution, s->y_resolution);
- set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_303MM_WIDTH);
- }
- else
- {
- /* We do not support this width and resolution combination */
- bad = T30_ERR_NOSIZESUPPORT;
- }
- }
- else
- {
- /* We do not support this width and resolution combination */
- bad = T30_ERR_NOSIZESUPPORT;
- }
-
- if (bad != T30_ERR_OK)
- {
- t30_set_status(s, bad);
- span_log(&s->logging,
- SPAN_LOG_FLOW,
- "Image width (%d pixels) and resolution (%d x %d) is not an acceptable\n",
- s->image_width,
- s->x_resolution,
- s->y_resolution);
- return -1;
+ break;
+ case T4_SUPPORT_WIDTH_255MM:
+ set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_255MM_WIDTH);
+ span_log(&s->logging, SPAN_LOG_FLOW, "Image width is B4 at %ddpm x %ddpm\n", s->x_resolution, s->y_resolution);
+ break;
+ case T4_SUPPORT_WIDTH_303MM:
+ set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_303MM_WIDTH);
+ span_log(&s->logging, SPAN_LOG_FLOW, "Image width is A3 at %ddpm x %ddpm\n", s->x_resolution, s->y_resolution);
+ break;
}
/* Set the image length */
@@ -1757,6 +1555,77 @@ static int build_dcs(t30_state_t *s)
else if ((s->mutual_image_sizes & T4_SUPPORT_LENGTH_US_LEGAL))
set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_NORTH_AMERICAN_LEGAL);
+ /* Set the Y resolution bits */
+ switch (s->current_page_resolution)
+ {
+ case T4_RESOLUTION_1200_1200:
+ set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_1200_1200);
+ set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_INCH_RESOLUTION);
+ if (!use_bilevel)
+ set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_COLOUR_GRAY_1200_1200);
+ break;
+ case T4_RESOLUTION_600_1200:
+ set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_600_1200);
+ set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_INCH_RESOLUTION);
+ break;
+ case T4_RESOLUTION_600_600:
+ set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_600_600);
+ set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_INCH_RESOLUTION);
+ if (!use_bilevel)
+ set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_COLOUR_GRAY_600_600);
+ break;
+ case T4_RESOLUTION_400_800:
+ set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_400_800);
+ set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_INCH_RESOLUTION);
+ break;
+ case T4_RESOLUTION_400_400:
+ set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_400_400);
+ set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_INCH_RESOLUTION);
+ if (!use_bilevel)
+ set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_COLOUR_GRAY_300_300_400_400);
+ break;
+ case T4_RESOLUTION_300_600:
+ set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_300_600);
+ set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_INCH_RESOLUTION);
+ break;
+ case T4_RESOLUTION_300_300:
+ set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_300_300);
+ set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_INCH_RESOLUTION);
+ if (!use_bilevel)
+ set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_COLOUR_GRAY_300_300_400_400);
+ break;
+ case T4_RESOLUTION_200_400:
+ set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_200_400);
+ set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_INCH_RESOLUTION);
+ break;
+ case T4_RESOLUTION_200_200:
+ set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_200_200);
+ set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_INCH_RESOLUTION);
+ if (!use_bilevel)
+ set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_FULL_COLOUR_MODE);
+ break;
+ case T4_RESOLUTION_200_100:
+ set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_INCH_RESOLUTION);
+ break;
+ case T4_RESOLUTION_100_100:
+ set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_INCH_RESOLUTION);
+ if (!use_bilevel)
+ set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_COLOUR_GRAY_100_100);
+ break;
+ case T4_RESOLUTION_R16_SUPERFINE:
+ set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_400_400);
+ break;
+ case T4_RESOLUTION_R8_SUPERFINE:
+ set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_200_400);
+ break;
+ case T4_RESOLUTION_R8_FINE:
+ set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_200_200);
+ break;
+ case T4_RESOLUTION_R8_STANDARD:
+ /* Nothing special to set */
+ break;
+ }
+
if (s->error_correcting_mode)
set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_ECM_MODE);
@@ -1810,7 +1679,7 @@ static int analyze_rx_dis_dtc(t30_state_t *s, const uint8_t *msg, int len)
}
if (msg[2] == T30_DIS)
- s->dis_received = TRUE;
+ s->dis_received = true;
/* Make a local copy of the message, padded to the maximum possible length with zeros. This allows
us to simply pick out the bits, without worrying about whether they were set from the remote side. */
@@ -1829,42 +1698,42 @@ static int analyze_rx_dis_dtc(t30_state_t *s, const uint8_t *msg, int len)
if (!s->error_correcting_mode)
{
/* Remove any compression schemes which need error correction to work. */
- s->mutual_compressions &= (0xF0000000 | T4_SUPPORT_COMPRESSION_NONE | T4_SUPPORT_COMPRESSION_T4_1D | T4_SUPPORT_COMPRESSION_T4_2D);
+ s->mutual_compressions &= (0xFF800000 | T4_COMPRESSION_NONE | T4_COMPRESSION_T4_1D | T4_COMPRESSION_T4_2D);
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_2D_CAPABLE))
- s->mutual_compressions &= ~T4_SUPPORT_COMPRESSION_T4_2D;
+ s->mutual_compressions &= ~T4_COMPRESSION_T4_2D;
}
else
{
/* Check the bi-level capabilities */
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_2D_CAPABLE))
- s->mutual_compressions &= ~T4_SUPPORT_COMPRESSION_T4_2D;
+ s->mutual_compressions &= ~T4_COMPRESSION_T4_2D;
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T6_CAPABLE))
- s->mutual_compressions &= ~T4_SUPPORT_COMPRESSION_T6;
+ s->mutual_compressions &= ~T4_COMPRESSION_T6;
/* T.85 L0 capable without T.85 capable is an invalid combination, so let
just zap both capabilities if the far end is not T.85 capable. */
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T85_CAPABLE))
- s->mutual_compressions &= ~(T4_SUPPORT_COMPRESSION_T85 | T4_SUPPORT_COMPRESSION_T85_L0);
+ s->mutual_compressions &= ~(T4_COMPRESSION_T85 | T4_COMPRESSION_T85_L0);
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T85_L0_CAPABLE))
- s->mutual_compressions &= ~T4_SUPPORT_COMPRESSION_T85_L0;
+ s->mutual_compressions &= ~T4_COMPRESSION_T85_L0;
/* Check for full colour or only gray-scale from the multi-level codecs */
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_FULL_COLOUR_CAPABLE))
- s->mutual_compressions &= ~T4_SUPPORT_COMPRESSION_COLOUR;
+ s->mutual_compressions &= ~T4_COMPRESSION_COLOUR;
/* Check the colour capabilities */
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T81_CAPABLE))
- s->mutual_compressions &= ~T4_SUPPORT_COMPRESSION_T42_T81;
+ s->mutual_compressions &= ~T4_COMPRESSION_T42_T81;
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_SYCC_T81_CAPABLE))
- s->mutual_compressions &= ~T4_SUPPORT_COMPRESSION_SYCC_T81;
+ s->mutual_compressions &= ~T4_COMPRESSION_SYCC_T81;
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T43_CAPABLE))
- s->mutual_compressions &= ~T4_SUPPORT_COMPRESSION_T43;
+ s->mutual_compressions &= ~T4_COMPRESSION_T43;
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T45_CAPABLE))
- s->mutual_compressions &= ~T4_SUPPORT_COMPRESSION_T45;
+ s->mutual_compressions &= ~T4_COMPRESSION_T45;
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_12BIT_CAPABLE))
- s->mutual_compressions &= ~T4_SUPPORT_COMPRESSION_12BIT;
- //if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_NO_SUBSAMPLING))
- // ???? = T4_COMPRESSION_T42_T81_SUBSAMPLING;
+ s->mutual_compressions &= ~T4_COMPRESSION_12BIT;
+ if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_NO_SUBSAMPLING))
+ s->mutual_compressions &= ~T4_COMPRESSION_NO_SUBSAMPLING;
/* bit74 custom illuminant */
/* bit75 custom gamut range */
@@ -1874,75 +1743,75 @@ static int analyze_rx_dis_dtc(t30_state_t *s, const uint8_t *msg, int len)
s->mutual_colour_resolutions = s->supported_colour_resolutions;
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_1200_1200_CAPABLE))
{
- s->mutual_bilevel_resolutions &= ~T4_SUPPORT_RESOLUTION_1200_1200;
- s->mutual_colour_resolutions &= ~T4_SUPPORT_RESOLUTION_1200_1200;
+ s->mutual_bilevel_resolutions &= ~T4_RESOLUTION_1200_1200;
+ s->mutual_colour_resolutions &= ~T4_RESOLUTION_1200_1200;
}
else
{
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_1200_1200_CAPABLE))
- s->mutual_colour_resolutions &= ~T4_SUPPORT_RESOLUTION_1200_1200;
+ s->mutual_colour_resolutions &= ~T4_RESOLUTION_1200_1200;
}
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_600_1200_CAPABLE))
- s->mutual_bilevel_resolutions &= ~T4_SUPPORT_RESOLUTION_600_1200;
+ s->mutual_bilevel_resolutions &= ~T4_RESOLUTION_600_1200;
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_600_600_CAPABLE))
{
- s->mutual_bilevel_resolutions &= ~T4_SUPPORT_RESOLUTION_600_600;
- s->mutual_colour_resolutions &= ~T4_SUPPORT_RESOLUTION_600_600;
+ s->mutual_bilevel_resolutions &= ~T4_RESOLUTION_600_600;
+ s->mutual_colour_resolutions &= ~T4_RESOLUTION_600_600;
}
else
{
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_600_600_CAPABLE))
- s->mutual_colour_resolutions &= ~T4_SUPPORT_RESOLUTION_600_600;
+ s->mutual_colour_resolutions &= ~T4_RESOLUTION_600_600;
}
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_400_800_CAPABLE))
- s->mutual_bilevel_resolutions &= ~T4_SUPPORT_RESOLUTION_400_800;
+ s->mutual_bilevel_resolutions &= ~T4_RESOLUTION_400_800;
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_400_400_CAPABLE))
{
- s->mutual_bilevel_resolutions &= ~(T4_SUPPORT_RESOLUTION_400_400 | T4_SUPPORT_RESOLUTION_R16_SUPERFINE);
- s->mutual_colour_resolutions &= ~T4_SUPPORT_RESOLUTION_400_400;
+ s->mutual_bilevel_resolutions &= ~(T4_RESOLUTION_400_400 | T4_RESOLUTION_R16_SUPERFINE);
+ s->mutual_colour_resolutions &= ~T4_RESOLUTION_400_400;
}
else
{
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_300_300_400_400_CAPABLE))
- s->mutual_colour_resolutions &= ~T4_SUPPORT_RESOLUTION_400_400;
+ s->mutual_colour_resolutions &= ~T4_RESOLUTION_400_400;
}
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_300_600_CAPABLE))
- s->mutual_bilevel_resolutions &= ~T4_SUPPORT_RESOLUTION_300_600;
+ s->mutual_bilevel_resolutions &= ~T4_RESOLUTION_300_600;
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_300_300_CAPABLE))
{
- s->mutual_bilevel_resolutions &= ~T4_SUPPORT_RESOLUTION_300_300;
- s->mutual_colour_resolutions &= ~T4_SUPPORT_RESOLUTION_300_300;
+ s->mutual_bilevel_resolutions &= ~T4_RESOLUTION_300_300;
+ s->mutual_colour_resolutions &= ~T4_RESOLUTION_300_300;
}
else
{
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_300_300_400_400_CAPABLE))
- s->mutual_colour_resolutions &= ~T4_SUPPORT_RESOLUTION_300_300;
+ s->mutual_colour_resolutions &= ~T4_RESOLUTION_300_300;
}
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_200_400_CAPABLE))
{
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_INCH_RESOLUTION_PREFERRED))
- s->mutual_bilevel_resolutions &= ~T4_SUPPORT_RESOLUTION_200_400;
+ s->mutual_bilevel_resolutions &= ~T4_RESOLUTION_200_400;
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_METRIC_RESOLUTION_PREFERRED))
- s->mutual_bilevel_resolutions &= ~T4_SUPPORT_RESOLUTION_R8_SUPERFINE;
+ s->mutual_bilevel_resolutions &= ~T4_RESOLUTION_R8_SUPERFINE;
}
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_200_200_CAPABLE))
{
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_INCH_RESOLUTION_PREFERRED))
- s->mutual_bilevel_resolutions &= ~T4_SUPPORT_RESOLUTION_200_200;
+ s->mutual_bilevel_resolutions &= ~T4_RESOLUTION_200_200;
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_METRIC_RESOLUTION_PREFERRED))
- s->mutual_bilevel_resolutions &= ~T4_SUPPORT_RESOLUTION_R8_FINE;
- s->mutual_colour_resolutions &= ~T4_SUPPORT_RESOLUTION_200_200;
+ s->mutual_bilevel_resolutions &= ~T4_RESOLUTION_R8_FINE;
+ s->mutual_colour_resolutions &= ~T4_RESOLUTION_200_200;
}
else
{
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_INCH_RESOLUTION_PREFERRED))
- s->mutual_colour_resolutions &= ~T4_SUPPORT_RESOLUTION_200_200;
+ s->mutual_colour_resolutions &= ~T4_RESOLUTION_200_200;
}
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_INCH_RESOLUTION_PREFERRED))
- s->mutual_bilevel_resolutions &= ~T4_SUPPORT_RESOLUTION_200_100;
- /* Never suppress T4_SUPPORT_RESOLUTION_R8_STANDARD */
+ s->mutual_bilevel_resolutions &= ~T4_RESOLUTION_200_100;
+ /* Never suppress T4_RESOLUTION_R8_STANDARD */
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_COLOUR_GRAY_100_100_CAPABLE))
- s->mutual_colour_resolutions &= ~T4_SUPPORT_RESOLUTION_100_100;
+ s->mutual_colour_resolutions &= ~T4_RESOLUTION_100_100;
s->mutual_image_sizes = s->supported_image_sizes;
/* 215mm wide is always supported */
@@ -2068,7 +1937,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
/* Note 35 of Table 2/T.30 */
if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_FULL_COLOUR_MODE))
{
- if ((s->supported_colour_resolutions & T4_SUPPORT_COMPRESSION_COLOUR))
+ if ((s->supported_colour_resolutions & T4_COMPRESSION_COLOUR))
{
/* We are going to work in full colour mode */
}
@@ -2076,7 +1945,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_12BIT_COMPONENT))
{
- if ((s->supported_colour_resolutions & T4_SUPPORT_COMPRESSION_12BIT))
+ if ((s->supported_colour_resolutions & T4_COMPRESSION_12BIT))
{
/* We are going to work in 12 bit mode */
}
@@ -2084,17 +1953,17 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_NO_SUBSAMPLING))
{
- //???? = T4_SUPPORT_COMPRESSION_T42_T81_SUBSAMPLING;
+ //???? = T4_COMPRESSION_NO_SUBSAMPLING;
}
if (!test_ctrl_bit(dcs_frame, T30_DCS_BIT_PREFERRED_HUFFMAN_TABLES))
{
- //???? = T4_SUPPORT_COMPRESSION_T42_T81_HUFFMAN;
+ //???? = T4_COMPRESSION_T42_T81_HUFFMAN;
}
if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_COLOUR_GRAY_1200_1200))
{
- if ((s->supported_colour_resolutions & T4_SUPPORT_RESOLUTION_1200_1200))
+ if ((s->supported_colour_resolutions & T4_RESOLUTION_1200_1200))
{
s->x_resolution = T4_X_RESOLUTION_1200;
s->y_resolution = T4_Y_RESOLUTION_1200;
@@ -2104,7 +1973,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
}
else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_COLOUR_GRAY_600_600))
{
- if ((s->supported_colour_resolutions & T4_SUPPORT_RESOLUTION_600_600))
+ if ((s->supported_colour_resolutions & T4_RESOLUTION_600_600))
{
s->x_resolution = T4_X_RESOLUTION_600;
s->y_resolution = T4_Y_RESOLUTION_600;
@@ -2114,7 +1983,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
}
else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_400_400))
{
- if ((s->supported_colour_resolutions & T4_SUPPORT_RESOLUTION_400_400))
+ if ((s->supported_colour_resolutions & T4_RESOLUTION_400_400))
{
s->x_resolution = T4_X_RESOLUTION_400;
s->y_resolution = T4_Y_RESOLUTION_400;
@@ -2124,7 +1993,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
}
else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_300_300))
{
- if ((s->supported_colour_resolutions & T4_SUPPORT_RESOLUTION_300_300))
+ if ((s->supported_colour_resolutions & T4_RESOLUTION_300_300))
{
s->x_resolution = T4_X_RESOLUTION_300;
s->y_resolution = T4_Y_RESOLUTION_300;
@@ -2134,7 +2003,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
}
else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_200_200))
{
- if ((s->supported_colour_resolutions & T4_SUPPORT_RESOLUTION_200_200))
+ if ((s->supported_colour_resolutions & T4_RESOLUTION_200_200))
{
s->x_resolution = T4_X_RESOLUTION_200;
s->y_resolution = T4_Y_RESOLUTION_200;
@@ -2144,7 +2013,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
}
else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_COLOUR_GRAY_100_100))
{
- if ((s->supported_colour_resolutions & T4_SUPPORT_RESOLUTION_100_100))
+ if ((s->supported_colour_resolutions & T4_RESOLUTION_100_100))
{
s->x_resolution = T4_X_RESOLUTION_100;
s->y_resolution = T4_Y_RESOLUTION_100;
@@ -2156,22 +2025,22 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
/* Check which compression the far end has decided to use. */
if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_T81_MODE))
{
- if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T42_T81))
+ if ((s->supported_compressions & T4_COMPRESSION_T42_T81))
s->line_compression = T4_COMPRESSION_T42_T81;
}
else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_T43_MODE))
{
- if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T43))
+ if ((s->supported_compressions & T4_COMPRESSION_T43))
s->line_compression = T4_COMPRESSION_T43;
}
else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_T45_MODE))
{
- if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T45))
+ if ((s->supported_compressions & T4_COMPRESSION_T45))
s->line_compression = T4_COMPRESSION_T45;
}
else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_SYCC_T81_MODE))
{
- if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_SYCC_T81))
+ if ((s->supported_compressions & T4_COMPRESSION_SYCC_T81))
s->line_compression = T4_COMPRESSION_SYCC_T81;
}
}
@@ -2180,7 +2049,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
/* Bi-level image */
if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_1200_1200))
{
- if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_1200_1200))
+ if ((s->supported_bilevel_resolutions & T4_RESOLUTION_1200_1200))
{
s->x_resolution = T4_X_RESOLUTION_1200;
s->y_resolution = T4_Y_RESOLUTION_1200;
@@ -2190,7 +2059,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
}
else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_600_1200))
{
- if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_600_1200))
+ if ((s->supported_bilevel_resolutions & T4_RESOLUTION_600_1200))
{
s->x_resolution = T4_X_RESOLUTION_600;
s->y_resolution = T4_Y_RESOLUTION_1200;
@@ -2200,7 +2069,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
}
else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_600_600))
{
- if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_600_600))
+ if ((s->supported_bilevel_resolutions & T4_RESOLUTION_600_600))
{
s->x_resolution = T4_X_RESOLUTION_600;
s->y_resolution = T4_Y_RESOLUTION_600;
@@ -2210,7 +2079,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
}
else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_400_800))
{
- if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_400_800))
+ if ((s->supported_bilevel_resolutions & T4_RESOLUTION_400_800))
{
s->x_resolution = T4_X_RESOLUTION_400;
s->y_resolution = T4_Y_RESOLUTION_800;
@@ -2222,7 +2091,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
{
if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_INCH_RESOLUTION))
{
- if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_400_400))
+ if ((s->supported_bilevel_resolutions & T4_RESOLUTION_400_400))
{
s->x_resolution = T4_X_RESOLUTION_400;
s->y_resolution = T4_Y_RESOLUTION_400;
@@ -2232,7 +2101,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
}
else
{
- if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_R16_SUPERFINE))
+ if ((s->supported_bilevel_resolutions & T4_RESOLUTION_R16_SUPERFINE))
{
s->x_resolution = T4_X_RESOLUTION_R16;
s->y_resolution = T4_Y_RESOLUTION_SUPERFINE;
@@ -2243,7 +2112,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
}
else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_300_600))
{
- if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_300_600))
+ if ((s->supported_bilevel_resolutions & T4_RESOLUTION_300_600))
{
s->x_resolution = T4_X_RESOLUTION_300;
s->y_resolution = T4_Y_RESOLUTION_600;
@@ -2253,7 +2122,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
}
else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_300_300))
{
- if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_300_300))
+ if ((s->supported_bilevel_resolutions & T4_RESOLUTION_300_300))
{
s->x_resolution = T4_X_RESOLUTION_300;
s->y_resolution = T4_Y_RESOLUTION_300;
@@ -2265,7 +2134,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
{
if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_INCH_RESOLUTION))
{
- if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_200_400))
+ if ((s->supported_bilevel_resolutions & T4_RESOLUTION_200_400))
{
s->x_resolution = T4_X_RESOLUTION_200;
s->y_resolution = T4_Y_RESOLUTION_400;
@@ -2275,7 +2144,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
}
else
{
- if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_R8_SUPERFINE))
+ if ((s->supported_bilevel_resolutions & T4_RESOLUTION_R8_SUPERFINE))
{
s->x_resolution = T4_X_RESOLUTION_R8;
s->y_resolution = T4_Y_RESOLUTION_SUPERFINE;
@@ -2288,7 +2157,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
{
if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_INCH_RESOLUTION))
{
- if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_200_200))
+ if ((s->supported_bilevel_resolutions & T4_RESOLUTION_200_200))
{
s->x_resolution = T4_X_RESOLUTION_200;
s->y_resolution = T4_Y_RESOLUTION_200;
@@ -2298,7 +2167,7 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
}
else
{
- if ((s->supported_bilevel_resolutions & T4_SUPPORT_RESOLUTION_R8_FINE))
+ if ((s->supported_bilevel_resolutions & T4_RESOLUTION_R8_FINE))
{
s->x_resolution = T4_X_RESOLUTION_R8;
s->y_resolution = T4_Y_RESOLUTION_FINE;
@@ -2332,32 +2201,32 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
||
test_ctrl_bit(dcs_frame, T30_DCS_BIT_T88_MODE_3))
{
- if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T88))
+ if ((s->supported_compressions & T4_COMPRESSION_T88))
s->line_compression = T4_COMPRESSION_T88;
}
if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_T85_L0_MODE))
{
- if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T85_L0))
+ if ((s->supported_compressions & T4_COMPRESSION_T85_L0))
s->line_compression = T4_COMPRESSION_T85_L0;
}
else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_T85_MODE))
{
- if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T85))
+ if ((s->supported_compressions & T4_COMPRESSION_T85))
s->line_compression = T4_COMPRESSION_T85;
}
else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_T6_MODE))
{
- if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T6))
+ if ((s->supported_compressions & T4_COMPRESSION_T6))
s->line_compression = T4_COMPRESSION_T6;
}
else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_2D_MODE))
{
- if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T4_2D))
+ if ((s->supported_compressions & T4_COMPRESSION_T4_2D))
s->line_compression = T4_COMPRESSION_T4_2D;
}
else
{
- if ((s->supported_compressions & T4_SUPPORT_COMPRESSION_T4_1D))
+ if ((s->supported_compressions & T4_COMPRESSION_T4_1D))
s->line_compression = T4_COMPRESSION_T4_1D;
}
}
@@ -2392,8 +2261,6 @@ static int analyze_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
static int step_fallback_entry(t30_state_t *s)
{
- int min_row_bits;
-
while (fallback_sequence[++s->current_fallback].which)
{
if ((fallback_sequence[s->current_fallback].which & s->current_permitted_modems))
@@ -2401,12 +2268,9 @@ static int step_fallback_entry(t30_state_t *s)
}
if (fallback_sequence[s->current_fallback].which == 0)
return -1;
- /* TODO: This only sets the minimum row time for future pages. It doesn't fix up the
- current page, though it is benign - fallback will only result in an excessive
- minimum. */
- min_row_bits = set_min_scan_time_code(s);
- t4_tx_set_min_bits_per_row(&s->t4.tx, min_row_bits);
- /* We need to rebuild the DCS message we will send. */
+ /* We need to update the minimum scan time, in case we are in non-ECM mode. */
+ set_min_scan_time(s);
+ /* Now we need to rebuild the DCS message we will send. */
build_dcs(s);
return s->current_fallback;
}
@@ -2531,7 +2395,6 @@ static int send_dcs_sequence(t30_state_t *s, int start)
/* Schedule training after the messages */
if (start)
{
- prune_dcs(s);
set_state(s, T30_STATE_D);
s->step = 0;
}
@@ -2629,7 +2492,7 @@ static void disconnect(t30_state_t *s)
}
/*- End of function --------------------------------------------------------*/
-static int set_min_scan_time_code(t30_state_t *s)
+static void set_min_scan_time(t30_state_t *s)
{
/* Translation between the codes for the minimum scan times the other end needs,
and the codes for what we say will be used. We need 0 minimum. */
@@ -2645,6 +2508,7 @@ static int set_min_scan_time_code(t30_state_t *s)
20, 5, 10, 0, 40, 0, 0, 0
};
int min_bits_field;
+ int min_row_bits;
/* Set the minimum scan time bits */
if (s->error_correcting_mode)
@@ -2654,35 +2518,33 @@ static int set_min_scan_time_code(t30_state_t *s)
switch (s->y_resolution)
{
case T4_Y_RESOLUTION_SUPERFINE:
- if (test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_200_400_CAPABLE))
- {
- s->min_scan_time_code = translate_min_scan_time[(test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_MIN_SCAN_TIME_HALVES)) ? 2 : 1][min_bits_field];
- break;
- }
- span_log(&s->logging, SPAN_LOG_FLOW, "Remote FAX does not support super-fine resolution. Squashing image.\n");
- /* Fall through */
+ case T4_Y_RESOLUTION_400:
+ s->min_scan_time_code = translate_min_scan_time[(test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_MIN_SCAN_TIME_HALVES)) ? 2 : 1][min_bits_field];
+ break;
case T4_Y_RESOLUTION_FINE:
- if (test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_200_200_CAPABLE))
- {
- s->min_scan_time_code = translate_min_scan_time[1][min_bits_field];
- break;
- }
- span_log(&s->logging, SPAN_LOG_FLOW, "Remote FAX does not support fine resolution. Squashing image.\n");
- /* Fall through */
- default:
+ case T4_Y_RESOLUTION_200:
+ s->min_scan_time_code = translate_min_scan_time[1][min_bits_field];
+ break;
case T4_Y_RESOLUTION_STANDARD:
+ case T4_Y_RESOLUTION_100:
s->min_scan_time_code = translate_min_scan_time[0][min_bits_field];
break;
+ default:
+ s->min_scan_time_code = T30_MIN_SCAN_0MS;
+ break;
}
- if (!s->error_correcting_mode && (s->iaf & T30_IAF_MODE_NO_FILL_BITS))
- return 0;
- return fallback_sequence[s->current_fallback].bit_rate*min_scan_times[s->min_scan_time_code]/1000;
+ if ((s->iaf & T30_IAF_MODE_NO_FILL_BITS))
+ min_row_bits = 0;
+ else
+ min_row_bits = (fallback_sequence[s->current_fallback].bit_rate*min_scan_times[s->min_scan_time_code])/1000;
+ span_log(&s->logging, SPAN_LOG_FLOW, "Minimum bits per row will be %d\n", min_row_bits);
+ t4_tx_set_min_bits_per_row(&s->t4.tx, min_row_bits);
}
/*- End of function --------------------------------------------------------*/
static int start_sending_document(t30_state_t *s)
{
- int min_row_bits;
+ int res;
if (s->tx_file[0] == '\0')
{
@@ -2698,33 +2560,68 @@ static int start_sending_document(t30_state_t *s)
return -1;
}
s->operation_in_progress = OPERATION_IN_PROGRESS_T4_TX;
- t4_tx_get_pages_in_file(&s->t4.tx);
- t4_tx_set_tx_encoding(&s->t4.tx, s->line_compression);
+
t4_tx_set_local_ident(&s->t4.tx, s->tx_info.ident);
t4_tx_set_header_info(&s->t4.tx, s->header_info);
if (s->use_own_tz)
t4_tx_set_header_tz(&s->t4.tx, &s->tz);
+ t4_tx_get_pages_in_file(&s->t4.tx);
+
+ if ((res = t4_tx_set_tx_image_format(&s->t4.tx,
+ s->mutual_compressions,
+ s->mutual_image_sizes,
+ s->mutual_bilevel_resolutions,
+ s->mutual_colour_resolutions)) < 0)
+ {
+ switch (res)
+ {
+ case T4_IMAGE_FORMAT_INCOMPATIBLE:
+ span_log(&s->logging, SPAN_LOG_WARNING, "Cannot negotiate an image format\n");
+ t30_set_status(s, T30_ERR_BADTIFFHDR);
+ break;
+ case T4_IMAGE_FORMAT_NOSIZESUPPORT:
+ span_log(&s->logging, SPAN_LOG_WARNING, "Cannot negotiate an image size\n");
+ t30_set_status(s, T30_ERR_NOSIZESUPPORT);
+ break;
+ case T4_IMAGE_FORMAT_NORESSUPPORT:
+ span_log(&s->logging, SPAN_LOG_WARNING, "Cannot negotiate an image resolution\n");
+ t30_set_status(s, T30_ERR_NORESSUPPORT);
+ break;
+ default:
+ span_log(&s->logging, SPAN_LOG_WARNING, "Cannot negotiate an image format\n");
+ t30_set_status(s, T30_ERR_BADTIFF);
+ break;
+ }
+ return -1;
+ }
+ s->line_image_type = t4_tx_get_tx_image_type(&s->t4.tx);
+ s->line_compression = t4_tx_get_tx_compression(&s->t4.tx);
+ s->image_width = t4_tx_get_tx_image_width(&s->t4.tx);
+ s->line_width_code = t4_tx_get_tx_image_width_code(&s->t4.tx);
+
+ s->x_resolution = t4_tx_get_tx_x_resolution(&s->t4.tx);
+ s->y_resolution = t4_tx_get_tx_y_resolution(&s->t4.tx);
+ s->current_page_resolution = t4_tx_get_tx_resolution(&s->t4.tx);
+
+ span_log(&s->logging,
+ SPAN_LOG_FLOW,
+ "Choose image type %s (%d), compression %s (%d)\n",
+ t4_image_type_to_str(s->line_image_type),
+ s->line_image_type,
+ t4_compression_to_str(s->line_compression),
+ s->line_compression);
+
+ /* The minimum scan time to be used can't be evaluated until we know the Y resolution. */
+ set_min_scan_time(s);
+
if (tx_start_page(s))
{
span_log(&s->logging, SPAN_LOG_WARNING, "Something seems to be wrong in the file\n");
- t30_set_status(s, T30_ERR_FILEERROR);
+ t30_set_status(s, T30_ERR_BADTIFFHDR);
return -1;
}
- s->x_resolution = t4_tx_get_x_resolution(&s->t4.tx);
- s->y_resolution = t4_tx_get_y_resolution(&s->t4.tx);
- s->image_width = t4_tx_get_image_width(&s->t4.tx);
- /* The minimum scan time to be used can't be evaluated until we know the Y resolution, and
- must be evaluated before the minimum scan row bits can be evaluated. */
- if ((min_row_bits = set_min_scan_time_code(s)) < 0)
- {
- terminate_operation_in_progress(s);
- return -1;
- }
- span_log(&s->logging, SPAN_LOG_FLOW, "Minimum bits per row will be %d\n", min_row_bits);
- t4_tx_set_min_bits_per_row(&s->t4.tx, min_row_bits);
-
if (s->error_correcting_mode)
{
if (get_partial_ecm_page(s) == 0)
@@ -2739,7 +2636,7 @@ static int restart_sending_document(t30_state_t *s)
t4_tx_restart_page(&s->t4.tx);
s->retries = 0;
s->ecm_block = 0;
- send_dcs_sequence(s, TRUE);
+ send_dcs_sequence(s, true);
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -2755,7 +2652,7 @@ static int start_receiving_document(t30_state_t *s)
span_log(&s->logging, SPAN_LOG_FLOW, "Start receiving document\n");
queue_phase(s, T30_PHASE_B_TX);
s->ecm_block = 0;
- send_dis_or_dtc_sequence(s, TRUE);
+ send_dis_or_dtc_sequence(s, true);
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -2796,21 +2693,6 @@ static int process_rx_dis_dtc(t30_state_t *s, const uint8_t *msg, int len)
send_dcn(s);
return -1;
}
-
- /* Choose a compression scheme from amongst those mutually available */
- if ((s->mutual_compressions & T4_SUPPORT_COMPRESSION_T85_L0))
- s->line_compression = T4_COMPRESSION_T85_L0;
- else if ((s->mutual_compressions & T4_SUPPORT_COMPRESSION_T85))
- s->line_compression = T4_COMPRESSION_T85;
- else if ((s->mutual_compressions & T4_SUPPORT_COMPRESSION_T6))
- s->line_compression = T4_COMPRESSION_T6;
- else if ((s->mutual_compressions & T4_SUPPORT_COMPRESSION_T4_2D))
- s->line_compression = T4_COMPRESSION_T4_2D;
- else
- s->line_compression = T4_COMPRESSION_T4_1D;
-
- span_log(&s->logging, SPAN_LOG_FLOW, "Choose compression %s (%d)\n", t4_compression_to_str(s->line_compression), s->line_compression);
-
if (s->phase_b_handler)
{
new_status = s->phase_b_handler(s, s->phase_b_user_data, msg[2]);
@@ -2846,7 +2728,7 @@ static int process_rx_dis_dtc(t30_state_t *s, const uint8_t *msg, int len)
return -1;
}
s->retries = 0;
- send_dcs_sequence(s, TRUE);
+ send_dcs_sequence(s, true);
return 0;
}
span_log(&s->logging, SPAN_LOG_FLOW, "%s nothing to send\n", t30_frametype(msg[2]));
@@ -2873,7 +2755,7 @@ static int process_rx_dis_dtc(t30_state_t *s, const uint8_t *msg, int len)
return -1;
}
s->retries = 0;
- send_dis_or_dtc_sequence(s, TRUE);
+ send_dis_or_dtc_sequence(s, true);
return 0;
}
span_log(&s->logging, SPAN_LOG_FLOW, "%s nothing to receive\n", t30_frametype(msg[2]));
@@ -2932,7 +2814,7 @@ static int process_rx_dcs(t30_state_t *s, const uint8_t *msg, int len)
if (!(s->iaf & T30_IAF_MODE_NO_TCF))
{
/* TCF is always sent with long training */
- s->short_train = FALSE;
+ s->short_train = false;
set_state(s, T30_STATE_F_TCF);
queue_phase(s, T30_PHASE_C_NON_ECM_RX);
timer_t2_start(s);
@@ -2948,7 +2830,7 @@ static int send_response_to_pps(t30_state_t *s)
{
set_state(s, T30_STATE_F_POST_RCP_MCF);
send_simple_frame(s, T30_MCF);
- return TRUE;
+ return true;
}
/* We need to send the PPR frame we have created, to try to fill in the missing/bad data. */
set_state(s, T30_STATE_F_POST_RCP_PPR);
@@ -2956,7 +2838,7 @@ static int send_response_to_pps(t30_state_t *s)
s->ecm_frame_map[1] = CONTROL_FIELD_FINAL_FRAME;
s->ecm_frame_map[2] = (uint8_t) (T30_PPR | s->dis_received);
send_frame(s, s->ecm_frame_map, 3 + 32);
- return FALSE;
+ return false;
}
/*- End of function --------------------------------------------------------*/
@@ -3053,7 +2935,7 @@ static int process_rx_pps(t30_state_t *s, const uint8_t *msg, int len)
/* Build a bit map of which frames we now have stored OK */
first_bad_frame = 256;
- first = TRUE;
+ first = true;
expected_len = 256;
for (i = 0; i < 32; i++)
{
@@ -3080,7 +2962,7 @@ static int process_rx_pps(t30_state_t *s, const uint8_t *msg, int len)
/* Use the length of the first frame as our model for what the length should be */
if (s->ecm_len[frame_no] == 64)
expected_len = 64;
- first = FALSE;
+ first = false;
}
/* Check the length is consistent with the first frame */
if (s->ecm_len[frame_no] != expected_len)
@@ -3165,7 +3047,7 @@ static int process_rx_pps(t30_state_t *s, const uint8_t *msg, int len)
case T30_PRI_EOP:
case T30_EOP:
span_log(&s->logging, SPAN_LOG_FLOW, "End of procedure detected\n");
- s->end_of_procedure_detected = TRUE;
+ s->end_of_procedure_detected = true;
break;
}
}
@@ -3280,7 +3162,7 @@ static void process_rx_fcd(t30_state_t *s, const uint8_t *msg, int len)
memcpy(&s->ecm_data[frame_no][0], &msg[4], len - 4);
s->ecm_len[frame_no] = (int16_t) (len - 4);
/* In case we are just after a CTC/CTR exchange, which kicked us back to long training */
- s->short_train = TRUE;
+ s->short_train = true;
}
/* We have received something, so any missing carrier status is out of date */
if (s->current_status == T30_ERR_RX_NOCARRIER)
@@ -3545,7 +3427,7 @@ static void process_state_d_post_tcf(t30_state_t *s, const uint8_t *msg, int len
/* Trainability test succeeded. Send the document. */
span_log(&s->logging, SPAN_LOG_FLOW, "Trainability test succeeded\n");
s->retries = 0;
- s->short_train = TRUE;
+ s->short_train = true;
if (s->error_correcting_mode)
{
set_state(s, T30_STATE_IV);
@@ -3562,7 +3444,7 @@ static void process_state_d_post_tcf(t30_state_t *s, const uint8_t *msg, int len
/* Trainability test failed. Try again. */
span_log(&s->logging, SPAN_LOG_FLOW, "Trainability test failed\n");
s->retries = 0;
- s->short_train = FALSE;
+ s->short_train = false;
if (step_fallback_entry(s) < 0)
{
/* We have fallen back as far as we can go. Give up. */
@@ -3572,7 +3454,7 @@ static void process_state_d_post_tcf(t30_state_t *s, const uint8_t *msg, int len
break;
}
queue_phase(s, T30_PHASE_B_TX);
- send_dcs_sequence(s, TRUE);
+ send_dcs_sequence(s, true);
break;
case T30_DIS:
/* It appears they didn't see what we sent - retry the TCF */
@@ -3586,7 +3468,7 @@ static void process_state_d_post_tcf(t30_state_t *s, const uint8_t *msg, int len
span_log(&s->logging, SPAN_LOG_FLOW, "Retry number %d\n", s->retries);
queue_phase(s, T30_PHASE_B_TX);
/* TODO: should we reassess the new DIS message, and possibly adjust the DCS we use? */
- send_dcs_sequence(s, TRUE);
+ send_dcs_sequence(s, true);
break;
case T30_DCN:
t30_set_status(s, T30_ERR_TX_BADDCS);
@@ -3848,7 +3730,7 @@ static void process_state_f_post_doc_non_ecm(t30_state_t *s, const uint8_t *msg,
/* Fall through */
case T30_EOP:
span_log(&s->logging, SPAN_LOG_FLOW, "End of procedure detected\n");
- s->end_of_procedure_detected = TRUE;
+ s->end_of_procedure_detected = true;
s->next_rx_step = fcf;
queue_phase(s, T30_PHASE_D_TX);
switch (copy_quality(s))
@@ -3960,7 +3842,7 @@ static void process_state_f_doc_and_post_doc_ecm(t30_state_t *s, const uint8_t *
break;
case T30_CTC:
/* T.30 says we change back to long training here */
- s->short_train = FALSE;
+ s->short_train = false;
queue_phase(s, T30_PHASE_D_TX);
set_state(s, T30_STATE_F_DOC_ECM);
send_simple_frame(s, T30_CTR);
@@ -4056,7 +3938,7 @@ static void process_state_f_post_rcp_rnr(t30_state_t *s, const uint8_t *msg, int
case T30_PRI_EOP:
case T30_EOP:
span_log(&s->logging, SPAN_LOG_FLOW, "End of procedure detected\n");
- s->end_of_procedure_detected = TRUE;
+ s->end_of_procedure_detected = true;
break;
}
}
@@ -4221,8 +4103,8 @@ static void process_state_ii_q(t30_state_t *s, const uint8_t *msg, int len)
if (s->phase_d_handler)
s->phase_d_handler(s, s->phase_d_user_data, fcf);
terminate_operation_in_progress(s);
- report_tx_result(s, TRUE);
- return_to_phase_b(s, FALSE);
+ report_tx_result(s, true);
+ return_to_phase_b(s, false);
break;
case T30_PRI_EOP:
case T30_EOP:
@@ -4231,7 +4113,7 @@ static void process_state_ii_q(t30_state_t *s, const uint8_t *msg, int len)
s->phase_d_handler(s, s->phase_d_user_data, fcf);
terminate_operation_in_progress(s);
send_dcn(s);
- report_tx_result(s, TRUE);
+ report_tx_result(s, true);
break;
}
break;
@@ -4269,7 +4151,7 @@ static void process_state_ii_q(t30_state_t *s, const uint8_t *msg, int len)
s->phase_d_handler(s, s->phase_d_user_data, fcf);
t4_tx_release(&s->t4.tx);
/* TODO: should go back to T, and resend */
- return_to_phase_b(s, TRUE);
+ return_to_phase_b(s, true);
break;
case T30_PRI_EOP:
case T30_EOP:
@@ -4334,7 +4216,7 @@ static void process_state_ii_q(t30_state_t *s, const uint8_t *msg, int len)
}
else
{
- return_to_phase_b(s, TRUE);
+ return_to_phase_b(s, true);
}
break;
case T30_PRI_EOP:
@@ -4574,8 +4456,8 @@ static void process_state_iv_pps_null(t30_state_t *s, const uint8_t *msg, int le
if (s->phase_d_handler)
s->phase_d_handler(s, s->phase_d_user_data, fcf);
terminate_operation_in_progress(s);
- report_tx_result(s, TRUE);
- return_to_phase_b(s, FALSE);
+ report_tx_result(s, true);
+ return_to_phase_b(s, false);
break;
case T30_PRI_EOP:
case T30_EOP:
@@ -4584,7 +4466,7 @@ static void process_state_iv_pps_null(t30_state_t *s, const uint8_t *msg, int le
s->phase_d_handler(s, s->phase_d_user_data, fcf);
terminate_operation_in_progress(s);
send_dcn(s);
- report_tx_result(s, TRUE);
+ report_tx_result(s, true);
break;
}
}
@@ -4678,8 +4560,8 @@ static void process_state_iv_pps_q(t30_state_t *s, const uint8_t *msg, int len)
if (s->phase_d_handler)
s->phase_d_handler(s, s->phase_d_user_data, fcf);
terminate_operation_in_progress(s);
- report_tx_result(s, TRUE);
- return_to_phase_b(s, FALSE);
+ report_tx_result(s, true);
+ return_to_phase_b(s, false);
break;
case T30_PRI_EOP:
case T30_EOP:
@@ -4688,7 +4570,7 @@ static void process_state_iv_pps_q(t30_state_t *s, const uint8_t *msg, int len)
s->phase_d_handler(s, s->phase_d_user_data, fcf);
terminate_operation_in_progress(s);
send_dcn(s);
- report_tx_result(s, TRUE);
+ report_tx_result(s, true);
break;
}
}
@@ -4793,8 +4675,8 @@ static void process_state_iv_pps_rnr(t30_state_t *s, const uint8_t *msg, int len
if (s->phase_d_handler)
s->phase_d_handler(s, s->phase_d_user_data, fcf);
terminate_operation_in_progress(s);
- report_tx_result(s, TRUE);
- return_to_phase_b(s, FALSE);
+ report_tx_result(s, true);
+ return_to_phase_b(s, false);
break;
case T30_PRI_EOP:
case T30_EOP:
@@ -4803,7 +4685,7 @@ static void process_state_iv_pps_rnr(t30_state_t *s, const uint8_t *msg, int len
s->phase_d_handler(s, s->phase_d_user_data, fcf);
terminate_operation_in_progress(s);
send_dcn(s);
- report_tx_result(s, TRUE);
+ report_tx_result(s, true);
break;
}
}
@@ -4854,7 +4736,7 @@ static void process_state_iv_ctc(t30_state_t *s, const uint8_t *msg, int len)
case T30_CTR:
/* Valid response to a CTC received */
/* T.30 says we change back to long training here */
- s->short_train = FALSE;
+ s->short_train = false;
/* Initiate resending of the remainder of the frames. */
set_state(s, T30_STATE_IV);
queue_phase(s, T30_PHASE_C_ECM_TX);
@@ -4980,7 +4862,7 @@ static void process_rx_control_msg(t30_state_t *s, const uint8_t *msg, int len)
/* We should only get good frames here. */
print_frame(s, "Rx: ", msg, len);
if (s->real_time_frame_handler)
- s->real_time_frame_handler(s, s->real_time_frame_user_data, TRUE, msg, len);
+ s->real_time_frame_handler(s, s->real_time_frame_user_data, true, msg, len);
if ((msg[1] & 0x10) == 0)
{
@@ -5281,42 +5163,42 @@ static void set_phase(t30_state_t *s, int phase)
signal. Force the signal present indicator to off, because the
receiver will never be able to. */
if (s->phase != T30_PHASE_A_CED && s->phase != T30_PHASE_A_CNG)
- s->rx_signal_present = FALSE;
- s->rx_trained = FALSE;
- s->rx_frame_received = FALSE;
+ s->rx_signal_present = false;
+ s->rx_trained = false;
+ s->rx_frame_received = false;
s->phase = phase;
switch (phase)
{
case T30_PHASE_A_CED:
if (s->set_rx_type_handler)
- s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_V21, 300, FALSE, TRUE);
+ s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_V21, 300, false, true);
if (s->set_tx_type_handler)
- s->set_tx_type_handler(s->set_tx_type_user_data, T30_MODEM_CED, 0, FALSE, FALSE);
+ s->set_tx_type_handler(s->set_tx_type_user_data, T30_MODEM_CED, 0, false, false);
break;
case T30_PHASE_A_CNG:
if (s->set_rx_type_handler)
- s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_V21, 300, FALSE, TRUE);
+ s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_V21, 300, false, true);
if (s->set_tx_type_handler)
- s->set_tx_type_handler(s->set_tx_type_user_data, T30_MODEM_CNG, 0, FALSE, FALSE);
+ s->set_tx_type_handler(s->set_tx_type_user_data, T30_MODEM_CNG, 0, false, false);
break;
case T30_PHASE_B_RX:
case T30_PHASE_D_RX:
if (s->set_rx_type_handler)
- s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_V21, 300, FALSE, TRUE);
+ s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_V21, 300, false, true);
if (s->set_tx_type_handler)
- s->set_tx_type_handler(s->set_tx_type_user_data, T30_MODEM_NONE, 0, FALSE, FALSE);
+ s->set_tx_type_handler(s->set_tx_type_user_data, T30_MODEM_NONE, 0, false, false);
break;
case T30_PHASE_B_TX:
case T30_PHASE_D_TX:
if (!s->far_end_detected && s->timer_t0_t1 > 0)
{
s->timer_t0_t1 = ms_to_samples(DEFAULT_TIMER_T1);
- s->far_end_detected = TRUE;
+ s->far_end_detected = true;
}
if (s->set_rx_type_handler)
- s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_NONE, 0, FALSE, FALSE);
+ s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_NONE, 0, false, false);
if (s->set_tx_type_handler)
- s->set_tx_type_handler(s->set_tx_type_user_data, T30_MODEM_V21, 300, FALSE, TRUE);
+ s->set_tx_type_handler(s->set_tx_type_user_data, T30_MODEM_V21, 300, false, true);
break;
case T30_PHASE_C_NON_ECM_RX:
if (s->set_rx_type_handler)
@@ -5324,11 +5206,11 @@ static void set_phase(t30_state_t *s, int phase)
/* Momentarily stop the receive modem, so the next change is forced to happen. If we don't do this
an HDLC message on the slow modem, which has disabled the fast modem, will prevent the same
fast modem from restarting. */
- s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_NONE, 0, FALSE, FALSE);
- s->set_rx_type_handler(s->set_rx_type_user_data, fallback_sequence[s->current_fallback].modem_type, fallback_sequence[s->current_fallback].bit_rate, s->short_train, FALSE);
+ s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_NONE, 0, false, false);
+ s->set_rx_type_handler(s->set_rx_type_user_data, fallback_sequence[s->current_fallback].modem_type, fallback_sequence[s->current_fallback].bit_rate, s->short_train, false);
}
if (s->set_tx_type_handler)
- s->set_tx_type_handler(s->set_tx_type_user_data, T30_MODEM_NONE, 0, FALSE, FALSE);
+ s->set_tx_type_handler(s->set_tx_type_user_data, T30_MODEM_NONE, 0, false, false);
break;
case T30_PHASE_C_NON_ECM_TX:
/* Pause before switching from anything to phase C */
@@ -5340,24 +5222,24 @@ static void set_phase(t30_state_t *s, int phase)
/* Momentarily stop the receive modem, so the next change is forced to happen. If we don't do this
an HDLC message on the slow modem, which has disabled the fast modem, will prevent the same
fast modem from restarting. */
- s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_NONE, 0, FALSE, FALSE);
- s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_NONE, 0, FALSE, FALSE);
+ s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_NONE, 0, false, false);
+ s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_NONE, 0, false, false);
}
if (s->set_tx_type_handler)
- s->set_tx_type_handler(s->set_tx_type_user_data, fallback_sequence[s->current_fallback].modem_type, fallback_sequence[s->current_fallback].bit_rate, s->short_train, FALSE);
+ s->set_tx_type_handler(s->set_tx_type_user_data, fallback_sequence[s->current_fallback].modem_type, fallback_sequence[s->current_fallback].bit_rate, s->short_train, false);
break;
case T30_PHASE_C_ECM_RX:
if (s->set_rx_type_handler)
- s->set_rx_type_handler(s->set_rx_type_user_data, fallback_sequence[s->current_fallback].modem_type, fallback_sequence[s->current_fallback].bit_rate, s->short_train, TRUE);
+ s->set_rx_type_handler(s->set_rx_type_user_data, fallback_sequence[s->current_fallback].modem_type, fallback_sequence[s->current_fallback].bit_rate, s->short_train, true);
if (s->set_tx_type_handler)
- s->set_tx_type_handler(s->set_tx_type_user_data, T30_MODEM_NONE, 0, FALSE, FALSE);
+ s->set_tx_type_handler(s->set_tx_type_user_data, T30_MODEM_NONE, 0, false, false);
break;
case T30_PHASE_C_ECM_TX:
/* Pause before switching from anything to phase C */
if (s->set_rx_type_handler)
- s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_NONE, 0, FALSE, FALSE);
+ s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_NONE, 0, false, false);
if (s->set_tx_type_handler)
- s->set_tx_type_handler(s->set_tx_type_user_data, fallback_sequence[s->current_fallback].modem_type, fallback_sequence[s->current_fallback].bit_rate, s->short_train, TRUE);
+ s->set_tx_type_handler(s->set_tx_type_user_data, fallback_sequence[s->current_fallback].modem_type, fallback_sequence[s->current_fallback].bit_rate, s->short_train, true);
break;
case T30_PHASE_E:
/* Send a little silence before ending things, to ensure the
@@ -5367,15 +5249,15 @@ static void set_phase(t30_state_t *s, int phase)
s->tcf_current_zeros = 0;
s->tcf_most_zeros = 0;
if (s->set_rx_type_handler)
- s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_NONE, 0, FALSE, FALSE);
+ s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_NONE, 0, false, false);
if (s->set_tx_type_handler)
- s->set_tx_type_handler(s->set_tx_type_user_data, T30_MODEM_PAUSE, 0, FINAL_FLUSH_TIME, FALSE);
+ s->set_tx_type_handler(s->set_tx_type_user_data, T30_MODEM_PAUSE, 0, FINAL_FLUSH_TIME, false);
break;
case T30_PHASE_CALL_FINISHED:
if (s->set_rx_type_handler)
- s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_DONE, 0, FALSE, FALSE);
+ s->set_rx_type_handler(s->set_rx_type_user_data, T30_MODEM_DONE, 0, false, false);
if (s->set_tx_type_handler)
- s->set_tx_type_handler(s->set_tx_type_user_data, T30_MODEM_DONE, 0, FALSE, FALSE);
+ s->set_tx_type_handler(s->set_tx_type_user_data, T30_MODEM_DONE, 0, false, false);
break;
}
}
@@ -5422,9 +5304,9 @@ static void repeat_last_command(t30_state_t *s)
switch (s->state)
{
case T30_STATE_R:
- s->dis_received = FALSE;
+ s->dis_received = false;
queue_phase(s, T30_PHASE_B_TX);
- send_dis_or_dtc_sequence(s, TRUE);
+ send_dis_or_dtc_sequence(s, true);
break;
case T30_STATE_III_Q_MCF:
queue_phase(s, T30_PHASE_D_TX);
@@ -5454,7 +5336,7 @@ static void repeat_last_command(t30_state_t *s)
break;
case T30_STATE_D:
queue_phase(s, T30_PHASE_B_TX);
- send_dcs_sequence(s, TRUE);
+ send_dcs_sequence(s, true);
break;
case T30_STATE_F_FTT:
queue_phase(s, T30_PHASE_B_TX);
@@ -5462,13 +5344,13 @@ static void repeat_last_command(t30_state_t *s)
break;
case T30_STATE_F_CFR:
queue_phase(s, T30_PHASE_B_TX);
- send_cfr_sequence(s, TRUE);
+ send_cfr_sequence(s, true);
break;
case T30_STATE_D_POST_TCF:
/* Need to send the whole training thing again */
- s->short_train = FALSE;
+ s->short_train = false;
queue_phase(s, T30_PHASE_B_TX);
- send_dcs_sequence(s, TRUE);
+ send_dcs_sequence(s, true);
break;
case T30_STATE_F_POST_RCP_RNR:
/* Just ignore */
@@ -5644,8 +5526,8 @@ static void timer_t2_expired(t30_state_t *s)
span_log(&s->logging, SPAN_LOG_FLOW, "Returning to phase B after %s\n", t30_frametype(s->next_rx_step));
set_phase(s, T30_PHASE_B_TX);
timer_t2_start(s);
- s->dis_received = FALSE;
- send_dis_or_dtc_sequence(s, TRUE);
+ s->dis_received = false;
+ send_dis_or_dtc_sequence(s, true);
return;
}
break;
@@ -5831,7 +5713,7 @@ static int decode_nsf_nss_nsc(t30_state_t *s, uint8_t *msg[], const uint8_t *pkt
{
uint8_t *t;
- if ((t = malloc(len - 1)) == NULL)
+ if ((t = span_alloc(len - 1)) == NULL)
return 0;
memcpy(t, pkt + 1, len - 1);
*msg = t;
@@ -5851,7 +5733,7 @@ static void t30_non_ecm_rx_status(void *user_data, int status)
case SIG_STATUS_TRAINING_IN_PROGRESS:
break;
case SIG_STATUS_TRAINING_FAILED:
- s->rx_trained = FALSE;
+ s->rx_trained = false;
break;
case SIG_STATUS_TRAINING_SUCCEEDED:
/* The modem is now trained */
@@ -5859,16 +5741,16 @@ static void t30_non_ecm_rx_status(void *user_data, int status)
s->tcf_test_bits = 0;
s->tcf_current_zeros = 0;
s->tcf_most_zeros = 0;
- s->rx_signal_present = TRUE;
- s->rx_trained = TRUE;
+ s->rx_signal_present = true;
+ s->rx_trained = true;
timer_t2_t4_stop(s);
break;
case SIG_STATUS_CARRIER_UP:
break;
case SIG_STATUS_CARRIER_DOWN:
was_trained = s->rx_trained;
- s->rx_signal_present = FALSE;
- s->rx_trained = FALSE;
+ s->rx_signal_present = false;
+ s->rx_trained = false;
switch (s->state)
{
case T30_STATE_F_TCF:
@@ -5896,11 +5778,11 @@ static void t30_non_ecm_rx_status(void *user_data, int status)
else
{
/* The training went OK */
- s->short_train = TRUE;
+ s->short_train = true;
rx_start_page(s);
set_phase(s, T30_PHASE_B_TX);
set_state(s, T30_STATE_F_CFR);
- send_cfr_sequence(s, TRUE);
+ send_cfr_sequence(s, true);
}
}
break;
@@ -6104,15 +5986,15 @@ static void t30_hdlc_rx_status(void *user_data, int status)
case SIG_STATUS_TRAINING_IN_PROGRESS:
break;
case SIG_STATUS_TRAINING_FAILED:
- s->rx_trained = FALSE;
+ s->rx_trained = false;
break;
case SIG_STATUS_TRAINING_SUCCEEDED:
/* The modem is now trained */
- s->rx_signal_present = TRUE;
- s->rx_trained = TRUE;
+ s->rx_signal_present = true;
+ s->rx_trained = true;
break;
case SIG_STATUS_CARRIER_UP:
- s->rx_signal_present = TRUE;
+ s->rx_signal_present = true;
switch (s->timer_t2_t4_is)
{
case TIMER_IS_T2B:
@@ -6127,8 +6009,8 @@ static void t30_hdlc_rx_status(void *user_data, int status)
break;
case SIG_STATUS_CARRIER_DOWN:
was_trained = s->rx_trained;
- s->rx_signal_present = FALSE;
- s->rx_trained = FALSE;
+ s->rx_signal_present = false;
+ s->rx_trained = false;
/* If a phase change has been queued to occur after the receive signal drops,
its time to change. */
if (s->state == T30_STATE_F_DOC_ECM)
@@ -6181,7 +6063,7 @@ static void t30_hdlc_rx_status(void *user_data, int status)
if (!s->far_end_detected && s->timer_t0_t1 > 0)
{
s->timer_t0_t1 = ms_to_samples(DEFAULT_TIMER_T1);
- s->far_end_detected = TRUE;
+ s->far_end_detected = true;
if (s->phase == T30_PHASE_A_CED || s->phase == T30_PHASE_A_CNG)
set_phase(s, T30_PHASE_B_RX);
}
@@ -6276,7 +6158,7 @@ SPAN_DECLARE_NONSTD(void) t30_hdlc_accept(void *user_data, const uint8_t *msg, i
timer_t2_t4_stop(s);
return;
}
- s->rx_frame_received = TRUE;
+ s->rx_frame_received = true;
/* Cancel the command or response timer (if one is running) */
timer_t2_t4_stop(s);
process_rx_control_msg(s, msg, len);
@@ -6300,11 +6182,11 @@ SPAN_DECLARE(void) t30_front_end_status(void *user_data, int status)
span_log(&s->logging, SPAN_LOG_FLOW, "Starting answer mode\n");
set_phase(s, T30_PHASE_B_TX);
timer_t2_start(s);
- s->dis_received = FALSE;
- send_dis_or_dtc_sequence(s, TRUE);
+ s->dis_received = false;
+ send_dis_or_dtc_sequence(s, true);
break;
case T30_STATE_R:
- if (send_dis_or_dtc_sequence(s, FALSE))
+ if (send_dis_or_dtc_sequence(s, false))
{
/* Wait for an acknowledgement. */
set_phase(s, T30_PHASE_B_RX);
@@ -6312,7 +6194,7 @@ SPAN_DECLARE(void) t30_front_end_status(void *user_data, int status)
}
break;
case T30_STATE_F_CFR:
- if (send_cfr_sequence(s, FALSE))
+ if (send_cfr_sequence(s, false))
{
if (s->error_correcting_mode)
{
@@ -6432,13 +6314,13 @@ SPAN_DECLARE(void) t30_front_end_status(void *user_data, int status)
}
break;
case T30_STATE_D:
- if (send_dcs_sequence(s, FALSE))
+ if (send_dcs_sequence(s, false))
{
if ((s->iaf & T30_IAF_MODE_NO_TCF))
{
/* Skip the trainability test */
s->retries = 0;
- s->short_train = TRUE;
+ s->short_train = true;
if (s->error_correcting_mode)
{
set_state(s, T30_STATE_IV);
@@ -6454,7 +6336,7 @@ SPAN_DECLARE(void) t30_front_end_status(void *user_data, int status)
{
/* Do the trainability test */
/* TCF is always sent with long training */
- s->short_train = FALSE;
+ s->short_train = false;
set_state(s, T30_STATE_D_TCF);
set_phase(s, T30_PHASE_C_NON_ECM_TX);
}
@@ -6488,7 +6370,8 @@ SPAN_DECLARE(void) t30_front_end_status(void *user_data, int status)
{
/* Send the end of page or partial page message */
set_phase(s, T30_PHASE_D_TX);
- s->next_tx_step = check_next_tx_step(s);
+ if (s->ecm_at_page_end)
+ s->next_tx_step = check_next_tx_step(s);
if (send_pps_frame(s) == T30_NULL)
set_state(s, T30_STATE_IV_PPS_NULL);
else
@@ -6557,7 +6440,7 @@ SPAN_DECLARE(void) t30_front_end_status(void *user_data, int status)
default:
/* Cancel any receive timeout, and declare that a receive signal is present,
since the front end is explicitly telling us we have seen something. */
- s->rx_signal_present = TRUE;
+ s->rx_signal_present = true;
timer_t2_t4_stop(s);
break;
}
@@ -6751,9 +6634,9 @@ SPAN_DECLARE(int) t30_restart(t30_state_t *s)
s->phase = T30_PHASE_IDLE;
s->next_phase = T30_PHASE_IDLE;
s->current_fallback = 0;
- s->rx_signal_present = FALSE;
- s->rx_trained = FALSE;
- s->rx_frame_received = FALSE;
+ s->rx_signal_present = false;
+ s->rx_trained = false;
+ s->rx_frame_received = false;
s->current_status = T30_ERR_OK;
s->ppr_count = 0;
s->ecm_progress = 0;
@@ -6767,9 +6650,9 @@ SPAN_DECLARE(int) t30_restart(t30_state_t *s)
s->tx_page_number = 0;
s->rtn_events = 0;
s->rtp_events = 0;
- s->local_interrupt_pending = FALSE;
- s->far_end_detected = FALSE;
- s->end_of_procedure_detected = FALSE;
+ s->local_interrupt_pending = false;
+ s->far_end_detected = false;
+ s->end_of_procedure_detected = false;
s->timer_t0_t1 = ms_to_samples(DEFAULT_TIMER_T0);
if (s->calling_party)
{
@@ -6796,7 +6679,7 @@ SPAN_DECLARE(t30_state_t *) t30_init(t30_state_t *s,
{
if (s == NULL)
{
- if ((s = (t30_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (t30_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -6810,10 +6693,13 @@ SPAN_DECLARE(t30_state_t *) t30_init(t30_state_t *s,
/* Default to the basic modems. */
s->supported_modems = T30_SUPPORT_V27TER | T30_SUPPORT_V29 | T30_SUPPORT_V17;
- s->supported_compressions = T4_SUPPORT_COMPRESSION_T4_1D | T4_SUPPORT_COMPRESSION_T4_2D;
- s->supported_bilevel_resolutions = T4_SUPPORT_RESOLUTION_R8_STANDARD
- | T4_SUPPORT_RESOLUTION_R8_FINE
- | T4_SUPPORT_RESOLUTION_R8_SUPERFINE;
+ s->supported_compressions = T4_COMPRESSION_T4_1D | T4_COMPRESSION_T4_2D;
+ s->supported_bilevel_resolutions = T4_RESOLUTION_R8_STANDARD
+ | T4_RESOLUTION_R8_FINE
+ | T4_RESOLUTION_R8_SUPERFINE
+ | T4_RESOLUTION_200_100
+ | T4_RESOLUTION_200_200
+ | T4_RESOLUTION_200_400;
s->supported_image_sizes = T4_SUPPORT_WIDTH_215MM
| T4_SUPPORT_LENGTH_US_LETTER
| T4_SUPPORT_LENGTH_US_LEGAL
@@ -6822,7 +6708,7 @@ SPAN_DECLARE(t30_state_t *) t30_init(t30_state_t *s,
| T4_SUPPORT_LENGTH_UNLIMITED;
/* Set the output encoding to something safe. Most things get 1D and 2D
encoding right. Quite a lot get other things wrong. */
- s->supported_output_compressions = T4_COMPRESSION_T4_2D;
+ s->supported_output_compressions = T4_COMPRESSION_T4_2D | T4_COMPRESSION_T42_T81;
s->local_min_scan_time_code = T30_MIN_SCAN_0MS;
span_log_init(&s->logging, SPAN_LOG_NONE, NULL);
span_log_set_protocol(&s->logging, "T.30");
@@ -6843,7 +6729,7 @@ SPAN_DECLARE(int) t30_release(t30_state_t *s)
SPAN_DECLARE(int) t30_free(t30_state_t *s)
{
t30_release(s);
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
diff --git a/libs/spandsp/src/t30_api.c b/libs/spandsp/src/t30_api.c
index af90452d91..a0a78b3164 100644
--- a/libs/spandsp/src/t30_api.c
+++ b/libs/spandsp/src/t30_api.c
@@ -41,10 +41,16 @@
#if defined(HAVE_MATH_H)
#include
#endif
+#if defined(HAVE_STDBOOL_H)
+#include
+#else
+#include "spandsp/stdbool.h"
+#endif
#include "floating_fudge.h"
#include
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/bit_operations.h"
#include "spandsp/queue.h"
@@ -277,8 +283,8 @@ SPAN_DECLARE(const char *) t30_get_rx_password(t30_state_t *s)
SPAN_DECLARE(int) t30_set_tx_nsf(t30_state_t *s, const uint8_t *nsf, int len)
{
if (s->tx_info.nsf)
- free(s->tx_info.nsf);
- if (nsf && len > 0 && (s->tx_info.nsf = malloc(len + 3)))
+ span_free(s->tx_info.nsf);
+ if (nsf && len > 0 && (s->tx_info.nsf = span_alloc(len + 3)))
{
memcpy(s->tx_info.nsf + 3, nsf, len);
s->tx_info.nsf_len = len;
@@ -311,8 +317,8 @@ SPAN_DECLARE(size_t) t30_get_rx_nsf(t30_state_t *s, const uint8_t *nsf[])
SPAN_DECLARE(int) t30_set_tx_nsc(t30_state_t *s, const uint8_t *nsc, int len)
{
if (s->tx_info.nsc)
- free(s->tx_info.nsc);
- if (nsc && len > 0 && (s->tx_info.nsc = malloc(len + 3)))
+ span_free(s->tx_info.nsc);
+ if (nsc && len > 0 && (s->tx_info.nsc = span_alloc(len + 3)))
{
memcpy(s->tx_info.nsc + 3, nsc, len);
s->tx_info.nsc_len = len;
@@ -345,8 +351,8 @@ SPAN_DECLARE(size_t) t30_get_rx_nsc(t30_state_t *s, const uint8_t *nsc[])
SPAN_DECLARE(int) t30_set_tx_nss(t30_state_t *s, const uint8_t *nss, int len)
{
if (s->tx_info.nss)
- free(s->tx_info.nss);
- if (nss && len > 0 && (s->tx_info.nss = malloc(len + 3)))
+ span_free(s->tx_info.nss);
+ if (nss && len > 0 && (s->tx_info.nss = span_alloc(len + 3)))
{
memcpy(s->tx_info.nss + 3, nss, len);
s->tx_info.nss_len = len;
@@ -379,7 +385,7 @@ SPAN_DECLARE(size_t) t30_get_rx_nss(t30_state_t *s, const uint8_t *nss[])
SPAN_DECLARE(int) t30_set_tx_tsa(t30_state_t *s, int type, const char *address, int len)
{
if (s->tx_info.tsa)
- free(s->tx_info.tsa);
+ span_free(s->tx_info.tsa);
if (address == NULL || len == 0)
{
s->tx_info.tsa = NULL;
@@ -389,7 +395,7 @@ SPAN_DECLARE(int) t30_set_tx_tsa(t30_state_t *s, int type, const char *address,
s->tx_info.tsa_type = type;
if (len < 0)
len = strlen(address);
- if ((s->tx_info.tsa = malloc(len)))
+ if ((s->tx_info.tsa = span_alloc(len)))
{
memcpy(s->tx_info.tsa, address, len);
s->tx_info.tsa_len = len;
@@ -421,7 +427,7 @@ SPAN_DECLARE(size_t) t30_get_rx_tsa(t30_state_t *s, int *type, const char *addre
SPAN_DECLARE(int) t30_set_tx_ira(t30_state_t *s, int type, const char *address, int len)
{
if (s->tx_info.ira)
- free(s->tx_info.ira);
+ span_free(s->tx_info.ira);
if (address == NULL)
{
s->tx_info.ira = NULL;
@@ -455,7 +461,7 @@ SPAN_DECLARE(size_t) t30_get_rx_ira(t30_state_t *s, int *type, const char *addre
SPAN_DECLARE(int) t30_set_tx_cia(t30_state_t *s, int type, const char *address, int len)
{
if (s->tx_info.cia)
- free(s->tx_info.cia);
+ span_free(s->tx_info.cia);
if (address == NULL)
{
s->tx_info.cia = NULL;
@@ -489,7 +495,7 @@ SPAN_DECLARE(size_t) t30_get_rx_cia(t30_state_t *s, int *type, const char *addre
SPAN_DECLARE(int) t30_set_tx_isp(t30_state_t *s, int type, const char *address, int len)
{
if (s->tx_info.isp)
- free(s->tx_info.isp);
+ span_free(s->tx_info.isp);
if (address == NULL)
{
s->tx_info.isp = NULL;
@@ -523,7 +529,7 @@ SPAN_DECLARE(size_t) t30_get_rx_isp(t30_state_t *s, int *type, const char *addre
SPAN_DECLARE(int) t30_set_tx_csa(t30_state_t *s, int type, const char *address, int len)
{
if (s->tx_info.csa)
- free(s->tx_info.csa);
+ span_free(s->tx_info.csa);
if (address == NULL)
{
s->tx_info.csa = NULL;
@@ -554,7 +560,7 @@ SPAN_DECLARE(size_t) t30_get_rx_csa(t30_state_t *s, int *type, const char *addre
}
/*- End of function --------------------------------------------------------*/
-SPAN_DECLARE(int) t30_set_tx_page_header_overlays_image(t30_state_t *s, int header_overlays_image)
+SPAN_DECLARE(int) t30_set_tx_page_header_overlays_image(t30_state_t *s, bool header_overlays_image)
{
s->header_overlays_image = header_overlays_image;
t4_tx_set_header_overlays_image(&s->t4.tx, s->header_overlays_image);
@@ -589,7 +595,7 @@ SPAN_DECLARE(int) t30_set_tx_page_header_tz(t30_state_t *s, const char *tzstring
{
if (tz_init(&s->tz, tzstring))
{
- s->use_own_tz = TRUE;
+ s->use_own_tz = true;
t4_tx_set_header_tz(&s->t4.tx, &s->tz);
return 0;
}
@@ -632,13 +638,13 @@ SPAN_DECLARE(void) t30_set_tx_file(t30_state_t *s, const char *file, int start_p
}
/*- End of function --------------------------------------------------------*/
-SPAN_DECLARE(void) t30_set_iaf_mode(t30_state_t *s, int iaf)
+SPAN_DECLARE(void) t30_set_iaf_mode(t30_state_t *s, bool iaf)
{
s->iaf = iaf;
}
/*- End of function --------------------------------------------------------*/
-SPAN_DECLARE(int) t30_set_ecm_capability(t30_state_t *s, int enabled)
+SPAN_DECLARE(int) t30_set_ecm_capability(t30_state_t *s, bool enabled)
{
s->ecm_allowed = enabled;
t30_build_dis_or_dtc(s);
@@ -685,31 +691,33 @@ SPAN_DECLARE(int) t30_set_supported_modems(t30_state_t *s, int supported_modems)
SPAN_DECLARE(int) t30_set_supported_compressions(t30_state_t *s, int supported_compressions)
{
/* Mask out the ones we actually support today. */
- supported_compressions &= T4_SUPPORT_COMPRESSION_T4_1D
- | T4_SUPPORT_COMPRESSION_T4_2D
- | T4_SUPPORT_COMPRESSION_T6
- | T4_SUPPORT_COMPRESSION_T85
- | T4_SUPPORT_COMPRESSION_T85_L0
+ supported_compressions &= T4_COMPRESSION_T4_1D
+ | T4_COMPRESSION_T4_2D
+ | T4_COMPRESSION_T6
+ | T4_COMPRESSION_T85
+ | T4_COMPRESSION_T85_L0
#if defined(SPANDSP_SUPPORT_T88)
- | T4_SUPPORT_COMPRESSION_T88
+ | T4_COMPRESSION_T88
+#endif
+ | T4_COMPRESSION_T42_T81
+#if defined(SPANDSP_SUPPORT_SYCC_T81)
+ | T4_COMPRESSION_SYCC_T81
#endif
- //| T4_SUPPORT_COMPRESSION_T81
#if defined(SPANDSP_SUPPORT_T43)
- | T4_SUPPORT_COMPRESSION_T43
+ | T4_COMPRESSION_T43
#endif
#if defined(SPANDSP_SUPPORT_T45)
- | T4_SUPPORT_COMPRESSION_T45
-#endif
-#if 0
- | T4_SUPPORT_COMPRESSION_GRAYSCALE
- | T4_SUPPORT_COMPRESSION_COLOUR
- | T4_SUPPORT_COMPRESSION_12BIT
- | T4_SUPPORT_COMPRESSION_COLOUR_TO_GRAY
- | T4_SUPPORT_COMPRESSION_GRAY_TO_BILEVEL
- | T4_SUPPORT_COMPRESSION_COLOUR_TO_BILEVEL
- | T4_SUPPORT_COMPRESSION_RESCALING
+ | T4_COMPRESSION_T45
#endif
+ | T4_COMPRESSION_GRAYSCALE
+ | T4_COMPRESSION_COLOUR
+ | T4_COMPRESSION_12BIT
+ | T4_COMPRESSION_COLOUR_TO_GRAY
+ | T4_COMPRESSION_GRAY_TO_BILEVEL
+ | T4_COMPRESSION_COLOUR_TO_BILEVEL
+ | T4_COMPRESSION_RESCALING
| 0;
+
s->supported_compressions = supported_compressions;
t30_build_dis_or_dtc(s);
return 0;
@@ -718,23 +726,23 @@ SPAN_DECLARE(int) t30_set_supported_compressions(t30_state_t *s, int supported_c
SPAN_DECLARE(int) t30_set_supported_bilevel_resolutions(t30_state_t *s, int supported_resolutions)
{
- supported_resolutions &= T4_SUPPORT_RESOLUTION_R8_STANDARD
- | T4_SUPPORT_RESOLUTION_R8_FINE
- | T4_SUPPORT_RESOLUTION_R8_SUPERFINE
- | T4_SUPPORT_RESOLUTION_R16_SUPERFINE
- | T4_SUPPORT_RESOLUTION_200_100
- | T4_SUPPORT_RESOLUTION_200_200
- | T4_SUPPORT_RESOLUTION_200_400
- | T4_SUPPORT_RESOLUTION_300_300
- | T4_SUPPORT_RESOLUTION_300_600
- | T4_SUPPORT_RESOLUTION_400_400
- | T4_SUPPORT_RESOLUTION_400_800
- | T4_SUPPORT_RESOLUTION_600_600
- | T4_SUPPORT_RESOLUTION_600_1200
- | T4_SUPPORT_RESOLUTION_1200_1200;
+ supported_resolutions &= T4_RESOLUTION_R8_STANDARD
+ | T4_RESOLUTION_R8_FINE
+ | T4_RESOLUTION_R8_SUPERFINE
+ | T4_RESOLUTION_R16_SUPERFINE
+ | T4_RESOLUTION_200_100
+ | T4_RESOLUTION_200_200
+ | T4_RESOLUTION_200_400
+ | T4_RESOLUTION_300_300
+ | T4_RESOLUTION_300_600
+ | T4_RESOLUTION_400_400
+ | T4_RESOLUTION_400_800
+ | T4_RESOLUTION_600_600
+ | T4_RESOLUTION_600_1200
+ | T4_RESOLUTION_1200_1200;
/* Make sure anything needed for colour is enabled as a bi-level image, as that is a
rule from T.30. 100x100 is an exception, as it doesn't exist as a bi-level resolution. */
- supported_resolutions |= (s->supported_colour_resolutions & ~T4_SUPPORT_RESOLUTION_100_100);
+ supported_resolutions |= (s->supported_colour_resolutions & ~T4_RESOLUTION_100_100);
s->supported_bilevel_resolutions = supported_resolutions;
t30_build_dis_or_dtc(s);
return 0;
@@ -743,16 +751,16 @@ SPAN_DECLARE(int) t30_set_supported_bilevel_resolutions(t30_state_t *s, int supp
SPAN_DECLARE(int) t30_set_supported_colour_resolutions(t30_state_t *s, int supported_resolutions)
{
- supported_resolutions &= T4_SUPPORT_RESOLUTION_100_100
- | T4_SUPPORT_RESOLUTION_200_200
- | T4_SUPPORT_RESOLUTION_300_300
- | T4_SUPPORT_RESOLUTION_400_400
- | T4_SUPPORT_RESOLUTION_600_600
- | T4_SUPPORT_RESOLUTION_1200_1200;
+ supported_resolutions &= T4_RESOLUTION_100_100
+ | T4_RESOLUTION_200_200
+ | T4_RESOLUTION_300_300
+ | T4_RESOLUTION_400_400
+ | T4_RESOLUTION_600_600
+ | T4_RESOLUTION_1200_1200;
s->supported_colour_resolutions = supported_resolutions;
/* Make sure anything needed for colour is enabled as a bi-level image, as that is a
rule from T.30. 100x100 is an exception, as it doesn't exist as a bi-level resolution. */
- s->supported_bilevel_resolutions |= (s->supported_colour_resolutions & ~T4_SUPPORT_RESOLUTION_100_100);
+ s->supported_bilevel_resolutions |= (s->supported_colour_resolutions & ~T4_RESOLUTION_100_100);
t30_build_dis_or_dtc(s);
return 0;
}
diff --git a/libs/spandsp/src/t30_logging.c b/libs/spandsp/src/t30_logging.c
index 33efcb9c03..ce1dc74664 100644
--- a/libs/spandsp/src/t30_logging.c
+++ b/libs/spandsp/src/t30_logging.c
@@ -41,6 +41,11 @@
#if defined(HAVE_MATH_H)
#include
#endif
+#if defined(HAVE_STDBOOL_H)
+#include
+#else
+#include "spandsp/stdbool.h"
+#endif
#include "floating_fudge.h"
#include
diff --git a/libs/spandsp/src/t31.c b/libs/spandsp/src/t31.c
index 6a9f08d382..79ba8f5286 100644
--- a/libs/spandsp/src/t31.c
+++ b/libs/spandsp/src/t31.c
@@ -46,11 +46,17 @@
#if defined(HAVE_MATH_H)
#include
#endif
+#if defined(HAVE_STDBOOL_H)
+#include
+#else
+#include "spandsp/stdbool.h"
+#endif
#include "floating_fudge.h"
#include
#include
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/bit_operations.h"
#include "spandsp/bitstream.h"
@@ -93,6 +99,7 @@
#include "spandsp/private/bitstream.h"
#include "spandsp/private/t38_core.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"
@@ -215,7 +222,7 @@ static int front_end_status(t31_state_t *s, int status)
{
at_modem_control(&s->at_state, AT_MODEM_CONTROL_HANGUP, NULL);
t31_set_at_rx_mode(s, AT_MODE_ONHOOK_COMMAND);
- s->at_state.do_hangup = FALSE;
+ s->at_state.do_hangup = false;
}
else
{
@@ -309,7 +316,7 @@ static int process_rx_missing(t38_core_state_t *t, void *user_data, int rx_seq_n
t31_state_t *s;
s = (t31_state_t *) user_data;
- s->t38_fe.rx_data_missing = TRUE;
+ s->t38_fe.rx_data_missing = true;
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -391,7 +398,7 @@ static int process_rx_indicator(t38_core_state_t *t, void *user_data, int indica
}
/*endswitch*/
fe->hdlc_rx.len = 0;
- fe->rx_data_missing = FALSE;
+ fe->rx_data_missing = false;
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -405,7 +412,7 @@ static void process_hdlc_data(t31_t38_front_end_state_t *fe, const uint8_t *buf,
}
else
{
- fe->rx_data_missing = TRUE;
+ fe->rx_data_missing = true;
}
/*endif*/
}
@@ -460,7 +467,7 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type,
/* All real HDLC messages in the FAX world start with 0xFF. If this one is not starting
with 0xFF it would appear some octets must have been missed before this one. */
if (len <= 0 || buf[0] != 0xFF)
- fe->rx_data_missing = TRUE;
+ fe->rx_data_missing = true;
/*endif*/
}
/*endif*/
@@ -514,7 +521,7 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type,
fe->hdlc_rx.len = 0;
}
/*endif*/
- fe->rx_data_missing = FALSE;
+ fe->rx_data_missing = false;
fe->timeout_rx_samples = fe->samples + ms_to_samples(MID_RX_TIMEOUT);
break;
case T38_FIELD_HDLC_FCS_BAD:
@@ -533,14 +540,14 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type,
{
span_log(&s->logging, SPAN_LOG_FLOW, "Type %s - CRC bad (%s)\n", (fe->hdlc_rx.len >= 3) ? t30_frametype(fe->hdlc_rx.buf[2]) : "???", (fe->rx_data_missing) ? "missing octets" : "clean");
if (data_type == T38_DATA_V21)
- hdlc_accept_frame(s, fe->hdlc_rx.buf, fe->hdlc_rx.len, FALSE);
+ hdlc_accept_frame(s, fe->hdlc_rx.buf, fe->hdlc_rx.len, false);
else
- hdlc_accept_t38_frame(s, fe->hdlc_rx.buf, fe->hdlc_rx.len, FALSE);
+ hdlc_accept_t38_frame(s, fe->hdlc_rx.buf, fe->hdlc_rx.len, false);
/*endif*/
fe->hdlc_rx.len = 0;
}
/*endif*/
- fe->rx_data_missing = FALSE;
+ fe->rx_data_missing = false;
fe->timeout_rx_samples = fe->samples + ms_to_samples(MID_RX_TIMEOUT);
break;
case T38_FIELD_HDLC_FCS_OK_SIG_END:
@@ -586,7 +593,7 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type,
fe->hdlc_rx.len = 0;
}
/*endif*/
- fe->rx_data_missing = FALSE;
+ fe->rx_data_missing = false;
if (t->current_rx_data_type != data_type || t->current_rx_field_type != field_type)
{
if (data_type == T38_DATA_V21)
@@ -614,14 +621,14 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type,
{
span_log(&s->logging, SPAN_LOG_FLOW, "Type %s - CRC bad, sig end (%s)\n", (fe->hdlc_rx.len >= 3) ? t30_frametype(fe->hdlc_rx.buf[2]) : "???", (fe->rx_data_missing) ? "missing octets" : "clean");
if (data_type == T38_DATA_V21)
- hdlc_accept_frame(s, fe->hdlc_rx.buf, fe->hdlc_rx.len, FALSE);
+ hdlc_accept_frame(s, fe->hdlc_rx.buf, fe->hdlc_rx.len, false);
else
- hdlc_accept_t38_frame(s, fe->hdlc_rx.buf, fe->hdlc_rx.len, FALSE);
+ hdlc_accept_t38_frame(s, fe->hdlc_rx.buf, fe->hdlc_rx.len, false);
/*endif*/
fe->hdlc_rx.len = 0;
}
/*endif*/
- fe->rx_data_missing = FALSE;
+ fe->rx_data_missing = false;
if (t->current_rx_data_type != data_type || t->current_rx_field_type != field_type)
{
if (data_type == T38_DATA_V21)
@@ -653,7 +660,7 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type,
i.e. they send T38_FIELD_HDLC_FCS_OK, and then T38_FIELD_HDLC_SIG_END when the carrier actually drops.
The other is because the HDLC signal drops unexpectedly - i.e. not just after a final frame. */
fe->hdlc_rx.len = 0;
- fe->rx_data_missing = FALSE;
+ fe->rx_data_missing = false;
fe->timeout_rx_samples = 0;
if (data_type == T38_DATA_V21)
hdlc_rx_status(s, SIG_STATUS_CARRIER_DOWN);
@@ -669,7 +676,7 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type,
if (!s->at_state.rx_signal_present)
{
non_ecm_rx_status(s, SIG_STATUS_TRAINING_SUCCEEDED);
- s->at_state.rx_signal_present = TRUE;
+ s->at_state.rx_signal_present = true;
}
/*endif*/
bit_reverse(buf2, buf, len);
@@ -689,7 +696,7 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type,
if (!s->at_state.rx_signal_present)
{
non_ecm_rx_status(s, SIG_STATUS_TRAINING_SUCCEEDED);
- s->at_state.rx_signal_present = TRUE;
+ s->at_state.rx_signal_present = true;
}
/*endif*/
bit_reverse(buf2, buf, len);
@@ -703,7 +710,7 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type,
non_ecm_rx_status(s, SIG_STATUS_CARRIER_DOWN);
}
/*endif*/
- s->at_state.rx_signal_present = FALSE;
+ s->at_state.rx_signal_present = false;
fe->timeout_rx_samples = 0;
break;
case T38_FIELD_CM_MESSAGE:
@@ -1177,7 +1184,7 @@ static int stream_hdlc(t31_state_t *s)
else
{
/* End of transmission */
- s->hdlc_tx.final = FALSE;
+ s->hdlc_tx.final = false;
category = (fe->current_tx_data_type == T38_DATA_V21) ? T38_PACKET_CATEGORY_CONTROL_DATA_END : T38_PACKET_CATEGORY_IMAGE_DATA_END;
if ((res = t38_core_send_data(&fe->t38, previous, T38_FIELD_HDLC_FCS_OK_SIG_END, NULL, 0, category)) < 0)
return res;
@@ -1301,7 +1308,7 @@ SPAN_DECLARE(int) t31_t38_send_timeout(t31_state_t *s, int samples)
fe = &s->t38_fe;
if (fe->current_rx_type == T30_MODEM_DONE || fe->current_tx_type == T30_MODEM_DONE)
- return TRUE;
+ return true;
/*endif*/
fe->samples += samples;
@@ -1313,12 +1320,12 @@ SPAN_DECLARE(int) t31_t38_send_timeout(t31_state_t *s, int samples)
}
/*endif*/
if (fe->timed_step == T38_TIMED_STEP_NONE)
- return FALSE;
+ return false;
/*endif*/
/* Wait until the right time comes along, unless we are working in "no delays" mode, while talking to an
IAF terminal. */
if (fe->us_per_tx_chunk && fe->samples < fe->next_tx_samples)
- return FALSE;
+ return false;
/*endif*/
/* Its time to send something */
delay = 0;
@@ -1347,7 +1354,7 @@ SPAN_DECLARE(int) t31_t38_send_timeout(t31_state_t *s, int samples)
}
/*endswitch*/
fe->next_tx_samples += us_to_samples(delay);
- return FALSE;
+ return false;
}
/*- End of function --------------------------------------------------------*/
@@ -1369,7 +1376,7 @@ static int t31_modem_control_handler(at_state_t *s, void *user_data, int op, con
case AT_MODEM_CONTROL_ONHOOK:
if (t->non_ecm_tx.holding)
{
- t->non_ecm_tx.holding = FALSE;
+ t->non_ecm_tx.holding = false;
/* Tell the application to release further data */
at_modem_control(&t->at_state, AT_MODEM_CONTROL_CTS, (void *) 1);
}
@@ -1413,15 +1420,15 @@ static void non_ecm_rx_status(void *user_data, int status)
case SIG_STATUS_TRAINING_IN_PROGRESS:
break;
case SIG_STATUS_TRAINING_FAILED:
- s->at_state.rx_trained = FALSE;
- s->audio.modems.rx_trained = FALSE;
+ s->at_state.rx_trained = false;
+ s->audio.modems.rx_trained = false;
break;
case SIG_STATUS_TRAINING_SUCCEEDED:
/* The modem is now trained */
at_put_response_code(&s->at_state, AT_RESPONSE_CODE_CONNECT);
- s->at_state.rx_signal_present = TRUE;
- s->at_state.rx_trained = TRUE;
- s->audio.modems.rx_trained = TRUE;
+ s->at_state.rx_signal_present = true;
+ s->at_state.rx_trained = true;
+ s->audio.modems.rx_trained = true;
break;
case SIG_STATUS_CARRIER_UP:
break;
@@ -1439,9 +1446,9 @@ static void non_ecm_rx_status(void *user_data, int status)
t31_set_at_rx_mode(s, AT_MODE_OFFHOOK_COMMAND);
}
/*endif*/
- s->at_state.rx_signal_present = FALSE;
- s->at_state.rx_trained = FALSE;
- s->audio.modems.rx_trained = FALSE;
+ s->at_state.rx_signal_present = false;
+ s->at_state.rx_trained = false;
+ s->audio.modems.rx_trained = false;
break;
default:
if (s->at_state.p.result_code_format)
@@ -1496,7 +1503,7 @@ static void non_ecm_put(void *user_data, const uint8_t buf[], int len)
if (!s->at_state.rx_signal_present)
{
non_ecm_rx_status(s, SIG_STATUS_TRAINING_SUCCEEDED);
- s->at_state.rx_signal_present = TRUE;
+ s->at_state.rx_signal_present = true;
}
/*endif*/
/* Ignore any fractional bytes which may have accumulated */
@@ -1546,20 +1553,20 @@ static int non_ecm_get_bit(void *user_data)
release flow control. */
if (s->non_ecm_tx.out_bytes > T31_TX_BUF_LOW_TIDE)
{
- s->non_ecm_tx.holding = FALSE;
+ s->non_ecm_tx.holding = false;
/* Tell the application to release further data */
at_modem_control(&s->at_state, AT_MODEM_CONTROL_CTS, (void *) 1);
}
/*endif*/
}
/*endif*/
- s->non_ecm_tx.data_started = TRUE;
+ s->non_ecm_tx.data_started = true;
}
else
{
if (s->non_ecm_tx.final)
{
- s->non_ecm_tx.final = FALSE;
+ s->non_ecm_tx.final = false;
/* This will put the modem into its shutdown sequence. When
it has finally shut down, an OK response will be sent. */
return SIG_STATUS_END_OF_DATA;
@@ -1603,20 +1610,20 @@ static int non_ecm_get(void *user_data, uint8_t buf[], int len)
/* See if the buffer is approaching empty. It might be time to release flow control. */
if (s->non_ecm_tx.out_bytes > T31_TX_BUF_LOW_TIDE)
{
- s->non_ecm_tx.holding = FALSE;
+ s->non_ecm_tx.holding = false;
/* Tell the application to release further data */
at_modem_control(&s->at_state, AT_MODEM_CONTROL_CTS, (void *) 1);
}
/*endif*/
}
/*endif*/
- s->non_ecm_tx.data_started = TRUE;
+ s->non_ecm_tx.data_started = true;
}
else
{
if (s->non_ecm_tx.final)
{
- s->non_ecm_tx.final = FALSE;
+ s->non_ecm_tx.final = false;
/* This will put the modem into its shutdown sequence. When
it has finally shut down, an OK response will be sent. */
return i;
@@ -1660,7 +1667,7 @@ static void hdlc_tx_underflow(void *user_data)
s = (t31_state_t *) user_data;
if (s->hdlc_tx.final)
{
- s->hdlc_tx.final = FALSE;
+ s->hdlc_tx.final = false;
/* Schedule an orderly shutdown of the modem */
hdlc_tx_frame(&s->audio.modems.hdlc_tx, NULL, 0);
}
@@ -1688,21 +1695,21 @@ static void hdlc_rx_status(void *user_data, int status)
case SIG_STATUS_TRAINING_IN_PROGRESS:
break;
case SIG_STATUS_TRAINING_FAILED:
- s->at_state.rx_trained = FALSE;
- s->audio.modems.rx_trained = FALSE;
+ s->at_state.rx_trained = false;
+ s->audio.modems.rx_trained = false;
break;
case SIG_STATUS_TRAINING_SUCCEEDED:
/* The modem is now trained */
- s->at_state.rx_signal_present = TRUE;
- s->at_state.rx_trained = TRUE;
- s->audio.modems.rx_trained = TRUE;
+ s->at_state.rx_signal_present = true;
+ s->at_state.rx_trained = true;
+ s->audio.modems.rx_trained = true;
break;
case SIG_STATUS_CARRIER_UP:
if (s->modem == FAX_MODEM_CNG_TONE_TX || s->modem == FAX_MODEM_NOCNG_TONE_TX || s->modem == FAX_MODEM_V21_RX)
{
- s->at_state.rx_signal_present = TRUE;
- s->rx_frame_received = FALSE;
- s->audio.modems.rx_frame_received = FALSE;
+ s->at_state.rx_signal_present = true;
+ s->rx_frame_received = false;
+ s->audio.modems.rx_frame_received = false;
}
/*endif*/
break;
@@ -1714,14 +1721,14 @@ static void hdlc_rx_status(void *user_data, int status)
if (s->at_state.ok_is_pending)
{
at_put_response_code(&s->at_state, AT_RESPONSE_CODE_OK);
- s->at_state.ok_is_pending = FALSE;
+ s->at_state.ok_is_pending = false;
}
else
{
at_put_response_code(&s->at_state, AT_RESPONSE_CODE_NO_CARRIER);
}
/*endif*/
- s->at_state.dte_is_waiting = FALSE;
+ s->at_state.dte_is_waiting = false;
t31_set_at_rx_mode(s, AT_MODE_OFFHOOK_COMMAND);
}
else
@@ -1732,9 +1739,9 @@ static void hdlc_rx_status(void *user_data, int status)
/*endif*/
}
/*endif*/
- s->at_state.rx_signal_present = FALSE;
- s->at_state.rx_trained = FALSE;
- s->audio.modems.rx_trained = FALSE;
+ s->at_state.rx_signal_present = false;
+ s->at_state.rx_trained = false;
+ s->audio.modems.rx_trained = false;
break;
case SIG_STATUS_FRAMING_OK:
if (s->modem == FAX_MODEM_CNG_TONE_TX || s->modem == FAX_MODEM_NOCNG_TONE_TX)
@@ -1742,7 +1749,7 @@ static void hdlc_rx_status(void *user_data, int status)
/* Once we get any valid HDLC the CNG tone stops, and we drop
to the V.21 receive modem on its own. */
s->modem = FAX_MODEM_V21_RX;
- s->at_state.transmit = FALSE;
+ s->at_state.transmit = false;
}
/*endif*/
if (s->modem == FAX_MODEM_V17_RX || s->modem == FAX_MODEM_V27TER_RX || s->modem == FAX_MODEM_V29_RX)
@@ -1753,12 +1760,12 @@ static void hdlc_rx_status(void *user_data, int status)
V.21 receive mode. */
if (s->at_state.p.adaptive_receive)
{
- s->at_state.rx_signal_present = TRUE;
- s->rx_frame_received = TRUE;
- s->audio.modems.rx_frame_received = TRUE;
+ s->at_state.rx_signal_present = true;
+ s->rx_frame_received = true;
+ s->audio.modems.rx_frame_received = true;
s->modem = FAX_MODEM_V21_RX;
- s->at_state.transmit = FALSE;
- s->at_state.dte_is_waiting = TRUE;
+ s->at_state.transmit = false;
+ s->at_state.dte_is_waiting = true;
at_put_response_code(&s->at_state, AT_RESPONSE_CODE_FRH3);
at_put_response_code(&s->at_state, AT_RESPONSE_CODE_CONNECT);
}
@@ -1766,8 +1773,8 @@ static void hdlc_rx_status(void *user_data, int status)
{
s->modem = FAX_MODEM_SILENCE_TX;
t31_set_at_rx_mode(s, AT_MODE_OFFHOOK_COMMAND);
- s->rx_frame_received = FALSE;
- s->audio.modems.rx_frame_received = FALSE;
+ s->rx_frame_received = false;
+ s->audio.modems.rx_frame_received = false;
at_put_response_code(&s->at_state, AT_RESPONSE_CODE_FCERROR);
}
/*endif*/
@@ -1780,8 +1787,8 @@ static void hdlc_rx_status(void *user_data, int status)
{
/* Report CONNECT as soon as possible to avoid a timeout. */
at_put_response_code(&s->at_state, AT_RESPONSE_CODE_CONNECT);
- s->rx_frame_received = TRUE;
- s->audio.modems.rx_frame_received = TRUE;
+ s->rx_frame_received = true;
+ s->audio.modems.rx_frame_received = true;
}
else
{
@@ -1824,8 +1831,8 @@ static void hdlc_accept_frame(void *user_data, const uint8_t *msg, int len, int
{
/* Report CONNECT as soon as possible to avoid a timeout. */
at_put_response_code(&s->at_state, AT_RESPONSE_CODE_CONNECT);
- s->rx_frame_received = TRUE;
- s->audio.modems.rx_frame_received = TRUE;
+ s->rx_frame_received = true;
+ s->audio.modems.rx_frame_received = true;
}
else
{
@@ -1859,14 +1866,14 @@ static void hdlc_accept_frame(void *user_data, const uint8_t *msg, int len, int
{
/* This is the last frame. We don't send OK until the carrier drops to avoid
redetecting it later. */
- s->at_state.ok_is_pending = TRUE;
+ s->at_state.ok_is_pending = true;
}
else
{
at_put_response_code(&s->at_state, (ok) ? AT_RESPONSE_CODE_OK : AT_RESPONSE_CODE_ERROR);
- s->at_state.dte_is_waiting = FALSE;
- s->rx_frame_received = FALSE;
- s->audio.modems.rx_frame_received = FALSE;
+ s->at_state.dte_is_waiting = false;
+ s->rx_frame_received = false;
+ s->audio.modems.rx_frame_received = false;
}
/*endif*/
}
@@ -2014,13 +2021,13 @@ static void hdlc_accept_non_ecm_frame(void *user_data, const uint8_t *msg, int l
static void t31_v21_rx(t31_state_t *s)
{
- s->at_state.ok_is_pending = FALSE;
+ s->at_state.ok_is_pending = false;
s->hdlc_tx.len = 0;
- s->hdlc_tx.final = FALSE;
- s->dled = FALSE;
- hdlc_rx_init(&s->audio.modems.hdlc_rx, FALSE, TRUE, HDLC_FRAMING_OK_THRESHOLD, hdlc_accept_frame, s);
+ s->hdlc_tx.final = false;
+ s->dled = false;
+ hdlc_rx_init(&s->audio.modems.hdlc_rx, false, true, HDLC_FRAMING_OK_THRESHOLD, hdlc_accept_frame, s);
fax_modems_start_slow_modem(&s->audio.modems, FAX_MODEM_V21_RX);
- s->at_state.transmit = TRUE;
+ s->at_state.transmit = true;
}
/*- End of function --------------------------------------------------------*/
@@ -2037,14 +2044,14 @@ static int restart_modem(t31_state_t *s, int new_modem)
/*endif*/
queue_flush(s->rx_queue);
s->modem = new_modem;
- s->non_ecm_tx.final = FALSE;
- s->at_state.rx_signal_present = FALSE;
- s->at_state.rx_trained = FALSE;
- s->audio.modems.rx_trained = FALSE;
- s->rx_frame_received = FALSE;
- s->audio.modems.rx_frame_received = FALSE;
+ s->non_ecm_tx.final = false;
+ s->at_state.rx_signal_present = false;
+ s->at_state.rx_trained = false;
+ s->audio.modems.rx_trained = false;
+ s->rx_frame_received = false;
+ s->audio.modems.rx_frame_received = false;
fax_modems_set_rx_handler(t, (span_rx_handler_t) &span_dummy_rx, NULL, (span_rx_fillin_handler_t) &span_dummy_rx_fillin, NULL);
- use_hdlc = FALSE;
+ use_hdlc = false;
switch (s->modem)
{
case FAX_MODEM_CNG_TONE_TX:
@@ -2067,7 +2074,7 @@ static int restart_modem(t31_state_t *s, int new_modem)
fax_modems_set_next_tx_handler(t, (span_tx_handler_t) NULL, NULL);
}
/*endif*/
- s->at_state.transmit = TRUE;
+ s->at_state.transmit = true;
break;
case FAX_MODEM_NOCNG_TONE_TX:
if (s->t38_mode)
@@ -2081,7 +2088,7 @@ static int restart_modem(t31_state_t *s, int new_modem)
fax_modems_set_tx_handler(t, (span_tx_handler_t) &silence_gen, &t->silence_gen);
}
/*endif*/
- s->at_state.transmit = FALSE;
+ s->at_state.transmit = false;
break;
case FAX_MODEM_CED_TONE_TX:
if (s->t38_mode)
@@ -2096,7 +2103,7 @@ static int restart_modem(t31_state_t *s, int new_modem)
fax_modems_set_next_tx_handler(t, (span_tx_handler_t) NULL, NULL);
}
/*endif*/
- s->at_state.transmit = TRUE;
+ s->at_state.transmit = true;
break;
case FAX_MODEM_V21_RX:
if (s->t38_mode)
@@ -2114,13 +2121,13 @@ static int restart_modem(t31_state_t *s, int new_modem)
{
s->t38_fe.next_tx_indicator = T38_IND_V21_PREAMBLE;
s->t38_fe.current_tx_data_type = T38_DATA_V21;
- use_hdlc = TRUE;
+ use_hdlc = true;
s->t38_fe.timed_step = (use_hdlc) ? T38_TIMED_STEP_HDLC_MODEM : T38_TIMED_STEP_NON_ECM_MODEM;
set_octets_per_data_packet(s, 300);
}
else
{
- hdlc_tx_init(&t->hdlc_tx, FALSE, 2, FALSE, hdlc_tx_underflow, s);
+ hdlc_tx_init(&t->hdlc_tx, false, 2, false, hdlc_tx_underflow, s);
/* The spec says 1s +-15% of preamble. So, the minimum is 32 octets. */
hdlc_tx_flags(&t->hdlc_tx, 32);
fax_modems_start_slow_modem(t, FAX_MODEM_V21_TX);
@@ -2129,9 +2136,9 @@ static int restart_modem(t31_state_t *s, int new_modem)
}
/*endif*/
s->hdlc_tx.len = 0;
- s->hdlc_tx.final = FALSE;
- s->dled = FALSE;
- s->at_state.transmit = TRUE;
+ s->hdlc_tx.final = false;
+ s->dled = false;
+ s->at_state.transmit = true;
break;
case FAX_MODEM_V17_RX:
case FAX_MODEM_V27TER_RX:
@@ -2143,7 +2150,7 @@ static int restart_modem(t31_state_t *s, int new_modem)
fax_modems_start_fast_modem(t, s->modem, s->bit_rate, s->short_train, use_hdlc);
}
/*endif*/
- s->at_state.transmit = FALSE;
+ s->at_state.transmit = false;
break;
case FAX_MODEM_V17_TX:
if (s->t38_mode)
@@ -2177,8 +2184,8 @@ static int restart_modem(t31_state_t *s, int new_modem)
}
/*endif*/
s->non_ecm_tx.out_bytes = 0;
- s->non_ecm_tx.data_started = FALSE;
- s->at_state.transmit = TRUE;
+ s->non_ecm_tx.data_started = false;
+ s->at_state.transmit = true;
break;
case FAX_MODEM_V27TER_TX:
if (s->t38_mode)
@@ -2204,8 +2211,8 @@ static int restart_modem(t31_state_t *s, int new_modem)
}
/*endif*/
s->non_ecm_tx.out_bytes = 0;
- s->non_ecm_tx.data_started = FALSE;
- s->at_state.transmit = TRUE;
+ s->non_ecm_tx.data_started = false;
+ s->at_state.transmit = true;
break;
case FAX_MODEM_V29_TX:
if (s->t38_mode)
@@ -2231,8 +2238,8 @@ static int restart_modem(t31_state_t *s, int new_modem)
}
/*endif*/
s->non_ecm_tx.out_bytes = 0;
- s->non_ecm_tx.data_started = FALSE;
- s->at_state.transmit = TRUE;
+ s->non_ecm_tx.data_started = false;
+ s->at_state.transmit = true;
break;
case FAX_MODEM_SILENCE_TX:
if (s->t38_mode)
@@ -2251,7 +2258,7 @@ static int restart_modem(t31_state_t *s, int new_modem)
fax_modems_set_next_tx_handler(t, (span_tx_handler_t) NULL, NULL);
}
/*endif*/
- s->at_state.transmit = FALSE;
+ s->at_state.transmit = false;
break;
case FAX_MODEM_SILENCE_RX:
if (!s->t38_mode)
@@ -2262,7 +2269,7 @@ static int restart_modem(t31_state_t *s, int new_modem)
fax_modems_set_next_tx_handler(t, (span_tx_handler_t) NULL, NULL);
}
/*endif*/
- s->at_state.transmit = FALSE;
+ s->at_state.transmit = false;
break;
case FAX_MODEM_FLUSH:
/* Send 200ms of silence to "push" the last audio out */
@@ -2278,7 +2285,7 @@ static int restart_modem(t31_state_t *s, int new_modem)
silence_gen_alter(&t->silence_gen, ms_to_samples(200));
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);
- s->at_state.transmit = TRUE;
+ s->at_state.transmit = true;
}
/*endif*/
break;
@@ -2300,7 +2307,7 @@ static __inline__ void dle_unstuff_hdlc(t31_state_t *s, const char *stuffed, int
{
if (s->dled)
{
- s->dled = FALSE;
+ s->dled = false;
if (stuffed[i] == ETX)
{
s->hdlc_tx.final = (s->hdlc_tx.buf[1] & 0x10);
@@ -2329,7 +2336,7 @@ static __inline__ void dle_unstuff_hdlc(t31_state_t *s, const char *stuffed, int
else
{
if (stuffed[i] == DLE)
- s->dled = TRUE;
+ s->dled = true;
else
s->hdlc_tx.buf[s->hdlc_tx.len++] = stuffed[i];
/*endif*/
@@ -2348,10 +2355,10 @@ static __inline__ void dle_unstuff_fake_hdlc(t31_state_t *s, const char *stuffed
{
if (s->dled)
{
- s->dled = FALSE;
+ s->dled = false;
if (stuffed[i] == ETX)
{
- s->non_ecm_tx.final = TRUE;
+ s->non_ecm_tx.final = true;
t31_set_at_rx_mode(s, AT_MODE_OFFHOOK_COMMAND);
return;
}
@@ -2369,7 +2376,7 @@ static __inline__ void dle_unstuff_fake_hdlc(t31_state_t *s, const char *stuffed
else
{
if (stuffed[i] == DLE)
- s->dled = TRUE;
+ s->dled = true;
else
hdlc_rx_put_byte(&s->t38_fe.hdlc_rx_non_ecm, bit_reverse8(stuffed[i]));
/*endif*/
@@ -2388,10 +2395,10 @@ static __inline__ void dle_unstuff(t31_state_t *s, const char *stuffed, int len)
{
if (s->dled)
{
- s->dled = FALSE;
+ s->dled = false;
if (stuffed[i] == ETX)
{
- s->non_ecm_tx.final = TRUE;
+ s->non_ecm_tx.final = true;
t31_set_at_rx_mode(s, AT_MODE_OFFHOOK_COMMAND);
return;
}
@@ -2410,7 +2417,7 @@ static __inline__ void dle_unstuff(t31_state_t *s, const char *stuffed, int len)
else
{
if (stuffed[i] == DLE)
- s->dled = TRUE;
+ s->dled = true;
else
s->non_ecm_tx.buf[s->non_ecm_tx.in_bytes++] = stuffed[i];
/*endif*/
@@ -2430,7 +2437,7 @@ static __inline__ void dle_unstuff(t31_state_t *s, const char *stuffed, int len)
/* See if the buffer is approaching full. We might need to apply flow control. */
if (s->non_ecm_tx.in_bytes > T31_TX_BUF_HIGH_TIDE)
{
- s->non_ecm_tx.holding = TRUE;
+ s->non_ecm_tx.holding = true;
/* Tell the application to hold further data */
at_modem_control(&s->at_state, AT_MODEM_CONTROL_CTS, (void *) 0);
}
@@ -2452,7 +2459,7 @@ static int process_class1_cmd(at_state_t *t, void *user_data, int direction, int
s = (t31_state_t *) user_data;
new_transmit = direction;
- immediate_response = TRUE;
+ immediate_response = true;
switch (operation)
{
case 'S':
@@ -2466,7 +2473,7 @@ static int process_class1_cmd(at_state_t *t, void *user_data, int direction, int
else
silence_gen_alter(&s->audio.modems.silence_gen, ms_to_samples(val*10));
/*endif*/
- s->at_state.transmit = TRUE;
+ s->at_state.transmit = true;
}
else
{
@@ -2486,7 +2493,7 @@ static int process_class1_cmd(at_state_t *t, void *user_data, int direction, int
/*endif*/
}
/*endif*/
- immediate_response = FALSE;
+ immediate_response = false;
span_log(&s->logging, SPAN_LOG_FLOW, "Silence %dms\n", val*10);
break;
case 'H':
@@ -2494,7 +2501,7 @@ static int process_class1_cmd(at_state_t *t, void *user_data, int direction, int
{
case 3:
new_modem = (new_transmit) ? FAX_MODEM_V21_TX : FAX_MODEM_V21_RX;
- s->short_train = FALSE;
+ s->short_train = false;
s->bit_rate = 300;
break;
default:
@@ -2505,7 +2512,7 @@ static int process_class1_cmd(at_state_t *t, void *user_data, int direction, int
if (new_modem != s->modem)
{
restart_modem(s, new_modem);
- immediate_response = FALSE;
+ immediate_response = false;
}
/*endif*/
s->at_state.transmit = new_transmit;
@@ -2520,8 +2527,8 @@ static int process_class1_cmd(at_state_t *t, void *user_data, int direction, int
{
/* Send straight away, if there is something queued. */
t31_set_at_rx_mode(s, AT_MODE_DELIVERY);
- s->rx_frame_received = FALSE;
- s->audio.modems.rx_frame_received = FALSE;
+ s->rx_frame_received = false;
+ s->audio.modems.rx_frame_received = false;
do
{
if (!queue_empty(s->rx_queue))
@@ -2550,7 +2557,7 @@ static int process_class1_cmd(at_state_t *t, void *user_data, int direction, int
}
else
{
- s->at_state.dte_is_waiting = TRUE;
+ s->at_state.dte_is_waiting = true;
break;
}
/*endif*/
@@ -2558,7 +2565,7 @@ static int process_class1_cmd(at_state_t *t, void *user_data, int direction, int
while (msg[0] == AT_RESPONSE_CODE_CONNECT);
}
/*endif*/
- immediate_response = FALSE;
+ immediate_response = false;
break;
default:
switch (val)
@@ -2567,84 +2574,84 @@ static int process_class1_cmd(at_state_t *t, void *user_data, int direction, int
s->t38_fe.next_tx_indicator = T38_IND_V27TER_2400_TRAINING;
s->t38_fe.current_tx_data_type = T38_DATA_V27TER_2400;
new_modem = (new_transmit) ? FAX_MODEM_V27TER_TX : FAX_MODEM_V27TER_RX;
- s->short_train = FALSE;
+ s->short_train = false;
s->bit_rate = 2400;
break;
case 48:
s->t38_fe.next_tx_indicator = T38_IND_V27TER_4800_TRAINING;
s->t38_fe.current_tx_data_type = T38_DATA_V27TER_4800;
new_modem = (new_transmit) ? FAX_MODEM_V27TER_TX : FAX_MODEM_V27TER_RX;
- s->short_train = FALSE;
+ s->short_train = false;
s->bit_rate = 4800;
break;
case 72:
s->t38_fe.next_tx_indicator = T38_IND_V29_7200_TRAINING;
s->t38_fe.current_tx_data_type = T38_DATA_V29_7200;
new_modem = (new_transmit) ? FAX_MODEM_V29_TX : FAX_MODEM_V29_RX;
- s->short_train = FALSE;
+ s->short_train = false;
s->bit_rate = 7200;
break;
case 96:
s->t38_fe.next_tx_indicator = T38_IND_V29_9600_TRAINING;
s->t38_fe.current_tx_data_type = T38_DATA_V29_9600;
new_modem = (new_transmit) ? FAX_MODEM_V29_TX : FAX_MODEM_V29_RX;
- s->short_train = FALSE;
+ s->short_train = false;
s->bit_rate = 9600;
break;
case 73:
s->t38_fe.next_tx_indicator = T38_IND_V17_7200_LONG_TRAINING;
s->t38_fe.current_tx_data_type = T38_DATA_V17_7200;
new_modem = (new_transmit) ? FAX_MODEM_V17_TX : FAX_MODEM_V17_RX;
- s->short_train = FALSE;
+ s->short_train = false;
s->bit_rate = 7200;
break;
case 74:
s->t38_fe.next_tx_indicator = T38_IND_V17_7200_SHORT_TRAINING;
s->t38_fe.current_tx_data_type = T38_DATA_V17_7200;
new_modem = (new_transmit) ? FAX_MODEM_V17_TX : FAX_MODEM_V17_RX;
- s->short_train = TRUE;
+ s->short_train = true;
s->bit_rate = 7200;
break;
case 97:
s->t38_fe.next_tx_indicator = T38_IND_V17_9600_LONG_TRAINING;
s->t38_fe.current_tx_data_type = T38_DATA_V17_9600;
new_modem = (new_transmit) ? FAX_MODEM_V17_TX : FAX_MODEM_V17_RX;
- s->short_train = FALSE;
+ s->short_train = false;
s->bit_rate = 9600;
break;
case 98:
s->t38_fe.next_tx_indicator = T38_IND_V17_9600_SHORT_TRAINING;
s->t38_fe.current_tx_data_type = T38_DATA_V17_9600;
new_modem = (new_transmit) ? FAX_MODEM_V17_TX : FAX_MODEM_V17_RX;
- s->short_train = TRUE;
+ s->short_train = true;
s->bit_rate = 9600;
break;
case 121:
s->t38_fe.next_tx_indicator = T38_IND_V17_12000_LONG_TRAINING;
s->t38_fe.current_tx_data_type = T38_DATA_V17_12000;
new_modem = (new_transmit) ? FAX_MODEM_V17_TX : FAX_MODEM_V17_RX;
- s->short_train = FALSE;
+ s->short_train = false;
s->bit_rate = 12000;
break;
case 122:
s->t38_fe.next_tx_indicator = T38_IND_V17_12000_SHORT_TRAINING;
s->t38_fe.current_tx_data_type = T38_DATA_V17_12000;
new_modem = (new_transmit) ? FAX_MODEM_V17_TX : FAX_MODEM_V17_RX;
- s->short_train = TRUE;
+ s->short_train = true;
s->bit_rate = 12000;
break;
case 145:
s->t38_fe.next_tx_indicator = T38_IND_V17_14400_LONG_TRAINING;
s->t38_fe.current_tx_data_type = T38_DATA_V17_14400;
new_modem = (new_transmit) ? FAX_MODEM_V17_TX : FAX_MODEM_V17_RX;
- s->short_train = FALSE;
+ s->short_train = false;
s->bit_rate = 14400;
break;
case 146:
s->t38_fe.next_tx_indicator = T38_IND_V17_14400_SHORT_TRAINING;
s->t38_fe.current_tx_data_type = T38_DATA_V17_14400;
new_modem = (new_transmit) ? FAX_MODEM_V17_TX : FAX_MODEM_V17_RX;
- s->short_train = TRUE;
+ s->short_train = true;
s->bit_rate = 14400;
break;
default:
@@ -2663,7 +2670,7 @@ static int process_class1_cmd(at_state_t *t, void *user_data, int direction, int
}
/*endif*/
restart_modem(s, new_modem);
- immediate_response = FALSE;
+ immediate_response = false;
break;
}
/*endswitch*/
@@ -2707,7 +2714,7 @@ SPAN_DECLARE(int) t31_at_rx(t31_state_t *s, const char *t, int len)
}
/*endif*/
s->at_state.rx_data_bytes = 0;
- s->at_state.transmit = FALSE;
+ s->at_state.transmit = false;
s->modem = FAX_MODEM_SILENCE_TX;
fax_modems_set_rx_handler(&s->audio.modems, (span_rx_handler_t) &span_dummy_rx, NULL, (span_rx_fillin_handler_t) &span_dummy_rx_fillin, NULL);
t31_set_at_rx_mode(s, AT_MODE_OFFHOOK_COMMAND);
@@ -2900,19 +2907,19 @@ SPAN_DECLARE_NONSTD(int) t31_tx(t31_state_t *s, int16_t amp[], int max_len)
}
/*- End of function --------------------------------------------------------*/
-SPAN_DECLARE(void) t31_set_transmit_on_idle(t31_state_t *s, int transmit_on_idle)
+SPAN_DECLARE(void) t31_set_transmit_on_idle(t31_state_t *s, bool transmit_on_idle)
{
s->audio.modems.transmit_on_idle = transmit_on_idle;
}
/*- End of function --------------------------------------------------------*/
-SPAN_DECLARE(void) t31_set_tep_mode(t31_state_t *s, int use_tep)
+SPAN_DECLARE(void) t31_set_tep_mode(t31_state_t *s, bool use_tep)
{
s->audio.modems.use_tep = use_tep;
}
/*- End of function --------------------------------------------------------*/
-SPAN_DECLARE(void) t31_set_t38_config(t31_state_t *s, int without_pacing)
+SPAN_DECLARE(void) t31_set_t38_config(t31_state_t *s, bool without_pacing)
{
if (without_pacing)
{
@@ -2940,7 +2947,7 @@ SPAN_DECLARE(void) t31_set_t38_config(t31_state_t *s, int without_pacing)
}
/*- End of function --------------------------------------------------------*/
-SPAN_DECLARE(void) t31_set_mode(t31_state_t *s, int t38_mode)
+SPAN_DECLARE(void) t31_set_mode(t31_state_t *s, bool t38_mode)
{
s->t38_mode = t38_mode;
span_log(&s->logging, SPAN_LOG_FLOW, "Mode set to %d\n", s->t38_mode);
@@ -2992,8 +2999,8 @@ static int t31_t38_fe_init(t31_state_t *t,
t->hdlc_tx.ptr = 0;
- hdlc_tx_init(&s->hdlc_tx_non_ecm, FALSE, 1, FALSE, hdlc_tx_underflow2, s);
- hdlc_rx_init(&s->hdlc_rx_non_ecm, FALSE, TRUE, 2, hdlc_accept_non_ecm_frame, t);
+ hdlc_tx_init(&s->hdlc_tx_non_ecm, false, 1, false, hdlc_tx_underflow2, s);
+ hdlc_rx_init(&s->hdlc_rx_non_ecm, false, true, 2, hdlc_accept_non_ecm_frame, t);
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -3013,13 +3020,13 @@ SPAN_DECLARE(t31_state_t *) t31_init(t31_state_t *s,
return NULL;
/*endif*/
- alloced = FALSE;
+ alloced = false;
if (s == NULL)
{
- if ((s = (t31_state_t *) malloc(sizeof (*s))) == NULL)
+ if ((s = (t31_state_t *) span_alloc(sizeof (*s))) == NULL)
return NULL;
/*endif*/
- alloced = TRUE;
+ alloced = true;
}
/*endif*/
memset(s, 0, sizeof(*s));
@@ -3029,7 +3036,7 @@ SPAN_DECLARE(t31_state_t *) t31_init(t31_state_t *s,
s->modem_control_handler = modem_control_handler;
s->modem_control_user_data = modem_control_user_data;
fax_modems_init(&s->audio.modems,
- FALSE,
+ false,
hdlc_accept_frame,
hdlc_tx_underflow,
non_ecm_put_bit,
@@ -3051,27 +3058,27 @@ SPAN_DECLARE(t31_state_t *) t31_init(t31_state_t *s,
v8_parms.pstn_access = 0;
v8_parms.nsf = -1;
v8_parms.t66 = -1;
- v8_init(&s->audio.v8, FALSE, &v8_parms, v8_handler, s);
+ v8_init(&s->audio.v8, false, &v8_parms, v8_handler, s);
power_meter_init(&s->audio.rx_power, 4);
s->audio.last_sample = 0;
s->audio.silence_threshold_power = power_meter_level_dbm0(-36);
- s->at_state.rx_signal_present = FALSE;
- s->at_state.rx_trained = FALSE;
- s->audio.modems.rx_trained = FALSE;
+ s->at_state.rx_signal_present = false;
+ s->at_state.rx_trained = false;
+ s->audio.modems.rx_trained = false;
- s->at_state.do_hangup = FALSE;
+ s->at_state.do_hangup = false;
s->at_state.line_ptr = 0;
s->audio.silence_heard = 0;
s->silence_awaited = 0;
s->call_samples = 0;
s->modem = FAX_MODEM_NONE;
- s->at_state.transmit = TRUE;
+ s->at_state.transmit = true;
if ((s->rx_queue = queue_init(NULL, 4096, QUEUE_WRITE_ATOMIC | QUEUE_READ_ATOMIC)) == NULL)
{
if (alloced)
- free(s);
+ span_free(s);
/*endif*/
return NULL;
}
@@ -3082,10 +3089,10 @@ SPAN_DECLARE(t31_state_t *) t31_init(t31_state_t *s,
if (tx_t38_packet_handler)
{
t31_t38_fe_init(s, tx_t38_packet_handler, tx_t38_packet_user_data);
- t31_set_t38_config(s, FALSE);
+ t31_set_t38_config(s, false);
}
/*endif*/
- s->t38_mode = FALSE;
+ s->t38_mode = false;
return s;
}
/*- End of function --------------------------------------------------------*/
@@ -3100,7 +3107,7 @@ SPAN_DECLARE(int) t31_release(t31_state_t *s)
SPAN_DECLARE(int) t31_free(t31_state_t *s)
{
t31_release(s);
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
diff --git a/libs/spandsp/src/t35.c b/libs/spandsp/src/t35.c
index 3e210854ab..ce04a6ce23 100644
--- a/libs/spandsp/src/t35.c
+++ b/libs/spandsp/src/t35.c
@@ -61,6 +61,11 @@
#include
#include
#include
+#if defined(HAVE_STDBOOL_H)
+#include
+#else
+#include "spandsp/stdbool.h"
+#endif
#include "spandsp/telephony.h"
#include "spandsp/bit_operations.h"
@@ -86,7 +91,7 @@ typedef struct
int vendor_id_len;
/*! The vendor's name */
const char *vendor_name;
- /*! TRUE if the station ID for this vendor is reversed */
+ /*! True if the station ID for this vendor is reversed */
int inverse_station_id_order;
/*! A pointer to a list of known models from this vendor */
const model_data_t *known_models;
@@ -273,260 +278,260 @@ static const model_data_t Muratec48[] =
static const nsf_data_t vendor_00[] =
{
/* Japan */
- {"\x00\x00", 2, "Unknown - indeterminate", TRUE, NULL},
- {"\x00\x01", 2, "Anritsu", FALSE, NULL},
- {"\x00\x02", 2, "Nippon Telephone", FALSE, NULL},
- {"\x00\x05", 2, "Mitsuba Electric", FALSE, NULL},
- {"\x00\x06", 2, "Master Net", FALSE, NULL},
- {"\x00\x09", 2, "Xerox/Toshiba", TRUE, Xerox},
- {"\x00\x0A", 2, "Kokusai", FALSE, NULL},
- {"\x00\x0D", 2, "Logic System International", FALSE, NULL},
- {"\x00\x0E", 2, "Panasonic", FALSE, Panasonic0E},
- {"\x00\x11", 2, "Canon", FALSE, Canon},
- {"\x00\x15", 2, "Toyotsushen Machinery", FALSE, NULL},
- {"\x00\x16", 2, "System House Mind", FALSE, NULL},
- {"\x00\x19", 2, "Xerox", TRUE, NULL},
- {"\x00\x1D", 2, "Hitachi Software", FALSE, NULL},
- {"\x00\x21", 2, "OKI Electric/Lanier", TRUE, NULL},
- {"\x00\x25", 2, "Ricoh", TRUE, Ricoh},
- {"\x00\x26", 2, "Konica", FALSE, NULL},
- {"\x00\x29", 2, "Japan Wireless", FALSE, NULL},
- {"\x00\x2D", 2, "Sony", FALSE, NULL},
- {"\x00\x31", 2, "Sharp/Olivetti", FALSE, Sharp},
- {"\x00\x35", 2, "Kogyu", FALSE, NULL},
- {"\x00\x36", 2, "Japan Telecom", FALSE, NULL},
- {"\x00\x3D", 2, "IBM Japan", FALSE, NULL},
- {"\x00\x39", 2, "Panasonic", FALSE, NULL},
- {"\x00\x41", 2, "Swasaki Communication", FALSE, NULL},
- {"\x00\x45", 2, "Muratec", FALSE, Muratec45},
- {"\x00\x46", 2, "Pheonix", FALSE, NULL},
- {"\x00\x48", 2, "Muratec", FALSE, Muratec48}, /* Not registered */
- {"\x00\x49", 2, "Japan Electric", FALSE, NULL},
- {"\x00\x4D", 2, "Okura Electric", FALSE, NULL},
- {"\x00\x51", 2, "Sanyo", FALSE, Sanyo},
- {"\x00\x55", 2, "Unknown - Japan 55", FALSE, NULL},
- {"\x00\x56", 2, "Brother", FALSE, Brother},
- {"\x00\x59", 2, "Fujitsu", FALSE, NULL},
- {"\x00\x5D", 2, "Kuoni", FALSE, NULL},
- {"\x00\x61", 2, "Casio", FALSE, NULL},
- {"\x00\x65", 2, "Tateishi Electric", FALSE, NULL},
- {"\x00\x66", 2, "Utax/Mita", TRUE, NULL},
- {"\x00\x69", 2, "Hitachi Production", FALSE, NULL},
- {"\x00\x6D", 2, "Hitachi Telecom", FALSE, NULL},
- {"\x00\x71", 2, "Tamura Electric Works", FALSE, NULL},
- {"\x00\x75", 2, "Tokyo Electric Corp.", FALSE, NULL},
- {"\x00\x76", 2, "Advance", FALSE, NULL},
- {"\x00\x79", 2, "Panasonic", FALSE, Panasonic79},
- {"\x00\x7D", 2, "Seiko", FALSE, NULL},
- {"\x08\x00", 2, "Daiko", FALSE, NULL},
- {"\x10\x00", 2, "Funai Electric", FALSE, NULL},
- {"\x20\x00", 2, "Eagle System", FALSE, NULL},
- {"\x30\x00", 2, "Nippon Business Systems", FALSE, NULL},
- {"\x40\x00", 2, "Comtron", FALSE, NULL},
- {"\x48\x00", 2, "Cosmo Consulting", FALSE, NULL},
- {"\x50\x00", 2, "Orion Electric", FALSE, NULL},
- {"\x60\x00", 2, "Nagano Nippon", FALSE, NULL},
- {"\x70\x00", 2, "Kyocera", FALSE, NULL},
- {"\x80\x00", 2, "Kanda Networks", FALSE, NULL},
- {"\x88\x00", 2, "Soft Front", FALSE, NULL},
- {"\x90\x00", 2, "Arctic", FALSE, NULL},
- {"\xA0\x00", 2, "Nakushima", FALSE, NULL},
- {"\xB0\x00", 2, "Minolta", FALSE, NULL},
- {"\xC0\x00", 2, "Tohoku Pioneer", FALSE, NULL},
- {"\xD0\x00", 2, "USC", FALSE, NULL},
- {"\xE0\x00", 2, "Hiboshi", FALSE, NULL},
- {"\xF0\x00", 2, "Sumitomo Electric", FALSE, NULL},
- {NULL, 0, NULL, FALSE, NULL}
+ {"\x00\x00", 2, "Unknown - indeterminate", true, NULL},
+ {"\x00\x01", 2, "Anritsu", false, NULL},
+ {"\x00\x02", 2, "Nippon Telephone", false, NULL},
+ {"\x00\x05", 2, "Mitsuba Electric", false, NULL},
+ {"\x00\x06", 2, "Master Net", false, NULL},
+ {"\x00\x09", 2, "Xerox/Toshiba", true, Xerox},
+ {"\x00\x0A", 2, "Kokusai", false, NULL},
+ {"\x00\x0D", 2, "Logic System International", false, NULL},
+ {"\x00\x0E", 2, "Panasonic", false, Panasonic0E},
+ {"\x00\x11", 2, "Canon", false, Canon},
+ {"\x00\x15", 2, "Toyotsushen Machinery", false, NULL},
+ {"\x00\x16", 2, "System House Mind", false, NULL},
+ {"\x00\x19", 2, "Xerox", true, NULL},
+ {"\x00\x1D", 2, "Hitachi Software", false, NULL},
+ {"\x00\x21", 2, "OKI Electric/Lanier", true, NULL},
+ {"\x00\x25", 2, "Ricoh", true, Ricoh},
+ {"\x00\x26", 2, "Konica", false, NULL},
+ {"\x00\x29", 2, "Japan Wireless", false, NULL},
+ {"\x00\x2D", 2, "Sony", false, NULL},
+ {"\x00\x31", 2, "Sharp/Olivetti", false, Sharp},
+ {"\x00\x35", 2, "Kogyu", false, NULL},
+ {"\x00\x36", 2, "Japan Telecom", false, NULL},
+ {"\x00\x3D", 2, "IBM Japan", false, NULL},
+ {"\x00\x39", 2, "Panasonic", false, NULL},
+ {"\x00\x41", 2, "Swasaki Communication", false, NULL},
+ {"\x00\x45", 2, "Muratec", false, Muratec45},
+ {"\x00\x46", 2, "Pheonix", false, NULL},
+ {"\x00\x48", 2, "Muratec", false, Muratec48}, /* Not registered */
+ {"\x00\x49", 2, "Japan Electric", false, NULL},
+ {"\x00\x4D", 2, "Okura Electric", false, NULL},
+ {"\x00\x51", 2, "Sanyo", false, Sanyo},
+ {"\x00\x55", 2, "Unknown - Japan 55", false, NULL},
+ {"\x00\x56", 2, "Brother", false, Brother},
+ {"\x00\x59", 2, "Fujitsu", false, NULL},
+ {"\x00\x5D", 2, "Kuoni", false, NULL},
+ {"\x00\x61", 2, "Casio", false, NULL},
+ {"\x00\x65", 2, "Tateishi Electric", false, NULL},
+ {"\x00\x66", 2, "Utax/Mita", true, NULL},
+ {"\x00\x69", 2, "Hitachi Production", false, NULL},
+ {"\x00\x6D", 2, "Hitachi Telecom", false, NULL},
+ {"\x00\x71", 2, "Tamura Electric Works", false, NULL},
+ {"\x00\x75", 2, "Tokyo Electric Corp.", false, NULL},
+ {"\x00\x76", 2, "Advance", false, NULL},
+ {"\x00\x79", 2, "Panasonic", false, Panasonic79},
+ {"\x00\x7D", 2, "Seiko", false, NULL},
+ {"\x08\x00", 2, "Daiko", false, NULL},
+ {"\x10\x00", 2, "Funai Electric", false, NULL},
+ {"\x20\x00", 2, "Eagle System", false, NULL},
+ {"\x30\x00", 2, "Nippon Business Systems", false, NULL},
+ {"\x40\x00", 2, "Comtron", false, NULL},
+ {"\x48\x00", 2, "Cosmo Consulting", false, NULL},
+ {"\x50\x00", 2, "Orion Electric", false, NULL},
+ {"\x60\x00", 2, "Nagano Nippon", false, NULL},
+ {"\x70\x00", 2, "Kyocera", false, NULL},
+ {"\x80\x00", 2, "Kanda Networks", false, NULL},
+ {"\x88\x00", 2, "Soft Front", false, NULL},
+ {"\x90\x00", 2, "Arctic", false, NULL},
+ {"\xA0\x00", 2, "Nakushima", false, NULL},
+ {"\xB0\x00", 2, "Minolta", false, NULL},
+ {"\xC0\x00", 2, "Tohoku Pioneer", false, NULL},
+ {"\xD0\x00", 2, "USC", false, NULL},
+ {"\xE0\x00", 2, "Hiboshi", false, NULL},
+ {"\xF0\x00", 2, "Sumitomo Electric", false, NULL},
+ {NULL, 0, NULL, false, NULL}
};
static const nsf_data_t vendor_20[] =
{
/* Germany */
- {"\x09", 1, "ITK Institut für Telekommunikation GmbH & Co KG", FALSE, NULL},
- {"\x11", 1, "Dr. Neuhaus Mikroelektronik", FALSE, NULL},
- {"\x21", 1, "ITO Communication", FALSE, NULL},
- {"\x31", 1, "mbp Kommunikationssysteme GmbH", FALSE, NULL},
- {"\x41", 1, "Siemens", FALSE, NULL},
- {"\x42", 1, "Deutsche Telekom AG", FALSE, NULL},
- {"\x51", 1, "mps Software", FALSE, NULL},
- {"\x61", 1, "Hauni Elektronik", FALSE, NULL},
- {"\x71", 1, "Digitronic computersysteme gmbh", FALSE, NULL},
- {"\x81\x00", 2, "Innovaphone GmbH", FALSE, NULL},
- {"\x81\x40", 2, "TEDAS Gesellschaft für Telekommunikations-, Daten- und Audiosysteme mbH", FALSE, NULL},
- {"\x81\x80", 2, "AVM Audiovisuelles Marketing und Computersysteme GmbH", FALSE, NULL},
- {"\x81\xC0", 2, "EICON Technology Research GmbH", FALSE, NULL},
- {"\xB1", 1, "Schneider Rundfunkwerke AG", FALSE, NULL},
- {"\xC2", 1, "Deutsche Telekom AG", FALSE, NULL},
- {"\xD1", 1, "Ferrari electronik GmbH", FALSE, NULL},
- {"\xF1", 1, "DeTeWe - Deutsche Telephonwerke AG & Co", FALSE, NULL},
- {"\xFF", 1, "Germany Regional Code", FALSE, NULL},
- {NULL, 0, NULL, FALSE, NULL}
+ {"\x09", 1, "ITK Institut für Telekommunikation GmbH & Co KG", false, NULL},
+ {"\x11", 1, "Dr. Neuhaus Mikroelektronik", false, NULL},
+ {"\x21", 1, "ITO Communication", false, NULL},
+ {"\x31", 1, "mbp Kommunikationssysteme GmbH", false, NULL},
+ {"\x41", 1, "Siemens", false, NULL},
+ {"\x42", 1, "Deutsche Telekom AG", false, NULL},
+ {"\x51", 1, "mps Software", false, NULL},
+ {"\x61", 1, "Hauni Elektronik", false, NULL},
+ {"\x71", 1, "Digitronic computersysteme gmbh", false, NULL},
+ {"\x81\x00", 2, "Innovaphone GmbH", false, NULL},
+ {"\x81\x40", 2, "TEDAS Gesellschaft für Telekommunikations-, Daten- und Audiosysteme mbH", false, NULL},
+ {"\x81\x80", 2, "AVM Audiovisuelles Marketing und Computersysteme GmbH", false, NULL},
+ {"\x81\xC0", 2, "EICON Technology Research GmbH", false, NULL},
+ {"\xB1", 1, "Schneider Rundfunkwerke AG", false, NULL},
+ {"\xC2", 1, "Deutsche Telekom AG", false, NULL},
+ {"\xD1", 1, "Ferrari electronik GmbH", false, NULL},
+ {"\xF1", 1, "DeTeWe - Deutsche Telephonwerke AG & Co", false, NULL},
+ {"\xFF", 1, "Germany Regional Code", false, NULL},
+ {NULL, 0, NULL, false, NULL}
};
static const nsf_data_t vendor_64[] =
{
/* China (not Lebanon) */
- {"\x00\x00", 2, "Unknown - China 00 00", FALSE, NULL},
- {"\x01\x00", 2, "Unknown - China 01 00", FALSE, NULL},
- {"\x01\x01", 2, "Unknown - China 01 01", FALSE, NULL},
- {"\x01\x02", 2, "Unknown - China 01 02", FALSE, NULL},
- {NULL, 0, NULL, FALSE, NULL}
+ {"\x00\x00", 2, "Unknown - China 00 00", false, NULL},
+ {"\x01\x00", 2, "Unknown - China 01 00", false, NULL},
+ {"\x01\x01", 2, "Unknown - China 01 01", false, NULL},
+ {"\x01\x02", 2, "Unknown - China 01 02", false, NULL},
+ {NULL, 0, NULL, false, NULL}
};
static const nsf_data_t vendor_61[] =
{
/* Korea */
- {"\x00\x7A", 2, "Xerox", FALSE, NULL},
- {NULL, 0, NULL, FALSE, NULL}
+ {"\x00\x7A", 2, "Xerox", false, NULL},
+ {NULL, 0, NULL, false, NULL}
};
static const nsf_data_t vendor_86[] =
{
/* Korea (not Papua New Guinea) */
- {"\x00\x02", 2, "Unknown - Korea 02", FALSE, NULL},
- {"\x00\x06", 2, "Unknown - Korea 06", FALSE, NULL},
- {"\x00\x08", 2, "Unknown - Korea 08", FALSE, NULL},
- {"\x00\x0A", 2, "Unknown - Korea 0A", FALSE, NULL},
- {"\x00\x0E", 2, "Unknown - Korea 0E", FALSE, NULL},
- {"\x00\x10", 2, "Samsung", FALSE, NULL},
- {"\x00\x11", 2, "Unknown - Korea 11", FALSE, NULL},
- {"\x00\x16", 2, "Samsung", FALSE, Samsung16},
- {"\x00\x1A", 2, "Unknown - Korea 1A", FALSE, NULL},
- {"\x00\x40", 2, "Unknown - Korea 40", FALSE, NULL},
- {"\x00\x48", 2, "Unknown - Korea 48", FALSE, NULL},
- {"\x00\x52", 2, "Unknown - Korea 52", FALSE, NULL},
- {"\x00\x5A", 2, "Samsung", FALSE, Samsung5A},
- {"\x00\x5E", 2, "Unknown - Korea 5E", FALSE, NULL},
- {"\x00\x66", 2, "Unknown - Korea 66", FALSE, NULL},
- {"\x00\x6E", 2, "Unknown - Korea 6E", FALSE, NULL},
- {"\x00\x82", 2, "Unknown - Korea 82", FALSE, NULL},
- {"\x00\x88", 2, "Unknown - Korea 88", FALSE, NULL},
- {"\x00\x8A", 2, "Unknown - Korea 8A", FALSE, NULL},
- {"\x00\x8C", 2, "Samsung", FALSE, Samsung8C},
- {"\x00\x92", 2, "Unknown - Korea 92", FALSE, NULL},
- {"\x00\x98", 2, "Samsung", FALSE, NULL},
- {"\x00\xA2", 2, "Samsung", FALSE, SamsungA2},
- {"\x00\xA4", 2, "Unknown - Korea A4", FALSE, NULL},
- {"\x00\xC2", 2, "Samsung", FALSE, NULL},
- {"\x00\xC9", 2, "Unknown - Korea C9", FALSE, NULL},
- {"\x00\xCC", 2, "Unknown - Korea CC", FALSE, NULL},
- {"\x00\xD2", 2, "Unknown - Korea D2", FALSE, NULL},
- {"\x00\xDA", 2, "Xerox", FALSE, XeroxDA},
- {"\x00\xE2", 2, "Unknown - Korea E2", FALSE, NULL},
- {"\x00\xEC", 2, "Unknown - Korea EC", FALSE, NULL},
- {"\x00\xEE", 2, "Unknown - Korea EE", FALSE, NULL},
- {NULL, 0, NULL, FALSE, NULL}
+ {"\x00\x02", 2, "Unknown - Korea 02", false, NULL},
+ {"\x00\x06", 2, "Unknown - Korea 06", false, NULL},
+ {"\x00\x08", 2, "Unknown - Korea 08", false, NULL},
+ {"\x00\x0A", 2, "Unknown - Korea 0A", false, NULL},
+ {"\x00\x0E", 2, "Unknown - Korea 0E", false, NULL},
+ {"\x00\x10", 2, "Samsung", false, NULL},
+ {"\x00\x11", 2, "Unknown - Korea 11", false, NULL},
+ {"\x00\x16", 2, "Samsung", false, Samsung16},
+ {"\x00\x1A", 2, "Unknown - Korea 1A", false, NULL},
+ {"\x00\x40", 2, "Unknown - Korea 40", false, NULL},
+ {"\x00\x48", 2, "Unknown - Korea 48", false, NULL},
+ {"\x00\x52", 2, "Unknown - Korea 52", false, NULL},
+ {"\x00\x5A", 2, "Samsung", false, Samsung5A},
+ {"\x00\x5E", 2, "Unknown - Korea 5E", false, NULL},
+ {"\x00\x66", 2, "Unknown - Korea 66", false, NULL},
+ {"\x00\x6E", 2, "Unknown - Korea 6E", false, NULL},
+ {"\x00\x82", 2, "Unknown - Korea 82", false, NULL},
+ {"\x00\x88", 2, "Unknown - Korea 88", false, NULL},
+ {"\x00\x8A", 2, "Unknown - Korea 8A", false, NULL},
+ {"\x00\x8C", 2, "Samsung", false, Samsung8C},
+ {"\x00\x92", 2, "Unknown - Korea 92", false, NULL},
+ {"\x00\x98", 2, "Samsung", false, NULL},
+ {"\x00\xA2", 2, "Samsung", false, SamsungA2},
+ {"\x00\xA4", 2, "Unknown - Korea A4", false, NULL},
+ {"\x00\xC2", 2, "Samsung", false, NULL},
+ {"\x00\xC9", 2, "Unknown - Korea C9", false, NULL},
+ {"\x00\xCC", 2, "Unknown - Korea CC", false, NULL},
+ {"\x00\xD2", 2, "Unknown - Korea D2", false, NULL},
+ {"\x00\xDA", 2, "Xerox", false, XeroxDA},
+ {"\x00\xE2", 2, "Unknown - Korea E2", false, NULL},
+ {"\x00\xEC", 2, "Unknown - Korea EC", false, NULL},
+ {"\x00\xEE", 2, "Unknown - Korea EE", false, NULL},
+ {NULL, 0, NULL, false, NULL}
};
static const nsf_data_t vendor_bc[] =
{
/* France */
- {"\x53\x01", 2, "Minolta", FALSE, NULL},
- {NULL, 0, NULL, FALSE, NULL}
+ {"\x53\x01", 2, "Minolta", false, NULL},
+ {NULL, 0, NULL, false, NULL}
};
static const nsf_data_t vendor_ad[] =
{
/* United States (not Tunisia) */
- {"\x00\x00", 2, "Pitney Bowes", FALSE, PitneyBowes},
- {"\x00\x0C", 2, "Dialogic", FALSE, NULL},
- {"\x00\x15", 2, "Lexmark", FALSE, Lexmark},
- {"\x00\x16", 2, "JetFax", FALSE, JetFax},
- {"\x00\x24", 2, "Octel", FALSE, NULL},
- {"\x00\x36", 2, "HP", FALSE, HP},
- {"\x00\x42", 2, "FaxTalk", FALSE, NULL},
- {"\x00\x44", 2, NULL, TRUE, NULL},
- {"\x00\x46", 2, "BrookTrout", FALSE, NULL},
- {"\x00\x51", 2, "Telogy Networks", FALSE, NULL},
- {"\x00\x55", 2, "HylaFAX", FALSE, NULL},
- {"\x00\x5C", 2, "IBM", FALSE, NULL},
- {"\x00\x98", 2, "Unknown - USA 98", TRUE, NULL},
- {NULL, 0, NULL, FALSE, NULL}
+ {"\x00\x00", 2, "Pitney Bowes", false, PitneyBowes},
+ {"\x00\x0C", 2, "Dialogic", false, NULL},
+ {"\x00\x15", 2, "Lexmark", false, Lexmark},
+ {"\x00\x16", 2, "JetFax", false, JetFax},
+ {"\x00\x24", 2, "Octel", false, NULL},
+ {"\x00\x36", 2, "HP", false, HP},
+ {"\x00\x42", 2, "FaxTalk", false, NULL},
+ {"\x00\x44", 2, NULL, true, NULL},
+ {"\x00\x46", 2, "BrookTrout", false, NULL},
+ {"\x00\x51", 2, "Telogy Networks", false, NULL},
+ {"\x00\x55", 2, "HylaFAX", false, NULL},
+ {"\x00\x5C", 2, "IBM", false, NULL},
+ {"\x00\x98", 2, "Unknown - USA 98", true, NULL},
+ {NULL, 0, NULL, false, NULL}
};
static const nsf_data_t vendor_b4[] =
{
/* United Kingdom */
- {"\x00\xB0", 2, "DCE", FALSE, NULL},
- {"\x00\xB1", 2, "Hasler", FALSE, NULL},
- {"\x00\xB2", 2, "Interquad", FALSE, NULL},
- {"\x00\xB3", 2, "Comwave", FALSE, NULL},
- {"\x00\xB4", 2, "Iconographic", FALSE, NULL},
- {"\x00\xB5", 2, "Wordcraft", FALSE, NULL},
- {"\x00\xB6", 2, "Acorn", FALSE, NULL},
- {NULL, 0, NULL, FALSE, NULL}
+ {"\x00\xB0", 2, "DCE", false, NULL},
+ {"\x00\xB1", 2, "Hasler", false, NULL},
+ {"\x00\xB2", 2, "Interquad", false, NULL},
+ {"\x00\xB3", 2, "Comwave", false, NULL},
+ {"\x00\xB4", 2, "Iconographic", false, NULL},
+ {"\x00\xB5", 2, "Wordcraft", false, NULL},
+ {"\x00\xB6", 2, "Acorn", false, NULL},
+ {NULL, 0, NULL, false, NULL}
};
static const nsf_data_t vendor_b5[] =
{
/* United States */
- {"\x00\x01", 2, "Picturetel", FALSE, NULL},
- {"\x00\x20", 2, "Conexant", FALSE, NULL},
- {"\x00\x22", 2, "Comsat", FALSE, NULL},
- {"\x00\x24", 2, "Octel", FALSE, NULL},
- {"\x00\x26", 2, "ROLM", FALSE, NULL},
- {"\x00\x28", 2, "SOFNET", FALSE, NULL},
- {"\x00\x29", 2, "TIA TR-29 Committee", FALSE, NULL},
- {"\x00\x2A", 2, "STF Tech", FALSE, NULL},
- {"\x00\x2C", 2, "HKB", FALSE, NULL},
- {"\x00\x2E", 2, "Delrina", FALSE, NULL},
- {"\x00\x30", 2, "Dialogic", FALSE, NULL},
- {"\x00\x32", 2, "Applied Synergy", FALSE, NULL},
- {"\x00\x34", 2, "Syncro Development", FALSE, NULL},
- {"\x00\x36", 2, "Genoa", FALSE, NULL},
- {"\x00\x38", 2, "Texas Instruments", FALSE, NULL},
- {"\x00\x3A", 2, "IBM", FALSE, NULL},
- {"\x00\x3C", 2, "ViaSat", FALSE, NULL},
- {"\x00\x3E", 2, "Ericsson", FALSE, NULL},
- {"\x00\x42", 2, "Bogosian", FALSE, NULL},
- {"\x00\x44", 2, "Adobe", FALSE, NULL},
- {"\x00\x46", 2, "Fremont Communications", FALSE, NULL},
- {"\x00\x48", 2, "Hayes", FALSE, NULL},
- {"\x00\x4A", 2, "Lucent", FALSE, NULL},
- {"\x00\x4C", 2, "Data Race", FALSE, NULL},
- {"\x00\x4E", 2, "TRW", FALSE, NULL},
- {"\x00\x52", 2, "Audiofax", FALSE, NULL},
- {"\x00\x54", 2, "Computer Automation", FALSE, NULL},
- {"\x00\x56", 2, "Serca", FALSE, NULL},
- {"\x00\x58", 2, "Octocom", FALSE, NULL},
- {"\x00\x5C", 2, "Power Solutions", FALSE, NULL},
- {"\x00\x5A", 2, "Digital Sound", FALSE, NULL},
- {"\x00\x5E", 2, "Pacific Data", FALSE, NULL},
- {"\x00\x60", 2, "Commetrex", FALSE, NULL},
- {"\x00\x62", 2, "BrookTrout", FALSE, NULL},
- {"\x00\x64", 2, "Gammalink", FALSE, NULL},
- {"\x00\x66", 2, "Castelle", FALSE, NULL},
- {"\x00\x68", 2, "Hybrid Fax", FALSE, NULL},
- {"\x00\x6A", 2, "Omnifax", FALSE, NULL},
- {"\x00\x6C", 2, "HP", FALSE, NULL},
- {"\x00\x6E", 2, "Microsoft", FALSE, NULL},
- {"\x00\x72", 2, "Speaking Devices", FALSE, NULL},
- {"\x00\x74", 2, "Compaq", FALSE, NULL},
- {"\x00\x76", 2, "Microsoft", FALSE, NULL}, /* uses LSB for country but MSB for manufacturer */
- {"\x00\x78", 2, "Cylink", FALSE, NULL},
- {"\x00\x7A", 2, "Pitney Bowes", FALSE, NULL},
- {"\x00\x7C", 2, "Digiboard", FALSE, NULL},
- {"\x00\x7E", 2, "Codex", FALSE, NULL},
- {"\x00\x82", 2, "Wang Labs", FALSE, NULL},
- {"\x00\x84", 2, "Netexpress Communications", FALSE, NULL},
- {"\x00\x86", 2, "Cable-Sat", FALSE, NULL},
- {"\x00\x88", 2, "MFPA", FALSE, NULL},
- {"\x00\x8A", 2, "Telogy Networks", FALSE, NULL},
- {"\x00\x8E", 2, "Telecom Multimedia Systems", FALSE, NULL},
- {"\x00\x8C", 2, "AT&T", FALSE, NULL},
- {"\x00\x92", 2, "Nuera", FALSE, NULL},
- {"\x00\x94", 2, "K56flex", FALSE, NULL},
- {"\x00\x96", 2, "MiBridge", FALSE, NULL},
- {"\x00\x98", 2, "Xerox", FALSE, NULL},
- {"\x00\x9A", 2, "Fujitsu", FALSE, NULL},
- {"\x00\x9B", 2, "Fujitsu", FALSE, NULL},
- {"\x00\x9C", 2, "Natural Microsystems", FALSE, NULL},
- {"\x00\x9E", 2, "CopyTele", FALSE, NULL},
- {"\x00\xA2", 2, "Murata", FALSE, NULL},
- {"\x00\xA4", 2, "Lanier", FALSE, NULL},
- {"\x00\xA6", 2, "Qualcomm", FALSE, NULL},
- {"\x00\xAA", 2, "HylaFAX", FALSE, NULL},
- {NULL, 0, NULL, FALSE, NULL}
+ {"\x00\x01", 2, "Picturetel", false, NULL},
+ {"\x00\x20", 2, "Conexant", false, NULL},
+ {"\x00\x22", 2, "Comsat", false, NULL},
+ {"\x00\x24", 2, "Octel", false, NULL},
+ {"\x00\x26", 2, "ROLM", false, NULL},
+ {"\x00\x28", 2, "SOFNET", false, NULL},
+ {"\x00\x29", 2, "TIA TR-29 Committee", false, NULL},
+ {"\x00\x2A", 2, "STF Tech", false, NULL},
+ {"\x00\x2C", 2, "HKB", false, NULL},
+ {"\x00\x2E", 2, "Delrina", false, NULL},
+ {"\x00\x30", 2, "Dialogic", false, NULL},
+ {"\x00\x32", 2, "Applied Synergy", false, NULL},
+ {"\x00\x34", 2, "Syncro Development", false, NULL},
+ {"\x00\x36", 2, "Genoa", false, NULL},
+ {"\x00\x38", 2, "Texas Instruments", false, NULL},
+ {"\x00\x3A", 2, "IBM", false, NULL},
+ {"\x00\x3C", 2, "ViaSat", false, NULL},
+ {"\x00\x3E", 2, "Ericsson", false, NULL},
+ {"\x00\x42", 2, "Bogosian", false, NULL},
+ {"\x00\x44", 2, "Adobe", false, NULL},
+ {"\x00\x46", 2, "Fremont Communications", false, NULL},
+ {"\x00\x48", 2, "Hayes", false, NULL},
+ {"\x00\x4A", 2, "Lucent", false, NULL},
+ {"\x00\x4C", 2, "Data Race", false, NULL},
+ {"\x00\x4E", 2, "TRW", false, NULL},
+ {"\x00\x52", 2, "Audiofax", false, NULL},
+ {"\x00\x54", 2, "Computer Automation", false, NULL},
+ {"\x00\x56", 2, "Serca", false, NULL},
+ {"\x00\x58", 2, "Octocom", false, NULL},
+ {"\x00\x5C", 2, "Power Solutions", false, NULL},
+ {"\x00\x5A", 2, "Digital Sound", false, NULL},
+ {"\x00\x5E", 2, "Pacific Data", false, NULL},
+ {"\x00\x60", 2, "Commetrex", false, NULL},
+ {"\x00\x62", 2, "BrookTrout", false, NULL},
+ {"\x00\x64", 2, "Gammalink", false, NULL},
+ {"\x00\x66", 2, "Castelle", false, NULL},
+ {"\x00\x68", 2, "Hybrid Fax", false, NULL},
+ {"\x00\x6A", 2, "Omnifax", false, NULL},
+ {"\x00\x6C", 2, "HP", false, NULL},
+ {"\x00\x6E", 2, "Microsoft", false, NULL},
+ {"\x00\x72", 2, "Speaking Devices", false, NULL},
+ {"\x00\x74", 2, "Compaq", false, NULL},
+ {"\x00\x76", 2, "Microsoft", false, NULL}, /* uses LSB for country but MSB for manufacturer */
+ {"\x00\x78", 2, "Cylink", false, NULL},
+ {"\x00\x7A", 2, "Pitney Bowes", false, NULL},
+ {"\x00\x7C", 2, "Digiboard", false, NULL},
+ {"\x00\x7E", 2, "Codex", false, NULL},
+ {"\x00\x82", 2, "Wang Labs", false, NULL},
+ {"\x00\x84", 2, "Netexpress Communications", false, NULL},
+ {"\x00\x86", 2, "Cable-Sat", false, NULL},
+ {"\x00\x88", 2, "MFPA", false, NULL},
+ {"\x00\x8A", 2, "Telogy Networks", false, NULL},
+ {"\x00\x8E", 2, "Telecom Multimedia Systems", false, NULL},
+ {"\x00\x8C", 2, "AT&T", false, NULL},
+ {"\x00\x92", 2, "Nuera", false, NULL},
+ {"\x00\x94", 2, "K56flex", false, NULL},
+ {"\x00\x96", 2, "MiBridge", false, NULL},
+ {"\x00\x98", 2, "Xerox", false, NULL},
+ {"\x00\x9A", 2, "Fujitsu", false, NULL},
+ {"\x00\x9B", 2, "Fujitsu", false, NULL},
+ {"\x00\x9C", 2, "Natural Microsystems", false, NULL},
+ {"\x00\x9E", 2, "CopyTele", false, NULL},
+ {"\x00\xA2", 2, "Murata", false, NULL},
+ {"\x00\xA4", 2, "Lanier", false, NULL},
+ {"\x00\xA6", 2, "Qualcomm", false, NULL},
+ {"\x00\xAA", 2, "HylaFAX", false, NULL},
+ {NULL, 0, NULL, false, NULL}
};
static const country_code_t t35_country_codes[255] =
@@ -904,7 +909,7 @@ SPAN_DECLARE(const char *) t35_vendor_to_str(const uint8_t *msg, int len)
}
/*- End of function --------------------------------------------------------*/
-SPAN_DECLARE(int) t35_decode(const uint8_t *msg, int len, const char **country, const char **vendor, const char **model)
+SPAN_DECLARE(bool) t35_decode(const uint8_t *msg, int len, const char **country, const char **vendor, const char **model)
{
const nsf_data_t *p;
const model_data_t *pp;
@@ -917,7 +922,7 @@ SPAN_DECLARE(int) t35_decode(const uint8_t *msg, int len, const char **country,
*model = NULL;
if ((p = find_vendor(msg, len)) == NULL)
- return FALSE;
+ return false;
if (vendor)
*vendor = p->vendor_name;
if (model && p->known_models)
@@ -933,7 +938,7 @@ SPAN_DECLARE(int) t35_decode(const uint8_t *msg, int len, const char **country,
}
}
}
- return TRUE;
+ return true;
}
/*- End of function --------------------------------------------------------*/
/*- End of file ------------------------------------------------------------*/
diff --git a/libs/spandsp/src/t38_core.c b/libs/spandsp/src/t38_core.c
index ae6526f7e8..0bbbd18fb6 100644
--- a/libs/spandsp/src/t38_core.c
+++ b/libs/spandsp/src/t38_core.c
@@ -41,12 +41,18 @@
#if defined(HAVE_MATH_H)
#include
#endif
+#if defined(HAVE_STDBOOL_H)
+#include
+#else
+#include "spandsp/stdbool.h"
+#endif
#include "floating_fudge.h"
#include
#include
#include
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/bit_operations.h"
#include "spandsp/t38_core.h"
@@ -455,7 +461,7 @@ SPAN_DECLARE_NONSTD(int) t38_core_rx_ifp_stream(t38_core_state_t *s, const uint8
//printf("Count is %d\n", count);
/* Do a dummy run through the fields to check we have a complete and uncorrupted packet. */
prev_ptr = ptr;
- other_half = FALSE;
+ other_half = false;
t30_field_type = 0;
for (i = 0; i < (int) count; i++)
{
@@ -472,7 +478,7 @@ SPAN_DECLARE_NONSTD(int) t38_core_rx_ifp_stream(t38_core_state_t *s, const uint8
/* Decode field_type */
t30_field_type = buf[ptr] & 0x7;
ptr++;
- other_half = FALSE;
+ other_half = false;
}
else
{
@@ -482,7 +488,7 @@ SPAN_DECLARE_NONSTD(int) t38_core_rx_ifp_stream(t38_core_state_t *s, const uint8
if (field_data_present)
ptr++;
else
- other_half = TRUE;
+ other_half = true;
}
if (t30_field_type > T38_FIELD_T4_NON_ECM_SIG_END)
{
@@ -537,7 +543,7 @@ SPAN_DECLARE_NONSTD(int) t38_core_rx_ifp_stream(t38_core_state_t *s, const uint8
/* Things look alright in the data, so lets run through the fields again, actually processing them.
There is no need to do all the error checking along the way on this pass. */
ptr = prev_ptr;
- other_half = FALSE;
+ other_half = false;
for (i = 0; i < (int) count; i++)
{
if (s->t38_version == 0)
@@ -551,7 +557,7 @@ SPAN_DECLARE_NONSTD(int) t38_core_rx_ifp_stream(t38_core_state_t *s, const uint8
/* Decode field_type */
t30_field_type = buf[ptr] & 0x7;
ptr++;
- other_half = FALSE;
+ other_half = false;
}
else
{
@@ -561,7 +567,7 @@ SPAN_DECLARE_NONSTD(int) t38_core_rx_ifp_stream(t38_core_state_t *s, const uint8
if (field_data_present)
ptr++;
else
- other_half = TRUE;
+ other_half = true;
}
}
else
@@ -1001,19 +1007,19 @@ SPAN_DECLARE(void) t38_set_data_transport_protocol(t38_core_state_t *s, int data
}
/*- End of function --------------------------------------------------------*/
-SPAN_DECLARE(void) t38_set_fill_bit_removal(t38_core_state_t *s, int fill_bit_removal)
+SPAN_DECLARE(void) t38_set_fill_bit_removal(t38_core_state_t *s, bool fill_bit_removal)
{
s->fill_bit_removal = fill_bit_removal;
}
/*- End of function --------------------------------------------------------*/
-SPAN_DECLARE(void) t38_set_mmr_transcoding(t38_core_state_t *s, int mmr_transcoding)
+SPAN_DECLARE(void) t38_set_mmr_transcoding(t38_core_state_t *s, bool mmr_transcoding)
{
s->mmr_transcoding = mmr_transcoding;
}
/*- End of function --------------------------------------------------------*/
-SPAN_DECLARE(void) t38_set_jbig_transcoding(t38_core_state_t *s, int jbig_transcoding)
+SPAN_DECLARE(void) t38_set_jbig_transcoding(t38_core_state_t *s, bool jbig_transcoding)
{
s->jbig_transcoding = jbig_transcoding;
}
@@ -1037,7 +1043,7 @@ SPAN_DECLARE(void) t38_set_t38_version(t38_core_state_t *s, int t38_version)
}
/*- End of function --------------------------------------------------------*/
-SPAN_DECLARE(void) t38_set_sequence_number_handling(t38_core_state_t *s, int check)
+SPAN_DECLARE(void) t38_set_sequence_number_handling(t38_core_state_t *s, bool check)
{
s->check_sequence_numbers = check;
}
@@ -1049,7 +1055,7 @@ SPAN_DECLARE(void) t38_set_pace_transmission(t38_core_state_t *s, int pace_trans
}
/*- End of function --------------------------------------------------------*/
-SPAN_DECLARE(void) t38_set_tep_handling(t38_core_state_t *s, int allow_for_tep)
+SPAN_DECLARE(void) t38_set_tep_handling(t38_core_state_t *s, bool allow_for_tep)
{
s->allow_for_tep = allow_for_tep;
}
@@ -1109,7 +1115,7 @@ SPAN_DECLARE(t38_core_state_t *) t38_core_init(t38_core_state_t *s,
{
if (s == NULL)
{
- if ((s = (t38_core_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (t38_core_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -1120,14 +1126,14 @@ SPAN_DECLARE(t38_core_state_t *) t38_core_init(t38_core_state_t *s,
T.38 domain - e.g. from SDP data. */
s->data_rate_management_method = T38_DATA_RATE_MANAGEMENT_TRANSFERRED_TCF;
s->data_transport_protocol = T38_TRANSPORT_UDPTL;
- s->fill_bit_removal = FALSE;
- s->mmr_transcoding = FALSE;
- s->jbig_transcoding = FALSE;
+ s->fill_bit_removal = false;
+ s->mmr_transcoding = false;
+ s->jbig_transcoding = false;
s->max_buffer_size = 400;
s->max_datagram_size = 100;
s->t38_version = 0;
- s->check_sequence_numbers = TRUE;
- s->pace_transmission = TRUE;
+ s->check_sequence_numbers = true;
+ s->pace_transmission = true;
/* Set some defaults */
s->category_control[T38_PACKET_CATEGORY_INDICATOR] = 1;
@@ -1157,7 +1163,7 @@ SPAN_DECLARE(int) t38_core_release(t38_core_state_t *s)
SPAN_DECLARE(int) t38_core_free(t38_core_state_t *s)
{
if (s)
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
diff --git a/libs/spandsp/src/t38_gateway.c b/libs/spandsp/src/t38_gateway.c
index 7656332e80..78346e3ecf 100644
--- a/libs/spandsp/src/t38_gateway.c
+++ b/libs/spandsp/src/t38_gateway.c
@@ -42,6 +42,11 @@
#if defined(HAVE_MATH_H)
#include
#endif
+#if defined(HAVE_STDBOOL_H)
+#include
+#else
+#include "spandsp/stdbool.h"
+#endif
#include "floating_fudge.h"
#include
#if defined(LOG_FAX_AUDIO)
@@ -50,6 +55,7 @@
#include