Fix FSF address (Tobias Mueller, #470445)
[platform/upstream/evolution-data-server.git] / camel / providers / nntp / camel-nntp-stream.h
1 /*
2  * Copyright (C) 2001 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 #ifndef _CAMEL_NNTP_STREAM_H
22 #define _CAMEL_NNTP_STREAM_H
23
24 #include <camel/camel-stream.h>
25
26 #define CAMEL_NNTP_STREAM(obj)         CAMEL_CHECK_CAST (obj, camel_nntp_stream_get_type (), CamelNNTPStream)
27 #define CAMEL_NNTP_STREAM_CLASS(klass) CAMEL_CHECK_CLASS_CAST (klass, camel_nntp_stream_get_type (), CamelNNTPStreamClass)
28 #define CAMEL_IS_NNTP_STREAM(obj)      CAMEL_CHECK_TYPE (obj, camel_nntp_stream_get_type ())
29
30 G_BEGIN_DECLS
31
32 typedef struct _CamelNNTPStreamClass CamelNNTPStreamClass;
33 typedef struct _CamelNNTPStream CamelNNTPStream;
34
35 typedef enum {
36         CAMEL_NNTP_STREAM_LINE,
37         CAMEL_NNTP_STREAM_DATA,
38         CAMEL_NNTP_STREAM_EOD,  /* end of data, acts as if end of stream */
39 } camel_nntp_stream_mode_t;
40
41 struct _CamelNNTPStream {
42         CamelStream parent;
43
44         CamelStream *source;
45
46         camel_nntp_stream_mode_t mode;
47         int state;
48
49         unsigned char *buf, *ptr, *end;
50         unsigned char *linebuf, *lineptr, *lineend;
51 };
52
53 struct _CamelNNTPStreamClass {
54         CamelStreamClass parent_class;
55 };
56
57 CamelType                camel_nntp_stream_get_type     (void);
58
59 CamelStream     *camel_nntp_stream_new          (CamelStream *source);
60
61
62 void             camel_nntp_stream_set_mode     (CamelNNTPStream *is, camel_nntp_stream_mode_t mode);
63
64 int              camel_nntp_stream_line         (CamelNNTPStream *is, unsigned char **data, unsigned int *len);
65 int              camel_nntp_stream_gets         (CamelNNTPStream *is, unsigned char **start, unsigned int *len);
66 int              camel_nntp_stream_getd         (CamelNNTPStream *is, unsigned char **start, unsigned int *len);
67
68 G_END_DECLS
69
70 #endif /* ! _CAMEL_NNTP_STREAM_H */