Revert "Add .gitignore"
[lcr.git] / lcrsocket.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 "%s/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         char            portname[64];
69         int             block;
70         int             ntmode;
71         int             ptp;
72         int             l1hold;
73         int             l2hold;
74         int             pri;
75         int             extension;
76         int             use; /* number of ports that use this interface */
77         int             l1link; /* down(0) or up(1) */
78         int             l2link; /* down(0) or up(1) */
79         unsigned char   l2mask[16]; /* one bit for each tei */
80         int             los, ais, rdi, slip_tx, slip_rx;
81         int             channels;
82         char            busy[256]; /* if port is idle(0) busy(1) */
83         unsigned int    port[256]; /* current port */
84         int             mode[256];
85 };
86
87 struct admin_response_remote {
88         char            name[32]; /* name of remote application */
89 };
90
91 struct admin_response_join {
92         unsigned int    serial; /* join serial number */
93         char            remote[32]; /* remote application name */
94         unsigned int    partyline;
95 };
96
97 struct admin_response_epoint {
98         unsigned int    serial;
99         unsigned int    join; /* link to join */
100 //      int             join_notify; /* if relation notified on hold */
101 //      int             join_hold; /* if relation on hold */
102         int             rx_state;
103         int             tx_state;
104         int             state;
105         char            terminal[16];
106         char            callerid[64];
107         char            dialing[64];
108         char            action[32];
109         int             park; /* if parked */
110         int             park_len;
111         unsigned char   park_callid[8];
112         int             crypt; /* crypt state */
113 };
114
115 struct admin_response_port {
116         unsigned int    serial; /* port serial number */
117         char            name[64]; /* name of port */
118         unsigned int    epoint; /* link to epoint */
119         int             state;
120         int             isdn; /* if port is isdn */
121         int             isdn_chan; /* bchannel number */
122         int             isdn_hold; /* on hold */
123         int             isdn_ces; /* ces to use (>=0)*/
124 };
125
126 struct admin_call {
127         char            interface[64]; /* name of port */
128         char            callerid[64]; /* use caller id */
129         char            dialing[64]; /* number to dial */
130         int             present; /* presentation */
131         int             cause; /* cause to send */
132         int             location;
133         int             notify;
134         int             bc_capa;
135         int             bc_mode;
136         int             bc_info1;
137         int             hlc;
138         int             exthlc;
139 };
140
141 struct admin_trace_req {
142         int             detail;
143         char            category;
144         int             port;
145         char            interface[64];
146         char            caller[34];
147         char            dialing[64];
148 };
149
150 struct admin_trace_rsp {
151         char            text[1024];
152 };
153
154 struct admin_msg {
155         int             type; /* type of message */
156         unsigned int    ref; /* reference to individual endpoints */
157         union parameter param; /* parameter union */
158 };
159
160 struct admin_message {
161         int message; /* type of admin message */
162         union u {
163                 struct admin_response_cmd       x;
164                 struct admin_response_state     s;
165                 struct admin_response_interface i;
166                 struct admin_response_port      p;
167                 struct admin_response_epoint    e;
168                 struct admin_response_join      j;
169                 struct admin_response_remote    r;
170                 struct admin_call               call;
171                 struct admin_msg                msg;
172                 struct admin_trace_req          trace_req;
173                 struct admin_trace_rsp          trace_rsp;
174         } u;
175 };
176
177 /* call states */
178 enum {
179         ADMIN_STATE_IDLE,
180         ADMIN_STATE_IN_SETUP,
181         ADMIN_STATE_OUT_SETUP,
182         ADMIN_STATE_IN_OVERLAP,
183         ADMIN_STATE_OUT_OVERLAP,
184         ADMIN_STATE_IN_PROCEEDING,
185         ADMIN_STATE_OUT_PROCEEDING,
186         ADMIN_STATE_IN_ALERTING,
187         ADMIN_STATE_OUT_ALERTING,
188         ADMIN_STATE_CONNECT,
189         ADMIN_STATE_IN_DISCONNECT,
190         ADMIN_STATE_OUT_DISCONNECT,
191         ADMIN_STATE_RELEASE,
192 };