1
#ifndef ISTREAM_PRIVATE_H
2
#define ISTREAM_PRIVATE_H
5
#include "iostream-private.h"
7
#define I_STREAM_MIN_SIZE IO_BLOCK_SIZE
9
struct istream_private {
11
struct iostream_private iostream;
14
ssize_t (*read)(struct istream_private *stream);
15
void (*seek)(struct istream_private *stream,
16
uoff_t v_offset, bool mark);
17
void (*sync)(struct istream_private *stream);
18
const struct stat *(*stat)(struct istream_private *stream, bool exact);
19
int (*get_size)(struct istream_private *stream, bool exact, uoff_t *size_r);
22
struct istream istream;
25
uoff_t abs_start_offset;
28
const unsigned char *buffer;
29
unsigned char *w_buffer; /* may be NULL */
31
size_t buffer_size, max_buffer_size, init_buffer_size;
34
struct istream *parent; /* for filter streams */
35
uoff_t parent_start_offset;
37
/* parent stream's expected offset is kept here. i_stream_read()
38
always seeks parent stream to here before calling read(). */
39
uoff_t parent_expected_offset;
41
/* increased every time the stream is changed (e.g. seek, read).
42
this way streams can check if their parent streams have been
43
accessed behind them. */
44
unsigned int access_counter;
46
string_t *line_str; /* for i_stream_next_line() if w_buffer == NULL */
47
unsigned int return_nolf_line:1;
51
i_stream_create(struct istream_private *stream, struct istream *parent, int fd);
53
void i_stream_compress(struct istream_private *stream);
54
void i_stream_grow_buffer(struct istream_private *stream, size_t bytes);
55
bool i_stream_get_buffer_space(struct istream_private *stream,
56
size_t wanted_size, size_t *size_r);
57
ssize_t i_stream_read_copy_from_parent(struct istream *istream);
58
void i_stream_default_seek(struct istream_private *stream,
59
uoff_t v_offset, bool mark);