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