Merge branch 'debian'
[hcoop/debian/exim4.git] / exim_monitor / em_hdr.h
CommitLineData
420a0d19
CE
1/*************************************************
2* Exim Monitor *
3*************************************************/
4
5/* Copyright (c) University of Cambridge 1995 - 2009 */
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
88#include <pcre.h>
89
2ea97746
CE
90/* Includes from the main source of Exim. One of these days I should tidy up
91this interface so that this kind of kludge isn't needed. */
420a0d19 92
2ea97746
CE
93#ifndef NS_MAXMSG
94# define NS_MAXMSG 65535
95#endif
96typedef void hctx;
420a0d19
CE
97
98#include "config.h"
99#include "mytypes.h"
100#include "macros.h"
101
102#include "local_scan.h"
103#include "structs.h"
2ea97746 104#include "blob.h"
420a0d19
CE
105#include "globals.h"
106#include "dbstuff.h"
107#include "functions.h"
108#include "osfunctions.h"
109#include "store.h"
110
111/* The sys/resource.h header on SunOS 4 causes trouble with the gcc
112compiler. Just stuff the bit we want in here; pragmatic easy way out. */
113
114#ifdef NO_SYS_RESOURCE_H
115#define RLIMIT_NOFILE 6 /* maximum descriptor index + 1 */
116struct rlimit {
117 int rlim_cur; /* current (soft) limit */
118 int rlim_max; /* maximum value for rlim_cur */
119};
120#else
121#include <sys/time.h>
122#include <sys/resource.h>
123#endif
124
125/* X11 includes */
126
127#include <X11/Xlib.h>
128#include <X11/Intrinsic.h>
129#include <X11/StringDefs.h>
130#include <X11/cursorfont.h>
131#include <X11/keysym.h>
132#include <X11/Shell.h>
133#include <X11/Xaw/AsciiText.h>
134#include <X11/Xaw/Command.h>
135#include <X11/Xaw/Form.h>
136#include <X11/Xaw/Dialog.h>
137#include <X11/Xaw/Label.h>
138#include <X11/Xaw/SimpleMenu.h>
139#include <X11/Xaw/SmeBSB.h>
140#include <X11/Xaw/SmeLine.h>
141#include <X11/Xaw/TextSrc.h>
142#include <X11/Xaw/TextSink.h>
143
144/* These are required because exim monitor has its own munged
145version of the stripchart widget. */
146
147#include <X11/IntrinsicP.h>
148#include <X11/StringDefs.h>
149#include <X11/Xaw/XawInit.h>
150#include <X11/Xaw/StripCharP.h>
151
152extern WidgetClass mystripChartWidgetClass;
153
154
155
156/*************************************************
157* Enumerations *
158*************************************************/
159
160/* Operations on the in-store message queue */
161
162enum { queue_noop, queue_add };
163
164/* Operations on the destinations queue */
165
166enum { dest_noop, dest_add, dest_remove };
167
168
169/*************************************************
170* Structure for destinations *
171*************************************************/
172
173typedef struct dest_item {
174 struct dest_item *next;
175 struct dest_item *parent;
176 uschar address[1];
177} dest_item;
178
179
180
181/*************************************************
182* Structure for queue items *
183*************************************************/
184
185typedef struct queue_item {
186 struct queue_item *next;
187 struct queue_item *prev;
188 struct dest_item *destinations;
189 int input_time;
190 int update_time;
191 int size;
192 uschar *sender;
193 uschar name[17];
194 uschar seen;
195 uschar frozen;
196 uschar dir_char;
197} queue_item;
198
199
200/*************************************************
201* Structure for queue skip items *
202*************************************************/
203
204typedef struct skip_item {
205 struct skip_item *next;
206 time_t reveal;
207 uschar text[1];
208} skip_item;
209
210
211/*************************************************
212* Structure for delivery displays *
213*************************************************/
214
215typedef struct pipe_item {
216 struct pipe_item *next;
217 int fd;
218 Widget widget;
219} pipe_item;
220
221
222
223/*************************************************
224* Global variables *
225*************************************************/
226
227extern Display *X_display; /* Current display */
228extern XtAppContext X_appcon; /* Application context */
229extern XtActionsRec actionTable[]; /* Actions table */
230
231extern XtTranslations queue_trans; /* translation table for queue text widget */
232extern XtTranslations text_trans; /* translation table for other text widgets */
233
234extern Widget dialog_ref_widget; /* for positioning dialog box */
235extern Widget toplevel_widget;
236extern Widget log_widget; /* widget for tail display */
237extern Widget queue_widget; /* widget for queue display */
238extern Widget unhide_widget; /* widget for unhide button */
239
240extern FILE *LOG;
241
242extern int action_output; /* TRUE when wanting action command output */
243extern int action_queue_update; /* controls auto updates */
244extern int actionTableSize; /* # entries in actionTable */
245extern uschar actioned_message[]; /* For menu handling */
246extern uschar *action_required;
247extern uschar *alternate_config; /* Alternate Exim configuration file */
248
249extern int body_max; /* Max size of body to display */
250
251extern int eximon_initialized; /* TRUE when initialized */
252
253extern int log_buffer_size; /* size of log buffer */
254extern BOOL log_datestamping; /* TRUE if logs are datestamped */
255extern int log_depth; /* depth of log tail window */
256extern uschar *log_display_buffer; /* to hold display text */
257extern uschar *log_file; /* supplied name of exim log file */
258extern uschar log_file_open[256]; /* actual open file */
259extern uschar *log_font; /* font for log display */
260extern ino_t log_inode; /* the inode of the log file */
261extern long int log_position; /* position in log file */
262extern int log_width; /* width of log tail window */
263
264extern uschar *menu_event; /* name of menu event */
265extern int menu_is_up; /* TRUE when menu displayed */
266extern int min_height; /* min window height */
267extern int min_width; /* min window width */
268
269extern pipe_item *pipe_chain; /* for delivery displays */
270
271extern uschar *qualify_domain;
272extern int queue_depth; /* depth of queue window */
273extern uschar *queue_font; /* font for queue display */
274extern int queue_max_addresses; /* limit on per-message list */
275extern skip_item *queue_skip; /* for hiding bits of queue */
276extern uschar *queue_stripchart_name; /* sic */
277extern int queue_update; /* update interval */
278extern int queue_width; /* width of queue window */
279
280extern pcre *yyyymmdd_regex; /* for matching yyyy-mm-dd */
281
282extern uschar *size_stripchart; /* path for size monitoring */
283extern uschar *size_stripchart_name; /* name for size stripchart */
284extern uschar *spool_directory; /* Name of exim spool directory */
285extern int spool_is_split; /* True if detected split spool */
286extern int start_small; /* True to start with small window */
287extern int stripchart_height; /* height of stripcharts */
288extern int stripchart_number; /* number of stripcharts */
289extern pcre **stripchart_regex; /* vector of regexps */
290extern uschar **stripchart_title; /* vector of titles */
291extern int *stripchart_total; /* vector of accumulating values */
292extern int stripchart_update; /* update interval */
293extern int stripchart_width; /* width of stripcharts */
294extern int stripchart_varstart; /* starting number for variable charts */
295
296extern int text_depth; /* depth of text windows */
297extern int tick_queue_accumulator; /* For timing next auto update */
298
299extern uschar *window_title; /* title of the exim monitor window */
300
301
302/*************************************************
303* Global functions *
304*************************************************/
305
306extern XtActionProc dialogAction(Widget, XEvent *, String *, Cardinal *);
307
308extern uschar *copystring(uschar *);
309extern void create_dialog(uschar *, uschar *);
310extern void create_stripchart(Widget, uschar *);
311extern void debug(char *, ...);
312extern dest_item *find_dest(queue_item *, uschar *, int, BOOL);
313extern queue_item *find_queue(uschar *, int, int);
314extern void init(int, uschar **);
315extern void menu_create(Widget, XEvent *, String *, Cardinal *);
316extern void NonMessageDialogue(uschar *);
317extern void queue_display(void);
318extern void read_log(void);
319extern int read_spool(uschar *);
320extern int read_spool_init(uschar *);
321extern void read_spool_tidy(void);
322extern int repaint_window(StripChartWidget, int, int);
323extern void scan_spool_input(int);
324extern void stripchart_init(void);
325extern void text_empty(Widget);
326extern void text_show(Widget, uschar *);
327extern void text_showf(Widget, char *, ...);
328extern void xs_SetValues(Widget, Cardinal, ...);
329
330/* End of em_hdr.h */