#include #include #include "al.h" #include "sio.h" #include "sio_module.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 **u) { private_t *mydata; mydata = (private_t *)malloc(sizeof(private_t)); if (mydata == NULL) return SIO_ERR_MEM; mydata->a = 42; mydata->b = 42.0; mydata->c = "42"; *u = mydata; 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 *mydata = (private_t *)u; mydata->a = *(int *)val; return SIO_OK; } /* * destroy stage */ static sio_rc_t null_cleanup(sio_t *sio, void *u) { private_t *mydata = (private_t *)u; free(mydata); 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) { return SIO_DOWNSTREAM; } static sio_rc_t null_output(sio_t *sio, al_t *al, void *u) { return SIO_UPSTREAM; } 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 };