-
Notifications
You must be signed in to change notification settings - Fork 14
/
MIME_headers.h
221 lines (172 loc) · 6.34 KB
/
MIME_headers.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
#ifndef MIMEHEADERS
#define MIMEHEADERS
#define MIMEH_VERSION "200812162102"
#define _CTYPE_RANGE 99
#define _CTYPE_UNSPECIFIED -1
#define _CTYPE_MESSAGE_START 1
#define _CTYPE_MESSAGE 1
#define _CTYPE_MESSAGE_END 100
#define _CTYPE_MULTIPART_START 100
#define _CTYPE_MULTIPART 100
#define _CTYPE_MULTIPART_MIXED 101
#define _CTYPE_MULTIPART_APPLEDOUBLE 102
#define _CTYPE_MULTIPART_RELATED 103
#define _CTYPE_MULTIPART_ALTERNATIVE 104
#define _CTYPE_MULTIPART_REPORT 105
#define _CTYPE_MULTIPART_SIGNED 106
#define _CTYPE_MULTIPART_END 199
#define _CTYPE_TEXT_START 200
#define _CTYPE_TEXT 200
#define _CTYPE_TEXT_PLAIN 201
#define _CTYPE_TEXT_UNKNOWN 202
#define _CTYPE_TEXT_HTML 203
#define _CTYPE_TEXT_CALENDAR 204
#define _CTYPE_TEXT_END 299
#define _CTYPE_IMAGE_START 300
#define _CTYPE_IMAGE 300
#define _CTYPE_IMAGE_GIF 301
#define _CTYPE_IMAGE_JPEG 302
#define _CTYPE_IMAGE_PNG 303
#define _CTYPE_IMAGE_END 399
#define _CTYPE_AUDIO_START 400
#define _CTYPE_AUDIO 400
#define _CTYPE_AUDIO_END 499
#define _CTYPE_OCTECT 800
#define _CTYPE_RFC822 500
#define _CTYPE_TNEF 600
#define _CTYPE_APPLICATION 700
#define _CTYPE_APPLICATION_APPLEFILE 701
#define _CTYPE_UNKNOWN 0
#define _CTRANS_ENCODING_UNSPECIFIED -1
#define _CTRANS_ENCODING_B64 100
#define _CTRANS_ENCODING_7BIT 101
#define _CTRANS_ENCODING_8BIT 102
#define _CTRANS_ENCODING_QP 103
#define _CTRANS_ENCODING_RAW 104
#define _CTRANS_ENCODING_BINARY 105
#define _CTRANS_ENCODING_UUENCODE 106
#define _CTRANS_ENCODING_UNKNOWN 0
#define _CDISPOSITION_UNSPECIFIED -1
#define _CDISPOSITION_INLINE 100
#define _CDISPOSITION_ATTACHMENT 200
#define _CDISPOSITION_FORMDATA 300
#define _CDISPOSITION_UNKNOWN 0
#define _MIMEH_FOUND_FROM 100
#define _MIMEH_STRLEN_MAX 1023
#define _MIMEH_FILENAMELEN_MAX 128
#define _MIMEH_CONTENT_TYPE_MAX 128
#define _MIMEH_SUBJECTLEN_MAX 128
#define _MIMEH_CONTENT_DESCRIPTION_MAX 128
#define _MIMEH_CONTENT_TRANSFER_ENCODING_MAX 256
#define _MIMEH_CONTENT_DISPOSITION_MAX 256
#define _MIMEH_DEBUG_NORMAL 1
#define _MIMEH_DEBUG_PEDANTIC 10
#define _MIMEH_DEFECT_ARRAY_SIZE 100
#define _MIMEH_CHARSET_MAX 128
// Errors to throw back
#define MIMEH_ERROR_DISK_FULL 128
// Defects
#define MIMEH_DEFECT_MULTIPLE_QUOTES 1
#define MIMEH_DEFECT_UNBALANCED_QUOTES 2
#define MIMEH_DEFECT_MULTIPLE_EQUALS_SEPARATORS 3
#define MIMEH_DEFECT_MULTIPLE_COLON_SEPARATORS 4
#define MIMEH_DEFECT_MULTIPLE_BOUNDARIES 5
#define MIMEH_DEFECT_UNBALANCED_BOUNDARY_QUOTE 6
#define MIMEH_DEFECT_MULTIPLE_FIELD_OCCURANCE 7
#define MIMEH_DEFECT_MISSING_SEPARATORS 8
#define MIMEH_DEFECT_MULTIPLE_NAMES 9
#define MIMEH_DEFECT_MULTIPLE_FILENAMES 10
struct MIMEH_header_info
{
char scratch[_MIMEH_STRLEN_MAX +1];
int content_type;
char content_type_string[ _MIMEH_CONTENT_TYPE_MAX +1 ];
char content_description_string[ _MIMEH_CONTENT_DESCRIPTION_MAX +1 ];
char boundary[_MIMEH_STRLEN_MAX +1];
int boundary_located;
char subject[_MIMEH_SUBJECTLEN_MAX +1];
char filename[_MIMEH_FILENAMELEN_MAX +1];
char name[_MIMEH_STRLEN_MAX +1];
/** 20041217-1601:PLD: New header fields to keep **/
char from[_MIMEH_STRLEN_MAX +1];
char date[_MIMEH_STRLEN_MAX +1];
char to[_MIMEH_STRLEN_MAX +1];
char messageid[_MIMEH_STRLEN_MAX +1];
char received[_MIMEH_STRLEN_MAX +1];
/** end of new fields **/
// Store multiple filenames
struct SS_object ss_filenames;
// Store multiple names
struct SS_object ss_names;
int content_transfer_encoding;
char content_transfer_encoding_string[ _MIMEH_CONTENT_TRANSFER_ENCODING_MAX +1 ];
int content_disposition;
char content_disposition_string[ _MIMEH_CONTENT_DISPOSITION_MAX +1 ];
//int charset;
char charset[ _MIMEH_CHARSET_MAX +1 ];
int format;
int file_has_uuencode;
char uudec_name[_MIMEH_FILENAMELEN_MAX +1]; // UUDecode name. This is a post-decode information field.
int current_recursion_level;
// Malformed email reporting
int defects[_MIMEH_DEFECT_ARRAY_SIZE];
int header_defect_count;
// Special Exception flags
int x_mac; // Set if the content type contains x-mac-* entries, which means a filename may contain /'s
/** Header sanity level - indicates if any of the headers we apparently read are good **/
int sanity;
/** 20051117-0932:PLD: Will be non-zero if email is MIME **/
int is_mime;
char delimeter[3];
int crlf_count; // 200811151149:PLD: Tally's the number of CRLF lines
int crcr_count; // 200811151149:PLD: Tally's the number of CRLF lines
int lf_count; // 200811151149:PLD: Tally's the number of LF only lines
};
#ifdef RIPMIME_V2XX
struct MIMEH_header_node {
struct MIMEH_header_info *header_list;
struct MIMEH_header_node *next;
};
struct MIMEH_email_info {
char mailpack_name[1024];
struct MIMEH_header_node *headers;
};
#endif
int MIMEH_version(void);
int MIMEH_init( void );
int MIMEH_set_debug( int level );
int MIMEH_set_verbosity( int level );
int MIMEH_set_verbosity_contenttype( int level );
int MIMEH_get_verbosity_contenttype( void );
int MIMEH_get_headers_sanity(void);
int MIMEH_is_contenttype( int range_type, int content_type );
int MIMEH_set_mailbox( int level );
int MIMEH_set_doubleCR( int level );
int MIMEH_set_doubleCR_save( int level );
int MIMEH_get_doubleCR_save( void );
int MIMEH_set_headerfix( int level );
int MIMEH_set_headers_save( FILE *f );
int MIMEH_set_headers_nosave( void );
int MIMEH_get_headers_save( void );
char *MIMEH_get_headers_ptr( void );
int MIMEH_set_headers_save_original( int level );
char *MIMEH_get_headers_original_ptr( void );
int MIMEH_set_headers_original_save_to_file( FILE *f );
int MIMEH_get_doubleCR( void );
char *MIMEH_get_doubleCR_name( void );
int MIMEH_set_header_longsearch( int level );
int MIMEH_headers_clearcount( struct MIMEH_header_info *hinfo );
int MIMEH_read_headers( struct MIMEH_header_info *hinfo, FFGET_FILE *f );
int MIMEH_headers_get( struct MIMEH_header_info *hinfo, FFGET_FILE *f );
int MIMEH_headers_process( struct MIMEH_header_info *hinfo, char *headers );
int MIMEH_headers_cleanup();
int MIMEH_parse_headers( FFGET_FILE *f, struct MIMEH_header_info *hinfo );
int MIMEH_display_info( struct MIMEH_header_info *hinfo );
int MIMEH_set_webform( int level );
int MIMEH_set_outputdir( char *dir );
int MIMEH_set_defect( struct MIMEH_header_info *hinfo, int defect );
int MIMEH_dump_defects( struct MIMEH_header_info *hinfo );
int MIMEH_get_defect_count( struct MIMEH_header_info *hinfo );
int MIMEH_set_report_MIME( int level );
int MIMEH_read_primary_headers( char *fname, struct MIMEH_header_info *hinfo );
#endif