istream-private.h revision 82ea464c113f43aaa2b2e23de334cf3081c332be
#ifndef ISTREAM_PRIVATE_H
#define ISTREAM_PRIVATE_H
#include "istream.h"
#include "iostream-private.h"
#define I_STREAM_MIN_SIZE IO_BLOCK_SIZE
struct io;
struct istream_private {
/* inheritance: */
struct iostream_private iostream;
/* methods: */
struct istream_snapshot *
struct istream_snapshot *prev_snapshot);
/* data: */
int fd;
/* added by io_add_istream() -> i_stream_set_io() */
const unsigned char *buffer;
unsigned char *w_buffer; /* may be NULL */
/* parent stream's expected offset is kept here. i_stream_read()
always seeks parent stream to here before calling read(). */
struct istream_snapshot *prev_snapshot;
/* increased every time the stream is changed (e.g. seek, read).
this way streams can check if their parent streams have been
accessed behind them. */
unsigned int access_counter;
bool line_crlf:1;
bool return_nolf_line:1;
bool nonpersistent_buffers:1;
};
struct istream_snapshot {
struct istream_snapshot *prev_snapshot;
struct memarea *old_memarea;
};
struct istream * ATTR_NOWARN_UNUSED_RESULT
ATTR_NULL(2);
/* Initialize parent lazily after i_stream_create() has already been called. */
/* Free memory allocated by i_stream_*alloc() */
/* Default snapshot handling: use memarea if it exists, otherwise snapshot
parent stream. */
struct istream_snapshot *
struct istream_snapshot *prev_snapshot);
#endif