aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-stream-buffer.h
blob: 81ab1a072e760dbf3ebb1b06406e2a89cf67ac8e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/* camel-stream-buffer.h :stream which buffers another stream */

/*
 *
 * Author :
 *  Michael Zucchi <notzed@helixcode.com>
 *
 * Copyright 2000 Helix Code Inc. (http://www.helixcode.com) .
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 * USA
 */


#ifndef CAMEL_STREAM_BUFFER_H
#define CAMEL_STREAM_BUFFER_H 1


#ifdef __cplusplus
extern "C" {
#pragma }
#endif /* __cplusplus }*/

#include <stdio.h>
#include <camel/camel-seekable-stream.h>

#define CAMEL_STREAM_BUFFER_TYPE     (camel_stream_buffer_get_type ())
#define CAMEL_STREAM_BUFFER(obj)     (CAMEL_CHECK_CAST((obj), CAMEL_STREAM_BUFFER_TYPE, CamelStreamBuffer))
#define CAMEL_STREAM_BUFFER_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_STREAM_BUFFER_TYPE, CamelStreamBufferClass))
#define CAMEL_IS_STREAM_BUFFER(o)    (CAMEL_CHECK_TYPE((o), CAMEL_STREAM_BUFFER_TYPE))

typedef enum
{
    CAMEL_STREAM_BUFFER_BUFFER = 0,
    CAMEL_STREAM_BUFFER_NEWLINE,
    CAMEL_STREAM_BUFFER_NONE,
    CAMEL_STREAM_BUFFER_READ = 0x00,
    CAMEL_STREAM_BUFFER_WRITE = 0x80,
    CAMEL_STREAM_BUFFER_MODE = 0x80
} CamelStreamBufferMode;

struct _CamelStreamBuffer
{
    CamelStream parent_object;

    /* these are all of course, private */
    CamelStream *stream;

    unsigned char *buf, *ptr, *end;
    int size;

    unsigned char *linebuf; /* for reading lines at a time */
    int linesize;

    CamelStreamBufferMode mode;
    unsigned int flags; /* internal flags */
};


typedef struct {
    CamelStreamClass parent_class;

    /* Virtual methods */
    void (*init) (CamelStreamBuffer *stream_buffer, CamelStream *stream,
              CamelStreamBufferMode mode);
    void (*init_vbuf) (CamelStreamBuffer *stream_buffer,
               CamelStream *stream, CamelStreamBufferMode mode,
               char *buf, guint32 size);

} CamelStreamBufferClass;


/* Standard Camel function */
CamelType camel_stream_buffer_get_type (void);


/* public methods */
CamelStream *camel_stream_buffer_new (CamelStream *s,
                      CamelStreamBufferMode mode);
CamelStream *camel_stream_buffer_new_with_vbuf (CamelStream *s,
                        CamelStreamBufferMode mode,
                        char *buf, guint32 size);

/* unimplemented
   CamelStream *camel_stream_buffer_set_vbuf (CamelStreamBuffer *b, CamelStreamBufferMode mode, char *buf, guint32 size); */

/* read a line of characters */
int camel_stream_buffer_gets (CamelStreamBuffer *b, char *buf, unsigned int max);

char *camel_stream_buffer_read_line (CamelStreamBuffer *sbf);

#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif /* CAMEL_STREAM_BUFFER_H */
n>/+4 * LibreOffice suite: update to 7.0.0 releaseDima Panov2020-08-161-5/+5 * Update LibreOffice suite to 6.4.6 maintenance releaseDima Panov2020-08-141-5/+5 * Update to 20200724Sunpoet Po-Chuan Hsieh2020-07-302-4/+4 * Update to 20200718Sunpoet Po-Chuan Hsieh2020-07-242-4/+4 * Update to 20200704Sunpoet Po-Chuan Hsieh2020-07-092-4/+4 * Update LibreOffice suite to 6.4.5 releaseDima Panov2020-07-071-5/+5 * Update to 20200619Sunpoet Po-Chuan Hsieh2020-06-232-4/+4 * Update to 20200611Sunpoet Po-Chuan Hsieh2020-06-182-4/+4 * FreeBSD Office team is proud to announce LibreOffice 6.4.4, latest stable rel...Dima Panov2020-06-131-5/+5 * Update to 20200530Sunpoet Po-Chuan Hsieh2020-06-042-4/+4 * polish/kadu: prepare for Qt5-5.15Tobias C. Berner2020-05-211-0/+10 * Update LibreOffice to 6.3.6 stable releaseDima Panov2020-05-161-5/+5 * net-im/qxmpp-qt5: update to 1.3.0Tobias C. Berner2020-04-081-1/+1 * net-im/qxmpp-qt5: update to 1.2.1Tobias C. Berner2020-04-051-1/+1 * Update to 20200327Sunpoet Po-Chuan Hsieh2020-04-022-4/+4 * Update to 20200320Sunpoet Po-Chuan Hsieh2020-03-282-4/+4 * devel/qca: update to 2.3Tobias C. Berner2020-03-211-3/+2 * Update to 20200220Sunpoet Po-Chuan Hsieh2020-02-252-4/+4 * Update to 20200214Sunpoet Po-Chuan Hsieh2020-02-182-4/+4 * Update to 20200205Sunpoet Po-Chuan Hsieh2020-02-122-4/+4 * net-im/qxmpp-qt5: update to 1.2.0Tobias C. Berner2020-02-081-1/+1 * Update to 20200202Sunpoet Po-Chuan Hsieh2020-02-042-4/+4 * Update to 20200125Sunpoet Po-Chuan Hsieh2020-01-282-4/+4 * Update to 20200108Sunpoet Po-Chuan Hsieh2020-01-142-4/+4 * Update to 20200103Sunpoet Po-Chuan Hsieh2020-01-062-4/+4 * Update to 20191229Sunpoet Po-Chuan Hsieh2019-12-312-4/+4 * Update to 20191222Sunpoet Po-Chuan Hsieh2019-12-282-4/+4 * - Update to 6.3.4Li-Wen Hsu2019-12-131-5/+5 * Update to 20191203Sunpoet Po-Chuan Hsieh2019-12-112-4/+4 * Update to 20191117Sunpoet Po-Chuan Hsieh2019-11-192-4/+4 * Update to 20191109Sunpoet Po-Chuan Hsieh2019-11-142-4/+4 * Add USES=xorg USES=gl, ports categories pNiclas Zeising2019-11-074-5/+6 * Update to 20191103Sunpoet Po-Chuan Hsieh2019-11-052-4/+4 * - Update to 6.3.3Li-Wen Hsu2019-11-011-5/+5 * net-im/qxmpp-qt5: update to 1.1.0Tobias C. Berner2019-10-301-1/+1 * Update to 20191027Sunpoet Po-Chuan Hsieh2019-10-282-4/+4 * Update to 20191019Sunpoet Po-Chuan Hsieh2019-10-242-4/+4 * net-im/qxmpp-qt5: update to 1.0.1Tobias C. Berner2019-10-171-1/+1 * Remove expired ports:Rene Ladan2019-10-169-291/+0 * Update to 20190929Sunpoet Po-Chuan Hsieh2019-09-302-4/+4 * Update to 20190921Sunpoet Po-Chuan Hsieh2019-09-282-4/+4 * - Update to 6.3.2Li-Wen Hsu2019-09-281-5/+5 * Deprecate a few portsAntoine Brodin2019-09-162-0/+4 * Update to 20190907Sunpoet Po-Chuan Hsieh2019-09-102-4/+4 * - Update to 6.3.1Li-Wen Hsu2019-09-061-5/+5 * Update to 20190831Sunpoet Po-Chuan Hsieh2019-09-032-4/+4 * Update to 20190823Sunpoet Po-Chuan Hsieh2019-08-262-4/+4 * - Update to 6.3.0Li-Wen Hsu2019-08-201-5/+5 * Update to 20190812Sunpoet Po-Chuan Hsieh2019-08-202-4/+4 * Update to 20190808Sunpoet Po-Chuan Hsieh2019-08-132-4/+4 * Update to 20190801Sunpoet Po-Chuan Hsieh2019-08-052-4/+4 * Mark BROKEN: unfetchableAntoine Brodin2019-08-052-0/+4 * Update to 20190725Sunpoet Po-Chuan Hsieh2019-07-302-4/+4 * Bump PORTREVISION for ports depending on the canonical version of GCCGerald Pfeifer2019-07-272-2/+2 * Update to 20190721Sunpoet Po-Chuan Hsieh2019-07-242-4/+4 * Update to 20190709Sunpoet Po-Chuan Hsieh2019-07-162-4/+4 * net-im/qxmpp-qt5: update to 1.0.0Tobias C. Berner2019-07-111-1/+1 * Update to 20190706Sunpoet Po-Chuan Hsieh2019-07-092-4/+4 * - Update to 6.2.5Li-Wen Hsu2019-07-081-5/+5 * Update to 20190626Sunpoet Po-Chuan Hsieh2019-07-012-4/+4 * Update to 20190623Sunpoet Po-Chuan Hsieh2019-06-252-4/+4 * Update to 20190615Sunpoet Po-Chuan Hsieh2019-06-202-4/+4 * Update to 20190608Sunpoet Po-Chuan Hsieh2019-06-112-4/+4 * Update to 20190602Sunpoet Po-Chuan Hsieh2019-06-042-6/+6 * Update to 20190527Sunpoet Po-Chuan Hsieh2019-05-282-4/+4 * - Update to 6.2.4Li-Wen Hsu2019-05-241-5/+5 * - Update to 6.2.3Li-Wen Hsu2019-04-211-5/+5 * Update to 20190419Sunpoet Po-Chuan Hsieh2019-04-202-4/+4 * Update to 20190418Sunpoet Po-Chuan Hsieh2019-04-192-4/+4 * Update devel/readline to 8.0Sunpoet Po-Chuan Hsieh2019-04-092-2/+2 * Mark BROKEN on FreeBSD 12 and 13Antoine Brodin2019-04-071-1/+8 * Update CMake to latest release, 3.14.1Adriaan de Groot2019-04-054-0/+44 * Mark BROKEN on FreeBSD 12 and 13Antoine Brodin2019-04-041-1/+8 * dns/libidn: Update to 1.35Yuri Victorovich2019-04-021-1/+1 * Update to 6.2.2Li-Wen Hsu2019-03-231-5/+5 * Qt4 deprecation: Remove Qt4 and its consumes.Tobias C. Berner2019-03-177-111/+0 * devel/qca: remove flavors (Qt4 deprecation)Tobias C. Berner2019-03-171-2/+2 * Update to 20190226Sunpoet Po-Chuan Hsieh2019-03-052-4/+4 * First step at deorbitting esound:Baptiste Daroussin2019-02-252-7/+4 * Update to 20190224Baptiste Daroussin2019-02-252-4/+4 * Update to 20190215Sunpoet Po-Chuan Hsieh2019-02-202-4/+4 * Update to 20190202Sunpoet Po-Chuan Hsieh2019-02-052-4/+4 * Update to 20190125Sunpoet Po-Chuan Hsieh2019-01-292-4/+4 * Update to 20190119Sunpoet Po-Chuan Hsieh2019-01-222-4/+4 * Fix Qt5 symbol version scripts to put the catch-all clause first. WhenTijl Coosemans2019-01-162-2/+2 * kadu-core/plugin/dependency-graph/plugin-dependency-graph-builder.hMark Linimon2019-01-161-0/+10 * Update to 20190110Sunpoet Po-Chuan Hsieh2019-01-142-4/+4 * Update to 20181230Sunpoet Po-Chuan Hsieh2019-01-022-4/+4 * Remove KDE4, part 5Rene Ladan2019-01-015-1739/+0 * Change cmake default behaviour to outsource.Tobias C. Berner2018-12-261-1/+1 * Remove expired ports:Rene Ladan2018-12-212-10/+0 * Bump PORTREVISION for ports depending on the canonical version of GCCGerald Pfeifer2018-12-122-2/+2 * Update to 20181201Sunpoet Po-Chuan Hsieh2018-12-042-4/+4 * Mark QT4 ports/functionality for removal on 2019-03-15Rene Ladan2018-12-021-0/+3 * Update to 20181123Sunpoet Po-Chuan Hsieh2018-11-272-4/+4 * Mark kde4-l10n ports deprecated.Tobias C. Berner2018-11-241-0/+3 * Update to 6.0.7.Jung-uk Kim2018-11-091-5/+5 * Update to 20181029Sunpoet Po-Chuan Hsieh2018-11-062-4/+4 * Merge lang/qt5-qml and x11-toolkits/qt5-quick into x11-toolkits/qt5-declarativeTobias C. Berner2018-11-051-3/+3 * Update to 20181025Sunpoet Po-Chuan Hsieh2018-10-302-4/+4 * Update to 20181021Sunpoet Po-Chuan Hsieh2018-10-242-5/+6 * Update to 20180925Sunpoet Po-Chuan Hsieh2018-10-231-1/+1 * Update to 20180925Sunpoet Po-Chuan Hsieh2018-10-032-4/+4 * Update to 20180919Sunpoet Po-Chuan Hsieh2018-09-242-4/+4 * Update to 20180915Sunpoet Po-Chuan Hsieh2018-09-182-4/+4 * Update to 20180907Sunpoet Po-Chuan Hsieh2018-09-112-4/+4 * Add DOCS options to ports that should have one.Mathieu Arnold2018-09-101-0/+2 * Fix build with Qt 5.11Jason E. Hale2018-08-311-0/+15 * Update to 20180810Sunpoet Po-Chuan Hsieh2018-08-142-4/+4 * Update to 20180730Sunpoet Po-Chuan Hsieh2018-08-072-4/+4 * Update to 20180719Sunpoet Po-Chuan Hsieh2018-07-312-4/+4 * Bump PORTREVISION for ports depending on the canonical version of GCCGerald Pfeifer2018-07-302-2/+2 * Replace bsd.qt.mk by Uses/qt.mk and Uses/qt-dist.mkTobias C. Berner2018-06-293-6/+6 * - Update to 6.0.5Li-Wen Hsu2018-06-271-5/+5 * Update to 20180621Sunpoet Po-Chuan Hsieh2018-06-262-4/+4 * Update to 20180612Sunpoet Po-Chuan Hsieh2018-06-212-4/+4 * Update to 20180603Sunpoet Po-Chuan Hsieh2018-06-052-4/+4 * Update to 20180526Sunpoet Po-Chuan Hsieh2018-05-282-4/+4 * Update to 20180516Sunpoet Po-Chuan Hsieh2018-05-212-4/+4 * Update to 20180509Sunpoet Po-Chuan Hsieh2018-05-142-4/+4 * - Update to 6.0.4Li-Wen Hsu2018-05-101-5/+5 * Update to 20180506Sunpoet Po-Chuan Hsieh2018-05-082-4/+4 * Update to 20180428Sunpoet Po-Chuan Hsieh2018-05-012-4/+4 * Update to 20180422Sunpoet Po-Chuan Hsieh2018-04-242-4/+4 * Update to 20180415Sunpoet Po-Chuan Hsieh2018-04-172-4/+4 * devel/qca, devel/qca-qt5 -- create flavorsTobias C. Berner2018-04-141-2/+2 * Update to 20180407Sunpoet Po-Chuan Hsieh2018-04-102-4/+4 * - Update to 6.0.3Li-Wen Hsu2018-04-081-5/+5 * Update to 20180331Sunpoet Po-Chuan Hsieh2018-04-022-4/+4 * Update to 20180322Sunpoet Po-Chuan Hsieh2018-03-272-4/+4 * Update to 20180317Sunpoet Po-Chuan Hsieh2018-03-192-4/+4 * - Update LibreOffice to 6.0.2 [1]Li-Wen Hsu2018-03-172-8/+5 * Update to 20180310Sunpoet Po-Chuan Hsieh2018-03-132-4/+4 * Update to 20180304Sunpoet Po-Chuan Hsieh2018-03-131-1/+1 * Update net/libmaia to 0.9.0 (follow up to r463988)Tobias C. Berner2018-03-101-1/+1 * Update net/libmaia to 0.9.0Tobias C. Berner2018-03-101-1/+1 * Update to 20180304Sunpoet Po-Chuan Hsieh2018-03-062-4/+4 * Update to 20180223Sunpoet Po-Chuan Hsieh2018-02-272-4/+4 * Return pawel@'s ports to the pool after he resigned.Rene Ladan2018-02-255-5/+5 * Update to 20180216Sunpoet Po-Chuan Hsieh2018-02-192-4/+4 * Update to 20180207Sunpoet Po-Chuan Hsieh2018-02-132-4/+4 * Rename KDE4 meta portsTobias C. Berner2018-02-101-1/+1 * Update to 20180202Sunpoet Po-Chuan Hsieh2018-02-062-4/+4 * Update to 20180127Sunpoet Po-Chuan Hsieh2018-01-292-4/+4 * Update to 20180113Sunpoet Po-Chuan Hsieh2018-01-162-4/+4 * Update to 20180107Sunpoet Po-Chuan Hsieh2018-01-092-4/+4 * Update to 20171224Sunpoet Po-Chuan Hsieh2017-12-252-4/+4 * Update to 20171217Sunpoet Po-Chuan Hsieh2017-12-192-4/+4 * Update to 20171215Sunpoet Po-Chuan Hsieh2017-12-162-4/+4