dyna won't you blow your horn

git-svn-id: http://svn.openzap.org/svn/openzap/trunk@517 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
Anthony Minessale
2008-08-29 15:58:59 +00:00
parent 2973d68f37
commit bc1ccab19c
34 changed files with 706 additions and 354 deletions

View File

@@ -9,6 +9,7 @@
#endif
struct hashtable;
struct hashtable_iterator;
/* Example of use:
*
@@ -168,6 +169,10 @@ hashtable_count(struct hashtable *h);
void
hashtable_destroy(struct hashtable *h, int free_keys, int free_values);
struct hashtable_iterator *hashtable_first(struct hashtable *h);
struct hashtable_iterator *hashtable_next(struct hashtable_iterator *i);
void hashtable_this(struct hashtable_iterator *i, const void **key, int *klen, void **val);
#endif /* __HASHTABLE_CWC22_H__ */
/*

View File

@@ -7,6 +7,7 @@
/*****************************************************************************/
struct entry
{
void *k, *v;
@@ -14,6 +15,12 @@ struct entry
struct entry *next;
};
struct hashtable_iterator {
int pos;
struct entry *e;
struct hashtable *h;
};
struct hashtable {
unsigned int tablelength;
struct entry **table;
@@ -22,6 +29,7 @@ struct hashtable {
unsigned int primeindex;
unsigned int (*hashfn) (void *k);
int (*eqfn) (void *k1, void *k2);
struct hashtable_iterator iterator;
};
/*****************************************************************************/

View File

@@ -479,6 +479,7 @@ struct zap_span {
zap_channel_t channels[ZAP_MAX_CHANNELS_SPAN];
zio_channel_outgoing_call_t outgoing_call;
zio_channel_request_t channel_request;
zap_span_start_t start;
void *mod_data;
char *type;
int suggest_chan_id;
@@ -579,6 +580,10 @@ uint32_t zap_hash_hashfromstring(void *ky);
uint32_t zap_running(void);
zap_status_t zap_channel_complete_state(zap_channel_t *zchan);
zap_status_t zap_channel_init(zap_channel_t *zchan);
int zap_load_modules(void);
zap_status_t zap_unload_modules(void);
zap_status_t zap_configure_span(const char *type, zap_span_t *span, zio_signal_cb_t sig_cb, ...);
zap_status_t zap_span_start(zap_span_t *span);
ZIO_CODEC_FUNCTION(zio_slin2ulaw);
ZIO_CODEC_FUNCTION(zio_ulaw2slin);

View File

@@ -1,129 +0,0 @@
/****************************************************************************
* sigboost.h $Revision: 1.5 $
*
* Definitions for the sigboost interface.
*
* WARNING WARNING WARNING
*
* This file is used by sangoma_mgd and perhaps other programs. Any changes
* to this file must be coordinated with other user programs,
*
* Copyright (C) 2005 Xygnada Technology, Inc.
*
****************************************************************************/
#ifndef _SIGBOOST_H_
#define _SIGBOOST_H_
#include <stdint.h>
#include <sys/time.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*/
SIGBOOST_EVENT_DIGIT_IN = 0x8d, /*141*/
};
enum e_sigboost_release_cause_values
{
SIGBOOST_RELEASE_CAUSE_UNDEFINED = 0,
SIGBOOST_RELEASE_CAUSE_NORMAL = 16,
/* 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,
};
#define MAX_DIALED_DIGITS 31
/* Next two defines are used to create the range of values for call_setup_id
* in the t_sigboost structure.
* 0..((CORE_MAX_SPANS * CORE_MAX_CHAN_PER_SPAN) - 1) */
#define CORE_MAX_SPANS 200
#define CORE_MAX_CHAN_PER_SPAN 30
#define MAX_PENDING_CALLS CORE_MAX_SPANS * CORE_MAX_CHAN_PER_SPAN
/* 0..(MAX_PENDING_CALLS-1) is range of call_setup_id below */
#define SIZE_RDNIS 128
#pragma pack(1)
typedef struct
{
uint32_t event_id;
/* delete sequence numbers - SCTP does not need them */
uint32_t fseqno;
uint32_t bseqno;
uint16_t call_setup_id;
uint32_t trunk_group;
uint8_t span;
uint8_t chan;
struct timeval tv;
uint8_t called_number_digits_count;
char called_number_digits [MAX_DIALED_DIGITS + 1]; /* it's a null terminated string */
uint8_t calling_number_digits_count; /* it's an array */
char calling_number_digits [MAX_DIALED_DIGITS + 1]; /* it's a null terminated string */
/* ref. Q.931 Table 4-11 and Q.951 Section 3 */
uint8_t calling_number_screening_ind;
uint8_t calling_number_presentation;
char calling_name[MAX_DIALED_DIGITS + 1];
uint16_t redirection_string_size;
char redirection_string [SIZE_RDNIS]; /* it's a null terminated string */
/* redir string format:
* http://www.ss7box.com/wiki/tiki-index.php?page=Call+Redirection
* */
} t_sigboost_callstart;
#define MIN_SIZE_CALLSTART_MSG (sizeof(t_sigboost_callstart) - SIZE_RDNIS)
typedef struct
{
uint32_t event_id;
/* delete sequence numbers - SCTP does not need them */
uint32_t fseqno;
uint32_t bseqno;
uint16_t call_setup_id;
uint32_t trunk_group;
uint8_t span;
uint8_t chan;
struct timeval tv;
uint8_t release_cause;
} t_sigboost_short;
#pragma pack()
static inline int boost_full_event(int event_id)
{
switch (event_id) {
case SIGBOOST_EVENT_CALL_START:
case SIGBOOST_EVENT_DIGIT_IN:
return 1;
default:
return 0;
}
return 0;
}
#endif

View File

@@ -1,148 +0,0 @@
/*
* Copyright (c) 2007, Anthony Minessale II, Nenad Corbic
* 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 _SS7BC_H
#define _SS7BC_H
#include <ctype.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#ifdef HAVE_NETINET_SCTP_H
#include <netinet/sctp.h>
#endif
#include <arpa/inet.h>
#include <stdarg.h>
#include <netdb.h>
#include <sigboost.h>
#include <sys/time.h>
#define ss7bc_test_flag(p,flag) ({ \
((p)->flags & (flag)); \
})
#define ss7bc_set_flag(p,flag) do { \
((p)->flags |= (flag)); \
} while (0)
#define ss7bc_clear_flag(p,flag) do { \
((p)->flags &= ~(flag)); \
} while (0)
#define ss7bc_copy_flags(dest,src,flagz) do { \
(dest)->flags &= ~(flagz); \
(dest)->flags |= ((src)->flags & (flagz)); \
} while (0)
typedef t_sigboost_callstart ss7bc_event_t;
typedef t_sigboost_short ss7bc_short_event_t;
typedef uint32_t ss7bc_event_id_t;
typedef struct ss7bc_ip_cfg
{
char local_ip[25];
int local_port;
char remote_ip[25];
int remote_port;
}ss7bc_ip_cfg_t;
typedef enum {
MSU_FLAG_EVENT = (1 << 0),
MSU_FLAG_DOWN = (1 << 1)
} ss7bc_flag_t;
struct ss7bc_connection {
zap_socket_t socket;
struct sockaddr_in local_addr;
struct sockaddr_in remote_addr;
ss7bc_event_t event;
struct hostent remote_hp;
struct hostent local_hp;
unsigned int flags;
zap_mutex_t *mutex;
FILE *log;
unsigned int txseq;
unsigned int rxseq;
unsigned int txwindow;
unsigned int rxseq_reset;
ss7bc_ip_cfg_t cfg;
uint32_t hb_elapsed;
};
typedef struct ss7bc_connection ss7bc_connection_t;
/* disable nagle's algorythm */
static inline void sctp_no_nagle(int socket)
{
#ifdef HAVE_NETINET_SCTP_H
int flag = 1;
setsockopt(socket, IPPROTO_SCTP, SCTP_NODELAY, (char *) &flag, sizeof(int));
#endif
}
int ss7bc_connection_close(ss7bc_connection_t *mcon);
int ss7bc_connection_open(ss7bc_connection_t *mcon, char *local_ip, int local_port, char *ip, int port);
ss7bc_event_t *__ss7bc_connection_read(ss7bc_connection_t *mcon, int iteration, const char *file, const char *func, int line);
ss7bc_event_t *__ss7bc_connection_readp(ss7bc_connection_t *mcon, int iteration, const char *file, const char *func, int line);
int __ss7bc_connection_write(ss7bc_connection_t *mcon, ss7bc_event_t *event, const char *file, const char *func, int line);
int __ss7bc_connection_writep(ss7bc_connection_t *mcon, ss7bc_event_t *event, const char *file, const char *func, int line);
#define ss7bc_connection_write(_m,_e) __ss7bc_connection_write(_m, _e, __FILE__, __func__, __LINE__)
#define ss7bc_connection_writep(_m,_e) __ss7bc_connection_writep(_m, _e, __FILE__, __func__, __LINE__)
#define ss7bc_connection_read(_m,_e) __ss7bc_connection_read(_m, _e, __FILE__, __func__, __LINE__)
#define ss7bc_connection_readp(_m,_e) __ss7bc_connection_readp(_m, _e, __FILE__, __func__, __LINE__)
void ss7bc_event_init(ss7bc_short_event_t *event, ss7bc_event_id_t event_id, int chan, int span);
void ss7bc_call_init(ss7bc_event_t *event, const char *calling, const char *called, int setup_id);
const char *ss7bc_event_id_name(uint32_t event_id);
int ss7bc_exec_command(ss7bc_connection_t *mcon, int span, int chan, int id, int cmd, int cause);
int ss7bc_exec_commandp(ss7bc_connection_t *pcon, int span, int chan, int id, int cmd, int cause);
#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 expandtab:
*/

View File

@@ -1,313 +0,0 @@
/*****************************************************************************
* wanpipe_tdm_api.h
*
* WANPIPE(tm) AFT TE1 Hardware Support
*
* Authors: Nenad Corbic <ncorbic@sangoma.com>
*
* Copyright (c) 2007, Sangoma Technologies
* 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 <organization> 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 <copyright holder> ``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 <copyright holder> 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.
* ============================================================================
* Oct 04, 2005 Nenad Corbic Initial version.
*
* Jul 25, 2006 David Rokhvarg <davidr@sangoma.com> Ported to Windows.
*****************************************************************************/
#ifndef __WANPIPE_TDM_API_IFACE_H_
#define __WANPIPE_TDM_API_IFACE_H_
#if defined(__WINDOWS__)
typedef HANDLE sng_fd_t;
#else
typedef int sng_fd_t;
#endif
enum wanpipe_tdm_api_cmds {
SIOC_WP_TDM_GET_USR_MTU_MRU, /* 0x00 */
SIOC_WP_TDM_SET_USR_PERIOD, /* 0x01 */
SIOC_WP_TDM_GET_USR_PERIOD, /* 0x02 */
SIOC_WP_TDM_SET_HW_MTU_MRU, /* 0x03 */
SIOC_WP_TDM_GET_HW_MTU_MRU, /* 0x04 */
SIOC_WP_TDM_SET_CODEC, /* 0x05 */
SIOC_WP_TDM_GET_CODEC, /* 0x06 */
SIOC_WP_TDM_SET_POWER_LEVEL, /* 0x07 */
SIOC_WP_TDM_GET_POWER_LEVEL, /* 0x08 */
SIOC_WP_TDM_TOGGLE_RX, /* 0x09 */
SIOC_WP_TDM_TOGGLE_TX, /* 0x0A */
SIOC_WP_TDM_GET_HW_CODING, /* 0x0B */
SIOC_WP_TDM_SET_HW_CODING, /* 0x0C */
SIOC_WP_TDM_GET_FULL_CFG, /* 0x0D */
SIOC_WP_TDM_SET_EC_TAP, /* 0x0E */
SIOC_WP_TDM_GET_EC_TAP, /* 0x0F */
SIOC_WP_TDM_ENABLE_RBS_EVENTS, /* 0x10 */
SIOC_WP_TDM_DISABLE_RBS_EVENTS, /* 0x11 */
SIOC_WP_TDM_WRITE_RBS_BITS, /* 0x12 */
SIOC_WP_TDM_GET_STATS, /* 0x13 */
SIOC_WP_TDM_FLUSH_BUFFERS, /* 0x14 */
SIOC_WP_TDM_READ_EVENT, /* 0x15 */
SIOC_WP_TDM_SET_EVENT,
SIOC_WP_TDM_SET_RX_GAINS,
SIOC_WP_TDM_SET_TX_GAINS,
SIOC_WP_TDM_CLEAR_RX_GAINS,
SIOC_WP_TDM_CLEAR_TX_GAINS,
SIOC_WP_TDM_GET_FE_ALARMS,
SIOC_WP_TDM_ENABLE_HWEC,
SIOC_WP_TDM_DISABLE_HWEC,
SIOC_WP_TDM_NOTSUPP /* */
};
enum wanpipe_tdm_api_events {
WP_TDMAPI_EVENT_NONE,
WP_TDMAPI_EVENT_RBS,
WP_TDMAPI_EVENT_ALARM,
WP_TDMAPI_EVENT_DTMF,
WP_TDMAPI_EVENT_RM_DTMF,
WP_TDMAPI_EVENT_RXHOOK,
WP_TDMAPI_EVENT_RING,
WP_TDMAPI_EVENT_RING_DETECT,
WP_TDMAPI_EVENT_RING_TRIP_DETECT,
WP_TDMAPI_EVENT_TONE,
WP_TDMAPI_EVENT_TXSIG_KEWL,
WP_TDMAPI_EVENT_TXSIG_START,
WP_TDMAPI_EVENT_TXSIG_OFFHOOK,
WP_TDMAPI_EVENT_TXSIG_ONHOOK,
WP_TDMAPI_EVENT_ONHOOKTRANSFER,
WP_TDMAPI_EVENT_SETPOLARITY
};
#define WP_TDMAPI_EVENT_ENABLE 0x01
#define WP_TDMAPI_EVENT_DISABLE 0x02
#define WP_TDMAPI_EVENT_MODE_DECODE(mode) \
((mode) == WP_TDMAPI_EVENT_ENABLE) ? "Enable" : \
((mode) == WP_TDMAPI_EVENT_DISABLE) ? "Disable" : \
"(Unknown mode)"
#define WPTDM_A_BIT WAN_RBS_SIG_A
#define WPTDM_B_BIT WAN_RBS_SIG_B
#define WPTDM_C_BIT WAN_RBS_SIG_C
#define WPTDM_D_BIT WAN_RBS_SIG_D
#define WP_TDMAPI_EVENT_RXHOOK_OFF 0x01
#define WP_TDMAPI_EVENT_RXHOOK_ON 0x02
#define WP_TDMAPI_EVENT_RXHOOK_DECODE(state) \
((state) == WP_TDMAPI_EVENT_RXHOOK_OFF) ? "Off-hook" : \
((state) == WP_TDMAPI_EVENT_RXHOOK_ON) ? "On-hook" : \
"(Unknown state)"
#define WP_TDMAPI_EVENT_RING_PRESENT 0x01
#define WP_TDMAPI_EVENT_RING_STOP 0x02
#define WP_TDMAPI_EVENT_RING_DECODE(state) \
((state) == WP_TDMAPI_EVENT_RING_PRESENT) ? "Ring Present" : \
((state) == WP_TDMAPI_EVENT_RING_STOP) ? "Ring Stop" : \
"(Unknown state)"
#define WP_TDMAPI_EVENT_RING_TRIP_PRESENT 0x01
#define WP_TDMAPI_EVENT_RING_TRIP_STOP 0x02
#define WP_TDMAPI_EVENT_RING_TRIP_DECODE(state) \
((state) == WP_TDMAPI_EVENT_RING_TRIP_PRESENT) ? "Ring Present" : \
((state) == WP_TDMAPI_EVENT_RING_TRIP_STOP) ? "Ring Stop" : \
"(Unknown state)"
#define WP_TDMAPI_EVENT_TONE_DIAL 0x01
#define WP_TDMAPI_EVENT_TONE_BUSY 0x02
#define WP_TDMAPI_EVENT_TONE_RING 0x03
#define WP_TDMAPI_EVENT_TONE_CONGESTION 0x04
typedef struct {
uint8_t type;
uint8_t mode;
uint32_t time_stamp;
uint16_t channel;
uint32_t chan_map;
union {
struct {
uint8_t alarm;
} te1_alarm;
struct {
uint8_t rbs_bits;
} te1_rbs;
struct {
uint8_t state;
uint8_t sig;
} rm_hook;
struct {
uint8_t state;
} rm_ring;
struct {
uint8_t type;
} rm_tone;
struct {
uint8_t digit; /* DTMF: digit */
uint8_t port; /* DTMF: SOUT/ROUT */
uint8_t type; /* DTMF: PRESET/STOP */
} dtmf;
struct {
uint16_t polarity;
uint16_t ohttimer;
} rm_common;
} wp_tdm_api_event_u;
#define wp_tdm_api_event_type type
#define wp_tdm_api_event_mode mode
#define wp_tdm_api_event_alarm wp_tdm_api_event_u.te1_alarm.alarm
#define wp_tdm_api_event_alarm wp_tdm_api_event_u.te1_alarm.alarm
#define wp_tdm_api_event_rbs_bits wp_tdm_api_event_u.te1_rbs.rbs_bits
#define wp_tdm_api_event_hook_state wp_tdm_api_event_u.rm_hook.state
#define wp_tdm_api_event_hook_sig wp_tdm_api_event_u.rm_hook.sig
#define wp_tdm_api_event_ring_state wp_tdm_api_event_u.rm_ring.state
#define wp_tdm_api_event_tone_type wp_tdm_api_event_u.rm_tone.type
#define wp_tdm_api_event_dtmf_digit wp_tdm_api_event_u.dtmf.digit
#define wp_tdm_api_event_dtmf_type wp_tdm_api_event_u.dtmf.type
#define wp_tdm_api_event_dtmf_port wp_tdm_api_event_u.dtmf.port
#define wp_tdm_api_event_ohttimer wp_tdm_api_event_u.rm_common.ohttimer
#define wp_tdm_api_event_polarity wp_tdm_api_event_u.rm_common.polarity
} wp_tdm_api_event_t;
typedef struct {
union {
unsigned char reserved[16];
}wp_rx_hdr_u;
} wp_tdm_api_rx_hdr_t;
typedef struct {
wp_tdm_api_rx_hdr_t hdr;
unsigned char data[1];
} wp_tdm_api_rx_element_t;
typedef struct {
union {
struct {
unsigned char _rbs_rx_bits;
unsigned int _time_stamp;
}wp_tx;
unsigned char reserved[16];
}wp_tx_hdr_u;
#define wp_api_time_stamp wp_tx_hdr_u.wp_tx._time_stamp
} wp_tdm_api_tx_hdr_t;
typedef struct {
wp_tdm_api_tx_hdr_t hdr;
unsigned char data[1];
} wp_tdm_api_tx_element_t;
typedef struct wp_tdm_chan_stats
{
unsigned int rx_packets; /* total packets received */
unsigned int tx_packets; /* total packets transmitted */
unsigned int rx_bytes; /* total bytes received */
unsigned int tx_bytes; /* total bytes transmitted */
unsigned int rx_errors; /* bad packets received */
unsigned int tx_errors; /* packet transmit problems */
unsigned int rx_dropped; /* no space in linux buffers */
unsigned int tx_dropped; /* no space available in linux */
unsigned int multicast; /* multicast packets received */
#if !defined(__WINDOWS__)
unsigned int collisions;
#endif
/* detailed rx_errors: */
unsigned int rx_length_errors;
unsigned int rx_over_errors; /* receiver ring buff overflow */
unsigned int rx_crc_errors; /* recved pkt with crc error */
unsigned int rx_frame_errors; /* recv'd frame alignment error */
#if !defined(__WINDOWS__)
unsigned int rx_fifo_errors; /* recv'r fifo overrun */
#endif
unsigned int rx_missed_errors; /* receiver missed packet */
/* detailed tx_errors */
#if !defined(__WINDOWS__)
unsigned int tx_aborted_errors;
unsigned int tx_carrier_errors;
#endif
unsigned int tx_fifo_errors;
unsigned int tx_heartbeat_errors;
unsigned int tx_window_errors;
}wp_tdm_chan_stats_t;
typedef struct wanpipe_tdm_api_cmd{
unsigned int cmd;
unsigned int hw_tdm_coding; /* Set/Get HW TDM coding: uLaw muLaw */
unsigned int hw_mtu_mru; /* Set/Get HW TDM MTU/MRU */
unsigned int usr_period; /* Set/Get User Period in ms */
unsigned int tdm_codec; /* Set/Get TDM Codec: SLinear */
unsigned int power_level; /* Set/Get Power level treshold */
unsigned int rx_disable; /* Enable/Disable Rx */
unsigned int tx_disable; /* Enable/Disable Tx */
unsigned int usr_mtu_mru; /* Set/Get User TDM MTU/MRU */
unsigned int ec_tap; /* Echo Cancellation Tap */
unsigned int rbs_poll; /* Enable/Disable RBS Polling */
unsigned int rbs_rx_bits; /* Rx RBS Bits */
unsigned int rbs_tx_bits; /* Tx RBS Bits */
unsigned int hdlc; /* HDLC based device */
unsigned int idle_flag; /* IDLE flag to Tx */
unsigned int fe_alarms; /* FE Alarms detected */
wp_tdm_chan_stats_t stats; /* TDM Statistics */
wp_tdm_api_event_t event; /* TDM Event */
unsigned int data_len;
void *data;
}wanpipe_tdm_api_cmd_t;
typedef struct wanpipe_tdm_api_event{
int (*wp_rbs_event)(sng_fd_t fd, unsigned char rbs_bits);
int (*wp_dtmf_event)(sng_fd_t fd, unsigned char dtmf, unsigned char type, unsigned char port);
int (*wp_rxhook_event)(sng_fd_t fd, unsigned char hook_state);
int (*wp_ring_detect_event)(sng_fd_t fd, unsigned char ring_state);
int (*wp_ring_trip_detect_event)(sng_fd_t fd, unsigned char ring_state);
int (*wp_fe_alarm_event)(sng_fd_t fd, unsigned char fe_alarm_event);
}wanpipe_tdm_api_event_t;
typedef struct wanpipe_tdm_api{
wanpipe_tdm_api_cmd_t wp_tdm_cmd;
wanpipe_tdm_api_event_t wp_tdm_event;
}wanpipe_tdm_api_t;
#endif

View File

@@ -1,59 +0,0 @@
/*
* 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.
*/
#ifndef ZAP_ANALOG_H
#define ZAP_ANALOG_H
#include "openzap.h"
typedef enum {
ZAP_ANALOG_RUNNING = (1 << 0)
} zap_analog_flag_t;
typedef struct zap_analog_data zap_analog_data_t;
zap_status_t zap_analog_start(zap_span_t *span);
zap_status_t zap_analog_configure_span(zap_span_t *span, char *tonemap, uint32_t digit_timeout, uint32_t max_dialstr, zio_signal_cb_t sig_cb);
#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 expandtab:
*/

View File

@@ -25,8 +25,8 @@ 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, const char **err);
zap_func_ptr_t zap_dso_func_sym(zap_dso_lib_t lib, const char *sym, const char **err);
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

View File

@@ -1,83 +0,0 @@
/*
* 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.
*/
#ifndef ZAP_ISDN_H
#define ZAP_ISDN_H
#include "openzap.h"
typedef enum {
ZAP_ISDN_OPT_NONE = 0,
ZAP_ISDN_OPT_SUGGEST_CHANNEL = (1 << 0)
} zap_isdn_opts_t;
typedef enum {
ZAP_ISDN_RUNNING = (1 << 0)
} zap_isdn_flag_t;
struct zap_isdn_data {
Q921Data_t q921;
Q931_TrunkInfo_t q931;
zap_channel_t *dchan;
zap_channel_t *dchans[2];
struct zap_sigmsg sigmsg;
zio_signal_cb_t sig_cb;
uint32_t flags;
int32_t mode;
zap_isdn_opts_t opts;
zap_caller_data_t *outbound_crv[32768];
zap_channel_t *channels_local_crv[32768];
zap_channel_t *channels_remote_crv[32768];
};
typedef struct zap_isdn_data zap_isdn_data_t;
zap_status_t zap_isdn_start(zap_span_t *span);
zap_status_t zap_isdn_init(void);
zap_status_t zap_isdn_configure_span(zap_span_t *span, Q921NetUser_t mode, Q931Dialect_t dialect, zap_isdn_opts_t opts, zio_signal_cb_t sig_cb);
#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 expandtab:
*/

View File

@@ -1,113 +0,0 @@
/*
* 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.
*/
#ifndef ZAP_PIKA_H
#define ZAP_PIKA_H
#include "openzap.h"
#include "pikahmpapi.h"
typedef enum {
PIKA_SPAN_FRAMING_T1_D4,
PIKA_SPAN_FRAMING_T1_ESF,
PIKA_SPAN_FRAMING_E1_BASIC,
PIKA_SPAN_FRAMING_E1_CRC4,
PIKA_SPAN_INVALID
} PIKA_TSpanFraming;
#define PIKA_SPAN_STRINGS "T1_D4", "T1_ESF", "E1_BASIC", "E1_CRC4"
ZAP_STR2ENUM_P(pika_str2span, pika_span2str, PIKA_TSpanFraming)
typedef enum {
PIKA_SPAN_ENCODING_T1_AMI_ZS_NONE,
PIKA_SPAN_ENCODING_T1_AMI_ZS_GTE,
PIKA_SPAN_ENCODING_T1_AMI_ZS_BELL,
PIKA_SPAN_ENCODING_T1_AMI_ZS_JAM8,
PIKA_SPAN_ENCODING_T1_B8ZS,
PIKA_SPAN_ENCODING_E1_AMI,
PIKA_SPAN_ENCODING_E1_HDB3,
PIKA_SPAN_ENCODING_INVALID
} PIKA_TSpanEncoding;
#define PIKA_SPAN_ENCODING_STRINGS "T1_AMI_ZS_NONE", "T1_AMI_ZS_GTE", "T1_AMI_ZS_BELL", "T1_AMI_ZS_JAM8", "T1_B8ZS", "E1_AMI", "E1_HDB3"
ZAP_STR2ENUM_P(pika_str2span_encoding, pika_span_encoding2str, PIKA_TSpanEncoding)
typedef enum {
PIKA_SPAN_LOOP_LENGTH_SHORT_HAUL,
PIKA_SPAN_LOOP_LENGTH_LONG_HAUL,
PIKA_SPAN_LOOP_INVALID
} PIKA_TSpanLoopLength;
#define PIKA_LL_STRINGS "SHORT_HAUL", "LONG_HAUL"
ZAP_STR2ENUM_P(pika_str2loop_length, pika_loop_length2str, PIKA_TSpanLoopLength)
typedef enum {
PIKA_SPAN_LBO_T1_LONG_0_DB,
PIKA_SPAN_LBO_T1_LONG_7_DB,
PIKA_SPAN_LBO_T1_LONG_15_DB,
PIKA_SPAN_LBO_T1_LONG_22_DB,
PIKA_SPAN_LBO_T1_SHORT_133_FT,
PIKA_SPAN_LBO_T1_SHORT_266_FT,
PIKA_SPAN_LBO_T1_SHORT_399_FT,
PIKA_SPAN_LBO_T1_SHORT_533_FT,
PIKA_SPAN_LBO_T1_SHORT_655_FT,
PIKA_SPAN_LBO_E1_WAVEFORM_120_OHM,
PIKA_SPAN_LBO_INVALID
} PIKA_TSpanBuildOut;
#define PIKA_LBO_STRINGS "T1_LONG_0_DB", "T1_LONG_7_DB", "T1_LONG_15_DB", "T1_LONG_22_DB", "T1_SHORT_133_FT", "T1_SHORT_266_FT", "T1_SHORT_399_FT", "T1_SHORT_533_FT", "T1_SHORT_655_FT", "E1_WAVEFORM_120_OHM"
ZAP_STR2ENUM_P(pika_str2lbo, pika_lbo2str, PIKA_TSpanBuildOut)
typedef enum {
PIKA_SPAN_COMPAND_MODE_MU_LAW = 1,
PIKA_SPAN_COMPAND_MODE_A_LAW,
PIKA_SPAN_COMPAND_MODE_INVALID
} PIKA_TSpanCompandMode;
#define PIKA_SPAN_COMPAND_MODE_STRINGS "MU_LAW", "A_LAW"
ZAP_STR2ENUM_P(pika_str2compand_mode, pika_compand_mode2str, PIKA_TSpanCompandMode)
/* Openzap PIKA hardware interface functions */
zap_status_t pika_init(zap_io_interface_t **zint);
zap_status_t pika_destroy(void);
#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 expandtab:
*/

View File

@@ -1,52 +0,0 @@
/*
* 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.
*/
#ifndef ZAP_SKEL_H
#define ZAP_SKEL_H
#include "openzap.h"
zap_status_t skel_init(zap_software_interface_t **zint);
zap_status_t skel_destroy(void);
#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 expandtab:
*/

View File

@@ -1,71 +0,0 @@
/*
* 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.
*/
#ifndef ZAP_SS7_BOOST_H
#define ZAP_SS7_BOOST_H
#include "ss7_boost_client.h"
#include "openzap.h"
typedef enum {
ZAP_SS7_BOOST_RUNNING = (1 << 0),
ZAP_SS7_BOOST_RESTARTING = (1 << 1)
} zap_ss7_boost_flag_t;
typedef struct zap_ss7_boost_data {
ss7bc_connection_t mcon;
ss7bc_connection_t pcon;
zio_signal_cb_t signal_cb;
uint32_t flags;
} zap_ss7_boost_data_t;
zap_status_t zap_ss7_boost_start(zap_span_t *span);
zap_status_t zap_ss7_boost_init(void);
zap_status_t zap_ss7_boost_configure_span(zap_span_t *span,
const char *local_ip, int local_port,
const char *remote_ip, int remote_port,
zio_signal_cb_t sig_cb);
#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 expandtab:
*/

View File

@@ -52,6 +52,7 @@ typedef int zap_filehandle_t;
#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;
@@ -383,6 +384,7 @@ 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;
#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)
@@ -402,6 +404,11 @@ typedef struct zap_caller_data zap_caller_data_t;
#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)
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 ;
@@ -421,6 +428,11 @@ 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 ;
#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
@@ -440,6 +452,24 @@ typedef zap_status_t (*zio_write_t) ZIO_WRITE_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
#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__
@@ -468,13 +498,13 @@ 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 zap_io_interface zap_io_interface_t;
typedef struct hashtable zap_hash_t;
typedef struct hashtable_itr zap_hash_itr_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 enum {
ZAP_CAUSE_NONE = 0,

View File

@@ -1,53 +0,0 @@
/*
* 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.
*/
#ifndef ZAP_WANPIPE_H
#define ZAP_WANPIPE_H
#include "openzap.h"
zap_status_t wanpipe_init(zap_io_interface_t **zint);
zap_status_t wanpipe_destroy(void);
#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 expandtab:
*/

View File

@@ -1,298 +0,0 @@
/*
* 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.
*/
#ifndef ZAP_ZT_H
#define ZAP_ZT_H
#include "openzap.h"
#include <sys/ioctl.h>
#include <poll.h>
#ifdef __sun
#include <unistd.h>
#include <sys/ioccom.h>
#include <stropts.h>
#endif
/* Hardware interface structures and defines */
/* Based on documentation of the structures required for the hardware interface */
/* from http://wiki.freeswitch.org/wiki/Zapata_zaptel_interface */
/* Structures */
/* Used with ioctl: ZT_GET_PARAMS and ZT_SET_PARAMS */
struct zt_params {
int chan_no; /* Channel Number */
int span_no; /* Span Number */
int chan_position; /* Channel Position */
int sig_type; /* Signal Type (read-only) */
int sig_cap; /* Signal Cap (read-only) */
int receive_offhook; /* Receive is offhook (read-only) */
int receive_bits; /* Number of bits in receive (read-only) */
int transmit_bits; /* Number of bits in transmit (read-only) */
int transmit_hook_sig; /* Transmit Hook Signal (read-only) */
int receive_hook_sig; /* Receive Hook Signal (read-only) */
int g711_type; /* Member of zt_g711_t (read-only) */
int idlebits; /* bits for the idle state (read-only) */
char chan_name[40]; /* Channel Name */
int prewink_time;
int preflash_time;
int wink_time;
int flash_time;
int start_time;
int receive_wink_time;
int receive_flash_time;
int debounce_time;
int pulse_break_time;
int pulse_make_time;
int pulse_after_time;
};
typedef struct zt_params zt_params_t;
/* Used with ioctl: ZT_CONFLINK, ZT_GETCONF and ZT_SETCONF */
struct zt_confinfo {
int chan_no; /* Channel Number, 0 for current */
int conference_number;
int conference_mode;
};
/* Used with ioctl: ZT_GETGAINS and ZT_SETGAINS */
struct zt_gains {
int chan_no; /* Channel Number, 0 for current */
unsigned char receive_gain[256]; /* Receive gain table */
unsigned char transmit_gain[256]; /* Transmit gain table */
};
/* Used with ioctl: ZT_SPANSTAT */
struct zt_spaninfo {
int span_no; /* span number (-1 to use name) */
char name[20]; /* Name of span */
char description[40]; /* Description of span */
int alarms; /* alarms status */
int transmit_level; /* Transmit level */
int receive_level; /* Receive level */
int bpv_count; /* Current BPV count */
int crc4_count; /* Current CRC4 error count */
int ebit_count; /* Current E-bit error count */
int fas_count; /* Current FAS error count */
int irq_misses; /* Current IRQ misses */
int sync_src; /* Span # of sync source (0 = free run) */
int configured_chan_count; /* Count of channels configured on the span */
int channel_count; /* Total count of channels on the span */
int span_count; /* Total count of zaptel spans on the system*/
};
struct zt_maintinfo {
int span_no; /* span number */
int command; /* Maintenance mode to set (from zt_maintenance_mode_t) */
};
struct zt_lineconfig {
/* Used in ZT_SPANCONFIG */
int span; /* Which span number (0 to use name) */
char name[20]; /* Name of span to use */
int lbo; /* line build-outs */
int lineconfig; /* line config parameters (framing, coding) */
int sync; /* what level of sync source we are */
};
struct zt_chanconfig {
/* Used in ZT_CHANCONFIG */
int chan; /* Channel we're applying this to (0 to use name) */
char name[40]; /* Name of channel to use */
int sigtype; /* Signal type */
int deflaw; /* Default law (ZT_LAW_DEFAULT, ZT_LAW_MULAW, or ZT_LAW_ALAW */
int master; /* Master channel if sigtype is ZT_SLAVE */
int idlebits; /* Idle bits (if this is a CAS channel) or channel to monitor (if this is DACS channel) */
char netdev_name[16]; /* name for the hdlc network device */
};
struct zt_bufferinfo {
/* used in ZT_SET_BUFINFO and ZT_GET_BUFINFO */
int txbufpolicy; /* Policy for handling receive buffers */
int rxbufpolicy; /* Policy for handling receive buffers */
int numbufs; /* How many buffers to use */
int bufsize; /* How big each buffer is */
int readbufs; /* How many read buffers are full (read-only) */
int writebufs; /* How many write buffers are full (read-only) */
};
/* Enumerations */
/* Values in zt_params structure for member g711_type */
typedef enum {
ZT_G711_DEFAULT = 0, /* Default mulaw/alaw from the span */
ZT_G711_MULAW = 1,
ZT_G711_ALAW = 2
} zt_g711_t;
typedef enum {
ZT_EVENT_NONE = 0,
ZT_EVENT_ONHOOK = 1,
ZT_EVENT_RINGOFFHOOK = 2,
ZT_EVENT_WINKFLASH = 3,
ZT_EVENT_ALARM = 4,
ZT_EVENT_NOALARM = 5,
ZT_EVENT_ABORT = 6,
ZT_EVENT_OVERRUN = 7,
ZT_EVENT_BADFCS = 8,
ZT_EVENT_DIALCOMPLETE = 9,
ZT_EVENT_RINGERON = 10,
ZT_EVENT_RINGEROFF = 11,
ZT_EVENT_HOOKCOMPLETE = 12,
ZT_EVENT_BITSCHANGED = 13,
ZT_EVENT_PULSE_START = 14,
ZT_EVENT_TIMER_EXPIRED = 15,
ZT_EVENT_TIMER_PING = 16,
ZT_EVENT_POLARITY = 17,
ZT_EVENT_RINGBEGIN = 18
} zt_event_t;
typedef enum {
ZT_FLUSH_READ = 1,
ZT_FLUSH_WRITE = 2,
ZT_FLUSH_BOTH = (ZT_FLUSH_READ | ZT_FLUSH_WRITE),
ZT_FLUSH_EVENT = 4,
ZT_FLUSH_ALL = (ZT_FLUSH_READ | ZT_FLUSH_WRITE | ZT_FLUSH_EVENT)
} zt_flush_t;
typedef enum {
ZT_IOMUX_READ = 1,
ZT_IOMUX_WRITE = 2,
ZT_IOMUX_WRITEEMPTY = 4,
ZT_IOMUX_SIGEVENT = 8,
ZT_IOMUX_NOWAIT = 256
} zt_iomux_t;
typedef enum {
ZT_ONHOOK = 0,
ZT_OFFHOOK = 1,
ZT_WINK = 2,
ZT_FLASH = 3,
ZT_START = 4,
ZT_RING = 5,
ZT_RINGOFF = 6
} zt_hookstate_t;
typedef enum {
ZT_MAINT_NONE = 0, /* Normal Mode */
ZT_MAINT_LOCALLOOP = 1, /* Local Loopback */
ZT_MAINT_REMOTELOOP = 2, /* Remote Loopback */
ZT_MAINT_LOOPUP = 3, /* Send Loopup Code */
ZT_MAINT_LOOPDOWN = 4, /* Send Loopdown Code */
ZT_MAINT_LOOPSTOP = 5 /* Stop Sending Loop Codes */
} zt_maintenance_mode_t;
typedef enum {
/* Signalling type */
ZT_SIG_NONE = 0, /* chan not configured. */
ZT_SIG_FXSLS = ((1 << 0) | (1 << 13)), /* FXS, Loopstart */
ZT_SIG_FXSGS = ((1 << 1) | (1 << 13)), /* FXS, Groundstart */
ZT_SIG_FXSKS = ((1 << 2) | (1 << 13)), /* FXS, Kewlstart */
ZT_SIG_FXOLS = ((1 << 3) | (1 << 12)), /* FXO, Loopstart */
ZT_SIG_FXOGS = ((1 << 4) | (1 << 12)), /* FXO, Groupstart */
ZT_SIG_FXOKS = ((1 << 5) | (1 << 12)), /* FXO, Kewlstart */
ZT_SIG_EM = (1 << 6), /* E&M */
ZT_SIG_CLEAR = (1 << 7),
ZT_SIG_HDLCRAW = ((1 << 8) | ZT_SIG_CLEAR),
ZT_SIG_HDLCFCS = ((1 << 9) | ZT_SIG_HDLCRAW)
} zt_sigtype_t;
/* Defines */
#define ZT_MAX_BLOCKSIZE 8192
#define ZT_DEFAULT_MTU_MRU 2048
/* ioctl defines */
#define ZT_CODE 'J'
#define ZT_GET_BLOCKSIZE _IOR (ZT_CODE, 1, int) /* Get Transfer Block Size. */
#define ZT_SET_BLOCKSIZE _IOW (ZT_CODE, 2, int) /* Set Transfer Block Size. */
#define ZT_FLUSH _IOW (ZT_CODE, 3, int) /* Flush Buffer(s) and stop I/O */
#define ZT_SYNC _IOW (ZT_CODE, 4, int) /* Wait for Write to Finish */
#define ZT_GET_PARAMS _IOR (ZT_CODE, 5, struct zt_params) /* Get channel parameters */
#define ZT_SET_PARAMS _IOW (ZT_CODE, 6, struct zt_params) /* Set channel parameters */
#define ZT_HOOK _IOW (ZT_CODE, 7, int) /* Set Hookswitch Status */
#define ZT_GETEVENT _IOR (ZT_CODE, 8, int) /* Get Signalling Event */
#define ZT_IOMUX _IOWR (ZT_CODE, 9, int) /* Wait for something to happen (IO Mux) */
#define ZT_SPANSTAT _IOWR (ZT_CODE, 10, struct zt_spaninfo) /* Get Span Status */
#define ZT_MAINT _IOW (ZT_CODE, 11, struct zt_maintinfo)/* Set Maintenance Mode for a span */
#define ZT_GETCONF _IOWR (ZT_CODE, 12, struct zt_confinfo) /* Get Conference Mode */
#define ZT_SETCONF _IOWR (ZT_CODE, 13, struct zt_confinfo) /* Set Conference Mode */
#define ZT_CONFLINK _IOW (ZT_CODE, 14, struct zt_confinfo) /* Setup or Remove Conference Link */
#define ZT_CONFDIAG _IOR (ZT_CODE, 15, int) /* Display Conference Diagnostic Information on Console */
#define ZT_GETGAINS _IOWR (ZT_CODE, 16, struct zt_gains) /* Get Channel audio gains */
#define ZT_SETGAINS _IOWR (ZT_CODE, 17, struct zt_gains) /* Set Channel audio gains */
#define ZT_SPANCONFIG _IOW (ZT_CODE, 18, struct zt_lineconfig)/* Set Line (T1) Configurations and start system */
#define ZT_CHANCONFIG _IOW (ZT_CODE, 19, struct zt_chanconfig)/* Set Channel Configuration */
#define ZT_SET_BUFINFO _IOW (ZT_CODE, 27, struct zt_bufferinfo)/* Set buffer policy */
#define ZT_GET_BUFINFO _IOR (ZT_CODE, 28, struct zt_bufferinfo)/* Get current buffer info */
#define ZT_AUDIOMODE _IOW (ZT_CODE, 32, int) /* Set a clear channel into audio mode */
#define ZT_ECHOCANCEL _IOW (ZT_CODE, 33, int) /* Control Echo Canceller */
#define ZT_HDLCRAWMODE _IOW (ZT_CODE, 36, int) /* Set a clear channel into HDLC w/out FCS checking/calculation mode */
#define ZT_HDLCFCSMODE _IOW (ZT_CODE, 37, int) /* Set a clear channel into HDLC w/ FCS mode */
/* Specify a channel on /dev/zap/chan -- must be done before any other ioctl's and is only valid on /dev/zap/chan */
#define ZT_SPECIFY _IOW (ZT_CODE, 38, int)
/* Temporarily set the law on a channel to ZT_LAW_DEFAULT, ZT_LAW_ALAW, or ZT_LAW_MULAW. Is reset on close. */
#define ZT_SETLAW _IOW (ZT_CODE, 39, int)
/* Temporarily set the channel to operate in linear mode when non-zero or default law if 0 */
#define ZT_SETLINEAR _IOW (ZT_CODE, 40, int)
#define ZT_GETCONFMUTE _IOR (ZT_CODE, 49, int) /* Get Conference to mute mode */
#define ZT_ECHOTRAIN _IOW (ZT_CODE, 50, int) /* Control Echo Trainer */
/* Openzap ZT hardware interface functions */
zap_status_t zt_init(zap_io_interface_t **zint);
zap_status_t zt_destroy(void);
#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 expandtab:
*/