summaryrefslogtreecommitdiff
path: root/zaptel.h
diff options
context:
space:
mode:
authormarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2002-03-08 20:41:50 +0000
committermarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2002-03-08 20:41:50 +0000
commit2d797a97ad19f93acb1af086490e386896bbd251 (patch)
treed969d67fd8ba924c3810a2ecf8a24aacff8be2d6 /zaptel.h
parentb05391fe2b5ae43144d789f91e8c3d1989cefd78 (diff)
Version 0.1.6 from FTP
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@63 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'zaptel.h')
-rwxr-xr-xzaptel.h109
1 files changed, 101 insertions, 8 deletions
diff --git a/zaptel.h b/zaptel.h
index c71fb5e..b9ba8dc 100755
--- a/zaptel.h
+++ b/zaptel.h
@@ -31,14 +31,19 @@
#ifdef __KERNEL__
#include <linux/config.h>
-#ifdef CONFIG_ZAPATA_NET
+#ifdef CONFIG_ZAPATA_NET
#include <linux/hdlc.h>
#endif
+#ifdef CONFIG_ZAPATA_PPP
+#include <linux/ppp_channel.h>
+#endif
#include <linux/fs.h>
-#include "mec.h"
+#include "sec.h"
#include "fasthdlc.h"
#endif
-
+#ifdef CONFIG_DEVFS_FS
+#include <linux/devfs_fs_kernel.h>
+#endif /* CONFIG_DEVFS_FS */
#include <linux/ioctl.h>
#ifndef ELAST
@@ -205,6 +210,15 @@ int dtmf_tonelen; /* DTMF tone length */
int reserved[4]; /* Reserved for future expansion -- always set to 0 */
} ZT_DIAL_PARAMS;
+
+typedef struct zt_dynamic_span {
+ char driver[20]; /* Which low-level driver to use */
+ char addr[40]; /* Destination address */
+ int numchans; /* Number of channels */
+ int timing; /* Timing source preference */
+ int spanno; /* Span number (filled in by zaptel) */
+} ZT_DYNAMIC_SPAN;
+
/* Define the max # of outgoing DTMF or MFv1 digits to queue in-kernel */
#define ZT_MAX_DTMF_BUF 256
@@ -389,6 +403,9 @@ char dialstr[ZT_MAX_DTMF_BUF];
/*
* Enable or disable echo cancellation on a channel
+ * The number is zero to disable echo cancellation and non-zero
+ * to enable echo cancellation. If the number is between 32
+ * and 256, it will also set the number of taps in the echo canceller
*/
#define ZT_ECHOCANCEL _IOW (ZT_CODE, 33, int)
@@ -433,6 +450,26 @@ char dialstr[ZT_MAX_DTMF_BUF];
*/
#define ZT_SETLINEAR _IOW (ZT_CODE, 40, int)
+/*
+ * Set a clear channel into HDLC w/ PPP interface mode
+ */
+#define ZT_HDLCPPP _IOW (ZT_CODE, 41, int)
+
+/*
+ * 60-80 are reserved for private drivers
+ * 80-85 are reserved for dynamic span stuff
+ */
+
+/*
+ * Create a dynamic span
+ */
+#define ZT_DYNAMIC_CREATE _IOWR (ZT_CODE, 80, struct zt_dynamic_span)
+
+/*
+ * Destroy a dynamic span
+ */
+#define ZT_DYNAMIC_DESTROY _IOW (ZT_CODE, 81, struct zt_dynamic_span)
+
/*
* Startup or Shutdown a span
*/
@@ -605,7 +642,7 @@ struct zt_tone_def { /* Structure for zone programming */
#define ZT_ALARM_NONE 0 /* No alarms */
#define ZT_ALARM_RECOVER 1 /* Recovering from alarm */
#define ZT_ALARM_LOOPBACK 2 /* In loopback */
-#define ZT_ALARM_YELLOW 4 /* Yellow Alarm */
+#define ZT_ALARM_YELLOW 4 /* Yellow Alarm */
#define ZT_ALARM_RED 8 /* Red Alarm */
#define ZT_ALARM_BLUE 16 /* Blue Alarm */
#define ZT_ALARM_NOTOPEN 32
@@ -681,10 +718,20 @@ struct zt_tone_state {
int v3_2;
};
+#ifdef CONFIG_ZAPATA_NET
+struct zt_hdlc {
+ hdlc_device netdev;
+ struct zt_chan *chan;
+};
+#endif
+
struct zt_chan {
#ifdef CONFIG_ZAPATA_NET
/* Must be first */
- hdlc_device netdev;
+ struct zt_hdlc *hdlcnetdev;
+#endif
+#ifdef CONFIG_ZAPATA_PPP
+ struct ppp_channel *ppp;
#endif
spinlock_t lock;
char name[40]; /* Name */
@@ -692,6 +739,10 @@ struct zt_chan {
int channo; /* Zaptel Channel number */
int chanpos;
int flags;
+
+ /* Slaves */
+ unsigned int slavemask;
+
struct zt_chan *master; /* Our Master channel (could be us) */
u_char *writechunk; /* Actual place to write to */
u_char swritechunk[ZT_MAX_CHUNKSIZE]; /* Buffer to be written */
@@ -786,7 +837,7 @@ struct zt_chan {
/* Is echo cancellation enabled or disabled */
int echocancel;
- struct mark_ec ec;
+ echo_can_state_t *ec;
/* RBS timings */
int prewinktime; /* pre-wink time (ms) */
@@ -817,6 +868,11 @@ struct zt_chan {
int deflaw; /* 1 = mulaw, 2=alaw, 0=undefined */
short *xlaw;
unsigned char *lin2x;
+
+#ifdef CONFIG_DEVFS_FS
+ devfs_handle_t fhandle; /* File handle in devfs for the channel */
+ devfs_handle_t fhandle_symlink;
+#endif /* CONFIG_DEVFS_FS */
};
/* defines for transmit signalling */
@@ -856,11 +912,13 @@ typedef enum {
#define ZT_FLAG_FCS (1 << 11) /* Calculate FCS */
/* Reserve 12 for uniqueness with span flags */
#define ZT_FLAG_LINEAR (1 << 13) /* Talk to user space in linear */
+#define ZT_FLAG_PPP (1 << 14) /* PPP is available */
+#define ZT_FLAG_T1PPP (1 << 15)
struct zt_span {
spinlock_t lock;
void *pvt; /* Private stuff */
- char name[20]; /* Span name */
+ char name[40]; /* Span name */
char desc[80]; /* Span description */
int deflaw; /* Default law (ZT_MULAW or ZT_ALAW) */
int alarms; /* Pending alarms on span */
@@ -878,7 +936,7 @@ struct zt_span {
int maintstat; /* Maintenance state */
wait_queue_head_t maintq; /* Maintenance queue */
int mainttimer; /* Maintenance timer */
-
+
struct zt_chan *chans; /* Member channel structures */
/* ==== Span Callback Operations ==== */
@@ -934,8 +992,40 @@ struct zt_span {
/* Used by zaptel only -- no user servicable parts inside */
int spanno; /* Span number for zaptel */
int lastalarms; /* Previous alarms */
+
+#ifdef CONFIG_DEVFS_FS
+ devfs_handle_t dhandle; /* Directory name */
+#endif
+};
+
+struct zt_dynamic_driver {
+ /* Driver name (e.g. Eth) */
+ char name[20];
+
+ /* Driver description */
+ char desc[80];
+
+ /* Create a new transmission pipe */
+ void *(*create)(struct zt_span *span, char *address);
+
+ /* Destroy a created transmission pipe */
+ void (*destroy)(void *tpipe);
+
+ /* Transmit a given message */
+ int (*transmit)(void *tpipe, unsigned char *msg, int msglen);
+
+ struct zt_dynamic_driver *next;
};
+/* Receive a dynamic span message */
+extern void zt_dynamic_receive(struct zt_span *span, unsigned char *msg, int msglen);
+
+/* Register a dynamic driver */
+extern int zt_dynamic_register(struct zt_dynamic_driver *driver);
+
+/* Unregister a dynamic driver */
+extern void zt_dynamic_unregister(struct zt_dynamic_driver *driver);
+
/* Receive on a span. The zaptel interface will handle all the calculations for
all member channels of the span, pulling the data from the readchunk buffer */
extern int zt_receive(struct zt_span *span);
@@ -978,6 +1068,9 @@ extern struct zt_tone *zt_dtmf_tone(char digit, int mf);
extern short __zt_mulaw[256];
extern u_char __zt_lin2mu[16384];
+/* Used by dynamic zaptel -- don't use directly */
+extern void zt_set_dynamic_ioctl(int (*func)(unsigned int cmd, unsigned long data));
+
/* Used privately by zaptel. Avoid touching directly */
struct zt_tone {
int fac1;