summaryrefslogtreecommitdiff
path: root/cpp/unpack.cc
blob: ce57e67669a3532415d04de80245cf9a46b3d9b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "unpack.h"
#include "unpack_context.h"
#include <stdlib.h>

msgpack_unpack_t* msgpack_unpack_new(void)
{
	msgpack_unpacker* ctx;
	ctx = (msgpack_unpacker*)calloc(1, sizeof(msgpack_unpacker));
	if(ctx == NULL) { return NULL; }
	msgpack_unpacker_init(ctx);
	return (msgpack_unpack_t*)ctx;
}

void msgpack_unpack_free(msgpack_unpack_t* ctx)
{
	free((msgpack_unpacker*)ctx);
}

int msgpack_unpack_execute(msgpack_unpack_t* ctx, const char* data, size_t len, size_t* off)
{
	return msgpack_unpacker_execute(
			(msgpack_unpacker*)ctx,
			data, len, off);
}

void* msgpack_unpack_data(msgpack_unpack_t* ctx)
{
	return msgpack_unpacker_data((msgpack_unpacker*)ctx);
}