1 /*
2 **  Here be values used for communicating with the server once it is
3 **  running.
4 */
5 
6 #ifndef INN_INNDCOMM_H
7 #define INN_INNDCOMM_H 1
8 
9 #include "inn/portable-macros.h"
10 
11 BEGIN_DECLS
12 
13 /* The header for the ICC protocol is a one-byte protocol version followed
14    by a 2 byte messages length*/
15 #define HEADER_SIZE (sizeof(ICC_PROTOCOLTYPE) + sizeof(ICC_MSGLENTYPE))
16 
17 typedef unsigned short ICC_MSGLENTYPE; /* Length code to prefix commands to
18                                        ** the server. */
19 typedef char ICC_PROTOCOLTYPE;
20 
21 /* Values for the protocol version field of the message. 8 bits wide. */
22 #define ICC_PROTOCOL_1 'a'
23 
24 #define SC_SEP       '\001'
25 #define SC_MAXFIELDS 6
26 
27 /* When modifying this list, the innreport_inn.pm file should be updated
28  * at the same time. */
29 #define SC_ADDHIST     'a'
30 #define SC_ALLOW       'D'
31 #define SC_BEGIN       'b'
32 #define SC_CANCEL      'c'
33 #define SC_CHANGEGROUP 'u'
34 #define SC_CHECKFILE   'd'
35 #define SC_DROP        'e'
36 #define SC_FEEDINFO    'F'
37 #define SC_FLUSH       'f'
38 #define SC_FLUSHLOGS   'g'
39 #define SC_GO          'h'
40 #define SC_HANGUP      'i'
41 #define SC_LOGMODE     'E'
42 #define SC_LOWMARK     'L'
43 #define SC_MODE        's'
44 #define SC_NAME        'j'
45 #define SC_NEWGROUP    'k'
46 #define SC_PARAM       'l'
47 #define SC_PAUSE       'm'
48 #define SC_PERL        'P'
49 #define SC_PYTHON      'Y'
50 #define SC_READERS     'v'
51 #define SC_REJECT      'C'
52 #define SC_RELOAD      'o'
53 #define SC_RENUMBER    'n'
54 #define SC_RESERVE     'z'
55 #define SC_RMGROUP     'p'
56 #define SC_SEND        'A'
57 #define SC_SHUTDOWN    'q'
58 #define SC_STATHIST    'H'
59 #define SC_STATUS      'S'
60 #define SC_SIGNAL      'B'
61 #define SC_THROTTLE    'r'
62 #define SC_TIMER       'Z'
63 #define SC_TRACE       'w'
64 #define SC_XABORT      'x'
65 #define SC_XEXEC       'y'
66 
67 /* Yes, we don't want anyone to use this. */
68 #define SC_FIRSTFREE G
69 
70 #define MAX_REASON_LEN 80
71 
72 
73 extern void ICCsettimeout(int i);
74 extern int ICCopen(void);
75 extern int ICCclose(void);
76 extern int ICCcommand(char cmd, const char *argv[], char **replyp);
77 extern int ICCcancel(const char *msgid);
78 extern int ICCgo(const char *why);
79 extern int ICCpause(const char *why);
80 extern int ICCreserve(const char *why);
81 
82 extern const char *ICCfailure;
83 
84 /* Use a read or recv call to read a descriptor. */
85 #ifdef HAVE_UNIX_DOMAIN_SOCKETS
86 #    define RECVorREAD(fd, p, s) recv((fd), (p), (s), 0)
87 #else
88 #    define RECVorREAD(fd, p, s) read((fd), (p), (s))
89 #endif
90 
91 END_DECLS
92 
93 #endif /* INN_INNDCOMM_H */
94