blob: c07a0214cc41e3334719db48c713a427b30d2d2d [file] [log] [blame]
#ifndef _SP_MSGPACK_H_
#define _SP_MSGPACK_H_
#include "../msgpack/cwpack.h"
#include "sp_config.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct
{
const char* key;
union
{
int32 intval;
const char* strval;
const uint8* binval;
} val;
int32 strlen;
} unpack_field_t;
int32 sp_pack_init(cw_pack_context* pack,uint8* buf,uint16 len);
void sp_pack_put_str(cw_pack_context* pack,const char* parakey,const char* paraval);
void sp_pack_put_int(cw_pack_context* pack,const char* parakey,const int paraval);
void sp_pack_put_bin(cw_pack_context* pack,const char* parakey,const uint8* paraval,
const uint16 len);
uint16 sp_pack_length(cw_pack_context* pack);
int32 sp_unpack_init(cw_unpack_context* unpack,uint8* buf,uint16 len);
uint8 sp_unpack_map_size(cw_unpack_context* unpack);
uint8 sp_unpack_value(cw_unpack_context* unpack,unpack_field_t* field);
#ifdef __cplusplus
}
#endif
#endif