ossp-pkg/sio/sio.h
1.1
/*
** OSSP sio -- Stream I/O
** Copyright (c) 2002 The OSSP Project <http://www.ossp.org/>
** Copyright (c) 2002 Cable & Wireless Deutschland <http://www.cw.com/de/>
** Copyright (c) 2002 Ralf S. Engelschall <rse@engelschall.com>
** Copyright (c) 2002 Michael van Elst <mlelstv@dev.de.cw.net>
**
** This file is part of OSSP sio, a library implementing layered I/O
**
** Permission to use, copy, modify, and distribute this software for
** any purpose with or without fee is hereby granted, provided that
** the above copyright notice and this permission notice appear in all
** copies.
**
** THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
** WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
** MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
** IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
** USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
** SUCH DAMAGE.
**
** sio.h: stream I/O public API definition
*/
typedef enum {
SIO_OK,
SIO_ERR_ARG,
SIO_ERR_MEM,
SIO_ERR_EOF,
SIO_ERR_SYS,
SIO_ERR_INT,
SIO_UPSTREAM,
SIO_DOWNSTREAM
} sio_rc_t;
typedef enum {
SIO_MODE_INVALID,
SIO_MODE_READ,
SIO_MODE_WRITE,
SIO_MODE_READWRITE
} sio_mode_t;
struct sio_st;
typedef struct sio_st sio_t;
struct sio_stage_st;
typedef struct sio_stage_st sio_stage_t;
struct sio_module_st;
typedef struct sio_module_st sio_module_t;
sio_rc_t sio_create(sio_t **siop);
sio_rc_t sio_destroy(sio_t *sio);
sio_rc_t sio_create_stage(sio_t *sio, sio_module_t *sioh, sio_stage_t **siosp);
sio_rc_t sio_destroy_stage(sio_t *sio, sio_stage_t *sios);
sio_rc_t sio_configure_stage(sio_t *sio, sio_stage_t *sios, void *o, void *v);
sio_rc_t sio_attach(sio_t *sio, sio_stage_t *sios, sio_mode_t rw);
sio_rc_t sio_detach(sio_t *sio, sio_stage_t *sios);
sio_rc_t sio_input(sio_t *sio, al_t *al, size_t limit);
sio_rc_t sio_output(sio_t *sio, al_t *al);
sio_rc_t sio_read(sio_t *sio, char *dst, size_t n, size_t *actualp);
sio_rc_t sio_write(sio_t *sio, char *src, size_t n, size_t *actualp);
const char *sio_error(sio_rc_t rc);