aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-stream-buffer.h
blob: 5c9037595abbbb9a788ee97f14a0a95d73778ae6 (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 <camel/camel-seekable-stream.h>
#include <stdio.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 */
5dbn2016-03-133-14/+20 * Combine print/cups-base, print/cups-client and print/cups-image intotijl2016-03-112-3/+4 * Chase latest fixes..brooks2016-03-112-4/+4 * emulators/qemu-devel: fix with DOCS=off [1]bofh2016-03-092-11/+7 * Update emulators/wine-mono from 0.0.8 to 4.5.6. [1]gerald2016-03-093-4/+4 * Update to Wine 1.9.5. This includes the following changes:gerald2016-03-092-6/+6 * Update wine-mono-devel, the Mono-based .NET implementation componentgerald2016-03-092-4/+4 * Always set the DEFAULT github DISTFILE with .tar.gz for EXTRACT_SUFX.mat2016-03-081-2/+2 * Update to 1.2.6.2mat2016-03-086-168/+40 * Update to 1.9.0mat2016-03-085-23/+90 * emulators/ppsspp: minor manpage updatejbeich2016-03-062-4/+4 * - Add missing files to plistamdmi32016-03-052-1/+5 * emulators/i386-wine-staging: align options with wine-staging.dbn2016-03-051-1/+1 * Update to a 2016-02-29 snapshot.brooks2016-03-042-4/+4 * Fix build on head.jkim2016-03-031-5/+29 * - Update to 0.6.4madpilot2016-03-013-25/+27 * emulators/i386-wine-devel: update to 1.9.4.dbn2016-02-293-13/+23 * Update to Wine 1.9.4. This includes the following changes:gerald2016-02-283-5/+15 * - Update to 0.61danilo2016-02-272-3/+3 * xen: update port and apply security fixesroyger2016-02-267-3/+440 * Update qemu-cheri to a fresh snapshot and add a port to build the 128-bitbrooks2016-02-235-7/+28 * emulators/ppsspp: update to 1.2.1jbeich2016-02-227-83/+48 * Bump PORTREVISION:sbruno2016-02-191-2/+1 * Attempt to unbreak stage (pointed out by amdmi3/junovitch)sbruno2016-02-193-0/+5 * This is the adaptation of PlayOnLinux to FreeBSD. The purpose of thisse2016-02-1811-0/+664 * Update glibc and glibc-common to latest versiondes2016-02-183-16/+16 * Update my email for ports I maintainolivier2016-02-171-2/+2 * On FreeBSD 9.x, even when CHOSEN_COMPILER_TYPE from Mk/Uses/compiler.mkgerald2016-02-161-1/+4 * A couple of portlint nits for tabs/spaces and a proper WWW note in asbruno2016-02-164-28/+12 * emulators/fuse-roms: tiny cleanuprene2016-02-151-1/+1 * Remove s390-zip1.rpm from pkg-plist.sbruno2016-02-141-1/+0 * Update qemu-sbruno and qemu-user-static.sbruno2016-02-143-18/+6 * emulators/i386-wine-devel: update to 1.9.3dbn2016-02-133-13/+16 * Transfer maintainership of wine-gecko and wine-gecko-devel from dbn@gerald2016-02-132-2/+2 * emulators/i386-wine-devel: fix depends reference to wine-gecko-develdbn2016-02-131-1/+1 * emulators/i386-wine: fix run depends reference to wine-geckodbn2016-02-131-1/+1 * Fix the build with clang 3.8.0 or later which support "native" Windowsgerald2016-02-111-1/+1 * Update to Wine 1.9.3. This includes the following changes:gerald2016-02-093-6/+9 * Update from version 2.40 to 2.44. This is based on Firefox 44 now.gerald2016-02-092-4/+4 * Update to the latest commit.brooks2016-02-093-5/+5 * Fix the build with clang 3.8.0 or later which support "native" Windowsgerald2016-02-081-1/+1 * Move Mk/bsd.gnome.mk and Mk/bsd.mate.mk to Mk/Uses/.kwm2016-02-081-2/+2 * emulators/cpmtools2: document ncurses requirement (USES+=ncurses)marino2016-02-071-2/+2 * emulators/i386-wine: update to 1.8.1dbn2016-02-072-7/+7 * Depend on emulators/wine-gecko instead of emulators/wine-gecko-develgerald2016-02-063-1/+4 * Update wine-gecko, the Gecko Layout Engine component for emulators/winegerald2016-02-062-3/+3 * Update to 4.3.36.jkim2016-02-058-33/+43 * Update to Wine 1.8.1 which bringsgerald2016-02-042-3/+3 * - Add missing dependsamdmi32016-02-021-2/+7 * - Add LICENSEamdmi32016-02-014-17/+29 * - Clarify LICENSEamdmi32016-02-012-29/+56 * emulators/i386-wine-staging: update Makefile.dbn2016-02-011-3/+3 * emulators/i386-wine-devel: update to 1.9.2dbn2016-02-015-58/+81 * - Add LICENSE_FILEamdmi32016-02-011-4/+5 * - Switch to options helpersamdmi32016-02-014-19/+21 * - Switch to options helpersamdmi32016-02-012-10/+36 * - Add missing USE_XORGamdmi32016-02-011-1/+4 * - Add missing USE_XORGamdmi32016-02-011-1/+4 * - Add LICENSE_FILEamdmi32016-02-012-1/+4 * - Add LICENSE_FILEamdmi32016-02-011-1/+4 * - Add LICENSE_FILEamdmi32016-02-011-9/+5 * - Switch to options helpersamdmi32016-02-011-1/+3 * - Update to 0.60danilo2016-01-312-3/+3 * - Switch to options helpersamdmi32016-01-311-0/+2 * Welcome Centos 6.7miwi2016-01-316-444/+445 * Add a port of sson's fork of QEMU with CHERI CPU support.brooks2016-01-277-0/+168 * Remove deprecated @dirrmpawel2016-01-271-4/+0 * Remove deprecated @dirrmpawel2016-01-271-4/+0 * Typo in CONFLICTS noted by brooks.sbruno2016-01-271-1/+1 * Remove all remaining references to BSD USERsbruno2016-01-261-6/+2 * Update to Wine 1.9.2. This includes the following changes:gerald2016-01-253-49/+69 * During the exp-run in bug 206074, it was found that emulators/simh givesdim2016-01-252-1/+16 * Remove BROKEN for FreeBSD 8, which is no longer supported.rakuco2016-01-241-2/+0 * Add "Enable R0 logging" option and set BUILD_TYPE=debug while DEBUG option setlwhsu2016-01-221-2/+11 * Add nestopia 1.47, portable NES/Famicom emulator.vanilla2016-01-197-0/+86 * emulators/i386-wine: update to 1.8.dbn2016-01-186-64/+493 * emulators/i386-wine-devel: update to 1.9.1.dbn2016-01-183-14/+22 * - Update to 1.4miwi2016-01-175-103/+42 * - Update to 1.4miwi2016-01-174-56/+65 * Add audio/linux-c6-pulseaudio-libs-glib2.kevlo2016-01-161-1/+2 * Fixup qemu-devel as the bsd-user code from my branch does not exist insbruno2016-01-142-148/+95 * Bump qemu-sbruno to capture merge request that sync's bsd-user mmap()sbruno2016-01-142-6/+6 * emulators/advancemame is not jobs safemarino2016-01-141-0/+2 * Convert LICENSE= "GPLxx # or later" to "GPLxx+"amdmi32016-01-1310-10/+10 * - Add workaround for "Network: write Failed: Cannot allocate memory" errorsdecke2016-01-121-0/+3 * emulators/py-gns3-converter: 1.2.3 -> 1.2.4pi2016-01-122-3/+3 * Update to Wine 1.9.1. This includes the following changes:gerald2016-01-113-6/+9 * Previous version did unbreak fmake parsing of the Makefile, but did notmat2016-01-071-4/+2 * Unbreak on 9.mat2016-01-071-1/+1 * xen: fix XSAsroyger2016-01-055-1/+183 * Update to Wine 1.9.0 which is in direct succession of the now closedgerald2016-01-053-5/+10 * Update from the stable 1.6 releases series of Wine to Wine 1.8 and thegerald2016-01-054-147/+641 * Bump to 2.5.50.g20160103, catchup with latest bug fixes.sbruno2016-01-052-7/+6 * Fix MASTER_SITES and unmark BROKEN.rakuco2016-01-031-3/+1 * - Update to 0.59danilo2016-01-024-6/+18 * emulators/qemu-devel: Update version 2.4.0=>2.5.0bofh2016-01-0216-292/+256 * Unmark BROKEN, the port can be fetched fine.rakuco2015-12-301-2/+0 * Unmark BROKEN, the port can be fetched fine.rakuco2015-12-301-1/+0 * Cleanup GH_* and variables order.mat2015-12-291-1/+0 * - Convert to USES=metaportamdmi32015-12-281-32/+6 * - Convert to USES=metaportamdmi32015-12-282-12/+2 * - Unbreakamdmi32015-12-264-5/+50 * Add arm activator to stop function.sbruno2015-12-262-0/+2 * Update qemu-sbruno tracking my github branch.sbruno2015-12-253-12/+18 * Fix build on head after vm_pageout_grow_cache() removal.jkim2015-12-221-10/+13 * Fix build as a user.mat2015-12-191-3/+2 * - Remove BROKEN, port is fetchableak2015-12-171-2/+0 * Mark this as being maintained as myself.sbruno2015-12-171-1/+1 * Take these ports as they are based on my branches in github.sbruno2015-12-172-2/+2 * emulators/qemu: Update version 0.11.1=>2.4.1bofh2015-12-1640-4402/+629 * audio/soundtouch: update to 1.9.2jbeich2015-12-162-0/+2 * Reset maintainereadler2015-12-146-6/+6 * emulators/i386-wine-devel: update to 1.8.r3dbn2015-12-134-23/+14 * Mark as broken: unfetchablebapt2015-12-133-0/+6 * emulators/i386-wine-devel: update to 1.8.r2.dbn2015-12-093-10/+12 * Update to Wine 1.8 RC3. Just bugfixes on our way towards a release.gerald2015-12-085-5/+8 * emulators/fuse-roms: add a discussion about distributing ROMs in DOCSDIRrene2015-12-081-0/+10 * Bump qemu-sbruno to capture commits in upstream project.sbruno2015-12-072-6/+6 * Fix do-install after r393228.rakuco2015-12-051-1/+1 * - Update to 0.2.8.2amdmi32015-12-043-22/+5 * Update giflib to 5.1.1antoine2015-12-041-1/+1 * - Update to 3.12ak2015-12-022-4/+3 * emulators/fuse-roms: update ROMs to those of Fedora 22, no content changes.rene2015-11-302-8/+9 * Update to Wine 1.8 RC2. Just bugfixes (though one new header).gerald2015-11-303-5/+6 * emulators/i386-wine-devel: update to 1.8.r1dbn2015-11-303-9/+11 * Take maintainership of emulators/fuse-romsrene2015-11-291-1/+1 * - Remove BROKEN, fetch was fixedamdmi32015-11-291-2/+0 * Deprecate ports broken for more than 6 monthsantoine2015-11-291-0/+2 * Update to Wine 1.8 RC1 in preparation of the 1.8 release. This bringsgerald2015-11-283-5/+7 * - Update to 0.58danilo2015-11-263-4/+3 * emulators/i386-wine-devel: update to 1.7.55dbn2015-11-234-260/+126 * - Unbreak, distfile has been rerolledak2015-11-223-6/+4 * - use post-install-DOCS-ondinoex2015-11-222-16/+4 * - Add LICENSEamdmi32015-11-211-14/+12 * - Add LICENSE_FILEamdmi32015-11-201-0/+3 * [NEW] emulators/vpsc: Virtual PC Simulatorbofh2015-11-194-0/+46 * Update to Wine 1.7.55. This includes the following changes:gerald2015-11-163-5/+12 * multimedia/libvpx: update 1.5.0jbeich2015-11-151-0/+1 * xen: update to 4.5.2royger2015-11-1410-382/+134 * emulators/visualboyadvance-m: Expand patch to support malloc.h-less DFmarino2015-11-131-1/+1 * Update to 4.3.34.jkim2015-11-136-11/+11 * Fix previous patch in the case mmap is enabled during configureantoine2015-11-131-1/+1 * Allow building with giflib 5.1antoine2015-11-131-0/+50 * emulators/fuse: modernize portrene2015-11-104-13/+11 * drop maintainership: ENOTIMEbapt2015-11-092-2/+2 * Mark a few ports BROKEN: unfetchableantoine2015-11-094-0/+8 * Also configure --without-gettext. This should not change the resultgerald2015-11-091-1/+1 * Add the man page for qemu-ga to the plist.sbruno2015-11-091-0/+1 * emulators/libspectrum: update WWW to new site, redirected from the old onerene2015-11-081-1/+1 * Package wine.1 man pages only in the 32-bit case (WINE32) since theygerald2015-11-071-4/+4 * Fix ports that confused the meaning of WRKDIR and WRKSRC.mat2015-11-055-14/+14 * emulators/(mame|mess): Avoid name pollution with <stdio.h>marino2015-11-022-0/+115 * Update to Wine 1.7.54. This includes the following changes:gerald2015-11-023-8/+11 * xen: apply XSAsroyger2015-10-317-1/+337 * - Update to version 0.9.11danfe2015-10-303-22/+23 * - Update to 0.57danilo2015-10-295-111/+69 * Mark BROKEN: unfetchableantoine2015-10-291-0/+2 * Clean-up patchesmartymac2015-10-272-14/+8 * Update mame/mess to 0.166madpilot2015-10-247-24/+86 * Mark as broken: does not fetchbapt2015-10-241-0/+2 * Mark as broken: does not fetchbapt2015-10-241-0/+1 * Mark as broken: does not fetchbapt2015-10-241-0/+1 * Bump version number to reflect the version of the kernel and the toolsbapt2015-10-231-1/+1 * i386-wine-devel: update to 1.7.53dbn2015-10-223-13/+35 * Fix on recent stable/10.mat2015-10-211-0/+2 * Update to 4.3.32.jkim2015-10-218-26/+22 * Update to Wine 1.7.53. This includes the following changes:gerald2015-10-203-5/+27 * - Convert to new shebangfix orderamdmi32015-10-191-12/+3 * Improve shebangfix frameworkamdmi32015-10-191-1/+0 * Update to 5.0-rcmartymac2015-10-1825-2027/+1852 * Drop 8 support.mat2015-10-158-71/+4 * emulators/dolphin-emu: chase r399209jbeich2015-10-142-1/+138 * - Mark MAKE_JOBS_UNSAFE: race between compilation and creating directories fo...amdmi32015-10-141-0/+2 * i386-wine-devel: update to version 1.7.52dbn2015-10-143-23/+40 * emulators/ppsspp: update to 1.1.1jbeich2015-10-142-6/+6 * Xorg-server update to 1.17.2 with related driver updates and bumps.kwm2015-10-132-5/+17 * Unconditionally prevent the detection of libinotify which fails thegerald2015-10-121-0/+12 * Update qemu-sbruno to track my github repo.sbruno2015-10-123-12/+13 * Remove iconv(), iconv_open() and iconv_close() symbols from libiconv.tijl2015-10-102-2/+22 * emulators/advancemenu: Upgrade version 2.7 => 2.8marino2015-10-103-9/+7 * xen: update to 4.5.1royger2015-10-0923-826/+660 * - Add LICENSE_FILEsunpoet2015-10-091-0/+1 * Remove trailing whitespace from Makefiles, A-L.olgeni2015-10-082-2/+2 * - cleanupdinoex2015-10-081-3/+1 * emulators/linux_base-c6: fix unfetchable distfilesrobak2015-10-081-3/+2 * Update to Wine 1.7.52. This includes the following changes:gerald2015-10-073-5/+17 * emulators/ppsspp: drop FreeBSD 8.x supportjbeich2015-10-061-25/+0 * emulators/ppsspp-devel: update to 1.1.0 by removing the portjbeich2015-10-063-24/+0 * emulators/ppsspp: update to 1.1.0jbeich2015-10-0644-811/+28 * - Fix installed script referencing stagediramdmi32015-10-014-4/+58 * Convert my ports to USES=localbasejbeich2015-09-272-5/+2 * emulators/ppsspp-devel: update to 1.0.1.2768jbeich2015-09-255-26/+52 * emulators/ppsspp: generate better .desktop filejbeich2015-09-252-3/+7 * Update OpenMSX and Catapult to 0.12.0johans2015-09-224-14/+11 * Typos, whitespace and capitalization fixes (A-F).olgeni2015-09-214-7/+7 * Remove BROKEN on Tier-2 systems statements which no longer true at leastdanfe2015-09-202-4/+0 * Backport CVE-2015-2331 fix to bundled libzipjbeich2015-09-204-2/+38 * - Add LICENSE_FILEamdmi32015-09-183-19/+3 * Remove ansi version fo wxGTK 2.8 and only keep the unicode versionbapt2015-09-172-1/+2 * emulators/ppsspp-devel: update to 1.0.1.2668jbeich2015-09-16