TFO: early-data for client outbound via socks5 proxy
[exim.git] / src / exim_monitor / em_hdr.h
CommitLineData
059ec3d9
PH
1/*************************************************
2* Exim Monitor *
3*************************************************/
4
0a49a7a4 5/* Copyright (c) University of Cambridge 1995 - 2009 */
059ec3d9
PH
6/* See the file NOTICE for conditions of use and distribution. */
7
8
9/* This is the general header file for all the modules that comprise
10the exim monitor program. */
11
12/* If this macro is defined, Eximon will anonymize all email addresses. This
13feature is just so that screen shots can be obtained for documentation
14purposes! */
15
16/* #define ANONYMIZE */
17
18/* System compilation parameters */
19
20#define queue_index_size 10 /* Size of index into queue */
21
22/* Assume most systems have statfs() unless os.h undefines this macro */
23
24#define HAVE_STATFS
25
26/* Bring in the system-dependent stuff */
27
28#include "os.h"
29
30
31/* ANSI C includes */
32
33#include <ctype.h>
34#include <setjmp.h>
35#include <signal.h>
36#include <stdarg.h>
37#include <stdio.h>
38#include <stdlib.h>
39#include <string.h>
40#include <time.h>
41
42/* Not-fully-ANSI systems (e.g. SunOS4 are missing some things) */
43
44#ifndef SEEK_SET
45#define SEEK_SET 0
46#define SEEK_CUR 1
47#define SEEK_END 2
48#endif
49
50/* Unix includes */
51
52#include <sys/types.h>
53#include <errno.h>
54#include <dirent.h>
55#include <fcntl.h>
56#include <pwd.h>
57#include <grp.h>
58#include <sys/param.h>
59#include <sys/stat.h>
60#include <unistd.h>
61
62/* The new standard is statvfs; some OS have statfs. Also arrange
63to be able to cut it out altogether for way-out OS that don't have
64anything. */
65
66#ifdef HAVE_STATFS
67#ifdef HAVE_SYS_STATVFS_H
68#include <sys/statvfs.h>
69
70#else
71 #define statvfs statfs
72 #ifdef HAVE_SYS_VFS_H
73 #include <sys/vfs.h>
74 #ifdef HAVE_SYS_STATFS_H
75 #include <sys/statfs.h>
76 #endif
77 #endif
78 #ifdef HAVE_SYS_MOUNT_H
79 #include <sys/mount.h>
80 #endif
81#endif
82#endif
83
84#include <sys/wait.h>
85
86/* Regular expression include */
87
8eb9f5bd 88#include <pcre.h>
059ec3d9
PH
89
90/* Includes from the main source of Exim. We need to have MAXPACKET defined for
91the benefit of structs.h. One of these days I should tidy up this interface so
92that this kind of kludge isn't needed. */
93
94#define MAXPACKET 1024
5fb822fc 95typedef void hctx;
059ec3d9 96
c6e692d7 97#include "config.h"
059ec3d9
PH
98#include "mytypes.h"
99#include "macros.h"
059ec3d9
PH
100
101#include "local_scan.h"
102#include "structs.h"
0ab63f3d 103#include "blob.h"
059ec3d9 104#include "globals.h"
490b427c 105#include "dbstuff.h"
059ec3d9
PH
106#include "functions.h"
107#include "osfunctions.h"
108#include "store.h"
109
110/* The sys/resource.h header on SunOS 4 causes trouble with the gcc
111compiler. Just stuff the bit we want in here; pragmatic easy way out. */
112
113#ifdef NO_SYS_RESOURCE_H
114#define RLIMIT_NOFILE 6 /* maximum descriptor index + 1 */
115struct rlimit {
116 int rlim_cur; /* current (soft) limit */
117 int rlim_max; /* maximum value for rlim_cur */
118};
119#else
120#include <sys/time.h>
121#include <sys/resource.h>
122#endif
123
124/* X11 includes */
125
126#include <X11/Xlib.h>
127#include <X11/Intrinsic.h>
128#include <X11/StringDefs.h>
129#include <X11/cursorfont.h>
130#include <X11/keysym.h>
131#include <X11/Shell.h>
132#include <X11/Xaw/AsciiText.h>
133#include <X11/Xaw/Command.h>
134#include <X11/Xaw/Form.h>
135#include <X11/Xaw/Dialog.h>
136#include <X11/Xaw/Label.h>
137#include <X11/Xaw/SimpleMenu.h>
138#include <X11/Xaw/SmeBSB.h>
139#include <X11/Xaw/SmeLine.h>
140#include <X11/Xaw/TextSrc.h>
141#include <X11/Xaw/TextSink.h>
142
143/* These are required because exim monitor has its own munged
144version of the stripchart widget. */
145
146#include <X11/IntrinsicP.h>
147#include <X11/StringDefs.h>
148#include <X11/Xaw/XawInit.h>
149#include <X11/Xaw/StripCharP.h>
150
151extern WidgetClass mystripChartWidgetClass;
152
153
154
155/*************************************************
156* Enumerations *
157*************************************************/
158
159/* Operations on the in-store message queue */
160
161enum { queue_noop, queue_add };
162
163/* Operations on the destinations queue */
164
165enum { dest_noop, dest_add, dest_remove };
166
167
168/*************************************************
169* Structure for destinations *
170*************************************************/
171
172typedef struct dest_item {
173 struct dest_item *next;
174 struct dest_item *parent;
175 uschar address[1];
176} dest_item;
177
178
179
180/*************************************************
181* Structure for queue items *
182*************************************************/
183
184typedef struct queue_item {
185 struct queue_item *next;
186 struct queue_item *prev;
187 struct dest_item *destinations;
188 int input_time;
189 int update_time;
190 int size;
191 uschar *sender;
192 uschar name[17];
193 uschar seen;
194 uschar frozen;
195 uschar dir_char;
196} queue_item;
197
198
199/*************************************************
200* Structure for queue skip items *
201*************************************************/
202
203typedef struct skip_item {
204 struct skip_item *next;
205 time_t reveal;
206 uschar text[1];
207} skip_item;
208
209
210/*************************************************
211* Structure for delivery displays *
212*************************************************/
213
214typedef struct pipe_item {
215 struct pipe_item *next;
216 int fd;
217 Widget widget;
218} pipe_item;
219
220
221
222/*************************************************
223* Global variables *
224*************************************************/
225
226extern Display *X_display; /* Current display */
227extern XtAppContext X_appcon; /* Application context */
228extern XtActionsRec actionTable[]; /* Actions table */
229
230extern XtTranslations queue_trans; /* translation table for queue text widget */
231extern XtTranslations text_trans; /* translation table for other text widgets */
232
233extern Widget dialog_ref_widget; /* for positioning dialog box */
234extern Widget toplevel_widget;
235extern Widget log_widget; /* widget for tail display */
236extern Widget queue_widget; /* widget for queue display */
237extern Widget unhide_widget; /* widget for unhide button */
238
239extern FILE *LOG;
240
241extern int action_output; /* TRUE when wanting action command output */
242extern int action_queue_update; /* controls auto updates */
243extern int actionTableSize; /* # entries in actionTable */
244extern uschar actioned_message[]; /* For menu handling */
245extern uschar *action_required;
246extern uschar *alternate_config; /* Alternate Exim configuration file */
247
248extern int body_max; /* Max size of body to display */
249
250extern int eximon_initialized; /* TRUE when initialized */
251
252extern int log_buffer_size; /* size of log buffer */
253extern BOOL log_datestamping; /* TRUE if logs are datestamped */
254extern int log_depth; /* depth of log tail window */
255extern uschar *log_display_buffer; /* to hold display text */
256extern uschar *log_file; /* supplied name of exim log file */
257extern uschar log_file_open[256]; /* actual open file */
258extern uschar *log_font; /* font for log display */
259extern ino_t log_inode; /* the inode of the log file */
260extern long int log_position; /* position in log file */
261extern int log_width; /* width of log tail window */
262
263extern uschar *menu_event; /* name of menu event */
264extern int menu_is_up; /* TRUE when menu displayed */
265extern int min_height; /* min window height */
266extern int min_width; /* min window width */
267
268extern pipe_item *pipe_chain; /* for delivery displays */
269
270extern uschar *qualify_domain;
271extern int queue_depth; /* depth of queue window */
272extern uschar *queue_font; /* font for queue display */
273extern int queue_max_addresses; /* limit on per-message list */
274extern skip_item *queue_skip; /* for hiding bits of queue */
275extern uschar *queue_stripchart_name; /* sic */
276extern int queue_update; /* update interval */
277extern int queue_width; /* width of queue window */
278
279extern pcre *yyyymmdd_regex; /* for matching yyyy-mm-dd */
280
281extern uschar *size_stripchart; /* path for size monitoring */
282extern uschar *size_stripchart_name; /* name for size stripchart */
283extern uschar *spool_directory; /* Name of exim spool directory */
284extern int spool_is_split; /* True if detected split spool */
285extern int start_small; /* True to start with small window */
286extern int stripchart_height; /* height of stripcharts */
287extern int stripchart_number; /* number of stripcharts */
288extern pcre **stripchart_regex; /* vector of regexps */
289extern uschar **stripchart_title; /* vector of titles */
290extern int *stripchart_total; /* vector of accumulating values */
291extern int stripchart_update; /* update interval */
292extern int stripchart_width; /* width of stripcharts */
293extern int stripchart_varstart; /* starting number for variable charts */
294
295extern int text_depth; /* depth of text windows */
296extern int tick_queue_accumulator; /* For timing next auto update */
297
298extern uschar *window_title; /* title of the exim monitor window */
299
300
301/*************************************************
302* Global functions *
303*************************************************/
304
305extern XtActionProc dialogAction(Widget, XEvent *, String *, Cardinal *);
306
307extern uschar *copystring(uschar *);
308extern void create_dialog(uschar *, uschar *);
309extern void create_stripchart(Widget, uschar *);
310extern void debug(char *, ...);
311extern dest_item *find_dest(queue_item *, uschar *, int, BOOL);
312extern queue_item *find_queue(uschar *, int, int);
313extern void init(int, uschar **);
314extern void menu_create(Widget, XEvent *, String *, Cardinal *);
315extern void NonMessageDialogue(uschar *);
316extern void queue_display(void);
317extern void read_log(void);
318extern int read_spool(uschar *);
319extern int read_spool_init(uschar *);
320extern void read_spool_tidy(void);
321extern int repaint_window(StripChartWidget, int, int);
322extern void scan_spool_input(int);
323extern void stripchart_init(void);
324extern void text_empty(Widget);
325extern void text_show(Widget, uschar *);
326extern void text_showf(Widget, char *, ...);
327extern void xs_SetValues(Widget, Cardinal, ...);
328
329/* End of em_hdr.h */