Start
[exim.git] / src / src / local_scan.h
CommitLineData
059ec3d9
PH
1/* $Cambridge: exim/src/src/local_scan.h,v 1.1 2004/10/07 10:39:01 ph10 Exp $ */
2
3/*************************************************
4* Exim - an Internet mail transport agent *
5*************************************************/
6
7/* Copyright (c) University of Cambridge 1995 - 2004 */
8/* See the file NOTICE for conditions of use and distribution. */
9
10/* This file is the header that is the only Exim header to be included in the
11source for the local_scan.c() function. It contains definitions that are made
12available for use in that function, and which are documented. */
13
14
15/* Some basic types that make some things easier, and the store functions. */
16
17#include <sys/types.h>
18#include "mytypes.h"
19#include "store.h"
20
21
22/* The function and its return codes. */
23
24extern int local_scan(int, uschar **);
25
26enum {
27 LOCAL_SCAN_ACCEPT, /* Accept */
28 LOCAL_SCAN_ACCEPT_FREEZE, /* Accept, but freeze */
29 LOCAL_SCAN_ACCEPT_QUEUE, /* Accept, but no immediate delivery */
30 LOCAL_SCAN_REJECT, /* Permanent rejection */
31 LOCAL_SCAN_REJECT_NOLOGHDR, /* Permanent rejection, no log header */
32 LOCAL_SCAN_TEMPREJECT, /* Temporary rejection */
33 LOCAL_SCAN_TEMPREJECT_NOLOGHDR /* Temporary rejection, no log header */
34};
35
36
37/* Return codes from the support functions lss_match_xxx(). */
38
39#define OK 0 /* Successful match */
40#define DEFER 1 /* Defer - some problem */
41#define FAIL 2 /* Matching failed */
42#define ERROR 3 /* Internal or config error */
43
44
45/* Available logging destinations */
46
47#define LOG_MAIN 1 /* Write to the main log */
48#define LOG_PANIC 2 /* Write to the panic log */
49#define LOG_REJECT 16 /* Write to the reject log, with headers */
50
51
52/* Accessible debugging bits */
53
54#define D_v 0x00000001
55#define D_local_scan 0x00000002
56
57
58/* Option types that can be used for local_scan_options. The boolean ones
59MUST be last so that they are contiguous with the internal boolean specials. */
60
61enum { opt_stringptr, opt_int, opt_octint, opt_mkint, opt_Kint, opt_fixed,
62 opt_time, opt_bool };
63
64
65/* The length of message identification strings. This is the id used internally
66by exim. The external version for use in Received: strings has a leading 'E'
67added to ensure it starts with a letter. */
68
69#define MESSAGE_ID_LENGTH 16
70
71/* The offset to the start of the data in the data file - this allows for
72the name of the data file to be present in the first line. */
73
74#define SPOOL_DATA_START_OFFSET (MESSAGE_ID_LENGTH+3)
75
76/* Some people (Marc Merlin et al) are maintaining a patch that allows for
77dynamic local_scan() libraries. This code is not yet in Exim proper, but it
78helps the maintainers if we keep their ABI version numbers here. This may
79mutate into more general support later. The major number is increased when the
80ABI is changed in a non backward compatible way. The minor number is increased
81each time a new feature is added (in a way that doesn't break backward
82compatibility). */
83
84#define LOCAL_SCAN_ABI_VERSION_MAJOR 1
85#define LOCAL_SCAN_ABI_VERSION_MINOR 0
86
87/* Structure definitions that are documented as visible in the function. */
88
89typedef struct header_line {
90 struct header_line *next;
91 int type;
92 int slen;
93 uschar *text;
94} header_line;
95
96/* Entries in lists options are in this form. */
97
98typedef struct {
99 char *name;
100 int type;
101 void *value;
102} optionlist;
103
104/*Structure for holding information about an envelope address. The errors_to
105field is always NULL except for one_time aliases that had errors_to on the
106routers that generated them. */
107
108typedef struct recipient_item {
109 uschar *address; /* the recipient address */
110 int pno; /* parent number for "one_time" alias, or -1 */
111 uschar *errors_to; /* the errors_to address or NULL */
112} recipient_item;
113
114
115/* Global variables that are documented as visible in the function. */
116
117extern unsigned int debug_selector; /* Debugging bits */
118
119extern uschar *expand_string_message; /* Error info for failing expansion */
120extern uschar *headers_charset; /* Charset for RFC 2047 decoding */
121extern header_line *header_last; /* Final header */
122extern header_line *header_list; /* First header */
123extern BOOL host_checking; /* Set when checking a host */
124extern uschar *interface_address; /* Interface for incoming call */
125extern int interface_port; /* Port number for incoming call */
126extern uschar *message_id; /* Internal id of message being handled */
127extern uschar *received_protocol; /* Name of incoming protocol */
128extern int recipients_count; /* Number of recipients */
129extern recipient_item *recipients_list;/* List of recipient addresses */
130extern unsigned char *sender_address; /* Sender address */
131extern uschar *sender_host_address; /* IP address of sender, as chars */
132extern uschar *sender_host_authenticated; /* Name of authentication mechanism */
133extern uschar *sender_host_name; /* Host name from lookup */
134extern int sender_host_port; /* Port number of sender */
135extern BOOL smtp_batched_input; /* TRUE if SMTP batch (no interaction) */
136extern BOOL smtp_input; /* TRUE if input is via SMTP */
137
138
139/* Functions that are documented as visible in local_scan(). */
140
141extern int child_close(pid_t, int);
142extern pid_t child_open(uschar **, uschar **, int, int *, int *, BOOL);
143extern pid_t child_open_exim(int *);
144extern void debug_printf(char *, ...) PRINTF_FUNCTION;
145extern uschar *expand_string(uschar *);
146extern void header_add(int, char *, ...);
147extern void header_add_at_position(BOOL, uschar *, BOOL, int, char *, ...);
148extern void header_remove(int, uschar *);
149extern BOOL header_testname(header_line *, uschar *, int, BOOL);
150extern void log_write(unsigned int, int, char *format, ...);
151extern int lss_b64decode(uschar *, uschar **);
152extern uschar *lss_b64encode(uschar *, int);
153extern int lss_match_domain(uschar *, uschar *);
154extern int lss_match_local_part(uschar *, uschar *, BOOL);
155extern int lss_match_address(uschar *, uschar *, BOOL);
156extern int lss_match_host(uschar *, uschar *, uschar *);
157extern void receive_add_recipient(uschar *, int);
158extern BOOL receive_remove_recipient(uschar *);
159extern uschar *rfc2047_decode(uschar *, BOOL, uschar *, int, int *, uschar **);
160extern int smtp_fflush(void);
161extern void smtp_printf(char *, ...) PRINTF_FUNCTION;
162extern uschar *string_copy(uschar *);
163extern uschar *string_copyn(uschar *, int);
164extern uschar *string_sprintf(char *, ...);
165
166/* End of local_scan.h */