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