~ubuntu-branches/ubuntu/karmic/libtinymail/karmic

« back to all changes in this revision

Viewing changes to libtinymail-camel/camel-lite/camel/camel-mime-filter-yenc.h

  • Committer: Bazaar Package Importer
  • Author(s): Steve Kowalik
  • Date: 2007-10-12 11:21:12 UTC
  • Revision ID: james.westby@ubuntu.com-20071012112112-fod9fs7yrooxjr7i
Tags: upstream-0.0.2
ImportĀ upstreamĀ versionĀ 0.0.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 
2
/*
 
3
 *  Authors: Jeffrey Stedfast <fejj@ximian.com>
 
4
 *
 
5
 *  Copyright 2002-2004 Ximian, Inc. (www.ximian.com)
 
6
 *
 
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.
 
11
 *
 
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.
 
16
 *
 
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.
 
20
 *
 
21
 */
 
22
 
 
23
 
 
24
#ifndef __CAMEL_MIME_FILTER_YENC_H__
 
25
#define __CAMEL_MIME_FILTER_YENC_H__
 
26
 
 
27
#include <camel/camel-mime-filter.h>
 
28
 
 
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))
 
35
 
 
36
G_BEGIN_DECLS
 
37
 
 
38
typedef struct _CamelMimeFilterYenc CamelMimeFilterYenc;
 
39
typedef struct _CamelMimeFilterYencClass CamelMimeFilterYencClass;
 
40
 
 
41
typedef enum {
 
42
        CAMEL_MIME_FILTER_YENC_DIRECTION_ENCODE,
 
43
        CAMEL_MIME_FILTER_YENC_DIRECTION_DECODE
 
44
} CamelMimeFilterYencDirection;
 
45
 
 
46
#define CAMEL_MIME_YDECODE_STATE_INIT     (0)
 
47
#define CAMEL_MIME_YENCODE_STATE_INIT     (0)
 
48
 
 
49
/* first 8 bits are reserved for saving a byte */
 
50
 
 
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)
 
54
 
 
55
/* bits 10 and 11 reserved for later uses? */
 
56
 
 
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)
 
61
 
 
62
#define CAMEL_MIME_YENCODE_CRC_INIT       (~0)
 
63
#define CAMEL_MIME_YENCODE_CRC_FINAL(crc) (~crc)
 
64
 
 
65
struct _CamelMimeFilterYenc {
 
66
        CamelMimeFilter parent_object;
 
67
        
 
68
        CamelMimeFilterYencDirection direction;
 
69
        
 
70
        int part;
 
71
        
 
72
        int state;
 
73
        guint32 pcrc;
 
74
        guint32 crc;
 
75
};
 
76
 
 
77
struct _CamelMimeFilterYencClass {
 
78
        CamelMimeFilterClass parent_class;
 
79
        
 
80
};
 
81
 
 
82
 
 
83
CamelType camel_mime_filter_yenc_get_type (void);
 
84
 
 
85
CamelMimeFilter *camel_mime_filter_yenc_new (CamelMimeFilterYencDirection direction);
 
86
 
 
87
void camel_mime_filter_yenc_set_state (CamelMimeFilterYenc *yenc, int state);
 
88
void camel_mime_filter_yenc_set_crc (CamelMimeFilterYenc *yenc, guint32 crc);
 
89
 
 
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);
 
93
 
 
94
 
 
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);
 
101
 
 
102
G_END_DECLS
 
103
 
 
104
#endif /* __CAMEL_MIME_FILTER_YENC_H__ */