Fix FSF address (Tobias Mueller, #470445)
[platform/upstream/evolution-data-server.git] / camel / providers / pop3 / camel-pop3-stream.h
1 /*
2  * Copyright (C) 2002 Ximian Inc.
3  *
4  * Authors: Michael Zucchi <notzed@ximian.com>
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of version 2 of the GNU Lesser General Public
8  * License as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this program; if not, write to the
17  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20
21 /* This is *identical* to the camel-nntp-stream, so should probably
22    work out a way to merge them */
23
24 #ifndef _CAMEL_POP3_STREAM_H
25 #define _CAMEL_POP3_STREAM_H
26
27 #include <camel/camel-stream.h>
28
29 #define CAMEL_POP3_STREAM(obj)         CAMEL_CHECK_CAST (obj, camel_pop3_stream_get_type (), CamelPOP3Stream)
30 #define CAMEL_POP3_STREAM_CLASS(klass) CAMEL_CHECK_CLASS_CAST (klass, camel_pop3_stream_get_type (), CamelPOP3StreamClass)
31 #define CAMEL_IS_POP3_STREAM(obj)      CAMEL_CHECK_TYPE (obj, camel_pop3_stream_get_type ())
32
33 G_BEGIN_DECLS
34
35 typedef struct _CamelPOP3StreamClass CamelPOP3StreamClass;
36 typedef struct _CamelPOP3Stream CamelPOP3Stream;
37
38 typedef enum {
39         CAMEL_POP3_STREAM_LINE,
40         CAMEL_POP3_STREAM_DATA,
41         CAMEL_POP3_STREAM_EOD,  /* end of data, acts as if end of stream */
42 } camel_pop3_stream_mode_t;
43
44 struct _CamelPOP3Stream {
45         CamelStream parent;
46
47         CamelStream *source;
48
49         camel_pop3_stream_mode_t mode;
50         int state;
51
52         unsigned char *buf, *ptr, *end;
53         unsigned char *linebuf, *lineptr, *lineend;
54 };
55
56 struct _CamelPOP3StreamClass {
57         CamelStreamClass parent_class;
58 };
59
60 CamelType                camel_pop3_stream_get_type     (void);
61
62 CamelStream     *camel_pop3_stream_new          (CamelStream *source);
63
64
65 void             camel_pop3_stream_set_mode     (CamelPOP3Stream *is, camel_pop3_stream_mode_t mode);
66
67 int              camel_pop3_stream_line         (CamelPOP3Stream *is, unsigned char **data, unsigned int *len);
68 int              camel_pop3_stream_gets         (CamelPOP3Stream *is, unsigned char **start, unsigned int *len);
69 int              camel_pop3_stream_getd         (CamelPOP3Stream *is, unsigned char **start, unsigned int *len);
70
71 G_END_DECLS
72
73 #endif /* ! _CAMEL_POP3_STREAM_H */