1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3
* Authors: Jeffrey Stedfast <fejj@ximian.com>
5
* Copyright 2002-2004 Ximian, Inc. (www.ximian.com)
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU Lesser General Public License as published by
9
* the Free Software Foundation; either version 2 of the License, or
10
* (at your option) any later version.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU Lesser General Public License for more details.
17
* You should have received a copy of the GNU Lesser General Public License
18
* along with this program; if not, write to the Free Software
19
* Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
24
#ifndef __CAMEL_MIME_FILTER_YENC_H__
25
#define __CAMEL_MIME_FILTER_YENC_H__
27
#include <camel/camel-mime-filter.h>
29
#define CAMEL_TYPE_MIME_FILTER_YENC (camel_mime_filter_yenc_get_type ())
30
#define CAMEL_MIME_FILTER_YENC(obj) (CAMEL_CHECK_CAST ((obj), CAMEL_TYPE_MIME_FILTER_YENC, CamelMimeFilterYenc))
31
#define CAMEL_MIME_FILTER_YENC_CLASS(klass) (CAMEL_CHECK_CLASS_CAST ((klass), CAMEL_TYPE_MIME_FILTER_YENC, CamelMimeFilterYencClass))
32
#define CAMEL_IS_MIME_FILTER_YENC(obj) (CAMEL_CHECK_TYPE ((obj), CAMEL_TYPE_MIME_FILTER_YENC))
33
#define CAMEL_IS_MIME_FILTER_YENC_CLASS(klass) (CAMEL_CHECK_CLASS_TYPE ((klass), CAMEL_TYPE_MIME_FILTER_YENC))
34
#define CAMEL_MIME_FILTER_YENC_GET_CLASS(obj) (CAMEL_CHECK_GET_CLASS ((obj), CAMEL_TYPE_MIME_FILTER_YENC, CamelMimeFilterYencClass))
38
typedef struct _CamelMimeFilterYenc CamelMimeFilterYenc;
39
typedef struct _CamelMimeFilterYencClass CamelMimeFilterYencClass;
42
CAMEL_MIME_FILTER_YENC_DIRECTION_ENCODE,
43
CAMEL_MIME_FILTER_YENC_DIRECTION_DECODE
44
} CamelMimeFilterYencDirection;
46
#define CAMEL_MIME_YDECODE_STATE_INIT (0)
47
#define CAMEL_MIME_YENCODE_STATE_INIT (0)
49
/* first 8 bits are reserved for saving a byte */
51
/* reserved for use only within camel_mime_ydecode_step */
52
#define CAMEL_MIME_YDECODE_STATE_EOLN (1 << 8)
53
#define CAMEL_MIME_YDECODE_STATE_ESCAPE (1 << 9)
55
/* bits 10 and 11 reserved for later uses? */
57
#define CAMEL_MIME_YDECODE_STATE_BEGIN (1 << 12)
58
#define CAMEL_MIME_YDECODE_STATE_PART (1 << 13)
59
#define CAMEL_MIME_YDECODE_STATE_DECODE (1 << 14)
60
#define CAMEL_MIME_YDECODE_STATE_END (1 << 15)
62
#define CAMEL_MIME_YENCODE_CRC_INIT (~0)
63
#define CAMEL_MIME_YENCODE_CRC_FINAL(crc) (~crc)
65
struct _CamelMimeFilterYenc {
66
CamelMimeFilter parent_object;
68
CamelMimeFilterYencDirection direction;
77
struct _CamelMimeFilterYencClass {
78
CamelMimeFilterClass parent_class;
83
CamelType camel_mime_filter_yenc_get_type (void);
85
CamelMimeFilter *camel_mime_filter_yenc_new (CamelMimeFilterYencDirection direction);
87
void camel_mime_filter_yenc_set_state (CamelMimeFilterYenc *yenc, int state);
88
void camel_mime_filter_yenc_set_crc (CamelMimeFilterYenc *yenc, guint32 crc);
90
/*int camel_mime_filter_yenc_get_part (CamelMimeFilterYenc *yenc);*/
91
guint32 camel_mime_filter_yenc_get_pcrc (CamelMimeFilterYenc *yenc);
92
guint32 camel_mime_filter_yenc_get_crc (CamelMimeFilterYenc *yenc);
95
size_t camel_ydecode_step (const unsigned char *in, size_t inlen, unsigned char *out,
96
int *state, guint32 *pcrc, guint32 *crc);
97
size_t camel_yencode_step (const unsigned char *in, size_t inlen, unsigned char *out,
98
int *state, guint32 *pcrc, guint32 *crc);
99
size_t camel_yencode_close (const unsigned char *in, size_t inlen, unsigned char *out,
100
int *state, guint32 *pcrc, guint32 *crc);
104
#endif /* __CAMEL_MIME_FILTER_YENC_H__ */