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