| 1 | #ifndef MIME_H |
| 2 | #define MIME_H |
| 3 | |
| 4 | #include "stralloc.h" |
| 5 | |
| 6 | extern void decodeQ(); |
| 7 | extern void decodeB(); |
| 8 | extern void encodeQ(); |
| 9 | extern void encodeB(); |
| 10 | extern void decodeHDR(); |
| 11 | extern void concatHDR(); |
| 12 | extern int unfoldHDR(); |
| 13 | |
| 14 | #ifdef WITH_PROTO |
| 15 | extern unsigned int author_name(char **,char *,unsigned int); |
| 16 | #else |
| 17 | extern unsigned int author_name(); |
| 18 | #endif |
| 19 | |
| 20 | /* Characters */ |
| 21 | #define ESC 0x1B |
| 22 | #define SI 0x0F |
| 23 | #define SO 0x0E |
| 24 | /* iso-2022-jp back-to-ascii seq */ |
| 25 | #define TOASCII "\x1B(B" |
| 26 | /* to JP. Last char [B|@] must be added */ |
| 27 | #define TOJP "\x1B$" |
| 28 | |
| 29 | /* iso-2022 SI sequence as string */ |
| 30 | #define TOSI "\x0F" |
| 31 | /* SI \n SO */ |
| 32 | #define SI_LF_SO "\x0F\n\x0E" |
| 33 | |
| 34 | /* in these bit 0 determines the number of bytes (1 or 2) in ss2/ss3 codes */ |
| 35 | /* it is 2 for CN,1 for JP, and they are not used for KR bit 3 for */ |
| 36 | /* iso-2022 */ |
| 37 | #define CS_2022_MASK 0x08 |
| 38 | #define CS_2022_JP 0x08 |
| 39 | #define CS_2022_KR 0xA0 |
| 40 | #define CS_NONE 0 |
| 41 | #define CS_BAD 0xffff |
| 42 | |
| 43 | #define CS_2022_CN 0x09 |
| 44 | /* Other Chinese ones. bit 7 set means MSB of 2-byte seq. No ss2/ss3 consid*/ |
| 45 | #define CS_CN 0x10 |
| 46 | |
| 47 | #define MIME_NONE 0 |
| 48 | #define MIME_APPLICATION_OCTETSTREAM 1 |
| 49 | #define MIME_MULTI 0x80 |
| 50 | #define MIME_MULTI_ALTERNATIVE 0x81 |
| 51 | #define MIME_MULTI_MIXED 0x82 |
| 52 | #define MIME_MULTI_DIGEST 0x83 |
| 53 | #define MIME_MULTI_SIGNED 0x84 |
| 54 | |
| 55 | #define MIME_TEXT 0x40 |
| 56 | #define MIME_TEXT_PLAIN 0x41 |
| 57 | #define MIME_TEXT_HTML 0x42 |
| 58 | #define MIME_TEXT_ENRICHED 0x43 |
| 59 | #define MIME_TEXT_VCARD 0x44 |
| 60 | |
| 61 | #define MIME_MESSAGE 0x20 |
| 62 | #define MIME_MESSAGE_RFC822 0x21 |
| 63 | |
| 64 | #define CTENC_NONE 0 |
| 65 | #define CTENC_QP 1 |
| 66 | #define CTENC_BASE64 2 |
| 67 | |
| 68 | /* this is a linked list of mime type info. */ |
| 69 | typedef struct { |
| 70 | int level; |
| 71 | unsigned int mimetype; |
| 72 | unsigned int ctenc; |
| 73 | unsigned int cs; /* charset flag - expand later */ |
| 74 | void *previous; |
| 75 | void *next; |
| 76 | stralloc boundary; |
| 77 | stralloc charset; |
| 78 | stralloc ctype; |
| 79 | } mime_info; |
| 80 | |
| 81 | #endif |