alpha phase is open, this means:
[lcr.git] / admin.h
1 /*****************************************************************************\
2 **                                                                           **
3 ** Linux Call Router                                                         **
4 **                                                                           **
5 **---------------------------------------------------------------------------**
6 ** Copyright: Andreas Eversberg                                              **
7 **                                                                           **
8 ** Administration tool header file                                           **
9 **                                                                           **
10 \*****************************************************************************/
11
12 #define SOCKET_NAME "/var/run/LCR.socket"
13
14 /* structures that define message between admin-tool and pbx */
15
16 enum { /* messages */
17         ADMIN_REQUEST_CMD_INTERFACE,
18         ADMIN_RESPONSE_CMD_INTERFACE,
19         ADMIN_REQUEST_CMD_ROUTE,
20         ADMIN_RESPONSE_CMD_ROUTE,
21         ADMIN_REQUEST_CMD_DIAL,
22         ADMIN_RESPONSE_CMD_DIAL,
23         ADMIN_REQUEST_CMD_RELEASE,
24         ADMIN_RESPONSE_CMD_RELEASE,
25         ADMIN_REQUEST_CMD_BLOCK,
26         ADMIN_RESPONSE_CMD_BLOCK,
27         ADMIN_REQUEST_STATE,
28         ADMIN_RESPONSE_STATE,
29         ADMIN_RESPONSE_S_INTERFACE,
30         ADMIN_RESPONSE_S_PORT,
31         ADMIN_RESPONSE_S_EPOINT,
32         ADMIN_RESPONSE_S_JOIN,
33         ADMIN_CALL_SETUP,
34         ADMIN_CALL_SETUP_ACK,
35         ADMIN_CALL_PROCEEDING,
36         ADMIN_CALL_ALERTING,
37         ADMIN_CALL_CONNECT,
38         ADMIN_CALL_DISCONNECT,
39         ADMIN_CALL_RELEASE,
40         ADMIN_CALL_NOTIFY,
41         ADMIN_TRACE_REQUEST,
42         ADMIN_TRACE_RESPONSE,
43         ADMIN_MESSAGE,
44 };
45
46 struct admin_response_cmd {
47         int             error;          /* error code 0 = ok*/
48         char            message[256];   /* info / response text */
49         int             block;
50         int             portnum;
51 };
52
53 struct admin_response_state {
54         char            version_string[64];
55         struct tm       tm;
56         char            logfile[128];
57         int             interfaces;
58         int             joins;
59         int             epoints;
60         int             ports;
61 };
62
63 struct admin_response_interface {
64         char            interface_name[32];
65         int             portnum;
66         int             block;
67         int             ntmode;
68         int             ptp;
69         int             pri;
70         int             extension;
71         int             use; /* number of ports that use this interface */
72         int             l1link; /* down(0) or up(1) */
73         int             l2link; /* down(0) or up(1) */
74         int             channels;
75         char            busy[256]; /* if port is idle(0) busy(1) */
76         unsigned long   port[256]; /* current port */
77 };
78
79 struct admin_response_join {
80         unsigned long   serial; /* join serial number */
81         unsigned long   partyline;
82 };
83
84 struct admin_response_epoint {
85         unsigned long   serial;
86         unsigned long   join; /* link to join */
87 //      int             join_notify; /* if relation notified on hold */
88 //      int             join_hold; /* if relation on hold */
89         int             rx_state;
90         int             tx_state;
91         int             state;
92         char            terminal[16];
93         char            callerid[64];
94         char            dialing[64];
95         char            action[32];
96         int             park; /* if parked */
97         int             park_len;
98         unsigned char   park_callid[8];
99         int             crypt; /* crypt state */
100 };
101
102 struct admin_response_port {
103         unsigned long   serial; /* port serial number */
104         char            name[64]; /* name of port */
105         unsigned long   epoint; /* link to epoint */
106         int             state;
107         int             isdn; /* if port is isdn */
108         int             isdn_chan; /* bchannel number */
109         int             isdn_hold; /* on hold */
110         int             isdn_ces; /* ces to use (>=0)*/
111 };
112
113 struct admin_call {
114         char            interface[64]; /* name of port */
115         char            callerid[64]; /* use caller id */
116         char            dialing[64]; /* number to dial */
117         int             present; /* presentation */
118         int             cause; /* cause to send */
119         int             location;
120         int             notify;
121         int             bc_capa;
122         int             bc_mode;
123         int             bc_info1;
124         int             hlc;
125         int             exthlc;
126 };
127
128 struct admin_trace_req {
129         int             detail;
130         char            category;
131         int             port;
132         char            interface[64];
133         char            caller[34];
134         char            dialing[64];
135 };
136
137 struct admin_trace_rsp {
138         char            text[1024];
139 };
140
141 struct admin_msg {
142         int             type; /* type of message */
143         unsigned long   ref; /* reference to individual endpoints */
144         union parameter param; /* parameter union */
145 };
146
147 struct admin_message {
148         int message; /* type of admin message */
149         union u {
150                 struct admin_response_cmd       x;
151                 struct admin_response_state     s;
152                 struct admin_response_interface i;
153                 struct admin_response_port      p;
154                 struct admin_response_epoint    e;
155                 struct admin_response_join      j;
156                 struct admin_call               call;
157                 struct admin_msg                msg;
158                 struct admin_trace_req          trace_req;
159                 struct admin_trace_rsp          trace_rsp;
160         } u;
161 };
162
163 /* call states */
164 enum {
165         ADMIN_STATE_IDLE,
166         ADMIN_STATE_IN_SETUP,
167         ADMIN_STATE_OUT_SETUP,
168         ADMIN_STATE_IN_OVERLAP,
169         ADMIN_STATE_OUT_OVERLAP,
170         ADMIN_STATE_IN_PROCEEDING,
171         ADMIN_STATE_OUT_PROCEEDING,
172         ADMIN_STATE_IN_ALERTING,
173         ADMIN_STATE_OUT_ALERTING,
174         ADMIN_STATE_CONNECT,
175         ADMIN_STATE_IN_DISCONNECT,
176         ADMIN_STATE_OUT_DISCONNECT,
177 };