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. */
10 /* This is the general header file for all the modules that comprise
11 the exim monitor program. */
13 /* If this macro is defined, Eximon will anonymize all email addresses. This
14 feature is just so that screen shots can be obtained for documentation
17 /* #define ANONYMIZE */
19 /* System compilation parameters */
21 #define queue_index_size 10 /* Size of index into queue */
23 /* Assume most systems have statfs() unless os.h undefines this macro */
27 /* Bring in the system-dependent stuff */
43 /* Not-fully-ANSI systems (e.g. SunOS4 are missing some things) */
53 #include <sys/types.h>
59 #include <sys/param.h>
63 /* The new standard is statvfs; some OS have statfs. Also arrange
64 to be able to cut it out altogether for way-out OS that don't have
68 #ifdef HAVE_SYS_STATVFS_H
69 #include <sys/statvfs.h>
72 #define statvfs statfs
75 #ifdef HAVE_SYS_STATFS_H
76 #include <sys/statfs.h>
79 #ifdef HAVE_SYS_MOUNT_H
80 #include <sys/mount.h>
87 /* Regular expression include */
89 #define PCRE2_CODE_UNIT_WIDTH 8
92 /* Includes from the main source of Exim. One of these days I should tidy up
93 this interface so that this kind of kludge isn't needed. */
96 # define NS_MAXMSG 65535
100 #include "local_scan.h"
106 #include "hintsdb_structs.h"
107 #include "functions.h"
108 #include "osfunctions.h"
110 /* The sys/resource.h header on SunOS 4 causes trouble with the gcc
111 compiler. Just stuff the bit we want in here; pragmatic easy way out. */
113 #ifdef NO_SYS_RESOURCE_H
114 #define RLIMIT_NOFILE 6 /* maximum descriptor index + 1 */
116 int rlim_cur; /* current (soft) limit */
117 int rlim_max; /* maximum value for rlim_cur */
120 #include <sys/time.h>
121 #include <sys/resource.h>
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>
143 /* These are required because exim monitor has its own munged
144 version of the stripchart widget. */
146 #include <X11/IntrinsicP.h>
147 #include <X11/StringDefs.h>
148 #include <X11/Xaw/XawInit.h>
149 #include <X11/Xaw/StripCharP.h>
151 extern WidgetClass mystripChartWidgetClass;
155 /*************************************************
157 *************************************************/
159 /* Operations on the in-store message queue */
161 enum { queue_noop, queue_add };
163 /* Operations on the destinations queue */
165 enum { dest_noop, dest_add, dest_remove };
168 /*************************************************
169 * Structure for destinations *
170 *************************************************/
172 typedef struct dest_item {
173 struct dest_item *next;
174 struct dest_item *parent;
180 /*************************************************
181 * Structure for queue items *
182 *************************************************/
184 typedef struct queue_item {
185 struct queue_item *next;
186 struct queue_item *prev;
187 struct dest_item *destinations;
199 /*************************************************
200 * Structure for queue skip items *
201 *************************************************/
203 typedef struct skip_item {
204 struct skip_item *next;
210 /*************************************************
211 * Structure for delivery displays *
212 *************************************************/
214 typedef struct pipe_item {
215 struct pipe_item *next;
222 /*************************************************
224 *************************************************/
226 extern Display *X_display; /* Current display */
227 extern XtAppContext X_appcon; /* Application context */
228 extern XtActionsRec actionTable[]; /* Actions table */
230 extern XtTranslations queue_trans; /* translation table for queue text widget */
231 extern XtTranslations text_trans; /* translation table for other text widgets */
233 extern Widget dialog_ref_widget; /* for positioning dialog box */
234 extern Widget toplevel_widget;
235 extern Widget log_widget; /* widget for tail display */
236 extern Widget queue_widget; /* widget for queue display */
237 extern Widget unhide_widget; /* widget for unhide button */
241 extern int action_output; /* TRUE when wanting action command output */
242 extern int action_queue_update; /* controls auto updates */
243 extern int actionTableSize; /* # entries in actionTable */
244 extern uschar actioned_message[]; /* For menu handling */
245 extern uschar *action_required;
246 extern uschar *alternate_config; /* Alternate Exim configuration file */
248 extern int body_max; /* Max size of body to display */
250 extern int eximon_initialized; /* TRUE when initialized */
252 extern int log_buffer_size; /* size of log buffer */
253 extern BOOL log_datestamping; /* TRUE if logs are datestamped */
254 extern int log_depth; /* depth of log tail window */
255 extern uschar *log_display_buffer; /* to hold display text */
256 extern uschar *log_file; /* supplied name of exim log file */
257 extern uschar log_file_open[256]; /* actual open file */
258 extern uschar *log_font; /* font for log display */
259 extern ino_t log_inode; /* the inode of the log file */
260 extern long int log_position; /* position in log file */
261 extern int log_width; /* width of log tail window */
263 extern uschar *menu_event; /* name of menu event */
264 extern int menu_is_up; /* TRUE when menu displayed */
265 extern int min_height; /* min window height */
266 extern int min_width; /* min window width */
268 extern pipe_item *pipe_chain; /* for delivery displays */
270 extern uschar *qualify_domain;
271 extern int queue_depth; /* depth of queue window */
272 extern uschar *queue_font; /* font for queue display */
273 extern int queue_max_addresses; /* limit on per-message list */
274 extern skip_item *queue_skip; /* for hiding bits of queue */
275 extern uschar *queue_stripchart_name; /* sic */
276 extern int queue_update; /* update interval */
277 extern int queue_width; /* width of queue window */
279 extern pcre2_code *yyyymmdd_regex; /* for matching yyyy-mm-dd */
281 extern uschar *size_stripchart; /* path for size monitoring */
282 extern uschar *size_stripchart_name; /* name for size stripchart */
283 extern uschar *spool_directory; /* Name of exim spool directory */
284 extern int spool_is_split; /* True if detected split spool */
285 extern int start_small; /* True to start with small window */
286 extern int stripchart_height; /* height of stripcharts */
287 extern int stripchart_number; /* number of stripcharts */
288 extern pcre2_code **stripchart_regex; /* vector of regexps */
289 extern uschar **stripchart_title; /* vector of titles */
290 extern int *stripchart_total; /* vector of accumulating values */
291 extern int stripchart_update; /* update interval */
292 extern int stripchart_width; /* width of stripcharts */
293 extern int stripchart_varstart; /* starting number for variable charts */
295 extern int text_depth; /* depth of text windows */
296 extern int tick_queue_accumulator; /* For timing next auto update */
298 extern uschar *window_title; /* title of the exim monitor window */
301 /*************************************************
303 *************************************************/
305 extern XtActionProc dialogAction(Widget, XEvent *, String *, Cardinal *);
307 extern uschar *copystring(uschar *);
308 extern void create_dialog(uschar *, uschar *);
309 extern void create_stripchart(Widget, uschar *);
310 extern void debug(char *, ...);
311 extern dest_item *find_dest(queue_item *, uschar *, int, BOOL);
312 extern queue_item *find_queue(uschar *, int, int);
313 extern void init(int, uschar **);
314 extern void menu_create(Widget, XEvent *, String *, Cardinal *);
315 extern void NonMessageDialogue(uschar *);
316 extern void queue_display(void);
317 extern void read_log(void);
318 extern int read_spool(uschar *);
319 extern int read_spool_init(uschar *);
320 extern void read_spool_tidy(void);
321 extern int repaint_window(StripChartWidget, int, int);
322 extern void scan_spool_input(int);
323 extern void stripchart_init(void);
324 extern void text_empty(Widget);
325 extern void text_show(Widget, uschar *);
326 extern void text_showf(Widget, char *, ...);
327 extern void xs_SetValues(Widget, Cardinal, ...);
329 /* End of em_hdr.h */