Annotation of win32/gnome/gmime-x.x.x/gmime-utils.h, revision 1.1
1.1 ! paf 1: /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
! 2: /*
! 3: * Authors: Michael Zucchi <notzed@helixcode.com>
! 4: * Jeffrey Stedfast <fejj@helixcode.com>
! 5: *
! 6: * Copyright 2000 Helix Code, Inc. (www.helixcode.com)
! 7: *
! 8: * This program is free software; you can redistribute it and/or modify
! 9: * it under the terms of the GNU General Public License as published by
! 10: * the Free Software Foundation; either version 2 of the License, or
! 11: * (at your option) any later version.
! 12: *
! 13: * This program is distributed in the hope that it will be useful,
! 14: * but WITHOUT ANY WARRANTY; without even the implied warranty of
! 15: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! 16: * GNU General Public License for more details.
! 17: *
! 18: * You should have received a copy of the GNU General Public License
! 19: * along with this program; if not, write to the Free Software
! 20: * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
! 21: *
! 22: */
! 23:
! 24: #ifndef __GMIME_UTILS_H__
! 25: #define __GMIME_UTILS_H__
! 26:
! 27: #ifdef __cplusplus
! 28: extern "C" {
! 29: //#pragma }
! 30: #endif /* __cplusplus }*/
! 31:
! 32: #include <glib.h>
! 33: #include <time.h>
! 34: #include <stdarg.h>
! 35:
! 36: typedef enum {
! 37: GMIME_PART_ENCODING_DEFAULT,
! 38: GMIME_PART_ENCODING_7BIT,
! 39: GMIME_PART_ENCODING_8BIT,
! 40: GMIME_PART_ENCODING_BINARY,
! 41: GMIME_PART_ENCODING_BASE64,
! 42: GMIME_PART_ENCODING_QUOTEDPRINTABLE,
! 43: GMIME_PART_ENCODING_UUENCODE,
! 44: GMIME_PART_NUM_ENCODINGS
! 45: } GMimePartEncodingType;
! 46:
! 47: #define BASE64_ENCODE_LEN(x) ((size_t) ((x) * 5 / 3) + 4) /* conservative would be ((x * 4 / 3) + 4) */
! 48: #define QP_ENCODE_LEN(x) ((size_t) ((x) * 7 / 2) + 4) /* conservative would be ((x * 3) + 4) */
! 49:
! 50: #define GMIME_UUDECODE_STATE_INIT (0)
! 51: #define GMIME_UUDECODE_STATE_BEGIN (1 << 16)
! 52: #define GMIME_UUDECODE_STATE_END (1 << 17)
! 53: #define GMIME_UUDECODE_STATE_MASK (GMIME_UUDECODE_STATE_BEGIN | GMIME_UUDECODE_STATE_END)
! 54:
! 55:
! 56: time_t g_mime_utils_header_decode_date (const char *in, int *saveoffset);
! 57: char *g_mime_utils_header_format_date (time_t time, int offset);
! 58:
! 59: char *g_mime_utils_header_fold (const char *in);
! 60: char *g_mime_utils_header_printf (const char *format, ...);
! 61:
! 62: char *g_mime_utils_quote_string (const char *string);
! 63: void g_mime_utils_unquote_string (char *string);
! 64:
! 65: /* encoding decision making utilities ;-) */
! 66: gboolean g_mime_utils_text_is_8bit (const unsigned char *text, size_t len);
! 67: GMimePartEncodingType g_mime_utils_best_encoding (const unsigned char *text, size_t len);
! 68:
! 69: /* utilities to (de/en)code headers */
! 70: char *g_mime_utils_8bit_header_decode (const unsigned char *in);
! 71: char *g_mime_utils_8bit_header_encode (const unsigned char *in);
! 72: char *g_mime_utils_8bit_header_encode_phrase (const unsigned char *in);
! 73:
! 74: /* do incremental base64 (de/en)coding */
! 75: size_t g_mime_utils_base64_decode_step (const unsigned char *in, size_t inlen, unsigned char *out, int *state, guint32 *save);
! 76: size_t g_mime_utils_base64_encode_step (const unsigned char *in, size_t inlen, unsigned char *out, int *state, guint32 *save);
! 77: size_t g_mime_utils_base64_encode_close (const unsigned char *in, size_t inlen, unsigned char *out, int *state, guint32 *save);
! 78:
! 79: /* do incremental uu (de/en)coding */
! 80: size_t g_mime_utils_uudecode_step (const unsigned char *in, size_t inlen, unsigned char *out, int *state, guint32 *save);
! 81: size_t g_mime_utils_uuencode_step (const unsigned char *in, size_t inlen, unsigned char *out, unsigned char *uubuf, int *state, guint32 *save);
! 82: size_t g_mime_utils_uuencode_close (const unsigned char *in, size_t inlen, unsigned char *out, unsigned char *uubuf, int *state, guint32 *save);
! 83:
! 84: /* do incremental quoted-printable (de/en)coding */
! 85: size_t g_mime_utils_quoted_decode_step (const unsigned char *in, size_t inlen, unsigned char *out, int *savestate, int *saved);
! 86: size_t g_mime_utils_quoted_encode_step (const unsigned char *in, size_t inlen, unsigned char *out, int *state, int *save);
! 87: size_t g_mime_utils_quoted_encode_close (const unsigned char *in, size_t inlen, unsigned char *out, int *state, int *save);
! 88:
! 89: #ifdef __cplusplus
! 90: }
! 91: #endif /* __cplusplus */
! 92:
! 93: #endif /* __GMIME_UTILS_H__ */
E-mail: