iostream-pump.h revision 39435f00a35a276d329283179b3e7e0351482939
/* Copyright (c) 2002-2017 Dovecot authors, see the included COPYING file
*/
#ifndef IOSTREAM_PUMP_H
#define IOSTREAM_PUMP_H 1
/**
iostream-pump
=============
This construct pumps data from istream to ostream asynchronously.
The pump requires you to provide completion callback. The
completion callback is called with success parameter to
indicate whether it ended with error.
The istream and ostream are reffed on creation and unreffed
on unref.
**/
struct istream;
struct ostream;
struct iostream_pump;
enum iostream_pump_status {
/* pump succeeded - EOF received from istream and all output was
written successfully to ostream. */
/* pump failed - istream returned an error */
/* pump failed - ostream returned an error */
};
/* The callback is called once when the pump succeeds or fails due to
iostreams. (It's not called if pump is destroyed.) */
void *context);
struct iostream_pump *
/* Returns TRUE if the pump is currently only writing to the ostream. The input
listener has been removed either because the ostream buffer is full or
because the istream already returned EOF. This function can also be called
from the completion callback in error conditions. */
#endif