Extra exiscan source files - first batch
[users/jgh/exim.git] / src / src / mime.h
1 /* $Cambridge: exim/src/src/mime.h,v 1.1.2.1 2004/11/26 09:13:34 tom Exp $ */
2
3 /*************************************************
4 *     Exim - an Internet mail transport agent    *
5 *************************************************/
6
7 /* This file is part of the exiscan-acl content scanner
8 patch. It is NOT part of the standard exim distribution. */
9
10 /* Copyright (c) Tom Kistner <tom@duncanthrax.net> 2004 */
11 /* License: GPL */
12
13
14 #define MIME_MAX_HEADER_SIZE 8192
15 #define MIME_MAX_LINE_LENGTH 32768
16
17 #define MBC_ATTACHMENT            0
18 #define MBC_COVERLETTER_ONESHOT   1
19 #define MBC_COVERLETTER_ALL       2
20
21 struct mime_boundary_context
22 {
23   struct mime_boundary_context *parent;
24   unsigned char *boundary;
25   int context;
26 };
27
28 typedef struct mime_header {
29   uschar *name;
30   int    namelen;
31   void   *value;
32 } mime_header;
33
34 static mime_header mime_header_list[] = {
35   { US"content-type:", 13, &mime_content_type },
36   { US"content-disposition:", 20, &mime_content_disposition },
37   { US"content-transfer-encoding:", 26, &mime_content_transfer_encoding },
38   { US"content-id:", 11, &mime_content_id },
39   { US"content-description:", 20 , &mime_content_description }
40 };
41
42 static int mime_header_list_size = sizeof(mime_header_list)/sizeof(mime_header);
43
44
45
46 typedef struct mime_parameter {
47   uschar *name;
48   int    namelen;
49   void   *value;
50 } mime_parameter;
51
52 static mime_parameter mime_parameter_list[] = {
53   { US"name=", 5, &mime_filename },
54   { US"filename=", 9, &mime_filename },
55   { US"charset=", 8, &mime_charset },
56   { US"boundary=", 9, &mime_boundary }
57 };
58
59 static int mime_parameter_list_size = sizeof(mime_parameter_list)/sizeof(mime_parameter);
60
61 /* BASE64 decoder matrix */
62 static unsigned char mime_b64[256]={
63 /*   0 */  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,
64 /*  16 */  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128, 
65 /*  32 */  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,   62,  128,  128,  128,   63,
66 /*  48 */   52,   53,   54,   55,   56,   57,   58,   59,   60,   61,  128,  128,  128,  255,  128,  128,
67 /*  64 */  128,    0,    1,    2,    3,    4,    5,    6,    7,    8,    9,   10,   11,   12,   13,   14,
68 /*  80 */   15,   16,   17,   18,   19,   20,   21,   22,   23,   24,   25,  128,  128,  128,  128,  128,
69 /*  96 */  128,   26,   27,   28,   29,   30,   31,   32,   33,   34,   35,   36,   37,   38,   39,   40,
70 /* 112 */   41,   42,   43,   44,   45,   46,   47,   48,   49,   50,   51,  128,  128,  128,  128,  128,
71 /* 128 */  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,
72 /* 144 */  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,
73 /* 160 */  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,
74 /* 176 */  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,
75 /* 192 */  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,
76 /* 208 */  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,
77 /* 224 */  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,
78 /* 240 */  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,  128 
79 };