view src/lib/iostream-internal.h @ 1870:c972ea085643 HEAD

istream rewrite. instead of directly setting any limits to stream, you now have to use i_stream_create_limit() to existing stream. this should make the istreams much easier to create and understand how they work.
author Timo Sirainen <tss@iki.fi>
date Sun, 09 Nov 2003 20:26:25 +0200
parents 411006be3c66
children d141e1bfdd63
line wrap: on
line source

#ifndef __IOSTREAM_INTERNAL_H
#define __IOSTREAM_INTERNAL_H

/* This file is private to IStream and OStream implementation */

struct _iostream {
	pool_t pool;
	int refcount;

	void (*close)(struct _iostream *stream);
	void (*destroy)(struct _iostream *stream);
	void (*set_max_buffer_size)(struct _iostream *stream, size_t max_size);
	void (*set_blocking)(struct _iostream *stream, int timeout_msecs,
			     void (*timeout_cb)(void *), void *context);
};

void _io_stream_init(pool_t pool, struct _iostream *stream);
void _io_stream_ref(struct _iostream *stream);
void _io_stream_unref(struct _iostream *stream);
void _io_stream_close(struct _iostream *stream);
void _io_stream_set_max_buffer_size(struct _iostream *stream, size_t max_size);
void _io_stream_set_blocking(struct _iostream *stream, int timeout_msecs,
			     void (*timeout_cb)(void *), void *context);

#define GET_TIMEOUT_TIME(fstream) \
        ((fstream)->timeout_msecs <= 0 ? 0 : \
	 time(NULL) + ((fstream)->timeout_msecs / 1000))
#define STREAM_IS_BLOCKING(fstream) \
	((fstream)->timeout_msecs != 0)

#endif