9464f01fae32802f2c5839328204db87260f6f75
[citadel.git] / citadel / mime_parser.h
1 /*
2  * $Id$
3  *
4  */
5
6 /*
7  * Here's a bunch of stupid magic to make the MIME parser portable between
8  * Citadel and WebCit.
9  */
10 #ifndef SIZ
11 #define SIZ     4096
12 #endif
13
14 #ifndef mallok
15 #define mallok(x) malloc(x)
16 #endif
17
18 #ifndef phree
19 #define phree(x) free(x)
20 #endif
21
22 #ifndef reallok
23 #define reallok(x,y) realloc(x,y)
24 #endif
25
26 #ifndef strdoop
27 #define strdoop(x) strdup(x)
28 #endif
29
30 /* 
31  * Declarations for functions in the parser
32  */
33
34 void extract_key(char *target, char *source, char *key);
35
36 void mime_parser(char *content_start, char *content_end,
37                 void (*CallBack)
38                         (char *cbname,
39                         char *cbfilename,
40                         char *cbpartnum,
41                         char *cbdisp,
42                         void *cbcontent,
43                         char *cbtype,
44                         size_t cblength,
45                         char *cbencoding,
46                         void *cbuserdata),
47                 void (*PreMultiPartCallBack)
48                         (char *cbname,
49                         char *cbfilename,
50                         char *cbpartnum,
51                         char *cbdisp,
52                         void *cbcontent,
53                         char *cbtype,
54                         size_t cblength,
55                         char *cbencoding,
56                         void *cbuserdata),
57                 void (*PostMultiPartCallBack)
58                         (char *cbname,
59                         char *cbfilename,
60                         char *cbpartnum,
61                         char *cbdisp,
62                         void *cbcontent,
63                         char *cbtype,
64                         size_t cblength,
65                         char *cbencoding,
66                         void *cbuserdata),
67                 void *userdata,
68                 int dont_decode
69                 );