You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
557 B
42 lines
557 B
#include <sipc.h>
|
|
#include <stdlib.h>
|
|
|
|
//Some FFI helpers
|
|
|
|
si_type sif_type(const si_message* msg)
|
|
{
|
|
return msg->type;
|
|
}
|
|
|
|
unsigned int sif_size(const si_message* msg)
|
|
{
|
|
return msg->data_len;
|
|
}
|
|
|
|
const unsigned char* sif_data(const si_message* msg)
|
|
{
|
|
return msg->data;
|
|
}
|
|
|
|
si_message** sif_heap_alloc(int keepresp)
|
|
{
|
|
if(keepresp)
|
|
{
|
|
si_message **resp = malloc(sizeof(si_message*));
|
|
*resp = NULL;
|
|
return resp;
|
|
}
|
|
else return NULL;
|
|
}
|
|
|
|
void sif_heap_free(si_message **msg)
|
|
{
|
|
if(msg) {
|
|
if(*msg) {
|
|
free(*msg);
|
|
*msg = NULL;
|
|
}
|
|
free(msg);
|
|
}
|
|
}
|