da3b06964fb3b4488ae9317a5577af3dbc7ed44c
[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         ADMIN_MESSAGE,
40 };
41
42 struct admin_response_cmd {
43         int             error;          /* error code 0 = ok*/
44         char            message[256];   /* info / response text */
45 };
46
47 struct admin_response_state {
48         char            version_string[64];
49         struct tm       tm;
50         char            logfile[128];
51         int             interfaces;
52         int             calls;
53         int             epoints;
54         int             ports;
55 };
56
57 struct admin_response_interface {
58         int             portnum;
59         char            interface_name[32];
60         int             ntmode;
61         int             ptp;
62         int             pri;
63         int             iftype;
64         int             use; /* number of ports that use this interface */
65         int             l1link; /* down(0) or up(1) */
66         int             l2link; /* down(0) or up(1) */
67         int             channels;
68         int             busy[256]; /* if port is idle(0) busy(1) */
69         unsigned long   port[256]; /* current port */
70 };
71
72 struct admin_response_call {
73         unsigned long   serial; /* call serial number */
74         unsigned long   partyline;
75 };
76
77 struct admin_response_epoint {
78         unsigned long   serial;
79         unsigned long   call; /* link to call */
80 //      int             call_notify; /* if relation notified on hold */
81 //      int             call_hold; /* if relation on hold */
82         int             rx_state;
83         int             tx_state;
84         int             state;
85         char            terminal[16];
86         char            callerid[64];
87         char            dialing[64];
88         char            action[32];
89         int             park; /* if parked */
90         int             park_len;
91         unsigned char   park_callid[8];
92         int             crypt; /* crypt state */
93 };
94
95 struct admin_response_port {
96         unsigned long   serial; /* port serial number */
97         char            name[64]; /* name of port */
98         unsigned long   epoint; /* link to epoint */
99         int             state;
100         int             isdn; /* if port is isdn */
101         int             isdn_chan; /* bchannel number */
102         int             isdn_hold; /* on hold */
103         int             isdn_ces; /* ces to use (>=0)*/
104 };
105
106 struct admin_call {
107         char            interface[64]; /* name of port */
108         char            callerid[64]; /* use caller id */
109         char            dialing[64]; /* number to dial */
110         int             present; /* presentation */
111         int             cause; /* cause to send */
112         int             location;
113         int             notify;
114         int             bc_capa;
115         int             bc_mode;
116         int             bc_info1;
117         int             hlc;
118         int             exthlc;
119 };
120
121 struct admin_message {
122         int             type; /* type of message */
123         unsigned long   ref; /* reference to individual endpoints */
124         union parameter param; /* parameter union */
125 };
126
127 struct admin_message {
128         int message; /* type of admin message */
129         union u {
130                 struct admin_response_cmd       x;
131                 struct admin_response_state     s;
132                 struct admin_response_interface i;
133                 struct admin_response_port      p;
134                 struct admin_response_epoint    e;
135                 struct admin_response_call      c;
136                 struct admin_call               call;
137                 struct admin_message            message;
138         } u;
139 };
140
141 /* call states */
142 enum {
143         ADMIN_STATE_IDLE,
144         ADMIN_STATE_IN_SETUP,
145         ADMIN_STATE_OUT_SETUP,
146         ADMIN_STATE_IN_OVERLAP,
147         ADMIN_STATE_OUT_OVERLAP,
148         ADMIN_STATE_IN_PROCEEDING,
149         ADMIN_STATE_OUT_PROCEEDING,
150         ADMIN_STATE_IN_ALERTING,
151         ADMIN_STATE_OUT_ALERTING,
152         ADMIN_STATE_CONNECT,
153         ADMIN_STATE_IN_DISCONNECT,
154         ADMIN_STATE_OUT_DISCONNECT,
155 };