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