OSSP CVS Repository

ossp - ossp-pkg/sio/sio_null.c 1.1
Not logged in
[Honeypot]  [Browse]  [Directory]  [Home]  [Login
[Reports]  [Search]  [Ticket]  [Timeline
  [Raw

ossp-pkg/sio/sio_null.c 1.1
#include <stddef.h>
#include <stdlib.h>

#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_open(sio_t *sio, void *u)
{
    return SIO_OK;
}

static
sio_rc_t null_close(sio_t *sio, 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;
}

sio_module_t sio_null_module = {
    "null",
    null_init,
    null_configure,
    null_cleanup,
    null_open,
    null_close,
    null_input,
    null_output
};


CVSTrac 2.0.1