/usr/include/gmime-2.6/gmime/gmime-encodings.h is in libgmime-2.6-dev 2.6.7-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/* GMime
* Copyright (C) 2000-2012 Jeffrey Stedfast
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1
* of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free
* Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
#ifndef __GMIME_ENCODINGS_H__
#define __GMIME_ENCODINGS_H__
#include <glib.h>
#include <sys/types.h>
G_BEGIN_DECLS
/**
* GMimeContentEncoding:
* @GMIME_CONTENT_ENCODING_DEFAULT: Default transfer encoding.
* @GMIME_CONTENT_ENCODING_7BIT: 7bit text transfer encoding.
* @GMIME_CONTENT_ENCODING_8BIT: 8bit text transfer encoding.
* @GMIME_CONTENT_ENCODING_BINARY: Binary transfer encoding.
* @GMIME_CONTENT_ENCODING_BASE64: Base64 transfer encoding.
* @GMIME_CONTENT_ENCODING_QUOTEDPRINTABLE: Quoted-printable transfer encoding.
* @GMIME_CONTENT_ENCODING_UUENCODE: Uuencode transfer encoding.
*
* A Content-Transfer-Encoding enumeration.
**/
typedef enum {
GMIME_CONTENT_ENCODING_DEFAULT,
GMIME_CONTENT_ENCODING_7BIT,
GMIME_CONTENT_ENCODING_8BIT,
GMIME_CONTENT_ENCODING_BINARY,
GMIME_CONTENT_ENCODING_BASE64,
GMIME_CONTENT_ENCODING_QUOTEDPRINTABLE,
GMIME_CONTENT_ENCODING_UUENCODE
} GMimeContentEncoding;
/**
* GMimeEncodingConstraint:
* @GMIME_ENCODING_CONSTRAINT_7BIT: The stream data must fit within the 7bit ASCII range.
* @GMIME_ENCODING_CONSTRAINT_8BIT: The stream data may have bytes with the high bit set, but no null bytes.
* @GMIME_ENCODING_CONSTRAINT_BINARY: The stream may contain any binary data.
*
* Used with functions like g_mime_filter_best_encoding() and
* g_mime_object_encode() as the 'constraint' argument. These values
* provide a means of letting the filter know what the encoding
* constraints are for the stream.
**/
typedef enum {
GMIME_ENCODING_CONSTRAINT_7BIT,
GMIME_ENCODING_CONSTRAINT_8BIT,
GMIME_ENCODING_CONSTRAINT_BINARY
} GMimeEncodingConstraint;
GMimeContentEncoding g_mime_content_encoding_from_string (const char *str);
const char *g_mime_content_encoding_to_string (GMimeContentEncoding encoding);
/**
* GMIME_BASE64_ENCODE_LEN:
* @x: Length of the input data to encode
*
* Calculates the maximum number of bytes needed to base64 encode the
* full input buffer of length @x.
*
* Returns: the number of output bytes needed to base64 encode an input
* buffer of size @x.
**/
#define GMIME_BASE64_ENCODE_LEN(x) ((size_t) (((((x) + 2) / 57) * 77) + 77))
/**
* GMIME_QP_ENCODE_LEN:
* @x: Length of the input data to encode
*
* Calculates the maximum number of bytes needed to encode the full
* input buffer of length @x using the quoted-printable encoding.
*
* Returns: the number of output bytes needed to encode an input buffer
* of size @x using the quoted-printable encoding.
**/
#define GMIME_QP_ENCODE_LEN(x) ((size_t) ((((x) / 24) * 74) + 74))
/**
* GMIME_UUENCODE_LEN:
* @x: Length of the input data to encode
*
* Calculates the maximum number of bytes needed to uuencode the full
* input buffer of length @x.
*
* Returns: the number of output bytes needed to uuencode an input
* buffer of size @x.
**/
#define GMIME_UUENCODE_LEN(x) ((size_t) (((((x) + 2) / 45) * 62) + 64))
/**
* GMIME_UUDECODE_STATE_INIT:
*
* Initial state for the g_mime_encoding_uudecode_step() function.
**/
#define GMIME_UUDECODE_STATE_INIT (0)
/**
* GMIME_UUDECODE_STATE_BEGIN:
*
* State for the g_mime_encoding_uudecode_step() function, denoting that
* the 'begin' line has been found.
**/
#define GMIME_UUDECODE_STATE_BEGIN (1 << 16)
/**
* GMIME_UUDECODE_STATE_END:
*
* State for the g_mime_encoding_uudecode_step() function, denoting that
* the end of the UU encoded block has been found.
**/
#define GMIME_UUDECODE_STATE_END (1 << 17)
#define GMIME_UUDECODE_STATE_MASK (GMIME_UUDECODE_STATE_BEGIN | GMIME_UUDECODE_STATE_END)
/**
* GMimeEncoding:
* @encoding: the type of encoding
* @uubuf: a temporary buffer needed when uuencoding data
* @encode: %TRUE if encoding or %FALSE if decoding
* @save: saved bytes from the previous step
* @state: current encder/decoder state
*
* A context used for encoding or decoding data.
**/
typedef struct _GMimeEncoding {
GMimeContentEncoding encoding;
unsigned char uubuf[60];
gboolean encode;
guint32 save;
int state;
} GMimeEncoding;
void g_mime_encoding_init_encode (GMimeEncoding *state, GMimeContentEncoding encoding);
void g_mime_encoding_init_decode (GMimeEncoding *state, GMimeContentEncoding encoding);
void g_mime_encoding_reset (GMimeEncoding *state);
size_t g_mime_encoding_outlen (GMimeEncoding *state, size_t inlen);
size_t g_mime_encoding_step (GMimeEncoding *state, const char *inbuf, size_t inlen, char *outbuf);
size_t g_mime_encoding_flush (GMimeEncoding *state, const char *inbuf, size_t inlen, char *outbuf);
/* do incremental base64 (de/en)coding */
size_t g_mime_encoding_base64_decode_step (const unsigned char *inbuf, size_t inlen, unsigned char *outbuf, int *state, guint32 *save);
size_t g_mime_encoding_base64_encode_step (const unsigned char *inbuf, size_t inlen, unsigned char *outbuf, int *state, guint32 *save);
size_t g_mime_encoding_base64_encode_close (const unsigned char *inbuf, size_t inlen, unsigned char *outbuf, int *state, guint32 *save);
/* do incremental uu (de/en)coding */
size_t g_mime_encoding_uudecode_step (const unsigned char *inbuf, size_t inlen, unsigned char *outbuf, int *state, guint32 *save);
size_t g_mime_encoding_uuencode_step (const unsigned char *inbuf, size_t inlen, unsigned char *outbuf, unsigned char *uubuf, int *state, guint32 *save);
size_t g_mime_encoding_uuencode_close (const unsigned char *inbuf, size_t inlen, unsigned char *outbuf, unsigned char *uubuf, int *state, guint32 *save);
/* do incremental quoted-printable (de/en)coding */
size_t g_mime_encoding_quoted_decode_step (const unsigned char *inbuf, size_t inlen, unsigned char *outbuf, int *state, guint32 *save);
size_t g_mime_encoding_quoted_encode_step (const unsigned char *inbuf, size_t inlen, unsigned char *outbuf, int *state, guint32 *save);
size_t g_mime_encoding_quoted_encode_close (const unsigned char *inbuf, size_t inlen, unsigned char *outbuf, int *state, guint32 *save);
G_END_DECLS
#endif /* __GMIME_ENCODINGS_H__ */
|