head 1.11; access; symbols SIO_0_9_3:1.11 SIO_0_9_2:1.10 SIO_0_9_1:1.10 SIO_0_9_0:1.10; locks; strict; comment @ * @; 1.11 date 2005.10.03.09.06.11; author rse; state Exp; branches; next 1.10; 1.10 date 2003.01.06.19.04.56; author rse; state Exp; branches; next 1.9; 1.9 date 2003.01.06.16.35.40; author rse; state Exp; branches; next 1.8; 1.8 date 2002.11.29.13.00.18; author mlelstv; state Exp; branches; next 1.7; 1.7 date 2002.11.27.15.50.29; author mlelstv; state Exp; branches; next 1.6; 1.6 date 2002.11.24.19.36.48; author mlelstv; state Exp; branches; next 1.5; 1.5 date 2002.11.14.15.56.10; author mlelstv; state Exp; branches; next 1.4; 1.4 date 2002.11.08.08.59.32; author mlelstv; state Exp; branches; next 1.3; 1.3 date 2002.11.05.13.23.36; author mlelstv; state Exp; branches; next 1.2; 1.2 date 2002.10.23.17.05.10; author mlelstv; state Exp; branches; next 1.1; 1.1 date 2002.10.22.12.57.20; author mlelstv; state Exp; branches; next ; desc @@ 1.11 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_null.c: /dev/null stage */ #include #include #include "al.h" #include "sio.h" typedef struct { int a; float b; char *c; } private_t; /* * create stage * * allocate private instance data */ static sio_rc_t null_init(sio_t *sio, void **up) { private_t *my; my = (private_t *)malloc(sizeof(private_t)); if (my == NULL) return SIO_ERR_MEM; my->a = 42; my->b = 42.0; my->c = "42"; *up = my; return SIO_OK; } /* * configure stage * * pass two void pointers */ static sio_rc_t null_configure(sio_t *sio, void *u, void *obj, void *val) { private_t *my = (private_t *)u; my->a = *(int *)val; return SIO_OK; } /* * destroy stage */ static sio_rc_t null_cleanup(sio_t *sio, void *u) { private_t *my = (private_t *)u; free(my); return SIO_OK; } static sio_rc_t null_openr(sio_t *sio, al_t *al, void *u) { return SIO_OK; } static sio_rc_t null_closer(sio_t *sio, al_t *al, void *u) { return SIO_OK; } static sio_rc_t null_openw(sio_t *sio, al_t *al, void *u) { return SIO_OK; } static sio_rc_t null_closew(sio_t *sio, al_t *al, void *u) { return SIO_OK; } static sio_rc_t null_input(sio_t *sio, al_t *al, void *u, sio_rc_t orc) { return SIO_OK; } static sio_rc_t null_output(sio_t *sio, al_t *al, void *u, sio_rc_t orc) { return SIO_OK; } static sio_rc_t null_shutdown(sio_t *sio, void *u) { return SIO_OK; } sio_module_t sio_module_null = { "null", null_init, null_configure, null_cleanup, null_openr, null_closer, null_openw, null_closew, null_input, null_output, null_shutdown }; @ 1.10 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.9 log @fix signature @ text @d1 30 d52 1 a52 1 @ 1.8 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 @d101 1 a101 1 sio_rc_t null_shutdown(sio_t *sio, al_t *al, void *u) @ 1.7 log @code cleanup PR: Submitted by: Reviewed by: Approved by: Obtained from: @ text @d89 1 a89 1 sio_rc_t null_input(sio_t *sio, al_t *al, void *u) d95 1 a95 1 sio_rc_t null_output(sio_t *sio, al_t *al, void *u) @ 1.6 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 @d19 1 a19 1 sio_rc_t null_init(sio_t *sio, void **u) d31 1 a31 1 *u = my; @ 1.5 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 @d100 6 d116 2 a117 1 null_output @ 1.4 log @less cluttering name for private data pointer PR: Submitted by: Reviewed by: Approved by: Obtained from: @ text @a5 1 #include "sio_module.h" @ 1.3 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 @d22 1 a22 1 private_t *mydata; d24 2 a25 2 mydata = (private_t *)malloc(sizeof(private_t)); if (mydata == NULL) d28 3 a30 3 mydata->a = 42; mydata->b = 42.0; mydata->c = "42"; d32 1 a32 1 *u = mydata; d45 1 a45 1 private_t *mydata = (private_t *)u; d47 1 a47 1 mydata->a = *(int *)val; d58 1 a58 1 private_t *mydata = (private_t *)u; d60 1 a60 1 free(mydata); @ 1.2 log @snapshot PR: Submitted by: Reviewed by: Approved by: Obtained from: @ text @d92 1 a92 1 return SIO_DOWNSTREAM; d98 1 a98 1 return SIO_UPSTREAM; @ 1.1 log @initial commit PR: Submitted by: Reviewed by: Approved by: Obtained from: @ text @d66 1 a66 1 sio_rc_t null_open(sio_t *sio, void *u) d72 13 a84 1 sio_rc_t null_close(sio_t *sio, void *u) d92 1 a92 1 return SIO_OK; d98 1 a98 1 return SIO_OK; d101 1 a101 1 sio_module_t sio_null_module = { d106 4 a109 2 null_open, null_close, @