1
/***************************************************************************
3
* Copyright (c) 2000,2001,2002 BalaBit IT Ltd, Budapest, Hungary
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
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
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19
* $Id: streamline.h,v 1.8.2.3 2003/04/11 19:15:54 sasa Exp $
21
***************************************************************************/
23
#ifndef ZORP_READLINE_H_INCLUDED
24
#define ZORP_READLINE_H_INCLUDED
26
#include <zorp/zorplib.h>
27
#include <zorp/stream.h>
33
#define ZRL_EOL_NL 0x00000001 /* end-of-line is indicated by nl */
34
#define ZRL_EOL_CRLF 0x00000002 /* end-of-line is indicated by crlf pair */
35
#define ZRL_EOL_FATAL 0x00000004 /* erroneous eol mark is fatal */
36
#define ZRL_NUL_NONFATAL 0x00000008 /* embedded NUL character is not fatal */
38
#define ZRL_TRUNCATE 0x00000010 /* truncate if line longer than buffer */
39
#define ZRL_SPLIT 0x00000020 /* split line if longer than buffer */
40
#define ZRL_SINGLE_READ 0x00000040 /* don't issue several read()s when fetching a line */
41
#define ZRL_PARTIAL_READ 0x00000080 /* call read callback even if no end-of-line available */
43
#define ZST_LINE_GET_TRUNCATE (0x01) | ZST_LINE
44
#define ZST_LINE_GET_SPLIT (0x02) | ZST_LINE
45
#define ZST_LINE_GET_SINGLE_READ (0x03) | ZST_LINE
46
#define ZST_LINE_GET_PARTIAL_READ (0x04) | ZST_LINE
48
#define ZST_LINE_SET_TRUNCATE (0x11) | ZST_LINE
49
#define ZST_LINE_SET_SPLIT (0x12) | ZST_LINE
50
#define ZST_LINE_SET_SINGLE_READ (0x13) | ZST_LINE
51
#define ZST_LINE_SET_PARTIAL_READ (0x14) | ZST_LINE
57
GIOStatus z_stream_line_get(ZStream *s, char **line, guint *length, GError **error);
58
GIOStatus z_stream_line_get_copy(ZStream *s, char *line, guint *length, GError **error);
59
void z_stream_line_unget_line(ZStream *stream);
61
ZStream *z_stream_line_new(ZStream *from, guint bufsize, guint flags);
64
z_stream_line_set_partial_read(ZStream *stream, gboolean enable)
66
z_stream_ctrl(stream, ZST_LINE_SET_PARTIAL_READ, &enable, sizeof(enable));
70
z_stream_line_permit_long_line(ZStream *stream, gboolean enable)
72
z_stream_ctrl(stream, ZST_LINE_SET_SPLIT, &enable, sizeof(enable));