1 /*************************************************
3 *************************************************/
5 /* Copyright (c) University of Cambridge 1995 - 2009 */
6 /* Copyright (c) The Exim Maintainers 2021 - 2022 */
7 /* See the file NOTICE for conditions of use and distribution. */
8 /* SPDX-License-Identifier: GPL-2.0-only */
11 /* This is the general header file for all the modules that comprise
12 the exim monitor program. */
14 /* If this macro is defined, Eximon will anonymize all email addresses. This
15 feature is just so that screen shots can be obtained for documentation
18 /* #define ANONYMIZE */
20 /* System compilation parameters */
22 #define queue_index_size 10 /* Size of index into queue */
24 /* Assume most systems have statfs() unless os.h undefines this macro */
28 /* Bring in the system-dependent stuff */
44 /* Not-fully-ANSI systems (e.g. SunOS4 are missing some things) */
54 #include <sys/types.h>
60 #include <sys/param.h>
64 /* The new standard is statvfs; some OS have statfs. Also arrange
65 to be able to cut it out altogether for way-out OS that don't have
69 #ifdef HAVE_SYS_STATVFS_H
70 #include <sys/statvfs.h>
73 #define statvfs statfs
76 #ifdef HAVE_SYS_STATFS_H
77 #include <sys/statfs.h>
80 #ifdef HAVE_SYS_MOUNT_H
81 #include <sys/mount.h>
88 /* Regular expression include */
90 #define PCRE2_CODE_UNIT_WIDTH 8
93 /* Includes from the main source of Exim. One of these days I should tidy up
94 this interface so that this kind of kludge isn't needed. */
97 # define NS_MAXMSG 65535
101 #include "local_scan.h"
107 #include "hintsdb_structs.h"
108 #include "functions.h"
109 #include "osfunctions.h"
111 /* The sys/resource.h header on SunOS 4 causes trouble with the gcc
112 compiler. Just stuff the bit we want in here; pragmatic easy way out. */
114 #ifdef NO_SYS_RESOURCE_H
115 #define RLIMIT_NOFILE 6 /* maximum descriptor index + 1 */
117 int rlim_cur; /* current (soft) limit */
118 int rlim_max; /* maximum value for rlim_cur */
121 #include <sys/time.h>
122 #include <sys/resource.h>
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>
144 /* These are required because exim monitor has its own munged
145 version of the stripchart widget. */
147 #include <X11/IntrinsicP.h>
148 #include <X11/StringDefs.h>
149 #include <X11/Xaw/XawInit.h>
150 #include <X11/Xaw/StripCharP.h>
152 extern WidgetClass mystripChartWidgetClass;
156 /*************************************************
158 *************************************************/
160 /* Operations on the in-store message queue */
162 enum { queue_noop, queue_add };
164 /* Operations on the destinations queue */
166 enum { dest_noop, dest_add, dest_remove };
169 /*************************************************
170 * Structure for destinations *
171 *************************************************/
173 typedef struct dest_item {
174 struct dest_item *next;
175 struct dest_item *parent;
181 /*************************************************
182 * Structure for queue items *
183 *************************************************/
185 typedef struct queue_item {
186 struct queue_item *next;
187 struct queue_item *prev;
188 struct dest_item *destinations;
200 /*************************************************
201 * Structure for queue skip items *
202 *************************************************/
204 typedef struct skip_item {
205 struct skip_item *next;
211 /*************************************************
212 * Structure for delivery displays *
213 *************************************************/
215 typedef struct pipe_item {
216 struct pipe_item *next;
223 /*************************************************
225 *************************************************/
227 extern Display *X_display; /* Current display */
228 extern XtAppContext X_appcon; /* Application context */
229 extern XtActionsRec actionTable[]; /* Actions table */
231 extern XtTranslations queue_trans; /* translation table for queue text widget */
232 extern XtTranslations text_trans; /* translation table for other text widgets */
234 extern Widget dialog_ref_widget; /* for positioning dialog box */
235 extern Widget toplevel_widget;
236 extern Widget log_widget; /* widget for tail display */
237 extern Widget queue_widget; /* widget for queue display */
238 extern Widget unhide_widget; /* widget for unhide button */
242 extern int action_output; /* TRUE when wanting action command output */
243 extern int action_queue_update; /* controls auto updates */
244 extern int actionTableSize; /* # entries in actionTable */
245 extern uschar actioned_message[]; /* For menu handling */
246 extern uschar *action_required;
247 extern uschar *alternate_config; /* Alternate Exim configuration file */
249 extern int body_max; /* Max size of body to display */
251 extern int eximon_initialized; /* TRUE when initialized */
253 extern int log_buffer_size; /* size of log buffer */
254 extern BOOL log_datestamping; /* TRUE if logs are datestamped */
255 extern int log_depth; /* depth of log tail window */
256 extern uschar *log_display_buffer; /* to hold display text */
257 extern uschar *log_file; /* supplied name of exim log file */
258 extern uschar log_file_open[256]; /* actual open file */
259 extern uschar *log_font; /* font for log display */
260 extern ino_t log_inode; /* the inode of the log file */
261 extern long int log_position; /* position in log file */
262 extern int log_width; /* width of log tail window */
264 extern uschar *menu_event; /* name of menu event */
265 extern int menu_is_up; /* TRUE when menu displayed */
266 extern int min_height; /* min window height */
267 extern int min_width; /* min window width */
269 extern pipe_item *pipe_chain; /* for delivery displays */
271 extern uschar *qualify_domain;
272 extern int queue_depth; /* depth of queue window */
273 extern uschar *queue_font; /* font for queue display */
274 extern int queue_max_addresses; /* limit on per-message list */
275 extern skip_item *queue_skip; /* for hiding bits of queue */
276 extern uschar *queue_stripchart_name; /* sic */
277 extern int queue_update; /* update interval */
278 extern int queue_width; /* width of queue window */
280 extern pcre2_code *yyyymmdd_regex; /* for matching yyyy-mm-dd */
282 extern uschar *size_stripchart; /* path for size monitoring */
283 extern uschar *size_stripchart_name; /* name for size stripchart */
284 extern uschar *spool_directory; /* Name of exim spool directory */
285 extern int spool_is_split; /* True if detected split spool */
286 extern int start_small; /* True to start with small window */
287 extern int stripchart_height; /* height of stripcharts */
288 extern int stripchart_number; /* number of stripcharts */
289 extern pcre2_code **stripchart_regex; /* vector of regexps */
290 extern uschar **stripchart_title; /* vector of titles */
291 extern int *stripchart_total; /* vector of accumulating values */
292 extern int stripchart_update; /* update interval */
293 extern int stripchart_width; /* width of stripcharts */
294 extern int stripchart_varstart; /* starting number for variable charts */
296 extern int text_depth; /* depth of text windows */
297 extern int tick_queue_accumulator; /* For timing next auto update */
299 extern uschar *window_title; /* title of the exim monitor window */
302 /*************************************************
304 *************************************************/
306 extern XtActionProc dialogAction(Widget, XEvent *, String *, Cardinal *);
308 extern uschar *copystring(uschar *);
309 extern void create_dialog(uschar *, uschar *);
310 extern void create_stripchart(Widget, uschar *);
311 extern void debug(char *, ...);
312 extern dest_item *find_dest(queue_item *, uschar *, int, BOOL);
313 extern queue_item *find_queue(uschar *, int, int);
314 extern void init(int, uschar **);
315 extern void menu_create(Widget, XEvent *, String *, Cardinal *);
316 extern void NonMessageDialogue(uschar *);
317 extern void queue_display(void);
318 extern void read_log(void);
319 extern int read_spool(uschar *);
320 extern int read_spool_init(uschar *);
321 extern void read_spool_tidy(void);
322 extern int repaint_window(StripChartWidget, int, int);
323 extern void scan_spool_input(int);
324 extern void stripchart_init(void);
325 extern void text_empty(Widget);
326 extern void text_show(Widget, uschar *);
327 extern void text_showf(Widget, char *, ...);
328 extern void xs_SetValues(Widget, Cardinal, ...);
330 /* End of em_hdr.h */