Fix FreeBSD build.
[haiku.git] / headers / os / mail / mail_encoding.h
blobeac45759f5b77ab3fbfa2c5f9a933b829e889bfa
1 #ifndef ZOIDBERG_MAIL_ENCODING_H
2 #define ZOIDBERG_MAIL_ENCODING_H
3 /* mail encoding - mail de-/encoding functions (base64 and friends)
4 **
5 ** Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved.
6 */
9 #include <size_t.h>
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
22 typedef enum {
23 base64 = 'b',
24 quoted_printable = 'q',
25 seven_bit = '7',
26 eight_bit = '8',
27 uuencode = 'u', // Invalid to encode something using uuencode.
28 null_encoding = 0, // For not changing existing settings.
29 no_encoding = -1
30 } mail_encoding;
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
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);
55 #ifdef __cplusplus
57 #endif
59 #endif /* ZOIDBERG_MAIL_ENCODING_H */