head 1.9; access; symbols SIO_0_9_3:1.9 SIO_0_9_2:1.8 SIO_0_9_1:1.8 SIO_0_9_0:1.8; locks; strict; comment @ * @; 1.9 date 2005.10.03.09.06.11; author rse; state Exp; branches; next 1.8; 1.8 date 2003.01.06.19.04.56; author rse; state Exp; branches; next 1.7; 1.7 date 2002.11.29.13.00.18; author mlelstv; state Exp; branches; next 1.6; 1.6 date 2002.11.27.15.50.29; author mlelstv; state Exp; branches; next 1.5; 1.5 date 2002.11.24.19.36.48; author mlelstv; state Exp; branches; next 1.4; 1.4 date 2002.11.14.15.56.10; author mlelstv; state Exp; branches; next 1.3; 1.3 date 2002.11.08.08.59.32; author mlelstv; state Exp; branches; next 1.2; 1.2 date 2002.11.05.13.23.36; author mlelstv; state Exp; branches; next 1.1; 1.1 date 2002.10.23.17.05.10; author mlelstv; state Exp; branches; next ; desc @@ 1.9 log @adjust copyright messages @ text @/* ** OSSP sio - Stream I/O ** Copyright (c) 2002-2005 Cable & Wireless ** Copyright (c) 2002-2005 The OSSP Project ** Copyright (c) 2002-2005 Ralf S. Engelschall ** ** This file is part of OSSP sio, a layered stream I/O library ** which can be found at http://www.ossp.org/pkg/lib/sio/. ** ** 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_hole.c: black hole stage */ #include #include #include "al.h" #include "sio.h" typedef struct { int dummy; } private_t; /* * create stage * * allocate private instance data */ static sio_rc_t hole_init(sio_t *sio, void **up) { private_t *my; my = (private_t *)malloc(sizeof(private_t)); if (my == NULL) return SIO_ERR_MEM; *up = my; return SIO_OK; } /* * configure stage * * pass two void pointers */ static sio_rc_t hole_configure(sio_t *sio, void *u, void *obj, void *val) { return SIO_ERR_ARG; } /* * destroy stage */ static sio_rc_t hole_cleanup(sio_t *sio, void *u) { private_t *my = (private_t *)u; free(my); return SIO_OK; } static sio_rc_t hole_openr(sio_t *sio, al_t *al, void *u) { return SIO_OK; } static sio_rc_t hole_closer(sio_t *sio, al_t *al, void *u) { return SIO_OK; } static sio_rc_t hole_openw(sio_t *sio, al_t *al, void *u) { return SIO_OK; } static sio_rc_t hole_closew(sio_t *sio, al_t *al, void *u) { return SIO_OK; } static sio_rc_t hole_input(sio_t *sio, al_t *al, void *u, sio_rc_t orc) { /* drop all data into the bit bucket */ al_splice(al, 0, al_bytes(al), NULL, NULL); return SIO_SCHED_DOWN; } static sio_rc_t hole_output(sio_t *sio, al_t *al, void *u, sio_rc_t orc) { /* drop all data into the bit bucket */ al_splice(al, 0, al_bytes(al), NULL, NULL); return SIO_SCHED_DOWN; } sio_module_t sio_module_hole = { "hole", hole_init, hole_configure, hole_cleanup, hole_openr, hole_closer, hole_openw, hole_closew, hole_input, hole_output, NULL }; @ 1.8 log @- consistently use standard OSSP copyright message everywhere - strip trailing whitespaces @ text @d3 3 a5 3 ** Copyright (c) 2002-2003 Cable & Wireless Deutschland ** Copyright (c) 2002-2003 The OSSP Project ** Copyright (c) 2002-2003 Ralf S. Engelschall @ 1.7 log @input/output now gets another parameter where scheduler tells them from where they methods called by passing the return value of the previously called stage. PR: Submitted by: Reviewed by: Approved by: Obtained from: @ text @d1 30 d50 1 a50 1 @ 1.6 log @code cleanup PR: Submitted by: Reviewed by: Approved by: Obtained from: @ text @d79 1 a79 1 sio_rc_t hole_input(sio_t *sio, al_t *al, void *u) d88 1 a88 1 sio_rc_t hole_output(sio_t *sio, al_t *al, void *u) @ 1.5 log @add optional shutdown function to modules. On detach, it is called and if returning SIO_OK another round through output and input is done. modules are now pushed at pipe head instead of appended so that a module can do upstream I/O while being wound up. PR: Submitted by: Reviewed by: Approved by: Obtained from: @ text @d17 1 a17 1 sio_rc_t hole_init(sio_t *sio, void **u) d25 1 a25 1 *u = my; @ 1.4 log @merged sio_module.h into sio.h renamed scheduler codes to SIO_SCHED_* added comments to sio.c PR: Submitted by: Reviewed by: Approved by: Obtained from: @ text @d106 2 a107 1 hole_output @ 1.3 log @less cluttering name for private data pointer PR: Submitted by: Reviewed by: Approved by: Obtained from: @ text @a5 1 #include "sio_module.h" d84 1 a84 1 return SIO_DOWNSTREAM; d93 1 a93 1 return SIO_DOWNSTREAM; @ 1.2 log @snapshot - sio_strategy now has a default direction triggered by SIO_OK result - added structure tag to aid debugging - sio_hole eats all data and returns downstream (correct ?) - sio_null now uses default directio - sio_sa puts wrapper on sa objects - sio_hello.c implements a trivial protocol handler PR: Submitted by: Reviewed by: Approved by: Obtained from: @ text @d20 1 a20 1 private_t *mydata; d22 2 a23 2 mydata = (private_t *)malloc(sizeof(private_t)); if (mydata == NULL) d26 1 a26 1 *u = mydata; d48 1 a48 1 private_t *mydata = (private_t *)u; d50 1 a50 1 free(mydata); @ 1.1 log @snapshot PR: Submitted by: Reviewed by: Approved by: Obtained from: @ text @d9 1 a81 2 size_t feed = al_bytes(al); d83 1 a83 4 if (feed > 0) { al_splice(al, 0, feed, NULL, NULL); return SIO_DOWNSTREAM; } d85 1 a85 1 return SIO_UPSTREAM; @