ossp-pkg/sio/sio_hole.c
1.5
#include <stddef.h>
#include <stdlib.h>
#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 **u)
{
private_t *my;
my = (private_t *)malloc(sizeof(private_t));
if (my == NULL)
return SIO_ERR_MEM;
*u = 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)
{
/* 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)
{
/* 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
};