3e7b7ed053ce15ee5efa94ea50c31afd55ae5397
[lcr.git] / admin.h
1 /*****************************************************************************\
2 **                                                                           **
3 ** PBX4Linux                                                                 **
4 **                                                                           **
5 **---------------------------------------------------------------------------**
6 ** Copyright: Andreas Eversberg                                              **
7 **                                                                           **
8 ** Administration tool header file                                           **
9 **                                                                           **
10 \*****************************************************************************/
11
12 #define SOCKET_NAME "/var/run/PBX4Linux.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_STATE,
26         ADMIN_RESPONSE_STATE,
27         ADMIN_RESPONSE_S_INTERFACE,
28         ADMIN_RESPONSE_S_PORT,
29         ADMIN_RESPONSE_S_EPOINT,
30         ADMIN_RESPONSE_S_CALL,
31         ADMIN_CALL_SETUP,
32         ADMIN_CALL_SETUP_ACK,
33         ADMIN_CALL_PROCEEDING,
34         ADMIN_CALL_ALERTING,
35         ADMIN_CALL_CONNECT,
36         ADMIN_CALL_DISCONNECT,
37         ADMIN_CALL_RELEASE,
38         ADMIN_CALL_NOTIFY,
39 };
40
41 struct admin_response_cmd {
42         int             error;          /* error code 0 = ok*/
43         char            message[256];   /* info / response text */
44 };
45
46 struct admin_response_state {
47         char            version_string[64];
48         struct tm       tm;
49         char            logfile[128];
50         int             interfaces;
51         int             calls;
52         int             epoints;
53         int             ports;
54 };
55
56 struct admin_response_interface {
57         int             portnum;
58         char            interface_name[32];
59         int             ntmode;
60         int             ptp;
61         int             pri;
62         int             iftype;
63         int             use; /* number of ports that use this interface */
64         int             l1link; /* down(0) or up(1) */
65         int             l2link; /* down(0) or up(1) */
66         int             channels;
67         int             busy[256]; /* if port is idle(0) busy(1) */
68         unsigned long   port[256]; /* current port */
69 };
70
71 struct admin_response_call {
72         unsigned long   serial; /* call serial number */
73         unsigned long   partyline;
74 };
75
76 struct admin_response_epoint {
77         unsigned long   serial;
78         unsigned long   call; /* link to call */
79 //      int             call_notify; /* if relation notified on hold */
80 //      int             call_hold; /* if relation on hold */
81         int             rx_state;
82         int             tx_state;
83         int             state;
84         char            terminal[16];
85         char            callerid[64];
86         char            dialing[64];
87         char            action[32];
88         int             park; /* if parked */
89         int             park_len;
90         unsigned char   park_callid[8];
91         int             crypt; /* crypt state */
92 };
93
94 struct admin_response_port {
95         unsigned long   serial; /* port serial number */
96         char            name[64]; /* name of port */
97         unsigned long   epoint; /* link to epoint */
98         int             state;
99         int             isdn; /* if port is isdn */
100         int             isdn_chan; /* bchannel number */
101         int             isdn_hold; /* on hold */
102         int             isdn_ces; /* ces to use (>=0)*/
103 };
104
105 struct admin_call {
106         char            interface[64]; /* name of port */
107         char            callerid[64]; /* use caller id */
108         char            dialing[64]; /* number to dial */
109         int             present; /* presentation */
110         int             cause; /* cause to send */
111         int             location;
112         int             notify;
113         int             bc_capa;
114         int             bc_mode;
115         int             bc_info1;
116         int             hlc;
117         int             exthlc;
118 };
119
120 struct admin_message {
121         int message; /* type of admin message */
122         union u {
123                 struct admin_response_cmd       x;
124                 struct admin_response_state     s;
125                 struct admin_response_interface i;
126                 struct admin_response_port      p;
127                 struct admin_response_epoint    e;
128                 struct admin_response_call      c;
129                 struct admin_call               call;
130         } u;
131 };
132
133 /* call states */
134 enum {
135         ADMIN_STATE_IDLE,
136         ADMIN_STATE_IN_SETUP,
137         ADMIN_STATE_OUT_SETUP,
138         ADMIN_STATE_IN_OVERLAP,
139         ADMIN_STATE_OUT_OVERLAP,
140         ADMIN_STATE_IN_PROCEEDING,
141         ADMIN_STATE_OUT_PROCEEDING,
142         ADMIN_STATE_IN_ALERTING,
143         ADMIN_STATE_OUT_ALERTING,
144         ADMIN_STATE_CONNECT,
145         ADMIN_STATE_IN_DISCONNECT,
146         ADMIN_STATE_OUT_DISCONNECT,
147 };