remove opezap from tree, it has been replaced by freetdm

This commit is contained in:
Michael Jerris 2014-05-06 11:05:54 -04:00
parent f5b438bbe9
commit d6fe10979d
172 changed files with 27 additions and 59092 deletions

View File

@ -591,10 +591,6 @@ speedy-sync: is-scm
$(MAKE) update
$(MAKE) -j install
libs/openzap/Makefile:
cd libs/openzap && autoconf
cd libs/openzap && ./configure
version:
git log -1 | head -3
@ -604,9 +600,8 @@ pristine:
git clean -fdx
git reset --hard
update-clean: clean libs/openzap/Makefile python-reconf lua-reconf spandsp-reconf srtp-reconf
update-clean: clean python-reconf lua-reconf spandsp-reconf srtp-reconf
cd libs/sofia-sip && $(MAKE) clean
cd libs/openzap && $(MAKE) clean
cd libs/portaudio && $(MAKE) clean
cd libs/esl && $(MAKE) clean
cd libs/srtp && $(MAKE) clean
@ -638,12 +633,6 @@ srtp-reconf:
cd libs/srtp && $(MAKE) clean
cd libs/srtp && sh ./configure.gnu
oz-reconf:
cd libs/openzap && $(MAKE) clean
cd libs/openzap && autoreconf -fi
cd libs/openzap && sh ./configure.gnu --prefix=$(prefix)
$(MAKE) mod_openzap-clean
iks-reconf:
cd libs/iksemel && $(MAKE) clean
cd libs/iksemel && autoreconf -fi

View File

@ -10,7 +10,7 @@ BASEDIR=`pwd`;
LIBDIR=${BASEDIR}/libs;
SUBDIRS="apr \
libzrtp ilbc iksemel js js/nsprpub libdingaling libsndfile sofia-sip \
speex srtp openzap freetdm spandsp libg722_1 portaudio unimrcp tiff-4.0.2 broadvoice silk libcodec2 \
speex srtp freetdm spandsp libg722_1 portaudio unimrcp tiff-4.0.2 broadvoice silk libcodec2 \
fs";
while getopts 'jhd:v' o; do

View File

@ -150,7 +150,6 @@ xml_int/mod_xml_rpc
xml_int/mod_xml_scgi
#../../libs/freetdm/mod_freetdm
#../../libs/openzap/mod_openzap
## Experimental Modules (don't cry if they're broken)
#../../contrib/mod/xml_int/mod_xml_odbc

View File

@ -35,14 +35,14 @@
<!--
You can use or modify this sample set of mappings. It turns on higher
level messages for all modules and then specifies extra lower level
messages for OpenZAP, Sofia, and switch core messages.
messages for freetdm, Sofia, and switch core messages.
<map name="all" value="warning,err,crit,alert"/>
<map name="zap_analog.c" value="all"/>
<map name="zap_io.c" value="all"/>
<map name="zap_isdn.c" value="all"/>
<map name="zap_zt.c" value="all"/>
<map name="mod_openzap" value="all"/>
<map name="mod_freetdm" value="all"/>
<map name="sofia.c" value="notice"/>
<map name="switch_core_state_machine.c" value="all"/>

View File

@ -1,45 +0,0 @@
<configuration name="openzap.conf" description="OpenZAP Configuration">
<settings>
<param name="debug" value="0"/>
<!--<param name="hold-music" value="$${moh_uri}"/>-->
<!--<param name="enable-analog-option" value="call-swap"/>-->
<!--<param name="enable-analog-option" value="3-way"/>-->
</settings>
<pri_spans>
<span name="PRI_1">
<!-- Log Levels: none, alert, crit, err, warning, notice, info, debug -->
<param name="q921loglevel" value="alert"/>
<param name="q931loglevel" value="alert"/>
<param name="mode" value="user"/>
<param name="dialect" value="5ess"/>
<param name="dialplan" value="XML"/>
<param name="context" value="default"/>
</span>
<span name="PRI_2">
<param name="q921loglevel" value="alert"/>
<param name="q931loglevel" value="alert"/>
<param name="mode" value="user"/>
<param name="dialect" value="5ess"/>
<param name="dialplan" value="XML"/>
<param name="context" value="default"/>
</span>
</pri_spans>
<!-- one entry here per openzap span -->
<analog_spans>
<span id="1">
<!--<param name="hold-music" value="$${moh_uri}"/>-->
<!--<param name="enable-analog-option" value="call-swap"/>-->
<!--<param name="enable-analog-option" value="3-way"/>-->
<param name="tonegroup" value="us"/>
<param name="digit-timeout" value="2000"/>
<param name="max-digits" value="11"/>
<param name="dialplan" value="XML"/>
<param name="context" value="default"/>
<param name="enable-callerid" value="true"/>
<!-- regex to stop dialing when it matches -->
<!--<param name="dial-regex" value="5555"/>-->
<!-- regex to stop dialing when it does not match -->
<!--<param name="fail-dial-regex" value="^5"/>-->
</span>
</analog_spans>
</configuration>

View File

@ -35,14 +35,14 @@
<!--
You can use or modify this sample set of mappings. It turns on higher
level messages for all modules and then specifies extra lower level
messages for OpenZAP, Sofia, and switch core messages.
messages for freetdm, Sofia, and switch core messages.
<map name="all" value="warning,err,crit,alert"/>
<map name="zap_analog.c" value="all"/>
<map name="zap_io.c" value="all"/>
<map name="zap_isdn.c" value="all"/>
<map name="zap_zt.c" value="all"/>
<map name="mod_openzap" value="all"/>
<map name="mod_freetdm" value="all"/>
<map name="sofia.c" value="notice"/>
<map name="switch_core_state_machine.c" value="all"/>

View File

@ -34,7 +34,7 @@
<load module="mod_sofia"/>
<load module="mod_loopback"/>
<!-- <load module="mod_woomera"/> -->
<!-- <load module="mod_openzap"/> -->
<!-- <load module="mod_freetdm"/> -->
<!-- Applications -->
<load module="mod_commands"/>

View File

@ -1,45 +0,0 @@
<configuration name="openzap.conf" description="OpenZAP Configuration">
<settings>
<param name="debug" value="0"/>
<!--<param name="hold-music" value="$${moh_uri}"/>-->
<!--<param name="enable-analog-option" value="call-swap"/>-->
<!--<param name="enable-analog-option" value="3-way"/>-->
</settings>
<pri_spans>
<span name="PRI_1">
<!-- Log Levels: none, alert, crit, err, warning, notice, info, debug -->
<param name="q921loglevel" value="alert"/>
<param name="q931loglevel" value="alert"/>
<param name="mode" value="user"/>
<param name="dialect" value="5ess"/>
<param name="dialplan" value="XML"/>
<param name="context" value="default"/>
</span>
<span name="PRI_2">
<param name="q921loglevel" value="alert"/>
<param name="q931loglevel" value="alert"/>
<param name="mode" value="user"/>
<param name="dialect" value="5ess"/>
<param name="dialplan" value="XML"/>
<param name="context" value="default"/>
</span>
</pri_spans>
<!-- one entry here per openzap span -->
<analog_spans>
<span id="1">
<!--<param name="hold-music" value="$${moh_uri}"/>-->
<!--<param name="enable-analog-option" value="call-swap"/>-->
<!--<param name="enable-analog-option" value="3-way"/>-->
<param name="tonegroup" value="us"/>
<param name="digit-timeout" value="2000"/>
<param name="max-digits" value="11"/>
<param name="dialplan" value="XML"/>
<param name="context" value="default"/>
<param name="enable-callerid" value="true"/>
<!-- regex to stop dialing when it matches -->
<!--<param name="dial-regex" value="5555"/>-->
<!-- regex to stop dialing when it does not match -->
<!--<param name="fail-dial-regex" value="^5"/>-->
</span>
</analog_spans>
</configuration>

View File

@ -36,9 +36,9 @@
</extension>
<!-- Set the domain -->
<extension name="set_domain_openzap" continue="true">
<extension name="set_domain_freetdm" continue="true">
<condition field="${domain_name}" expression="^$"/>
<condition field="source" expression="mod_openzap">
<condition field="source" expression="mod_freetdm">
<action application="set" data="domain_name=$${domain}"/>
</condition>
</extension>

View File

@ -35,14 +35,14 @@
<!--
You can use or modify this sample set of mappings. It turns on higher
level messages for all modules and then specifies extra lower level
messages for OpenZAP, Sofia, and switch core messages.
messages for Freetdm, Sofia, and switch core messages.
<map name="all" value="warning,err,crit,alert"/>
<map name="zap_analog.c" value="all"/>
<map name="zap_io.c" value="all"/>
<map name="zap_isdn.c" value="all"/>
<map name="zap_zt.c" value="all"/>
<map name="mod_openzap" value="all"/>
<map name="mod_freetdm" value="all"/>
<map name="sofia.c" value="notice"/>
<map name="switch_core_state_machine.c" value="all"/>

View File

@ -35,14 +35,14 @@
<!--
You can use or modify this sample set of mappings. It turns on higher
level messages for all modules and then specifies extra lower level
messages for OpenZAP, Sofia, and switch core messages.
messages for Freetdm, Sofia, and switch core messages.
<map name="all" value="warning,err,crit,alert"/>
<map name="zap_analog.c" value="all"/>
<map name="zap_io.c" value="all"/>
<map name="zap_isdn.c" value="all"/>
<map name="zap_zt.c" value="all"/>
<map name="mod_openzap" value="all"/>
<map name="mod_freetdm" value="all"/>
<map name="sofia.c" value="notice"/>
<map name="switch_core_state_machine.c" value="all"/>

View File

@ -35,9 +35,9 @@
</extension>
<!-- Set the domain -->
<extension name="set_domain_openzap" continue="true">
<extension name="set_domain_freetdm" continue="true">
<condition field="${domain_name}" expression="^$"/>
<condition field="source" expression="mod_openzap">
<condition field="source" expression="mod_freetdm">
<action application="set" data="domain_name=$${domain}"/>
</condition>
</extension>

View File

@ -35,14 +35,14 @@
<!--
You can use or modify this sample set of mappings. It turns on higher
level messages for all modules and then specifies extra lower level
messages for OpenZAP, Sofia, and switch core messages.
messages for freetdm, Sofia, and switch core messages.
<map name="all" value="warning,err,crit,alert"/>
<map name="zap_analog.c" value="all"/>
<map name="zap_io.c" value="all"/>
<map name="zap_isdn.c" value="all"/>
<map name="zap_zt.c" value="all"/>
<map name="mod_openzap" value="all"/>
<map name="mod_freetdm" value="all"/>
<map name="sofia.c" value="notice"/>
<map name="switch_core_state_machine.c" value="all"/>

View File

@ -39,7 +39,6 @@
<load module="mod_loopback"/>
<!-- <load module="mod_woomera"/> -->
<!-- <load module="mod_freetdm"/> -->
<!-- <load module="mod_openzap"/> -->
<!-- <load module="mod_unicall"/> -->
<!-- <load module="mod_skinny"/> -->
<!-- <load module="mod_khomp"/> -->

View File

@ -1627,7 +1627,6 @@ AC_CONFIG_SUBDIRS([libs/libdingaling])
AC_CONFIG_SUBDIRS([libs/libsndfile])
AC_CONFIG_SUBDIRS([libs/sofia-sip])
AC_CONFIG_SUBDIRS([libs/portaudio])
AC_CONFIG_SUBDIRS([libs/openzap])
AC_CONFIG_SUBDIRS([libs/freetdm])
AC_CONFIG_SUBDIRS([libs/unimrcp])
AC_CONFIG_SUBDIRS([libs/tiff-4.0.2])

39
debian/copyright vendored
View File

@ -1874,45 +1874,6 @@ Files: libs/win32/pcre/dftables.c
Copyright: 1997-2008 University of Cambridge
License: BSD-3-clause
Files: libs/openzap/*
Copyright: 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
2007-2014, Anthony Minessale II, Nenad Corbic
2005-2014, Anthony Minessale II
2006 Nenad Corbic <ncorbic@sangoma.com>
2007 Jan Vidar Berger, Case Labs, Ltd.
2007,2008 Michael Jerris
2008 Shane Burrell
2007 Michael S. Collins
2001 Steve Underwood <steveu@coppice.org>
2001 Steve Underwood
2002,2004 Christopher Clark <firstname.lastname@cl.cam.ac.uk>
2002 Christopher Clark
1984-2007 Sangoma Technologies Inc.
2007-2009, Sangoma Technologies
2009, Moises Silva <moy@sangoma.com>
2008, Stefan Knoblich, axsentis GmbH.
2005 Xygnada Technology, Inc.
License: BSD-3-clause
Files: libs/openzap/src/fsk.c
libs/openzap/src/include/uart.h
libs/openzap/src/uart.c
Copyright: 2009-2012, Anthony Minessale II
2005 Robert Krten
License: BSD-2-clause
Files: libs/openzap/src/include/libteletone.h
libs/openzap/mod_openzap/mod_openzap.c
Copyright: 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
2005-2014, Anthony Minessale II
License: MPL-1.1
Files: libs/openzap/src/sangoma_pri.[ch]
libs/openzap/src/priserver.c
Copyright: 2005-2014 Anthony Minessale II
2006 Nenad Corbic <ncorbic@sangoma.com>
License: GPL-2+
Files: libs/ilbc/*
Copyright: 2007-2008, Steve Underwood
2006 Michael Jerris

View File

@ -221,16 +221,6 @@ Rules:
Matches: Copyright\s\(c\)\s2006-2011,\sSkype\sLimited.
Matches: THIS\sSOFTWARE\sIS\sPROVIDED\sBY\sTHE\sCOPYRIGHT\sHOLDERS\sAND
Copyright: 2006-2011, Skype Limited.
-
Glob: libs/openzap/src/ozmod/ozmod_wanpipe/wanpipe_tdm_api_iface.h
Matches: Copyright\s\(c\)\s2007\s-\s08,\sSangoma\sTechnologies
Copyright: 2007-2008, Sangoma Technologies
-
Glob: libs/openzap/src/testm3ua.c
Matches: Created\sby\sShane\sBurrell\son\s4/8/08.
Matches: Copyright\s2008\s__MyCompanyName__.
Copyright: 2008, Shane Burrell
Justification: I presume that __MyCompanyName__ is nonsense, which is why I'm crediting Shane Burrell
-
Glob: debian/*
Copyright: 2012 Travis Cross <tc@traviscross.com>

4
libs/.gitignore vendored
View File

@ -329,10 +329,6 @@ opal
/libmpg123/
/openldap-*/
/openssl-*/
/openzap/build/compile
/openzap/COPYING
/openzap/INSTALL
/openzap/Makefile.in
/opus-*/
/pocketsphinx-*/
/portaudio/bin/

View File

@ -2,7 +2,7 @@
; each category is a config profile
; to apply the profile append it to a channel def in
; openzap.conf with @<profile_name>
; freetdm.conf with @<profile_name>
; e.g.
; [span pika]
; name => pika

View File

@ -1,5 +1,5 @@
#!/bin/bash
# this script must be run from openzap root dir and it is assuming
# this script must be run from freetdm root dir and it is assuming
# FreeSWITCH is trunk is located at ../../
fsdir=../..
set -x

View File

@ -2,7 +2,7 @@
1. FreeTDM open channels immediately.
Yes, this seems to come from the early days of OpenZAP where probably the analog modules were implemented first and was dragged incorrectly to ISDN.
Yes, this seems to come from the early days of Freetdm where probably the analog modules were implemented first and was dragged incorrectly to ISDN.
The open API also sets the flag in use so others cannot use it. We should decouple this open and reserve operations. Does not seem very hard to do,
I'll take a look at it on my way back to Toronto this week or earlier if possible, I'll create a git branch for it and send you the url for peer review.
Feel free to do the opposite if you are in a hurry.
@ -15,7 +15,7 @@ was not properly closing the channel, if that is what you mean, then it means th
Now, a more lengthy response ...
When we, Sangoma, took over openzap and renamed it to freetdm, it was not just a name change, many API cleanups were done so API users cannot access
When we, Sangoma, took over freetdm and renamed it to freetdm, it was not just a name change, many API cleanups were done so API users cannot access
the internal data structures and cannot explicitly move between channel states. Also, some order on the state transitions has been put into place.
@ -43,7 +43,7 @@ Having said that, there is a major architectural change coming, probably early 2
We've also found that the concept of a channel and a call are unnecesarily coupled together in FreeTDM. I've never asked Anthony the reasoning
for this, but it seems the API was meant to be used with, or without calls. That is, a user should be able to just 'open' a channel and start
reading and writing raw data without ever launching one of the provided signaling stacks on top, may be just because the user is using their
own signaling stack and just needs freetdm/openzap as an I/O API. In fact, signaling modules work like this (but there are defects there).
own signaling stack and just needs freetdm as an I/O API. In fact, signaling modules work like this (but there are defects there).
The problem is, as you have noticed, the way ftdm_channel_open_xx APIs has been implemented is abusing this concept.
Problems with current implementation.

View File

@ -607,7 +607,7 @@ static void ftdm_isdn_call_event(struct Q931_Call *call, struct Q931_CallEvent *
ftdm_channel_get_id(ftdmchan));
/*
* Send hangup signal to mod_openzap
* Send hangup signal to mod_freetdm
*/
if (!sig.channel->caller_data.hangup_cause) {
sig.channel->caller_data.hangup_cause = FTDM_CAUSE_NORMAL_CLEARING;
@ -653,7 +653,7 @@ static void ftdm_isdn_call_event(struct Q931_Call *call, struct Q931_CallEvent *
ftdm_channel_get_id(ftdmchan));
/*
* Send signal to mod_openzap
* Send signal to mod_freetdm
*/
sig.channel->caller_data.hangup_cause = FTDM_CAUSE_NETWORK_OUT_OF_ORDER;

View File

@ -1,27 +0,0 @@
*.o
*.lo
*.so
*.a
*.orig
*.rej
*.log
Makefile
config.*
configure
libtool
aclocal.m4
detect_dtmf
detect_tones
testanalog
testapp
testboost
testcid
testisdn
testpri
testr2
testtones
!/msvc/testanalog/
!/msvc/testisdn/

View File

@ -1 +0,0 @@
Fri Oct 3 17:54:41 EDT 2008

View File

View File

View File

@ -1,275 +0,0 @@
# Copyright (c) 2007-2014, Anthony Minessale II
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# * Neither the name of the original author; nor the names of any contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PREFIX = $(prefix)
SRC = src
moddir = @modinstdir@
libdir = @libdir@
library_includedir = $(PREFIX)/include
INCS = -I$(OZ_SRCDIR)/$(SRC)/include -I$(OZ_SRCDIR)/$(SRC)/isdn/include
if HAVE_SCTP
INCS += -I$(OZ_SRCDIR)/$(SRC)/ozmod/ozmod_sangoma_boost
endif
MY_CFLAGS = $(INCS) $(ZAP_CFLAGS) -DZAP_CONFIG_DIR=\"@confdir@\" -DZAP_MOD_DIR=\"$(moddir)\" @COMP_VENDOR_CFLAGS@ @DEFS@
COMPILE = $(CC) $(MY_CFLAGS) $(INCS)
LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(COMPILE)
LINK = $(LIBTOOL) --mode=link --tag=CC $(CC) $(MY_CFLAGS) $(LDFLAGS) -o $@
if DEBUGDTMF
MY_CFLAGS += -DZAP_DEBUG_DTMF
endif
#
# GNU pkgconfig file
#
EXTRA_DIST = openzap.pc.in
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = openzap.pc
#
# libopenzap
#
libopenzap_la_SOURCES = \
$(SRC)/hashtable.c \
$(SRC)/hashtable_itr.c \
$(SRC)/zap_io.c \
$(SRC)/zap_config.c \
$(SRC)/zap_callerid.c \
$(SRC)/fsk.c \
$(SRC)/uart.c \
$(SRC)/g711.c \
$(SRC)/libteletone_detect.c \
$(SRC)/libteletone_generate.c \
$(SRC)/zap_buffer.c \
$(SRC)/zap_threadmutex.c \
$(SRC)/zap_dso.c \
$(SRC)/zap_cpu_monitor.c
library_include_HEADERS = \
$(SRC)/include/fsk.h \
$(SRC)/include/g711.h \
$(SRC)/include/hashtable.h \
$(SRC)/include/hashtable_itr.h \
$(SRC)/include/hashtable_private.h \
$(SRC)/include/libteletone_detect.h \
$(SRC)/include/libteletone_generate.h \
$(SRC)/include/libteletone.h \
$(SRC)/include/openzap.h \
$(SRC)/include/sangoma_tdm_api.h \
$(SRC)/include/uart.h \
$(SRC)/include/zap_buffer.h \
$(SRC)/include/zap_config.h \
$(SRC)/include/zap_threadmutex.h \
$(SRC)/include/zap_dso.h \
$(SRC)/include/zap_types.h \
$(SRC)/include/zap_cpu_monitor.h
lib_LTLIBRARIES = libopenzap.la
libopenzap_la_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS)
libopenzap_la_LDFLAGS = -version-info 1:0:0 $(AM_LDFLAGS)
libopenzap_la_LIBADD = $(LIBS)
MYLIB = libopenzap.la
core: libopenzap.la
core-install: install-libLTLIBRARIES
#
# tools & test programs
#
noinst_PROGRAMS = testtones detect_tones detect_dtmf testisdn testpri testr2 testanalog testapp testcid
if HAVE_SCTP
noinst_PROGRAMS += testboost
endif
testapp_SOURCES = $(SRC)/testapp.c
testapp_LDADD = libopenzap.la
testapp_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS)
testcid_SOURCES = $(SRC)/testcid.c
testcid_LDADD = libopenzap.la
testcid_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS)
testtones_SOURCES = $(SRC)/testtones.c
testtones_LDADD = libopenzap.la
testtones_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS)
detect_tones_SOURCES = $(SRC)/detect_tones.c
detect_tones_LDADD = libopenzap.la
detect_tones_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS)
detect_dtmf_SOURCES = $(SRC)/detect_dtmf.c
detect_dtmf_LDADD = libopenzap.la
detect_dtmf_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS)
testisdn_SOURCES = $(SRC)/testisdn.c
testisdn_LDADD = libopenzap.la
testisdn_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS)
testpri_SOURCES = $(SRC)/testpri.c
testpri_LDADD = libopenzap.la
testpri_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS)
testr2_SOURCES = $(SRC)/testr2.c
testr2_LDADD = libopenzap.la
testr2_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS)
if HAVE_SCTP
testboost_SOURCES = $(SRC)/testboost.c
testboost_LDADD = libopenzap.la
testboost_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS)
endif
testanalog_SOURCES = $(SRC)/testanalog.c
testanalog_LDADD = libopenzap.la
testanalog_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS)
#
# ozmod modules
#
mod_LTLIBRARIES = ozmod_zt.la ozmod_skel.la ozmod_isdn.la ozmod_analog.la ozmod_analog_em.la
if HAVE_SCTP
mod_LTLIBRARIES += ozmod_sangoma_boost.la
endif
if LIBSANGOMA
mod_LTLIBRARIES += ozmod_wanpipe.la
endif
if LIBPRI
mod_LTLIBRARIES += ozmod_libpri.la
endif
if OPENR2
mod_LTLIBRARIES += ozmod_r2.la
endif
ozmod_zt_la_SOURCES = $(SRC)/ozmod/ozmod_zt/ozmod_zt.c
ozmod_zt_la_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS)
ozmod_zt_la_LDFLAGS = -module -avoid-version
ozmod_zt_la_LIBADD = $(MYLIB)
ozmod_skel_la_SOURCES = $(SRC)/ozmod/ozmod_skel/ozmod_skel.c
ozmod_skel_la_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS)
ozmod_skel_la_LDFLAGS = -module -avoid-version
ozmod_skel_la_LIBADD = $(MYLIB)
if LIBSANGOMA
ozmod_wanpipe_la_SOURCES = $(SRC)/ozmod/ozmod_wanpipe/ozmod_wanpipe.c
ozmod_wanpipe_la_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS) -D__LINUX__ -I/usr/include/wanpipe
ozmod_wanpipe_la_LDFLAGS = -module -avoid-version -lsangoma
ozmod_wanpipe_la_LIBADD = $(MYLIB)
endif
ozmod_isdn_la_SOURCES = \
$(SRC)/isdn/EuroISDNStateNT.c \
$(SRC)/isdn/EuroISDNStateTE.c \
$(SRC)/isdn/mfifo.c \
$(SRC)/isdn/Q921.c \
$(SRC)/isdn/Q931api.c \
$(SRC)/isdn/Q931.c \
$(SRC)/isdn/Q931ie.c \
$(SRC)/isdn/Q931mes.c \
$(SRC)/isdn/Q931StateNT.c \
$(SRC)/isdn/Q931StateTE.c \
$(SRC)/isdn/nationalmes.c \
$(SRC)/isdn/nationalStateNT.c \
$(SRC)/isdn/nationalStateTE.c \
$(SRC)/isdn/DMSmes.c \
$(SRC)/isdn/DMSStateNT.c \
$(SRC)/isdn/DMSStateTE.c \
$(SRC)/isdn/5ESSmes.c \
$(SRC)/isdn/5ESSStateNT.c \
$(SRC)/isdn/5ESSStateTE.c \
$(SRC)/isdn/Q932mes.c \
$(SRC)/ozmod/ozmod_isdn/ozmod_isdn.c
ozmod_isdn_la_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS) -D_GNU_SOURCE
ozmod_isdn_la_LDFLAGS = $(PCAP_LIB_FLAGS) -module -avoid-version
ozmod_isdn_la_LIBADD = $(MYLIB)
ozmod_analog_la_SOURCES = $(SRC)/ozmod/ozmod_analog/ozmod_analog.c
ozmod_analog_la_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS)
ozmod_analog_la_LDFLAGS = -module -avoid-version
ozmod_analog_la_LIBADD = $(MYLIB)
ozmod_analog_em_la_SOURCES = $(SRC)/ozmod/ozmod_analog_em/ozmod_analog_em.c
ozmod_analog_em_la_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS)
ozmod_analog_em_la_LDFLAGS = -module -avoid-version
ozmod_analog_em_la_LIBADD = $(MYLIB)
if HAVE_SCTP
ozmod_sangoma_boost_la_SOURCES = $(SRC)/ozmod/ozmod_sangoma_boost/sangoma_boost_client.c $(SRC)/ozmod/ozmod_sangoma_boost/ozmod_sangoma_boost.c
ozmod_sangoma_boost_la_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS)
ozmod_sangoma_boost_la_LDFLAGS = -module -avoid-version
ozmod_sangoma_boost_la_LIBADD = $(MYLIB)
endif
if LIBPRI
ozmod_libpri_la_SOURCES = $(SRC)/ozmod/ozmod_libpri/ozmod_libpri.c $(SRC)/ozmod/ozmod_libpri/lpwrap_pri.c
ozmod_libpri_la_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS)
ozmod_libpri_la_LDFLAGS = -module -avoid-version -lpri
ozmod_libpri_la_LIBADD = $(MYLIB)
endif
if OPENR2
ozmod_r2_la_SOURCES = $(SRC)/ozmod/ozmod_r2/ozmod_r2.c
ozmod_r2_la_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS)
ozmod_r2_la_LDFLAGS = -module -avoid-version -lopenr2
ozmod_r2_la_LIBADD = $(MYLIB)
endif
dox doxygen:
cd docs && doxygen $(OZ_SRCDIR)/docs/Doxygen.conf
mod_openzap/mod_openzap.so: $(MYLIB) mod_openzap/mod_openzap.c
cd mod_openzap && make
mod_openzap: mod_openzap/mod_openzap.so
mod_openzap-install: mod_openzap
cd mod_openzap && make install
mod_openzap-clean:
@if [ -f mod_openzap/mod_openzap.so ] ; then cd mod_openzap && make clean ; fi
install-data-local:
$(mkinstalldirs) $(DESTDIR)$(PREFIX)
$(mkinstalldirs) $(DESTDIR)@confdir@
@[ -f "$(DESTDIR)@confdir@/openzap.conf" ] || ( cp conf/*.conf $(DESTDIR)@confdir@)
@echo OpenZAP Installed

View File

View File

@ -1,3 +0,0 @@
OPENZAP (WORK IN PROGRESS)
*shrug*

View File

@ -1 +0,0 @@
m4_include([build/libpcap.m4])

View File

@ -1,6 +0,0 @@
#!/bin/bash
autoheader
libtoolize --force --copy
aclocal
automake -f --copy --add-missing
autoconf

View File

@ -1,144 +0,0 @@
dnl libpcap.m4--PCAP libraries and includes
dnl Derrick Brashear
dnl from KTH krb and Arla
dnl $Id: libpcap.m4,v 1.4 2006/01/20 20:21:09 snsimon Exp $
AC_DEFUN([PCAP_INC_WHERE1], [
ac_cv_found_pcap_inc=no
if test -f "$1/pcap.h" ; then
ac_cv_found_pcap_inc=yes
fi
])
AC_DEFUN([PCAP_INC_WHERE], [
for i in $1; do
AC_MSG_CHECKING(for pcap header in $i)
PCAP_INC_WHERE1($i)
if test "$ac_cv_found_pcap_inc" = "yes"; then
ac_cv_pcap_where_inc=$i
AC_MSG_RESULT(found)
break
else
AC_MSG_RESULT(no found)
fi
done
])
AC_DEFUN([PCAP_LIB_WHERE1], [
saved_LIBS=$LIBS
LIBS="$saved_LIBS -L$1 -lpcap"
AC_TRY_LINK(,
[pcap_lookupdev("");],
[ac_cv_found_pcap_lib=yes],
ac_cv_found_pcap_lib=no)
LIBS=$saved_LIBS
])
AC_DEFUN([TEST_LIBPATH], [
changequote(<<, >>)
define(<<AC_CV_FOUND>>, translit(ac_cv_found_$2_lib, <<- *>>, <<__p>>))
changequote([, ])
if test "$AC_CV_FOUND" = "yes"; then
if test \! -r "$1/lib$2.a" -a \! -r "$1/lib$2.so" -a \! -r "$1/lib$2.sl" -a \! -r "$1/lib$2.dylib"; then
AC_CV_FOUND=no
fi
fi
])
AC_DEFUN([PCAP_LIB_WHERE], [
for i in $1; do
AC_MSG_CHECKING(for pcap library in $i)
PCAP_LIB_WHERE1($i)
TEST_LIBPATH($i, pcap)
if test "$ac_cv_found_pcap_lib" = "yes" ; then
ac_cv_pcap_where_lib=$i
AC_MSG_RESULT(found)
break
else
AC_MSG_RESULT(no found)
fi
done
])
AC_DEFUN([FIND_LIB_SUBDIR],
[dnl
AC_ARG_WITH([lib-subdir], AC_HELP_STRING([--with-lib-subdir=DIR],[Find libraries in DIR instead of lib]))
AC_CHECK_SIZEOF(long)
AC_CACHE_CHECK([what directory libraries are found in], [ac_cv_cmu_lib_subdir],
[test "X$with_lib_subdir" = "Xyes" && with_lib_subdir=
test "X$with_lib_subdir" = "Xno" && with_lib_subdir=
if test "X$with_lib_subdir" = "X" ; then
ac_cv_cmu_lib_subdir=lib
if test $ac_cv_sizeof_long -eq 4 ; then
test -d /usr/lib32 && ac_cv_cmu_lib_subdir=lib32
test -r /usr/lib/libpcap.so && ac_cv_cmu_lib_subdir=lib
fi
if test $ac_cv_sizeof_long -eq 8 ; then
test -d /usr/lib64 && ac_cv_cmu_lib_subdir=lib64
fi
else
ac_cv_cmu_lib_subdir=$with_lib_subdir
fi])
AC_SUBST(LIB_SUBDIR, $ac_cv_cmu_lib_subdir)
])
AC_DEFUN([AX_LIB_PCAP], [
AC_REQUIRE([FIND_LIB_SUBDIR])
AC_ARG_WITH(pcap,
[ --with-pcap=PREFIX Compile with PCAP support],
[if test "X$with_pcap" = "X"; then
with_pcap=yes
fi])
AC_ARG_WITH(pcap-lib,
[ --with-pcap-lib=dir use pcap libraries in dir],
[if test "$withval" = "yes" -o "$withval" = "no"; then
AC_MSG_ERROR([No argument for --with-pcap-lib])
fi])
AC_ARG_WITH(pcap-include,
[ --with-pcap-include=dir use pcap headers in dir],
[if test "$withval" = "yes" -o "$withval" = "no"; then
AC_MSG_ERROR([No argument for --with-pcap-include])
fi])
if test "X$with_pcap" != "X"; then
if test "$with_pcap" != "yes"; then
ac_cv_pcap_where_lib=$with_pcap
ac_cv_pcap_where_inc=$with_pcap/include
fi
fi
if test "X$with_pcap_lib" != "X"; then
ac_cv_pcap_where_lib=$with_pcap_lib
fi
if test "X$ac_cv_pcap_where_lib" = "X"; then
PCAP_LIB_WHERE(/usr/$LIB_SUBDIR /usr/local/$LIB_SUBDIR)
fi
if test "X$with_pcap_include" != "X"; then
ac_cv_pcap_where_inc=$with_pcap_include
fi
if test "X$ac_cv_pcap_where_inc" = "X"; then
PCAP_INC_WHERE(/usr/ng/include /usr/include /usr/local/include)
fi
AC_MSG_CHECKING(whether to include pcap)
if test "X$ac_cv_pcap_where_lib" != "X" -a "X$ac_cv_pcap_where_inc" != "X"; then
ac_cv_found_pcap=yes
AC_MSG_RESULT(yes)
PCAP_INC_DIR=$ac_cv_pcap_where_inc
PCAP_LIB_DIR=$ac_cv_pcap_where_lib
PCAP_INC_FLAGS="-I${PCAP_INC_DIR}"
PCAP_LIB_FLAGS="-L${PCAP_LIB_DIR} -lpcap"
AC_SUBST(PCAP_INC_DIR)
AC_SUBST(PCAP_LIB_DIR)
AC_SUBST(PCAP_INC_FLAGS)
AC_SUBST(PCAP_LIB_FLAGS)
AC_DEFINE([HAVE_LIBPCAP],[1],[libpcap])
else
ac_cv_found_pcap=no
AC_MSG_RESULT(no)
fi
])

View File

@ -1,38 +0,0 @@
;M3UA SS7 Links Config
;
;ss7box-m3ua_mode => true
;local_sctp_ip => localhost
;local sctp_port => 30000
;remote_sctp_ip => localhost
;remote_sctp_port => 30001
;opc => 0-0-0
;dpc => 0-0-0
; AP Specific Stuff. This will likely move later.
; CNAM Gateways
cnam1_dpc => 0-0-0
cnam1_ssn => 253
cnam2_dpc => 0-0-0
cnam2_ssn => 253
cnam3_dpc => 0-0-0
cnam3_ssn => 253
;LNP Gateways
lnp1_dpc => 0-0-0
lnp1_ssn => 253
lnp2_dpc => 0-0-0
lnp2_ssn => 253
lnp3_dpc => 0-0-0
lnp3_ssn => 253
;LNP Gateways
sms8001_dpc => 0-0-0
sms8001_ssn => 253
sms8002_dpc => 0-0-0
sms8002_ssn => 253
sms8003_dpc => 0-0-0
sms8003_ssn => 253

View File

@ -1,19 +0,0 @@
[span wanpipe]
name => OpenZAP
number => 1
fxs-channel => 1:3-4
[span wanpipe]
fxo-channel => 1:1-2
[span zt]
name => OpenZAP
number => 2
fxs-channel => 1
[span zt]
name => OpenZAP
number => 2
fxo-channel => 3

View File

@ -1,45 +0,0 @@
<configuration name="openzap.conf" description="OpenZAP Configuration">
<settings>
<param name="debug" value="0"/>
<!--<param name="hold-music" value="$${moh_uri}"/>-->
<!--<param name="enable-analog-option" value="call-swap"/>-->
<!--<param name="enable-analog-option" value="3-way"/>-->
</settings>
<pri_spans>
<span name="PRI_1">
<!-- Log Levels: none, alert, crit, err, warning, notice, info, debug -->
<param name="q921loglevel" value="alert"/>
<param name="q931loglevel" value="alert"/>
<param name="mode" value="user"/>
<param name="dialect" value="5ess"/>
<param name="dialplan" value="XML"/>
<param name="context" value="default"/>
</span>
<span name="PRI_2">
<param name="q921loglevel" value="alert"/>
<param name="q931loglevel" value="alert"/>
<param name="mode" value="user"/>
<param name="dialect" value="5ess"/>
<param name="dialplan" value="XML"/>
<param name="context" value="default"/>
</span>
</pri_spans>
<!-- one entry here per openzap span -->
<analog_spans>
<span id="1">
<!--<param name="hold-music" value="$${moh_uri}"/>-->
<!--<param name="enable-analog-option" value="call-swap"/>-->
<!--<param name="enable-analog-option" value="3-way"/>-->
<param name="tonegroup" value="us"/>
<param name="digit-timeout" value="2000"/>
<param name="max-digits" value="11"/>
<param name="dialplan" value="XML"/>
<param name="context" value="default"/>
<param name="enable-callerid" value="true"/>
<!-- regex to stop dialing when it matches -->
<!--<param name="dial-regex" value="5555"/>-->
<!-- regex to stop dialing when it does not match -->
<!--<param name="fail-dial-regex" value="^5"/>-->
</span>
</analog_spans>
</configuration>

View File

@ -1,41 +0,0 @@
; each category is a config profile
; to apply the profile append it to a channel def in
; openzap.conf with @<profile_name>
; e.g.
; [span pika]
; name => pika
; number => pika
; fxs-channel => 1:0:1-12@default
[default]
; region is na or eu
;region => na
;rx-gain => 0.00
;rx-agc-enabled => false
;rx-agc-targetPower => -15.00
;rx-agc-minGain => -6.00
;rx-agc-maxGain => 18.00
;rx-agc-attackRate => 170
;rx-agc-decayRate => 750
;rx-agc-speechThreshold => -36.00
;rx-vad-enabled => false
;rx-vad-activationThreshold => -40.00
;rx-vad-activationDebounceTime => 72
;rx-vad-deactivationThreshold => -40.00
;rx-vad-deactivationDebounceTime => 984
;rx-vad-preSpeechBufferSize => 240
;tx-gain => 0.00
;tx-agc-enabled => true
;tx-agc-targetPower => -15.00
;tx-agc-minGain => -6.00
;tx-agc-maxGain => 18.00
;tx-agc-attackRate => 170
;tx-agc-decayRate => 750
;tx-agc-speechThreshold => -36.00
;ec-enabled => false
;ec-doubleTalkerThreshold => -6.00
;ec-speechPresentThreshold => -40.00
;ec-echoSuppressionThreshold => -18.00
;ec-echoSuppressionEnabled => true
;ec-comfortNoiseEnabled => true
;ec-adaptationModeEnabled => true

View File

@ -1,63 +0,0 @@
[us]
generate-dial => v=-7;%(1000,0,350,440)
detect-dial => 350,440
generate-ring => v=-7;%(2000,4000,440,480)
detect-ring => 440,480
generate-busy => v=-7;%(500,500,480,620)
detect-busy => 480,620
generate-attn => v=0;%(100,100,1400,2060,2450,2600)
detect-attn => 1400,2060,2450,2600
generate-callwaiting-sas => v=0;%(300,0,440)
detect-callwaiting-sas => 440
generate-callwaiting-cas => v=0;%(80,0,2750,2130)
detect-callwaiting-cas => 2750,2130
detect-fail1 => 913.8
detect-fail2 => 1370.6
detect-fail3 => 1776.7
[sg]
generate-dial => v=-7;%(1000,0,425)
detect-dial => 425
generate-ring => v=-7;%(2000,4000,425)
detect-ring => 425
generate-busy => v=-7;%(750,750,425)
detect-busy => 425
generate-attn => v=0;%(100,100,1400,2060,2450,2600)
detect-attn => 1400,2060,2450,2600
generate-callwaiting-sas => v=0;%(300,0,440)
detect-callwaiting-sas => 440
generate-callwaiting-cas => v=0;%(80,0,2750,2130)
detect-callwaiting-cas => 2750,2130
detect-fail1 => 913.8
detect-fail2 => 1370.6
detect-fail3 => 1776.7
[ru]
generate-dial => v=-7;%(1000,425)
detect-dial => 0
generate-ring => v=-7;%(800,5000,425,0)
detect-ring => 425,0
generate-busy => v=-7;%(350,350,425,0)
detect-busy => 425,0
generate-attn => v=0;%(100,100,1400,2060,2450,2600)
detect-attn => 1400,2060,2450,2600
generate-callwaiting-sas => v=0;%(300,0,440)
detect-callwaiting-sas => 440,480
generate-callwaiting-cas => v=0;%(80,0,2750,2130)
detect-callwaiting-cas => 2750,2130
detect-fail1 => 913.8
detect-fail2 => 1370.6
detect-fail3 => 1776.7

View File

@ -1,4 +0,0 @@
[defaults]
codec_ms => 20
wink_ms => 150
flash_ms => 750

View File

@ -1,8 +0,0 @@
[defaults]
codec_ms => 20
wink_ms => 150
flash_ms => 750
echo_cancel_level => 64
rxgain => 0.0
txgain => 0.0

View File

@ -1,195 +0,0 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT([openzap],[0.1],[bugs@freeswitch.org])
AC_CONFIG_SRCDIR([src/zap_io.c])
AC_CONFIG_AUX_DIR(build)
AM_INIT_AUTOMAKE
# Checks for programs.
AC_PROG_CC
AC_PROG_MAKE_SET
AM_PROG_CC_C_O
AC_PREFIX_DEFAULT(/usr/local/openzap)
# AC_PREFIX_DEFAULT does not get expanded until too late so we need to do this to use prefix in this script
if test "x$prefix" = "xNONE" ; then
prefix='/usr/local/openzap'
fi
# Absolute source/build directory
OZ_SRCDIR=`(cd $srcdir && pwd)`
oz_builddir=`pwd`
AC_SUBST(OZ_SRCDIR)
AC_SUBST(oz_builddir)
if test "$sysconfdir" = "\${prefix}/etc" ; then
confdir="$prefix/conf"
else
confdir="$sysconfdir"
fi
AC_SUBST(confdir)
#override some default libtool behavior and invoke AC_PROG_LIBTOOL (see http://lists.gnu.org/archive/html/libtool/2007-03/msg00000.html)
m4_defun([_LT_AC_LANG_F77_CONFIG], [:])
m4_defun([_LT_AC_LANG_GCJ_CONFIG], [:])
m4_defun([_LT_AC_LANG_RC_CONFIG], [:])
#AM_PROG_CC_C_O
AC_PROG_LIBTOOL
AC_PROG_INSTALL
# Check for com;iler type
AC_DEFUN([AX_COMPILER_VENDOR],
[
AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor,
[ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=unknown
# note: don't check for GCC first, since some other compilers define __GNUC__
for ventest in intel:__ICC,__ECC,__INTEL_COMPILER ibm:__xlc__,__xlC__,__IBMC__,__IBMCPP__ gnu:__GNUC__ sun:__SUNPRO_C,__SUNPRO_CC hp:__HP_cc,__HP_aCC dec:__DECC,__DECCXX,__DECC_VER,__DECCXX_VER borland:__BORLANDC__,__TURBOC__ comeau:__COMO__ cray:_CRAYC kai:__KCC lcc:__LCC__ metrowerks:__MWERKS__ sgi:__sgi,sgi microsoft:_MSC_VER watcom:__WATCOMC__ portland:__PGI; do
vencpp="defined("`echo $ventest | cut -d: -f2 | sed 's/,/) || defined(/g'`")"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[
#if !($vencpp)
thisisanerror;
#endif
])], [ax_cv_]_AC_LANG_ABBREV[_compiler_vendor=`echo $ventest | cut -d: -f1`; break])
done
])
])
AC_ARG_ENABLE([enable_64], [AS_HELP_STRING([--enable-64], [Enable 64bit compilation])], [enable_64="$enableval"], [enable_64="no"])
AX_COMPILER_VENDOR
case "${ax_cv_c_compiler_vendor}" in
gnu)
COMP_VENDOR_CFLAGS="-ffast-math -Wall -Werror -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -O0"
;;
sun)
COMP_VENDOR_CFLAGS="-xc99=all -mt -xCC -D__FUNCTION__=__func__ -xvpara"
if test "$enable_64" = "yes" ; then
COMP_VENDOR_CFLAGS="-m64 $COMP_VENDOR_CFLAGS"
fi
;;
*)
COMP_VENDOR_CFLAGS="-std=c99 -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes"
;;
esac
#set SOLINK variable based on compiler and host
if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
SOLINK="-Bdynamic -dy -G"
elif test "x${ax_cv_c_compiler_vendor}" = "xclang" ; then
case "$host" in
*darwin*)
SOLINK="-dynamic -bundle -force-flat-namespace"
;;
*)
SOLINK="-shared -Xlinker -x"
;;
esac
elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then
case "$host" in
*darwin*)
SOLINK="-dynamic -bundle -force-flat-namespace"
;;
*-solaris2*)
SOLINK="-shared -Xlinker"
;;
*)
SOLINK="-shared -Xlinker -x"
;;
esac
elif test "x${ax_cv_c_compiler_vendor}" = "xintel" ; then
case "$host" in
*)
SOLINK="-shared -Xlinker -x"
;;
esac
else
AC_ERROR([Please update configure.in with SOLINK values for your compiler])
fi
DEFAULT_INCLUDES="-I. -I./src/include -I$(srcdir)"
AC_SUBST(SOLINK)
AC_SUBST(DEFAULT_INCLUDES)
AC_CHECK_LIB([dl], [dlopen])
AC_CHECK_LIB([pthread], [pthread_create])
AC_CHECK_LIB([m], [cos])
AX_LIB_PCAP
AC_CHECK_HEADERS([netinet/sctp.h netdb.h sys/select.h])
AM_CONDITIONAL([HAVE_SCTP],[test "${ac_cv_header_netinet_sctp_h}" = "yes"])
AC_CHECK_FUNC([gethostbyname_r],
[], [AC_CHECK_LIB([nsl], [gethostbyname_r])]
)
if test "$ac_cv_func_gethostbyname_r" = "yes" -o "$ac_cv_lib_nsl_gethostbyname_r" = "yes" ; then
AC_MSG_CHECKING([whether gethostbyname_r requires five arguments])
ac_cv_func_gethostbyname_r_five_args="no"
AC_TRY_COMPILE([#include <netdb.h>],
[char *name;
struct hostent *he, *res;
char buffer[2048];
int buflen = 2048;
(void)gethostbyname_r(name, he, buffer, buflen, &res)],
[ac_cv_func_gethostbyname_r_five_args="yes"
AC_DEFINE([HAVE_GETHOSTBYNAME_R_FIVE], [1], [gethostbyname_r has five arguments])]
)
AC_MSG_RESULT([$ac_cv_func_gethostbyname_r_five_args])
AC_DEFINE([HAVE_GETHOSTBYNAME_R],[1],[threadsafe gethostbyname])
fi
# Enable debugging
AC_ARG_ENABLE(debug,
[AC_HELP_STRING([--enable-debug],[build with debug information])],[enable_debug="$enableval"],[enable_debug="yes"])
if test "${enable_debug}" = "yes"; then
AC_DEFINE([DEBUG],[],[Enable extra debugging.])
if test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then
COMP_VENDOR_CFLAGS="$COMP_VENDOR_CFLAGS -g -ggdb"
fi
fi
# Where to install the modules
AC_ARG_WITH([modinstdir],
[AS_HELP_STRING([--with-modinstdir=DIR], [Install modules into this location (default: $prefix/mod)])], [modinstdir="$withval"], [modinstdir="${prefix}/mod"])
AC_SUBST(modinstdir)
# libpri?
AC_ARG_WITH([libpri],
[AS_HELP_STRING([--with-libpri], [Install ozmod_libpri])], [enable_libpri="yes"], [enable_libpri="no"])
AC_SUBST(enable_libpri)
# debug dtmf?
AC_ARG_WITH([debugdtmf],
[AS_HELP_STRING([--with-debugdtmf], [Debug DTMF])], [enable_debugdtmf="yes"], [enable_debugdtmf="no"])
AC_SUBST(enable_debugdtmf)
AC_CHECK_LIB([sangoma], [sangoma_span_chan_toif], [have_libsangoma="yes"])
AM_CONDITIONAL([LIBSANGOMA],[test "${have_libsangoma}" = "yes"])
AM_CONDITIONAL([LIBPRI],[test "${enable_libpri}" = "yes"])
AM_CONDITIONAL([DEBUGDTMF],[test "${enable_debugdtmf}" = "yes"])
AC_CHECK_LIB([openr2], [openr2_context_set_io_type], [have_openr2="yes"])
AM_CONDITIONAL([OPENR2],[test "${have_openr2}" = "yes"])
COMP_VENDOR_CFLAGS="$COMP_VENDOR_CFLAGS"
AC_SUBST(COMP_VENDOR_CFLAGS)
AC_CONFIG_FILES([Makefile
openzap.pc
mod_openzap/Makefile])
AC_OUTPUT

View File

@ -1,4 +0,0 @@
#! /bin/sh
srcpath=$(dirname $0 2>/dev/null ) || srcpath="."
$srcpath/configure "$@" --with-pic

View File

@ -1,277 +0,0 @@
# Doxyfile 1.4.6
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = OpenZAP
PROJECT_NUMBER =
OUTPUT_DIRECTORY = .
CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English
USE_WINDOWS_ENCODING = YES
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ABBREVIATE_BRIEF = "The $name class" \
"The $name widget" \
"The $name file" \
is \
provides \
specifies \
contains \
represents \
a \
an \
the
ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = NO
FULL_PATH_NAMES = NO
STRIP_FROM_PATH =
STRIP_FROM_INC_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
DETAILS_AT_TOP = NO
INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 8
ALIASES =
OPTIMIZE_OUTPUT_FOR_C = YES
OPTIMIZE_OUTPUT_JAVA = NO
DISTRIBUTE_GROUP_DOC = NO
SUBGROUPING = YES
IGNORE_PREFIX = zap_ ZAP_ Q921 Q931
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
EXTRACT_ALL = YES
EXTRACT_PRIVATE = YES
EXTRACT_STATIC = YES
EXTRACT_LOCAL_CLASSES = YES
EXTRACT_LOCAL_METHODS = YES
HIDE_UNDOC_MEMBERS = YES
HIDE_UNDOC_CLASSES = YES
HIDE_FRIEND_COMPOUNDS = NO
HIDE_IN_BODY_DOCS = NO
INTERNAL_DOCS = NO
CASE_SENSE_NAMES = NO
HIDE_SCOPE_NAMES = NO
SHOW_INCLUDE_FILES = YES
INLINE_INFO = YES
SORT_MEMBER_DOCS = YES
SORT_BRIEF_DOCS = NO
SORT_BY_SCOPE_NAME = NO
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = YES
SHOW_DIRECTORIES = YES
FILE_VERSION_FILTER =
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = NO
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_NO_PARAMDOC = NO
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = ../src ../src/include \
../src/isdn ../src/isdn/include \
../mod_openzap ../ \
../src/ozmod \
../src/ozmod/ozmod_analog \
../src/ozmod/ozmod_analog_em \
../src/ozmod/ozmod_isdn \
../src/ozmod/ozmod_pika \
../src/ozmod/ozmod_skel \
../src/ozmod/ozmod_ss7_boost \
../src/ozmod/ozmod_wanpipe \
../src/ozmod/ozmod_zt
FILE_PATTERNS = *.c \
*.cc \
*.cxx \
*.cpp \
*.c++ \
*.d \
*.java \
*.ii \
*.ixx \
*.ipp \
*.i++ \
*.inl \
*.h \
*.hh \
*.hxx \
*.hpp \
*.h++ \
*.idl \
*.odl \
*.cs \
*.php \
*.php3 \
*.inc \
*.m \
*.mm \
*.dox \
*.py
RECURSIVE = NO
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS =
EXAMPLE_PATH =
EXAMPLE_PATTERNS =
EXAMPLE_RECURSIVE = NO
IMAGE_PATH =
INPUT_FILTER =
FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER = NO
INLINE_SOURCES = YES
STRIP_CODE_COMMENTS = YES
REFERENCED_BY_RELATION = YES
REFERENCES_RELATION = YES
USE_HTAGS = YES
VERBATIM_HEADERS = NO
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = YES
COLS_IN_ALPHA_INDEX = 1
IGNORE_PREFIX = zap_
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = html
HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET =
HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = NO
CHM_FILE = freeswitch.chm
HHC_LOCATION =
GENERATE_CHI = YES
BINARY_TOC = NO
TOC_EXPAND = NO
DISABLE_INDEX = NO
ENUM_VALUES_PER_LINE = 4
GENERATE_TREEVIEW = YES
TREEVIEW_WIDTH = 250
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = NO
LATEX_OUTPUT = latex
LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4wide
EXTRA_PACKAGES =
LATEX_HEADER =
PDF_HYPERLINKS = NO
USE_PDFLATEX = NO
LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF = NO
RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN = NO
MAN_OUTPUT = man
MAN_EXTENSION = .3
MAN_LINKS = NO
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = NO
XML_OUTPUT = xml
XML_SCHEMA =
XML_DTD =
XML_PROGRAMLISTING = YES
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# configuration options related to the Perl module output
#---------------------------------------------------------------------------
GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO
PERLMOD_PRETTY = YES
PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = YES
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = NO
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS = *.h
PREDEFINED = ZAP_DECLARE(x)=x \
APR_DECLARE(x)=x \
ZAP_MOD_DECLARE(x)=x \
DoxyDefine(x)=x
EXPAND_AS_DEFINED = NO
SKIP_FUNCTION_MACROS = NO
#---------------------------------------------------------------------------
# Configuration::additions related to external references
#---------------------------------------------------------------------------
TAGFILES =
GENERATE_TAGFILE =
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = YES
HIDE_UNDOC_RELATIONS = YES
HAVE_DOT = YES
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
GROUP_GRAPHS = YES
UML_LOOK = YES
TEMPLATE_RELATIONS = YES
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
CALL_GRAPH = YES
GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES
DOT_IMAGE_FORMAT = jpg
DOT_PATH =
DOTFILE_DIRS =
MAX_DOT_GRAPH_WIDTH = 1024
MAX_DOT_GRAPH_HEIGHT = 1024
MAX_DOT_GRAPH_DEPTH = 1000
DOT_TRANSPARENT = NO
DOT_MULTI_TARGETS = NO
GENERATE_LEGEND = YES
DOT_CLEANUP = YES
#---------------------------------------------------------------------------
# Configuration::additions related to the search engine
#---------------------------------------------------------------------------
SEARCHENGINE = NO

View File

@ -1,23 +0,0 @@
OZ_CFLAGS=@CFLAGS@ @COMP_VENDOR_CFLAGS@ @DEFS@
BASE=../../..
OZ_DIR=..
VERBOSE=1
OZLA=$(OZ_DIR)/libopenzap.la
LOCAL_CFLAGS=-I$(OZ_DIR)/src/include -I$(OZ_DIR)/src/isdn/include $(OZ_CFLAGS)
LOCAL_LDFLAGS=-L$(OZ_DIR) -lopenzap
include $(BASE)/build/modmake.rules
local_depend: $(OZLA)
$(OZLA): $(OZ_DIR)/.update
cd $(OZ_DIR) && $(MAKE)
local_install:
cd $(OZ_DIR) && $(MAKE) install
[ -f $(DESTDIR)@confdir@/autoload_configs/openzap.conf.xml ] || cp -f $(OZ_DIR)/conf/openzap.conf.xml $(DESTDIR)@confdir@/autoload_configs
local_clean:
cd $(OZ_DIR) && $(MAKE) clean

View File

@ -1,201 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="mod_openzap"
ProjectGUID="{FE3540C5-3303-46E0-A69E-D92F775687F1}"
RootNamespace="mod_openzap"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../../src/include;../src/include;../src/isdn/include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="4"
WarnAsError="true"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="FreeSwitchCore.lib"
OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
LinkIncremental="2"
AdditionalLibraryDirectories="&quot;../../../w32/Library/$(OutDir)&quot;"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
SubSystem="2"
ImportLibrary="$(OutDir)/mod_openzap.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../../../src/include;../src/include;../src/isdn/include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="4"
WarnAsError="true"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="FreeSwitchCore.lib"
OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
LinkIncremental="1"
AdditionalLibraryDirectories="&quot;../../../w32/Library/$(OutDir)&quot;"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
LinkTimeCodeGeneration="1"
ImportLibrary="$(OutDir)/mod_openzap.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\mod_openzap.c"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -1,369 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="mod_openzap"
ProjectGUID="{FE3540C5-3303-46E0-A69E-D92F775687F1}"
RootNamespace="mod_openzap"
Keyword="Win32Proj"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../../src/include;../src/include;../src/isdn/include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="4"
WarnAsError="true"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="FreeSwitchCore.lib"
OutputFile="$(SolutionDir)$(OutDir)/mod/mod_openzap.dll"
LinkIncremental="2"
AdditionalLibraryDirectories="&quot;../../../w32/Library/$(OutDir)&quot;"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
SubSystem="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
ImportLibrary="$(OutDir)/mod_openzap.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../../../src/include;../src/include;../src/isdn/include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="4"
WarnAsError="true"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="FreeSwitchCore.lib"
OutputFile="$(SolutionDir)$(OutDir)/mod/mod_openzap.dll"
LinkIncremental="1"
AdditionalLibraryDirectories="&quot;../../../w32/Library/$(OutDir)&quot;"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
LinkTimeCodeGeneration="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
ImportLibrary="$(OutDir)/mod_openzap.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../../src/include;../src/include;../src/isdn/include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="4"
WarnAsError="true"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="FreeSwitchCore.lib"
OutputFile="$(SolutionDir)$(OutDir)/mod/mod_openzap.dll"
LinkIncremental="2"
AdditionalLibraryDirectories="&quot;../../../w32/Library/$(OutDir)&quot;"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
SubSystem="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
ImportLibrary="$(OutDir)/mod_openzap.lib"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../../../src/include;../src/include;../src/isdn/include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="4"
WarnAsError="true"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="FreeSwitchCore.lib"
OutputFile="$(SolutionDir)$(OutDir)/mod/mod_openzap.dll"
LinkIncremental="1"
AdditionalLibraryDirectories="&quot;../../../w32/Library/$(OutDir)&quot;"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
LinkTimeCodeGeneration="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
ImportLibrary="$(OutDir)/mod_openzap.lib"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\mod_openzap.c"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

File diff suppressed because it is too large Load Diff

View File

@ -1,301 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="openzap"
ProjectGUID="{93B8812C-3EC4-4F78-8970-FFBFC99E167D}"
RootNamespace="openzap"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="2"
BuildLogFile="$(IntDir)\BuildLog-openzap.htm"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../src/include;../src/isdn/include"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;OPENZAP_EXPORTS;TELETONE_EXPORTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
DisableLanguageExtensions="false"
RuntimeTypeInfo="false"
UsePrecompiledHeader="0"
WarningLevel="4"
WarnAsError="true"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
CompileAs="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="2"
WholeProgramOptimization="1"
BuildLogFile="$(IntDir)\BuildLog-openzap.htm"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../src/include;../src/isdn/include"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;OPENZAP_EXPORTS;TELETONE_EXPORTS"
RuntimeLibrary="2"
DisableLanguageExtensions="false"
RuntimeTypeInfo="false"
UsePrecompiledHeader="0"
WarningLevel="4"
WarnAsError="true"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
CompileAs="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\src\fsk.c"
>
</File>
<File
RelativePath="..\src\g711.c"
>
</File>
<File
RelativePath="..\src\hashtable.c"
>
</File>
<File
RelativePath="..\src\hashtable_itr.c"
>
</File>
<File
RelativePath="..\src\libteletone_detect.c"
>
</File>
<File
RelativePath="..\src\libteletone_generate.c"
>
</File>
<File
RelativePath="..\src\uart.c"
>
</File>
<File
RelativePath="..\src\zap_buffer.c"
>
</File>
<File
RelativePath="..\src\zap_callerid.c"
>
</File>
<File
RelativePath="..\src\zap_config.c"
>
</File>
<File
RelativePath="..\src\zap_dso.c"
>
</File>
<File
RelativePath="..\src\zap_io.c"
>
</File>
<File
RelativePath="..\src\zap_threadmutex.c"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath="..\src\include\fsk.h"
>
</File>
<File
RelativePath="..\src\include\g711.h"
>
</File>
<File
RelativePath="..\src\include\hashtable.h"
>
</File>
<File
RelativePath="..\src\include\hashtable_itr.h"
>
</File>
<File
RelativePath="..\src\include\hashtable_private.h"
>
</File>
<File
RelativePath="..\src\include\libteletone.h"
>
</File>
<File
RelativePath="..\src\include\libteletone_detect.h"
>
</File>
<File
RelativePath="..\src\include\libteletone_generate.h"
>
</File>
<File
RelativePath="..\src\include\openzap.h"
>
</File>
<File
RelativePath="..\src\include\uart.h"
>
</File>
<File
RelativePath="..\src\include\zap_buffer.h"
>
</File>
<File
RelativePath="..\src\include\zap_config.h"
>
</File>
<File
RelativePath="..\src\include\zap_dso.h"
>
</File>
<File
RelativePath="..\src\include\zap_threadmutex.h"
>
</File>
<File
RelativePath="..\src\include\zap_types.h"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -1,451 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="openzap"
ProjectGUID="{93B8812C-3EC4-4F78-8970-FFBFC99E167D}"
RootNamespace="openzap"
Keyword="Win32Proj"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="2"
BuildLogFile="$(IntDir)\BuildLog-openzap.htm"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../src/include;../src/isdn/include"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;OPENZAP_EXPORTS;TELETONE_EXPORTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
DisableLanguageExtensions="false"
RuntimeTypeInfo="false"
UsePrecompiledHeader="0"
WarningLevel="4"
WarnAsError="true"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
CompileAs="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
GenerateDebugInformation="true"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="2"
WholeProgramOptimization="1"
BuildLogFile="$(IntDir)\BuildLog-openzap.htm"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../src/include;../src/isdn/include"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;OPENZAP_EXPORTS;TELETONE_EXPORTS"
RuntimeLibrary="2"
DisableLanguageExtensions="false"
RuntimeTypeInfo="false"
UsePrecompiledHeader="0"
WarningLevel="4"
WarnAsError="true"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
CompileAs="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="2"
BuildLogFile="$(IntDir)\BuildLog-openzap.htm"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../src/include;../src/isdn/include"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;OPENZAP_EXPORTS;TELETONE_EXPORTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
DisableLanguageExtensions="false"
RuntimeTypeInfo="false"
UsePrecompiledHeader="0"
WarningLevel="4"
WarnAsError="true"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
CompileAs="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
GenerateDebugInformation="true"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="2"
WholeProgramOptimization="1"
BuildLogFile="$(IntDir)\BuildLog-openzap.htm"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../src/include;../src/isdn/include"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;OPENZAP_EXPORTS;TELETONE_EXPORTS"
RuntimeLibrary="2"
DisableLanguageExtensions="false"
RuntimeTypeInfo="false"
UsePrecompiledHeader="0"
WarningLevel="4"
WarnAsError="true"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
CompileAs="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath="..\src\include\fsk.h"
>
</File>
<File
RelativePath="..\src\include\g711.h"
>
</File>
<File
RelativePath="..\src\include\hashtable.h"
>
</File>
<File
RelativePath="..\src\include\hashtable_itr.h"
>
</File>
<File
RelativePath="..\src\include\hashtable_private.h"
>
</File>
<File
RelativePath="..\src\include\libteletone.h"
>
</File>
<File
RelativePath="..\src\include\libteletone_detect.h"
>
</File>
<File
RelativePath="..\src\include\libteletone_generate.h"
>
</File>
<File
RelativePath="..\src\include\openzap.h"
>
</File>
<File
RelativePath="..\src\include\uart.h"
>
</File>
<File
RelativePath="..\src\include\zap_buffer.h"
>
</File>
<File
RelativePath="..\src\include\zap_config.h"
>
</File>
<File
RelativePath="..\src\include\zap_dso.h"
>
</File>
<File
RelativePath="..\src\include\zap_threadmutex.h"
>
</File>
<File
RelativePath="..\src\include\zap_types.h"
>
</File>
</Filter>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\src\fsk.c"
>
</File>
<File
RelativePath="..\src\g711.c"
>
</File>
<File
RelativePath="..\src\hashtable.c"
>
</File>
<File
RelativePath="..\src\hashtable_itr.c"
>
</File>
<File
RelativePath="..\src\libteletone_detect.c"
>
</File>
<File
RelativePath="..\src\libteletone_generate.c"
>
</File>
<File
RelativePath="..\src\uart.c"
>
</File>
<File
RelativePath="..\src\zap_buffer.c"
>
</File>
<File
RelativePath="..\src\zap_callerid.c"
>
</File>
<File
RelativePath="..\src\zap_config.c"
>
</File>
<File
RelativePath="..\src\zap_dso.c"
>
</File>
<File
RelativePath="..\src\zap_io.c"
>
</File>
<File
RelativePath="..\src\zap_threadmutex.c"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -1,193 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="testanalog"
ProjectGUID="{BB833648-BAFF-4BE2-94DB-F8BB043C588C}"
RootNamespace="testanalog"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
BuildLogFile="$(IntDir)\BuildLog-testanalog.htm"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../src/include;../../src/isdn/include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="4"
WarnAsError="true"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
DisableSpecificWarnings="4100"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
BuildLogFile="$(IntDir)\BuildLog-testanalog.htm"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../../src/include;../../src/isdn/include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="4"
WarnAsError="true"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
DisableSpecificWarnings="4100"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\src\testanalog.c"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -1,349 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="testanalog"
ProjectGUID="{BB833648-BAFF-4BE2-94DB-F8BB043C588C}"
RootNamespace="testanalog"
Keyword="Win32Proj"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
BuildLogFile="$(IntDir)\BuildLog-testanalog.htm"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../src/include;../../src/isdn/include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="4"
WarnAsError="true"
DebugInformationFormat="4"
DisableSpecificWarnings="4100"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
BuildLogFile="$(IntDir)\BuildLog-testanalog.htm"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../../src/include;../../src/isdn/include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="4"
WarnAsError="true"
DebugInformationFormat="3"
DisableSpecificWarnings="4100"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
BuildLogFile="$(IntDir)\BuildLog-testanalog.htm"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../src/include;../../src/isdn/include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="4"
WarnAsError="true"
DebugInformationFormat="3"
DisableSpecificWarnings="4100"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
BuildLogFile="$(IntDir)\BuildLog-testanalog.htm"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../../src/include;../../src/isdn/include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="4"
WarnAsError="true"
DebugInformationFormat="3"
DisableSpecificWarnings="4100"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\src\testanalog.c"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -1,193 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="testisdn"
ProjectGUID="{6DA6FD42-641D-4147-92F5-3BC4AAA6589B}"
RootNamespace="testisdn"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
BuildLogFile="$(IntDir)\BuildLog-testisdn.htm"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../src/include;../../src/isdn/include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="4"
WarnAsError="true"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
DisableSpecificWarnings="4100"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
BuildLogFile="$(IntDir)\BuildLog-testisdn.htm"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../../src/include;../../src/isdn/include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="4"
WarnAsError="true"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
DisableSpecificWarnings="4100"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\src\testisdn.c"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -1,349 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="testisdn"
ProjectGUID="{6DA6FD42-641D-4147-92F5-3BC4AAA6589B}"
RootNamespace="testisdn"
Keyword="Win32Proj"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
BuildLogFile="$(IntDir)\BuildLog-testisdn.htm"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../src/include;../../src/isdn/include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="4"
WarnAsError="true"
DebugInformationFormat="4"
DisableSpecificWarnings="4100"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
BuildLogFile="$(IntDir)\BuildLog-testisdn.htm"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../../src/include;../../src/isdn/include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="4"
WarnAsError="true"
DebugInformationFormat="3"
DisableSpecificWarnings="4100"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
BuildLogFile="$(IntDir)\BuildLog-testisdn.htm"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../src/include;../../src/isdn/include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="4"
WarnAsError="true"
DebugInformationFormat="3"
DisableSpecificWarnings="4100"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
BuildLogFile="$(IntDir)\BuildLog-testisdn.htm"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../../src/include;../../src/isdn/include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="4"
WarnAsError="true"
DebugInformationFormat="3"
DisableSpecificWarnings="4100"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\src\testisdn.c"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -1,82 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openzap", "msvc\openzap.2005.vcproj", "{93B8812C-3EC4-4F78-8970-FFBFC99E167D}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testanalog", "msvc\testanalog\testanalog.2005.vcproj", "{BB833648-BAFF-4BE2-94DB-F8BB043C588C}"
ProjectSection(ProjectDependencies) = postProject
{93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testisdn", "msvc\testisdn\testisdn.2005.vcproj", "{6DA6FD42-641D-4147-92F5-3BC4AAA6589B}"
ProjectSection(ProjectDependencies) = postProject
{93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_openzap", "mod_openzap\mod_openzap.2005.vcproj", "{FE3540C5-3303-46E0-A69E-D92F775687F1}"
ProjectSection(ProjectDependencies) = postProject
{93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ozmod_analog", "src\ozmod\ozmod_analog\ozmod_analog.2005.vcproj", "{37C94798-6E33-4B4F-8EE0-C72A7DC91157}"
ProjectSection(ProjectDependencies) = postProject
{93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ozmod_analog_em", "src\ozmod\ozmod_analog_em\ozmod_analog_em.2005.vcproj", "{C539D7C8-26A8-4A94-B938-77672165C130}"
ProjectSection(ProjectDependencies) = postProject
{93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ozmod_isdn", "src\ozmod\ozmod_isdn\ozmod_isdn.2005.vcproj", "{729344A5-D5E9-434D-8EE8-AF8C6C795D15}"
ProjectSection(ProjectDependencies) = postProject
{93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ozmod_wanpipe", "src\ozmod\ozmod_wanpipe\ozmod_wanpipe.2005.vcproj", "{1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ozmod_pika", "src\ozmod\ozmod_pika\ozmod_pika.2005.vcproj", "{E886B4D5-AB4F-4092-B8F4-3B06E1E462EF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Debug|Win32.ActiveCfg = Debug|Win32
{93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Debug|Win32.Build.0 = Debug|Win32
{93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Release|Win32.ActiveCfg = Release|Win32
{93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Release|Win32.Build.0 = Release|Win32
{BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Debug|Win32.ActiveCfg = Debug|Win32
{BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Debug|Win32.Build.0 = Debug|Win32
{BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Release|Win32.ActiveCfg = Release|Win32
{BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Release|Win32.Build.0 = Release|Win32
{6DA6FD42-641D-4147-92F5-3BC4AAA6589B}.Debug|Win32.ActiveCfg = Debug|Win32
{6DA6FD42-641D-4147-92F5-3BC4AAA6589B}.Debug|Win32.Build.0 = Debug|Win32
{6DA6FD42-641D-4147-92F5-3BC4AAA6589B}.Release|Win32.ActiveCfg = Release|Win32
{6DA6FD42-641D-4147-92F5-3BC4AAA6589B}.Release|Win32.Build.0 = Release|Win32
{FE3540C5-3303-46E0-A69E-D92F775687F1}.Debug|Win32.ActiveCfg = Debug|Win32
{FE3540C5-3303-46E0-A69E-D92F775687F1}.Debug|Win32.Build.0 = Debug|Win32
{FE3540C5-3303-46E0-A69E-D92F775687F1}.Release|Win32.ActiveCfg = Release|Win32
{FE3540C5-3303-46E0-A69E-D92F775687F1}.Release|Win32.Build.0 = Release|Win32
{37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Debug|Win32.ActiveCfg = Debug|Win32
{37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Debug|Win32.Build.0 = Debug|Win32
{37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Release|Win32.ActiveCfg = Release|Win32
{37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Release|Win32.Build.0 = Release|Win32
{C539D7C8-26A8-4A94-B938-77672165C130}.Debug|Win32.ActiveCfg = Debug|Win32
{C539D7C8-26A8-4A94-B938-77672165C130}.Debug|Win32.Build.0 = Debug|Win32
{C539D7C8-26A8-4A94-B938-77672165C130}.Release|Win32.ActiveCfg = Release|Win32
{C539D7C8-26A8-4A94-B938-77672165C130}.Release|Win32.Build.0 = Release|Win32
{729344A5-D5E9-434D-8EE8-AF8C6C795D15}.Debug|Win32.ActiveCfg = Debug|Win32
{729344A5-D5E9-434D-8EE8-AF8C6C795D15}.Debug|Win32.Build.0 = Debug|Win32
{729344A5-D5E9-434D-8EE8-AF8C6C795D15}.Release|Win32.ActiveCfg = Release|Win32
{729344A5-D5E9-434D-8EE8-AF8C6C795D15}.Release|Win32.Build.0 = Release|Win32
{1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}.Debug|Win32.ActiveCfg = Debug|Win32
{1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}.Release|Win32.ActiveCfg = Release|Win32
{E886B4D5-AB4F-4092-B8F4-3B06E1E462EF}.Debug|Win32.ActiveCfg = Debug|Win32
{E886B4D5-AB4F-4092-B8F4-3B06E1E462EF}.Release|Win32.ActiveCfg = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -1,119 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openzap", "msvc\openzap.2008.vcproj", "{93B8812C-3EC4-4F78-8970-FFBFC99E167D}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testanalog", "msvc\testanalog\testanalog.2008.vcproj", "{BB833648-BAFF-4BE2-94DB-F8BB043C588C}"
ProjectSection(ProjectDependencies) = postProject
{93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testisdn", "msvc\testisdn\testisdn.2008.vcproj", "{6DA6FD42-641D-4147-92F5-3BC4AAA6589B}"
ProjectSection(ProjectDependencies) = postProject
{93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_openzap", "mod_openzap\mod_openzap.2008.vcproj", "{FE3540C5-3303-46E0-A69E-D92F775687F1}"
ProjectSection(ProjectDependencies) = postProject
{93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ozmod_analog", "src\ozmod\ozmod_analog\ozmod_analog.2008.vcproj", "{37C94798-6E33-4B4F-8EE0-C72A7DC91157}"
ProjectSection(ProjectDependencies) = postProject
{93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ozmod_analog_em", "src\ozmod\ozmod_analog_em\ozmod_analog_em.2008.vcproj", "{B3F49375-2834-4937-9D8C-4AC2EC911010}"
ProjectSection(ProjectDependencies) = postProject
{93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ozmod_isdn", "src\ozmod\ozmod_isdn\ozmod_isdn.2008.vcproj", "{729344A5-D5E9-434D-8EE8-AF8C6C795D15}"
ProjectSection(ProjectDependencies) = postProject
{93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ozmod_pika", "src\ozmod\ozmod_pika\ozmod_pika.2008.vcproj", "{E886B4D5-AB4F-4092-B8F4-3B06E1E462EF}"
ProjectSection(ProjectDependencies) = postProject
{93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ozmod_wanpipe", "src\ozmod\ozmod_wanpipe\ozmod_wanpipe.2008.vcproj", "{1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Debug|Win32.ActiveCfg = Debug|Win32
{93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Debug|Win32.Build.0 = Debug|Win32
{93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Debug|x64.ActiveCfg = Debug|x64
{93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Debug|x64.Build.0 = Debug|x64
{93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Release|Win32.ActiveCfg = Release|Win32
{93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Release|Win32.Build.0 = Release|Win32
{93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Release|x64.ActiveCfg = Release|x64
{93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Release|x64.Build.0 = Release|x64
{BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Debug|Win32.ActiveCfg = Debug|Win32
{BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Debug|Win32.Build.0 = Debug|Win32
{BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Debug|x64.ActiveCfg = Debug|x64
{BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Debug|x64.Build.0 = Debug|x64
{BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Release|Win32.ActiveCfg = Release|Win32
{BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Release|Win32.Build.0 = Release|Win32
{BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Release|x64.ActiveCfg = Release|x64
{BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Release|x64.Build.0 = Release|x64
{6DA6FD42-641D-4147-92F5-3BC4AAA6589B}.Debug|Win32.ActiveCfg = Debug|Win32
{6DA6FD42-641D-4147-92F5-3BC4AAA6589B}.Debug|Win32.Build.0 = Debug|Win32
{6DA6FD42-641D-4147-92F5-3BC4AAA6589B}.Debug|x64.ActiveCfg = Debug|x64
{6DA6FD42-641D-4147-92F5-3BC4AAA6589B}.Debug|x64.Build.0 = Debug|x64
{6DA6FD42-641D-4147-92F5-3BC4AAA6589B}.Release|Win32.ActiveCfg = Release|Win32
{6DA6FD42-641D-4147-92F5-3BC4AAA6589B}.Release|Win32.Build.0 = Release|Win32
{6DA6FD42-641D-4147-92F5-3BC4AAA6589B}.Release|x64.ActiveCfg = Release|x64
{6DA6FD42-641D-4147-92F5-3BC4AAA6589B}.Release|x64.Build.0 = Release|x64
{FE3540C5-3303-46E0-A69E-D92F775687F1}.Debug|Win32.ActiveCfg = Debug|Win32
{FE3540C5-3303-46E0-A69E-D92F775687F1}.Debug|Win32.Build.0 = Debug|Win32
{FE3540C5-3303-46E0-A69E-D92F775687F1}.Debug|x64.ActiveCfg = Debug|x64
{FE3540C5-3303-46E0-A69E-D92F775687F1}.Debug|x64.Build.0 = Debug|x64
{FE3540C5-3303-46E0-A69E-D92F775687F1}.Release|Win32.ActiveCfg = Release|Win32
{FE3540C5-3303-46E0-A69E-D92F775687F1}.Release|Win32.Build.0 = Release|Win32
{FE3540C5-3303-46E0-A69E-D92F775687F1}.Release|x64.ActiveCfg = Release|x64
{FE3540C5-3303-46E0-A69E-D92F775687F1}.Release|x64.Build.0 = Release|x64
{37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Debug|Win32.ActiveCfg = Debug|Win32
{37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Debug|Win32.Build.0 = Debug|Win32
{37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Debug|x64.ActiveCfg = Debug|x64
{37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Debug|x64.Build.0 = Debug|x64
{37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Release|Win32.ActiveCfg = Release|Win32
{37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Release|Win32.Build.0 = Release|Win32
{37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Release|x64.ActiveCfg = Release|x64
{37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Release|x64.Build.0 = Release|x64
{B3F49375-2834-4937-9D8C-4AC2EC911010}.Debug|Win32.ActiveCfg = Debug|Win32
{B3F49375-2834-4937-9D8C-4AC2EC911010}.Debug|Win32.Build.0 = Debug|Win32
{B3F49375-2834-4937-9D8C-4AC2EC911010}.Debug|x64.ActiveCfg = Debug|x64
{B3F49375-2834-4937-9D8C-4AC2EC911010}.Debug|x64.Build.0 = Debug|x64
{B3F49375-2834-4937-9D8C-4AC2EC911010}.Release|Win32.ActiveCfg = Release|Win32
{B3F49375-2834-4937-9D8C-4AC2EC911010}.Release|Win32.Build.0 = Release|Win32
{B3F49375-2834-4937-9D8C-4AC2EC911010}.Release|x64.ActiveCfg = Release|x64
{B3F49375-2834-4937-9D8C-4AC2EC911010}.Release|x64.Build.0 = Release|x64
{729344A5-D5E9-434D-8EE8-AF8C6C795D15}.Debug|Win32.ActiveCfg = Debug|Win32
{729344A5-D5E9-434D-8EE8-AF8C6C795D15}.Debug|Win32.Build.0 = Debug|Win32
{729344A5-D5E9-434D-8EE8-AF8C6C795D15}.Debug|x64.ActiveCfg = Debug|x64
{729344A5-D5E9-434D-8EE8-AF8C6C795D15}.Debug|x64.Build.0 = Debug|x64
{729344A5-D5E9-434D-8EE8-AF8C6C795D15}.Release|Win32.ActiveCfg = Release|Win32
{729344A5-D5E9-434D-8EE8-AF8C6C795D15}.Release|Win32.Build.0 = Release|Win32
{729344A5-D5E9-434D-8EE8-AF8C6C795D15}.Release|x64.ActiveCfg = Release|x64
{729344A5-D5E9-434D-8EE8-AF8C6C795D15}.Release|x64.Build.0 = Release|x64
{E886B4D5-AB4F-4092-B8F4-3B06E1E462EF}.Debug|Win32.ActiveCfg = Debug|Win32
{E886B4D5-AB4F-4092-B8F4-3B06E1E462EF}.Debug|x64.ActiveCfg = Debug|Win32
{E886B4D5-AB4F-4092-B8F4-3B06E1E462EF}.Release|Win32.ActiveCfg = Release|Win32
{E886B4D5-AB4F-4092-B8F4-3B06E1E462EF}.Release|x64.ActiveCfg = Release|Win32
{1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}.Debug|Win32.ActiveCfg = Debug|Win32
{1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}.Debug|x64.ActiveCfg = Debug|x64
{1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}.Release|Win32.ActiveCfg = Release|Win32
{1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}.Release|x64.ActiveCfg = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -1,17 +0,0 @@
#
# OpenZAP pkg-config file
#
prefix=@prefix@
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: OpenZAP
Description:
Version: @PACKAGE_VERSION@
URL: http://www.openzap.org/
Requires:
Conflicts:
Libs: -L${libdir} -lopenzap
Libs.private: -lm
Cflags: -I${includedir}

View File

@ -1,134 +0,0 @@
Index: src/ozmod/ozmod_wanpipe/ozmod_wanpipe.c
===================================================================
--- src/ozmod/ozmod_wanpipe/ozmod_wanpipe.c (revision 745)
+++ src/ozmod/ozmod_wanpipe/ozmod_wanpipe.c (working copy)
@@ -98,19 +98,21 @@
* so we can have one analong handler thread that will deal with all the idle analog channels for events
* the alternative would be for the driver to provide one socket for all of the oob events for all analog channels
*/
-static __inline__ int tdmv_api_wait_socket(sng_fd_t fd, int timeout, int *flags)
+static __inline__ int tdmv_api_wait_socket(zap_channel_t *zchan, int timeout, int *flags)
{
#ifdef LIBSANGOMA_VERSION
int err;
- sangoma_wait_obj_t sangoma_wait_obj;
+ sangoma_wait_obj_t *sangoma_wait_obj = zchan->mod_data;
- sangoma_init_wait_obj(&sangoma_wait_obj, fd, 1, 1, *flags, SANGOMA_WAIT_OBJ);
+ sangoma_init_wait_obj(sangoma_wait_obj, zchan->sockfd, 1, 1, 0, SANGOMA_WAIT_OBJ);
- err=sangoma_socket_waitfor_many(&sangoma_wait_obj,1 , timeout);
+ err = sangoma_socket_waitfor_many(&sangoma_wait_obj, 1, timeout);
+
if (err > 0) {
- *flags=sangoma_wait_obj.flags_out;
+ *flags = sangoma_wait_obj.flags_out;
}
+
return err;
#else
@@ -118,7 +120,7 @@
int res;
memset(&pfds[0], 0, sizeof(pfds[0]));
- pfds[0].fd = fd;
+ pfds[0].fd = zchan->sockfd;
pfds[0].events = *flags;
res = poll(pfds, 1, timeout);
*flags = 0;
@@ -200,6 +202,15 @@
if (sockfd != WP_INVALID_SOCKET && zap_span_add_channel(span, sockfd, type, &chan) == ZAP_SUCCESS) {
wanpipe_tdm_api_t tdm_api;
+#ifdef LIBSANGOMA_VERSION
+ sangoma_wait_obj_t *sangoma_wait_obj;
+
+ sangoma_wait_obj = malloc(sizeof(*sangoma_wait_obj));
+ memset(sangoma_wait_obj, 0, sizeof(*sangoma_wait_obj));
+ sangoma_init_wait_obj(sangoma_wait_obj, sockfd, 1, 1, 0, SANGOMA_WAIT_OBJ);
+ chan->mod_data = sangoma_wait_obj;
+#endif
+
memset(&tdm_api,0,sizeof(tdm_api));
chan->physical_span_id = spanno;
@@ -211,7 +222,7 @@
dtmf = "software";
- /* FIXME: Handle Error Conditino Check for return code */
+ /* FIXME: Handle Error Condition Check for return code */
err= sangoma_tdm_get_hw_coding(chan->sockfd, &tdm_api);
if (tdm_api.wp_tdm_cmd.hw_tdm_coding) {
@@ -606,7 +617,7 @@
inflags |= POLLPRI;
}
- result = tdmv_api_wait_socket(zchan->sockfd, to, &inflags);
+ result = tdmv_api_wait_socket(zchan, to, &inflags);
*flags = ZAP_NO_FLAGS;
@@ -643,26 +654,30 @@
ZIO_SPAN_POLL_EVENT_FUNCTION(wanpipe_poll_event)
{
#ifdef LIBSANGOMA_VERSION
- sangoma_wait_obj_t pfds[ZAP_MAX_CHANNELS_SPAN];
+ sangoma_wait_obj_t *pfds[ZAP_MAX_CHANNELS_SPAN] = { 0 };
#else
struct pollfd pfds[ZAP_MAX_CHANNELS_SPAN];
#endif
uint32_t i, j = 0, k = 0, l = 0;
- int objects=0;
int r;
for(i = 1; i <= span->chan_count; i++) {
zap_channel_t *zchan = span->channels[i];
+
#ifdef LIBSANGOMA_VERSION
- sangoma_init_wait_obj(&pfds[j], zchan->sockfd , 1, 1, POLLPRI, SANGOMA_WAIT_OBJ);
+ if (!zchan->mod_data) {
+ continue;
+ }
+ pfds[j] = zchan->mod_data;
+
#else
memset(&pfds[j], 0, sizeof(pfds[j]));
pfds[j].fd = span->channels[i]->sockfd;
pfds[j].events = POLLPRI;
#endif
- objects++;
+
/* The driver probably should be able to do this wink/flash/ringing by itself this is sort of a hack to make it work! */
if (zap_test_flag(zchan, ZAP_CHANNEL_WINK) || zap_test_flag(zchan, ZAP_CHANNEL_FLASH)) {
@@ -703,7 +718,7 @@
ms = l;
}
#ifdef LIBSANGOMA_VERSION
- r = sangoma_socket_waitfor_many(pfds,objects,ms);
+ r = sangoma_socket_waitfor_many(pfds, j, ms);
#else
r = poll(pfds, j, ms);
#endif
@@ -935,6 +950,15 @@
*/
static ZIO_CHANNEL_DESTROY_FUNCTION(wanpipe_channel_destroy)
{
+ sangoma_wait_obj_t *sangoma_wait_obj;
+
+ if (zchan->mod_data) {
+ sangoma_wait_obj = zchan->mod_data;
+ zchan->mod_data = NULL;
+ sangoma_release_wait_obj(sangoma_wait_obj);
+ free(sangoma_wait_obj);
+ }
+
if (zchan->sockfd > -1) {
close(zchan->sockfd);
zchan->sockfd = WP_INVALID_SOCKET;

View File

@ -1,33 +0,0 @@
//#include "openzap.h"
#include "libteletone_detect.h"
int main(int argc, char *argv[])
{
int fd, b;
short sln[512] = {0};
teletone_dtmf_detect_state_t dtmf_detect = {0};
char digit_str[128] = "";
if (argc < 2) {
fprintf(stderr, "Arg Error!\n");
exit(-1);
}
teletone_dtmf_detect_init (&dtmf_detect, 8000);
if ((fd = open(argv[1], O_RDONLY)) < 0) {
fprintf(stderr, "File Error! [%s]\n", strerror(errno));
exit(-1);
}
while((b = read(fd, sln, 320)) > 0) {
teletone_dtmf_detect(&dtmf_detect, sln, b / 2);
teletone_dtmf_get(&dtmf_detect, digit_str, sizeof(digit_str));
if (*digit_str) {
printf("digit: %s\n", digit_str);
}
}
close(fd);
return 0;
}

View File

@ -1,32 +0,0 @@
//#include "openzap.h"
#include "libteletone_detect.h"
int main(int argc, char *argv[])
{
teletone_multi_tone_t mt = {0};
teletone_tone_map_t map = {{0}};
int fd, b;
short sln[512] = {0};
if (argc < 2) {
fprintf(stderr, "Arg Error!\n");
exit(-1);
}
map.freqs[0] = atof("350");
map.freqs[1] = atof("440");
teletone_multi_tone_init(&mt, &map);
if ((fd = open(argv[1], O_RDONLY)) < 0) {
fprintf(stderr, "File Error! [%s]\n", strerror(errno));
exit(-1);
}
while((b = read(fd, sln, 320)) > 0) {
printf("TEST %d %d\n", b, teletone_multi_tone_detect(&mt, sln, b / 2));
}
close(fd);
return 0;
}

View File

@ -1,351 +0,0 @@
/*
* bell202.c
*
* Copyright (c) 2005 Robert Krten. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This module contains a Bell-202 1200-baud FSK decoder, suitable for
* use in a library. The general style of the library calls is modeled
* after the POSIX pthread_*() functions.
*
* 2005 03 20 R. Krten created
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <math.h>
#include "fsk.h"
#include "uart.h"
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
fsk_modem_definition_t fsk_modem_definitions[] =
{
{ /* FSK_V23_FORWARD_MODE1 */ 1700, 1300, 600 },
{ /* FSK_V23_FORWARD_MODE2 */ 2100, 1300, 1200 },
{ /* FSK_V23_BACKWARD */ 450, 390, 75 },
{ /* FSK_BELL202 */ 2200, 1200, 1200 },
};
/*
* dsp_fsk_attr_init
*
* Initializes the attributes structure; this must be done before the
* attributes structure is used.
*/
void dsp_fsk_attr_init (dsp_fsk_attr_t *attr)
{
memset(attr, 0, sizeof(*attr));
}
/*
* dsp_fsk_attr_get_bithandler
* dsp_fsk_attr_set_bithandler
* dsp_fsk_attr_get_bytehandler
* dsp_fsk_attr_set_bytehandler
* dsp_fsk_attr_getsamplerate
* dsp_fsk_attr_setsamplerate
*
* These functions get and set their respective elements from the
* attributes structure. If an error code is returned, it is just
* zero == ok, -1 == fail.
*/
bithandler_func_t dsp_fsk_attr_get_bithandler(dsp_fsk_attr_t *attr, void **bithandler_arg)
{
*bithandler_arg = attr->bithandler_arg;
return attr->bithandler;
}
void dsp_fsk_attr_set_bithandler(dsp_fsk_attr_t *attr, bithandler_func_t bithandler, void *bithandler_arg)
{
attr->bithandler = bithandler;
attr->bithandler_arg = bithandler_arg;
}
bytehandler_func_t dsp_fsk_attr_get_bytehandler(dsp_fsk_attr_t *attr, void **bytehandler_arg)
{
*bytehandler_arg = attr->bytehandler_arg;
return attr->bytehandler;
}
void dsp_fsk_attr_set_bytehandler(dsp_fsk_attr_t *attr, bytehandler_func_t bytehandler, void *bytehandler_arg)
{
attr->bytehandler = bytehandler;
attr->bytehandler_arg = bytehandler_arg;
}
int dsp_fsk_attr_get_samplerate (dsp_fsk_attr_t *attr)
{
return attr->sample_rate;
}
int dsp_fsk_attr_set_samplerate (dsp_fsk_attr_t *attr, int samplerate)
{
if (samplerate <= 0) {
return -1;
}
attr->sample_rate = samplerate;
return 0;
}
/*
* dsp_fsk_create
*
* Creates a handle for subsequent use. The handle is created to contain
* a context data structure for use by the sample handler function. The
* function expects an initialized attributes structure, and returns the
* handle or a NULL if there were errors.
*
* Once created, the handle can be used until it is destroyed.
*/
dsp_fsk_handle_t *dsp_fsk_create(dsp_fsk_attr_t *attr)
{
int i;
double phi_mark, phi_space;
dsp_fsk_handle_t *handle;
handle = malloc(sizeof(*handle));
if (!handle) {
return NULL;
}
memset(handle, 0, sizeof(*handle));
/* fill the attributes member */
memcpy(&handle->attr, attr, sizeof(*attr));
/* see if we can do downsampling. We only really need 6 samples to "match" */
if (attr->sample_rate / fsk_modem_definitions[FSK_BELL202].freq_mark > 6) {
handle->downsampling_count = attr->sample_rate / fsk_modem_definitions[FSK_BELL202].freq_mark / 6;
} else {
handle->downsampling_count = 1;
}
handle->current_downsample = 1;
/* calculate the correlate size (number of samples required for slowest wave) */
handle->corrsize = attr->sample_rate / handle->downsampling_count / fsk_modem_definitions[FSK_BELL202].freq_mark;
/* allocate the correlation sin/cos arrays and initialize */
for (i = 0; i < 4; i++) {
handle->correlates[i] = malloc(sizeof(double) * handle->corrsize);
if (handle->correlates[i] == NULL) {
/* some failed, back out memory allocations */
dsp_fsk_destroy(&handle);
return NULL;
}
}
/* now initialize them */
phi_mark = 2. * M_PI / ((double) attr->sample_rate / (double) handle->downsampling_count / (double) fsk_modem_definitions[FSK_BELL202].freq_mark);
phi_space = 2. * M_PI / ((double) attr->sample_rate / (double) handle->downsampling_count / (double) fsk_modem_definitions[FSK_BELL202].freq_space);
for (i = 0; i < handle->corrsize; i++) {
handle->correlates[0][i] = sin(phi_mark * (double) i);
handle->correlates[1][i] = cos(phi_mark * (double) i);
handle->correlates[2][i] = sin(phi_space * (double) i);
handle->correlates[3][i] = cos(phi_space * (double) i);
}
/* initialize the ring buffer */
handle->buffer = malloc(sizeof(double) * handle->corrsize);
if (!handle->buffer) { /* failed; back out memory allocations */
dsp_fsk_destroy(&handle);
return NULL;
}
memset(handle->buffer, 0, sizeof(double) * handle->corrsize);
handle->ringstart = 0;
/* initalize intra-cell position */
handle->cellpos = 0;
handle->celladj = fsk_modem_definitions[FSK_BELL202].baud_rate / (double) attr->sample_rate * (double) handle->downsampling_count;
/* if they have provided a byte handler, add a UART to the processing chain */
if (handle->attr.bytehandler) {
dsp_uart_attr_t uart_attr;
dsp_uart_handle_t *uart_handle;
dsp_uart_attr_init(&uart_attr);
dsp_uart_attr_set_bytehandler(&uart_attr, handle->attr.bytehandler, handle->attr.bytehandler_arg);
uart_handle = dsp_uart_create(&uart_attr);
if (uart_handle == NULL) {
dsp_fsk_destroy(&handle);
return NULL;
}
handle->attr.bithandler = dsp_uart_bit_handler;
handle->attr.bithandler_arg = uart_handle;
}
return handle;
}
/*
* dsp_fsk_destroy
*
* Destroys a handle, releasing any associated memory. Sets handle pointer to NULL
* so A destroyed handle can not be used for anything after the destroy.
*/
void dsp_fsk_destroy(dsp_fsk_handle_t **handle)
{
int i;
/* if empty handle, just return */
if (*handle == NULL) {
return;
}
for (i = 0; i < 4; i++) {
if ((*handle)->correlates[i] != NULL) {
free((*handle)->correlates[i]);
(*handle)->correlates[i] = NULL;
}
}
if ((*handle)->buffer != NULL) {
free((*handle)->buffer);
(*handle)->buffer = NULL;
}
if ((*handle)->attr.bytehandler) {
dsp_uart_handle_t** dhandle = (void *)(&(*handle)->attr.bithandler_arg);
dsp_uart_destroy(dhandle);
}
free(*handle);
*handle = NULL;
}
/*
* dsp_fsk_sample
*
* This is the main processing entry point. The function accepts a normalized
* sample (i.e., one whose range is between -1 and +1). The function performs
* the Bell-202 FSK modem decode processing, and, if it detects a valid bit,
* will call the bithandler associated with the attributes structure.
*
* For the Bell-202 standard, a logical zero (space) is 2200 Hz, and a logical
* one (mark) is 1200 Hz.
*/
void
dsp_fsk_sample (dsp_fsk_handle_t *handle, double normalized_sample)
{
double val;
double factors[4];
int i, j;
/* if we can avoid processing samples, do so */
if (handle->downsampling_count != 1) {
if (handle->current_downsample < handle->downsampling_count) {
handle->current_downsample++;
return; /* throw this sample out */
}
handle->current_downsample = 1;
}
/* store sample in buffer */
handle->buffer[handle->ringstart++] = normalized_sample;
if (handle->ringstart >= handle->corrsize) {
handle->ringstart = 0;
}
/* do the correlation calculation */
factors[0] = factors[1] = factors[2] = factors[3] = 0; /* clear out intermediate sums */
j = handle->ringstart;
for (i = 0; i < handle->corrsize; i++) {
if (j >= handle->corrsize) {
j = 0;
}
val = handle->buffer[j];
factors[0] += handle->correlates[0][i] * val;
factors[1] += handle->correlates[1][i] * val;
factors[2] += handle->correlates[2][i] * val;
factors[3] += handle->correlates[3][i] * val;
j++;
}
/* store the bit (bit value is comparison of the two sets of correlate factors) */
handle->previous_bit = handle->current_bit;
handle->current_bit = (factors[0] * factors[0] + factors[1] * factors[1] > factors[2] * factors[2] + factors[3] * factors[3]);
/* if there's a transition, we can synchronize the cell position */
if (handle->previous_bit != handle->current_bit) {
handle->cellpos = 0.5; /* adjust cell position to be in the middle of the cell */
}
handle->cellpos += handle->celladj; /* walk the cell along */
if (handle->cellpos > 1.0) {
handle->cellpos -= 1.0;
switch (handle->state) {
case FSK_STATE_DATA:
{
(*handle->attr.bithandler) (handle->attr.bithandler_arg, handle->current_bit);
}
break;
case FSK_STATE_CHANSEIZE:
{
if (handle->last_bit != handle->current_bit) {
handle->conscutive_state_bits++;
} else {
handle->conscutive_state_bits = 0;
}
if (handle->conscutive_state_bits > 15) {
handle->state = FSK_STATE_CARRIERSIG;
handle->conscutive_state_bits = 0;
}
}
break;
case FSK_STATE_CARRIERSIG:
{
if (handle->current_bit) {
handle->conscutive_state_bits++;
} else {
handle->conscutive_state_bits = 0;
}
if (handle->conscutive_state_bits > 15) {
handle->state = FSK_STATE_DATA;
handle->conscutive_state_bits = 0;
}
}
break;
}
handle->last_bit = handle->current_bit;
}
}

View File

@ -1,104 +0,0 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* g711.c - A-law and u-law transcoding routines
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2006 Steve Underwood
*
* Despite my general liking of the GPL, I place this code in the
* public domain for the benefit of all mankind - even the slimy
* ones who might try to proprietize my work and use it to my
* detriment.
*
* $Id: g711.c,v 1.1 2006/06/07 15:46:39 steveu Exp $
*/
/*! \file */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#ifndef _MSC_VER
#include <inttypes.h>
#ifdef HAVE_TGMATH_H
#include <tgmath.h>
#endif
#endif
#include "g711.h"
/* Copied from the CCITT G.711 specification */
static const uint8_t ulaw_to_alaw_table[256] =
{
42, 43, 40, 41, 46, 47, 44, 45, 34, 35, 32, 33, 38, 39, 36, 37,
58, 59, 56, 57, 62, 63, 60, 61, 50, 51, 48, 49, 54, 55, 52, 53,
10, 11, 8, 9, 14, 15, 12, 13, 2, 3, 0, 1, 6, 7, 4, 26,
27, 24, 25, 30, 31, 28, 29, 18, 19, 16, 17, 22, 23, 20, 21, 106,
104, 105, 110, 111, 108, 109, 98, 99, 96, 97, 102, 103, 100, 101, 122, 120,
126, 127, 124, 125, 114, 115, 112, 113, 118, 119, 116, 117, 75, 73, 79, 77,
66, 67, 64, 65, 70, 71, 68, 69, 90, 91, 88, 89, 94, 95, 92, 93,
82, 82, 83, 83, 80, 80, 81, 81, 86, 86, 87, 87, 84, 84, 85, 85,
170, 171, 168, 169, 174, 175, 172, 173, 162, 163, 160, 161, 166, 167, 164, 165,
186, 187, 184, 185, 190, 191, 188, 189, 178, 179, 176, 177, 182, 183, 180, 181,
138, 139, 136, 137, 142, 143, 140, 141, 130, 131, 128, 129, 134, 135, 132, 154,
155, 152, 153, 158, 159, 156, 157, 146, 147, 144, 145, 150, 151, 148, 149, 234,
232, 233, 238, 239, 236, 237, 226, 227, 224, 225, 230, 231, 228, 229, 250, 248,
254, 255, 252, 253, 242, 243, 240, 241, 246, 247, 244, 245, 203, 201, 207, 205,
194, 195, 192, 193, 198, 199, 196, 197, 218, 219, 216, 217, 222, 223, 220, 221,
210, 210, 211, 211, 208, 208, 209, 209, 214, 214, 215, 215, 212, 212, 213, 213
};
/* These transcoding tables are copied from the CCITT G.711 specification. To achieve
optimal results, do not change them. */
static const uint8_t alaw_to_ulaw_table[256] =
{
42, 43, 40, 41, 46, 47, 44, 45, 34, 35, 32, 33, 38, 39, 36, 37,
57, 58, 55, 56, 61, 62, 59, 60, 49, 50, 47, 48, 53, 54, 51, 52,
10, 11, 8, 9, 14, 15, 12, 13, 2, 3, 0, 1, 6, 7, 4, 5,
26, 27, 24, 25, 30, 31, 28, 29, 18, 19, 16, 17, 22, 23, 20, 21,
98, 99, 96, 97, 102, 103, 100, 101, 93, 93, 92, 92, 95, 95, 94, 94,
116, 118, 112, 114, 124, 126, 120, 122, 106, 107, 104, 105, 110, 111, 108, 109,
72, 73, 70, 71, 76, 77, 74, 75, 64, 65, 63, 63, 68, 69, 66, 67,
86, 87, 84, 85, 90, 91, 88, 89, 79, 79, 78, 78, 82, 83, 80, 81,
170, 171, 168, 169, 174, 175, 172, 173, 162, 163, 160, 161, 166, 167, 164, 165,
185, 186, 183, 184, 189, 190, 187, 188, 177, 178, 175, 176, 181, 182, 179, 180,
138, 139, 136, 137, 142, 143, 140, 141, 130, 131, 128, 129, 134, 135, 132, 133,
154, 155, 152, 153, 158, 159, 156, 157, 146, 147, 144, 145, 150, 151, 148, 149,
226, 227, 224, 225, 230, 231, 228, 229, 221, 221, 220, 220, 223, 223, 222, 222,
244, 246, 240, 242, 252, 254, 248, 250, 234, 235, 232, 233, 238, 239, 236, 237,
200, 201, 198, 199, 204, 205, 202, 203, 192, 193, 191, 191, 196, 197, 194, 195,
214, 215, 212, 213, 218, 219, 216, 217, 207, 207, 206, 206, 210, 211, 208, 209
};
uint8_t alaw_to_ulaw(uint8_t alaw)
{
return alaw_to_ulaw_table[alaw];
}
/*- End of function --------------------------------------------------------*/
uint8_t ulaw_to_alaw(uint8_t ulaw)
{
return ulaw_to_alaw_table[ulaw];
}
/*- End of function --------------------------------------------------------*/
/*- End of file ------------------------------------------------------------*/
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/

View File

@ -1,339 +0,0 @@
/*
* Copyright (c) 2002, Christopher Clark
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of the original author; nor the names of any contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "hashtable.h"
#include "hashtable_private.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
/*
Credit for primes table: Aaron Krowne
http://br.endernet.org/~akrowne/
http://planetmath.org/encyclopedia/GoodHashTablePrimes.html
*/
static const unsigned int primes[] = {
53, 97, 193, 389,
769, 1543, 3079, 6151,
12289, 24593, 49157, 98317,
196613, 393241, 786433, 1572869,
3145739, 6291469, 12582917, 25165843,
50331653, 100663319, 201326611, 402653189,
805306457, 1610612741
};
const unsigned int prime_table_length = sizeof(primes)/sizeof(primes[0]);
const float max_load_factor = 0.65f;
/*****************************************************************************/
OZ_DECLARE(struct hashtable *)
create_hashtable(unsigned int minsize,
unsigned int (*hashf) (void*),
int (*eqf) (void*,void*))
{
struct hashtable *h;
unsigned int pindex, size = primes[0];
/* Check requested hashtable isn't too large */
if (minsize > (1u << 30)) return NULL;
/* Enforce size as prime */
for (pindex=0; pindex < prime_table_length; pindex++) {
if (primes[pindex] > minsize) { size = primes[pindex]; break; }
}
h = (struct hashtable *)malloc(sizeof(struct hashtable));
if (NULL == h) return NULL; /*oom*/
h->table = (struct entry **)malloc(sizeof(struct entry*) * size);
if (NULL == h->table) { free(h); return NULL; } /*oom*/
memset(h->table, 0, size * sizeof(struct entry *));
h->tablelength = size;
h->primeindex = pindex;
h->entrycount = 0;
h->hashfn = hashf;
h->eqfn = eqf;
h->loadlimit = (unsigned int) ceil(size * max_load_factor);
return h;
}
/*****************************************************************************/
unsigned int
hash(struct hashtable *h, void *k)
{
/* Aim to protect against poor hash functions by adding logic here
* - logic taken from java 1.4 hashtable source */
unsigned int i = h->hashfn(k);
i += ~(i << 9);
i ^= ((i >> 14) | (i << 18)); /* >>> */
i += (i << 4);
i ^= ((i >> 10) | (i << 22)); /* >>> */
return i;
}
/*****************************************************************************/
static int
hashtable_expand(struct hashtable *h)
{
/* Double the size of the table to accomodate more entries */
struct entry **newtable;
struct entry *e;
struct entry **pE;
unsigned int newsize, i, index;
/* Check we're not hitting max capacity */
if (h->primeindex == (prime_table_length - 1)) return 0;
newsize = primes[++(h->primeindex)];
newtable = (struct entry **)malloc(sizeof(struct entry*) * newsize);
if (NULL != newtable)
{
memset(newtable, 0, newsize * sizeof(struct entry *));
/* This algorithm is not 'stable'. ie. it reverses the list
* when it transfers entries between the tables */
for (i = 0; i < h->tablelength; i++) {
while (NULL != (e = h->table[i])) {
h->table[i] = e->next;
index = indexFor(newsize,e->h);
e->next = newtable[index];
newtable[index] = e;
}
}
free(h->table);
h->table = newtable;
}
/* Plan B: realloc instead */
else
{
newtable = (struct entry **)
realloc(h->table, newsize * sizeof(struct entry *));
if (NULL == newtable) { (h->primeindex)--; return 0; }
h->table = newtable;
memset(newtable[h->tablelength], 0, newsize - h->tablelength);
for (i = 0; i < h->tablelength; i++) {
for (pE = &(newtable[i]), e = *pE; e != NULL; e = *pE) {
index = indexFor(newsize,e->h);
if (index == i)
{
pE = &(e->next);
}
else
{
*pE = e->next;
e->next = newtable[index];
newtable[index] = e;
}
}
}
}
h->tablelength = newsize;
h->loadlimit = (unsigned int) ceil(newsize * max_load_factor);
return -1;
}
/*****************************************************************************/
OZ_DECLARE(unsigned int)
hashtable_count(struct hashtable *h)
{
return h->entrycount;
}
/*****************************************************************************/
OZ_DECLARE(int)
hashtable_insert(struct hashtable *h, void *k, void *v, hashtable_flag_t flags)
{
/* This method allows duplicate keys - but they shouldn't be used */
unsigned int index;
struct entry *e;
if (++(h->entrycount) > h->loadlimit)
{
/* Ignore the return value. If expand fails, we should
* still try cramming just this value into the existing table
* -- we may not have memory for a larger table, but one more
* element may be ok. Next time we insert, we'll try expanding again.*/
hashtable_expand(h);
}
e = (struct entry *)malloc(sizeof(struct entry));
if (NULL == e) { --(h->entrycount); return 0; } /*oom*/
e->h = hash(h,k);
index = indexFor(h->tablelength,e->h);
e->k = k;
e->v = v;
e->flags = flags;
e->next = h->table[index];
h->table[index] = e;
return -1;
}
/*****************************************************************************/
OZ_DECLARE(void *) /* returns value associated with key */
hashtable_search(struct hashtable *h, void *k)
{
struct entry *e;
unsigned int hashvalue, index;
hashvalue = hash(h,k);
index = indexFor(h->tablelength,hashvalue);
e = h->table[index];
while (NULL != e)
{
/* Check hash value to short circuit heavier comparison */
if ((hashvalue == e->h) && (h->eqfn(k, e->k))) return e->v;
e = e->next;
}
return NULL;
}
/*****************************************************************************/
OZ_DECLARE(void *) /* returns value associated with key */
hashtable_remove(struct hashtable *h, void *k)
{
/* TODO: consider compacting the table when the load factor drops enough,
* or provide a 'compact' method. */
struct entry *e;
struct entry **pE;
void *v;
unsigned int hashvalue, index;
hashvalue = hash(h,k);
index = indexFor(h->tablelength,hash(h,k));
pE = &(h->table[index]);
e = *pE;
while (NULL != e)
{
/* Check hash value to short circuit heavier comparison */
if ((hashvalue == e->h) && (h->eqfn(k, e->k)))
{
*pE = e->next;
h->entrycount--;
v = e->v;
if (e->flags & HASHTABLE_FLAG_FREE_KEY) {
freekey(e->k);
}
free(e);
return v;
}
pE = &(e->next);
e = e->next;
}
return NULL;
}
/*****************************************************************************/
/* destroy */
OZ_DECLARE(void)
hashtable_destroy(struct hashtable *h)
{
unsigned int i;
struct entry *e, *f;
struct entry **table = h->table;
for (i = 0; i < h->tablelength; i++)
{
e = table[i];
while (NULL != e)
{ f = e; e = e->next; if (f->flags & HASHTABLE_FLAG_FREE_KEY) freekey(f->k); if (f->flags & HASHTABLE_FLAG_FREE_VALUE) free(f->v); free(f); }
}
free(h->table);
free(h);
}
OZ_DECLARE(struct hashtable_iterator *) hashtable_next(struct hashtable_iterator *i)
{
if (i->e) {
if ((i->e = i->e->next) != 0) {
return i;
} else {
i->pos++;
}
}
while(i->pos < i->h->tablelength && !i->h->table[i->pos]) {
i->pos++;
}
if (i->pos >= i->h->tablelength) {
return NULL;
}
if ((i->e = i->h->table[i->pos]) != 0) {
return i;
}
return NULL;
}
OZ_DECLARE(struct hashtable_iterator *) hashtable_first(struct hashtable *h)
{
h->iterator.pos = 0;
h->iterator.e = NULL;
h->iterator.h = h;
return hashtable_next(&h->iterator);
}
OZ_DECLARE(void) hashtable_this(struct hashtable_iterator *i, const void **key, int *klen, void **val)
{
if (i->e) {
if (key) {
*key = i->e->k;
}
if (klen) {
*klen = (int)strlen(i->e->k);
}
if (val) {
*val = i->e->v;
}
} else {
if (key) {
*key = NULL;
}
if (klen) {
*klen = 0;
}
if (val) {
*val = NULL;
}
}
}
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/

View File

@ -1,186 +0,0 @@
/*
* Copyright (c) 2002, 2004, Christopher Clark
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of the original author; nor the names of any contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "hashtable.h"
#include "hashtable_private.h"
#include "hashtable_itr.h"
#include <stdlib.h> /* defines NULL */
/*****************************************************************************/
/* hashtable_iterator - iterator constructor */
struct hashtable_itr *
hashtable_iterator(struct hashtable *h)
{
unsigned int i, tablelength;
struct hashtable_itr *itr = (struct hashtable_itr *)
malloc(sizeof(struct hashtable_itr));
if (NULL == itr) return NULL;
itr->h = h;
itr->e = NULL;
itr->parent = NULL;
tablelength = h->tablelength;
itr->index = tablelength;
if (0 == h->entrycount) return itr;
for (i = 0; i < tablelength; i++)
{
if (NULL != h->table[i])
{
itr->e = h->table[i];
itr->index = i;
break;
}
}
return itr;
}
/*****************************************************************************/
/* advance - advance the iterator to the next element
* returns zero if advanced to end of table */
int
hashtable_iterator_advance(struct hashtable_itr *itr)
{
unsigned int j,tablelength;
struct entry **table;
struct entry *next;
if (NULL == itr->e) return 0; /* stupidity check */
next = itr->e->next;
if (NULL != next)
{
itr->parent = itr->e;
itr->e = next;
return -1;
}
tablelength = itr->h->tablelength;
itr->parent = NULL;
if (tablelength <= (j = ++(itr->index)))
{
itr->e = NULL;
return 0;
}
table = itr->h->table;
while (NULL == (next = table[j]))
{
if (++j >= tablelength)
{
itr->index = tablelength;
itr->e = NULL;
return 0;
}
}
itr->index = j;
itr->e = next;
return -1;
}
/*****************************************************************************/
/* remove - remove the entry at the current iterator position
* and advance the iterator, if there is a successive
* element.
* If you want the value, read it before you remove:
* beware memory leaks if you don't.
* Returns zero if end of iteration. */
int
hashtable_iterator_remove(struct hashtable_itr *itr)
{
struct entry *remember_e, *remember_parent;
int ret;
/* Do the removal */
if (NULL == (itr->parent))
{
/* element is head of a chain */
itr->h->table[itr->index] = itr->e->next;
} else {
/* element is mid-chain */
itr->parent->next = itr->e->next;
}
/* itr->e is now outside the hashtable */
remember_e = itr->e;
itr->h->entrycount--;
freekey(remember_e->k);
/* Advance the iterator, correcting the parent */
remember_parent = itr->parent;
ret = hashtable_iterator_advance(itr);
if (itr->parent == remember_e) { itr->parent = remember_parent; }
free(remember_e);
return ret;
}
/*****************************************************************************/
int /* returns zero if not found */
hashtable_iterator_search(struct hashtable_itr *itr,
struct hashtable *h, void *k)
{
struct entry *e, *parent;
unsigned int hashvalue, index;
hashvalue = hash(h,k);
index = indexFor(h->tablelength,hashvalue);
e = h->table[index];
parent = NULL;
while (NULL != e)
{
/* Check hash value to short circuit heavier comparison */
if ((hashvalue == e->h) && (h->eqfn(k, e->k)))
{
itr->index = index;
itr->e = e;
itr->parent = parent;
itr->h = h;
return -1;
}
parent = e;
e = e->next;
}
return 0;
}
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/

View File

@ -1,113 +0,0 @@
/*
* bell202.h
*
* Copyright (c) 2005 Robert Krten. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This module contains the manifest constants and declarations for
* the Bell-202 1200 baud FSK modem.
*
* 2005 03 20 R. Krten created
*/
#ifndef __FSK_H__
#define __FSK_H__
#include "uart.h"
typedef struct {
int freq_space; /* Frequency of the 0 bit */
int freq_mark; /* Frequency of the 1 bit */
int baud_rate; /* baud rate for the modem */
} fsk_modem_definition_t;
/* Must be kept in sync with fsk_modem_definitions array in fsk.c */
/* V.23 definitions: http://www.itu.int/rec/recommendation.asp?type=folders&lang=e&parent=T-REC-V.23 */
typedef enum {
FSK_V23_FORWARD_MODE1 = 0, /* Maximum 600 bps for long haul */
FSK_V23_FORWARD_MODE2, /* Standard 1200 bps V.23 */
FSK_V23_BACKWARD, /* 75 bps return path for V.23 */
FSK_BELL202 /* Bell 202 half-duplex 1200 bps */
} fsk_modem_types_t;
typedef enum {
FSK_STATE_CHANSEIZE = 0,
FSK_STATE_CARRIERSIG,
FSK_STATE_DATA
} fsk_state_t;
typedef struct dsp_fsk_attr_s
{
int sample_rate; /* sample rate in HZ */
bithandler_func_t bithandler; /* bit handler */
void *bithandler_arg; /* arbitrary ID passed to bithandler as first argument */
bytehandler_func_t bytehandler; /* byte handler */
void *bytehandler_arg; /* arbitrary ID passed to bytehandler as first argument */
} dsp_fsk_attr_t;
typedef struct
{
fsk_state_t state;
dsp_fsk_attr_t attr; /* attributes structure */
double *correlates[4]; /* one for each of sin/cos for mark/space */
int corrsize; /* correlate size (also number of samples in ring buffer) */
double *buffer; /* sample ring buffer */
int ringstart; /* ring buffer start offset */
double cellpos; /* bit cell position */
double celladj; /* bit cell adjustment for each sample */
int previous_bit; /* previous bit (for detecting a transition to sync-up cell position) */
int current_bit; /* current bit */
int last_bit;
int downsampling_count; /* number of samples to skip */
int current_downsample; /* current skip count */
int conscutive_state_bits; /* number of bits in a row that matches the pattern for the current state */
} dsp_fsk_handle_t;
/*
* Function prototypes
*
* General calling order is:
* a) create the attributes structure (dsp_fsk_attr_init)
* b) initialize fields in the attributes structure (dsp_fsk_attr_set_*)
* c) create a Bell-202 handle (dsp_fsk_create)
* d) feed samples through the handler (dsp_fsk_sample)
*/
void dsp_fsk_attr_init(dsp_fsk_attr_t *attributes);
bithandler_func_t dsp_fsk_attr_get_bithandler(dsp_fsk_attr_t *attributes, void **bithandler_arg);
void dsp_fsk_attr_set_bithandler(dsp_fsk_attr_t *attributes, bithandler_func_t bithandler, void *bithandler_arg);
bytehandler_func_t dsp_fsk_attr_get_bytehandler(dsp_fsk_attr_t *attributes, void **bytehandler_arg);
void dsp_fsk_attr_set_bytehandler(dsp_fsk_attr_t *attributes, bytehandler_func_t bytehandler, void *bytehandler_arg);
int dsp_fsk_attr_get_samplerate(dsp_fsk_attr_t *attributes);
int dsp_fsk_attr_set_samplerate(dsp_fsk_attr_t *attributes, int samplerate);
dsp_fsk_handle_t * dsp_fsk_create(dsp_fsk_attr_t *attributes);
void dsp_fsk_destroy(dsp_fsk_handle_t **handle);
void dsp_fsk_sample(dsp_fsk_handle_t *handle, double normalized_sample);
extern fsk_modem_definition_t fsk_modem_definitions[];
#endif

View File

@ -1,395 +0,0 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* g711.h - In line A-law and u-law conversion routines
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2001 Steve Underwood
*
* Despite my general liking of the GPL, I place this code in the
* public domain for the benefit of all mankind - even the slimy
* ones who might try to proprietize my work and use it to my
* detriment.
*
* $Id: g711.h,v 1.1 2006/06/07 15:46:39 steveu Exp $
*/
/*! \file */
/*! \page g711_page A-law and mu-law handling
Lookup tables for A-law and u-law look attractive, until you consider the impact
on the CPU cache. If it causes a substantial area of your processor cache to get
hit too often, cache sloshing will severely slow things down. The main reason
these routines are slow in C, is the lack of direct access to the CPU's "find
the first 1" instruction. A little in-line assembler fixes that, and the
conversion routines can be faster than lookup tables, in most real world usage.
A "find the first 1" instruction is available on most modern CPUs, and is a
much underused feature.
If an assembly language method of bit searching is not available, these routines
revert to a method that can be a little slow, so the cache thrashing might not
seem so bad :(
Feel free to submit patches to add fast "find the first 1" support for your own
favourite processor.
Look up tables are used for transcoding between A-law and u-law, since it is
difficult to achieve the precise transcoding procedure laid down in the G.711
specification by other means.
*/
#if !defined(_G711_H_)
#define _G711_H_
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _MSC_VER
#ifndef __inline__
#define __inline__ __inline
#endif
typedef unsigned __int8 uint8_t;
typedef __int16 int16_t;
typedef __int32 int32_t;
typedef unsigned __int16 uint16_t;
#else
#include <stdint.h>
#endif
#if defined(__i386__)
/*! \brief Find the bit position of the highest set bit in a word
\param bits The word to be searched
\return The bit number of the highest set bit, or -1 if the word is zero. */
static __inline__ int top_bit(unsigned int bits)
{
int res;
__asm__ __volatile__(" movl $-1,%%edx;\n"
" bsrl %%eax,%%edx;\n"
: "=d" (res)
: "a" (bits));
return res;
}
/*- End of function --------------------------------------------------------*/
/*! \brief Find the bit position of the lowest set bit in a word
\param bits The word to be searched
\return The bit number of the lowest set bit, or -1 if the word is zero. */
static __inline__ int bottom_bit(unsigned int bits)
{
int res;
__asm__ __volatile__(" movl $-1,%%edx;\n"
" bsfl %%eax,%%edx;\n"
: "=d" (res)
: "a" (bits));
return res;
}
/*- End of function --------------------------------------------------------*/
#elif defined(__x86_64__)
static __inline__ int top_bit(unsigned int bits)
{
int res;
__asm__ __volatile__(" movq $-1,%%rdx;\n"
" bsrq %%rax,%%rdx;\n"
: "=d" (res)
: "a" (bits));
return res;
}
/*- End of function --------------------------------------------------------*/
static __inline__ int bottom_bit(unsigned int bits)
{
int res;
__asm__ __volatile__(" movq $-1,%%rdx;\n"
" bsfq %%rax,%%rdx;\n"
: "=d" (res)
: "a" (bits));
return res;
}
/*- End of function --------------------------------------------------------*/
#else
static __inline__ int top_bit(unsigned int bits)
{
int i;
if (bits == 0)
return -1;
i = 0;
if (bits & 0xFFFF0000)
{
bits &= 0xFFFF0000;
i += 16;
}
if (bits & 0xFF00FF00)
{
bits &= 0xFF00FF00;
i += 8;
}
if (bits & 0xF0F0F0F0)
{
bits &= 0xF0F0F0F0;
i += 4;
}
if (bits & 0xCCCCCCCC)
{
bits &= 0xCCCCCCCC;
i += 2;
}
if (bits & 0xAAAAAAAA)
{
bits &= 0xAAAAAAAA;
i += 1;
}
return i;
}
/*- End of function --------------------------------------------------------*/
static __inline__ int bottom_bit(unsigned int bits)
{
int i;
if (bits == 0)
return -1;
i = 32;
if (bits & 0x0000FFFF)
{
bits &= 0x0000FFFF;
i -= 16;
}
if (bits & 0x00FF00FF)
{
bits &= 0x00FF00FF;
i -= 8;
}
if (bits & 0x0F0F0F0F)
{
bits &= 0x0F0F0F0F;
i -= 4;
}
if (bits & 0x33333333)
{
bits &= 0x33333333;
i -= 2;
}
if (bits & 0x55555555)
{
bits &= 0x55555555;
i -= 1;
}
return i;
}
/*- End of function --------------------------------------------------------*/
#endif
/* N.B. It is tempting to use look-up tables for A-law and u-law conversion.
* However, you should consider the cache footprint.
*
* A 64K byte table for linear to x-law and a 512 byte table for x-law to
* linear sound like peanuts these days, and shouldn't an array lookup be
* real fast? No! When the cache sloshes as badly as this one will, a tight
* calculation may be better. The messiest part is normally finding the
* segment, but a little inline assembly can fix that on an i386, x86_64 and
* many other modern processors.
*/
/*
* Mu-law is basically as follows:
*
* Biased Linear Input Code Compressed Code
* ------------------------ ---------------
* 00000001wxyza 000wxyz
* 0000001wxyzab 001wxyz
* 000001wxyzabc 010wxyz
* 00001wxyzabcd 011wxyz
* 0001wxyzabcde 100wxyz
* 001wxyzabcdef 101wxyz
* 01wxyzabcdefg 110wxyz
* 1wxyzabcdefgh 111wxyz
*
* Each biased linear code has a leading 1 which identifies the segment
* number. The value of the segment number is equal to 7 minus the number
* of leading 0's. The quantization interval is directly available as the
* four bits wxyz. * The trailing bits (a - h) are ignored.
*
* Ordinarily the complement of the resulting code word is used for
* transmission, and so the code word is complemented before it is returned.
*
* For further information see John C. Bellamy's Digital Telephony, 1982,
* John Wiley & Sons, pps 98-111 and 472-476.
*/
/*#define ULAW_ZEROTRAP*/ /* turn on the trap as per the MIL-STD */
#define ULAW_BIAS 0x84 /* Bias for linear code. */
/*! \brief Encode a linear sample to u-law
\param linear The sample to encode.
\return The u-law value.
*/
static __inline__ uint8_t linear_to_ulaw(int linear)
{
uint8_t u_val;
int mask;
int seg;
/* Get the sign and the magnitude of the value. */
if (linear < 0)
{
linear = ULAW_BIAS - linear;
mask = 0x7F;
}
else
{
linear = ULAW_BIAS + linear;
mask = 0xFF;
}
seg = top_bit(linear | 0xFF) - 7;
/*
* Combine the sign, segment, quantization bits,
* and complement the code word.
*/
if (seg >= 8)
u_val = (uint8_t) (0x7F ^ mask);
else
u_val = (uint8_t) (((seg << 4) | ((linear >> (seg + 3)) & 0xF)) ^ mask);
#ifdef ULAW_ZEROTRAP
/* Optional ITU trap */
if (u_val == 0)
u_val = 0x02;
#endif
return u_val;
}
/*- End of function --------------------------------------------------------*/
/*! \brief Decode an u-law sample to a linear value.
\param ulaw The u-law sample to decode.
\return The linear value.
*/
static __inline__ int16_t ulaw_to_linear(uint8_t ulaw)
{
int t;
/* Complement to obtain normal u-law value. */
ulaw = ~ulaw;
/*
* Extract and bias the quantization bits. Then
* shift up by the segment number and subtract out the bias.
*/
t = (((ulaw & 0x0F) << 3) + ULAW_BIAS) << (((int) ulaw & 0x70) >> 4);
return (int16_t) ((ulaw & 0x80) ? (ULAW_BIAS - t) : (t - ULAW_BIAS));
}
/*- End of function --------------------------------------------------------*/
/*
* A-law is basically as follows:
*
* Linear Input Code Compressed Code
* ----------------- ---------------
* 0000000wxyza 000wxyz
* 0000001wxyza 001wxyz
* 000001wxyzab 010wxyz
* 00001wxyzabc 011wxyz
* 0001wxyzabcd 100wxyz
* 001wxyzabcde 101wxyz
* 01wxyzabcdef 110wxyz
* 1wxyzabcdefg 111wxyz
*
* For further information see John C. Bellamy's Digital Telephony, 1982,
* John Wiley & Sons, pps 98-111 and 472-476.
*/
#define ALAW_AMI_MASK 0x55
/*! \brief Encode a linear sample to A-law
\param linear The sample to encode.
\return The A-law value.
*/
static __inline__ uint8_t linear_to_alaw(int linear)
{
int mask;
int seg;
if (linear >= 0)
{
/* Sign (bit 7) bit = 1 */
mask = ALAW_AMI_MASK | 0x80;
}
else
{
/* Sign (bit 7) bit = 0 */
mask = ALAW_AMI_MASK;
linear = -linear - 8;
}
/* Convert the scaled magnitude to segment number. */
seg = top_bit(linear | 0xFF) - 7;
if (seg >= 8)
{
if (linear >= 0)
{
/* Out of range. Return maximum value. */
return (uint8_t) (0x7F ^ mask);
}
/* We must be just a tiny step below zero */
return (uint8_t) (0x00 ^ mask);
}
/* Combine the sign, segment, and quantization bits. */
return (uint8_t) (((seg << 4) | ((linear >> ((seg) ? (seg + 3) : 4)) & 0x0F)) ^ mask);
}
/*- End of function --------------------------------------------------------*/
/*! \brief Decode an A-law sample to a linear value.
\param alaw The A-law sample to decode.
\return The linear value.
*/
static __inline__ int16_t alaw_to_linear(uint8_t alaw)
{
int i;
int seg;
alaw ^= ALAW_AMI_MASK;
i = ((alaw & 0x0F) << 4);
seg = (((int) alaw & 0x70) >> 4);
if (seg)
i = (i + 0x108) << (seg - 1);
else
i += 8;
return (int16_t) ((alaw & 0x80) ? i : -i);
}
/*- End of function --------------------------------------------------------*/
/*! \brief Transcode from A-law to u-law, using the procedure defined in G.711.
\param alaw The A-law sample to transcode.
\return The best matching u-law value.
*/
uint8_t alaw_to_ulaw(uint8_t alaw);
/*! \brief Transcode from u-law to A-law, using the procedure defined in G.711.
\param alaw The u-law sample to transcode.
\return The best matching A-law value.
*/
uint8_t ulaw_to_alaw(uint8_t ulaw);
#ifdef __cplusplus
}
#endif
#endif
/*- End of file ------------------------------------------------------------*/
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/

View File

@ -1,228 +0,0 @@
/* Copyright (C) 2002 Christopher Clark <firstname.lastname@cl.cam.ac.uk> */
#ifndef __HASHTABLE_CWC22_H__
#define __HASHTABLE_CWC22_H__
#ifdef _MSC_VER
#ifndef __inline__
#define __inline__ __inline
#endif
#endif
#include "openzap.h"
struct hashtable;
struct hashtable_iterator;
/* Example of use:
*
* struct hashtable *h;
* struct some_key *k;
* struct some_value *v;
*
* static unsigned int hash_from_key_fn( void *k );
* static int keys_equal_fn ( void *key1, void *key2 );
*
* h = create_hashtable(16, hash_from_key_fn, keys_equal_fn);
* k = (struct some_key *) malloc(sizeof(struct some_key));
* v = (struct some_value *) malloc(sizeof(struct some_value));
*
* (initialise k and v to suitable values)
*
* if (! hashtable_insert(h,k,v) )
* { exit(-1); }
*
* if (NULL == (found = hashtable_search(h,k) ))
* { printf("not found!"); }
*
* if (NULL == (found = hashtable_remove(h,k) ))
* { printf("Not found\n"); }
*
*/
/* Macros may be used to define type-safe(r) hashtable access functions, with
* methods specialized to take known key and value types as parameters.
*
* Example:
*
* Insert this at the start of your file:
*
* DEFINE_HASHTABLE_INSERT(insert_some, struct some_key, struct some_value);
* DEFINE_HASHTABLE_SEARCH(search_some, struct some_key, struct some_value);
* DEFINE_HASHTABLE_REMOVE(remove_some, struct some_key, struct some_value);
*
* This defines the functions 'insert_some', 'search_some' and 'remove_some'.
* These operate just like hashtable_insert etc., with the same parameters,
* but their function signatures have 'struct some_key *' rather than
* 'void *', and hence can generate compile time errors if your program is
* supplying incorrect data as a key (and similarly for value).
*
* Note that the hash and key equality functions passed to create_hashtable
* still take 'void *' parameters instead of 'some key *'. This shouldn't be
* a difficult issue as they're only defined and passed once, and the other
* functions will ensure that only valid keys are supplied to them.
*
* The cost for this checking is increased code size and runtime overhead
* - if performance is important, it may be worth switching back to the
* unsafe methods once your program has been debugged with the safe methods.
* This just requires switching to some simple alternative defines - eg:
* #define insert_some hashtable_insert
*
*/
/*****************************************************************************
* create_hashtable
* @name create_hashtable
* @param minsize minimum initial size of hashtable
* @param hashfunction function for hashing keys
* @param key_eq_fn function for determining key equality
* @return newly created hashtable or NULL on failure
*/
OZ_DECLARE(struct hashtable *)
create_hashtable(unsigned int minsize,
unsigned int (*hashfunction) (void*),
int (*key_eq_fn) (void*,void*));
/*****************************************************************************
* hashtable_insert
* @name hashtable_insert
* @param h the hashtable to insert into
* @param k the key - hashtable claims ownership and will free on removal
* @param v the value - does not claim ownership
* @return non-zero for successful insertion
*
* This function will cause the table to expand if the insertion would take
* the ratio of entries to table size over the maximum load factor.
*
* This function does not check for repeated insertions with a duplicate key.
* The value returned when using a duplicate key is undefined -- when
* the hashtable changes size, the order of retrieval of duplicate key
* entries is reversed.
* If in doubt, remove before insert.
*/
typedef enum {
HASHTABLE_FLAG_NONE = 0,
HASHTABLE_FLAG_FREE_KEY = (1 << 0),
HASHTABLE_FLAG_FREE_VALUE = (1 << 1)
} hashtable_flag_t;
OZ_DECLARE(int)
hashtable_insert(struct hashtable *h, void *k, void *v, hashtable_flag_t flags);
#define DEFINE_HASHTABLE_INSERT(fnname, keytype, valuetype) \
int fnname (struct hashtable *h, keytype *k, valuetype *v) \
{ \
return hashtable_insert(h,k,v); \
}
/*****************************************************************************
* hashtable_search
* @name hashtable_search
* @param h the hashtable to search
* @param k the key to search for - does not claim ownership
* @return the value associated with the key, or NULL if none found
*/
OZ_DECLARE(void *)
hashtable_search(struct hashtable *h, void *k);
#define DEFINE_HASHTABLE_SEARCH(fnname, keytype, valuetype) \
valuetype * fnname (struct hashtable *h, keytype *k) \
{ \
return (valuetype *) (hashtable_search(h,k)); \
}
/*****************************************************************************
* hashtable_remove
* @name hashtable_remove
* @param h the hashtable to remove the item from
* @param k the key to search for - does not claim ownership
* @return the value associated with the key, or NULL if none found
*/
OZ_DECLARE(void *) /* returns value */
hashtable_remove(struct hashtable *h, void *k);
#define DEFINE_HASHTABLE_REMOVE(fnname, keytype, valuetype) \
valuetype * fnname (struct hashtable *h, keytype *k) \
{ \
return (valuetype *) (hashtable_remove(h,k)); \
}
/*****************************************************************************
* hashtable_count
* @name hashtable_count
* @param h the hashtable
* @return the number of items stored in the hashtable
*/
OZ_DECLARE(unsigned int)
hashtable_count(struct hashtable *h);
/*****************************************************************************
* hashtable_destroy
* @name hashtable_destroy
* @param h the hashtable
* @param free_values whether to call 'free' on the remaining values
*/
OZ_DECLARE(void)
hashtable_destroy(struct hashtable *h);
OZ_DECLARE(struct hashtable_iterator*) hashtable_first(struct hashtable *h);
OZ_DECLARE(struct hashtable_iterator*) hashtable_next(struct hashtable_iterator *i);
OZ_DECLARE(void) hashtable_this(struct hashtable_iterator *i, const void **key, int *klen, void **val);
#endif /* __HASHTABLE_CWC22_H__ */
/*
* Copyright (c) 2002, Christopher Clark
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of the original author; nor the names of any contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/

View File

@ -1,129 +0,0 @@
/* Copyright (C) 2002, 2004 Christopher Clark <firstname.lastname@cl.cam.ac.uk> */
#ifndef __HASHTABLE_ITR_CWC22__
#define __HASHTABLE_ITR_CWC22__
#include "hashtable.h"
#include "hashtable_private.h" /* needed to enable inlining */
/*****************************************************************************/
/* This struct is only concrete here to allow the inlining of two of the
* accessor functions. */
struct hashtable_itr
{
struct hashtable *h;
struct entry *e;
struct entry *parent;
unsigned int index;
};
/*****************************************************************************/
/* hashtable_iterator
*/
struct hashtable_itr *
hashtable_iterator(struct hashtable *h);
/*****************************************************************************/
/* hashtable_iterator_key
* - return the value of the (key,value) pair at the current position */
extern __inline__ void *
hashtable_iterator_key(struct hashtable_itr *i);
extern __inline__ void *
hashtable_iterator_key(struct hashtable_itr *i)
{
return i->e->k;
}
/*****************************************************************************/
/* value - return the value of the (key,value) pair at the current position */
extern __inline__ void *
hashtable_iterator_value(struct hashtable_itr *i);
extern __inline__ void *
hashtable_iterator_value(struct hashtable_itr *i)
{
return i->e->v;
}
/*****************************************************************************/
/* advance - advance the iterator to the next element
* returns zero if advanced to end of table */
int
hashtable_iterator_advance(struct hashtable_itr *itr);
/*****************************************************************************/
/* remove - remove current element and advance the iterator to the next element
* NB: if you need the value to free it, read it before
* removing. ie: beware memory leaks!
* returns zero if advanced to end of table */
int
hashtable_iterator_remove(struct hashtable_itr *itr);
/*****************************************************************************/
/* search - overwrite the supplied iterator, to point to the entry
* matching the supplied key.
h points to the hashtable to be searched.
* returns zero if not found. */
int
hashtable_iterator_search(struct hashtable_itr *itr,
struct hashtable *h, void *k);
#define DEFINE_HASHTABLE_ITERATOR_SEARCH(fnname, keytype) \
int fnname (struct hashtable_itr *i, struct hashtable *h, keytype *k) \
{ \
return (hashtable_iterator_search(i,h,k)); \
}
#endif /* __HASHTABLE_ITR_CWC22__*/
/*
* Copyright (c) 2002, 2004, Christopher Clark
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of the original author; nor the names of any contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/

View File

@ -1,105 +0,0 @@
/* Copyright (C) 2002, 2004 Christopher Clark <firstname.lastname@cl.cam.ac.uk> */
#ifndef __HASHTABLE_PRIVATE_CWC22_H__
#define __HASHTABLE_PRIVATE_CWC22_H__
#include "hashtable.h"
/*****************************************************************************/
struct entry
{
void *k, *v;
unsigned int h;
hashtable_flag_t flags;
struct entry *next;
};
struct hashtable_iterator {
unsigned int pos;
struct entry *e;
struct hashtable *h;
};
struct hashtable {
unsigned int tablelength;
struct entry **table;
unsigned int entrycount;
unsigned int loadlimit;
unsigned int primeindex;
unsigned int (*hashfn) (void *k);
int (*eqfn) (void *k1, void *k2);
struct hashtable_iterator iterator;
};
/*****************************************************************************/
unsigned int
hash(struct hashtable *h, void *k);
/*****************************************************************************/
/* indexFor */
static __inline__ unsigned int
indexFor(unsigned int tablelength, unsigned int hashvalue) {
return (hashvalue % tablelength);
}
/* Only works if tablelength == 2^N */
/*static inline unsigned int
indexFor(unsigned int tablelength, unsigned int hashvalue)
{
return (hashvalue & (tablelength - 1u));
}
*/
/*****************************************************************************/
#define freekey(X) free(X)
/*define freekey(X) ; */
/*****************************************************************************/
#endif /* __HASHTABLE_PRIVATE_CWC22_H__*/
/*
* Copyright (c) 2002, Christopher Clark
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of the original author; nor the names of any contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/

View File

@ -1,161 +0,0 @@
/*
* libteletone
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is libteletone
*
* The Initial Developer of the Original Code is
* Anthony Minessale II <anthm@freeswitch.org>
* Portions created by the Initial Developer are Copyright (C)
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Anthony Minessale II <anthm@freeswitch.org>
*
*
* libteletone.h -- Tone Generator/Detector
*
*
*
* Exception:
* The author hereby grants the use of this source code under the
* following license if and only if the source code is distributed
* as part of the openzap library. Any use or distribution of this
* source code outside the scope of the openzap library will nullify the
* following license and reinact the MPL 1.1 as stated above.
*
* Copyright (c) 2005-2014, Anthony Minessale II
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of the original author; nor the names of any contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef LIBTELETONE_H
#define LIBTELETONE_H
#ifdef __cplusplus
extern "C" {
#endif
#include <math.h>
#define TELETONE_MAX_DTMF_DIGITS 128
#define TELETONE_MAX_TONES 18
#define TELETONE_TONE_RANGE 127
typedef double teletone_process_t;
/*! \file libteletone.h
\brief Top level include file
This file should be included by applications using the library
*/
/*! \brief An abstraction to store a tone mapping */
typedef struct {
/*! An array of tone frequencies */
teletone_process_t freqs[TELETONE_MAX_TONES];
} teletone_tone_map_t;
#if !defined(M_PI)
/* C99 systems may not define M_PI */
#define M_PI 3.14159265358979323846264338327
#endif
#ifdef _MSC_VER
typedef __int16 int16_t;
#endif
#if (_MSC_VER >= 1400) // VC8+
#define teletone_assert(expr) assert(expr);__analysis_assume( expr )
#else
#define teletone_assert(expr) assert(expr)
#endif
#ifdef _MSC_VER
#if defined(TT_DECLARE_STATIC)
#define TELETONE_API(type) type __stdcall
#define TELETONE_API_NONSTD(type) type __cdecl
#define TELETONE_API_DATA
#elif defined(TELETONE_EXPORTS)
#define TELETONE_API(type) __declspec(dllexport) type __stdcall
#define TELETONE_API_NONSTD(type) __declspec(dllexport) type __cdecl
#define TELETONE_API_DATA __declspec(dllexport)
#else
#define TELETONE_API(type) __declspec(dllimport) type __stdcall
#define TELETONE_API_NONSTD(type) __declspec(dllimport) type __cdecl
#define TELETONE_API_DATA __declspec(dllimport)
#endif
#else
#if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined (__SUNPRO_C)) && defined(HAVE_VISIBILITY)
#define TELETONE_API(type) __attribute__((visibility("default"))) type
#define TELETONE_API_NONSTD(type) __attribute__((visibility("default"))) type
#define TELETONE_API_DATA __attribute__((visibility("default")))
#else
#define TELETONE_API(type) type
#define TELETONE_API_NONSTD(type) type
#define TELETONE_API_DATA
#endif
#endif
#include <libteletone_generate.h>
#include <libteletone_detect.h>
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#ifdef __cplusplus
}
#endif
#endif
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/

View File

@ -1,240 +0,0 @@
/*
* libteletone
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
* libteletone_detect.c Tone Detection Code
*
* Exception:
* The author hereby grants the use of this source code under the
* following license if and only if the source code is distributed
* as part of the openzap library. Any use or distribution of this
* source code outside the scope of the openzap library will nullify the
* following license and reinact the MPL 1.1 as stated above.
*
* Copyright (c) 2007, Anthony Minessale II
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of the original author; nor the names of any contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*********************************************************************************
*
* Derived from tone_detect.h - General telephony tone detection, and specific
* detection of DTMF.
*
* Copyright (C) 2001 Steve Underwood <steveu@coppice.org>
*
* Despite my general liking of the GPL, I place this code in the
* public domain for the benefit of all mankind - even the slimy
* ones who might try to proprietize my work and use it to my
* detriment.
*
*
*/
#ifndef LIBTELETONE_DETECT_H
#define LIBTELETONE_DETECT_H
#ifdef __cplusplus
extern "C" {
#endif
#include <libteletone.h>
/*! \file libteletone_detect.h
\brief Tone Detection Routines
This module is responsible for tone detection specifics
*/
#ifndef FALSE
#define FALSE 0
#ifndef TRUE
#define TRUE (!FALSE)
#endif
#endif
/* Basic DTMF specs:
*
* Minimum tone on = 40ms
* Minimum tone off = 50ms
* Maximum digit rate = 10 per second
* Normal twist <= 8dB accepted
* Reverse twist <= 4dB accepted
* S/N >= 15dB will detect OK
* Attenuation <= 26dB will detect OK
* Frequency tolerance +- 1.5% will detect, +-3.5% will reject
*/
#define DTMF_THRESHOLD 8.0e7
#define DTMF_NORMAL_TWIST 6.3 /* 8dB */
#define DTMF_REVERSE_TWIST 2.5 /* 4dB */
#define DTMF_RELATIVE_PEAK_ROW 6.3 /* 8dB */
#define DTMF_RELATIVE_PEAK_COL 6.3 /* 8dB */
#define DTMF_2ND_HARMONIC_ROW 2.5 /* 4dB */
#define DTMF_2ND_HARMONIC_COL 63.1 /* 18dB */
#define GRID_FACTOR 4
#define BLOCK_LEN 102
#define M_TWO_PI 2.0*M_PI
/*! \brief A continer for the elements of a Goertzel Algorithm (The names are from his formula) */
typedef struct {
float v2;
float v3;
double fac;
} teletone_goertzel_state_t;
/*! \brief A container for a DTMF detection state.*/
typedef struct {
int hit1;
int hit2;
int hit3;
int hit4;
int mhit;
teletone_goertzel_state_t row_out[GRID_FACTOR];
teletone_goertzel_state_t col_out[GRID_FACTOR];
teletone_goertzel_state_t row_out2nd[GRID_FACTOR];
teletone_goertzel_state_t col_out2nd[GRID_FACTOR];
float energy;
int current_sample;
char digits[TELETONE_MAX_DTMF_DIGITS + 1];
int current_digits;
int detected_digits;
int lost_digits;
int digit_hits[16];
} teletone_dtmf_detect_state_t;
/*! \brief An abstraction to store the coefficient of a tone frequency */
typedef struct {
float fac;
} teletone_detection_descriptor_t;
/*! \brief A container for a single multi-tone detection
TELETONE_MAX_TONES dictates the maximum simultaneous tones that can be present
in a multi-tone representation.
*/
typedef struct {
int sample_rate;
teletone_detection_descriptor_t tdd[TELETONE_MAX_TONES];
teletone_goertzel_state_t gs[TELETONE_MAX_TONES];
teletone_goertzel_state_t gs2[TELETONE_MAX_TONES];
int tone_count;
float energy;
int current_sample;
int min_samples;
int total_samples;
int positives;
int negatives;
int hits;
int positive_factor;
int negative_factor;
int hit_factor;
} teletone_multi_tone_t;
/*!
\brief Initilize a multi-frequency tone detector
\param mt the multi-frequency tone descriptor
\param map a representation of the multi-frequency tone
*/
TELETONE_API(void) teletone_multi_tone_init(teletone_multi_tone_t *mt, teletone_tone_map_t *map);
/*!
\brief Check a sample buffer for the presence of the mulit-frequency tone described by mt
\param mt the multi-frequency tone descriptor
\param sample_buffer an array aof 16 bit signed linear samples
\param samples the number of samples present in sample_buffer
\return true when the tone was detected or false when it is not
*/
TELETONE_API(int) teletone_multi_tone_detect (teletone_multi_tone_t *mt,
int16_t sample_buffer[],
int samples);
/*!
\brief Initilize a DTMF detection state object
\param dtmf_detect_state the DTMF detection state to initilize
\param sample_rate the desired sample rate
*/
TELETONE_API(void) teletone_dtmf_detect_init (teletone_dtmf_detect_state_t *dtmf_detect_state, int sample_rate);
/*!
\brief Check a sample buffer for the presence of DTMF digits
\param dtmf_detect_state the detection state object to check
\param sample_buffer an array aof 16 bit signed linear samples
\param samples the number of samples present in sample_buffer
\return true when DTMF was detected or false when it is not
*/
TELETONE_API(int) teletone_dtmf_detect (teletone_dtmf_detect_state_t *dtmf_detect_state,
int16_t sample_buffer[],
int samples);
/*!
\brief retrieve any collected digits into a string buffer
\param dtmf_detect_state the detection state object to check
\param buf the string buffer to write to
\param max the maximum length of buf
\return the number of characters written to buf
*/
TELETONE_API(int) teletone_dtmf_get (teletone_dtmf_detect_state_t *dtmf_detect_state,
char *buf,
int max);
/*!
\brief Step through the Goertzel Algorithm for each sample in a buffer
\param goertzel_state the goertzel state to step the samples through
\param sample_buffer an array aof 16 bit signed linear samples
\param samples the number of samples present in sample_buffer
*/
TELETONE_API(void) teletone_goertzel_update(teletone_goertzel_state_t *goertzel_state,
int16_t sample_buffer[],
int samples);
#ifdef __cplusplus
}
#endif
#endif
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/

View File

@ -1,279 +0,0 @@
/*
* libteletone
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of the original author; nor the names of any contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef LIBTELETONE_GENERATE_H
#define LIBTELETONE_GENERATE_H
#ifdef __cplusplus
extern "C" {
#ifdef _doh
}
#endif
#endif
#include <stdio.h>
#include <stdlib.h>
#if defined(__SUNPRO_C) || defined(__SUNPRO_CC)
#ifndef __inline__
#define __inline__ inline
#endif
#endif
#ifdef _MSC_VER
#ifndef __inline__
#define __inline__ __inline
#endif
typedef unsigned __int64 uint64_t;
typedef unsigned __int32 uint32_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int8 uint8_t;
typedef __int64 int64_t;
typedef __int32 int32_t;
typedef __int16 int16_t;
typedef __int8 int8_t;
#else
#include <stdint.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <math.h>
#if !defined(powf) && !defined(_WIN64)
extern float powf (float, float);
#endif
#include <string.h>
#include <errno.h>
#ifndef _MSC_VER
#include <unistd.h>
#endif
#include <assert.h>
#include <stdarg.h>
#include <libteletone.h>
#define TELETONE_VOL_DB_MAX 0
#define TELETONE_VOL_DB_MIN -63
#define MAX_PHASE_TONES 4
struct teletone_dds_state {
uint32_t phase_rate[MAX_PHASE_TONES];
uint32_t scale_factor;
uint32_t phase_accumulator;
teletone_process_t tx_level;
};
typedef struct teletone_dds_state teletone_dds_state_t;
#define SINE_TABLE_MAX 128
#define SINE_TABLE_LEN (SINE_TABLE_MAX - 1)
#define MAX_PHASE_ACCUMULATOR 0x10000 * 0x10000
/* 3.14 == the max power on ulaw (alaw is 3.17) */
/* 3.02 represents twice the power */
#define DBM0_MAX_POWER (3.14f + 3.02f)
TELETONE_API_DATA extern int16_t TELETONE_SINES[SINE_TABLE_MAX];
static __inline__ int32_t teletone_dds_phase_rate(teletone_process_t tone, uint32_t rate)
{
return (int32_t) ((tone * MAX_PHASE_ACCUMULATOR) / rate);
}
static __inline__ int16_t teletone_dds_state_modulate_sample(teletone_dds_state_t *dds, uint32_t pindex)
{
int32_t bitmask = dds->phase_accumulator, sine_index = (bitmask >>= 23) & SINE_TABLE_LEN;
int16_t sample;
if (pindex >= MAX_PHASE_TONES) {
pindex = 0;
}
if (bitmask & SINE_TABLE_MAX) {
sine_index = SINE_TABLE_LEN - sine_index;
}
sample = TELETONE_SINES[sine_index];
if (bitmask & (SINE_TABLE_MAX * 2)) {
sample *= -1;
}
dds->phase_accumulator += dds->phase_rate[pindex];
return (int16_t) (sample * dds->scale_factor >> 15);
}
static __inline__ void teletone_dds_state_set_tx_level(teletone_dds_state_t *dds, float tx_level)
{
dds->scale_factor = (int) (powf(10.0f, (tx_level - DBM0_MAX_POWER) / 20.0f) * (32767.0f * 1.414214f));
dds->tx_level = tx_level;
}
static __inline__ void teletone_dds_state_reset_accum(teletone_dds_state_t *dds)
{
dds->phase_accumulator = 0;
}
static __inline__ int teletone_dds_state_set_tone(teletone_dds_state_t *dds, teletone_process_t tone, uint32_t rate, uint32_t pindex)
{
if (pindex < MAX_PHASE_TONES) {
dds->phase_rate[pindex] = teletone_dds_phase_rate(tone, rate);
return 0;
}
return -1;
}
/*! \file libteletone_generate.h
\brief Tone Generation Routines
This module is responsible for tone generation specifics
*/
typedef int16_t teletone_audio_t;
struct teletone_generation_session;
typedef int (*tone_handler)(struct teletone_generation_session *ts, teletone_tone_map_t *map);
/*! \brief An abstraction to store a tone generation session */
struct teletone_generation_session {
/*! An array of tone mappings to character mappings */
teletone_tone_map_t TONES[TELETONE_TONE_RANGE];
/*! The number of channels the output audio should be in */
int channels;
/*! The Rate in hz of the output audio */
int rate;
/*! The duration (in samples) of the output audio */
int duration;
/*! The duration of silence to append after the initial audio is generated */
int wait;
/*! The duration (in samples) of the output audio (takes prescedence over actual duration value) */
int tmp_duration;
/*! The duration of silence to append after the initial audio is generated (takes prescedence over actual wait value)*/
int tmp_wait;
/*! Number of loops to repeat a single instruction*/
int loops;
/*! Number of loops to repeat the entire set of instructions*/
int LOOPS;
/*! Number to mutiply total samples by to determine when to begin ascent or decent e.g. 0=beginning 4=(last 25%) */
float decay_factor;
/*! Direction to perform volume increase/decrease 1/-1*/
int decay_direction;
/*! Number of samples between increase/decrease of volume */
int decay_step;
/*! Volume factor of the tone */
float volume;
/*! Debug on/off */
int debug;
/*! FILE stream to write debug data to */
FILE *debug_stream;
/*! Extra user data to attach to the session*/
void *user_data;
/*! Buffer for storing sample data (dynamic) */
teletone_audio_t *buffer;
/*! Size of the buffer */
int datalen;
/*! In-Use size of the buffer */
int samples;
/*! Callback function called during generation */
int dynamic;
tone_handler handler;
};
typedef struct teletone_generation_session teletone_generation_session_t;
/*!
\brief Assign a set of tones to a tone_session indexed by a paticular index/character
\param ts the tone generation session
\param index the index to map the tone to
\param ... up to TELETONE_MAX_TONES frequencies terminated by 0.0
\return 0
*/
TELETONE_API(int) teletone_set_tone(teletone_generation_session_t *ts, int index, ...);
/*!
\brief Assign a set of tones to a single tone map
\param map the map to assign the tones to
\param ... up to TELETONE_MAX_TONES frequencies terminated by 0.0
\return 0
*/
TELETONE_API(int) teletone_set_map(teletone_tone_map_t *map, ...);
/*!
\brief Initilize a tone generation session
\param ts the tone generation session to initilize
\param buflen the size of the buffer(in samples) to dynamically allocate
\param handler a callback function to execute when a tone generation instruction is complete
\param user_data optional user data to send
\return 0
*/
TELETONE_API(int) teletone_init_session(teletone_generation_session_t *ts, int buflen, tone_handler handler, void *user_data);
/*!
\brief Free the buffer allocated by a tone generation session
\param ts the tone generation session to destroy
\return 0
*/
TELETONE_API(int) teletone_destroy_session(teletone_generation_session_t *ts);
/*!
\brief Execute a single tone generation instruction
\param ts the tone generation session to consult for parameters
\param map the tone mapping to use for the frequencies
\return 0
*/
TELETONE_API(int) teletone_mux_tones(teletone_generation_session_t *ts, teletone_tone_map_t *map);
/*!
\brief Execute a tone generation script and call callbacks after each instruction
\param ts the tone generation session to execute on
\param cmd the script to execute
\return 0
*/
TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cmd);
#ifdef __cplusplus
}
#endif
#endif
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/

View File

@ -1,818 +0,0 @@
/*
* Copyright (c) 2007-2014, Anthony Minessale II
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of the original author; nor the names of any contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef OPENZAP_H
#define OPENZAP_H
#if !defined(_XOPEN_SOURCE) && !defined(__FreeBSD__)
#define _XOPEN_SOURCE 600
#endif
#ifndef HAVE_STRINGS_H
#define HAVE_STRINGS_H 1
#endif
#ifndef HAVE_SYS_SOCKET_H
#define HAVE_SYS_SOCKET_H 1
#endif
#ifndef __WINDOWS__
#if defined(WIN32) || defined(WIN64) || defined(_MSC_VER) || defined(_WIN32) || defined(_WIN64)
#define __WINDOWS__
#endif
#endif
#ifdef _MSC_VER
#if defined(OZ_DECLARE_STATIC)
#define OZ_DECLARE(type) type __stdcall
#define OZ_DECLARE_NONSTD(type) type __cdecl
#define OZ_DECLARE_DATA
#elif defined(OPENZAP_EXPORTS)
#define OZ_DECLARE(type) __declspec(dllexport) type __stdcall
#define OZ_DECLARE_NONSTD(type) __declspec(dllexport) type __cdecl
#define OZ_DECLARE_DATA __declspec(dllexport)
#else
#define OZ_DECLARE(type) __declspec(dllimport) type __stdcall
#define OZ_DECLARE_NONSTD(type) __declspec(dllimport) type __cdecl
#define OZ_DECLARE_DATA __declspec(dllimport)
#endif
#define EX_DECLARE_DATA __declspec(dllexport)
#else
#if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined (__SUNPRO_C)) && defined(HAVE_VISIBILITY)
#define OZ_DECLARE(type) __attribute__((visibility("default"))) type
#define OZ_DECLARE_NONSTD(type) __attribute__((visibility("default"))) type
#define OZ_DECLARE_DATA __attribute__((visibility("default")))
#else
#define OZ_DECLARE(type) type
#define OZ_DECLARE_NONSTD(type) type
#define OZ_DECLARE_DATA
#endif
#define EX_DECLARE_DATA
#endif
#ifdef _MSC_VER
#ifndef __inline__
#define __inline__ __inline
#endif
#if (_MSC_VER >= 1400) /* VC8+ */
#ifndef _CRT_SECURE_NO_DEPRECATE
#define _CRT_SECURE_NO_DEPRECATE
#endif
#ifndef _CRT_NONSTDC_NO_DEPRECATE
#define _CRT_NONSTDC_NO_DEPRECATE
#endif
#endif
#ifndef strcasecmp
#define strcasecmp(s1, s2) _stricmp(s1, s2)
#endif
#ifndef strncasecmp
#define strncasecmp(s1, s2, n) _strnicmp(s1, s2, n)
#endif
#ifndef snprintf
#define snprintf _snprintf
#endif
#ifndef S_IRUSR
#define S_IRUSR _S_IREAD
#endif
#ifndef S_IWUSR
#define S_IWUSR _S_IWRITE
#endif
#undef HAVE_STRINGS_H
#undef HAVE_SYS_SOCKET_H
/* disable warning for zero length array in a struct */
/* this will cause errors on c99 and ansi compliant compilers and will need to be fixed in the wanpipe header files */
#pragma warning(disable:4706)
#pragma comment(lib, "Winmm")
#endif
#define ZAP_THREAD_STACKSIZE 240 * 1024
#define ZAP_ENUM_NAMES(_NAME, _STRINGS) static const char * _NAME [] = { _STRINGS , NULL };
#define ZAP_STR2ENUM_P(_FUNC1, _FUNC2, _TYPE) OZ_DECLARE(_TYPE) _FUNC1 (const char *name); OZ_DECLARE(const char *) _FUNC2 (_TYPE type);
#define ZAP_STR2ENUM(_FUNC1, _FUNC2, _TYPE, _STRINGS, _MAX) \
OZ_DECLARE(_TYPE) _FUNC1 (const char *name) \
{ \
int i; \
_TYPE t = _MAX ; \
\
for (i = 0; i < _MAX ; i++) { \
if (!strcasecmp(name, _STRINGS[i])) { \
t = (_TYPE) i; \
break; \
} \
} \
\
return t; \
} \
OZ_DECLARE(const char *) _FUNC2 (_TYPE type) \
{ \
if (type > _MAX) { \
type = _MAX; \
} \
return _STRINGS[(int)type]; \
} \
#define zap_true(expr) \
(expr && ( !strcasecmp(expr, "yes") || \
!strcasecmp(expr, "on") || \
!strcasecmp(expr, "true") || \
!strcasecmp(expr, "enabled") || \
!strcasecmp(expr, "active") || \
atoi(expr))) ? 1 : 0
#include <time.h>
#ifndef __WINDOWS__
#include <sys/time.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
#include <assert.h>
#include "zap_types.h"
#include "hashtable.h"
#include "zap_config.h"
#include "g711.h"
#include "libteletone.h"
#include "zap_buffer.h"
#include "zap_threadmutex.h"
#ifdef __WINDOWS__
#define zap_sleep(x) Sleep(x)
#else
#define zap_sleep(x) usleep(x * 1000)
#endif
#ifdef NDEBUG
#undef assert
#define assert(_Expression) ((void)(_Expression))
#endif
#define ZAP_MAX_CHANNELS_PHYSICAL_SPAN 32
#define ZAP_MAX_PHYSICAL_SPANS_PER_LOGICAL_SPAN 32
#define ZAP_MAX_CHANNELS_SPAN ZAP_MAX_CHANNELS_PHYSICAL_SPAN * ZAP_MAX_PHYSICAL_SPANS_PER_LOGICAL_SPAN
#define ZAP_MAX_SPANS_INTERFACE 128
#define GOTO_STATUS(label,st) status = st; goto label ;
#define zap_copy_string(x,y,z) strncpy(x, y, z - 1)
#define zap_set_string(x,y) strncpy(x, y, sizeof(x)-1)
#define zap_strlen_zero(s) (!s || *s == '\0')
#define zap_strlen_zero_buf(s) (*s == '\0')
#define zap_channel_test_feature(obj, flag) ((obj)->features & flag)
#define zap_channel_set_feature(obj, flag) (obj)->features |= (flag)
#define zap_channel_clear_feature(obj, flag) (obj)->features &= ~(flag)
#define zap_channel_set_member_locked(obj, _m, _v) zap_mutex_lock(obj->mutex); obj->_m = _v; zap_mutex_unlock(obj->mutex)
/*!
\brief Test for the existance of a flag on an arbitary object
\command obj the object to test
\command flag the or'd list of flags to test
\return true value if the object has the flags defined
*/
#define zap_test_flag(obj, flag) ((obj)->flags & flag)
#define zap_test_pflag(obj, flag) ((obj)->pflags & flag)
#define zap_test_sflag(obj, flag) ((obj)->sflags & flag)
#define zap_set_alarm_flag(obj, flag) (obj)->alarm_flags |= (flag)
#define zap_clear_alarm_flag(obj, flag) (obj)->alarm_flags &= ~(flag)
#define zap_test_alarm_flag(obj, flag) ((obj)->alarm_flags & flag)
/*!
\brief Set a flag on an arbitrary object
\command obj the object to set the flags on
\command flag the or'd list of flags to set
*/
#define zap_set_flag(obj, flag) (obj)->flags |= (flag)
#define zap_set_flag_locked(obj, flag) assert(obj->mutex != NULL); \
zap_mutex_lock(obj->mutex); \
(obj)->flags |= (flag); \
zap_mutex_unlock(obj->mutex);
#define zap_set_pflag(obj, flag) (obj)->pflags |= (flag)
#define zap_set_pflag_locked(obj, flag) assert(obj->mutex != NULL); \
zap_mutex_lock(obj->mutex); \
(obj)->pflags |= (flag); \
zap_mutex_unlock(obj->mutex);
#define zap_set_sflag(obj, flag) (obj)->sflags |= (flag)
#define zap_set_sflag_locked(obj, flag) assert(obj->mutex != NULL); \
zap_mutex_lock(obj->mutex); \
(obj)->sflags |= (flag); \
zap_mutex_unlock(obj->mutex);
/*!
\brief Clear a flag on an arbitrary object while locked
\command obj the object to test
\command flag the or'd list of flags to clear
*/
#define zap_clear_flag(obj, flag) (obj)->flags &= ~(flag)
#define zap_clear_flag_locked(obj, flag) assert(obj->mutex != NULL); zap_mutex_lock(obj->mutex); (obj)->flags &= ~(flag); zap_mutex_unlock(obj->mutex);
#define zap_clear_pflag(obj, flag) (obj)->pflags &= ~(flag)
#define zap_clear_pflag_locked(obj, flag) assert(obj->mutex != NULL); zap_mutex_lock(obj->mutex); (obj)->pflags &= ~(flag); zap_mutex_unlock(obj->mutex);
#define zap_clear_sflag(obj, flag) (obj)->sflags &= ~(flag)
#define zap_clear_sflag_locked(obj, flag) assert(obj->mutex != NULL); zap_mutex_lock(obj->mutex); (obj)->sflags &= ~(flag); zap_mutex_unlock(obj->mutex);
#define zap_log_chan(zchan, level, format, ...) zap_log(level, "[s%dc%d][%d:%d] " format, zchan->span_id, zchan->chan_id, zchan->physical_span_id, zchan->physical_chan_id, __VA_ARGS__)
#define zap_log_chan_msg(zchan, level, msg) zap_log(level, "[s%dc%d][%d:%d] " msg, zchan->span_id, zchan->chan_id, zchan->physical_span_id, zchan->physical_chan_id)
#define zap_set_state_locked(obj, s) if ( obj->state == s ) { \
if (s != ZAP_CHANNEL_STATE_HANGUP) zap_log(ZAP_LOG_WARNING, "Why bother changing state on %d:%d from %s to %s\n", obj->span_id, obj->chan_id, zap_channel_state2str(obj->state), zap_channel_state2str(s)); \
} else if (zap_test_flag(obj, ZAP_CHANNEL_READY)) { \
int st = obj->state; \
zap_channel_set_state(obj, s, 1); \
if (obj->state == s) zap_log(ZAP_LOG_DEBUG, "Changing state on %d:%d from %s to %s\n", obj->span_id, obj->chan_id, zap_channel_state2str(st), zap_channel_state2str(s)); \
else if (!((obj->state == ZAP_CHANNEL_STATE_HANGUP && s == ZAP_CHANNEL_STATE_TERMINATING) || (obj->state == ZAP_CHANNEL_STATE_HANGUP_COMPLETE && s == ZAP_CHANNEL_STATE_HANGUP) || (obj->state == ZAP_CHANNEL_STATE_TERMINATING && s == ZAP_CHANNEL_STATE_HANGUP))) zap_log(ZAP_LOG_WARNING, "VETO Changing state on %d:%d from %s to %s\n", obj->span_id, obj->chan_id, zap_channel_state2str(st), zap_channel_state2str(s)); \
}
#ifdef _MSC_VER
/* The while(0) below throws a conditional expression is constant warning */
#pragma warning(disable:4127)
#endif
#define zap_set_state_locked_wait(obj, s) \
do { \
int __safety = 100; \
zap_set_state_locked(obj, s); \
while(__safety-- && zap_test_flag(obj, ZAP_CHANNEL_STATE_CHANGE)) { \
zap_sleep(10); \
} \
if(!__safety) { \
zap_log(ZAP_LOG_CRIT, "State change not completed\n"); \
} \
} while(0);
#define zap_wait_for_flag_cleared(obj, flag, time) \
do { \
int __safety = time; \
while(__safety-- && zap_test_flag(obj, flag)) { \
zap_mutex_unlock(obj->mutex); \
zap_sleep(10); \
zap_mutex_lock(obj->mutex); \
} \
if(!__safety) { \
zap_log(ZAP_LOG_CRIT, "flag %d was never cleared\n", flag); \
} \
} while(0);
#define zap_set_state_wait(obj, s) \
do { \
zap_channel_set_state(obj, s, 0); \
zap_wait_for_flag_cleared(obj, ZAP_CHANNEL_STATE_CHANGE, 100); \
} while(0);
typedef enum {
ZAP_STATE_CHANGE_FAIL,
ZAP_STATE_CHANGE_SUCCESS,
ZAP_STATE_CHANGE_SAME,
} zap_state_change_result_t;
#define zap_set_state_r(obj, s, l, r) if ( obj->state == s ) { \
if (s != ZAP_CHANNEL_STATE_HANGUP) zap_log(ZAP_LOG_WARNING, "Why bother changing state on %d:%d from %s to %s\n", obj->span_id, obj->chan_id, zap_channel_state2str(obj->state), zap_channel_state2str(s)); r = ZAP_STATE_CHANGE_SAME; \
} else if (zap_test_flag(obj, ZAP_CHANNEL_READY)) { \
int st = obj->state; \
r = (zap_channel_set_state(obj, s, l) == ZAP_SUCCESS) ? ZAP_STATE_CHANGE_SUCCESS : ZAP_STATE_CHANGE_FAIL; \
if (obj->state == s) {zap_log(ZAP_LOG_DEBUG, "Changing state on %d:%d from %s to %s\n", obj->span_id, obj->chan_id, zap_channel_state2str(st), zap_channel_state2str(s));} \
else { if (!((obj->state == ZAP_CHANNEL_STATE_HANGUP && s == ZAP_CHANNEL_STATE_TERMINATING) || (obj->state == ZAP_CHANNEL_STATE_HANGUP_COMPLETE && s == ZAP_CHANNEL_STATE_HANGUP) || (obj->state == ZAP_CHANNEL_STATE_TERMINATING && s == ZAP_CHANNEL_STATE_HANGUP))) zap_log(ZAP_LOG_WARNING, "VETO Changing state on %d:%d from %s to %s\n", obj->span_id, obj->chan_id, zap_channel_state2str(st), zap_channel_state2str(s)); } \
}
#define zap_is_dtmf(key) ((key > 47 && key < 58) || (key > 64 && key < 69) || (key > 96 && key < 101) || key == 35 || key == 42 || key == 87 || key == 119)
/*!
\brief Copy flags from one arbitrary object to another
\command dest the object to copy the flags to
\command src the object to copy the flags from
\command flags the flags to copy
*/
#define zap_copy_flags(dest, src, flags) (dest)->flags &= ~(flags); (dest)->flags |= ((src)->flags & (flags))
/*!
\brief Free a pointer and set it to NULL unless it already is NULL
\command it the pointer
*/
#define zap_safe_free(it) if (it) {free(it);it=NULL;}
#define zap_socket_close(it) if (it > -1) { close(it); it = -1;}
struct zap_stream_handle {
zap_stream_handle_write_function_t write_function;
zap_stream_handle_raw_write_function_t raw_write_function;
void *data;
void *end;
zap_size_t data_size;
zap_size_t data_len;
zap_size_t alloc_len;
zap_size_t alloc_chunk;
};
OZ_DECLARE_NONSTD(zap_status_t) zap_console_stream_raw_write(zap_stream_handle_t *handle, uint8_t *data, zap_size_t datalen);
OZ_DECLARE_NONSTD(zap_status_t) zap_console_stream_write(zap_stream_handle_t *handle, const char *fmt, ...);
#define ZAP_CMD_CHUNK_LEN 1024
#define ZAP_STANDARD_STREAM(s) memset(&s, 0, sizeof(s)); s.data = malloc(ZAP_CMD_CHUNK_LEN); \
assert(s.data); \
memset(s.data, 0, ZAP_CMD_CHUNK_LEN); \
s.end = s.data; \
s.data_size = ZAP_CMD_CHUNK_LEN; \
s.write_function = zap_console_stream_write; \
s.raw_write_function = zap_console_stream_raw_write; \
s.alloc_len = ZAP_CMD_CHUNK_LEN; \
s.alloc_chunk = ZAP_CMD_CHUNK_LEN
struct zap_event {
zap_event_type_t e_type;
uint32_t enum_id;
zap_channel_t *channel;
void *data;
};
#define ZAP_TOKEN_STRLEN 128
#define ZAP_MAX_TOKENS 10
static __inline__ char *zap_clean_string(char *s)
{
char *p;
for (p = s; p && *p; p++) {
uint8_t x = (uint8_t) *p;
if (x < 32 || x > 127) {
*p = ' ';
}
}
return s;
}
struct zap_bitstream {
uint8_t *data;
uint32_t datalen;
uint32_t byte_index;
uint8_t bit_index;
int8_t endian;
uint8_t top;
uint8_t bot;
uint8_t ss;
uint8_t ssv;
};
struct zap_fsk_data_state {
dsp_fsk_handle_t *fsk1200_handle;
uint8_t init;
uint8_t *buf;
size_t bufsize;
zap_size_t blen;
zap_size_t bpos;
zap_size_t dlen;
zap_size_t ppos;
int checksum;
};
struct zap_fsk_modulator {
teletone_dds_state_t dds;
zap_bitstream_t bs;
uint32_t carrier_bits_start;
uint32_t carrier_bits_stop;
uint32_t chan_sieze_bits;
uint32_t bit_factor;
uint32_t bit_accum;
uint32_t sample_counter;
int32_t samples_per_bit;
int32_t est_bytes;
fsk_modem_types_t modem_type;
zap_fsk_data_state_t *fsk_data;
zap_fsk_write_sample_t write_sample_callback;
void *user_data;
int16_t sample_buffer[64];
};
/**
* Type Of Number (TON)
*/
typedef enum {
ZAP_TON_UNKNOWN = 0,
ZAP_TON_INTERNATIONAL,
ZAP_TON_NATIONAL,
ZAP_TON_NETWORK_SPECIFIC,
ZAP_TON_SUBSCRIBER_NUMBER,
ZAP_TON_ABBREVIATED_NUMBER,
ZAP_TON_RESERVED,
ZAP_TON_INVALID = 255
} zap_ton_t;
/**
* Numbering Plan Identification (NPI)
*/
typedef enum {
ZAP_NPI_UNKNOWN = 0,
ZAP_NPI_ISDN = 1,
ZAP_NPI_DATA = 3,
ZAP_NPI_TELEX = 4,
ZAP_NPI_NATIONAL = 8,
ZAP_NPI_PRIVATE = 9,
ZAP_NPI_RESERVED = 10,
ZAP_NPI_INVALID = 255
} zap_npi_t;
typedef struct {
char digits[25];
uint8_t type;
uint8_t plan;
} zap_number_t;
typedef enum {
ZAP_CALLER_STATE_DIALING,
ZAP_CALLER_STATE_SUCCESS,
ZAP_CALLER_STATE_FAIL
} zap_caller_state_t;
struct zap_caller_data {
char cid_date[8];
char cid_name[80];
zap_number_t cid_num;
zap_number_t ani;
zap_number_t dnis;
zap_number_t rdnis;
char aniII[25];
uint8_t screen;
uint8_t pres;
char collected[25];
int CRV;
int hangup_cause;
char raw_data[1024];
uint32_t raw_data_len;
uint32_t flags;
zap_caller_state_t call_state;
uint32_t chan_id;
};
typedef enum {
ZAP_TYPE_NONE,
ZAP_TYPE_SPAN = 0xFF,
ZAP_TYPE_CHANNEL
} zap_data_type_t;
#ifdef ZAP_DEBUG_DTMF
/* number of bytes for the circular buffer (5 seconds worth of audio) */
#define DTMF_DEBUG_SIZE 8 * 5000
/* number of 20ms cycles before timeout and close the debug dtmf file (5 seconds) */
#define DTMF_DEBUG_TIMEOUT 250
typedef struct {
FILE *file;
char buffer[DTMF_DEBUG_SIZE];
int windex;
int wrapped;
int closetimeout;
zap_mutex_t *mutex;
} zap_dtmf_debug_t;
#endif
/* 2^8 table size, one for each byte value */
#define ZAP_GAINS_TABLE_SIZE 256
struct zap_channel {
zap_data_type_t data_type;
uint32_t span_id;
uint32_t chan_id;
uint32_t physical_span_id;
uint32_t physical_chan_id;
uint32_t rate;
uint32_t extra_id;
zap_chan_type_t type;
zap_socket_t sockfd;
zap_channel_flag_t flags;
uint32_t pflags;
uint32_t sflags;
zap_alarm_flag_t alarm_flags;
zap_channel_feature_t features;
zap_codec_t effective_codec;
zap_codec_t native_codec;
uint32_t effective_interval;
uint32_t native_interval;
uint32_t packet_len;
zap_channel_state_t state;
zap_channel_state_t last_state;
zap_channel_state_t init_state;
zap_mutex_t *mutex;
teletone_dtmf_detect_state_t dtmf_detect;
uint32_t buffer_delay;
zap_event_t event_header;
char last_error[256];
zio_event_cb_t event_callback;
uint32_t skip_read_frames;
zap_buffer_t *dtmf_buffer;
zap_buffer_t *gen_dtmf_buffer;
zap_buffer_t *pre_buffer;
zap_buffer_t *digit_buffer;
zap_buffer_t *fsk_buffer;
zap_mutex_t *pre_buffer_mutex;
uint32_t dtmf_on;
uint32_t dtmf_off;
char *dtmf_hangup_buf;
teletone_generation_session_t tone_session;
zap_time_t last_event_time;
zap_time_t ring_time;
char tokens[ZAP_MAX_TOKENS+1][ZAP_TOKEN_STRLEN];
uint8_t needed_tones[ZAP_TONEMAP_INVALID];
uint8_t detected_tones[ZAP_TONEMAP_INVALID];
zap_tonemap_t last_detected_tone;
uint32_t token_count;
char chan_name[128];
char chan_number[32];
zap_filehandle_t fds[2];
zap_fsk_data_state_t fsk;
uint8_t fsk_buf[80];
uint32_t ring_count;
void *mod_data;
void *call_data;
struct zap_caller_data caller_data;
struct zap_span *span;
struct zap_io_interface *zio;
zap_hash_t *variable_hash;
unsigned char rx_cas_bits;
uint32_t pre_buffer_size;
unsigned char rxgain_table[ZAP_GAINS_TABLE_SIZE];
unsigned char txgain_table[ZAP_GAINS_TABLE_SIZE];
float rxgain;
float txgain;
#ifdef ZAP_DEBUG_DTMF
zap_dtmf_debug_t dtmfdbg;
#endif
};
struct zap_sigmsg {
zap_signal_event_t event_id;
uint32_t chan_id;
uint32_t span_id;
zap_channel_t *channel;
void *raw_data;
uint32_t raw_data_len;
};
struct zap_span {
zap_data_type_t data_type;
char *name;
uint32_t span_id;
uint32_t chan_count;
zap_span_flag_t flags;
struct zap_io_interface *zio;
zio_event_cb_t event_callback;
zap_mutex_t *mutex;
zap_trunk_type_t trunk_type;
zap_analog_start_type_t start_type;
zap_signal_type_t signal_type;
void *signal_data;
zio_signal_cb_t signal_cb;
zap_event_t event_header;
char last_error[256];
char tone_map[ZAP_TONEMAP_INVALID+1][ZAP_TONEMAP_LEN];
teletone_tone_map_t tone_detect_map[ZAP_TONEMAP_INVALID+1];
teletone_multi_tone_t tone_finder[ZAP_TONEMAP_INVALID+1];
zap_channel_t *channels[ZAP_MAX_CHANNELS_SPAN+1];
zio_channel_outgoing_call_t outgoing_call;
zio_channel_request_t channel_request;
zap_span_start_t start;
zap_span_stop_t stop;
void *mod_data;
char *type;
char *dtmf_hangup;
size_t dtmf_hangup_len;
int suggest_chan_id;
zap_state_map_t *state_map;
zap_caller_data_t default_caller_data;
struct zap_span *next;
};
OZ_DECLARE_DATA extern zap_logger_t zap_log;
struct zap_io_interface {
const char *name;
zio_configure_span_t configure_span;
zio_configure_t configure;
zio_open_t open;
zio_close_t close;
zio_channel_destroy_t channel_destroy;
zio_span_destroy_t span_destroy;
zio_get_alarms_t get_alarms;
zio_command_t command;
zio_wait_t wait;
zio_read_t read;
zio_write_t write;
zio_span_poll_event_t poll_event;
zio_span_next_event_t next_event;
zio_api_t api;
};
OZ_DECLARE(zap_size_t) zap_fsk_modulator_generate_bit(zap_fsk_modulator_t *fsk_trans, int8_t bit, int16_t *buf, zap_size_t buflen);
OZ_DECLARE(int32_t) zap_fsk_modulator_generate_carrier_bits(zap_fsk_modulator_t *fsk_trans, uint32_t bits);
OZ_DECLARE(void) zap_fsk_modulator_generate_chan_sieze(zap_fsk_modulator_t *fsk_trans);
OZ_DECLARE(void) zap_fsk_modulator_send_data(zap_fsk_modulator_t *fsk_trans);
#define zap_fsk_modulator_send_all(_it) zap_fsk_modulator_generate_chan_sieze(_it); \
zap_fsk_modulator_generate_carrier_bits(_it, _it->carrier_bits_start); \
zap_fsk_modulator_send_data(_it); \
zap_fsk_modulator_generate_carrier_bits(_it, _it->carrier_bits_stop)
OZ_DECLARE(zap_status_t) zap_fsk_modulator_init(zap_fsk_modulator_t *fsk_trans,
fsk_modem_types_t modem_type,
uint32_t sample_rate,
zap_fsk_data_state_t *fsk_data,
float db_level,
uint32_t carrier_bits_start,
uint32_t carrier_bits_stop,
uint32_t chan_sieze_bits,
zap_fsk_write_sample_t write_sample_callback,
void *user_data);
OZ_DECLARE(int8_t) zap_bitstream_get_bit(zap_bitstream_t *bsp);
OZ_DECLARE(void) zap_bitstream_init(zap_bitstream_t *bsp, uint8_t *data, uint32_t datalen, zap_endian_t endian, uint8_t ss);
OZ_DECLARE(zap_status_t) zap_fsk_data_parse(zap_fsk_data_state_t *state, zap_size_t *type, char **data, zap_size_t *len);
OZ_DECLARE(zap_status_t) zap_fsk_demod_feed(zap_fsk_data_state_t *state, int16_t *data, size_t samples);
OZ_DECLARE(zap_status_t) zap_fsk_demod_destroy(zap_fsk_data_state_t *state);
OZ_DECLARE(int) zap_fsk_demod_init(zap_fsk_data_state_t *state, int rate, uint8_t *buf, size_t bufsize);
OZ_DECLARE(zap_status_t) zap_fsk_data_init(zap_fsk_data_state_t *state, uint8_t *data, uint32_t datalen);
OZ_DECLARE(zap_status_t) zap_fsk_data_add_mdmf(zap_fsk_data_state_t *state, zap_mdmf_type_t type, const uint8_t *data, uint32_t datalen);
OZ_DECLARE(zap_status_t) zap_fsk_data_add_checksum(zap_fsk_data_state_t *state);
OZ_DECLARE(zap_status_t) zap_fsk_data_add_sdmf(zap_fsk_data_state_t *state, const char *date, char *number);
OZ_DECLARE(zap_status_t) zap_channel_outgoing_call(zap_channel_t *zchan);
OZ_DECLARE(void) zap_channel_rotate_tokens(zap_channel_t *zchan);
OZ_DECLARE(void) zap_channel_clear_detected_tones(zap_channel_t *zchan);
OZ_DECLARE(void) zap_channel_clear_needed_tones(zap_channel_t *zchan);
OZ_DECLARE(zap_status_t) zap_channel_get_alarms(zap_channel_t *zchan);
OZ_DECLARE(zap_status_t) zap_channel_send_fsk_data(zap_channel_t *zchan, zap_fsk_data_state_t *fsk_data, float db_level);
OZ_DECLARE(zap_status_t) zap_channel_clear_token(zap_channel_t *zchan, const char *token);
OZ_DECLARE(void) zap_channel_replace_token(zap_channel_t *zchan, const char *old_token, const char *new_token);
OZ_DECLARE(zap_status_t) zap_channel_add_token(zap_channel_t *zchan, char *token, int end);
OZ_DECLARE(zap_status_t) zap_channel_set_state(zap_channel_t *zchan, zap_channel_state_t state, int lock);
OZ_DECLARE(zap_status_t) zap_span_load_tones(zap_span_t *span, const char *mapname);
OZ_DECLARE(zap_size_t) zap_channel_dequeue_dtmf(zap_channel_t *zchan, char *dtmf, zap_size_t len);
OZ_DECLARE(zap_status_t) zap_channel_queue_dtmf(zap_channel_t *zchan, const char *dtmf);
OZ_DECLARE(void) zap_channel_flush_dtmf(zap_channel_t *zchan);
OZ_DECLARE(zap_time_t) zap_current_time_in_ms(void);
OZ_DECLARE(zap_status_t) zap_span_poll_event(zap_span_t *span, uint32_t ms);
OZ_DECLARE(zap_status_t) zap_span_next_event(zap_span_t *span, zap_event_t **event);
OZ_DECLARE(zap_status_t) zap_span_find(uint32_t id, zap_span_t **span);
OZ_DECLARE(zap_status_t) zap_span_create(zap_io_interface_t *zio, zap_span_t **span, const char *name);
OZ_DECLARE(zap_status_t) zap_span_close_all(void);
OZ_DECLARE(zap_status_t) zap_span_add_channel(zap_span_t *span, zap_socket_t sockfd, zap_chan_type_t type, zap_channel_t **chan);
OZ_DECLARE(zap_status_t) zap_span_set_event_callback(zap_span_t *span, zio_event_cb_t event_callback);
OZ_DECLARE(zap_status_t) zap_channel_set_event_callback(zap_channel_t *zchan, zio_event_cb_t event_callback);
OZ_DECLARE(zap_status_t) zap_channel_open(uint32_t span_id, uint32_t chan_id, zap_channel_t **zchan);
OZ_DECLARE(zap_status_t) zap_channel_open_chan(zap_channel_t *zchan);
OZ_DECLARE(zap_status_t) zap_span_channel_use_count(zap_span_t *span, uint32_t *count);
OZ_DECLARE(zap_status_t) zap_channel_open_any(uint32_t span_id, zap_direction_t direction, zap_caller_data_t *caller_data, zap_channel_t **zchan);
OZ_DECLARE(zap_status_t) zap_channel_close(zap_channel_t **zchan);
OZ_DECLARE(zap_status_t) zap_channel_done(zap_channel_t *zchan);
OZ_DECLARE(zap_status_t) zap_channel_use(zap_channel_t *zchan);
OZ_DECLARE(zap_status_t) zap_channel_command(zap_channel_t *zchan, zap_command_t command, void *obj);
OZ_DECLARE(zap_status_t) zap_channel_wait(zap_channel_t *zchan, zap_wait_flag_t *flags, int32_t to);
OZ_DECLARE(zap_status_t) zap_channel_read(zap_channel_t *zchan, void *data, zap_size_t *datalen);
OZ_DECLARE(void) zap_generate_sln_silence(int16_t *data, uint32_t samples, uint32_t divisor);
OZ_DECLARE(zap_status_t) zap_channel_write(zap_channel_t *zchan, void *data, zap_size_t datasize, zap_size_t *datalen);
OZ_DECLARE(zap_status_t) zap_channel_add_var(zap_channel_t *zchan, const char *var_name, const char *value);
OZ_DECLARE(const char *) zap_channel_get_var(zap_channel_t *zchan, const char *var_name);
OZ_DECLARE(zap_status_t) zap_channel_clear_vars(zap_channel_t *zchan);
OZ_DECLARE(zap_status_t) zap_global_init(void);
OZ_DECLARE(zap_status_t) zap_global_destroy(void);
OZ_DECLARE(void) zap_global_set_logger(zap_logger_t logger);
OZ_DECLARE(void) zap_global_set_default_logger(int level);
OZ_DECLARE(uint32_t) zap_separate_string(char *buf, char delim, char **array, int arraylen);
OZ_DECLARE(void) print_bits(uint8_t *b, int bl, char *buf, int blen, int e, uint8_t ss);
OZ_DECLARE(void) print_hex_bytes(uint8_t *data, zap_size_t dlen, char *buf, zap_size_t blen);
OZ_DECLARE_NONSTD(int) zap_hash_equalkeys(void *k1, void *k2);
OZ_DECLARE_NONSTD(uint32_t) zap_hash_hashfromstring(void *ky);
OZ_DECLARE(uint32_t) zap_running(void);
OZ_DECLARE(zap_status_t) zap_channel_complete_state(zap_channel_t *zchan);
OZ_DECLARE(zap_status_t) zap_channel_init(zap_channel_t *zchan);
OZ_DECLARE(int) zap_load_modules(void);
OZ_DECLARE(zap_status_t) zap_unload_modules(void);
OZ_DECLARE(zap_status_t) zap_configure_span(const char *type, zap_span_t *span, zio_signal_cb_t sig_cb, ...);
OZ_DECLARE(zap_status_t) zap_span_start(zap_span_t *span);
OZ_DECLARE(zap_status_t) zap_span_stop(zap_span_t *span);
OZ_DECLARE(zap_status_t) zap_span_send_signal(zap_span_t *span, zap_sigmsg_t *sigmsg);
OZ_DECLARE(int) zap_load_module(const char *name);
OZ_DECLARE(int) zap_load_module_assume(const char *name);
OZ_DECLARE(zap_status_t) zap_span_find_by_name(const char *name, zap_span_t **span);
OZ_DECLARE(char *) zap_api_execute(const char *type, const char *cmd);
OZ_DECLARE(int) zap_vasprintf(char **ret, const char *fmt, va_list ap);
OZ_DECLARE(zap_status_t) zap_channel_set_caller_data(zap_channel_t *zchan, zap_caller_data_t *caller_data);
OZ_DECLARE(void) zap_cpu_monitor_disable(void);
ZIO_CODEC_FUNCTION(zio_slin2ulaw);
ZIO_CODEC_FUNCTION(zio_ulaw2slin);
ZIO_CODEC_FUNCTION(zio_slin2alaw);
ZIO_CODEC_FUNCTION(zio_alaw2slin);
ZIO_CODEC_FUNCTION(zio_ulaw2alaw);
ZIO_CODEC_FUNCTION(zio_alaw2ulaw);
#ifdef DEBUG_LOCKS
#define zap_mutex_lock(_x) printf("++++++lock %s:%d\n", __FILE__, __LINE__) && _zap_mutex_lock(_x)
#define zap_mutex_trylock(_x) printf("++++++try %s:%d\n", __FILE__, __LINE__) && _zap_mutex_trylock(_x)
#define zap_mutex_unlock(_x) printf("------unlock %s:%d\n", __FILE__, __LINE__) && _zap_mutex_unlock(_x)
#else
#define zap_mutex_lock(_x) _zap_mutex_lock(_x)
#define zap_mutex_trylock(_x) _zap_mutex_trylock(_x)
#define zap_mutex_unlock(_x) _zap_mutex_unlock(_x)
#endif
static __inline__ void zap_set_state_all(zap_span_t *span, zap_channel_state_t state)
{
uint32_t j;
zap_mutex_lock(span->mutex);
for(j = 1; j <= span->chan_count; j++) {
zap_set_state_locked((span->channels[j]), state);
}
zap_mutex_unlock(span->mutex);
}
static __inline__ int zap_check_state_all(zap_span_t *span, zap_channel_state_t state)
{
uint32_t j;
for(j = 1; j <= span->chan_count; j++) {
if (span->channels[j]->state != state || zap_test_flag(span->channels[j], ZAP_CHANNEL_STATE_CHANGE)) {
return 0;
}
}
return 1;
}
static __inline__ void zap_set_flag_all(zap_span_t *span, uint32_t flag)
{
uint32_t j;
zap_mutex_lock(span->mutex);
for(j = 1; j <= span->chan_count; j++) {
zap_set_flag_locked((span->channels[j]), flag);
}
zap_mutex_unlock(span->mutex);
}
static __inline__ void zap_clear_flag_all(zap_span_t *span, uint32_t flag)
{
uint32_t j;
zap_mutex_lock(span->mutex);
for(j = 1; j <= span->chan_count; j++) {
zap_clear_flag_locked((span->channels[j]), flag);
}
zap_mutex_unlock(span->mutex);
}
#endif
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/

View File

@ -1,321 +0,0 @@
/*****************************************************************************
* sangoma_tdm_api.h Sangoma TDM API Portability functions
*
* Author(s): Anthony Minessale II <anthm@freeswitch.org>
* Nenad Corbic <ncorbic@sangoma.com>
* Michael Jerris <mike@jerris.com>
* David Rokhvarg <davidr@sangoma.com>
*
* Copyright: (c) 2006 Nenad Corbic <ncorbic@sangoma.com>
* Anthony Minessale II
* (c) 1984-2007 Sangoma Technologies Inc.
*
* ============================================================================
*/
#ifndef _SANGOMA_TDM_API_H
#define _SANGOMA_TDM_API_H
/* This entire block of defines and includes from this line, through #define FNAME_LEN probably dont belong here */
/* most of them probably belong in wanpipe_defines.h, then each header file listed included below properly included */
/* in the header files that depend on them, leaving only the include for wanpipe_tdm_api.h left in this file or */
/* possibly integrating the rest of this file diretly into wanpipe_tdm_api.h */
#ifndef __WINDOWS__
#if defined(WIN32) || defined(WIN64) || defined(_MSC_VER) || defined(_WIN32)
#define __WINDOWS__
#endif /* defined(WIN32) || defined(WIN64) || defined(_MSC_VER) || defined(_WIN32) */
#endif /* ndef __WINDOWS__ */
#if defined(__WINDOWS__)
#if defined(_MSC_VER)
/* disable some warnings caused by wanpipe headers that will need to be fixed in those headers */
#pragma warning(disable:4201 4214)
/* sang_api.h(74) : warning C4201: nonstandard extension used : nameless struct/union */
/* wanpipe_defines.h(219) : warning C4214: nonstandard extension used : bit field types other than int */
/* wanpipe_defines.h(220) : warning C4214: nonstandard extension used : bit field types other than int */
/* this will break for any compilers that are strict ansi or strict c99 */
/* The following definition for that struct should resolve this warning and work for 32 and 64 bit */
#if 0
struct iphdr {
#if defined(__LITTLE_ENDIAN_BITFIELD)
unsigned ihl:4,
version:4;
#elif defined (__BIG_ENDIAN_BITFIELD)
unsigned version:4,
ihl:4;
#else
# error "unknown byteorder!"
#endif
unsigned tos:8;
unsigned tot_len:16;
unsigned id:16;
unsigned frag_off:16;
__u8 ttl;
__u8 protocol;
__u16 check;
__u32 saddr;
__u32 daddr;
/*The options start here. */
};
#endif /* #if 0 */
#define __inline__ __inline
#endif /* defined(_MSC_VER) */
#include <windows.h>
/* do we like the name WP_INVALID_SOCKET or should it be changed? */
#define WP_INVALID_SOCKET INVALID_HANDLE_VALUE
#else /* defined(__WINDOWS__) */
#define WP_INVALID_SOCKET -1
#include <stropts.h>
#include <poll.h>
#include <sys/socket.h>
#endif
#include <wanpipe_defines.h>
#include <wanpipe_cfg.h>
#include <wanpipe_tdm_api.h>
#include <sdla_te1_pmc.h>
#ifdef __WINDOWS__
#include <sang_status_defines.h>
#include <sang_api.h>
#endif
#include <sdla_aft_te1.h>
#define FNAME_LEN 50
#if defined(__WINDOWS__)
/* This might be broken on windows, as POLL_EVENT_TELEPHONY seems to be commented out in sang_api.h.. it should be added to POLLPRI */
#define POLLPRI (POLL_EVENT_LINK_STATE | POLL_EVENT_LINK_CONNECT | POLL_EVENT_LINK_DISCONNECT)
#endif
/* return -1 for error, 0 for timeout or 1 for success. *flags is set to the poll evetns POLLIN | POLLOUT | POLLPRI based on the result of the poll */
/* on windows we actually have POLLPRI defined with several events, so we could theoretically poll */
/* for specific events. Is there any way to do this on *nix as well? */
/* a cross platform way to poll on an actual pollset (span and/or list of spans) will probably also be needed for analog */
/* so we can have one analong handler thread that will deal with all the idle analog channels for events */
/* the alternative would be for the driver to provide one socket for all of the oob events for all analog channels */
static __inline__ int tdmv_api_wait_socket(sng_fd_t fd, int timeout, int *flags)
{
#if defined(__WINDOWS__)
DWORD ln;
API_POLL_STRUCT api_poll;
memset(&api_poll, 0x00, sizeof(API_POLL_STRUCT));
api_poll.user_flags_bitmap = *flags;
api_poll.timeout = timeout;
if (!DeviceIoControl(
fd,
IoctlApiPoll,
(LPVOID)NULL,
0L,
(LPVOID)&api_poll,
sizeof(API_POLL_STRUCT),
(LPDWORD)(&ln),
(LPOVERLAPPED)NULL)) {
return -1;
}
*flags = 0;
switch(api_poll.operation_status)
{
case SANG_STATUS_RX_DATA_AVAILABLE:
break;
case SANG_STATUS_RX_DATA_TIMEOUT:
return 0;
default:
return -1;
}
if (api_poll.poll_events_bitmap == 0){
return -1;
}
if (api_poll.poll_events_bitmap & POLL_EVENT_TIMEOUT) {
return 0;
}
*flags = api_poll.poll_events_bitmap;
return 1;
#else
struct pollfd pfds[1];
int res;
memset(&pfds[0], 0, sizeof(pfds[0]));
pfds[0].fd = fd;
pfds[0].events = *flags;
res = poll(pfds, 1, timeout);
*flags = 0;
if (pfds[0].revents & POLLERR) {
res = -1;
}
if (res > 0) {
*flags = pfds[0].revents;
}
return res;
#endif
}
/* on windows right now, there is no way to specify if we want to read events here or not, we allways get them here */
/* we need some what to select if we are reading regular tdm msgs or events */
/* need to either have 2 functions, 1 for events, 1 for regural read, or a flag on this function to choose */
/* 2 functions preferred. Need implementation for the event function for both nix and windows that is threadsafe */
static __inline__ int tdmv_api_readmsg_tdm(sng_fd_t fd, void *hdrbuf, int hdrlen, void *databuf, int datalen)
{
/* What do we need to do here to avoid having to do all */
/* the memcpy's on windows and still maintain api compat with nix */
int rx_len=0;
#if defined(__WINDOWS__)
static RX_DATA_STRUCT rx_data;
api_header_t *pri;
wp_tdm_api_rx_hdr_t *tdm_api_rx_hdr;
wp_tdm_api_rx_hdr_t *user_buf = (wp_tdm_api_rx_hdr_t*)hdrbuf;
DWORD ln;
if (hdrlen != sizeof(wp_tdm_api_rx_hdr_t)){
return -1;
}
if (!DeviceIoControl(
fd,
IoctlReadCommand,
(LPVOID)NULL,
0L,
(LPVOID)&rx_data,
sizeof(RX_DATA_STRUCT),
(LPDWORD)(&ln),
(LPOVERLAPPED)NULL
)){
return -1;
}
pri = &rx_data.api_header;
tdm_api_rx_hdr = (wp_tdm_api_rx_hdr_t*)rx_data.data;
user_buf->wp_tdm_api_event_type = pri->operation_status;
switch(pri->operation_status)
{
case SANG_STATUS_RX_DATA_AVAILABLE:
if (pri->data_length > datalen){
break;
}
memcpy(databuf, rx_data.data, pri->data_length);
rx_len = pri->data_length;
break;
default:
break;
}
#else
struct msghdr msg;
struct iovec iov[2];
memset(&msg,0,sizeof(struct msghdr));
iov[0].iov_len=hdrlen;
iov[0].iov_base=hdrbuf;
iov[1].iov_len=datalen;
iov[1].iov_base=databuf;
msg.msg_iovlen=2;
msg.msg_iov=iov;
rx_len = read(fd,&msg,datalen+hdrlen);
if (rx_len <= sizeof(wp_tdm_api_rx_hdr_t)){
return -EINVAL;
}
rx_len-=sizeof(wp_tdm_api_rx_hdr_t);
#endif
return rx_len;
}
static __inline__ int tdmv_api_writemsg_tdm(sng_fd_t fd, void *hdrbuf, int hdrlen, void *databuf, unsigned short datalen)
{
/* What do we need to do here to avoid having to do all */
/* the memcpy's on windows and still maintain api compat with nix */
int bsent = 0;
#if defined(__WINDOWS__)
static TX_DATA_STRUCT local_tx_data;
api_header_t *pri;
DWORD ln;
/* Are these really not needed or used??? What about for nix?? */
(void)hdrbuf;
(void)hdrlen;
pri = &local_tx_data.api_header;
pri->data_length = datalen;
memcpy(local_tx_data.data, databuf, pri->data_length);
if (!DeviceIoControl(
fd,
IoctlWriteCommand,
(LPVOID)&local_tx_data,
(ULONG)sizeof(TX_DATA_STRUCT),
(LPVOID)&local_tx_data,
sizeof(TX_DATA_STRUCT),
(LPDWORD)(&ln),
(LPOVERLAPPED)NULL
)){
return -1;
}
if (local_tx_data.api_header.operation_status == SANG_STATUS_SUCCESS) {
bsent = datalen;
}
#else
struct msghdr msg;
struct iovec iov[2];
memset(&msg,0,sizeof(struct msghdr));
iov[0].iov_len = hdrlen;
iov[0].iov_base = hdrbuf;
iov[1].iov_len = datalen;
iov[1].iov_base = databuf;
msg.msg_iovlen = 2;
msg.msg_iov = iov;
bsent = write(fd, &msg, datalen + hdrlen);
if (bsent > 0){
bsent -= sizeof(wp_tdm_api_tx_hdr_t);
}
#endif
return bsent;
}
#endif /* _SANGOMA_TDM_API_H */
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/

View File

@ -1,76 +0,0 @@
/*
* uart.h
*
* Copyright (c) 2005 Robert Krten. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This module contains the manifest constants and declarations for
* the UART module.
*
* 2005 06 19 R. Krten created
*/
#ifndef __UART_H__
#define __UART_H__
typedef void (*bytehandler_func_t) (void *, int);
typedef void (*bithandler_func_t) (void *, int);
typedef struct dsp_uart_attr_s
{
bytehandler_func_t bytehandler; /* byte handler */
void *bytehandler_arg; /* arbitrary ID passed to bytehandler as first argument */
} dsp_uart_attr_t;
typedef struct
{
dsp_uart_attr_t attr;
int have_start; /* wait for start bit to show up */
int data; /* data buffer */
int nbits; /* number of bits accumulated so far */
} dsp_uart_handle_t;
/*
* Function prototypes
*
* General calling order is:
* a) create the attributes structure (dsp_uart_attr_init)
* b) initialize fields in the attributes structure (dsp_uart_attr_set_*)
* c) create a Bell-202 handle (dsp_uart_create)
* d) feed bits through dsp_uart_bit_handler
*/
void dsp_uart_attr_init(dsp_uart_attr_t *attributes);
bytehandler_func_t dsp_uart_attr_get_bytehandler(dsp_uart_attr_t *attributes, void **bytehandler_arg);
void dsp_uart_attr_set_bytehandler(dsp_uart_attr_t *attributes, bytehandler_func_t bytehandler, void *bytehandler_arg);
dsp_uart_handle_t * dsp_uart_create(dsp_uart_attr_t *attributes);
void dsp_uart_destroy(dsp_uart_handle_t **handle);
void dsp_uart_bit_handler(void *handle, int bit);
#endif

View File

@ -1,146 +0,0 @@
/*
* Copyright (c) 2007-2014, Anthony Minessale II
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of the original author; nor the names of any contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef ZAP_BUFFER_H
#define ZAP_BUFFER_H
#include "openzap.h"
/**
* @defgroup zap_buffer Buffer Routines
* @ingroup buffer
* The purpose of this module is to make a plain buffering interface that can be used for read/write buffers
* throughout the application.
* @{
*/
struct zap_buffer;
typedef struct zap_buffer zap_buffer_t;
/*! \brief Allocate a new dynamic zap_buffer
* \param buffer returned pointer to the new buffer
* \param blocksize length to realloc by as data is added
* \param start_len ammount of memory to reserve initially
* \param max_len length the buffer is allowed to grow to
* \return status
*/
OZ_DECLARE(zap_status_t) zap_buffer_create(zap_buffer_t **buffer, zap_size_t blocksize, zap_size_t start_len, zap_size_t max_len);
/*! \brief Get the length of a zap_buffer_t
* \param buffer any buffer of type zap_buffer_t
* \return int size of the buffer.
*/
OZ_DECLARE(zap_size_t) zap_buffer_len(zap_buffer_t *buffer);
/*! \brief Get the freespace of a zap_buffer_t
* \param buffer any buffer of type zap_buffer_t
* \return int freespace in the buffer.
*/
OZ_DECLARE(zap_size_t) zap_buffer_freespace(zap_buffer_t *buffer);
/*! \brief Get the in use amount of a zap_buffer_t
* \param buffer any buffer of type zap_buffer_t
* \return int ammount of buffer curently in use
*/
OZ_DECLARE(zap_size_t) zap_buffer_inuse(zap_buffer_t *buffer);
/*! \brief Read data from a zap_buffer_t up to the ammount of datalen if it is available. Remove read data from buffer.
* \param buffer any buffer of type zap_buffer_t
* \param data pointer to the read data to be returned
* \param datalen amount of data to be returned
* \return int ammount of data actually read
*/
OZ_DECLARE(zap_size_t) zap_buffer_read(zap_buffer_t *buffer, void *data, zap_size_t datalen);
/*! \brief Read data endlessly from a zap_buffer_t
* \param buffer any buffer of type zap_buffer_t
* \param data pointer to the read data to be returned
* \param datalen amount of data to be returned
* \return int ammount of data actually read
* \note Once you have read all the data from the buffer it will loop around.
*/
OZ_DECLARE(zap_size_t) zap_buffer_read_loop(zap_buffer_t *buffer, void *data, zap_size_t datalen);
/*! \brief Assign a number of loops to read
* \param buffer any buffer of type zap_buffer_t
* \param loops the number of loops (-1 for infinite)
*/
OZ_DECLARE(void) zap_buffer_set_loops(zap_buffer_t *buffer, int32_t loops);
/*! \brief Write data into a zap_buffer_t up to the length of datalen
* \param buffer any buffer of type zap_buffer_t
* \param data pointer to the data to be written
* \param datalen amount of data to be written
* \return int amount of buffer used after the write, or 0 if no space available
*/
OZ_DECLARE(zap_size_t) zap_buffer_write(zap_buffer_t *buffer, const void *data, zap_size_t datalen);
/*! \brief Remove data from the buffer
* \param buffer any buffer of type zap_buffer_t
* \param datalen amount of data to be removed
* \return int size of buffer, or 0 if unable to toss that much data
*/
OZ_DECLARE(zap_size_t) zap_buffer_toss(zap_buffer_t *buffer, zap_size_t datalen);
/*! \brief Remove all data from the buffer
* \param buffer any buffer of type zap_buffer_t
*/
OZ_DECLARE(void) zap_buffer_zero(zap_buffer_t *buffer);
/*! \brief Destroy the buffer
* \param buffer buffer to destroy
* \note only neccessary on dynamic buffers (noop on pooled ones)
*/
OZ_DECLARE(void) zap_buffer_destroy(zap_buffer_t **buffer);
/*! \brief Seek to offset from the beginning of the buffer
* \param buffer buffer to seek
* \param datalen offset in bytes
* \return new position
*/
OZ_DECLARE(zap_size_t) zap_buffer_seek(zap_buffer_t *buffer, zap_size_t datalen);
/** @} */
OZ_DECLARE(zap_size_t) zap_buffer_zwrite(zap_buffer_t *buffer, const void *data, zap_size_t datalen);
#endif
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/

View File

@ -1,138 +0,0 @@
/*
* Copyright (c) 2007-2014, Anthony Minessale II
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of the original author; nor the names of any contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* @defgroup config Config File Parser
* @ingroup config
* This module implements a basic interface and file format parser
*
* <pre>
*
* EXAMPLE
*
* [category1]
* var1 => val1
* var2 => val2
* \# lines that begin with \# are comments
* \#var3 => val3
* </pre>
* @{
*/
#ifndef ZAP_CONFIG_H
#define ZAP_CONFIG_H
#include "openzap.h"
#define ZAP_URL_SEPARATOR "://"
#ifdef WIN32
#define ZAP_PATH_SEPARATOR "\\"
#ifndef ZAP_CONFIG_DIR
#define ZAP_CONFIG_DIR "c:\\openzap"
#endif
#define zap_is_file_path(file) (*(file +1) == ':' || *file == '/' || strstr(file, SWITCH_URL_SEPARATOR))
#else
#define ZAP_PATH_SEPARATOR "/"
#ifndef ZAP_CONFIG_DIR
#define ZAP_CONFIG_DIR "/etc/openzap"
#endif
#define zap_is_file_path(file) ((*file == '/') || strstr(file, SWITCH_URL_SEPARATOR))
#endif
typedef struct zap_config zap_config_t;
/*! \brief A simple file handle representing an open configuration file **/
struct zap_config {
/*! FILE stream buffer to the opened file */
FILE *file;
/*! path to the file */
char path[512];
/*! current category */
char category[256];
/*! current section */
char section[256];
/*! buffer of current line being read */
char buf[1024];
/*! current line number in file */
int lineno;
/*! current category number in file */
int catno;
/*! current section number in file */
int sectno;
int lockto;
};
/*!
\brief Open a configuration file
\param cfg (zap_config_t *) config handle to use
\param file_path path to the file
\return 1 (true) on success 0 (false) on failure
*/
int zap_config_open_file(zap_config_t * cfg, const char *file_path);
/*!
\brief Close a previously opened configuration file
\param cfg (zap_config_t *) config handle to use
*/
void zap_config_close_file(zap_config_t * cfg);
/*!
\brief Retrieve next name/value pair from configuration file
\param cfg (zap_config_t *) config handle to use
\param var pointer to aim at the new variable name
\param val pointer to aim at the new value
*/
int zap_config_next_pair(zap_config_t * cfg, char **var, char **val);
/*!
\brief Retrieve the CAS bits from a configuration string value
\param strvalue pointer to the configuration string value (expected to be in format whatever:xxxx)
\param outbits pointer to aim at the CAS bits
*/
OZ_DECLARE (int) zap_config_get_cas_bits(char *strvalue, unsigned char *outbits);
/** @} */
#endif
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/

View File

@ -1,74 +0,0 @@
/* * Copyright (c) 2009, Sangoma Technologies
* Moises Silva <moy@sangoma.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of the original author; nor the names of any contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* Contributors:
* David Yat Sin <dyatsin@sangoma.com>
*
*/
/*! \brief opaque cpu stats structure */
struct zap_cpu_monitor_stats;
/*!
* \brief create a new cpu monitor
* \return profile timer structure previously created with new_profile_timer, NULL on error
*/
OZ_DECLARE(struct zap_cpu_monitor_stats*) zap_new_cpu_monitor(void);
/*!
* \brief Deletes cpu_monitor
*/
OZ_DECLARE(void) zap_delete_cpu_monitor(struct zap_cpu_monitor_stats *p);
/*!
* \brief provides the percentage of idle system time
* \param p cpu_stats structure previously created with zap_new_cpu_monitor
* \param pointer to store the percentage of idle time
* \return -1 on error 0 for success
*/
OZ_DECLARE(zap_status_t) zap_cpu_get_system_idle_time (struct zap_cpu_monitor_stats *p, double *idle_percentage);
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/

View File

@ -1,44 +0,0 @@
/*
* Cross Platform dso/dll load abstraction
* Copyright(C) 2008 Michael Jerris
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so.
*
* This work is provided under this license on an "as is" basis, without warranty of any kind,
* either expressed or implied, including, without limitation, warranties that the covered code
* is free of defects, merchantable, fit for a particular purpose or non-infringing. The entire
* risk as to the quality and performance of the covered code is with you. Should any covered
* code prove defective in any respect, you (not the initial developer or any other contributor)
* assume the cost of any necessary servicing, repair or correction. This disclaimer of warranty
* constitutes an essential part of this license. No use of any covered code is authorized hereunder
* except under this disclaimer.
*
*/
#ifndef _ZAP_DSO_H
#define _ZAP_DSO_H
typedef void (*zap_func_ptr_t) (void);
typedef void * zap_dso_lib_t;
void zap_dso_destroy(zap_dso_lib_t *lib);
zap_dso_lib_t zap_dso_open(const char *path, char **err);
void *zap_dso_func_sym(zap_dso_lib_t lib, const char *sym, char **err);
#endif
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet
*/

View File

@ -1,128 +0,0 @@
/*
* zap_m3ua.h
* openzap
*
* Created by Shane Burrell on 4/3/08.
* Copyright 2008 Shane Burrell. All rights reserved.
*
* Copyright (c) 2007, Anthony Minessale II, Nenad Corbic
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of the original author; nor the names of any contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
//#include "m3ua_client.h"
#include "openzap.h"
enum e_sigboost_event_id_values
{
SIGBOOST_EVENT_CALL_START = 0x80, /*128*/
SIGBOOST_EVENT_CALL_START_ACK = 0x81, /*129*/
SIGBOOST_EVENT_CALL_START_NACK = 0x82, /*130*/
SIGBOOST_EVENT_CALL_START_NACK_ACK = 0x83, /*131*/
SIGBOOST_EVENT_CALL_ANSWERED = 0x84, /*132*/
SIGBOOST_EVENT_CALL_STOPPED = 0x85, /*133*/
SIGBOOST_EVENT_CALL_STOPPED_ACK = 0x86, /*134*/
SIGBOOST_EVENT_SYSTEM_RESTART = 0x87, /*135*/
SIGBOOST_EVENT_SYSTEM_RESTART_ACK = 0x88, /*136*/
/* Following IDs are ss7boost to sangoma_mgd only. */
SIGBOOST_EVENT_HEARTBEAT = 0x89, /*137*/
SIGBOOST_EVENT_INSERT_CHECK_LOOP = 0x8a, /*138*/
SIGBOOST_EVENT_REMOVE_CHECK_LOOP = 0x8b, /*139*/
SIGBOOST_EVENT_AUTO_CALL_GAP_ABATE = 0x8c, /*140*/
};
enum e_sigboost_release_cause_values
{
SIGBOOST_RELEASE_CAUSE_UNDEFINED = 0,
SIGBOOST_RELEASE_CAUSE_NORMAL = 16,
SIGBOOST_RELEASE_CAUSE_BUSY = 17,
/* probable elimination */
//SIGBOOST_RELEASE_CAUSE_BUSY = 0x91, /* 145 */
//SIGBOOST_RELEASE_CAUSE_CALLED_NOT_EXIST = 0x92, /* 146 */
//SIGBOOST_RELEASE_CAUSE_CIRCUIT_RESET = 0x93, /* 147 */
//SIGBOOST_RELEASE_CAUSE_NOANSWER = 0x94, /* 148 */
};
enum e_sigboost_call_setup_ack_nack_cause_values
{
SIGBOOST_CALL_SETUP_NACK_ALL_CKTS_BUSY = 117, /* unused Q.850 value */
SIGBOOST_CALL_SETUP_NACK_TEST_CKT_BUSY = 118, /* unused Q.850 value */
SIGBOOST_CALL_SETUP_NACK_INVALID_NUMBER = 28,
/* probable elimination */
//SIGBOOST_CALL_SETUP_RESERVED = 0x00,
//SIGBOOST_CALL_SETUP_CIRCUIT_RESET = 0x10,
//SIGBOOST_CALL_SETUP_NACK_CKT_START_TIMEOUT = 0x11,
//SIGBOOST_CALL_SETUP_NACK_AUTO_CALL_GAP = 0x17,
};
typedef enum {
M3UA_SPAN_SIGNALING_M3UA,
M3UA_SPAN_SIGNALING_SS7BOX,
} M3UA_TSpanSignaling;
#define M3UA_SPAN_STRINGS "M3UA", "SS7BOX"
ZAP_STR2ENUM_P(m3ua_str2span, m3ua_span2str, M3UA_TSpanSignaling)
typedef enum {
ZAP_M3UA_RUNNING = (1 << 0)
} zap_m3uat_flag_t;
/*typedef struct m3ua_data {
m3uac_connection_t mcon;
m3uac_connection_t pcon;
zio_signal_cb_t signal_cb;
uint32_t flags;
} m3ua_data_t;
*/
/*typedef struct mu3a_link {
ss7bc_connection_t mcon;
ss7bc_connection_t pcon;
zio_signal_cb_t signal_cb;
uint32_t flags;
} zap_m3ua_data_t;
*/
zap_status_t m3ua_init(zap_io_interface_t **zint);
zap_status_t m3ua_destroy(void);
zap_status_t m3ua_start(zap_span_t *span);
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/

View File

@ -1,56 +0,0 @@
/*
* Cross Platform Thread/Mutex abstraction
* Copyright(C) 2007 Michael Jerris
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so.
*
* This work is provided under this license on an "as is" basis, without warranty of any kind,
* either expressed or implied, including, without limitation, warranties that the covered code
* is free of defects, merchantable, fit for a particular purpose or non-infringing. The entire
* risk as to the quality and performance of the covered code is with you. Should any covered
* code prove defective in any respect, you (not the initial developer or any other contributor)
* assume the cost of any necessary servicing, repair or correction. This disclaimer of warranty
* constitutes an essential part of this license. No use of any covered code is authorized hereunder
* except under this disclaimer.
*
*/
#ifndef _ZAP_THREADMUTEX_H
#define _ZAP_THREADMUTEX_H
#include "openzap.h"
typedef struct zap_mutex zap_mutex_t;
typedef struct zap_thread zap_thread_t;
typedef void *(*zap_thread_function_t) (zap_thread_t *, void *);
OZ_DECLARE(zap_status_t) zap_thread_create_detached(zap_thread_function_t func, void *data);
OZ_DECLARE(zap_status_t) zap_thread_create_detached_ex(zap_thread_function_t func, void *data, zap_size_t stack_size);
OZ_DECLARE(void) zap_thread_override_default_stacksize(zap_size_t size);
OZ_DECLARE(zap_status_t) zap_mutex_create(zap_mutex_t **mutex);
OZ_DECLARE(zap_status_t) zap_mutex_destroy(zap_mutex_t **mutex);
OZ_DECLARE(zap_status_t) _zap_mutex_lock(zap_mutex_t *mutex);
OZ_DECLARE(zap_status_t) _zap_mutex_trylock(zap_mutex_t *mutex);
OZ_DECLARE(zap_status_t) _zap_mutex_unlock(zap_mutex_t *mutex);
OZ_DECLARE(zap_status_t) zap_interrupt_create(zap_interrupt_t **ininterrupt, zap_socket_t device);
OZ_DECLARE(zap_status_t) zap_interrupt_wait(zap_interrupt_t *interrupt, int ms);
OZ_DECLARE(zap_status_t) zap_interrupt_signal(zap_interrupt_t *interrupt);
OZ_DECLARE(zap_status_t) zap_interrupt_destroy(zap_interrupt_t **ininterrupt);
OZ_DECLARE(zap_status_t) zap_interrupt_multiple_wait(zap_interrupt_t *interrupts[], zap_size_t size, int ms);
#endif
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/

View File

@ -1,642 +0,0 @@
/*
* Copyright (c) 2007-2014, Anthony Minessale II
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of the original author; nor the names of any contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef ZAP_TYPES_H
#define ZAP_TYPES_H
#include "fsk.h"
#ifdef WIN32
#define ZAP_INVALID_SOCKET INVALID_HANDLE_VALUE
#else
#define ZAP_INVALID_SOCKET -1
#endif
#define zap_array_len(obj) sizeof(obj)/sizeof(obj[0])
#ifdef WIN32
#include <windows.h>
typedef HANDLE zap_socket_t;
typedef unsigned __int64 uint64_t;
typedef unsigned __int32 uint32_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int8 uint8_t;
typedef __int64 int64_t;
typedef __int32 int32_t;
typedef __int16 int16_t;
typedef __int8 int8_t;
typedef intptr_t zap_ssize_t;
typedef int zap_filehandle_t;
#else
#include <stdint.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <stdarg.h>
typedef int zap_socket_t;
typedef ssize_t zap_ssize_t;
typedef int zap_filehandle_t;
#endif
#define TAG_END NULL
typedef size_t zap_size_t;
struct zap_io_interface;
typedef struct zap_interrupt zap_interrupt_t;
#define ZAP_COMMAND_OBJ_INT *((int *)obj)
#define ZAP_COMMAND_OBJ_CHAR_P (char *)obj
#define ZAP_COMMAND_OBJ_FLOAT *((float *)obj)
#define ZAP_FSK_MOD_FACTOR 0x10000
#define ZAP_DEFAULT_DTMF_ON 250
#define ZAP_DEFAULT_DTMF_OFF 50
#define ZAP_END -1
#define ZAP_ANY_STATE -1
typedef uint64_t zap_time_t;
typedef enum {
ZAP_ENDIAN_BIG = 1,
ZAP_ENDIAN_LITTLE = -1
} zap_endian_t;
typedef enum {
ZAP_CID_TYPE_SDMF = 0x04,
ZAP_CID_TYPE_MDMF = 0x80
} zap_cid_type_t;
typedef enum {
MDMF_DATETIME = 1,
MDMF_PHONE_NUM = 2,
MDMF_DDN = 3,
MDMF_NO_NUM = 4,
MDMF_PHONE_NAME = 7,
MDMF_NO_NAME = 8,
MDMF_ALT_ROUTE = 9,
MDMF_INVALID = 10
} zap_mdmf_type_t;
#define MDMF_STRINGS "X", "DATETIME", "PHONE_NUM", "DDN", "NO_NUM", "X", "X", "PHONE_NAME", "NO_NAME", "ALT_ROUTE", "INVALID"
ZAP_STR2ENUM_P(zap_str2zap_mdmf_type, zap_mdmf_type2str, zap_mdmf_type_t)
#define ZAP_TONEMAP_LEN 128
typedef enum {
ZAP_TONEMAP_NONE,
ZAP_TONEMAP_DIAL,
ZAP_TONEMAP_RING,
ZAP_TONEMAP_BUSY,
ZAP_TONEMAP_FAIL1,
ZAP_TONEMAP_FAIL2,
ZAP_TONEMAP_FAIL3,
ZAP_TONEMAP_ATTN,
ZAP_TONEMAP_CALLWAITING_CAS,
ZAP_TONEMAP_CALLWAITING_SAS,
ZAP_TONEMAP_CALLWAITING_ACK,
ZAP_TONEMAP_INVALID
} zap_tonemap_t;
#define TONEMAP_STRINGS "NONE", "DIAL", "RING", "BUSY", "FAIL1", "FAIL2", "FAIL3", "ATTN", "CALLWAITING-CAS", "CALLWAITING-SAS", "CALLWAITING-ACK", "INVALID"
ZAP_STR2ENUM_P(zap_str2zap_tonemap, zap_tonemap2str, zap_tonemap_t)
typedef enum {
ZAP_TRUNK_E1,
ZAP_TRUNK_T1,
ZAP_TRUNK_J1,
ZAP_TRUNK_BRI,
ZAP_TRUNK_BRI_PTMP,
ZAP_TRUNK_FXO,
ZAP_TRUNK_FXS,
ZAP_TRUNK_EM,
ZAP_TRUNK_NONE
} zap_trunk_type_t;
#define TRUNK_STRINGS "E1", "T1", "J1", "BRI", "BRI_PTMP", "FXO", "FXS", "EM", "NONE"
ZAP_STR2ENUM_P(zap_str2zap_trunk_type, zap_trunk_type2str, zap_trunk_type_t)
typedef enum {
ZAP_ANALOG_START_KEWL,
ZAP_ANALOG_START_LOOP,
ZAP_ANALOG_START_GROUND,
ZAP_ANALOG_START_WINK,
ZAP_ANALOG_START_NA
} zap_analog_start_type_t;
#define START_TYPE_STRINGS "KEWL", "LOOP", "GROUND", "WINK", "NA"
ZAP_STR2ENUM_P(zap_str2zap_analog_start_type, zap_analog_start_type2str, zap_analog_start_type_t)
typedef enum {
ZAP_OOB_DTMF,
ZAP_OOB_ONHOOK,
ZAP_OOB_OFFHOOK,
ZAP_OOB_WINK,
ZAP_OOB_FLASH,
ZAP_OOB_RING_START,
ZAP_OOB_RING_STOP,
ZAP_OOB_ALARM_TRAP,
ZAP_OOB_ALARM_CLEAR,
ZAP_OOB_NOOP,
ZAP_OOB_CAS_BITS_CHANGE,
ZAP_OOB_INVALID
} zap_oob_event_t;
#define OOB_STRINGS "DTMF", "ONHOOK", "OFFHOOK", "WINK", "FLASH", "RING_START", "RING_STOP", "ALARM_TRAP", "ALARM_CLEAR", "NOOP", "CAS_BITS_CHANGE", "INVALID"
ZAP_STR2ENUM_P(zap_str2zap_oob_event, zap_oob_event2str, zap_oob_event_t)
typedef enum {
ZAP_ALARM_NONE = 0,
ZAP_ALARM_RECOVER = (1 << 0),
ZAP_ALARM_LOOPBACK = (1 << 2),
ZAP_ALARM_YELLOW = (1 << 3),
ZAP_ALARM_RED = (1 << 4),
ZAP_ALARM_BLUE = (1 << 5),
ZAP_ALARM_NOTOPEN = ( 1 << 6),
ZAP_ALARM_AIS = ( 1 << 7),
ZAP_ALARM_RAI = ( 1 << 8),
ZAP_ALARM_GENERAL = ( 1 << 30)
} zap_alarm_flag_t;
typedef enum {
ZAP_SIGTYPE_NONE,
ZAP_SIGTYPE_ISDN,
ZAP_SIGTYPE_RBS,
ZAP_SIGTYPE_ANALOG,
ZAP_SIGTYPE_SANGOMABOOST,
ZAP_SIGTYPE_M3UA,
ZAP_SIGTYPE_R2
} zap_signal_type_t;
typedef enum {
ZAP_SIGEVENT_START,
ZAP_SIGEVENT_STOP,
ZAP_SIGEVENT_TRANSFER,
ZAP_SIGEVENT_ANSWER,
ZAP_SIGEVENT_UP,
ZAP_SIGEVENT_FLASH,
ZAP_SIGEVENT_PROGRESS,
ZAP_SIGEVENT_PROGRESS_MEDIA,
ZAP_SIGEVENT_NOTIFY,
ZAP_SIGEVENT_TONE_DETECTED,
ZAP_SIGEVENT_ALARM_TRAP,
ZAP_SIGEVENT_ALARM_CLEAR,
ZAP_SIGEVENT_MISC,
ZAP_SIGEVENT_COLLECTED_DIGIT,
ZAP_SIGEVENT_ADD_CALL,
ZAP_SIGEVENT_RESTART,
ZAP_SIGEVENT_INVALID
} zap_signal_event_t;
#define SIGNAL_STRINGS "START", "STOP", "TRANSFER", "ANSWER", "UP", "FLASH", "PROGRESS", \
"PROGRESS_MEDIA", "NOTIFY", "TONE_DETECTED", "ALARM_TRAP", "ALARM_CLEAR", "MISC", "COLLECTED_DIGIT", "ADD_CALL", "RESTART", "INVALID"
ZAP_STR2ENUM_P(zap_str2zap_signal_event, zap_signal_event2str, zap_signal_event_t)
typedef enum {
ZAP_EVENT_NONE,
ZAP_EVENT_DTMF,
ZAP_EVENT_OOB,
ZAP_EVENT_COUNT
} zap_event_type_t;
typedef enum {
ZAP_TOP_DOWN,
ZAP_BOTTOM_UP
} zap_direction_t;
typedef enum {
ZAP_SUCCESS,
ZAP_FAIL,
ZAP_MEMERR,
ZAP_TIMEOUT,
ZAP_NOTIMPL,
ZAP_CHECKSUM_ERROR,
ZAP_STATUS_COUNT,
ZAP_BREAK
} zap_status_t;
typedef enum {
ZAP_NO_FLAGS = 0,
ZAP_READ = (1 << 0),
ZAP_WRITE = (1 << 1),
ZAP_EVENTS = (1 << 2)
} zap_wait_flag_t;
typedef enum {
ZAP_CODEC_ULAW = 0,
ZAP_CODEC_ALAW = 8,
ZAP_CODEC_SLIN = 10,
ZAP_CODEC_NONE = (1 << 30)
} zap_codec_t;
typedef enum {
ZAP_TONE_DTMF = (1 << 0)
} zap_tone_type_t;
typedef enum {
ZAP_COMMAND_NOOP,
ZAP_COMMAND_SET_INTERVAL,
ZAP_COMMAND_GET_INTERVAL,
ZAP_COMMAND_SET_CODEC,
ZAP_COMMAND_GET_CODEC,
ZAP_COMMAND_SET_NATIVE_CODEC,
ZAP_COMMAND_GET_NATIVE_CODEC,
ZAP_COMMAND_ENABLE_DTMF_DETECT,
ZAP_COMMAND_DISABLE_DTMF_DETECT,
ZAP_COMMAND_SEND_DTMF,
ZAP_COMMAND_SET_DTMF_ON_PERIOD,
ZAP_COMMAND_GET_DTMF_ON_PERIOD,
ZAP_COMMAND_SET_DTMF_OFF_PERIOD,
ZAP_COMMAND_GET_DTMF_OFF_PERIOD,
ZAP_COMMAND_GENERATE_RING_ON,
ZAP_COMMAND_GENERATE_RING_OFF,
ZAP_COMMAND_OFFHOOK,
ZAP_COMMAND_ONHOOK,
ZAP_COMMAND_FLASH,
ZAP_COMMAND_WINK,
ZAP_COMMAND_ENABLE_PROGRESS_DETECT,
ZAP_COMMAND_DISABLE_PROGRESS_DETECT,
ZAP_COMMAND_TRACE_INPUT,
ZAP_COMMAND_TRACE_OUTPUT,
ZAP_COMMAND_TRACE_END_ALL,
ZAP_COMMAND_ENABLE_CALLERID_DETECT,
ZAP_COMMAND_DISABLE_CALLERID_DETECT,
ZAP_COMMAND_ENABLE_ECHOCANCEL,
ZAP_COMMAND_DISABLE_ECHOCANCEL,
ZAP_COMMAND_ENABLE_ECHOTRAIN,
ZAP_COMMAND_DISABLE_ECHOTRAIN,
ZAP_COMMAND_SET_CAS_BITS,
ZAP_COMMAND_GET_CAS_BITS,
ZAP_COMMAND_SET_RX_GAIN,
ZAP_COMMAND_GET_RX_GAIN,
ZAP_COMMAND_SET_TX_GAIN,
ZAP_COMMAND_GET_TX_GAIN,
ZAP_COMMAND_FLUSH_TX_BUFFERS,
ZAP_COMMAND_FLUSH_RX_BUFFERS,
ZAP_COMMAND_FLUSH_BUFFERS,
ZAP_COMMAND_SET_PRE_BUFFER_SIZE,
ZAP_COMMAND_ENABLE_LOOP,
ZAP_COMMAND_DISABLE_LOOP,
ZAP_COMMAND_COUNT
} zap_command_t;
typedef enum {
ZAP_SPAN_CONFIGURED = (1 << 0),
ZAP_SPAN_READY = (1 << 1),
ZAP_SPAN_STATE_CHANGE = (1 << 2),
ZAP_SPAN_SUSPENDED = (1 << 3),
ZAP_SPAN_IN_THREAD = (1 << 4),
ZAP_SPAN_STOP_THREAD = (1 << 5)
} zap_span_flag_t;
typedef enum {
ZAP_CHAN_TYPE_B,
ZAP_CHAN_TYPE_DQ921,
ZAP_CHAN_TYPE_DQ931,
ZAP_CHAN_TYPE_FXS,
ZAP_CHAN_TYPE_FXO,
ZAP_CHAN_TYPE_EM,
ZAP_CHAN_TYPE_CAS,
ZAP_CHAN_TYPE_COUNT
} zap_chan_type_t;
#define CHAN_TYPE_STRINGS "B", "DQ921", "DQ931", "FXS", "FXO", "EM", "CAS", "INVALID"
ZAP_STR2ENUM_P(zap_str2zap_chan_type, zap_chan_type2str, zap_chan_type_t)
#define ZAP_IS_VOICE_CHANNEL(zap_chan) ((zap_chan)->type != ZAP_CHAN_TYPE_DQ921 && (zap_chan)->type != ZAP_CHAN_TYPE_DQ931)
typedef enum {
ZAP_CHANNEL_FEATURE_DTMF_DETECT = (1 << 0),
ZAP_CHANNEL_FEATURE_DTMF_GENERATE = (1 << 1),
ZAP_CHANNEL_FEATURE_CODECS = (1 << 2),
ZAP_CHANNEL_FEATURE_INTERVAL = (1 << 3),
ZAP_CHANNEL_FEATURE_CALLERID = (1 << 4),
ZAP_CHANNEL_FEATURE_PROGRESS = (1 << 5),
ZAP_CHANNEL_FEATURE_CALLWAITING = (1 << 6)
} zap_channel_feature_t;
typedef enum {
ZAP_CHANNEL_STATE_DOWN,
ZAP_CHANNEL_STATE_HOLD,
ZAP_CHANNEL_STATE_SUSPENDED,
ZAP_CHANNEL_STATE_DIALTONE,
ZAP_CHANNEL_STATE_COLLECT,
ZAP_CHANNEL_STATE_RING,
ZAP_CHANNEL_STATE_BUSY,
ZAP_CHANNEL_STATE_ATTN,
ZAP_CHANNEL_STATE_GENRING,
ZAP_CHANNEL_STATE_DIALING,
ZAP_CHANNEL_STATE_GET_CALLERID,
ZAP_CHANNEL_STATE_CALLWAITING,
ZAP_CHANNEL_STATE_RESTART,
ZAP_CHANNEL_STATE_PROGRESS,
ZAP_CHANNEL_STATE_PROGRESS_MEDIA,
ZAP_CHANNEL_STATE_UP,
ZAP_CHANNEL_STATE_IDLE,
ZAP_CHANNEL_STATE_TERMINATING,
ZAP_CHANNEL_STATE_CANCEL,
ZAP_CHANNEL_STATE_HANGUP,
ZAP_CHANNEL_STATE_HANGUP_COMPLETE,
ZAP_CHANNEL_STATE_IN_LOOP,
ZAP_CHANNEL_STATE_INVALID
} zap_channel_state_t;
#define CHANNEL_STATE_STRINGS "DOWN", "HOLD", "SUSPENDED", "DIALTONE", "COLLECT", \
"RING", "BUSY", "ATTN", "GENRING", "DIALING", "GET_CALLERID", "CALLWAITING", \
"RESTART", "PROGRESS", "PROGRESS_MEDIA", "UP", "IDLE", "TERMINATING", "CANCEL", \
"HANGUP", "HANGUP_COMPLETE", "IN_LOOP", "INVALID"
ZAP_STR2ENUM_P(zap_str2zap_channel_state, zap_channel_state2str, zap_channel_state_t)
typedef enum {
ZAP_CHANNEL_CONFIGURED = (1 << 0),
ZAP_CHANNEL_READY = (1 << 1),
ZAP_CHANNEL_OPEN = (1 << 2),
ZAP_CHANNEL_DTMF_DETECT = (1 << 3),
ZAP_CHANNEL_SUPRESS_DTMF = (1 << 4),
ZAP_CHANNEL_TRANSCODE = (1 << 5),
ZAP_CHANNEL_BUFFER = (1 << 6),
ZAP_CHANNEL_EVENT = (1 << 7),
ZAP_CHANNEL_INTHREAD = (1 << 8),
ZAP_CHANNEL_WINK = (1 << 9),
ZAP_CHANNEL_FLASH = (1 << 10),
ZAP_CHANNEL_STATE_CHANGE = (1 << 11),
ZAP_CHANNEL_HOLD = (1 << 12),
ZAP_CHANNEL_INUSE = (1 << 13),
ZAP_CHANNEL_OFFHOOK = (1 << 14),
ZAP_CHANNEL_RINGING = (1 << 15),
ZAP_CHANNEL_PROGRESS_DETECT = (1 << 16),
ZAP_CHANNEL_CALLERID_DETECT = (1 << 17),
ZAP_CHANNEL_OUTBOUND = (1 << 18),
ZAP_CHANNEL_SUSPENDED = (1 << 19),
ZAP_CHANNEL_3WAY = (1 << 20),
ZAP_CHANNEL_PROGRESS = (1 << 21),
ZAP_CHANNEL_MEDIA = (1 << 22),
ZAP_CHANNEL_ANSWERED = (1 << 23),
ZAP_CHANNEL_MUTE = (1 << 24),
ZAP_CHANNEL_USE_RX_GAIN = (1 << 25),
ZAP_CHANNEL_USE_TX_GAIN = (1 << 26),
} zap_channel_flag_t;
typedef enum {
ZSM_NONE,
ZSM_UNACCEPTABLE,
ZSM_ACCEPTABLE
} zap_state_map_type_t;
typedef enum {
ZSD_INBOUND,
ZSD_OUTBOUND,
} zap_state_direction_t;
#define ZAP_MAP_NODE_SIZE 512
#define ZAP_MAP_MAX ZAP_CHANNEL_STATE_INVALID+2
struct zap_state_map_node {
zap_state_direction_t direction;
zap_state_map_type_t type;
zap_channel_state_t check_states[ZAP_MAP_MAX];
zap_channel_state_t states[ZAP_MAP_MAX];
};
typedef struct zap_state_map_node zap_state_map_node_t;
struct zap_state_map {
zap_state_map_node_t nodes[ZAP_MAP_NODE_SIZE];
};
typedef struct zap_state_map zap_state_map_t;
typedef struct zap_channel zap_channel_t;
typedef struct zap_event zap_event_t;
typedef struct zap_sigmsg zap_sigmsg_t;
typedef struct zap_span zap_span_t;
typedef struct zap_caller_data zap_caller_data_t;
typedef struct zap_io_interface zap_io_interface_t;
struct zap_stream_handle;
typedef struct zap_stream_handle zap_stream_handle_t;
typedef zap_status_t (*zap_stream_handle_raw_write_function_t) (zap_stream_handle_t *handle, uint8_t *data, zap_size_t datalen);
typedef zap_status_t (*zap_stream_handle_write_function_t) (zap_stream_handle_t *handle, const char *fmt, ...);
#define ZIO_CHANNEL_REQUEST_ARGS (zap_span_t *span, uint32_t chan_id, zap_direction_t direction, zap_caller_data_t *caller_data, zap_channel_t **zchan)
#define ZIO_CHANNEL_OUTGOING_CALL_ARGS (zap_channel_t *zchan)
#define ZIO_SPAN_POLL_EVENT_ARGS (zap_span_t *span, uint32_t ms)
#define ZIO_SPAN_NEXT_EVENT_ARGS (zap_span_t *span, zap_event_t **event)
#define ZIO_SIGNAL_CB_ARGS (zap_sigmsg_t *sigmsg)
#define ZIO_EVENT_CB_ARGS (zap_channel_t *zchan, zap_event_t *event)
#define ZIO_CODEC_ARGS (void *data, zap_size_t max, zap_size_t *datalen)
#define ZIO_CONFIGURE_SPAN_ARGS (zap_span_t *span, const char *str, zap_chan_type_t type, char *name, char *number)
#define ZIO_CONFIGURE_ARGS (const char *category, const char *var, const char *val, int lineno)
#define ZIO_OPEN_ARGS (zap_channel_t *zchan)
#define ZIO_CLOSE_ARGS (zap_channel_t *zchan)
#define ZIO_CHANNEL_DESTROY_ARGS (zap_channel_t *zchan)
#define ZIO_SPAN_DESTROY_ARGS (zap_span_t *span)
#define ZIO_COMMAND_ARGS (zap_channel_t *zchan, zap_command_t command, void *obj)
#define ZIO_WAIT_ARGS (zap_channel_t *zchan, zap_wait_flag_t *flags, int32_t to)
#define ZIO_GET_ALARMS_ARGS (zap_channel_t *zchan)
#define ZIO_READ_ARGS (zap_channel_t *zchan, void *data, zap_size_t *datalen)
#define ZIO_WRITE_ARGS (zap_channel_t *zchan, void *data, zap_size_t *datalen)
#define ZIO_IO_LOAD_ARGS (zap_io_interface_t **zio)
#define ZIO_IO_UNLOAD_ARGS (void)
#define ZIO_SIG_LOAD_ARGS (void)
#define ZIO_SIG_CONFIGURE_ARGS (zap_span_t *span, zio_signal_cb_t sig_cb, va_list ap)
#define ZIO_SIG_UNLOAD_ARGS (void)
#define ZIO_API_ARGS (zap_stream_handle_t *stream, const char *data)
typedef zap_status_t (*zio_channel_request_t) ZIO_CHANNEL_REQUEST_ARGS ;
typedef zap_status_t (*zio_channel_outgoing_call_t) ZIO_CHANNEL_OUTGOING_CALL_ARGS ;
typedef zap_status_t (*zio_span_poll_event_t) ZIO_SPAN_POLL_EVENT_ARGS ;
typedef zap_status_t (*zio_span_next_event_t) ZIO_SPAN_NEXT_EVENT_ARGS ;
typedef zap_status_t (*zio_signal_cb_t) ZIO_SIGNAL_CB_ARGS ;
typedef zap_status_t (*zio_event_cb_t) ZIO_EVENT_CB_ARGS ;
typedef zap_status_t (*zio_codec_t) ZIO_CODEC_ARGS ;
typedef zap_status_t (*zio_configure_span_t) ZIO_CONFIGURE_SPAN_ARGS ;
typedef zap_status_t (*zio_configure_t) ZIO_CONFIGURE_ARGS ;
typedef zap_status_t (*zio_open_t) ZIO_OPEN_ARGS ;
typedef zap_status_t (*zio_close_t) ZIO_CLOSE_ARGS ;
typedef zap_status_t (*zio_channel_destroy_t) ZIO_CHANNEL_DESTROY_ARGS ;
typedef zap_status_t (*zio_span_destroy_t) ZIO_SPAN_DESTROY_ARGS ;
typedef zap_status_t (*zio_get_alarms_t) ZIO_GET_ALARMS_ARGS ;
typedef zap_status_t (*zio_command_t) ZIO_COMMAND_ARGS ;
typedef zap_status_t (*zio_wait_t) ZIO_WAIT_ARGS ;
typedef zap_status_t (*zio_read_t) ZIO_READ_ARGS ;
typedef zap_status_t (*zio_write_t) ZIO_WRITE_ARGS ;
typedef zap_status_t (*zio_io_load_t) ZIO_IO_LOAD_ARGS ;
typedef zap_status_t (*zio_sig_load_t) ZIO_SIG_LOAD_ARGS ;
typedef zap_status_t (*zio_sig_configure_t) ZIO_SIG_CONFIGURE_ARGS ;
typedef zap_status_t (*zio_io_unload_t) ZIO_IO_UNLOAD_ARGS ;
typedef zap_status_t (*zio_sig_unload_t) ZIO_SIG_UNLOAD_ARGS ;
typedef zap_status_t (*zio_api_t) ZIO_API_ARGS ;
#define ZIO_CHANNEL_REQUEST_FUNCTION(name) zap_status_t name ZIO_CHANNEL_REQUEST_ARGS
#define ZIO_CHANNEL_OUTGOING_CALL_FUNCTION(name) zap_status_t name ZIO_CHANNEL_OUTGOING_CALL_ARGS
#define ZIO_SPAN_POLL_EVENT_FUNCTION(name) zap_status_t name ZIO_SPAN_POLL_EVENT_ARGS
#define ZIO_SPAN_NEXT_EVENT_FUNCTION(name) zap_status_t name ZIO_SPAN_NEXT_EVENT_ARGS
#define ZIO_SIGNAL_CB_FUNCTION(name) zap_status_t name ZIO_SIGNAL_CB_ARGS
#define ZIO_EVENT_CB_FUNCTION(name) zap_status_t name ZIO_EVENT_CB_ARGS
#define ZIO_CODEC_FUNCTION(name) OZ_DECLARE_NONSTD(zap_status_t) name ZIO_CODEC_ARGS
#define ZIO_CONFIGURE_SPAN_FUNCTION(name) zap_status_t name ZIO_CONFIGURE_SPAN_ARGS
#define ZIO_CONFIGURE_FUNCTION(name) zap_status_t name ZIO_CONFIGURE_ARGS
#define ZIO_OPEN_FUNCTION(name) zap_status_t name ZIO_OPEN_ARGS
#define ZIO_CLOSE_FUNCTION(name) zap_status_t name ZIO_CLOSE_ARGS
#define ZIO_CHANNEL_DESTROY_FUNCTION(name) zap_status_t name ZIO_CHANNEL_DESTROY_ARGS
#define ZIO_SPAN_DESTROY_FUNCTION(name) zap_status_t name ZIO_SPAN_DESTROY_ARGS
#define ZIO_GET_ALARMS_FUNCTION(name) zap_status_t name ZIO_GET_ALARMS_ARGS
#define ZIO_COMMAND_FUNCTION(name) zap_status_t name ZIO_COMMAND_ARGS
#define ZIO_WAIT_FUNCTION(name) zap_status_t name ZIO_WAIT_ARGS
#define ZIO_READ_FUNCTION(name) zap_status_t name ZIO_READ_ARGS
#define ZIO_WRITE_FUNCTION(name) zap_status_t name ZIO_WRITE_ARGS
#define ZIO_IO_LOAD_FUNCTION(name) zap_status_t name ZIO_IO_LOAD_ARGS
#define ZIO_SIG_LOAD_FUNCTION(name) zap_status_t name ZIO_SIG_LOAD_ARGS
#define ZIO_SIG_CONFIGURE_FUNCTION(name) zap_status_t name ZIO_SIG_CONFIGURE_ARGS
#define ZIO_IO_UNLOAD_FUNCTION(name) zap_status_t name ZIO_IO_UNLOAD_ARGS
#define ZIO_SIG_UNLOAD_FUNCTION(name) zap_status_t name ZIO_SIG_UNLOAD_ARGS
#define ZIO_API_FUNCTION(name) zap_status_t name ZIO_API_ARGS
#include "zap_dso.h"
typedef struct {
char name[256];
zio_io_load_t io_load;
zio_io_unload_t io_unload;
zio_sig_load_t sig_load;
zio_sig_configure_t sig_configure;
zio_sig_unload_t sig_unload;
zap_dso_lib_t lib;
char path[256];
} zap_module_t;
#ifndef __FUNCTION__
#define __FUNCTION__ (const char *)__func__
#endif
#define ZAP_PRE __FILE__, __FUNCTION__, __LINE__
#define ZAP_LOG_LEVEL_DEBUG 7
#define ZAP_LOG_LEVEL_INFO 6
#define ZAP_LOG_LEVEL_NOTICE 5
#define ZAP_LOG_LEVEL_WARNING 4
#define ZAP_LOG_LEVEL_ERROR 3
#define ZAP_LOG_LEVEL_CRIT 2
#define ZAP_LOG_LEVEL_ALERT 1
#define ZAP_LOG_LEVEL_EMERG 0
#define ZAP_LOG_DEBUG ZAP_PRE, ZAP_LOG_LEVEL_DEBUG
#define ZAP_LOG_INFO ZAP_PRE, ZAP_LOG_LEVEL_INFO
#define ZAP_LOG_NOTICE ZAP_PRE, ZAP_LOG_LEVEL_NOTICE
#define ZAP_LOG_WARNING ZAP_PRE, ZAP_LOG_LEVEL_WARNING
#define ZAP_LOG_ERROR ZAP_PRE, ZAP_LOG_LEVEL_ERROR
#define ZAP_LOG_CRIT ZAP_PRE, ZAP_LOG_LEVEL_CRIT
#define ZAP_LOG_ALERT ZAP_PRE, ZAP_LOG_LEVEL_ALERT
#define ZAP_LOG_EMERG ZAP_PRE, ZAP_LOG_LEVEL_EMERG
typedef struct zap_fsk_data_state zap_fsk_data_state_t;
typedef int (*zap_fsk_data_decoder_t)(zap_fsk_data_state_t *state);
typedef zap_status_t (*zap_fsk_write_sample_t)(int16_t *buf, zap_size_t buflen, void *user_data);
typedef void (*zap_logger_t)(const char *file, const char *func, int line, int level, const char *fmt, ...);
typedef struct hashtable zap_hash_t;
typedef struct hashtable_iterator zap_hash_iterator_t;
typedef struct key zap_hash_key_t;
typedef struct value zap_hash_val_t;
typedef struct zap_bitstream zap_bitstream_t;
typedef struct zap_fsk_modulator zap_fsk_modulator_t;
typedef zap_status_t (*zap_span_start_t)(zap_span_t *span);
typedef zap_status_t (*zap_span_stop_t)(zap_span_t *span);
typedef enum {
ZAP_CAUSE_NONE = 0,
ZAP_CAUSE_UNALLOCATED = 1,
ZAP_CAUSE_NO_ROUTE_TRANSIT_NET = 2,
ZAP_CAUSE_NO_ROUTE_DESTINATION = 3,
ZAP_CAUSE_CHANNEL_UNACCEPTABLE = 6,
ZAP_CAUSE_CALL_AWARDED_DELIVERED = 7,
ZAP_CAUSE_NORMAL_CLEARING = 16,
ZAP_CAUSE_USER_BUSY = 17,
ZAP_CAUSE_NO_USER_RESPONSE = 18,
ZAP_CAUSE_NO_ANSWER = 19,
ZAP_CAUSE_SUBSCRIBER_ABSENT = 20,
ZAP_CAUSE_CALL_REJECTED = 21,
ZAP_CAUSE_NUMBER_CHANGED = 22,
ZAP_CAUSE_REDIRECTION_TO_NEW_DESTINATION = 23,
ZAP_CAUSE_EXCHANGE_ROUTING_ERROR = 25,
ZAP_CAUSE_DESTINATION_OUT_OF_ORDER = 27,
ZAP_CAUSE_INVALID_NUMBER_FORMAT = 28,
ZAP_CAUSE_FACILITY_REJECTED = 29,
ZAP_CAUSE_RESPONSE_TO_STATUS_ENQUIRY = 30,
ZAP_CAUSE_NORMAL_UNSPECIFIED = 31,
ZAP_CAUSE_NORMAL_CIRCUIT_CONGESTION = 34,
ZAP_CAUSE_NETWORK_OUT_OF_ORDER = 38,
ZAP_CAUSE_NORMAL_TEMPORARY_FAILURE = 41,
ZAP_CAUSE_SWITCH_CONGESTION = 42,
ZAP_CAUSE_ACCESS_INFO_DISCARDED = 43,
ZAP_CAUSE_REQUESTED_CHAN_UNAVAIL = 44,
ZAP_CAUSE_PRE_EMPTED = 45,
ZAP_CAUSE_FACILITY_NOT_SUBSCRIBED = 50,
ZAP_CAUSE_OUTGOING_CALL_BARRED = 52,
ZAP_CAUSE_INCOMING_CALL_BARRED = 54,
ZAP_CAUSE_BEARERCAPABILITY_NOTAUTH = 57,
ZAP_CAUSE_BEARERCAPABILITY_NOTAVAIL = 58,
ZAP_CAUSE_SERVICE_UNAVAILABLE = 63,
ZAP_CAUSE_BEARERCAPABILITY_NOTIMPL = 65,
ZAP_CAUSE_CHAN_NOT_IMPLEMENTED = 66,
ZAP_CAUSE_FACILITY_NOT_IMPLEMENTED = 69,
ZAP_CAUSE_SERVICE_NOT_IMPLEMENTED = 79,
ZAP_CAUSE_INVALID_CALL_REFERENCE = 81,
ZAP_CAUSE_INCOMPATIBLE_DESTINATION = 88,
ZAP_CAUSE_INVALID_MSG_UNSPECIFIED = 95,
ZAP_CAUSE_MANDATORY_IE_MISSING = 96,
ZAP_CAUSE_MESSAGE_TYPE_NONEXIST = 97,
ZAP_CAUSE_WRONG_MESSAGE = 98,
ZAP_CAUSE_IE_NONEXIST = 99,
ZAP_CAUSE_INVALID_IE_CONTENTS = 100,
ZAP_CAUSE_WRONG_CALL_STATE = 101,
ZAP_CAUSE_RECOVERY_ON_TIMER_EXPIRE = 102,
ZAP_CAUSE_MANDATORY_IE_LENGTH_ERROR = 103,
ZAP_CAUSE_PROTOCOL_ERROR = 111,
ZAP_CAUSE_INTERWORKING = 127,
ZAP_CAUSE_SUCCESS = 142,
ZAP_CAUSE_ORIGINATOR_CANCEL = 487,
ZAP_CAUSE_CRASH = 500,
ZAP_CAUSE_SYSTEM_SHUTDOWN = 501,
ZAP_CAUSE_LOSE_RACE = 502,
ZAP_CAUSE_MANAGER_REQUEST = 503,
ZAP_CAUSE_BLIND_TRANSFER = 600,
ZAP_CAUSE_ATTENDED_TRANSFER = 601,
ZAP_CAUSE_ALLOTTED_TIMEOUT = 602,
ZAP_CAUSE_USER_CHALLENGE = 603,
ZAP_CAUSE_MEDIA_TIMEOUT = 604
} zap_call_cause_t;
#endif
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/

View File

@ -1,132 +0,0 @@
/*****************************************************************************
FileName: 5ESSStateNT.c
Contents: AT&T 5ESS ISDN State Engine for NT (Network Mode).
The controlling state engine for Q.931 is the state engine
on the NT side. The state engine on the TE side is a slave
of this. The TE side maintain it's own states as described in
ITU-T Q931, but will in raise conditions be overridden by
the NT side.
License/Copyright:
Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved.
email:janvb@caselaboratories.com
Copyright (c) 2007, Michael Jerris. All rights reserved.
email:mike@jerris.com
Copyright (c) 2007, Michael S. Collins, All rights reserved.
email:mcollins@fcnetwork.com
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the Case Labs, Ltd nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
#include "5ESS.h"
/*****************************************************************************
Function: ATT5ESSCreateNT
Description: Will create the AT&T 5ESS ISDN NT as a Dialect in the stack. The first
bulk set up the message handlers, the second bulk the IE
encoders/coders, and the last bulk set up the state table.
Parameters: i Dialect index
*****************************************************************************/
void ATT5ESSCreateNT(L3UCHAR i)
{
Q931SetMesProc(Q931mes_ALERTING, i, Q931ProcAlertingNT, Q931Umes_Alerting, Q931Pmes_Alerting);
Q931SetMesProc(Q931mes_CALL_PROCEEDING, i, Q931ProcCallProceedingNT, Q931Umes_CallProceeding, Q931Pmes_CallProceeding);
Q931SetMesProc(Q931mes_CONNECT, i, Q931ProcConnectNT, Q931Umes_Connect, Q931Pmes_Connect);
Q931SetMesProc(Q931mes_CONNECT_ACKNOWLEDGE, i, Q931ProcConnectAckNT, Q931Umes_ConnectAck, Q931Pmes_ConnectAck);
Q931SetMesProc(Q931mes_PROGRESS, i, Q931ProcProgressNT, Q931Umes_Progress, Q931Pmes_Progress);
Q931SetMesProc(Q931mes_SETUP, i, Q931ProcSetupNT, Q931Umes_Setup, Q931Pmes_Setup);
Q931SetMesProc(Q931mes_SETUP_ACKNOWLEDGE, i, Q931ProcSetupAckNT, Q931Umes_SetupAck, Q931Pmes_SetupAck);
Q931SetMesProc(Q931mes_RESUME, i, Q931ProcResumeNT, Q931Umes_Resume, Q931Pmes_Resume);
Q931SetMesProc(Q931mes_RESUME_ACKNOWLEDGE, i, Q931ProcResumeAckNT, Q931Umes_ResumeAck, Q931Pmes_ResumeAck);
Q931SetMesProc(Q931mes_RESUME_REJECT, i, Q931ProcResumeRejectNT, Q931Umes_ResumeReject, Q931Pmes_ResumeReject);
Q931SetMesProc(Q931mes_SUSPEND, i, Q931ProcSuspendNT, Q931Umes_Suspend, Q931Pmes_Suspend);
Q931SetMesProc(Q931mes_SUSPEND_ACKNOWLEDGE, i, Q931ProcSuspendAckNT, Q931Umes_SuspendAck, Q931Pmes_SuspendAck);
Q931SetMesProc(Q931mes_SUSPEND_REJECT, i, Q931ProcSuspendRejectNT, Q931Umes_SuspendReject, Q931Pmes_SuspendReject);
Q931SetMesProc(Q931mes_USER_INFORMATION, i, Q931ProcUserInformationNT, Q931Umes_UserInformation, Q931Pmes_UserInformation);
Q931SetMesProc(Q931mes_DISCONNECT, i, Q931ProcDisconnectNT, Q931Umes_Disconnect, Q931Pmes_Disconnect);
Q931SetMesProc(Q931mes_RELEASE, i, Q931ProcReleaseNT, Q931Umes_Release, Q931Pmes_Release);
Q931SetMesProc(Q931mes_RELEASE_COMPLETE, i, Q931ProcReleaseCompleteNT, Q931Umes_ReleaseComplete, Q931Pmes_ReleaseComplete);
Q931SetMesProc(Q931mes_RESTART, i, Q931ProcRestartNT, Q931Umes_Restart, Q931Pmes_Restart);
Q931SetMesProc(Q931mes_RESTART_ACKNOWLEDGE, i, Q931ProcRestartAckNT, Q931Umes_RestartAck, Q931Pmes_RestartAck);
Q931SetMesProc(Q931mes_CONGESTION_CONTROL, i, Q931ProcCongestionControlNT, Q931Umes_CongestionControl, Q931Pmes_CongestionControl);
Q931SetMesProc(Q931mes_INFORMATION, i, Q931ProcInformationNT, Q931Umes_Information, Q931Pmes_Information);
Q931SetMesProc(Q931mes_NOTIFY, i, Q931ProcNotifyNT, Q931Umes_Notify, Q931Pmes_Notify);
Q931SetMesProc(Q931mes_STATUS, i, Q931ProcStatusNT, Q931Umes_Status, Q931Pmes_Status);
Q931SetMesProc(Q931mes_STATUS_ENQUIRY, i, Q931ProcStatusEnquiryNT, Q931Umes_StatusEnquiry, Q931Pmes_StatusEnquiry);
Q931SetMesProc(Q931mes_SEGMENT, i, Q931ProcSegmentNT, Q931Umes_Segment, Q931Pmes_Segment);
Q931SetMesProc(Q932mes_FACILITY, i, Q932ProcFacilityNT, Q932Umes_Facility, Q932Pmes_Facility);
Q931SetMesProc(Q932mes_HOLD, i, Q932ProcHoldNT, Q932Umes_Hold, Q932Pmes_Hold);
Q931SetMesProc(Q932mes_HOLD_ACKNOWLEDGE, i, Q932ProcHoldAckNT, Q932Umes_HoldAck, Q932Pmes_HoldAck);
Q931SetMesProc(Q932mes_HOLD_REJECT, i, Q932ProcHoldRejectNT, Q932Umes_HoldReject, Q932Pmes_HoldReject);
Q931SetMesProc(Q932mes_REGISTER, i, Q932ProcRegisterNT, Q932Umes_Register, Q932Pmes_Register);
Q931SetMesProc(Q932mes_RETRIEVE, i, Q932ProcRetrieveNT, Q932Umes_Retrieve, Q932Pmes_Retrieve);
Q931SetMesProc(Q932mes_RETRIEVE_ACKNOWLEDGE, i, Q932ProcRetrieveAckNT, Q932Umes_RetrieveAck, Q932Pmes_RetrieveAck);
Q931SetMesProc(Q932mes_RETRIEVE_REJECT, i, Q932ProcRetrieveRejectNT, Q932Umes_RetrieveReject, Q932Pmes_RetrieveReject);
/* Set up the IE encoder/decoder handle table.*/
Q931SetIEProc(Q931ie_SEGMENTED_MESSAGE, i, Q931Pie_Segment, Q931Uie_Segment);
Q931SetIEProc(Q931ie_BEARER_CAPABILITY, i, Q931Pie_BearerCap, Q931Uie_BearerCap);
Q931SetIEProc(Q931ie_CAUSE, i, Q931Pie_Cause, Q931Uie_Cause);
Q931SetIEProc(Q931ie_CALL_IDENTITY, i, Q931Pie_CallID, Q931Uie_CallID);
Q931SetIEProc(Q931ie_CALL_STATE, i, Q931Pie_CallState, Q931Uie_CallState);
Q931SetIEProc(Q931ie_CHANNEL_IDENTIFICATION, i, Q931Pie_ChanID, Q931Uie_ChanID);
Q931SetIEProc(Q931ie_PROGRESS_INDICATOR, i, Q931Pie_ProgInd, Q931Uie_ProgInd);
Q931SetIEProc(Q931ie_NETWORK_SPECIFIC_FACILITIES, i, Q931Pie_NetFac, Q931Uie_NetFac);
Q931SetIEProc(Q931ie_NOTIFICATION_INDICATOR, i, Q931Pie_NotifInd, Q931Uie_NotifInd);
Q931SetIEProc(Q931ie_DISPLAY, i, Q931Pie_Display, Q931Uie_Display);
Q931SetIEProc(Q931ie_DATETIME, i, Q931Pie_DateTime, Q931Uie_DateTime);
Q931SetIEProc(Q931ie_KEYPAD_FACILITY, i, Q931Pie_KeypadFac, Q931Uie_KeypadFac);
Q931SetIEProc(Q931ie_SIGNAL, i, Q931Pie_Signal, Q931Uie_Signal);
Q931SetIEProc(Q931ie_TRANSIT_DELAY_SELECTION_AND_IND, i, Q931Pie_TransNetSel, Q931Uie_TransNetSel);
Q931SetIEProc(Q931ie_CALLING_PARTY_NUMBER, i, Q931Pie_CallingNum, Q931Uie_CallingNum);
Q931SetIEProc(Q931ie_CALLING_PARTY_SUBADDRESS, i, Q931Pie_CallingSub, Q931Uie_CallingSub);
Q931SetIEProc(Q931ie_CALLED_PARTY_NUMBER, i, Q931Pie_CalledNum, Q931Uie_CalledNum);
Q931SetIEProc(Q931ie_CALLED_PARTY_SUBADDRESS, i, Q931Pie_CalledSub, Q931Uie_CalledSub);
Q931SetIEProc(Q931ie_TRANSIT_NETWORK_SELECTION, i, Q931Pie_TransNetSel, Q931Uie_TransNetSel);
Q931SetIEProc(Q931ie_RESTART_INDICATOR, i, Q931Pie_RestartInd, Q931Uie_RestartInd);
Q931SetIEProc(Q931ie_LOW_LAYER_COMPATIBILITY, i, Q931Pie_LLComp, Q931Uie_LLComp);
Q931SetIEProc(Q931ie_HIGH_LAYER_COMPATIBILITY, i, Q931Pie_HLComp, Q931Uie_HLComp);
Q931SetIEProc(Q931ie_USER_USER, i, Q931Pie_UserUser, Q931Uie_UserUser);
Q931SetIEProc(Q931ie_GENERIC_DIGITS, i, Q931Pie_GenericDigits, Q931Uie_GenericDigits);
Q931SetIEProc(Q931ie_CONNECTED_NUMBER, i, Q931Pie_Generic, Q931Uie_Generic);
Q931SetIEProc(Q931ie_FACILITY, i, Q931Pie_Generic, Q931Uie_Generic);
/* The following define a state machine. The point is that the Message */
/* procs can when search this to find out if the message/state */
/* combination is legale. If not, the proc for unexpected message apply.*/
/* TODO define state table here */
}

View File

@ -1,291 +0,0 @@
/*****************************************************************************
FileName: 5ESSStateTE.c
Contents: AT&T 5ESS ISDN State Engine for TE (User Mode).
The controlling state engine for Q.931 is the state engine
on the NT side. The state engine on the TE side is a slave
of this. The TE side maintain it's own states as described in
ITU-T Q931, but will in raise conditions be overridden by
the NT side.
This reference implementation uses a process per message,
meaning that each message must check call states. This
is easier for dialect maintenance as each message proc
can be replaced individually. A new TE variant only
need to copy the Q931CreateTE and replace those procs or
need to override.
License/Copyright:
Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved.
email:janvb@caselaboratories.com
Copyright (c) 2007, Michael Jerris. All rights reserved.
email:mike@jerris.com
Copyright (c) 2007, Michael S. Collins, All rights reserved.
email:mcollins@fcnetwork.com
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the Case Labs, Ltd nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
#include "5ESS.h"
extern L3INT Q931L4HeaderSpace;
/*****************************************************************************
Function: ATT5ESSCreateTE
Description: Will create the AT&T 5ESS TE as a Dialect in the stack. The first
bulk set up the message handlers, the second bulk the IE
encoders/coders, and the last bulk set up the state table.
Parameters: i Dialect index
*****************************************************************************/
void ATT5ESSCreateTE(L3UCHAR i)
{
Q931SetMesProc(Q931mes_ALERTING, i, Q931ProcAlertingTE, Q931Umes_Alerting, Q931Pmes_Alerting);
Q931SetMesProc(Q931mes_CALL_PROCEEDING, i, Q931ProcCallProceedingTE, Q931Umes_CallProceeding, Q931Pmes_CallProceeding);
Q931SetMesProc(Q931mes_CONNECT, i, ATT5ESSProc0x07TE, ATT5ESSUmes_0x07, ATT5ESSPmes_0x07);
Q931SetMesProc(Q931mes_CONNECT_ACKNOWLEDGE, i, ATT5ESSProc0x0fTE, ATT5ESSUmes_0x0f, ATT5ESSPmes_0x0f);
Q931SetMesProc(Q931mes_PROGRESS, i, Q931ProcProgressTE, Q931Umes_Progress, Q931Pmes_Progress);
Q931SetMesProc(Q931mes_SETUP, i, Q931ProcSetupTE, ATT5ESSUmes_Setup, ATT5ESSPmes_Setup);
Q931SetMesProc(Q931mes_SETUP_ACKNOWLEDGE, i, Q931ProcSetupAckTE, Q931Umes_SetupAck, Q931Pmes_SetupAck);
Q931SetMesProc(Q931mes_RESUME, i, Q931ProcResumeTE, Q931Umes_Resume, Q931Pmes_Resume);
Q931SetMesProc(Q931mes_RESUME_ACKNOWLEDGE, i, Q931ProcResumeAckTE, Q931Umes_ResumeAck, Q931Pmes_ResumeAck);
Q931SetMesProc(Q931mes_RESUME_REJECT, i, Q931ProcResumeRejectTE, Q931Umes_ResumeReject, Q931Pmes_ResumeReject);
Q931SetMesProc(Q931mes_SUSPEND, i, Q931ProcSuspendTE, Q931Umes_Suspend, Q931Pmes_Suspend);
Q931SetMesProc(Q931mes_SUSPEND_ACKNOWLEDGE, i, Q931ProcSuspendAckTE, Q931Umes_SuspendAck, Q931Pmes_SuspendAck);
Q931SetMesProc(Q931mes_SUSPEND_REJECT, i, Q931ProcSuspendRejectTE, Q931Umes_SuspendReject, Q931Pmes_SuspendReject);
Q931SetMesProc(Q931mes_USER_INFORMATION, i, Q931ProcUserInformationTE, Q931Umes_UserInformation, Q931Pmes_UserInformation);
Q931SetMesProc(Q931mes_DISCONNECT, i, Q931ProcDisconnectTE, Q931Umes_Disconnect, Q931Pmes_Disconnect);
Q931SetMesProc(Q931mes_RELEASE, i, Q931ProcReleaseTE, Q931Umes_Release, Q931Pmes_Release);
Q931SetMesProc(Q931mes_RELEASE_COMPLETE, i, Q931ProcReleaseCompleteTE, Q931Umes_ReleaseComplete, Q931Pmes_ReleaseComplete);
Q931SetMesProc(Q931mes_RESTART, i, Q931ProcRestartTE, Q931Umes_Restart, Q931Pmes_Restart);
Q931SetMesProc(Q931mes_RESTART_ACKNOWLEDGE, i, Q931ProcRestartAckTE, Q931Umes_RestartAck, Q931Pmes_RestartAck);
Q931SetMesProc(Q931mes_CONGESTION_CONTROL, i, Q931ProcCongestionControlTE, Q931Umes_CongestionControl, Q931Pmes_CongestionControl);
Q931SetMesProc(Q931mes_INFORMATION, i, Q931ProcInformationTE, Q931Umes_Information, Q931Pmes_Information);
Q931SetMesProc(Q931mes_NOTIFY, i, Q931ProcNotifyTE, Q931Umes_Notify, Q931Pmes_Notify);
Q931SetMesProc(Q931mes_STATUS, i, Q931ProcStatusTE, Q931Umes_Status, Q931Pmes_Status);
Q931SetMesProc(Q931mes_STATUS_ENQUIRY, i, Q931ProcStatusEnquiryTE, Q931Umes_StatusEnquiry, Q931Pmes_StatusEnquiry);
Q931SetMesProc(Q931mes_SEGMENT, i, Q931ProcSegmentTE, Q931Umes_Segment, Q931Pmes_Segment);
Q931SetMesProc(Q932mes_FACILITY, i, Q932ProcFacilityTE, Q932Umes_Facility, Q932Pmes_Facility);
Q931SetMesProc(Q932mes_HOLD, i, Q932ProcHoldTE, Q932Umes_Hold, Q932Pmes_Hold);
Q931SetMesProc(Q932mes_HOLD_ACKNOWLEDGE, i, Q932ProcHoldAckTE, Q932Umes_HoldAck, Q932Pmes_HoldAck);
Q931SetMesProc(Q932mes_HOLD_REJECT, i, Q932ProcHoldRejectTE, Q932Umes_HoldReject, Q932Pmes_HoldReject);
Q931SetMesProc(Q932mes_REGISTER, i, Q932ProcRegisterTE, Q932Umes_Register, Q932Pmes_Register);
Q931SetMesProc(Q932mes_RETRIEVE, i, Q932ProcRetrieveTE, Q932Umes_Retrieve, Q932Pmes_Retrieve);
Q931SetMesProc(Q932mes_RETRIEVE_ACKNOWLEDGE, i, Q932ProcRetrieveAckTE, Q932Umes_RetrieveAck, Q932Pmes_RetrieveAck);
Q931SetMesProc(Q932mes_RETRIEVE_REJECT, i, Q932ProcRetrieveRejectTE, Q932Umes_RetrieveReject, Q932Pmes_RetrieveReject);
/* Set up the IE encoder/decoder handle table.*/
Q931SetIEProc(Q931ie_SEGMENTED_MESSAGE, i, Q931Pie_Segment, Q931Uie_Segment);
Q931SetIEProc(Q931ie_BEARER_CAPABILITY, i, Q931Pie_BearerCap, Q931Uie_BearerCap);
Q931SetIEProc(Q931ie_CAUSE, i, Q931Pie_Cause, Q931Uie_Cause);
Q931SetIEProc(Q931ie_CALL_IDENTITY, i, Q931Pie_CallID, Q931Uie_CallID);
Q931SetIEProc(Q931ie_CALL_STATE, i, Q931Pie_CallState, Q931Uie_CallState);
Q931SetIEProc(Q931ie_CHANGE_STATUS, i, Q931Pie_ChangeStatus, Q931Uie_ChangeStatus);
Q931SetIEProc(Q931ie_CHANNEL_IDENTIFICATION, i, Q931Pie_ChanID, Q931Uie_ChanID);
Q931SetIEProc(Q931ie_PROGRESS_INDICATOR, i, Q931Pie_ProgInd, Q931Uie_ProgInd);
Q931SetIEProc(Q931ie_NETWORK_SPECIFIC_FACILITIES, i, Q931Pie_NetFac, Q931Uie_NetFac);
Q931SetIEProc(Q931ie_NOTIFICATION_INDICATOR, i, Q931Pie_NotifInd, Q931Uie_NotifInd);
Q931SetIEProc(Q931ie_DISPLAY, i, Q931Pie_Display, Q931Uie_Display);
Q931SetIEProc(Q931ie_DATETIME, i, Q931Pie_DateTime, Q931Uie_DateTime);
Q931SetIEProc(Q931ie_KEYPAD_FACILITY, i, Q931Pie_KeypadFac, Q931Uie_KeypadFac);
Q931SetIEProc(Q931ie_SIGNAL, i, Q931Pie_Signal, Q931Uie_Signal);
Q931SetIEProc(Q931ie_TRANSIT_DELAY_SELECTION_AND_IND, i, Q931Pie_TransNetSel, Q931Uie_TransNetSel);
Q931SetIEProc(Q931ie_CALLING_PARTY_NUMBER, i, Q931Pie_CallingNum, Q931Uie_CallingNum);
Q931SetIEProc(Q931ie_CALLING_PARTY_SUBADDRESS, i, Q931Pie_CallingSub, Q931Uie_CallingSub);
Q931SetIEProc(Q931ie_CALLED_PARTY_NUMBER, i, Q931Pie_CalledNum, Q931Uie_CalledNum);
Q931SetIEProc(Q931ie_CALLED_PARTY_SUBADDRESS, i, Q931Pie_CalledSub, Q931Uie_CalledSub);
Q931SetIEProc(Q931ie_TRANSIT_NETWORK_SELECTION, i, Q931Pie_TransNetSel, Q931Uie_TransNetSel);
Q931SetIEProc(Q931ie_RESTART_INDICATOR, i, Q931Pie_RestartInd, Q931Uie_RestartInd);
Q931SetIEProc(Q931ie_LOW_LAYER_COMPATIBILITY, i, Q931Pie_LLComp, Q931Uie_LLComp);
Q931SetIEProc(Q931ie_HIGH_LAYER_COMPATIBILITY, i, Q931Pie_HLComp, Q931Uie_HLComp);
Q931SetIEProc(Q931ie_USER_USER, i, Q931Pie_UserUser, Q931Uie_UserUser);
Q931SetIEProc(Q931ie_GENERIC_DIGITS, i, Q931Pie_GenericDigits, Q931Uie_GenericDigits);
Q931SetIEProc(Q931ie_CONNECTED_NUMBER, i, Q931Pie_Generic, Q931Uie_Generic);
Q931SetIEProc(Q931ie_FACILITY, i, Q931Pie_Generic, Q931Uie_Generic);
/* The following define a state machine. The point is that the Message */
/* procs can when search this to find out if the message/state */
/* combination is legale. If not, the proc for unexpected message apply.*/
/* State 0 Idle */
Q931AddStateEntry(i, Q931_U0, Q931mes_RESUME, 2);
Q931AddStateEntry(i, Q931_U0, Q931mes_SETUP, 4);
Q931AddStateEntry(i, Q931_U0, Q931mes_SETUP, 2);
Q931AddStateEntry(i, Q931_U0, Q931mes_STATUS, 4);
Q931AddStateEntry(i, Q931_U0, Q931mes_RELEASE, 4);
Q931AddStateEntry(i, Q931_U0, Q931mes_RELEASE_COMPLETE, 4);
/* State 1 Call Initiating */
Q931AddStateEntry(i, Q931_U1, Q931mes_DISCONNECT, 2);
Q931AddStateEntry(i, Q931_U1, Q931mes_SETUP_ACKNOWLEDGE, 4);
Q931AddStateEntry(i, Q931_U1, Q931mes_RELEASE_COMPLETE, 4);
Q931AddStateEntry(i, Q931_U1, Q931mes_CALL_PROCEEDING, 4);
Q931AddStateEntry(i, Q931_U1, Q931mes_ALERTING, 4);
Q931AddStateEntry(i, Q931_U1, Q931mes_CONNECT, 4);
/* State 2 Overlap Sending */
Q931AddStateEntry(i, Q931_U2, Q931mes_INFORMATION, 2);
Q931AddStateEntry(i, Q931_U2, Q931mes_CALL_PROCEEDING, 4);
Q931AddStateEntry(i, Q931_U2, Q931mes_ALERTING, 4);
Q931AddStateEntry(i, Q931_U2, Q931mes_PROGRESS, 4);
Q931AddStateEntry(i, Q931_U2, Q931mes_CONNECT, 4);
Q931AddStateEntry(i, Q931_U2, Q931mes_RELEASE, 2);
/* State 3 Outgoing Call Proceeding */
Q931AddStateEntry(i, Q931_U3, Q931mes_PROGRESS, 4);
Q931AddStateEntry(i, Q931_U3, Q931mes_ALERTING, 4);
Q931AddStateEntry(i, Q931_U3, Q931mes_CONNECT, 4);
Q931AddStateEntry(i, Q931_U3, Q931mes_RELEASE, 2);
/* State 4 Call Delivered */
Q931AddStateEntry(i, Q931_U4, Q931mes_CONNECT, 4);
/* State 6 Call Precent */
Q931AddStateEntry(i, Q931_U6, Q931mes_INFORMATION, 2);
Q931AddStateEntry(i, Q931_U6, Q931mes_ALERTING, 2);
Q931AddStateEntry(i, Q931_U6, Q931mes_CALL_PROCEEDING, 2);
Q931AddStateEntry(i, Q931_U6, Q931mes_CONNECT, 2);
Q931AddStateEntry(i, Q931_U6, Q931mes_RELEASE_COMPLETE, 2);
Q931AddStateEntry(i, Q931_U6, Q931mes_RELEASE, 4);
Q931AddStateEntry(i, Q931_U6, Q931mes_DISCONNECT, 4);
/* State 7 Call Received */
Q931AddStateEntry(i, Q931_U7, Q931mes_CONNECT, 2);
/* State 8 Connect request */
Q931AddStateEntry(i, Q931_U8, Q931mes_CONNECT_ACKNOWLEDGE, 4);
/* State 9 Incoming Call Proceeding */
Q931AddStateEntry(i, Q931_U9, Q931mes_CONNECT, 2);
Q931AddStateEntry(i, Q931_U9, Q931mes_ALERTING, 2);
Q931AddStateEntry(i, Q931_U9, Q931mes_PROGRESS, 2);
/* State 10 Active */
Q931AddStateEntry(i, Q931_U10, Q931mes_SUSPEND, 2);
Q931AddStateEntry(i, Q931_U10, Q931mes_NOTIFY, 4);
Q931AddStateEntry(i, Q931_U10, Q931mes_NOTIFY, 2);
/* State 11 Disconnect Request */
Q931AddStateEntry(i, Q931_U11, Q931mes_RELEASE, 4);
Q931AddStateEntry(i, Q931_U11, Q931mes_DISCONNECT, 4);
Q931AddStateEntry(i, Q931_U11, Q931mes_NOTIFY, 4);
/* State 12 Disconnect Ind */
Q931AddStateEntry(i, Q931_U12, Q931mes_RELEASE, 4);
Q931AddStateEntry(i, Q931_U12, Q931mes_RELEASE, 2);
/* State 15 Suspend Request */
Q931AddStateEntry(i, Q931_U15, Q931mes_SUSPEND_ACKNOWLEDGE, 4);
Q931AddStateEntry(i, Q931_U15, Q931mes_SUSPEND_REJECT, 4);
Q931AddStateEntry(i, Q931_U15, Q931mes_DISCONNECT, 4);
Q931AddStateEntry(i, Q931_U15, Q931mes_RELEASE, 4);
/* TODO
Q931AddStateEntry(i, Q931_U17,
Q931AddStateEntry(i, Q931_U19,
Q931AddStateEntry(i, Q931_U25,
*/
}
/*****************************************************************************
Function: ATT5ESSProc0x0fTE
*****************************************************************************/
L3INT ATT5ESSProc0x0fTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom)
{
Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace];
L3INT callIndex;
L3INT ret = Q931E_NO_ERROR;
if (pMes->ProtDisc == 8) {
/* Find the call using CRV */
ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex);
if (ret != Q931E_NO_ERROR)
return ret;
/* TODO chack against state table for illegal or unexpected message here*/
/* TODO - Set correct timer here */
Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303);
}
if (iFrom == 4) {
/* TODO Add proc here*/
ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size);
}
else if (iFrom ==2) {
/* TODO Add proc here*/
ret = Q931Tx34(pTrunk, buf, pMes->Size);
if (pMes->ProtDisc == 3 && pTrunk->autoServiceAck) {
printf("autoServiceAck is on, responding to Service Req from network...\n");
Q931AckService(pTrunk, buf);
}
}
return ret;
}
/*****************************************************************************
Function: ATT5ESSProc0x07TE
*****************************************************************************/
L3INT ATT5ESSProc0x07TE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom)
{
Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace];
L3INT callIndex;
L3INT ret = Q931E_NO_ERROR;
if (pMes->ProtDisc == 8) {
/* Find the call using CRV */
ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex);
if (ret != Q931E_NO_ERROR)
return ret;
/* TODO chack against state table for illegal or unexpected message here*/
/* TODO - Set correct timer here */
Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303);
}
if (iFrom == 4) {
/* TODO Add proc here*/
ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size);
}
else if (iFrom == 2) {
/* TODO Add proc here*/
ret = Q931Tx34(pTrunk, buf, pMes->Size);
}
return ret;
}

View File

@ -1,361 +0,0 @@
/*****************************************************************************
FileName: 5ESSmes.c
Contents: Pack/Unpack functions. These functions will unpack a 5ESS ISDN
message from the bit packed original format into structs
that contains variables sized by the user. It will also pack
the struct back into a Q.931 message as required.
See 5ESS.h for description.
License/Copyright:
Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved.
email:janvb@caselaboratories.com
Copyright (c) 2007, Michael Jerris. All rights reserved.
email:mike@jerris.com
Copyright (c) 2007, Michael S. Collins, All rights reserved.
email:mcollins@fcnetwork.com
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the Case Labs, Ltd nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
#include "5ESS.h"
/*****************************************************************************
Function: ATT5ESSUmes_Setup
*****************************************************************************/
L3INT ATT5ESSUmes_Setup(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size)
{
L3INT ir = 0;
L3INT OOff = 0;
L3INT rc = Q931E_NO_ERROR;
L3UCHAR last_codeset = 0, codeset = 0;
L3UCHAR shift_nolock = 1;
while (IOff < Size) {
if (shift_nolock) {
codeset = last_codeset;
}
if ((IBuf[IOff] & 0xF0) == Q931ie_SHIFT) {
shift_nolock = (IBuf[IOff] & 0x08);
if (shift_nolock) {
last_codeset = codeset;
}
codeset = ((IBuf[IOff] & 0x07));
IOff++;
}
if (codeset == 0) {
switch (IBuf[IOff])
{
case Q931ie_SENDING_COMPLETE:
case Q931ie_BEARER_CAPABILITY:
case Q931ie_CHANNEL_IDENTIFICATION:
case Q931ie_PROGRESS_INDICATOR:
case Q931ie_NETWORK_SPECIFIC_FACILITIES:
case Q931ie_DISPLAY:
case Q931ie_DATETIME:
case Q931ie_KEYPAD_FACILITY:
case Q931ie_SIGNAL:
case Q931ie_CALLING_PARTY_NUMBER:
case Q931ie_CALLING_PARTY_SUBADDRESS:
case Q931ie_CALLED_PARTY_NUMBER:
case Q931ie_CALLED_PARTY_SUBADDRESS:
case Q931ie_TRANSIT_NETWORK_SELECTION:
case Q931ie_LOW_LAYER_COMPATIBILITY:
case Q931ie_HIGH_LAYER_COMPATIBILITY:
case Q931ie_FACILITY:
rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff);
if (rc != Q931E_NO_ERROR)
return rc;
break;
case Q931ie_REPEAT_INDICATOR:
if (ir < 2) {
rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff);
ir++;
} else {
return Q931E_ILLEGAL_IE;
}
break;
default:
return Q931E_ILLEGAL_IE;
break;
}
} else if (codeset == 6) {
switch (IBuf[IOff])
{
case Q931ie_GENERIC_DIGITS:
rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff);
if (rc != Q931E_NO_ERROR)
return rc;
break;
default:
return Q931E_ILLEGAL_IE;
break;
}
} else if (codeset == 7) {
switch (IBuf[IOff])
{
case Q931ie_DISPLAY:
rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff);
if (rc != Q931E_NO_ERROR)
return rc;
break;
default:
return Q931E_ILLEGAL_IE;
break;
}
} else {
return Q931E_ILLEGAL_IE;
}
}
mes->Size = sizeof(Q931mes_Generic) - 1 + OOff;
return Q931E_NO_ERROR;
}
/*****************************************************************************
Function: ATT5ESSPmes_Setup
Decription: Pack a Q931mes_Generic into a real Q.931 message. The user will
set up a SETUP message and issue this to the stack where it
is processed by Q931ProcSetup that processes and validates
it before it actually sends it out. This function is called
to compute the real Q.931 message.
Parameters: IBuf[IN] Ptr to un-packed struct
ISize[IN] Size of input buffer (unpacked message).
OBuf[OUT] Ptr to packed 'octet' wise message.
OSize[OUT] Size of packed message.
Called By: Q931ProcSetup
*****************************************************************************/
L3INT ATT5ESSPmes_Setup(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize)
{
L3INT rc = Q931E_NO_ERROR;
Q931mes_Generic *pMes = (Q931mes_Generic *)IBuf;
L3INT Octet = 0;
/* Q931 Message Header */
Q931MesgHeader(pTrunk, pMes, OBuf, *OSize, &Octet);
/* Sending Complete */
if (Q931IsIEPresent(pMes->SendComplete)) {
OBuf[Octet++] = (L3UCHAR)(pMes->SendComplete & 0x00ff);
}
/* Repeat Indicator */
if (Q931IsIEPresent(pMes->RepeatInd)) {
OBuf[Octet++] = (L3UCHAR)(pMes->RepeatInd & 0x00ff);
}
/* Bearer capability */
if (Q931IsIEPresent(pMes->BearerCap)) {
if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_BEARER_CAPABILITY](pTrunk, Q931GetIEPtr(pMes->BearerCap,pMes->buf), OBuf, &Octet))!=0)
return rc;
} else {
rc = Q931E_BEARERCAP;
}
/* Channel Identification */
if (Q931IsIEPresent(pMes->ChanID)) {
if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CHANNEL_IDENTIFICATION](pTrunk, Q931GetIEPtr(pMes->ChanID,pMes->buf), OBuf, &Octet))!=0)
return rc;
}
/* Progress indicator */
if (Q931IsIEPresent(pMes->ProgInd)) {
if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_PROGRESS_INDICATOR](pTrunk, Q931GetIEPtr(pMes->ProgInd,pMes->buf), OBuf, &Octet))!=0)
return rc;
}
/* Network specific facilities */
if (Q931IsIEPresent(pMes->NetFac)) {
if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_NETWORK_SPECIFIC_FACILITIES](pTrunk, Q931GetIEPtr(pMes->NetFac,pMes->buf), OBuf, &Octet))!=0)
return rc;
}
/* Display */
if (Q931IsIEPresent(pMes->Display)) {
if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_DISPLAY](pTrunk, Q931GetIEPtr(pMes->Display,pMes->buf), OBuf, &Octet))!=0)
return rc;
}
/* Date/Time */
if (Q931IsIEPresent(pMes->DateTime)) {
if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_DATETIME](pTrunk, Q931GetIEPtr(pMes->DateTime,pMes->buf), OBuf, &Octet))!=0)
return rc;
}
/* Keypad Facility */
if (Q931IsIEPresent(pMes->KeypadFac)) {
if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_KEYPAD_FACILITY](pTrunk, Q931GetIEPtr(pMes->KeypadFac,pMes->buf), OBuf, &Octet))!=0)
return rc;
}
/* Signal */
if (Q931IsIEPresent(pMes->Signal)) {
if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_SIGNAL](pTrunk, Q931GetIEPtr(pMes->Signal,pMes->buf), OBuf, &Octet))!=0)
return rc;
}
/* Calling Party Number */
if (Q931IsIEPresent(pMes->CallingNum)) {
if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CALLING_PARTY_NUMBER](pTrunk, Q931GetIEPtr(pMes->CallingNum,pMes->buf), OBuf, &Octet))!=0)
return rc;
}
/* Calling Party Subaddress */
if (Q931IsIEPresent(pMes->CallingSub)) {
if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CALLING_PARTY_SUBADDRESS](pTrunk, Q931GetIEPtr(pMes->CallingSub,pMes->buf), OBuf, &Octet))!=0)
return rc;
}
/* Called Party number */
if (Q931IsIEPresent(pMes->CalledNum)) {
if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CALLED_PARTY_NUMBER](pTrunk, Q931GetIEPtr(pMes->CalledNum,pMes->buf), OBuf, &Octet))!=0)
return rc;
}
/* Called party subaddress */
if (Q931IsIEPresent(pMes->CalledSub)) {
if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CALLED_PARTY_SUBADDRESS](pTrunk, Q931GetIEPtr(pMes->CalledSub,pMes->buf), OBuf, &Octet))!=0)
return rc;
}
/* Transit network selection */
if (Q931IsIEPresent(pMes->TransNetSel)) {
if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_TRANSIT_NETWORK_SELECTION](pTrunk, Q931GetIEPtr(pMes->TransNetSel,pMes->buf), OBuf, &Octet))!=0)
return rc;
}
/* Repeat Indicator */
if (Q931IsIEPresent(pMes->LLRepeatInd)) {
rc = Q931E_UNKNOWN_IE;/* TODO */
}
/* Low Layer Compatibility */
if (Q931IsIEPresent(pMes->LLComp)) {
if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_LOW_LAYER_COMPATIBILITY](pTrunk, Q931GetIEPtr(pMes->LLComp,pMes->buf), OBuf, &Octet))!=0)
return rc;
}
/* High Layer Compatibility */
if (Q931IsIEPresent(pMes->HLComp)) {
if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_HIGH_LAYER_COMPATIBILITY](pTrunk, Q931GetIEPtr(pMes->HLComp,pMes->buf), OBuf, &Octet))!=0)
return rc;
}
*OSize = Octet;
return rc;
}
/*****************************************************************************
Function: ATT5ESSUmes_0x0f
*****************************************************************************/
L3INT ATT5ESSUmes_0x0f(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size)
{
if (mes->ProtDisc == 8) {
return Q931Umes_ConnectAck(pTrunk, IBuf, mes, IOff, Size);
}
if (mes->ProtDisc == 3) {
return Q931Umes_Service(pTrunk, IBuf, mes, IOff, Size);
}
return Q931E_UNKNOWN_MESSAGE;
}
/*****************************************************************************
Function: ATT5ESSPmes_0x0f
*****************************************************************************/
L3INT ATT5ESSPmes_0x0f(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize)
{
Q931mes_Generic *mes = (Q931mes_Generic *)IBuf;
if (mes->ProtDisc == 8) {
return Q931Pmes_ConnectAck(pTrunk, IBuf, ISize, OBuf, OSize);
}
if (mes->ProtDisc == 3) {
return Q931Pmes_Service(pTrunk, IBuf, ISize, OBuf, OSize);
}
return Q931E_UNKNOWN_MESSAGE;
}
/*****************************************************************************
Function: ATT5ESSUmes_0x07
*****************************************************************************/
L3INT ATT5ESSUmes_0x07(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size)
{
if (mes->ProtDisc == 8) {
return Q931Umes_Connect(pTrunk, IBuf, mes, IOff, Size);
}
if (mes->ProtDisc == 3) {
return Q931Umes_ServiceAck(pTrunk, IBuf, mes, IOff, Size);
}
return Q931E_UNKNOWN_MESSAGE;
}
/*****************************************************************************
Function: ATT5ESSPmes_0x07
*****************************************************************************/
L3INT ATT5ESSPmes_0x07(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize)
{
Q931mes_Generic *mes = (Q931mes_Generic *)IBuf;
if (mes->ProtDisc == 8) {
return Q931Pmes_Connect(pTrunk, IBuf, ISize, OBuf, OSize);
}
if (mes->ProtDisc == 3) {
return Q931Pmes_ServiceAck(pTrunk, IBuf, ISize, OBuf, OSize);
}
return Q931E_UNKNOWN_MESSAGE;
}

View File

@ -1,126 +0,0 @@
/*****************************************************************************
FileName: DMSStateNT.c
Contents: DMS-100 ISDN State Engine for NT (Network Mode).
The controlling state engine for Q.931 is the state engine
on the NT side. The state engine on the TE side is a slave
of this. The TE side maintain it's own states as described in
ITU-T Q931, but will in raise conditions be overridden by
the NT side.
License/Copyright:
Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved.
email:janvb@caselaboratories.com
Copyright (c) 2007, Michael Jerris. All rights reserved.
email:mike@jerris.com
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the Case Labs, Ltd nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
#include "DMS.h"
/*****************************************************************************
Function: DMSCreateNT
Description: Will create the National ISDN NT as a Dialect in the stack. The first
bulk set up the message handlers, the second bulk the IE
encoders/coders, and the last bulk set up the state table.
Parameters: i Dialect index
*****************************************************************************/
void DMSCreateNT(L3UCHAR i)
{
Q931SetMesProc(Q931mes_ALERTING, i, Q931ProcAlertingNT, Q931Umes_Alerting, Q931Pmes_Alerting);
Q931SetMesProc(Q931mes_CALL_PROCEEDING, i, Q931ProcCallProceedingNT, Q931Umes_CallProceeding, Q931Pmes_CallProceeding);
Q931SetMesProc(Q931mes_CONNECT, i, Q931ProcConnectNT, Q931Umes_Connect, Q931Pmes_Connect);
Q931SetMesProc(Q931mes_CONNECT_ACKNOWLEDGE, i, Q931ProcConnectAckNT, Q931Umes_ConnectAck, Q931Pmes_ConnectAck);
Q931SetMesProc(Q931mes_PROGRESS, i, Q931ProcProgressNT, Q931Umes_Progress, Q931Pmes_Progress);
Q931SetMesProc(Q931mes_SETUP, i, Q931ProcSetupNT, DMSUmes_Setup, DMSPmes_Setup);
Q931SetMesProc(Q931mes_SETUP_ACKNOWLEDGE, i, Q931ProcSetupAckNT, Q931Umes_SetupAck, Q931Pmes_SetupAck);
Q931SetMesProc(Q931mes_RESUME, i, Q931ProcResumeNT, Q931Umes_Resume, Q931Pmes_Resume);
Q931SetMesProc(Q931mes_RESUME_ACKNOWLEDGE, i, Q931ProcResumeAckNT, Q931Umes_ResumeAck, Q931Pmes_ResumeAck);
Q931SetMesProc(Q931mes_RESUME_REJECT, i, Q931ProcResumeRejectNT, Q931Umes_ResumeReject, Q931Pmes_ResumeReject);
Q931SetMesProc(Q931mes_SUSPEND, i, Q931ProcSuspendNT, Q931Umes_Suspend, Q931Pmes_Suspend);
Q931SetMesProc(Q931mes_SUSPEND_ACKNOWLEDGE, i, Q931ProcSuspendAckNT, Q931Umes_SuspendAck, Q931Pmes_SuspendAck);
Q931SetMesProc(Q931mes_SUSPEND_REJECT, i, Q931ProcSuspendRejectNT, Q931Umes_SuspendReject, Q931Pmes_SuspendReject);
Q931SetMesProc(Q931mes_USER_INFORMATION, i, Q931ProcUserInformationNT, Q931Umes_UserInformation, Q931Pmes_UserInformation);
Q931SetMesProc(Q931mes_DISCONNECT, i, Q931ProcDisconnectNT, Q931Umes_Disconnect, Q931Pmes_Disconnect);
Q931SetMesProc(Q931mes_RELEASE, i, Q931ProcReleaseNT, Q931Umes_Release, Q931Pmes_Release);
Q931SetMesProc(Q931mes_RELEASE_COMPLETE, i, Q931ProcReleaseCompleteNT, Q931Umes_ReleaseComplete, Q931Pmes_ReleaseComplete);
Q931SetMesProc(Q931mes_RESTART, i, Q931ProcRestartNT, Q931Umes_Restart, Q931Pmes_Restart);
Q931SetMesProc(Q931mes_RESTART_ACKNOWLEDGE, i, Q931ProcRestartAckNT, Q931Umes_RestartAck, Q931Pmes_RestartAck);
Q931SetMesProc(Q931mes_CONGESTION_CONTROL, i, Q931ProcCongestionControlNT, Q931Umes_CongestionControl, Q931Pmes_CongestionControl);
Q931SetMesProc(Q931mes_INFORMATION, i, Q931ProcInformationNT, Q931Umes_Information, Q931Pmes_Information);
Q931SetMesProc(Q931mes_NOTIFY, i, Q931ProcNotifyNT, Q931Umes_Notify, Q931Pmes_Notify);
Q931SetMesProc(Q931mes_STATUS, i, Q931ProcStatusNT, Q931Umes_Status, Q931Pmes_Status);
Q931SetMesProc(Q931mes_STATUS_ENQUIRY, i, Q931ProcStatusEnquiryNT, Q931Umes_StatusEnquiry, Q931Pmes_StatusEnquiry);
Q931SetMesProc(Q931mes_SEGMENT, i, Q931ProcSegmentNT, Q931Umes_Segment, Q931Pmes_Segment);
Q931SetMesProc(Q932mes_FACILITY, i, Q932ProcFacilityNT, Q932Umes_Facility, Q932Pmes_Facility);
Q931SetMesProc(Q932mes_HOLD, i, Q932ProcHoldNT, Q932Umes_Hold, Q932Pmes_Hold);
Q931SetMesProc(Q932mes_HOLD_ACKNOWLEDGE, i, Q932ProcHoldAckNT, Q932Umes_HoldAck, Q932Pmes_HoldAck);
Q931SetMesProc(Q932mes_HOLD_REJECT, i, Q932ProcHoldRejectNT, Q932Umes_HoldReject, Q932Pmes_HoldReject);
Q931SetMesProc(Q932mes_REGISTER, i, Q932ProcRegisterNT, Q932Umes_Register, Q932Pmes_Register);
Q931SetMesProc(Q932mes_RETRIEVE, i, Q932ProcRetrieveNT, Q932Umes_Retrieve, Q932Pmes_Retrieve);
Q931SetMesProc(Q932mes_RETRIEVE_ACKNOWLEDGE, i, Q932ProcRetrieveAckNT, Q932Umes_RetrieveAck, Q932Pmes_RetrieveAck);
Q931SetMesProc(Q932mes_RETRIEVE_REJECT, i, Q932ProcRetrieveRejectNT, Q932Umes_RetrieveReject, Q932Pmes_RetrieveReject);
/* Set up the IE encoder/decoder handle table.*/
Q931SetIEProc(Q931ie_SEGMENTED_MESSAGE, i, Q931Pie_Segment, Q931Uie_Segment);
Q931SetIEProc(Q931ie_BEARER_CAPABILITY, i, Q931Pie_BearerCap, Q931Uie_BearerCap);
Q931SetIEProc(Q931ie_CAUSE, i, Q931Pie_Cause, Q931Uie_Cause);
Q931SetIEProc(Q931ie_CALL_IDENTITY, i, Q931Pie_CallID, Q931Uie_CallID);
Q931SetIEProc(Q931ie_CALL_STATE, i, Q931Pie_CallState, Q931Uie_CallState);
Q931SetIEProc(Q931ie_CHANNEL_IDENTIFICATION, i, Q931Pie_ChanID, Q931Uie_ChanID);
Q931SetIEProc(Q931ie_PROGRESS_INDICATOR, i, Q931Pie_ProgInd, Q931Uie_ProgInd);
Q931SetIEProc(Q931ie_NETWORK_SPECIFIC_FACILITIES, i, Q931Pie_NetFac, Q931Uie_NetFac);
Q931SetIEProc(Q931ie_NOTIFICATION_INDICATOR, i, Q931Pie_NotifInd, Q931Uie_NotifInd);
Q931SetIEProc(Q931ie_DISPLAY, i, Q931Pie_Display, Q931Uie_Display);
Q931SetIEProc(Q931ie_DATETIME, i, Q931Pie_DateTime, Q931Uie_DateTime);
Q931SetIEProc(Q931ie_KEYPAD_FACILITY, i, Q931Pie_KeypadFac, Q931Uie_KeypadFac);
Q931SetIEProc(Q931ie_SIGNAL, i, Q931Pie_Signal, Q931Uie_Signal);
Q931SetIEProc(Q931ie_TRANSIT_DELAY_SELECTION_AND_IND, i, Q931Pie_TransNetSel, Q931Uie_TransNetSel);
Q931SetIEProc(Q931ie_CALLING_PARTY_NUMBER, i, Q931Pie_CallingNum, Q931Uie_CallingNum);
Q931SetIEProc(Q931ie_CALLING_PARTY_SUBADDRESS, i, Q931Pie_CallingSub, Q931Uie_CallingSub);
Q931SetIEProc(Q931ie_CALLED_PARTY_NUMBER, i, Q931Pie_CalledNum, Q931Uie_CalledNum);
Q931SetIEProc(Q931ie_CALLED_PARTY_SUBADDRESS, i, Q931Pie_CalledSub, Q931Uie_CalledSub);
Q931SetIEProc(Q931ie_TRANSIT_NETWORK_SELECTION, i, Q931Pie_TransNetSel, Q931Uie_TransNetSel);
Q931SetIEProc(Q931ie_RESTART_INDICATOR, i, Q931Pie_RestartInd, Q931Uie_RestartInd);
Q931SetIEProc(Q931ie_LOW_LAYER_COMPATIBILITY, i, Q931Pie_LLComp, Q931Uie_LLComp);
Q931SetIEProc(Q931ie_HIGH_LAYER_COMPATIBILITY, i, Q931Pie_HLComp, Q931Uie_HLComp);
Q931SetIEProc(Q931ie_USER_USER, i, Q931Pie_UserUser, Q931Uie_UserUser);
Q931SetIEProc(Q931ie_GENERIC_DIGITS, i, Q931Pie_GenericDigits, Q931Uie_GenericDigits);
/* The following define a state machine. The point is that the Message */
/* procs can when search this to find out if the message/state */
/* combination is legale. If not, the proc for unexpected message apply.*/
/* TODO define state table here */
}

View File

@ -1,284 +0,0 @@
/*****************************************************************************
FileName: DMSStateTE.c
Contents: DMS-100 ISDN State Engine for TE (User Mode).
The controlling state engine for Q.931 is the state engine
on the NT side. The state engine on the TE side is a slave
of this. The TE side maintain it's own states as described in
ITU-T Q931, but will in raise conditions be overridden by
the NT side.
This reference implementation uses a process per message,
meaning that each message must check call states. This
is easier for dialect maintenance as each message proc
can be replaced individually. A new TE variant only
need to copy the Q931CreateTE and replace those procs or
need to override.
License/Copyright:
Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved.
email:janvb@caselaboratories.com
Copyright (c) 2007, Michael Jerris. All rights reserved.
email:mike@jerris.com
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the Case Labs, Ltd nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
#include "DMS.h"
extern L3INT Q931L4HeaderSpace;
/*****************************************************************************
Function: DMSCreateTE
Description: Will create the National TE as a Dialect in the stack. The first
bulk set up the message handlers, the second bulk the IE
encoders/coders, and the last bulk set up the state table.
Parameters: i Dialect index
*****************************************************************************/
void DMSCreateTE(L3UCHAR i)
{
Q931SetMesProc(Q931mes_ALERTING, i, Q931ProcAlertingTE, Q931Umes_Alerting, Q931Pmes_Alerting);
Q931SetMesProc(Q931mes_CALL_PROCEEDING, i, Q931ProcCallProceedingTE, Q931Umes_CallProceeding, Q931Pmes_CallProceeding);
Q931SetMesProc(Q931mes_CONNECT, i, DMSProc0x07TE, DMSUmes_0x07, DMSPmes_0x07);
Q931SetMesProc(Q931mes_CONNECT_ACKNOWLEDGE, i, DMSProc0x0fTE, DMSUmes_0x0f, DMSPmes_0x0f);
Q931SetMesProc(Q931mes_PROGRESS, i, Q931ProcProgressTE, Q931Umes_Progress, Q931Pmes_Progress);
Q931SetMesProc(Q931mes_SETUP, i, Q931ProcSetupTE, DMSUmes_Setup, DMSPmes_Setup);
Q931SetMesProc(Q931mes_SETUP_ACKNOWLEDGE, i, Q931ProcSetupAckTE, Q931Umes_SetupAck, Q931Pmes_SetupAck);
Q931SetMesProc(Q931mes_RESUME, i, Q931ProcResumeTE, Q931Umes_Resume, Q931Pmes_Resume);
Q931SetMesProc(Q931mes_RESUME_ACKNOWLEDGE, i, Q931ProcResumeAckTE, Q931Umes_ResumeAck, Q931Pmes_ResumeAck);
Q931SetMesProc(Q931mes_RESUME_REJECT, i, Q931ProcResumeRejectTE, Q931Umes_ResumeReject, Q931Pmes_ResumeReject);
Q931SetMesProc(Q931mes_SUSPEND, i, Q931ProcSuspendTE, Q931Umes_Suspend, Q931Pmes_Suspend);
Q931SetMesProc(Q931mes_SUSPEND_ACKNOWLEDGE, i, Q931ProcSuspendAckTE, Q931Umes_SuspendAck, Q931Pmes_SuspendAck);
Q931SetMesProc(Q931mes_SUSPEND_REJECT, i, Q931ProcSuspendRejectTE, Q931Umes_SuspendReject, Q931Pmes_SuspendReject);
Q931SetMesProc(Q931mes_USER_INFORMATION, i, Q931ProcUserInformationTE, Q931Umes_UserInformation, Q931Pmes_UserInformation);
Q931SetMesProc(Q931mes_DISCONNECT, i, Q931ProcDisconnectTE, Q931Umes_Disconnect, Q931Pmes_Disconnect);
Q931SetMesProc(Q931mes_RELEASE, i, Q931ProcReleaseTE, Q931Umes_Release, Q931Pmes_Release);
Q931SetMesProc(Q931mes_RELEASE_COMPLETE, i, Q931ProcReleaseCompleteTE, Q931Umes_ReleaseComplete, Q931Pmes_ReleaseComplete);
Q931SetMesProc(Q931mes_RESTART, i, Q931ProcRestartTE, Q931Umes_Restart, Q931Pmes_Restart);
Q931SetMesProc(Q931mes_RESTART_ACKNOWLEDGE, i, Q931ProcRestartAckTE, Q931Umes_RestartAck, Q931Pmes_RestartAck);
Q931SetMesProc(Q931mes_CONGESTION_CONTROL, i, Q931ProcCongestionControlTE, Q931Umes_CongestionControl, Q931Pmes_CongestionControl);
Q931SetMesProc(Q931mes_INFORMATION, i, Q931ProcInformationTE, Q931Umes_Information, Q931Pmes_Information);
Q931SetMesProc(Q931mes_NOTIFY, i, Q931ProcNotifyTE, Q931Umes_Notify, Q931Pmes_Notify);
Q931SetMesProc(Q931mes_STATUS, i, Q931ProcStatusTE, Q931Umes_Status, Q931Pmes_Status);
Q931SetMesProc(Q931mes_STATUS_ENQUIRY, i, Q931ProcStatusEnquiryTE, Q931Umes_StatusEnquiry, Q931Pmes_StatusEnquiry);
Q931SetMesProc(Q931mes_SEGMENT, i, Q931ProcSegmentTE, Q931Umes_Segment, Q931Pmes_Segment);
Q931SetMesProc(Q932mes_FACILITY, i, Q932ProcFacilityTE, Q932Umes_Facility, Q932Pmes_Facility);
Q931SetMesProc(Q932mes_HOLD, i, Q932ProcHoldTE, Q932Umes_Hold, Q932Pmes_Hold);
Q931SetMesProc(Q932mes_HOLD_ACKNOWLEDGE, i, Q932ProcHoldAckTE, Q932Umes_HoldAck, Q932Pmes_HoldAck);
Q931SetMesProc(Q932mes_HOLD_REJECT, i, Q932ProcHoldRejectTE, Q932Umes_HoldReject, Q932Pmes_HoldReject);
Q931SetMesProc(Q932mes_REGISTER, i, Q932ProcRegisterTE, Q932Umes_Register, Q932Pmes_Register);
Q931SetMesProc(Q932mes_RETRIEVE, i, Q932ProcRetrieveTE, Q932Umes_Retrieve, Q932Pmes_Retrieve);
Q931SetMesProc(Q932mes_RETRIEVE_ACKNOWLEDGE, i, Q932ProcRetrieveAckTE, Q932Umes_RetrieveAck, Q932Pmes_RetrieveAck);
Q931SetMesProc(Q932mes_RETRIEVE_REJECT, i, Q932ProcRetrieveRejectTE, Q932Umes_RetrieveReject, Q932Pmes_RetrieveReject);
/* Set up the IE encoder/decoder handle table.*/
Q931SetIEProc(Q931ie_SEGMENTED_MESSAGE, i, Q931Pie_Segment, Q931Uie_Segment);
Q931SetIEProc(Q931ie_BEARER_CAPABILITY, i, Q931Pie_BearerCap, Q931Uie_BearerCap);
Q931SetIEProc(Q931ie_CAUSE, i, Q931Pie_Cause, Q931Uie_Cause);
Q931SetIEProc(Q931ie_CALL_IDENTITY, i, Q931Pie_CallID, Q931Uie_CallID);
Q931SetIEProc(Q931ie_CALL_STATE, i, Q931Pie_CallState, Q931Uie_CallState);
Q931SetIEProc(Q931ie_CHANGE_STATUS, i, Q931Pie_ChangeStatus, Q931Uie_ChangeStatus);
Q931SetIEProc(Q931ie_CHANNEL_IDENTIFICATION, i, Q931Pie_ChanID, Q931Uie_ChanID);
Q931SetIEProc(Q931ie_PROGRESS_INDICATOR, i, Q931Pie_ProgInd, Q931Uie_ProgInd);
Q931SetIEProc(Q931ie_NETWORK_SPECIFIC_FACILITIES, i, Q931Pie_NetFac, Q931Uie_NetFac);
Q931SetIEProc(Q931ie_NOTIFICATION_INDICATOR, i, Q931Pie_NotifInd, Q931Uie_NotifInd);
Q931SetIEProc(Q931ie_DISPLAY, i, Q931Pie_Display, Q931Uie_Display);
Q931SetIEProc(Q931ie_DATETIME, i, Q931Pie_DateTime, Q931Uie_DateTime);
Q931SetIEProc(Q931ie_KEYPAD_FACILITY, i, Q931Pie_KeypadFac, Q931Uie_KeypadFac);
Q931SetIEProc(Q931ie_SIGNAL, i, Q931Pie_Signal, Q931Uie_Signal);
Q931SetIEProc(Q931ie_TRANSIT_DELAY_SELECTION_AND_IND, i, Q931Pie_TransNetSel, Q931Uie_TransNetSel);
Q931SetIEProc(Q931ie_CALLING_PARTY_NUMBER, i, Q931Pie_CallingNum, Q931Uie_CallingNum);
Q931SetIEProc(Q931ie_CALLING_PARTY_SUBADDRESS, i, Q931Pie_CallingSub, Q931Uie_CallingSub);
Q931SetIEProc(Q931ie_CALLED_PARTY_NUMBER, i, Q931Pie_CalledNum, Q931Uie_CalledNum);
Q931SetIEProc(Q931ie_CALLED_PARTY_SUBADDRESS, i, Q931Pie_CalledSub, Q931Uie_CalledSub);
Q931SetIEProc(Q931ie_TRANSIT_NETWORK_SELECTION, i, Q931Pie_TransNetSel, Q931Uie_TransNetSel);
Q931SetIEProc(Q931ie_RESTART_INDICATOR, i, Q931Pie_RestartInd, Q931Uie_RestartInd);
Q931SetIEProc(Q931ie_LOW_LAYER_COMPATIBILITY, i, Q931Pie_LLComp, Q931Uie_LLComp);
Q931SetIEProc(Q931ie_HIGH_LAYER_COMPATIBILITY, i, Q931Pie_HLComp, Q931Uie_HLComp);
Q931SetIEProc(Q931ie_USER_USER, i, Q931Pie_UserUser, Q931Uie_UserUser);
Q931SetIEProc(Q931ie_GENERIC_DIGITS, i, Q931Pie_GenericDigits, Q931Uie_GenericDigits);
/* The following define a state machine. The point is that the Message */
/* procs can when search this to find out if the message/state */
/* combination is legale. If not, the proc for unexpected message apply.*/
/* State 0 Idle */
Q931AddStateEntry(i, Q931_U0, Q931mes_RESUME, 2);
Q931AddStateEntry(i, Q931_U0, Q931mes_SETUP, 4);
Q931AddStateEntry(i, Q931_U0, Q931mes_SETUP, 2);
Q931AddStateEntry(i, Q931_U0, Q931mes_STATUS, 4);
Q931AddStateEntry(i, Q931_U0, Q931mes_RELEASE, 4);
Q931AddStateEntry(i, Q931_U0, Q931mes_RELEASE_COMPLETE, 4);
/* State 1 Call Initiating */
Q931AddStateEntry(i, Q931_U1, Q931mes_DISCONNECT, 2);
Q931AddStateEntry(i, Q931_U1, Q931mes_SETUP_ACKNOWLEDGE, 4);
Q931AddStateEntry(i, Q931_U1, Q931mes_RELEASE_COMPLETE, 4);
Q931AddStateEntry(i, Q931_U1, Q931mes_CALL_PROCEEDING, 4);
Q931AddStateEntry(i, Q931_U1, Q931mes_ALERTING, 4);
Q931AddStateEntry(i, Q931_U1, Q931mes_CONNECT, 4);
/* State 2 Overlap Sending */
Q931AddStateEntry(i, Q931_U2, Q931mes_INFORMATION, 2);
Q931AddStateEntry(i, Q931_U2, Q931mes_CALL_PROCEEDING, 4);
Q931AddStateEntry(i, Q931_U2, Q931mes_ALERTING, 4);
Q931AddStateEntry(i, Q931_U2, Q931mes_PROGRESS, 4);
Q931AddStateEntry(i, Q931_U2, Q931mes_CONNECT, 4);
Q931AddStateEntry(i, Q931_U2, Q931mes_RELEASE, 2);
/* State 3 Outgoing Call Proceeding */
Q931AddStateEntry(i, Q931_U3, Q931mes_PROGRESS, 4);
Q931AddStateEntry(i, Q931_U3, Q931mes_ALERTING, 4);
Q931AddStateEntry(i, Q931_U3, Q931mes_CONNECT, 4);
Q931AddStateEntry(i, Q931_U3, Q931mes_RELEASE, 2);
/* State 4 Call Delivered */
Q931AddStateEntry(i, Q931_U4, Q931mes_CONNECT, 4);
/* State 6 Call Precent */
Q931AddStateEntry(i, Q931_U6, Q931mes_INFORMATION, 2);
Q931AddStateEntry(i, Q931_U6, Q931mes_ALERTING, 2);
Q931AddStateEntry(i, Q931_U6, Q931mes_CALL_PROCEEDING, 2);
Q931AddStateEntry(i, Q931_U6, Q931mes_CONNECT, 2);
Q931AddStateEntry(i, Q931_U6, Q931mes_RELEASE_COMPLETE, 2);
Q931AddStateEntry(i, Q931_U6, Q931mes_RELEASE, 4);
Q931AddStateEntry(i, Q931_U6, Q931mes_DISCONNECT, 4);
/* State 7 Call Received */
Q931AddStateEntry(i, Q931_U7, Q931mes_CONNECT, 2);
/* State 8 Connect request */
Q931AddStateEntry(i, Q931_U8, Q931mes_CONNECT_ACKNOWLEDGE, 4);
/* State 9 Incoming Call Proceeding */
Q931AddStateEntry(i, Q931_U9, Q931mes_CONNECT, 2);
Q931AddStateEntry(i, Q931_U9, Q931mes_ALERTING, 2);
Q931AddStateEntry(i, Q931_U9, Q931mes_PROGRESS, 2);
/* State 10 Active */
Q931AddStateEntry(i, Q931_U10, Q931mes_SUSPEND, 2);
Q931AddStateEntry(i, Q931_U10, Q931mes_NOTIFY, 4);
Q931AddStateEntry(i, Q931_U10, Q931mes_NOTIFY, 2);
/* State 11 Disconnect Request */
Q931AddStateEntry(i, Q931_U11, Q931mes_RELEASE, 4);
Q931AddStateEntry(i, Q931_U11, Q931mes_DISCONNECT, 4);
Q931AddStateEntry(i, Q931_U11, Q931mes_NOTIFY, 4);
/* State 12 Disconnect Ind */
Q931AddStateEntry(i, Q931_U12, Q931mes_RELEASE, 4);
Q931AddStateEntry(i, Q931_U12, Q931mes_RELEASE, 2);
/* State 15 Suspend Request */
Q931AddStateEntry(i, Q931_U15, Q931mes_SUSPEND_ACKNOWLEDGE, 4);
Q931AddStateEntry(i, Q931_U15, Q931mes_SUSPEND_REJECT, 4);
Q931AddStateEntry(i, Q931_U15, Q931mes_DISCONNECT, 4);
Q931AddStateEntry(i, Q931_U15, Q931mes_RELEASE, 4);
/* TODO
Q931AddStateEntry(i, Q931_U17,
Q931AddStateEntry(i, Q931_U19,
Q931AddStateEntry(i, Q931_U25,
*/
}
/*****************************************************************************
Function: DMSProc0x0fTE
*****************************************************************************/
L3INT DMSProc0x0fTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom)
{
Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace];
L3INT callIndex;
L3INT ret = Q931E_NO_ERROR;
if (pMes->ProtDisc == 8) {
/* Find the call using CRV */
ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex);
if (ret != Q931E_NO_ERROR)
return ret;
/* TODO chack against state table for illegal or unexpected message here*/
/* TODO - Set correct timer here */
Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303);
}
if (iFrom == 4) {
/* TODO Add proc here*/
ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size);
}
else if (iFrom == 2) {
/* TODO Add proc here*/
ret = Q931Tx34(pTrunk, buf, pMes->Size);
if (pMes->ProtDisc == 3 && pTrunk->autoServiceAck) {
Q931AckService(pTrunk, buf);
}
}
return ret;
}
/*****************************************************************************
Function: DMSProc0x07TE
*****************************************************************************/
L3INT DMSProc0x07TE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom)
{
Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace];
L3INT callIndex;
L3INT ret = Q931E_NO_ERROR;
if (pMes->ProtDisc == 8) {
/* Find the call using CRV */
ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex);
if (ret != Q931E_NO_ERROR)
return ret;
/* TODO chack against state table for illegal or unexpected message here*/
/* TODO - Set correct timer here */
Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303);
}
if (iFrom == 4) {
/* TODO Add proc here*/
ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size);
}
else if (iFrom == 2) {
/* TODO Add proc here*/
ret = Q931Tx34(pTrunk, buf, pMes->Size);
}
return ret;
}

View File

@ -1,344 +0,0 @@
/*****************************************************************************
FileName: DMSmes.c
Contents: Pack/Unpack functions. These functions will unpack a DMS-100 ISDN
message from the bit packed original format into structs
that contains variables sized by the user. It will also pack
the struct back into a Q.931 message as required.
See national.h for description.
License/Copyright:
Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved.
email:janvb@caselaboratories.com
Copyright (c) 2007, Michael Jerris. All rights reserved.
email:mike@jerris.com
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the Case Labs, Ltd nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
#include "DMS.h"
/*****************************************************************************
Function: DMSUmes_Setup
*****************************************************************************/
L3INT DMSUmes_Setup(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size)
{
L3INT ir = 0;
L3INT OOff = 0;
L3INT rc = Q931E_NO_ERROR;
L3UCHAR last_codeset = 0, codeset = 0;
L3UCHAR shift_lock = 1;
while (IOff < Size) {
if (!shift_lock) {
codeset = last_codeset;
}
if ((IBuf[IOff] & 0xF0) == Q931ie_SHIFT ) {
shift_lock = (IBuf[IOff] & 0x08);
if (shift_lock) {
last_codeset = codeset;
}
codeset = ((IBuf[IOff] & 0x07));
IOff++;
}
if (codeset == 0) {
switch (IBuf[IOff]) {
case Q931ie_SENDING_COMPLETE:
case Q931ie_BEARER_CAPABILITY:
case Q931ie_CHANNEL_IDENTIFICATION:
case Q931ie_PROGRESS_INDICATOR:
case Q931ie_NETWORK_SPECIFIC_FACILITIES:
case Q931ie_DISPLAY:
case Q931ie_DATETIME:
case Q931ie_KEYPAD_FACILITY:
case Q931ie_SIGNAL:
case Q931ie_CALLING_PARTY_NUMBER:
case Q931ie_CALLING_PARTY_SUBADDRESS:
case Q931ie_CALLED_PARTY_NUMBER:
case Q931ie_CALLED_PARTY_SUBADDRESS:
case Q931ie_TRANSIT_NETWORK_SELECTION:
case Q931ie_LOW_LAYER_COMPATIBILITY:
case Q931ie_HIGH_LAYER_COMPATIBILITY:
rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff);
if (rc != Q931E_NO_ERROR)
return rc;
break;
case Q931ie_REPEAT_INDICATOR:
if (ir < 2) {
rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff);
ir++;
} else {
return Q931E_ILLEGAL_IE;
}
break;
default:
return Q931E_ILLEGAL_IE;
break;
}
} else if (codeset == 6) {
switch (IBuf[IOff]) {
case Q931ie_GENERIC_DIGITS:
rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff);
if (rc != Q931E_NO_ERROR)
return rc;
break;
default:
return Q931E_ILLEGAL_IE;
break;
}
} else {
return Q931E_ILLEGAL_IE;
}
}
mes->Size = sizeof(Q931mes_Generic) - 1 + OOff;
return Q931E_NO_ERROR;
}
/*****************************************************************************
Function: DMSPmes_Setup
Decription: Pack a Q931mes_Generic into a real Q.931 message. The user will
set up a SETUP message and issue this to the stack where it
is processed by Q931ProcSetup that processes and validates
it before it actually sends it out. This function is called
to compute the real Q.931 message.
Parameters: IBuf[IN] Ptr to un-packed struct
ISize[IN] Size of input buffer (unpacked message).
OBuf[OUT] Ptr to packed 'octet' wise message.
OSize[OUT] Size of packed message.
Called By: Q931ProcSetup
*****************************************************************************/
L3INT DMSPmes_Setup(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize)
{
L3INT rc = Q931E_NO_ERROR;
Q931mes_Generic *pMes = (Q931mes_Generic *)IBuf;
L3INT Octet = 0;
/* Q931 Message Header */
Q931MesgHeader(pTrunk, pMes, OBuf, *OSize, &Octet);
/* Sending Complete */
if (Q931IsIEPresent(pMes->SendComplete)) {
OBuf[Octet++] = (L3UCHAR)(pMes->SendComplete & 0x00ff);
}
/* Repeat Indicator */
if (Q931IsIEPresent(pMes->RepeatInd)) {
OBuf[Octet++] = (L3UCHAR)(pMes->RepeatInd & 0x00ff);
}
/* Bearer capability */
if (Q931IsIEPresent(pMes->BearerCap)) {
if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_BEARER_CAPABILITY](pTrunk, Q931GetIEPtr(pMes->BearerCap,pMes->buf), OBuf, &Octet)) != 0)
return rc;
} else {
rc = Q931E_BEARERCAP;
}
/* Channel Identification */
if (Q931IsIEPresent(pMes->ChanID)) {
if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CHANNEL_IDENTIFICATION](pTrunk, Q931GetIEPtr(pMes->ChanID,pMes->buf), OBuf, &Octet)) != 0)
return rc;
}
/* Progress indicator */
if (Q931IsIEPresent(pMes->ProgInd)) {
if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_PROGRESS_INDICATOR](pTrunk, Q931GetIEPtr(pMes->ProgInd,pMes->buf), OBuf, &Octet)) != 0)
return rc;
}
/* Network spesific facilities */
if (Q931IsIEPresent(pMes->NetFac)) {
if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_NETWORK_SPECIFIC_FACILITIES](pTrunk, Q931GetIEPtr(pMes->NetFac,pMes->buf), OBuf, &Octet)) != 0)
return rc;
}
/* Display */
if (Q931IsIEPresent(pMes->Display)) {
if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_DISPLAY](pTrunk, Q931GetIEPtr(pMes->Display,pMes->buf), OBuf, &Octet)) != 0)
return rc;
}
/* Date/Time */
if (Q931IsIEPresent(pMes->DateTime)) {
if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_DATETIME](pTrunk, Q931GetIEPtr(pMes->DateTime,pMes->buf), OBuf, &Octet)) != 0)
return rc;
}
/* Keypad Facility */
if (Q931IsIEPresent(pMes->KeypadFac)) {
if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_KEYPAD_FACILITY](pTrunk, Q931GetIEPtr(pMes->KeypadFac,pMes->buf), OBuf, &Octet)) != 0)
return rc;
}
/* Signal */
if (Q931IsIEPresent(pMes->Signal)) {
if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_SIGNAL](pTrunk, Q931GetIEPtr(pMes->Signal,pMes->buf), OBuf, &Octet)) != 0)
return rc;
}
/* Calling Party Number */
if (Q931IsIEPresent(pMes->CallingNum)) {
if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CALLING_PARTY_NUMBER](pTrunk, Q931GetIEPtr(pMes->CallingNum,pMes->buf), OBuf, &Octet)) != 0)
return rc;
}
/* Calling Party Subaddress */
if (Q931IsIEPresent(pMes->CallingSub)) {
if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CALLING_PARTY_SUBADDRESS](pTrunk, Q931GetIEPtr(pMes->CallingSub,pMes->buf), OBuf, &Octet)) != 0)
return rc;
}
/* Called Party number */
if (Q931IsIEPresent(pMes->CalledNum)) {
if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CALLED_PARTY_NUMBER](pTrunk, Q931GetIEPtr(pMes->CalledNum,pMes->buf), OBuf, &Octet)) != 0)
return rc;
}
/* Called party subaddress */
if (Q931IsIEPresent(pMes->CalledSub)) {
if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CALLED_PARTY_SUBADDRESS](pTrunk, Q931GetIEPtr(pMes->CalledSub,pMes->buf), OBuf, &Octet)) != 0)
return rc;
}
/* Transit network selection */
if (Q931IsIEPresent(pMes->TransNetSel)) {
if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_TRANSIT_NETWORK_SELECTION](pTrunk, Q931GetIEPtr(pMes->TransNetSel,pMes->buf), OBuf, &Octet)) != 0)
return rc;
}
/* Repeat Indicator */
if (Q931IsIEPresent(pMes->LLRepeatInd)) {
rc = Q931E_UNKNOWN_IE;/* TODO */
}
/* Low Layer Compatibility */
if (Q931IsIEPresent(pMes->LLComp)) {
if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_LOW_LAYER_COMPATIBILITY](pTrunk, Q931GetIEPtr(pMes->LLComp,pMes->buf), OBuf, &Octet)) != 0)
return rc;
}
/* High Layer Compatibility */
if (Q931IsIEPresent(pMes->HLComp)) {
if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_HIGH_LAYER_COMPATIBILITY](pTrunk, Q931GetIEPtr(pMes->HLComp,pMes->buf), OBuf, &Octet)) != 0)
return rc;
}
*OSize = Octet;
return rc;
}
/*****************************************************************************
Function: DMSUmes_0x0f
*****************************************************************************/
L3INT DMSUmes_0x0f(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size)
{
if (mes->ProtDisc == 8) {
return Q931Umes_ConnectAck(pTrunk, IBuf, mes, IOff, Size);
}
if (mes->ProtDisc == 3) {
return Q931Umes_Service(pTrunk, IBuf, mes, IOff, Size);
}
return Q931E_UNKNOWN_MESSAGE;
}
/*****************************************************************************
Function: DMSPmes_0x0f
*****************************************************************************/
L3INT DMSPmes_0x0f(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize)
{
Q931mes_Generic *mes = (Q931mes_Generic *)IBuf;
if (mes->ProtDisc == 8) {
return Q931Pmes_ConnectAck(pTrunk, IBuf, ISize, OBuf, OSize);
}
if (mes->ProtDisc == 3) {
return Q931Pmes_Service(pTrunk, IBuf, ISize, OBuf, OSize);
}
return Q931E_UNKNOWN_MESSAGE;
}
/*****************************************************************************
Function: DMSUmes_0x07
*****************************************************************************/
L3INT DMSUmes_0x07(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size)
{
if (mes->ProtDisc == 8) {
return Q931Umes_Connect(pTrunk, IBuf, mes, IOff, Size);
}
if (mes->ProtDisc == 3) {
return Q931Umes_ServiceAck(pTrunk, IBuf, mes, IOff, Size);
}
return Q931E_UNKNOWN_MESSAGE;
}
/*****************************************************************************
Function: DMSPmes_0x07
*****************************************************************************/
L3INT DMSPmes_0x07(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize)
{
Q931mes_Generic *mes = (Q931mes_Generic *)IBuf;
if (mes->ProtDisc == 8) {
return Q931Pmes_Connect(pTrunk, IBuf, ISize, OBuf, OSize);
}
if (mes->ProtDisc == 3) {
return Q931Pmes_ServiceAck(pTrunk, IBuf, ISize, OBuf, OSize);
}
return Q931E_UNKNOWN_MESSAGE;
}

View File

@ -1,44 +0,0 @@
/*****************************************************************************
FileName: EuroISDNStateNT.c
Contents: EuroISDN State Engine for NT (Network Mode).
The controlling state engine for Q.931 is the state engine
on the NT side. The state engine on the TE side is a slave
of this. The TE side maintain it's own states as described in
ITU-T Q931, but will in raise conditions be overridden by
the NT side.
License/Copyright:
Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved.
email:janvb@caselaboratories.com
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the Case Labs, Ltd nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
#include "Q931.h"

View File

@ -1,58 +0,0 @@
/*****************************************************************************
FileName: EuroISDNStateTE.c
Contents: EuroISDN State Engine for TE (User Mode).
The controlling state engine for Q.931 is the state engine
on the NT side. The state engine on the TE side is a slave
of this. The TE side maintain it's own states as described in
ITU-T Q931, but will in raise conditions be overridden by
the NT side.
License/Copyright:
Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved.
email:janvb@caselaboratories.com
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the Case Labs, Ltd nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
#include "Q931.h"
/*
EuroISDN is a sub-set of Q.931. Q.931 is very generic as it embrase a lot,
while EuroISDN is more exact and make decitions on some of the
'implementation options' in the original standard. EuroISDN will
however run smoothly under the generic space, so these functions are more
for show
*/
#if 0
static void EuroISDNCreateTE(L3UCHAR i)
{
Q931CreateTE(i);
}
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,888 +0,0 @@
/*****************************************************************************
FileName: Q931.c
Contents: Implementation of Q.931 stack main interface functions.
See q931.h for description.
License/Copyright:
Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved.
email:janvb@caselaboratories.com
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the Case Labs, Ltd nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
#include "Q921.h"
#include "Q931.h"
#include "national.h"
#include "DMS.h"
#include "5ESS.h"
/*****************************************************************************
Dialect function pointers tables.
The following function pointer arrays define pack/unpack functions and
processing furnctions for the different Q.931 based dialects.
The arrays are initialized with pointers to dummy functions and later
overrided with pointers to actual functions as new dialects are added.
The initial Q.931 will as an example define 2 dialects as it treats User
and Network mode as separate ISDN dialects.
The API messages Q931AddProc, Q931AddMes, Q931AddIE are used to initialize
these table entries during system inititialization of a stack.
*****************************************************************************/
q931proc_func_t *Q931Proc[Q931MAXDLCT][Q931MAXMES];
q931umes_func_t *Q931Umes[Q931MAXDLCT][Q931MAXMES];
q931pmes_func_t *Q931Pmes[Q931MAXDLCT][Q931MAXMES];
q931uie_func_t *Q931Uie[Q931MAXDLCT][Q931MAXIE];
q931pie_func_t *Q931Pie[Q931MAXDLCT][Q931MAXIE];
q931timeout_func_t *Q931Timeout[Q931MAXDLCT][Q931MAXTIMER];
q931timer_t Q931Timer[Q931MAXDLCT][Q931MAXTIMER];
void (*Q931CreateDialectCB[Q931MAXDLCT])(L3UCHAR iDialect) = { NULL, NULL };
Q931State Q931st[Q931MAXSTATE];
/*****************************************************************************
Core system tables and variables.
*****************************************************************************/
L3INT Q931L4HeaderSpace = {0}; /* header space to be ignoder/inserted */
/* at head of each message. */
L3INT Q931L2HeaderSpace = {4}; /* Q921 header space, sapi, tei etc */
/*****************************************************************************
Main interface callback functions.
*****************************************************************************/
Q931ErrorCB_t Q931ErrorProc; /* callback for error messages. */
L3ULONG (*Q931GetTimeProc) (void) = NULL; /* callback for func reading time in ms */
/*****************************************************************************
Function: Q931SetL4HeaderSpace
Description: Set the # of bytes to be inserted/ignored at the head of
each message. Q931 will issue a message with space for header
and the user will use this to fill in whatever header info
is required to support the architecture used.
*****************************************************************************/
void Q931SetL4HeaderSpace(L3INT space)
{
Q931L4HeaderSpace = space;
}
/*****************************************************************************
Function: Q931SetL2HeaderSpace
Description: Set the # of bytes to be inserted/ignored at the head of
each message. Q931 will issue a message with space for header
and the user will use this to fill in whatever header info
is required to support the architecture used.
*****************************************************************************/
void Q931SetL2HeaderSpace(L3INT space)
{
Q931L2HeaderSpace = space;
}
/*****************************************************************************
Function: Q931ProcDummy
Description: Dummy function for message processing.
*****************************************************************************/
L3INT Q931ProcDummy(Q931_TrunkInfo_t *pTrunk, L3UCHAR * b,L3INT c)
{
return Q931E_INTERNAL;
}
/*****************************************************************************
Function: Q931UmesDummy
Description: Dummy function for message processing
*****************************************************************************/
L3INT Q931UmesDummy(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, Q931mes_Generic *OBuf, L3INT IOff, L3INT Size)
{
return Q931E_UNKNOWN_MESSAGE;
}
/*****************************************************************************
Function: Q931UieDummy
Description: Dummy function for message processing
*****************************************************************************/
L3INT Q931UieDummy(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff)
{
return Q931E_UNKNOWN_IE;
}
/*****************************************************************************
Function: Q931PmesDummy
Description: Dummy function for message processing
*****************************************************************************/
L3INT Q931PmesDummy(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize)
{
return Q931E_UNKNOWN_MESSAGE;
}
/*****************************************************************************
Function: Q931PieDummy
Description: Dummy function for message processing
*****************************************************************************/
L3INT Q931PieDummy(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet)
{
return Q931E_UNKNOWN_IE;
}
/*****************************************************************************
Function: Q931TxDummy
Description: Dummy function for message processing
*****************************************************************************/
L3INT Q931TxDummy(Q931_TrunkInfo_t *pTrunk, L3UCHAR * b, L3INT n)
{
return Q931E_MISSING_CB;
}
/*****************************************************************************
Function: Q931ErrorDummy
Description: Dummy function for error processing
*****************************************************************************/
L3INT Q931ErrorDummy(void *priv, L3INT a, L3INT b, L3INT c)
{
return 0;
}
/*****************************************************************************
Function: Q931Initialize
Description: This function Initialize the stack.
Will set up the trunk array, channel
arrays and initialize Q931 function arrays before it finally
set up EuroISDN processing with User as dialect 0 and
Network as dialect 1.
Note: Initialization of other stacks should be inserted after
the initialization of EuroISDN.
*****************************************************************************/
void Q931Initialize()
{
L3INT x,y;
/* Secure the callbacks to default procs */
Q931ErrorProc = Q931ErrorDummy;
/* The user will only add the message handlers and IE handlers he need,
* so we need to initialize every single entry to a default function
* that will throw an appropriate error if they are ever called.
*/
for (x = 0; x < Q931MAXDLCT; x++) {
for (y = 0; y < Q931MAXMES; y++) {
Q931Proc[x][y] = Q931ProcDummy;
Q931Umes[x][y] = Q931UmesDummy;
Q931Pmes[x][y] = Q931PmesDummy;
}
for (y = 0; y < Q931MAXIE; y++) {
Q931Pie[x][y] = Q931PieDummy;
Q931Uie[x][y] = Q931UieDummy;
}
for (y = 0; y < Q931MAXTIMER; y++) {
Q931Timeout[x][y] = Q931TimeoutDummy;
Q931Timer[x][y] = 0;
}
}
if (Q931CreateDialectCB[Q931_Dialect_Q931 + Q931_TE] == NULL)
Q931AddDialect(Q931_Dialect_Q931 + Q931_TE, Q931CreateTE);
if (Q931CreateDialectCB[Q931_Dialect_Q931 + Q931_NT] == NULL)
Q931AddDialect(Q931_Dialect_Q931 + Q931_NT, Q931CreateNT);
if (Q931CreateDialectCB[Q931_Dialect_National + Q931_TE] == NULL)
Q931AddDialect(Q931_Dialect_National + Q931_TE, nationalCreateTE);
if (Q931CreateDialectCB[Q931_Dialect_National + Q931_NT] == NULL)
Q931AddDialect(Q931_Dialect_National + Q931_NT, nationalCreateNT);
if (Q931CreateDialectCB[Q931_Dialect_DMS + Q931_TE] == NULL)
Q931AddDialect(Q931_Dialect_DMS + Q931_TE, DMSCreateTE);
if (Q931CreateDialectCB[Q931_Dialect_DMS + Q931_NT] == NULL)
Q931AddDialect(Q931_Dialect_DMS + Q931_NT, DMSCreateNT);
if (Q931CreateDialectCB[Q931_Dialect_5ESS + Q931_TE] == NULL)
Q931AddDialect(Q931_Dialect_5ESS + Q931_TE, ATT5ESSCreateTE);
if (Q931CreateDialectCB[Q931_Dialect_5ESS + Q931_NT] == NULL)
Q931AddDialect(Q931_Dialect_5ESS + Q931_NT, ATT5ESSCreateNT);
/* The last step we do is to call the callbacks to create the dialects */
for (x = 0; x < Q931MAXDLCT; x++) {
if (Q931CreateDialectCB[x] != NULL) {
Q931CreateDialectCB[x]((L3UCHAR)x);
}
}
}
/**
* Q931TimerTick
* \brief Periodically called to update and check for expired timers
* \param pTrunk Q.931 trunk
*/
void Q931TimerTick(Q931_TrunkInfo_t *pTrunk)
{
struct Q931_Call *call = NULL;
L3ULONG now = 0;
L3INT x;
/* TODO: Loop through all active calls, check timers and call timout procs
* if timers are expired.
* Implement a function array so each dialect can deal with their own
* timeouts.
*/
now = Q931GetTime();
for (x = 0; x < Q931MAXCALLPERTRUNK; x++) {
call = &pTrunk->call[x];
if (!call->InUse || !call->Timer || !call->TimerID)
continue;
if (call->Timer <= now) {
/* Stop Timer */
Q931StopTimer(pTrunk, x, call->TimerID);
/* Invoke dialect timeout callback */
Q931Timeout[pTrunk->Dialect][call->TimerID](pTrunk, x);
}
}
}
/*****************************************************************************
Function: Q931Rx23
Description: Receive message from layer 2 (LAPD). Receiving a message
is always done in 2 steps. First the message must be
interpreted and translated to a static struct. Secondly
the message is processed and responded to.
The Q.931 message contains a static header that is
interpreted in this function. The rest is interpreted
in a sub function according to mestype.
Parameters: pTrunk [IN] Ptr to trunk info.
buf [IN] Ptr to buffer containing message.
Size [IN] Size of message.
Return Value: Error Code. 0 = No Error, < 0 :error, > 0 : Warning
see q931errors.h for details.
*****************************************************************************/
L3INT Q931Rx23(Q931_TrunkInfo_t *pTrunk, L3INT ind, L3UCHAR tei, L3UCHAR * buf, L3INT Size)
{
L3UCHAR *Mes = NULL;
L3INT RetCode = Q931E_NO_ERROR;
Q931mes_Generic *m = (Q931mes_Generic *) pTrunk->L3Buf;
L3INT ISize;
L3INT IOff = 0;
L3INT L2HSize = Q931L2HeaderSpace;
switch (ind) {
case Q921_DL_UNIT_DATA: /* DL-UNITDATA indication (UI frame, 3 byte header) */
L2HSize = 3;
case Q921_DL_DATA: /* DL-DATA indication (I frame, 4 byte header) */
/* Reset our decode buffer */
memset(pTrunk->L3Buf, 0, sizeof(pTrunk->L3Buf));
/* L2 Header Offset */
Mes = &buf[L2HSize];
/* Protocol Discriminator */
m->ProtDisc = Mes[IOff++];
/* CRV */
m->CRVFlag = (Mes[IOff + 1] >> 7) & 0x01;
m->CRV = Q931Uie_CRV(pTrunk, Mes, m->buf, &IOff, &ISize);
/* Message Type */
m->MesType = Mes[IOff++];
/* Store tei */
m->Tei = tei;
/* d'oh a little ugly but this saves us from:
* a) doing Q.921 work in the lower levels (extracting the TEI ourselves)
* b) adding a tei parameter to _all_ Proc functions
*/
if (tei) {
L3INT callIndex = 0;
/* Find the call using CRV */
RetCode = Q931FindCRV(pTrunk, m->CRV, &callIndex);
if (RetCode == Q931E_NO_ERROR && !pTrunk->call[callIndex].Tei) {
pTrunk->call[callIndex].Tei = tei;
}
}
Q931Log(pTrunk, Q931_LOG_DEBUG, "Received message from Q.921 (ind %d, tei %d, size %d)\nMesType: %d, CRVFlag %d (%s), CRV %d (Dialect: %d)\n", ind, m->Tei, Size,
m->MesType, m->CRVFlag, m->CRVFlag ? "Terminator" : "Originator", m->CRV, pTrunk->Dialect);
RetCode = Q931Umes[pTrunk->Dialect][m->MesType](pTrunk, Mes, (Q931mes_Generic *)pTrunk->L3Buf, IOff, Size - L2HSize);
if (RetCode >= Q931E_NO_ERROR) {
RetCode = Q931Proc[pTrunk->Dialect][m->MesType](pTrunk, pTrunk->L3Buf, 2);
}
break;
default:
break;
}
return RetCode;
}
/*****************************************************************************
Function: Q931Tx34
Description: Called from the stack to send a message to layer 4.
Parameters: Mes[IN] Ptr to message buffer.
Size[IN] Message size in bytes.
Return Value: Error Code. 0 = No Error, < 0 :error, > 0 : Warning
see q931errors.h for details.
*****************************************************************************/
L3INT Q931Tx34(Q931_TrunkInfo_t *pTrunk, L3UCHAR * Mes, L3INT Size)
{
Q931Log(pTrunk, Q931_LOG_DEBUG, "Sending message to Layer4 (size: %d)\n", Size);
if (pTrunk->Q931Tx34CBProc) {
return pTrunk->Q931Tx34CBProc(pTrunk->PrivateData34, Mes, Size);
}
return Q931E_MISSING_CB;
}
/*****************************************************************************
Function: Q931Rx43
Description: Receive message from Layer 4 (application).
Parameters: pTrunk[IN] Trunk #.
buf[IN] Message Pointer.
Size[IN] Message size in bytes.
Return Value: Error Code. 0 = No Error, < 0 :error, > 0 : Warning
see q931errors.h for details.
*****************************************************************************/
L3INT Q931Rx43(Q931_TrunkInfo_t *pTrunk,L3UCHAR * buf, L3INT Size)
{
Q931mes_Header *ptr = (Q931mes_Header*)&buf[Q931L4HeaderSpace];
L3INT RetCode = Q931E_NO_ERROR;
Q931Log(pTrunk, Q931_LOG_DEBUG, "Receiving message from Layer4 (size: %d, type: %d)\n", Size, ptr->MesType);
RetCode = Q931Proc[pTrunk->Dialect][ptr->MesType](pTrunk, buf, 4);
Q931Log(pTrunk, Q931_LOG_DEBUG, "Q931Rx43 return code: %d\n", RetCode);
return RetCode;
}
/*****************************************************************************
Function: Q931Tx32
Description: Called from the stack to send a message to L2. The input is
always a non-packed message so it will first make a proper
call to create a packed message before it transmits that
message to layer 2.
Parameters: pTrunk[IN] Trunk #
buf[IN] Ptr to message buffer.
Size[IN] Message size in bytes.
Return Value: Error Code. 0 = No Error, < 0 :error, > 0 : Warning
see q931errors.h for details.
*****************************************************************************/
L3INT Q931Tx32Data(Q931_TrunkInfo_t *pTrunk, L3UCHAR bcast, L3UCHAR * Mes, L3INT Size)
{
Q931mes_Generic *ptr = (Q931mes_Generic*)Mes;
L3INT RetCode = Q931E_NO_ERROR;
L3INT iDialect = pTrunk->Dialect;
L3INT Offset = bcast ? (Q931L2HeaderSpace - 1) : Q931L2HeaderSpace;
L3INT OSize;
Q931Log(pTrunk, Q931_LOG_DEBUG, "Sending message to Q.921 (size: %d)\n", Size);
memset(pTrunk->L2Buf, 0, sizeof(pTrunk->L2Buf));
/* Call pack function through table. */
RetCode = Q931Pmes[iDialect][ptr->MesType](pTrunk, (Q931mes_Generic *)Mes, Size, &pTrunk->L2Buf[Offset], &OSize);
if (RetCode >= Q931E_NO_ERROR) {
L3INT callIndex;
L3UCHAR tei = 0;
if (ptr->CRV) {
/* Find the call using CRV */
RetCode = Q931FindCRV(pTrunk, ptr->CRV, &callIndex);
if (RetCode != Q931E_NO_ERROR)
return RetCode;
tei = pTrunk->call[callIndex].Tei;
}
if (pTrunk->Q931Tx32CBProc) {
RetCode = pTrunk->Q931Tx32CBProc(pTrunk->PrivateData32, bcast ? Q921_DL_UNIT_DATA : Q921_DL_DATA, tei, pTrunk->L2Buf, OSize + Offset);
} else {
RetCode = Q931E_MISSING_CB;
}
}
return RetCode;
}
/*****************************************************************************
Function: Q931SetError
Description: Called from the stack to indicate an error.
Parameters: ErrID ID of ie or message causing error.
ErrPar1 Error parameter 1
ErrPar2 Error parameter 2.
*****************************************************************************/
void Q931SetError(Q931_TrunkInfo_t *pTrunk,L3INT ErrID, L3INT ErrPar1, L3INT ErrPar2)
{
if (pTrunk->Q931ErrorCBProc) {
pTrunk->Q931ErrorCBProc(pTrunk->PrivateData34, ErrID, ErrPar1, ErrPar2);
} else {
Q931ErrorProc(pTrunk->PrivateData34, ErrID, ErrPar1, ErrPar2);
}
}
void Q931SetDefaultErrorCB(Q931ErrorCB_t Q931ErrorPar)
{
Q931ErrorProc = Q931ErrorPar;
}
/*****************************************************************************
Function: Q931CreateCRV
Description: Create a CRV entry and return it's index. The function will
locate a free entry in the call tables allocate it and
allocate a unique CRV value attached to it.
Parameters: pTrunk [IN] Trunk number
callindex [OUT] return call table index.
Return Value: Error Code. 0 = No Error, < 0 :error, > 0 : Warning
see q931errors.h for details.
****************************************************************************/
L3INT Q931CreateCRV(Q931_TrunkInfo_t *pTrunk, L3INT * callIndex)
{
L3INT CRV = Q931GetUniqueCRV(pTrunk);
return Q931AllocateCRV(pTrunk, CRV, callIndex);
}
L3INT Q931ReleaseCRV(Q931_TrunkInfo_t *pTrunk, L3INT CRV)
{
int callIndex;
if ((Q931FindCRV(pTrunk, CRV, &callIndex)) == Q931E_NO_ERROR) {
pTrunk->call[callIndex].InUse = 0;
return Q931E_NO_ERROR;
}
return Q931E_INVALID_CRV;
}
/*****************************************************************************
Function: Q931AllocateCRV
Description: Allocate a call table entry and assigns the given CRV value
to it.
Parameters: pTrunk [IN] Trunk number
iCRV [IN] Call Reference Value.
callindex [OUT] return call table index.
Return Value: Error Code. 0 = No Error, < 0 :error, > 0 : Warning
see q931errors.h for details.
*****************************************************************************/
L3INT Q931AllocateCRV(Q931_TrunkInfo_t *pTrunk, L3INT iCRV, L3INT * callIndex)
{
L3INT x;
for (x = 0; x < Q931MAXCALLPERTRUNK; x++) {
if (!pTrunk->call[x].InUse) {
pTrunk->call[x].CRV = iCRV;
pTrunk->call[x].BChan = 255;
pTrunk->call[x].State = 0; /* null state - idle */
pTrunk->call[x].TimerID = 0; /* no timer running */
pTrunk->call[x].Timer = 0;
pTrunk->call[x].InUse = 1; /* mark as used */
*callIndex = x;
return Q931E_NO_ERROR;
}
}
return Q931E_TOMANYCALLS;
}
/*****************************************************************************
Function: Q931GetCallState
Description: Look up CRV and return current call state. A non existing
CRV is the same as state zero (0).
Parameters: pTrunk [IN] Trunk number.
iCRV [IN] CRV
Return Value: Call State.
*****************************************************************************/
L3INT Q931GetCallState(Q931_TrunkInfo_t *pTrunk, L3INT iCRV)
{
L3INT x;
for (x = 0; x < Q931MAXCALLPERTRUNK; x++) {
if (pTrunk->call[x].InUse) {
if (pTrunk->call[x].CRV == iCRV) {
return pTrunk->call[x].State;
}
}
}
return 0; /* assume state zero for non existing CRV's */
}
/**
* Q931StartTimer
* \brief Start a timer
* \param pTrunk Q.931 trunk
* \param callindex Index of the call
* \param iTimerID ID of timer
* \return always 0
*/
L3INT Q931StartTimer(Q931_TrunkInfo_t *pTrunk, L3INT callIndex, L3USHORT iTimerID)
{
#if 0
L3ULONG duration = Q931Timer[pTrunk->Dialect][iTimerID];
if (duration) {
pTrunk->call[callIndex].Timer = Q931GetTime() + duration;
pTrunk->call[callIndex].TimerID = iTimerID;
}
#endif
return 0;
}
/**
* Q931StopTimer
* \brief Stop a timer
* \param pTrunk Q.931 trunk
* \param callindex Index of the call
* \param iTimerID ID of timer
* \return always 0
*/
L3INT Q931StopTimer(Q931_TrunkInfo_t *pTrunk, L3INT callindex, L3USHORT iTimerID)
{
if (pTrunk->call[callindex].TimerID == iTimerID)
pTrunk->call[callindex].TimerID = 0;
return 0;
}
L3INT Q931SetState(Q931_TrunkInfo_t *pTrunk, L3INT callIndex, L3INT iState)
{
pTrunk->call[callIndex].State = iState;
return 0;
}
L3ULONG Q931GetTime()
{
L3ULONG tNow = 0;
static L3ULONG tLast = 0;
if (Q931GetTimeProc != NULL) {
tNow = Q931GetTimeProc();
if (tNow < tLast) { /* wrapped */
/* TODO */
}
tLast = tNow;
}
return tNow;
}
void Q931SetGetTimeCB(L3ULONG (*callback)(void))
{
Q931GetTimeProc = callback;
}
L3INT Q931FindCRV(Q931_TrunkInfo_t *pTrunk, L3INT crv, L3INT *callindex)
{
L3INT x;
for (x = 0; x < Q931MAXCALLPERTRUNK; x++) {
if (pTrunk->call[x].InUse) {
if (pTrunk->call[x].CRV == crv) {
*callindex = x;
return Q931E_NO_ERROR;
}
}
}
return Q931E_INVALID_CRV;
}
void Q931AddDialect(L3UCHAR i, void (*callback)(L3UCHAR iD ))
{
if (i < Q931MAXDLCT) {
Q931CreateDialectCB[i] = callback;
}
}
/*****************************************************************************
Function: Q931AddStateEntry
Description: Find an empty entry in the dialects state table and add this
entry.
*****************************************************************************/
void Q931AddStateEntry(L3UCHAR iD, L3INT iState, L3INT iMes, L3UCHAR cDir)
{
int x;
for (x = 0; x < Q931MAXSTATE; x++) {
if (Q931st[x].Message == 0) {
Q931st[x].State = iState;
Q931st[x].Message = iMes;
Q931st[x].Direction = cDir;
/* TODO Sort table and use bsearch */
return;
}
}
}
/*****************************************************************************
Function: Q931IsEventLegal
Description: Check state table for matching criteria to indicate if this
Message is legal in this state or not.
Note: Someone write a bsearch or invent something smart here
please - sequential is ok for now.
*****************************************************************************/
L3BOOL Q931IsEventLegal(L3UCHAR iD, L3INT iState, L3INT iMes, L3UCHAR cDir)
{
int x;
/* TODO Sort table and use bsearch */
for (x = 0; x < Q931MAXSTATE; x++) {
if (Q931st[x].State == iState && Q931st[x].Message == iMes &&
Q931st[x].Direction == cDir) {
return L3TRUE;
}
}
return L3FALSE;
}
/*****************************************************************************
Function: q931_error_to_name()
Description: Check state table for matching criteria to indicate if this
Message is legal in this state or not.
Note: Someone write a bsearch or invent something smart here
please - sequential is ok for now.
*****************************************************************************/
static const char *q931_error_names[] = {
"Q931E_NO_ERROR", /* 0 */
"Q931E_UNKNOWN_MESSAGE", /* -3001 */
"Q931E_ILLEGAL_IE", /* -3002 */
"Q931E_UNKNOWN_IE", /* -3003 */
"Q931E_BEARERCAP", /* -3004 */
"Q931E_HLCOMP", /* -3005 */
"Q931E_LLCOMP", /* -3006 */
"Q931E_INTERNAL", /* -3007 */
"Q931E_MISSING_CB", /* -3008 */
"Q931E_UNEXPECTED_MESSAGE", /* -3009 */
"Q931E_ILLEGAL_MESSAGE", /* -3010 */
"Q931E_TOMANYCALLS", /* -3011 */
"Q931E_INVALID_CRV", /* -3012 */
"Q931E_CALLID", /* -3013 */
"Q931E_CALLSTATE", /* -3014 */
"Q931E_CALLEDSUB", /* -3015 */
"Q931E_CALLEDNUM", /* -3016 */
"Q931E_CALLINGNUM", /* -3017 */
"Q931E_CALLINGSUB", /* -3018 */
"Q931E_CAUSE", /* -3019 */
"Q931E_CHANID", /* -3020 */
"Q931E_DATETIME", /* -3021 */
"Q931E_DISPLAY", /* -3022 */
"Q931E_KEYPADFAC", /* -3023 */
"Q931E_NETFAC", /* -3024 */
"Q931E_NOTIFIND", /* -3025 */
"Q931E_PROGIND", /* -3026 */
"Q931E_RESTARTIND", /* -3027 */
"Q931E_SEGMENT", /* -3028 */
"Q931E_SIGNAL", /* -3029 */
"Q931E_GENERIC_DIGITS" /* -3030 */
};
#define Q931_MAX_ERROR 30
const char *q931_error_to_name(q931_error_t error)
{
int index = 0;
if ((int)error < 0) {
index = (((int)error * -1) -3000);
}
if (index < 0 || index > Q931_MAX_ERROR) {
return "";
}
return q931_error_names[index];
}
/*
* Logging
*/
#include <stdarg.h>
L3INT Q931Log(Q931_TrunkInfo_t *trunk, Q931LogLevel_t level, const char *fmt, ...)
{
char buf[Q931_LOGBUFSIZE];
L3INT len;
va_list ap;
if (!trunk->Q931LogCBProc)
return 0;
if (trunk->loglevel < level)
return 0;
va_start(ap, fmt);
len = vsnprintf(buf, sizeof(buf)-1, fmt, ap);
if (len <= 0) {
/* TODO: error handling */
return -1;
}
if (len >= sizeof(buf))
len = sizeof(buf) - 1;
buf[len] = '\0';
va_end(ap);
return trunk->Q931LogCBProc(trunk->PrivateDataLog, level, buf, len);
}
/**
* Q921SetLogCB
* \brief Set Logging callback function and private data
*/
void Q931SetLogCB(Q931_TrunkInfo_t *trunk, Q931LogCB_t func, void *priv)
{
trunk->Q931LogCBProc = func;
trunk->PrivateDataLog = priv;
}
/**
* Q921SetLogLevel
* \brief Set Loglevel
*/
void Q931SetLogLevel(Q931_TrunkInfo_t *trunk, Q931LogLevel_t level)
{
if(!trunk)
return;
if (level < Q931_LOG_NONE) {
level = Q931_LOG_NONE;
} else if (level > Q931_LOG_DEBUG) {
level = Q931_LOG_DEBUG;
}
trunk->loglevel = level;
}
/**
* Q931TimeoutDummy
* \brief Dummy handler for timeouts
* \param pTrunk Q.931 trunk
* \param callIndex Index of call
*/
L3INT Q931TimeoutDummy(Q931_TrunkInfo_t *pTrunk, L3INT callIndex)
{
Q931Log(pTrunk, Q931_LOG_DEBUG, "Timer %d of call %d (CRV: %d) timed out\n", pTrunk->call[callIndex].TimerID, callIndex, pTrunk->call[callIndex].CRV);
return 0;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,598 +0,0 @@
/*****************************************************************************
FileName: Q931api.c
Contents: api (Application Programming Interface) functions.
See q931.h for description.
License/Copyright:
Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved.
email:janvb@caselaboratories.com
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the Case Labs, Ltd nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
#include "Q931.h"
#include "memory.h"
extern L3INT Q931L4HeaderSpace;
/*
L3INT Q931CreateMesIndex(L3INT mc)
{
if(mc < 0 || mc > 127 )
return Q931E_INTERNAL;
if(Q931MesCount >127)
return Q931E_INTERNAL;
Q931MesIndex[mc] = Q931MesCount ++;
return Q931E_NO_ERROR;
}
*/
/*
L3INT Q931CreateIEIndex(L3INT iec)
{
if(iec < 0 || iec > 127 )
return Q931E_INTERNAL;
if(Q931IECount > 127)
return Q931E_INTERNAL;
Q931IEIndex[iec] = Q931IECount ++;
return Q931E_NO_ERROR;
}
*/
L3INT Q931Api_InitTrunk(Q931_TrunkInfo_t *pTrunk,
Q931Dialect_t Dialect,
Q931NetUser_t NetUser,
Q931_TrunkType_t TrunkType,
Q931Tx34CB_t Q931Tx34CBProc,
Q931Tx32CB_t Q931Tx32CBProc,
Q931ErrorCB_t Q931ErrorCBProc,
void *PrivateData32,
void *PrivateData34)
{
int y, dchannel, maxchans, has_sync = 0;
switch(TrunkType)
{
case Q931_TrType_E1:
dchannel = 16;
maxchans = 31;
has_sync = 1;
break;
case Q931_TrType_T1:
case Q931_TrType_J1:
dchannel = 24;
maxchans = 24;
break;
case Q931_TrType_BRI:
case Q931_TrType_BRI_PTMP:
dchannel = 3;
maxchans = 3;
break;
default:
return 0;
}
pTrunk->Q931Tx34CBProc = Q931Tx34CBProc;
pTrunk->Q931Tx32CBProc = Q931Tx32CBProc;
pTrunk->Q931ErrorCBProc = Q931ErrorCBProc;
pTrunk->PrivateData32 = PrivateData32;
pTrunk->PrivateData34 = PrivateData34;
pTrunk->LastCRV = 0;
pTrunk->Dialect = Dialect + NetUser;
pTrunk->Enabled = 0;
pTrunk->TrunkType = TrunkType;
pTrunk->NetUser = NetUser;
pTrunk->TrunkState = 0;
pTrunk->autoRestartAck = 0;
for(y=0; y < Q931MAXCHPERTRUNK; y++)
{
pTrunk->ch[y].Available = 1;
if(has_sync && y == 0)
{
pTrunk->ch[y].ChanType = Q931_ChType_Sync;
}
else if(y == dchannel)
{
pTrunk->ch[y].ChanType = Q931_ChType_D;
}
else if(y > maxchans)
{
pTrunk->ch[y].ChanType = Q931_ChType_NotUsed;
}
else
{
pTrunk->ch[y].ChanType = Q931_ChType_B;
}
}
for(y=0; y < Q931MAXCALLPERTRUNK; y++)
{
pTrunk->call[y].InUse = 0;
}
return 1;
}
void Q931SetMesProc(L3UCHAR mes, L3UCHAR dialect, q931proc_func_t *Q931ProcFunc, q931umes_func_t *Q931UmesFunc, q931pmes_func_t *Q931PmesFunc)
{
if(Q931ProcFunc != NULL)
Q931Proc[dialect][mes] = Q931ProcFunc;
if(Q931UmesFunc != NULL)
Q931Umes[dialect][mes] = Q931UmesFunc;
if(Q931PmesFunc != NULL)
Q931Pmes[dialect][mes] = Q931PmesFunc;
}
void Q931SetIEProc(L3UCHAR iec, L3UCHAR dialect, q931pie_func_t *Q931PieProc, q931uie_func_t *Q931UieProc)
{
if(Q931PieProc != NULL)
Q931Pie[dialect][iec] = Q931PieProc;
if(Q931UieProc != NULL)
Q931Uie[dialect][iec] = Q931UieProc;
}
void Q931SetTimeoutProc(L3UCHAR dialect, L3UCHAR timer, q931timeout_func_t *Q931TimeoutProc)
{
if(Q931Timeout != NULL)
Q931Timeout[dialect][timer] = Q931TimeoutProc;
}
void Q931SetTimerDefault(L3UCHAR dialect, L3UCHAR timer, q931timer_t timeout)
{
Q931Timer[dialect][timer] = timeout;
}
L3INT Q931GetMesSize(Q931mes_Generic *pMes)
{
L3UCHAR *p = &pMes->buf[0];
L3INT Size = (L3INT)(p - (L3UCHAR *)pMes);
return Size;
}
/*****************************************************************************
Function: q931AppendIE
Description: Append IE to the message.
Parameters: pm Ptr to message.
pi Ptr to information element
Return Value ie setting
*****************************************************************************/
ie Q931AppendIE( L3UCHAR *pm, L3UCHAR *pi)
{
ie IE = 0;
Q931mes_Generic * pMes= (Q931mes_Generic *)pm;
Q931ie_BearerCap * pIE= (Q931ie_BearerCap *)pi;
L3INT iISize = pIE->Size;
L3UCHAR *pBuf = &pMes->buf[0];
L3INT Off = (L3INT)(pMes->Size - (pBuf - pm));
IE = (ie)(Off | 0x8000);
memcpy(&pm[pMes->Size], pi, iISize);
pMes->Size += iISize;
return IE;
}
/*****************************************************************************
*****************************************************************************/
static L3INT crv={1};
L3INT Q931GetUniqueCRV(Q931_TrunkInfo_t *pTrunk)
{
L3INT max = (Q931_IS_BRI(pTrunk)) ? Q931_BRI_MAX_CRV : Q931_PRI_MAX_CRV;
crv++;
crv = (crv <= max) ? crv : 1;
return crv;
}
L3INT Q931InitMesGeneric(Q931mes_Generic *pMes)
{
memset(pMes, 0, sizeof(*pMes));
pMes->ProtDisc = 0x08;
pMes->Size = Q931GetMesSize(pMes);
return 0;
}
L3INT Q931InitMesResume(Q931mes_Generic * pMes)
{
pMes->ProtDisc = 0x08;
pMes->CRV = 0; /* CRV to be allocated, might be receive*/
pMes->MesType = Q931mes_RESUME;
pMes->Size = Q931GetMesSize(pMes);
pMes->CallID = 0; /* Channel Identification */
return 0;
}
L3INT Q931InitMesRestartAck(Q931mes_Generic * pMes)
{
pMes->ProtDisc = 0x08;
pMes->CRV = 0; /* CRV to be allocated, might be receive*/
pMes->MesType = Q931mes_RESTART_ACKNOWLEDGE;
pMes->Size = Q931GetMesSize(pMes);
pMes->ChanID = 0; /* Channel Identification */
pMes->Display = 0;
pMes->RestartInd = 0;
pMes->RestartWin = 0;
return 0;
}
L3INT Q931InitIEBearerCap(Q931ie_BearerCap *pIE)
{
pIE->IEId = Q931ie_BEARER_CAPABILITY;
pIE->Size = sizeof(Q931ie_BearerCap);
pIE->CodStand = 0;
pIE->ITC = 0;
pIE->TransMode = 0;
pIE->ITR = 0x10;
pIE->RateMul = 0;
pIE->Layer1Ident = 0;
pIE->UIL1Prot = 0; /* User Information Layer 1 Protocol */
pIE->SyncAsync = 0; /* Sync/Async */
pIE->Negot = 0;
pIE->UserRate = 0;
pIE->InterRate = 0; /* Intermediate Rate */
pIE->NIConTx = 0;
pIE->NIConRx = 0;
pIE->FlowCtlTx = 0; /* Flow control on Tx */
pIE->FlowCtlRx = 0; /* Flow control on Rx */
pIE->HDR = 0;
pIE->MultiFrame = 0; /* Multi frame support */
pIE->Mode = 0;
pIE->LLInegot = 0;
pIE->Assignor = 0; /* Assignor/assignee */
pIE->InBandNeg = 0; /* In-band/out-band negot. */
pIE->NumStopBits = 0; /* Number of stop bits */
pIE->NumDataBits = 0; /* Number of data bits. */
pIE->Parity = 0;
pIE->DuplexMode = 0;
pIE->ModemType = 0;
pIE->Layer2Ident = 0;
pIE->UIL2Prot = 0; /* User Information Layer 2 Protocol */
pIE->Layer3Ident = 0;
pIE->UIL3Prot = 0; /* User Information Layer 3 Protocol */
pIE->AL3Info1 = 0;
pIE->AL3Info2 = 0;
return 0;
}
L3INT Q931InitIEChanID(Q931ie_ChanID *pIE)
{
pIE->IEId = Q931ie_CHANNEL_IDENTIFICATION;
pIE->Size = sizeof(Q931ie_ChanID);
pIE->IntIDPresent = 0; /* Int. id. present */
pIE->IntType = 0; /* Int. type */
pIE->PrefExcl = 0; /* Pref./Excl. */
pIE->DChanInd = 0; /* D-channel ind. */
pIE->InfoChanSel = 0; /* Info. channel selection */
pIE->InterfaceID = 0; /* Interface identifier */
pIE->CodStand = 0; /* Code standard */
pIE->NumMap = 0; /* Number/Map */
pIE->ChanMapType = 0; /* Channel type/Map element type */
pIE->ChanSlot = 0; /* Channel number/Slot map */
return 0;
}
L3INT Q931InitIEProgInd(Q931ie_ProgInd * pIE)
{
pIE->IEId = Q931ie_PROGRESS_INDICATOR;
pIE->Size = sizeof(Q931ie_ProgInd);
pIE->CodStand = 0; /* Coding standard */
pIE->Location = 0; /* Location */
pIE->ProgDesc = 0; /* Progress description */
return 0;
}
L3INT Q931InitIENetFac(Q931ie_NetFac * pIE)
{
pIE->IEId = Q931ie_NETWORK_SPECIFIC_FACILITIES;
pIE->Size = sizeof(Q931ie_NetFac);
pIE->LenNetID = 0; /* Length of network facilities id. */
pIE->TypeNetID = 0; /* Type of network identification */
pIE->NetIDPlan = 0; /* Network identification plan. */
pIE->NetFac = 0; /* Network specific facility spec. */
pIE->NetID[0] = 0;
return 0;
}
L3INT Q931InitIEDisplay(Q931ie_Display * pIE)
{
pIE->IEId = Q931ie_DISPLAY;
pIE->Size = sizeof(Q931ie_Display);
pIE->Display[0] = 0;
return 0;
}
L3INT Q931InitIEDateTime(Q931ie_DateTime * pIE)
{
pIE->IEId = Q931ie_DATETIME;
pIE->Size = sizeof(Q931ie_DateTime);
pIE->Year = 0; /* Year */
pIE->Month = 0; /* Month */
pIE->Day = 0; /* Day */
pIE->Hour = 0; /* Hour */
pIE->Minute = 0; /* Minute */
pIE->Second = 0; /* Second */
return 0;
}
L3INT Q931InitIEKeypadFac(Q931ie_KeypadFac * pIE)
{
pIE->IEId = Q931ie_KEYPAD_FACILITY;
pIE->Size = sizeof(Q931ie_KeypadFac);
pIE->KeypadFac[0] = 0;
return 0;
}
L3INT Q931InitIESignal(Q931ie_Signal * pIE)
{
pIE->IEId = Q931ie_SIGNAL;
pIE->Size = sizeof(Q931ie_Signal);
pIE->Signal = 0;
return 0;
}
L3INT Q931InitIECallingNum(Q931ie_CallingNum * pIE)
{
pIE->IEId = Q931ie_CALLING_PARTY_NUMBER;
pIE->Size = sizeof(Q931ie_CallingNum);
pIE->TypNum = 0; /* Type of number */
pIE->NumPlanID = 0; /* Numbering plan identification */
pIE->PresInd = 0; /* Presentation indicator */
pIE->ScreenInd = 0; /* Screening indicator */
pIE->Digit[0] = 0; /* Number digits (IA5) */
return 0;
}
L3INT Q931InitIECallingSub(Q931ie_CallingSub * pIE)
{
pIE->IEId = Q931ie_CALLING_PARTY_SUBADDRESS;
pIE->Size = sizeof(Q931ie_CallingSub);
pIE->TypNum = 0; /* Type of subaddress */
pIE->OddEvenInd = 0; /* Odd/Even indicator */
pIE->Digit[0] = 0; /* Digits */
return 0;
}
L3INT Q931InitIECalledNum(Q931ie_CalledNum * pIE)
{
pIE->IEId = Q931ie_CALLED_PARTY_NUMBER;
pIE->Size = sizeof(Q931ie_CalledNum);
pIE->TypNum = 0; /* Type of Number */
pIE->NumPlanID = 0; /* Numbering plan identification */
pIE->Digit[0] = 0; /* Digit (IA5) */
return 0;
}
L3INT Q931InitIECalledSub(Q931ie_CalledSub * pIE)
{
pIE->IEId = Q931ie_CALLED_PARTY_SUBADDRESS;
pIE->Size = sizeof(Q931ie_CalledSub);
pIE->TypNum = 0; /* Type of subaddress */
pIE->OddEvenInd = 0; /* Odd/Even indicator */
pIE->Digit[0] = 0; /* Digits */
return 0;
}
L3INT Q931InitIETransNetSel(Q931ie_TransNetSel * pIE)
{
pIE->IEId = Q931ie_TRANSIT_NETWORK_SELECTION;
pIE->Size = sizeof(Q931ie_TransNetSel);
pIE->Type = 0; /* Type of network identifier */
pIE->NetIDPlan = 0; /* Network idetification plan */
pIE->NetID[0] = 0; /* Network identification(IA5) */
return 0;
}
L3INT Q931InitIELLComp(Q931ie_LLComp * pIE)
{
pIE->IEId = Q931ie_LOW_LAYER_COMPATIBILITY;
pIE->Size = sizeof(Q931ie_LLComp);
pIE->CodStand = 0; /* Coding standard */
pIE->ITransCap = 0; /* Information transfer capability */
pIE->NegotInd = 0; /* Negot indic. */
pIE->TransMode = 0; /* Transfer Mode */
pIE->InfoRate = 0; /* Information transfer rate */
pIE->RateMul = 0; /* Rate multiplier */
pIE->Layer1Ident = 0; /* Layer 1 ident. */
pIE->UIL1Prot = 0; /* User information layer 1 protocol */
pIE->SyncAsync = 0; /* Synch/asynch */
pIE->Negot = 0; /* Negot */
pIE->UserRate = 0; /* User rate */
pIE->InterRate = 0; /* Intermediate rate */
pIE->NIConTx = 0; /* NIC on Tx */
pIE->NIConRx = 0; /* NIC on Rx */
pIE->FlowCtlTx = 0; /* Flow control on Tx */
pIE->FlowCtlRx = 0; /* Flow control on Rx */
pIE->HDR = 0; /* Hdr/no hdr */
pIE->MultiFrame = 0; /* Multiframe */
pIE->ModeL1 = 0; /* Mode L1 */
pIE->NegotLLI = 0; /* Negot. LLI */
pIE->Assignor = 0; /* Assignor/Assignor ee */
pIE->InBandNeg = 0; /* In-band negot. */
pIE->NumStopBits = 0; /* Number of stop bits */
pIE->NumDataBits = 0; /* Number of data bits */
pIE->Parity = 0; /* Parity */
pIE->DuplexMode = 0; /* Duplex Mode */
pIE->ModemType = 0; /* Modem type */
pIE->Layer2Ident = 0; /* Layer 2 ident. */
pIE->UIL2Prot = 0; /* User information layer 2 protocol */
pIE->ModeL2 = 0; /* ModeL2 */
pIE->Q933use = 0; /* Q.9333 use */
pIE->UsrSpcL2Prot = 0; /* User specified layer 2 protocol info */
pIE->WindowSize = 0; /* Window size (k) */
pIE->Layer3Ident = 0; /* Layer 3 ident */
pIE->OptL3Info = 0; /* Optional layer 3 protocol info. */
pIE->ModeL3 = 0; /* Mode of operation */
#if 0
pIE->ModeX25op = 0; /* Mode of operation X.25 */
#endif
pIE->DefPackSize = 0; /* Default packet size */
pIE->PackWinSize = 0; /* Packet window size */
pIE->AddL3Info = 0; /* Additional Layer 3 protocol info */
return 0;
}
L3INT Q931InitIEHLComp(Q931ie_HLComp * pIE)
{
pIE->IEId = Q931ie_HIGH_LAYER_COMPATIBILITY;
pIE->Size = sizeof(Q931ie_HLComp);
return 0;
}
L3INT Q931ProcUnknownMessage(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom)
{
/* TODO: Unhandled paramaters */
(void)pTrunk;
(void)b;
(void)iFrom;
return 0;
}
L3INT Q931ProcUnexpectedMessage(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom)
{
/* TODO: Unhandled paramaters */
(void)pTrunk;
(void)b;
(void)iFrom;
return 0;
}
L3INT Q931Disconnect(Q931_TrunkInfo_t *pTrunk, L3INT iTo, L3INT iCRV, L3INT iCause)
{
/* TODO: Unhandled paramaters */
(void)pTrunk;
(void)iTo;
(void)iCRV;
(void)iCause;
return 0;
}
L3INT Q931ReleaseComplete(Q931_TrunkInfo_t *pTrunk, L3UCHAR *buf)
{
Q931mes_Header *ptr = (Q931mes_Header*)&buf[Q931L4HeaderSpace];
ptr->MesType = Q931mes_RELEASE_COMPLETE;
ptr->CRVFlag = !(ptr->CRVFlag);
return Q931Tx32Data(pTrunk,0,buf,ptr->Size);
}
L3INT Q931AckRestart(Q931_TrunkInfo_t *pTrunk, L3UCHAR *buf)
{
L3INT RetCode;
Q931mes_Header *ptr = (Q931mes_Header*)&buf[Q931L4HeaderSpace];
ptr->MesType = Q931mes_RESTART_ACKNOWLEDGE;
//if (ptr->CRV) {
ptr->CRVFlag = !(ptr->CRVFlag);
//}
RetCode = Q931Proc[pTrunk->Dialect][ptr->MesType](pTrunk, buf, 4);
return RetCode;
}
L3INT Q931AckSetup(Q931_TrunkInfo_t *pTrunk, L3UCHAR *buf)
{
L3INT RetCode;
Q931mes_Header *ptr = (Q931mes_Header*)&buf[Q931L4HeaderSpace];
ptr->MesType = Q931mes_SETUP_ACKNOWLEDGE;
RetCode = Q931Proc[pTrunk->Dialect][ptr->MesType](pTrunk, buf, 4);
return RetCode;
}
L3INT Q931AckConnect(Q931_TrunkInfo_t *pTrunk, L3UCHAR *buf)
{
L3INT RetCode;
Q931mes_Header *ptr = (Q931mes_Header*)&buf[Q931L4HeaderSpace];
ptr->MesType = Q931mes_CONNECT_ACKNOWLEDGE;
RetCode = Q931Proc[pTrunk->Dialect][ptr->MesType](pTrunk, buf, 4);
return RetCode;
}
L3INT Q931AckService(Q931_TrunkInfo_t *pTrunk, L3UCHAR *buf)
{
L3INT RetCode;
Q931mes_Header *ptr = (Q931mes_Header*)&buf[Q931L4HeaderSpace];
ptr->MesType = Q931mes_SERVICE_ACKNOWLEDGE;
if (ptr->CRV) {
ptr->CRVFlag = !(ptr->CRVFlag);
}
RetCode = Q931Proc[pTrunk->Dialect][ptr->MesType](pTrunk, buf, 4);
return RetCode;
}
Q931_ENUM_NAMES(DIALECT_TYPE_NAMES, DIALECT_STRINGS)
Q931_STR2ENUM(q931_str2Q931Dialect_type, q931_Q931Dialect_type2str, Q931Dialect_t, DIALECT_TYPE_NAMES, Q931_Dialect_Count)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,286 +0,0 @@
/*****************************************************************************
FileName: Q932mes.c
Contents: Q.932 Message Encoders/Decoders
License/Copyright:
Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved.
email:janvb@caselaboratories.com
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the Case Labs, Ltd nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
#include "Q931.h"
/*****************************************************************************
Function: Q932Umes_Facility
*****************************************************************************/
L3INT Q932Umes_Facility(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size)
{
L3INT OOff = 0;
/* TODO */
mes->Size = sizeof(Q931mes_Generic) - 1 + OOff;
return Q931E_NO_ERROR;
}
/*****************************************************************************
Function: Q931Pmes_Facility
*****************************************************************************/
L3INT Q932Pmes_Facility(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize)
{
L3BOOL RetCode = L3FALSE;
NoWarning(OBuf);
NoWarning(IBuf);
return RetCode;
}
/*****************************************************************************
Function: Q932Umes_Hold
*****************************************************************************/
L3INT Q932Umes_Hold(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size)
{
L3INT OOff = 0;
/* TODO */
mes->Size = sizeof(Q931mes_Generic) - 1 + OOff;
return Q931E_NO_ERROR;
}
/*****************************************************************************
Function: Q931Pmes_Hold
*****************************************************************************/
L3INT Q932Pmes_Hold(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize)
{
L3BOOL RetCode = L3FALSE;
NoWarning(OBuf);
NoWarning(IBuf);
return RetCode;
}
/*****************************************************************************
Function: Q932Umes_HoldAck
*****************************************************************************/
L3INT Q932Umes_HoldAck(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size)
{
L3INT OOff = 0;
/* TODO */
mes->Size = sizeof(Q931mes_Generic) - 1 + OOff;
return Q931E_NO_ERROR;
}
/*****************************************************************************
Function: Q931Pmes_HoldAck
*****************************************************************************/
L3INT Q932Pmes_HoldAck(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize)
{
L3BOOL RetCode = L3FALSE;
NoWarning(OBuf);
NoWarning(IBuf);
return RetCode;
}
/*****************************************************************************
Function: Q932Umes_HoldReject
*****************************************************************************/
L3INT Q932Umes_HoldReject(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size)
{
L3INT OOff = 0;
/* TODO */
mes->Size = sizeof(Q931mes_Generic) - 1 + OOff;
return Q931E_NO_ERROR;
}
/*****************************************************************************
Function: Q931Pmes_HoldReject
*****************************************************************************/
L3INT Q932Pmes_HoldReject(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize)
{
L3BOOL RetCode = L3FALSE;
NoWarning(OBuf);
NoWarning(IBuf);
return RetCode;
}
/*****************************************************************************
Function: Q932Umes_Register
*****************************************************************************/
L3INT Q932Umes_Register(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size)
{
L3INT OOff = 0;
/* TODO */
mes->Size = sizeof(Q931mes_Generic) - 1 + OOff;
return Q931E_NO_ERROR;
}
/*****************************************************************************
Function: Q931Pmes_Register
*****************************************************************************/
L3INT Q932Pmes_Register(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize)
{
L3BOOL RetCode = L3FALSE;
NoWarning(OBuf);
NoWarning(IBuf);
return RetCode;
}
/*****************************************************************************
Function: Q932Umes_Retrieve
*****************************************************************************/
L3INT Q932Umes_Retrieve(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size)
{
L3INT OOff = 0;
/* TODO */
mes->Size = sizeof(Q931mes_Generic) - 1 + OOff;
return Q931E_NO_ERROR;
}
/*****************************************************************************
Function: Q931Pmes_Retrieve
*****************************************************************************/
L3INT Q932Pmes_Retrieve(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize)
{
L3BOOL RetCode = L3FALSE;
NoWarning(OBuf);
NoWarning(IBuf);
return RetCode;
}
/*****************************************************************************
Function: Q932Umes_RetrieveAck
*****************************************************************************/
L3INT Q932Umes_RetrieveAck(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size)
{
L3INT OOff = 0;
/* TODO */
mes->Size = sizeof(Q931mes_Generic) - 1 + OOff;
return Q931E_NO_ERROR;
}
/*****************************************************************************
Function: Q931Pmes_RetrieveAck
*****************************************************************************/
L3INT Q932Pmes_RetrieveAck(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize)
{
L3BOOL RetCode = L3FALSE;
NoWarning(OBuf);
NoWarning(IBuf);
return RetCode;
}
/*****************************************************************************
Function: Q932Umes_RetrieveReject
*****************************************************************************/
L3INT Q932Umes_RetrieveReject(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size)
{
L3INT OOff = 0;
/* TODO */
mes->Size = sizeof(Q931mes_Generic) - 1 + OOff;
return Q931E_NO_ERROR;
}
/*****************************************************************************
Function: Q931Pmes_RetrieveReject
*****************************************************************************/
L3INT Q932Pmes_RetrieveReject(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize)
{
L3BOOL RetCode = L3FALSE;
NoWarning(OBuf);
NoWarning(IBuf);
return RetCode;
}

View File

@ -1,103 +0,0 @@
/******************************************************************************
FileName: 5ESS.h
Contents: Header and definition for the AT&T 5ESS ISDN dialect. The
header contains the following parts:
- Definition of codes
- Definition of information elements (5ESSie_).
- Definition of messages (5ESSmes_).
- Function prototypes.
Description: The AT&T 5ESS ISDN dialect here covers ????
Related Files: 5ESS.h AT&T 5ESS ISDN Definitions
5ESSie.c AT&T 5ESS ISDN IE encoders/coders (not extant yet)
See Q931ie.c for IE encoders/coders
5ESSStateTE.c AT&T 5ESS ISDN TE State Engine
5ESSStateNT.c AT&T 5ESS ISDN NT State Engine
License/Copyright:
Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved.
email:janvb@caselaboratories.com
Copyright (c) 2007, Michael Jerris. All rights reserved.
email:mike@jerris.com
Copyright (c) 2007, Michael S. Collins, All rights reserved.
email:mcollins@fcnetwork.com
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the Case Labs, Ltd nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
******************************************************************************/
#ifndef _5ESS_NL
#define _5ESS_NL
#include "Q931.h"
/*****************************************************************************
Q.931 Message codes
Only 5ESS specific message and ie types
here the rest are inherited from Q931.h
*****************************************************************************/
/*****************************************************************************
Q.931 Message Pack/Unpack functions. Implemented in 5ESSmes.c
Note: Because C variables may not begin with numeric digit, all identifiers
are prefixed with "ATT5ESS" instead of a bare "5ESS"
*****************************************************************************/
L3INT ATT5ESSUmes_Setup(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *OBuf, L3INT IOff, L3INT Size);
L3INT ATT5ESSPmes_Setup(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize);
L3INT ATT5ESSUmes_SetupAck(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *OBuf, L3INT IOff, L3INT Size);
L3INT ATT5ESSPmes_SetupAck(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize);
L3INT ATT5ESSUmes_0x07(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size);
L3INT ATT5ESSPmes_0x07(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize);
L3INT ATT5ESSUmes_0x0f(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size);
L3INT ATT5ESSPmes_0x0f(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize);
/*****************************************************************************
Q.931 Process Function Prototyping. Implemented in 5ESSStateTE.c
*****************************************************************************/
L3INT ATT5ESSProc0x0fTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom);
L3INT ATT5ESSProc0x07TE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom);
void ATT5ESSCreateTE(L3UCHAR i);
void ATT5ESSCreateNT(L3UCHAR i);
#endif /* _5ESS_NL */

View File

@ -1,91 +0,0 @@
/******************************************************************************
FileName: national.h
Contents: Header and definition for the National ISDN dialect. The
header contents the following parts:
- Definition of codes
- Definition of information elements (nationalie_).
- Definition of messages (nationalmes_).
- Function prototypes.
Description: The National ISDN dialect here covers ????
Related Files: national.h National ISDN Definitions
nationalie.c National ISDN IE encoders/coders
nationalStateTE.c National ISDN TE State Engine
nationalStateNT.c National ISDN NT State Engine
License/Copyright:
Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved.
email:janvb@caselaboratories.com
Copyright (c) 2007, Michael Jerris. All rights reserved.
email:mike@jerris.com
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the Case Labs, Ltd nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
******************************************************************************/
#ifndef _DMS_NL
#define _DMS_NL
#include "Q931.h"
/*****************************************************************************
Q.931 Message codes
Only National specific message and ie types
here the rest are inherited from national.h
*****************************************************************************/
/*****************************************************************************
Q.931 Message Pack/Unpack functions. Implemented in nationalmes.c
*****************************************************************************/
L3INT DMSUmes_Setup(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *OBuf, L3INT IOff, L3INT Size);
L3INT DMSPmes_Setup(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize);
L3INT DMSUmes_0x07(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size);
L3INT DMSPmes_0x07(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize);
L3INT DMSUmes_0x0f(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size);
L3INT DMSPmes_0x0f(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize);
/*****************************************************************************
Q.931 Process Function Prototyping. Implemented in nationalStateTE.c
*****************************************************************************/
L3INT DMSProc0x0fTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom);
L3INT DMSProc0x07TE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom);
void DMSCreateTE(L3UCHAR i);
void DMSCreateNT(L3UCHAR i);
#endif /* _DMS_NL */

View File

@ -1,227 +0,0 @@
/*****************************************************************************
FileName: q921.h
Description: Contains headers of a Q.921 protocol.
Note: This header file is the only include file that should be
acessed by users of the Q.921 stack.
Interface: The Q.921 stack contains 2 layers.
- One interface layer.
- One driver layer.
The interface layer contains the interface functions required
for a layer 2 stack to be able to send and receive messages.
The driver layer will simply feed bytes into the ship as
required and queue messages received out from the ship.
Q921TimeTick The Q.921 like any other blackbox
modules contains no thread by it's own
and must therefore be called regularly
by an external 'thread' to do maintenance
etc.
Q921Rx32 Receive message from layer 3. Called by
the layer 3 stack to send a message.
NOTE: The following are not yet implemented
OnQ921Error Function called every if an error is
detected.
OnQ921Log Function called if logging is active.
<TODO> Maintenance/Configuration interface
<TODO> Logging
<TODO> DL_ message passing to layer 3
<TODO> Timers
<TODO> Api commands to tell 921 to stop and start for a trunk
Created: 27.dec.2000/JVB
License/Copyright:
Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved.
email:janvb@caselaboratories.com
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the Case Labs, Ltd nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
/****************************************************************************
* Changes:
*
* - June,July 2008: Stefan Knoblich <s.knoblich@axsentis.de>:
* Add PTMP TEI management
* Add timers
* Add retransmit counters
* Add logging
* Various cleanups
*
****************************************************************************/
#ifndef _Q921
#define _Q921
#define Q921MAXHDLCSPACE 3000
#define L2UCHAR unsigned char /* Min 8 bit */
#define L2USHORT unsigned short /* 16 bit */
#define L2INT int /* Min 16 bit signed */
#define L2ULONG unsigned long /* Min 32 bit */
#define L2TRUNK Q921Data_t *
#define Q921_TEI_BCAST 127
#define Q921_TEI_MAX Q921_TEI_BCAST
#define Q921_TEI_DYN_MIN 64
#define Q921_TEI_DYN_MAX 126
typedef enum /* Network/User Mode */
{
Q921_TE=0, /* 0 : User Mode */
Q921_NT=1 /* 1 : Network Mode */
} Q921NetUser_t;
typedef enum /* Type of connection */
{
Q921_PTP=0, /* 0 : Point-To-Point */
Q921_PTMP=1 /* 1 : Point-To-Multipoint */
} Q921NetType_t;
typedef enum
{
Q921_LOG_NONE = -1,
Q921_LOG_EMERG = 0,
Q921_LOG_ALERT,
Q921_LOG_CRIT,
Q921_LOG_ERROR,
Q921_LOG_WARNING,
Q921_LOG_NOTICE,
Q921_LOG_INFO,
Q921_LOG_DEBUG
} Q921LogLevel_t;
/*
* Messages for L2 <-> L3 communication
*/
typedef enum {
Q921_DL_ESTABLISH = 0,
Q921_DL_ESTABLISH_CONFIRM,
Q921_DL_RELEASE,
Q921_DL_RELEASE_CONFIRM,
Q921_DL_DATA,
Q921_DL_UNIT_DATA
} Q921DLMsg_t;
typedef int (*Q921Tx21CB_t) (void *, L2UCHAR *, L2INT);
typedef int (*Q921Tx23CB_t) (void *, Q921DLMsg_t ind, L2UCHAR tei, L2UCHAR *, L2INT);
typedef int (*Q921LogCB_t) (void *, Q921LogLevel_t, char *, L2INT);
struct Q921_Link;
typedef struct Q921Data
{
L2INT initialized;
L2UCHAR sapi; /*!< User assigned SAPI */
L2UCHAR tei; /*!< User assigned TEI value */
L2INT Q921HeaderSpace;
Q921NetUser_t NetUser;
Q921NetType_t NetType;
struct Q921_Link *context; /*!< per-TEI / link context space */
/* timers */
L2ULONG T202; /*!< PTMP TE mode TEI retransmit timer */
L2ULONG T200Timeout;
L2ULONG T201Timeout;
L2ULONG T202Timeout;
L2ULONG T203Timeout;
L2ULONG TM01Timeout;
/* counters */
L2ULONG N200Limit; /*!< max retransmit */
L2ULONG N202; /*!< PTMP TE mode retransmit counter */
L2ULONG N202Limit; /*!< PTMP TE mode max retransmit */
L2ULONG N201Limit; /*!< max number of octets */
L2ULONG k; /*!< max number of unacknowledged I frames */
/* callbacks and callback data pointers */
Q921Tx21CB_t Q921Tx21Proc;
Q921Tx23CB_t Q921Tx23Proc;
void *PrivateData21;
void *PrivateData23;
/* logging */
Q921LogLevel_t loglevel; /*!< trunk loglevel */
Q921LogCB_t Q921LogProc; /*!< log callback procedure */
void *PrivateDataLog; /*!< private data pointer for log proc */
/* tei mgmt */
L2UCHAR tei_map[Q921_TEI_MAX]; /*!< */
L2UCHAR HDLCInQueue[Q921MAXHDLCSPACE]; /*!< HDLC input queue */
} Q921Data_t;
/*
* Public functions
*/
int Q921_InitTrunk(L2TRUNK trunk,
L2UCHAR sapi,
L2UCHAR tei,
Q921NetUser_t NetUser,
Q921NetType_t NetType,
L2INT hsize,
Q921Tx21CB_t cb21,
Q921Tx23CB_t cb23,
void *priv21,
void *priv23);
int Q921Start(L2TRUNK trunk);
int Q921Stop(L2TRUNK trunk);
void Q921SetLogCB(L2TRUNK trunk, Q921LogCB_t func, void *priv);
void Q921SetLogLevel(L2TRUNK trunk, Q921LogLevel_t level);
int Q921Rx12(L2TRUNK trunk);
int Q921Rx32(L2TRUNK trunk, Q921DLMsg_t ind, L2UCHAR tei, L2UCHAR * Mes, L2INT Size);
int Q921QueueHDLCFrame(L2TRUNK trunk, L2UCHAR *b, L2INT size);
void Q921SetGetTimeCB(L2ULONG (*callback)(void));
void Q921TimerTick(L2TRUNK trunk);
#endif

View File

@ -1,321 +0,0 @@
/*****************************************************************************
FileName: Q921priv.h
Description: Private declarations
Created: 08.Aug.2008/STKN
License/Copyright:
Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved.
email:janvb@caselaboratories.com
Copyright (c) 2008, Stefan Knoblich, axsentis GmbH. All rights reserved.
email:s.knoblich@axsentis.de
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the Case Labs, Ltd nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
#ifndef _Q921_PRIV_H_
#define _Q921_PRIV_H_
#ifdef _MSC_VER
#ifndef __inline__
#define __inline__ __inline
#endif
#if (_MSC_VER >= 1400) /* VC8+ */
#ifndef _CRT_SECURE_NO_DEPRECATE
#define _CRT_SECURE_NO_DEPRECATE
#endif
#ifndef _CRT_NONSTDC_NO_DEPRECATE
#define _CRT_NONSTDC_NO_DEPRECATE
#endif
#endif
#ifndef strcasecmp
#define strcasecmp(s1, s2) _stricmp(s1, s2)
#endif
#ifndef strncasecmp
#define strncasecmp(s1, s2, n) _strnicmp(s1, s2, n)
#endif
#ifndef snprintf
#define snprintf _snprintf
#endif
#endif
typedef enum /* Q.921 States */
{
Q921_STATE_STOPPED = 0, /* Trunk stopped */
Q921_STATE_TEI_UNASSIGNED = 1, /* TEI unassigned */
Q921_STATE_TEI_AWAITING, /* Assign awaiting TEI */
Q921_STATE_TEI_ESTABLISH, /* Establish awaiting TEI */
Q921_STATE_TEI_ASSIGNED, /* TEI assigned */
Q921_STATE_AWAITING_ESTABLISHMENT, /* Awaiting establishment */
Q921_STATE_AWAITING_RELEASE, /* Awaiting release */
Q921_STATE_MULTIPLE_FRAME_ESTABLISHED, /* Multiple frame established */
Q921_STATE_TIMER_RECOVERY /* Timer recovery */
} Q921State_t;
/*
* Flags
*/
enum Q921_Flags {
Q921_FLAG_L3_INITIATED = (1 << 0),
Q921_FLAG_UI_FRAME_QUEUED = (1 << 1),
Q921_FLAG_I_FRAME_QUEUED = (1 << 2),
Q921_FLAG_ACK_PENDING = (1 << 3),
Q921_FLAG_REJECT = (1 << 4),
Q921_FLAG_RECV_BUSY = (1 << 5),
Q921_FLAG_PEER_RECV_BUSY = (1 << 6)
};
#define Q921_SET_FLAG(x, f) ((x)->flags |= f)
#define Q921_CHECK_FLAG(x, f) ((x)->flags & f)
#define Q921_CLEAR_FLAG(x, f) ((x)->flags &= ~f)
/*
* dynamic TEI handling
*/
#define Q921_SAPI_TEI 63 /* SAPI for all TEI Messages */
#define Q921_LAYER_ENT_ID_TEI 0x0f /* UN Layer Management Entity ID for TEI Mgmt */
#define Q921_LAYER_ENT_ID_Q931 0x08 /* Q.931 Layer Management Entity ID */
typedef enum {
Q921_TEI_ID_REQUEST = 1,
Q921_TEI_ID_ASSIGNED,
Q921_TEI_ID_DENIED,
Q921_TEI_ID_CHECKREQ,
Q921_TEI_ID_CHECKRESP,
Q921_TEI_ID_REMOVE,
Q921_TEI_ID_VERIFY
} Q921TeiMessageType_t;
/**
* Per-Datalink context
*/
struct Q921_Link {
L2UCHAR tei; /*!< This endpoint's TEI */
L2UCHAR va;
L2UCHAR vs;
L2UCHAR vr;
L2INT flags;
Q921State_t state;
L2ULONG N202; /*!< PTMP TE mode retransmit counter */
L2ULONG N200; /*!< retransmit counter (per-TEI in PTMP NT mode) */
L2ULONG TM01; /*!< Datalink inactivity disconnect timer */
L2ULONG T200;
L2ULONG T201; /*!< PTMP NT mode timer */
L2ULONG T203;
L2USHORT ri; /*!< random id for TEI request mgmt */
/* I + UI Frame queue */
L2UCHAR UIFrameQueue[Q921MAXHDLCSPACE];
L2UCHAR IFrameQueue[Q921MAXHDLCSPACE];
L2UCHAR IFrameResendQueue[Q921MAXHDLCSPACE];
};
#define Q921_LINK_CONTEXT(tr, tei) \
(Q921_IS_PTMP_NT(tr) && tei != Q921_TEI_BCAST) ? ((struct Q921_Link *)&(tr)->context[tei]) : (tr)->context
#define Q921_TRUNK_CONTEXT(tr) \
(tr)->context
#define Q921_LOGBUFSIZE 2000
#define INITIALIZED_MAGIC 42
/*
* Helper macros
*/
#define Q921_INC_COUNTER(x) (x = (x + 1) % 128)
#define Q921_DEC_COUNTER(x) (x = (x) ? (x - 1) : 127)
#define Q921_UFRAME_HEADER_SIZE 3
#define Q921_UFRAME_DATA_OFFSET(tr) ((tr)->Q921HeaderSpace + Q921_UFRAME_HEADER_SIZE)
#define Q921_SFRAME_HEADER_SIZE 4
#define Q921_SFRAME_DATA_OFFSET(tr) ((tr)->Q921HeaderSpace + Q921_SFRAME_HEADER_SIZE)
#define Q921_IFRAME_HEADER_SIZE 4
#define Q921_IFRAME_DATA_OFFSET(tr) ((tr)->Q921HeaderSpace + Q921_IFRAME_HEADER_SIZE)
#define Q921_IS_TE(x) ((x)->NetUser == Q921_TE)
#define Q921_IS_NT(x) ((x)->NetUser == Q921_NT)
#define Q921_IS_STOPPED(tr) ((tr)->state == Q921_STATE_STOPPED)
/* TODO: rework this one */
#define Q921_IS_READY(tr) ((tr)->state >= Q921_STATE_TEI_ASSIGNED)
#define Q921_IS_PTMP(x) ((x)->NetType == Q921_PTMP)
#define Q921_IS_PTMP_TE(x) ((x)->NetType == Q921_PTMP && (x)->NetUser == Q921_TE)
#define Q921_IS_PTMP_NT(x) ((x)->NetType == Q921_PTMP && (x)->NetUser == Q921_NT)
#define Q921_IS_PTP(x) ((x)->NetType == Q921_PTP)
#define Q921_IS_PTP_TE(x) ((x)->NetType == Q921_PTP && (x)->NetUser == Q921_TE)
#define Q921_IS_PTP_NT(x) ((x)->NetType == Q921_PTP && (x)->NetUser == Q921_NT)
/* Make life a little easier */
#define Q921_COMMAND(x) ((x)->NetUser == Q921_TE ? 0 : 1)
#define Q921_RESPONSE(x) ((x)->NetUser == Q921_TE ? 1 : 0)
#define Q921_IS_COMMAND(tr, x) ((x) == (Q921_IS_TE(tr) ? 1 : 0))
#define Q921_IS_RESPONSE(tr, x) ((x) == (Q921_IS_TE(tr) ? 0 : 1))
/*******************************************************************************
* Private functions
*******************************************************************************/
/*
* L1 / L2 Interface
*/
static int Q921Tx21Proc(L2TRUNK trunk, L2UCHAR *Msg, L2INT size);
static int Q921Tx23Proc(L2TRUNK trunk, Q921DLMsg_t ind, L2UCHAR tei, L2UCHAR *Msg, L2INT size);
/*
* Timers
*/
static L2ULONG Q921GetTime(void);
static void Q921T200TimerStart(L2TRUNK trunk, L2UCHAR tei);
static void Q921T200TimerStop(L2TRUNK trunk, L2UCHAR tei);
static void Q921T200TimerReset(L2TRUNK trunk, L2UCHAR tei);
static void Q921T200TimerExpire(L2TRUNK trunk, L2UCHAR tei);
static void Q921T201TimerStart(L2TRUNK trunk, L2UCHAR tei);
static void Q921T201TimerStop(L2TRUNK trunk, L2UCHAR tei);
/* static void Q921T201TimerReset(L2TRUNK trunk, L2UCHAR tei); - Unused for now */
static void Q921T201TimerExpire(L2TRUNK trunk, L2UCHAR tei);
static void Q921T202TimerStart(L2TRUNK trunk);
static void Q921T202TimerStop(L2TRUNK trunk);
static void Q921T202TimerReset(L2TRUNK trunk);
static void Q921T202TimerExpire(L2TRUNK trunk);
static void Q921T203TimerStart(L2TRUNK trunk, L2UCHAR tei);
static void Q921T203TimerStop(L2TRUNK trunk, L2UCHAR tei);
static void Q921T203TimerReset(L2TRUNK trunk, L2UCHAR tei);
static void Q921T203TimerExpire(L2TRUNK trunk, L2UCHAR tei);
static void Q921TM01TimerStart(L2TRUNK trunk, L2UCHAR tei);
/* static void Q921TM01TimerStop(L2TRUNK trunk, L2UCHAR tei); - Unused for now */
static void Q921TM01TimerReset(L2TRUNK trunk, L2UCHAR tei);
/* static void Q921TM01TimerExpire(L2TRUNK trunk, L2UCHAR tei); - Unused for now */
/*
* Frame encoding
*/
static int Q921SendS(L2TRUNK trunk, L2UCHAR Sapi, char cr, L2UCHAR Tei, char pf, L2UCHAR sv, L2UCHAR *mes, L2INT size);
static int Q921SendU(L2TRUNK trunk, L2UCHAR Sapi, char cr, L2UCHAR Tei, char pf, L2UCHAR m, L2UCHAR *mes, L2INT size);
static int Q921SendRNR(L2TRUNK trunk, int Sapi, int cr, int Tei, int pf);
static int Q921SendREJ(L2TRUNK trunk, int Sapi, int cr, int Tei, int pf);
static int Q921SendSABME(L2TRUNK trunk, int Sapi, int cr, int Tei, int pf);
static int Q921SendDM(L2TRUNK trunk, int Sapi, int cr, int Tei, int pf);
static int Q921SendDISC(L2TRUNK trunk, int Sapi, int cr, int Tei, int pf);
static int Q921SendUA(L2TRUNK trunk, int Sapi, int cr, int Tei, int pf);
static int Q921SendUN(L2TRUNK trunk, int Sapi, int cr, int Tei, int pf, L2UCHAR *mes, L2INT size);
static int Q921SendRR(L2TRUNK trunk, int Sapi, int cr, int Tei, int pf);
/*
* Frame decoding
*/
static int Q921ProcIFrame(L2TRUNK trunk, L2UCHAR *mes, L2INT size);
static int Q921ProcSFrame(L2TRUNK trunk, L2UCHAR *mes, L2INT size);
static int Q921ProcUFrame(L2TRUNK trunk, L2UCHAR *mes, L2INT size);
static int Q921ProcSABME(L2TRUNK trunk, L2UCHAR *mes, L2INT size);
static int Q921ProcDM(L2TRUNK trunk, L2UCHAR *mes, L2INT size);
static int Q921ProcUA(L2TRUNK trunk, L2UCHAR *mes, L2INT size);
static int Q921ProcDISC(L2TRUNK trunk, L2UCHAR *mes, L2INT size);
static int Q921ProcRR(L2TRUNK trunk, L2UCHAR *mes, L2INT size);
static int Q921ProcRNR(L2TRUNK trunk, L2UCHAR *mes, L2INT size);
static int Q921ProcREJ(L2TRUNK trunk, L2UCHAR *mes, L2INT size);
/*
* (Common) procedures defined in the Q.921 SDL
*/
static int Q921SendEnquiry(L2TRUNK trunk, L2UCHAR tei);
static int Q921SendEnquiryResponse(L2TRUNK trunk, L2UCHAR tei);
static void Q921ResetExceptionConditions(L2TRUNK trunk, L2UCHAR tei);
static int Q921EstablishDataLink(L2TRUNK trunk, L2UCHAR tei);
static int Q921NrErrorRecovery(L2TRUNK trunk, L2UCHAR tei);
static int Q921InvokeRetransmission(L2TRUNK trunk, L2UCHAR tei, L2UCHAR nr);
static int Q921AcknowledgePending(L2TRUNK trunk, L2UCHAR tei);
/*
static int Q921SetReceiverBusy(L2TRUNK trunk);
static int Q921ClearReceiverBusy(L2TRUNK trunk);
*/
/*
* Queueing
*/
static int Q921SendQueuedIFrame(L2TRUNK trunk, L2UCHAR tei);
static int Q921EnqueueI(L2TRUNK trunk, L2UCHAR Sapi, char cr, L2UCHAR Tei, char pf, L2UCHAR *mes, L2INT size);
/*
* TEI management
*/
static int Q921TeiSendAssignRequest(L2TRUNK trunk);
static int Q921TeiProcAssignResponse(L2TRUNK trunk, L2UCHAR *mes, L2INT size);
static int Q921TeiSendVerifyRequest(L2TRUNK trunk);
static int Q921TeiProcCheckRequest(L2TRUNK trunk, L2UCHAR *mes, L2INT size);
static int Q921TeiProcRemoveRequest(L2TRUNK trunk, L2UCHAR *mes, L2INT size);
static int Q921TeiProcAssignRequest(L2TRUNK trunk, L2UCHAR *mes, L2INT size);
static int Q921TeiProcCheckResponse(L2TRUNK trunk, L2UCHAR *mes, L2INT size);
static int Q921TeiProcVerifyRequest(L2TRUNK trunk, L2UCHAR *mes, L2INT size);
static int Q921TeiSendRemoveRequest(L2TRUNK trunk, L2UCHAR tei);
static int Q921TeiSendDenyResponse(L2TRUNK trunk, L2UCHAR tei, L2USHORT ri);
static int Q921TeiSendAssignedResponse(L2TRUNK trunk, L2UCHAR tei, L2USHORT ri);
static int Q921TeiSendCheckRequest(L2TRUNK trunk, L2UCHAR tei);
/*
* Logging
*/
static int Q921Log(L2TRUNK trunk, Q921LogLevel_t level, const char *fmt, ...);
static int Q921LogMesg(L2TRUNK trunk, Q921LogLevel_t level, L2UCHAR received, L2UCHAR *mes, L2INT size, const char *fmt, ...);
/*
* State handling
*/
static int Q921ChangeState(L2TRUNK trunk, Q921State_t state, L2UCHAR tei);
#endif

Some files were not shown because too many files have changed in this diff Show More