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