Added layer1 hold feature. Requires new mISDN and mISDNuser package from git.
[lcr.git] / interface.h
1 /*****************************************************************************\
2 **                                                                           **
3 ** LCR                                                                       **
4 **                                                                           **
5 **---------------------------------------------------------------------------**
6 ** Copyright: Andreas Eversberg                                              **
7 **                                                                           **
8 ** interface header file                                                     **
9 **                                                                           **
10 \*****************************************************************************/ 
11 enum {  /* interface type */
12         IF_TYPE_DIRECT,
13         IF_TYPE_EXTENSION,
14 };
15
16         /* channel selection -1 is reserved for "no ie" */
17 #define CHANNEL_NO              -2
18 #define CHANNEL_ANY             -3
19 #define CHANNEL_FREE            -100
20
21         /* port selection */
22 enum {  HUNT_LINEAR = 0,
23         HUNT_ROUNDROBIN,
24 };
25
26         /* filters */
27 enum {  FILTER_GAIN,
28         FILTER_CANCEL,
29         FILTER_BLOWFISH,
30 };
31
32 enum {  IS_DEFAULT = 0,
33         IS_YES,
34         IS_NO,
35 };
36
37 struct select_channel {
38         struct select_channel   *next;
39         int                     channel;
40 };
41
42 struct interface_port {
43         struct interface_port   *next;
44         struct interface        *interface; /* link to interface */
45         struct mISDNport        *mISDNport; /* link to port */
46         int                     portnum; /* port number */
47         char                    portname[64]; /* alternately: port name */
48         int                     ptp; /* force load stack in PTP mode */
49         int                     ptmp; /* force load stack in PTP mode */
50         int                     nt; /* load stack in NT-mode */
51         int                     tespecial; /* special TE-mode behavior */
52         int                     l1hold; /* hold layer 1 (1=on, 0=off) */
53         int                     l2hold; /* hold layer 2 (1=force, -1=disable, 0=default) */
54         int                     channel_force; /* forces channel by protocol */
55         int                     nodtmf; /* disables DTMF */
56         struct select_channel   *out_channel; /* list of channels to select */
57         struct select_channel   *in_channel; /* the same for incoming channels */
58         int                     block; /* set if interface is blocked */
59         int                     tout_setup;
60         int                     tout_dialing;
61         int                     tout_proceeding;
62         int                     tout_alerting;
63         int                     tout_disconnect;
64 //      int                     tout_hold;
65 //      int                     tout_park;
66         int                     dialmax; /* maximum number of digits to dial */
67 };
68
69 struct interface_msn {
70         struct interface_msn    *next;
71         char                    msn[64]; /* msn */
72 };
73
74 struct interface_screen {
75         struct interface_screen *next;
76         char                    match[64]; /* what caller id to match */
77         int                     match_type; /* number type */
78         int                     match_present; /* presentation type */
79         char                    result[64]; /* what caller id to change to */
80         int                     result_type; /* number type */
81         int                     result_present; /* presentation type */
82 };
83
84 struct interface {
85         struct interface        *next;
86         char                    name[64]; /* name of interface */
87         int                     extension; /* calls are handled as extension */
88         int                     is_tones; /* generate tones */
89         int                     is_earlyb; /* bridge tones during call setup */
90         int                     hunt; /* select algorithm */
91         int                     hunt_next; /* ifport index to start hunt */
92         struct interface_port   *ifport; /* link to interface port list */
93         struct interface_msn    *ifmsn; /* link to interface msn list */
94         struct interface_screen *ifscreen_in; /* link to screening list */
95         struct interface_screen *ifscreen_out; /* link to screening list */
96         int                     tx_gain, rx_gain; /* filter gain */
97         char                    pipeline[256]; /* filter pipeline */
98         unsigned char           bf_key[56]; /* filter blowfish */
99         int                     bf_len; /* filter length of blowfish */
100 };
101
102 struct interface_param {
103         const char              *name;
104 /*      return value            (pointer of function)(args ...) */
105         int                     (*func)(struct interface *, char *, int, char *, char*);
106         const char              *usage;
107         const char              *help;
108 };
109
110
111 extern struct interface *interface_first;
112 extern struct interface *interface_newlist;
113
114 extern char interface_error[256];
115 struct interface *read_interfaces(void);
116 void free_interfaces(struct interface *interface_start);
117 void relink_interfaces(void);
118 void load_port(struct interface_port *ifport);
119 void doc_interface(void);
120 void do_screen(int out, char *id, int idsize, int *type, int *present, struct interface *interface);
121