a34820d0a300620d07c4d762d54a46c8840f369e
[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_REMOTE,
30         ADMIN_RESPONSE_S_INTERFACE,
31         ADMIN_RESPONSE_S_PORT,
32         ADMIN_RESPONSE_S_EPOINT,
33         ADMIN_RESPONSE_S_JOIN,
34         ADMIN_CALL_SETUP,
35         ADMIN_CALL_SETUP_ACK,
36         ADMIN_CALL_PROCEEDING,
37         ADMIN_CALL_ALERTING,
38         ADMIN_CALL_CONNECT,
39         ADMIN_CALL_DISCONNECT,
40         ADMIN_CALL_RELEASE,
41         ADMIN_CALL_NOTIFY,
42         ADMIN_TRACE_REQUEST,
43         ADMIN_TRACE_RESPONSE,
44         ADMIN_MESSAGE,
45 };
46
47 struct admin_response_cmd {
48         int             error;          /* error code 0 = ok*/
49         char            message[256];   /* info / response text */
50         int             block;
51         int             portnum;
52 };
53
54 struct admin_response_state {
55         char            version_string[64];
56         struct tm       tm;
57         char            logfile[128];
58         int             interfaces;
59         int             remotes;
60         int             joins;
61         int             epoints;
62         int             ports;
63 };
64
65 struct admin_response_interface {
66         char            interface_name[32];
67         int             portnum;
68         int             block;
69         int             ntmode;
70         int             ptp;
71         int             pri;
72         int             extension;
73         int             use; /* number of ports that use this interface */
74         int             l1link; /* down(0) or up(1) */
75         int             l2link; /* down(0) or up(1) */
76         int             channels;
77         char            busy[256]; /* if port is idle(0) busy(1) */
78         unsigned long   port[256]; /* current port */
79 };
80
81 struct admin_response_remote {
82         char            name[32]; /* name of remote application */
83 };
84
85 struct admin_response_join {
86         unsigned long   serial; /* join serial number */
87         char            remote[32]; /* remote application name */
88         unsigned long   partyline;
89 };
90
91 struct admin_response_epoint {
92         unsigned long   serial;
93         unsigned long   join; /* link to join */
94 //      int             join_notify; /* if relation notified on hold */
95 //      int             join_hold; /* if relation on hold */
96         int             rx_state;
97         int             tx_state;
98         int             state;
99         char            terminal[16];
100         char            callerid[64];
101         char            dialing[64];
102         char            action[32];
103         int             park; /* if parked */
104         int             park_len;
105         unsigned char   park_callid[8];
106         int             crypt; /* crypt state */
107 };
108
109 struct admin_response_port {
110         unsigned long   serial; /* port serial number */
111         char            name[64]; /* name of port */
112         unsigned long   epoint; /* link to epoint */
113         int             state;
114         int             isdn; /* if port is isdn */
115         int             isdn_chan; /* bchannel number */
116         int             isdn_hold; /* on hold */
117         int             isdn_ces; /* ces to use (>=0)*/
118 };
119
120 struct admin_call {
121         char            interface[64]; /* name of port */
122         char            callerid[64]; /* use caller id */
123         char            dialing[64]; /* number to dial */
124         int             present; /* presentation */
125         int             cause; /* cause to send */
126         int             location;
127         int             notify;
128         int             bc_capa;
129         int             bc_mode;
130         int             bc_info1;
131         int             hlc;
132         int             exthlc;
133 };
134
135 struct admin_trace_req {
136         int             detail;
137         char            category;
138         int             port;
139         char            interface[64];
140         char            caller[34];
141         char            dialing[64];
142 };
143
144 struct admin_trace_rsp {
145         char            text[1024];
146 };
147
148 struct admin_msg {
149         int             type; /* type of message */
150         unsigned long   ref; /* reference to individual endpoints */
151         union parameter param; /* parameter union */
152 };
153
154 struct admin_message {
155         int message; /* type of admin message */
156         union u {
157                 struct admin_response_cmd       x;
158                 struct admin_response_state     s;
159                 struct admin_response_interface i;
160                 struct admin_response_port      p;
161                 struct admin_response_epoint    e;
162                 struct admin_response_join      j;
163                 struct admin_response_remote    r;
164                 struct admin_call               call;
165                 struct admin_msg                msg;
166                 struct admin_trace_req          trace_req;
167                 struct admin_trace_rsp          trace_rsp;
168         } u;
169 };
170
171 /* call states */
172 enum {
173         ADMIN_STATE_IDLE,
174         ADMIN_STATE_IN_SETUP,
175         ADMIN_STATE_OUT_SETUP,
176         ADMIN_STATE_IN_OVERLAP,
177         ADMIN_STATE_OUT_OVERLAP,
178         ADMIN_STATE_IN_PROCEEDING,
179         ADMIN_STATE_OUT_PROCEEDING,
180         ADMIN_STATE_IN_ALERTING,
181         ADMIN_STATE_OUT_ALERTING,
182         ADMIN_STATE_CONNECT,
183         ADMIN_STATE_IN_DISCONNECT,
184         ADMIN_STATE_OUT_DISCONNECT,
185 };