2 * Copyright (C) 2000 Ximian Inc.
4 * Authors: Michael Zucchi <notzed@ximian.com>
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.
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.
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.
21 #ifndef _CAMEL_IMAPP_STREAM_H
22 #define _CAMEL_IMAPP_STREAM_H
24 #include <camel/camel-stream.h>
26 #define CAMEL_IMAPP_STREAM(obj) CAMEL_CHECK_CAST (obj, camel_imapp_stream_get_type (), CamelIMAPPStream)
27 #define CAMEL_IMAPP_STREAM_CLASS(klass) CAMEL_CHECK_CLASS_CAST (klass, camel_imapp_stream_get_type (), CamelIMAPPStreamClass)
28 #define CAMEL_IS_IMAP_STREAM(obj) CAMEL_CHECK_TYPE (obj, camel_imapp_stream_get_type ())
32 typedef struct _CamelIMAPPStreamClass CamelIMAPPStreamClass;
33 typedef struct _CamelIMAPPStream CamelIMAPPStream;
36 IMAP_TOK_PROTOCOL = -2,
42 } camel_imapp_token_t;
44 struct _CamelIMAPPStream {
50 unsigned char *buf, *ptr, *end;
54 camel_imapp_token_t unget_tok;
55 unsigned char *unget_token;
56 unsigned int unget_len;
58 unsigned char *tokenbuf, *tokenptr, *tokenend;
61 struct _CamelIMAPPStreamClass {
62 CamelStreamClass parent_class;
65 CamelType camel_imapp_stream_get_type (void);
67 CamelStream *camel_imapp_stream_new (CamelStream *source);
69 camel_imapp_token_t camel_imapp_stream_token (CamelIMAPPStream *is, unsigned char **start, unsigned int *len); /* throws IO,PARSE exception */
70 void camel_imapp_stream_ungettoken (CamelIMAPPStream *is, camel_imapp_token_t tok, unsigned char *token, unsigned int len);
72 void camel_imapp_stream_set_literal (CamelIMAPPStream *is, unsigned int literal);
73 int camel_imapp_stream_gets (CamelIMAPPStream *is, unsigned char **start, unsigned int *len);
74 int camel_imapp_stream_getl (CamelIMAPPStream *is, unsigned char **start, unsigned int *len);
76 /* all throw IO,PARSE exceptions */
78 /* gets an atom, upper-cases */
79 int camel_imapp_stream_atom (CamelIMAPPStream *is, unsigned char **start, unsigned int *len);
80 /* gets an atom or string */
81 int camel_imapp_stream_astring (CamelIMAPPStream *is, unsigned char **start);
82 /* gets a NIL or a string, start==NULL if NIL */
83 int camel_imapp_stream_nstring (CamelIMAPPStream *is, unsigned char **start);
84 /* gets a NIL or string into a stream, stream==NULL if NIL */
85 int camel_imapp_stream_nstring_stream(CamelIMAPPStream *is, CamelStream **stream);
87 int camel_imapp_stream_text (CamelIMAPPStream *is, unsigned char **text);
90 guint32 camel_imapp_stream_number(CamelIMAPPStream *is);
94 #endif /* ! _CAMEL_IMAPP_STREAM_H */