--- /dev/null
+/******************************************************************************
+
+ 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 _national_NATIONAL_NL
+#define _national_NATIONAL_NL
+
+#include "Q931.h"
+
+/*****************************************************************************
+
+ Q.931 Message codes
+ Only National specific message and ie types
+ here the rest are inherited from national.h
+
+*****************************************************************************/
+
+
+/* Single octet information elements */
+
+/* Variable Length Information Elements */
+#define nationalie_GENERIC_DIGITS 0x37 /* 0011 0111 */
+
+
+
+/*****************************************************************************
+
+ Struct: nationalie_GenericDigits
+
+
+*****************************************************************************/
+
+typedef struct
+{
+ L3UCHAR IEId; /* 00110111 */
+ L3UCHAR Size; /* Length of Information Element */
+}nationalie_GenericDigits;
+
+
+/*****************************************************************************
+
+ Q.931 Information Element Pack/Unpack functions. Implemented in nationalie.c
+
+*****************************************************************************/
+
+L3INT nationalPie_GenericDigits(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet);
+L3INT nationalPie_CallingNum(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet);
+
+L3INT nationalUie_CallingNum(Q931_TrunkInfo_t *pTrunk, ie *pIE, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff);
+L3INT nationalUie_GenericDigits(Q931_TrunkInfo_t *pTrunk,ie *pIE, L3UCHAR * IBuf, L3UCHAR *OBuf, L3INT *IOff, L3INT *OOff);
+
+
+/*****************************************************************************
+
+ Q.931 Message Pack/Unpack functions. Implemented in nationalmes.c
+
+*****************************************************************************/
+L3INT nationalUmes_Setup(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT IOff, L3INT Size);
+L3INT nationalPmes_Setup(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize);
+
+/*****************************************************************************
+
+ Q.931 Process Function Prototyping. Implemented in nationalStateTE.c
+
+*****************************************************************************/
+
+
+
+void nationalCreateTE(L3UCHAR i);
+void nationalCreateNT(L3UCHAR i);
+
+#endif /* _national_NATIONAL_NL */
return ZAP_SUCCESS;
}
+#ifndef WIN32
ZIO_SPAN_POLL_EVENT_FUNCTION(wanpipe_poll_event)
{
struct pollfd pfds[ZAP_MAX_CHANNELS_SPAN];
return k ? ZAP_SUCCESS : ZAP_FAIL;
}
+#endif
+
ZIO_SPAN_NEXT_EVENT_FUNCTION(wanpipe_next_event)
{
- int i;
+ uint32_t i;
zap_oob_event_t event_id;
for(i = 1; i <= span->chan_count; i++) {
if (span->channels[i].last_event_time && !zap_test_flag((&span->channels[i]), ZAP_CHANNEL_EVENT)) {
- uint32_t diff = zap_current_time_in_ms() - span->channels[i].last_event_time;
- XX printf("%u %u %u\n", diff, (unsigned)zap_current_time_in_ms(), (unsigned)span->channels[i].last_event_time);
+ uint32_t diff = (uint32_t)(zap_current_time_in_ms() - span->channels[i].last_event_time);
+ /* XX printf("%u %u %u\n", diff, (unsigned)zap_current_time_in_ms(), (unsigned)span->channels[i].last_event_time); */
if (zap_test_flag((&span->channels[i]), ZAP_CHANNEL_WINK)) {
if (diff > wp_globals.wink_ms) {
zap_clear_flag_locked((&span->channels[i]), ZAP_CHANNEL_WINK);
wanpipe_interface.wait = wanpipe_wait;
wanpipe_interface.read = wanpipe_read;
wanpipe_interface.write = wanpipe_write;
+#ifndef WIN32
wanpipe_interface.poll_event = wanpipe_poll_event;
+#endif
wanpipe_interface.next_event = wanpipe_next_event;
*zio = &wanpipe_interface;