Lucciefr
Lua code caving, injection and exploration framework
Functions
mpkutils.c File Reference

MessagePack utilities. More...

#include "mpkutils.h"

Functions

int msgpack_pack_lstring (msgpack_packer *pk, const char *str, size_t len)
 Pack string with a given length. More...
 
void msgpack_object_from_lstring (msgpack_object *object, const char *str, size_t len)
 Create msgpack object from string (with given length). More...
 
size_t msgpack_object_str_fwrite (msgpack_object_str str, FILE *stream)
 Write msgpack_object_str to a stream. More...
 

Detailed Description

MessagePack utilities.

Function Documentation

void msgpack_object_from_lstring ( msgpack_object *  object,
const char *  str,
size_t  len 
)

Create msgpack object from string (with given length).

Also translates NULL to a "nil" object.

Note
This does not allocate any memory within the object, justs sets the str pointer!
size_t msgpack_object_str_fwrite ( msgpack_object_str  str,
FILE *  stream 
)

Write msgpack_object_str to a stream.

Since a string-type msgpack_object_str isn't NUL-terminated, it's a bit awkward to output; maybe this helps.

Returns
number of bytes written
int msgpack_pack_lstring ( msgpack_packer *  pk,
const char *  str,
size_t  len 
)

Pack string with a given length.

msgpack-c has an awful syntax for string packing (requiring two calls for string length and actual content), work around that - by introducing a cleaner "string + length" interface.