only for backup, still in coding state - no compile!!!
[lcr.git] / interface.h
1 /*****************************************************************************\
2 **                                                                           **
3 ** LCR                                                                       **
4 **                                                                           **
5 **---------------------------------------------------------------------------**
6 ** Copyright: Andreas Eversberg                                              **
7 **                                                                           **
8 ** interface header file                                                     **
9 **                                                                           **
10 \*****************************************************************************/ 
11
12 #define FLAG_PORT_USE           1
13 #define FLAG_PORT_PTP           (1<<1)
14
15 enum {  /* interface type */
16         IF_TYPE_DIRECT,
17         IF_TYPE_EXTENSION,
18 };
19
20         /* channel selection -1 is reserved for "no ie" */
21 #define CHANNEL_NO              -2
22 #define CHANNEL_ANY             -3
23 #define CHANNEL_FREE            -100
24
25         /* port selection */
26 enum {  HUNT_LINEAR = 0,
27         HUNT_ROUNDROBIN,
28 };
29
30         /* filters */
31 enum {  FILTER_GAIN,
32         FILTER_CANCEL,
33         FILTER_BLOWFISH,
34 };
35
36 enum {  IS_DEFAULT = 0,
37         IS_YES,
38         IS_NO,
39 };
40
41 struct select_channel {
42         struct select_channel   *next;
43         int                     channel;
44 };
45
46 struct interface_port {
47         struct interface_port   *next;
48         struct interface        *interface; /* link to interface */
49         struct mISDNport        *mISDNport; /* link to port */
50         int                     portnum; /* port number */
51         int                     ptp; /* load stack in PTP mode */
52         int                     channel_force; /* forces channel by protocol */
53         struct select_channel   *out_select; /* list of channels to select */
54         struct select_channel   *in_select; /* the same for incoming channels */
55 //      int                     open; /* set if port is opened */
56         int                     block; /* set if interface is blocked */
57 };
58
59 struct interface_msn {
60         struct interface_msn    *next;
61         char                    msn[64]; /* msn */
62 };
63
64 struct interface_screen {
65         struct interface_screen *next;
66         char                    match[64]; /* what caller id to match */
67         int                     match_type; /* number type */
68         int                     match_present; /* presentation type */
69         char                    result[64]; /* what caller id to change to */
70         int                     result_type; /* number type */
71         int                     result_present; /* presentation type */
72 };
73
74 struct interface_filter {
75         struct interface_filter *next;
76         int                     filter; /* filter to use */
77         char                    parameter[256]; /* filter parameter */
78 };
79
80 struct interface {
81         struct interface        *next;
82         char                    name[64]; /* name of interface */
83         int                     extension; /* calls are handled as extension */
84         int                     is_tones; /* generate tones */
85         int                     is_earlyb; /* bridge tones during call setup */
86         int                     hunt; /* select algorithm */
87         int                     hunt_next; /* ifport index to start hunt */
88         struct interface_port   *ifport; /* link to interface port list */
89         struct interface_msn    *ifmsn; /* link to interface msn list */
90         struct interface_screen *ifscreen_in; /* link to screening list */
91         struct interface_screen *ifscreen_out; /* link to screening list */
92         struct interface_filter *iffilter; /* link to filter list */
93 };
94
95 struct interface_param {
96         char                    *name;
97 /*      return value            (pointer of function)(args ...) */
98         int                     (*func)(struct interface *, char *, int, char *, char*);
99         char                    *usage;
100         char                    *help;
101 };
102
103
104 extern struct interface *interface_first;
105 extern struct interface *interface_newlist;
106
107 extern char interface_error[256];
108 struct interface *read_interfaces(void);
109 void free_interfaces(struct interface *interface_start);
110 void relink_interfaces(void);
111 void doc_interface(void);
112
113