1 #ifndef ZOIDBERG_MAIL_ENCODING_H
2 #define ZOIDBERG_MAIL_ENCODING_H
3 /* mail encoding - mail de-/encoding functions (base64 and friends)
5 ** Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved.
10 #include <sys/types.h>
13 #define B_MAIL_NULL_CONVERSION ((uint32) -1)
14 #define B_MAIL_UTF8_CONVERSION ((uint32) -2)
15 // For specifying the UTF-8 character set when converting to/from UTF-8.
16 #define B_MAIL_US_ASCII_CONVERSION ((uint32) -3)
17 // Plain 7 bit ASCII character set. A subset of UTF-8, but some mail software
18 // specifies it so we need to recognize it.
20 #define BASE64_LINELENGTH 76
24 quoted_printable
= 'q',
27 uuencode
= 'u', // Invalid to encode something using uuencode.
28 null_encoding
= 0, // For not changing existing settings.
36 ssize_t
encode(mail_encoding encoding
, char *out
, const char *in
,
37 off_t length
, int headerMode
);
38 // boolean headerMode only matters for quoted_printable and base64.
39 ssize_t
decode(mail_encoding encoding
, char *out
, const char *in
, off_t length
,
40 int underscore_is_space
);
41 // the value of underscore_is_space only matters for quoted_printable.
43 ssize_t
max_encoded_length(mail_encoding encoding
, off_t cur_length
);
44 mail_encoding
encoding_for_cte(const char *content_transfer_encoding
);
46 ssize_t
encode_base64(char *out
, const char *in
, off_t length
, int headerMode
);
47 ssize_t
decode_base64(char *out
, const char *in
, off_t length
);
49 ssize_t
encode_qp(char *out
, const char *in
, off_t length
, int headerMode
);
50 ssize_t
decode_qp(char *out
, const char *in
, off_t length
, int underscore_is_space
);
51 //---underscore_is_space should be 1 if and only if you are decoding a header field
53 ssize_t
uu_decode(char *out
, const char *in
, off_t length
);
59 #endif /* ZOIDBERG_MAIL_ENCODING_H */