ossp-pkg/sio/sio_null.c
1.7
#include <stddef.h>
#include <stdlib.h>
#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)
{
return SIO_OK;
}
static
sio_rc_t null_output(sio_t *sio, al_t *al, void *u)
{
return SIO_OK;
}
static
sio_rc_t null_shutdown(sio_t *sio, al_t *al, 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
};