Ports can now be specified by number or by name.
[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         char                    portname[64]; /* alternately: port name */
49         int                     ptp; /* force load stack in PTP mode */
50         int                     ptmp; /* force load stack in PTP mode */
51         int                     nt; /* load stack in NT-mode */
52         int                     l2hold; /* hold layer 2 (1=force, -1=disable */
53         int                     channel_force; /* forces channel by protocol */
54         int                     nodtmf; /* disables DTMF */
55         struct select_channel   *out_channel; /* list of channels to select */
56         struct select_channel   *in_channel; /* the same for incoming channels */
57         int                     block; /* set if interface is blocked */
58         int                     tout_setup;
59         int                     tout_dialing;
60         int                     tout_proceeding;
61         int                     tout_alerting;
62         int                     tout_disconnect;
63 //      int                     tout_hold;
64 //      int                     tout_park;
65 };
66
67 struct interface_msn {
68         struct interface_msn    *next;
69         char                    msn[64]; /* msn */
70 };
71
72 struct interface_screen {
73         struct interface_screen *next;
74         char                    match[64]; /* what caller id to match */
75         int                     match_type; /* number type */
76         int                     match_present; /* presentation type */
77         char                    result[64]; /* what caller id to change to */
78         int                     result_type; /* number type */
79         int                     result_present; /* presentation type */
80 };
81
82 struct interface {
83         struct interface        *next;
84         char                    name[64]; /* name of interface */
85         int                     extension; /* calls are handled as extension */
86         int                     is_tones; /* generate tones */
87         int                     is_earlyb; /* bridge tones during call setup */
88         int                     hunt; /* select algorithm */
89         int                     hunt_next; /* ifport index to start hunt */
90         struct interface_port   *ifport; /* link to interface port list */
91         struct interface_msn    *ifmsn; /* link to interface msn list */
92         struct interface_screen *ifscreen_in; /* link to screening list */
93         struct interface_screen *ifscreen_out; /* link to screening list */
94         int                     tx_gain, rx_gain; /* filter gain */
95         char                    pipeline[256]; /* filter pipeline */
96         unsigned char           bf_key[56]; /* filter blowfish */
97         int                     bf_len; /* filter length of blowfish */
98 };
99
100 struct interface_param {
101         const char              *name;
102 /*      return value            (pointer of function)(args ...) */
103         int                     (*func)(struct interface *, char *, int, char *, char*);
104         const char              *usage;
105         const char              *help;
106 };
107
108
109 extern struct interface *interface_first;
110 extern struct interface *interface_newlist;
111
112 extern char interface_error[256];
113 struct interface *read_interfaces(void);
114 void free_interfaces(struct interface *interface_start);
115 void relink_interfaces(void);
116 void load_port(struct interface_port *ifport);
117 void doc_interface(void);
118 void do_screen(int out, char *id, int idsize, int *type, int *present, struct interface *interface);
119