MessagePack macros. More...

Macros

#define MSGPACK_BOOL(obj)   _MSGPACK_GET_OBJ_VALUE_(obj, msgpack_object8_t, boolean)
 Get MessagePack object as boolean.
 
#define MSGPACK_INT8(obj)   _MSGPACK_GET_OBJ_VALUE_(obj, msgpack_object8_t, s)
 Get MessagePack object as signed 8bit. More...
 
#define MSGPACK_UINT8(obj)   _MSGPACK_GET_OBJ_VALUE_(obj, msgpack_object8_t, u)
 Get MessagePack object as unsigned 8bit. More...
 
#define MSGPACK_INT16(obj)   _MSGPACK_GET_OBJ_VALUE_(obj, msgpack_object16_t, s)
 Get MessagePack object as signed 16bit. More...
 
#define MSGPACK_UINT16(obj)   _MSGPACK_GET_OBJ_VALUE_(obj, msgpack_object16_t, u)
 Get MessagePack object as unsigned 16bit. More...
 
#define MSGPACK_INT32(obj)   _MSGPACK_GET_OBJ_VALUE_(obj, msgpack_object32_t, s)
 Get MessagePack object as signed 32bit. More...
 
#define MSGPACK_UINT32(obj)   _MSGPACK_GET_OBJ_VALUE_(obj, msgpack_object32_t, u)
 Get MessagePack object as unsigned 32bit. More...
 
#define MSGPACK_FLOAT(obj)   _MSGPACK_GET_OBJ_VALUE_(obj, msgpack_object32_t, flt)
 Get MessagePack object as float.
 
#define MSGPACK_INT64(obj)   _MSGPACK_GET_OBJ_VALUE_(obj, msgpack_object64_t, s)
 Get MessagePack object as signed 64bit. More...
 
#define MSGPACK_UINT64(obj)   _MSGPACK_GET_OBJ_VALUE_(obj, msgpack_object64_t, u)
 Get MessagePack object as unsigned 64bit. More...
 
#define MSGPACK_DOUBLE(obj)   _MSGPACK_GET_OBJ_VALUE_(obj, msgpack_object64_t, dbl)
 Get MessagePack object as double.
 
#define MSGPACK_DICT(obj, key)   msgpack_get_dict_object(obj, key)
 Get MessagePack object as a dictionary (aka map)
 
#define MSGPACK_ARRAY(obj, index)   msgpack_get_array_object(obj, index)
 Get MessagePack object as an array.
 
#define MSGPACK_STR_VALUE(obj)   ((const msgpack_object_str_t*)(obj))->data
 Get string MessagePack object's string value. More...
 
#define MSGPACK_STR_LENGTH(obj)   ((const msgpack_object_str_t*)(obj))->length
 Get MessagePack object string length.
 
#define MSGPACK_STR_CMP(obj, str)   strncmp(MSGPACK_STR_VALUE(obj), str, MSGPACK_STR_LENGTH(obj))
 Compare string MessagePack object to another string.
 
#define MSGPACK_BIN_VALUE(obj)   ((const msgpack_object_bin_t*)(obj))->data
 Get binary MessagePack object's value.
 
#define MSGPACK_BIN_LENGTH(obj)   ((const msgpack_object_bin_t*)(obj))->length
 Get binary MessagePack object's length.
 
#define MSGPACK_BIN_CMP(obj, mem)   memcmp(MSGPACK_BIN_VALUE(obj), mem, MSGPACK_BIN_LENGTH(obj))
 Compare binary MessagePack object to another binary value.
 
#define MSGPACK_INT(obj)   msgpack_get_int(obj)
 Get MessagePack object as a signed 32bit value. More...
 
#define MSGPACK_UINT(obj)   msgpack_get_uint(obj)
 Get MessagePack object as an unsigned 32bit value. More...
 
#define MSGPACK_LONG(obj, buffer)   msgpack_get_long(obj, buffer)
 Get MessagePack object as a signed 64bit value. More...
 
#define MSGPACK_ULONG(obj, buffer)   msgpack_get_ulong(obj, buffer)
 Get MessagePack object as an unsigned 64bit value. More...
 
#define MSGPACK_STR(obj, buffer, max_length)   msgpack_get_str(obj, buffer, max_length)
 Get MessagePack object as a null-terminated string. More...
 
#define MSGPACK_IS_NIL(obj)   _MSGPACK_IS_(obj, NIL)
 Return ZOS_TRUE if MessagePack object is a NIL (i.e. More...
 
#define MSGPACK_IS_BOOL(obj)   _MSGPACK_IS_(obj, BOOL)
 Return ZOS_TRUE if MessagePack object is a boolean.
 
#define MSGPACK_IS_INT8(obj)   _MSGPACK_IS_(obj, INT8)
 Return ZOS_TRUE if MessagePack object is a signed 8bit integer.
 
#define MSGPACK_IS_UINT8(obj)   _MSGPACK_IS_(obj, UINT8)
 Return ZOS_TRUE if MessagePack object is an unsigned 8bit integer.
 
#define MSGPACK_IS_INT16(obj)   _MSGPACK_IS_(obj, INT16)
 Return ZOS_TRUE if MessagePack object is a signed 16bit integer.
 
#define MSGPACK_IS_UINT16(obj)   _MSGPACK_IS_(obj, UINT16)
 Return ZOS_TRUE if MessagePack object is an unsigned 16bit integer.
 
#define MSGPACK_IS_INT32(obj)   _MSGPACK_IS_(obj, INT32)
 Return ZOS_TRUE if MessagePack object is a signed 32bit integer.
 
#define MSGPACK_IS_UINT32(obj)   _MSGPACK_IS_(obj, UINT32)
 Return ZOS_TRUE if MessagePack object is an unsigned 32bit integer.
 
#define MSGPACK_IS_INT64(obj)   _MSGPACK_IS_(obj, INT64)
 Return ZOS_TRUE if MessagePack object is a signed 64bit integer.
 
#define MSGPACK_IS_UINT64(obj)   _MSGPACK_IS_(obj, UINT64)
 Return ZOS_TRUE if MessagePack object is an unsigned 64bit integer.
 
#define MSGPACK_IS_FLOAT(obj)   _MSGPACK_IS_(obj, FLOAT)
 Return ZOS_TRUE if MessagePack object is a float.
 
#define MSGPACK_IS_DOUBLE(obj)   _MSGPACK_IS_(obj, DOUBLE)
 Return ZOS_TRUE if MessagePack object is a double.
 
#define MSGPACK_IS_STR(obj)   _MSGPACK_IS_(obj, STR)
 Return ZOS_TRUE if MessagePack object is a string.
 
#define MSGPACK_IS_BIN(obj)   _MSGPACK_IS_(obj, BIN)
 Return ZOS_TRUE if MessagePack object is a binary string.
 
#define MSGPACK_IS_DICT(obj)   _MSGPACK_IS_(obj, DICT)
 Return ZOS_TRUE if MessagePack object is a dictionary (aka map)
 
#define MSGPACK_IS_ARRAY(obj)   _MSGPACK_IS_(obj, ARRAY)
 Return ZOS_TRUE if MessagePack object is an array.
 
#define MSGPACK_NIL   0xC0
 Raw value of a MessagePack NIL typed object.
 
#define MSGPACK_FALSE   0xC2
 Raw value of a MessagePack FALSE boolean typed object.
 
#define MSGPACK_TRUE   0xC3
 Raw value of a MessagePack TRUE boolean typed object.
 
#define MSGPACK_INIT_WITH_BUFFER(name, _buf, _len)
 Declare and initialize a msgpack_context_t with the supplied buffer. More...
 
#define MSGPACK_INIT_WITH_WRITER(name, _writer, _user)
 Declare and initialize a msgpack_context_t with the supplied msgpack_writer_t. More...
 
#define MSGPACK_SET_WRITER(context, _writer, _user)
 Configure the given msgpack_context_t with a msgpack_writer_t. More...
 
#define MSGPACK_FREE_OBJECTS(obj)   msgpack_free_objects(obj)
 De-allocate all objects assoicated with supplied object. More...
 
#define MSGPACK_BUFFER_USED(ctx)   (uint16_t)((ctx)->buffer.ptr - (ctx)->buffer.buffer)
 Return the number of data buffer bytes currently used by a msgpack_context_t. More...
 
#define MSGPACK_BUFFER_REMAINING(ctx)   (uint16_t)((ctx)->buffer.end - (ctx)->buffer.ptr)
 Return the number of data buffer bytes unused (i.e. More...
 
#define MSGPACK_DICT_GET_OBJECT(dict, key)   msgpack_get_dict_object((const msgpack_object_dict_t*)dict, key)
 Return an object for the corresponding key in a dictionary. More...
 
#define MSGPACK_ARRAY_GET_OBJECT(array, index)   msgpack_get_array_object((const msgpack_object_array_t*)array, index)
 Return the object a the corresponding index in an array. More...
 

Detailed Description

MessagePack macros.

Macro Definition Documentation

#define MSGPACK_ARRAY_GET_OBJECT (   array,
  index 
)    msgpack_get_array_object((const msgpack_object_array_t*)array, index)

Return the object a the corresponding index in an array.

See also
msgpack_get_array_object for more info
#define MSGPACK_BUFFER_REMAINING (   ctx)    (uint16_t)((ctx)->buffer.end - (ctx)->buffer.ptr)

Return the number of data buffer bytes unused (i.e.

available) by a msgpack_context_t

Parameters
ctxmsgpack_context_t initialized with a data buffer
#define MSGPACK_BUFFER_USED (   ctx)    (uint16_t)((ctx)->buffer.ptr - (ctx)->buffer.buffer)

Return the number of data buffer bytes currently used by a msgpack_context_t.

Parameters
ctxmsgpack_context_t initialized with a data buffer
#define MSGPACK_DICT_GET_OBJECT (   dict,
  key 
)    msgpack_get_dict_object((const msgpack_object_dict_t*)dict, key)

Return an object for the corresponding key in a dictionary.

See also
msgpack_get_dict_object for more info
Examples:
cloud/s2cbasic/platform_streams.c, and cloud/s2cdemo/zentri_platform_streams.c.
#define MSGPACK_FREE_OBJECTS (   obj)    msgpack_free_objects(obj)

De-allocate all objects assoicated with supplied object.

See also
msgpack_free_objects() for more info
#define MSGPACK_INIT_WITH_BUFFER (   name,
  _buf,
  _len 
)
Value:
{ \
.buffer.buffer = _buf, \
.buffer.ptr = _buf, \
.buffer.end = _buf + _len, \
.writer = NULL, \
.user = NULL \
}
uint8_t * buffer
buffer to hold 'packed' message data
Definition: zos_msgpack.h:479
MessagePack data writing context.
Definition: zos_msgpack.h:475

Declare and initialize a msgpack_context_t with the supplied buffer.

Parameters
nameThe variable name of msgpack_context_t being declared
_bufData buffer to initialize context with
_lenLength of supplied data buffer
Examples:
cloud/s2cdemo/main.c.
#define MSGPACK_INIT_WITH_WRITER (   name,
  _writer,
  _user 
)
Value:
{ \
.writer = _writer, \
.user = _user, \
.buffer.buffer = NULL \
}
msgpack_writer_t writer
Data writer, see msgpack_writer_t.
Definition: zos_msgpack.h:483
MessagePack data writing context.
Definition: zos_msgpack.h:475

Declare and initialize a msgpack_context_t with the supplied msgpack_writer_t.

Parameters
nameThe variable name of msgpack_context_t being declared
_writerMessagePack data writer, see msgpack_writer_t
_userOptional user argument given to the data writer
#define MSGPACK_INT (   obj)    msgpack_get_int(obj)

Get MessagePack object as a signed 32bit value.

See also
msgpack_get_int() for more info
#define MSGPACK_INT16 (   obj)    _MSGPACK_GET_OBJ_VALUE_(obj, msgpack_object16_t, s)

Get MessagePack object as signed 16bit.

See also
MSGPACK_INT() to automatically determine the integer bit size
#define MSGPACK_INT32 (   obj)    _MSGPACK_GET_OBJ_VALUE_(obj, msgpack_object32_t, s)

Get MessagePack object as signed 32bit.

See also
MSGPACK_INT() to automatically determine the integer bit size
#define MSGPACK_INT64 (   obj)    _MSGPACK_GET_OBJ_VALUE_(obj, msgpack_object64_t, s)

Get MessagePack object as signed 64bit.

See also
MSGPACK_LONG() to automatically determine the integer bit size
#define MSGPACK_INT8 (   obj)    _MSGPACK_GET_OBJ_VALUE_(obj, msgpack_object8_t, s)

Get MessagePack object as signed 8bit.

See also
MSGPACK_INT() to automatically determine the integer bit size
#define MSGPACK_IS_NIL (   obj)    _MSGPACK_IS_(obj, NIL)

Return ZOS_TRUE if MessagePack object is a NIL (i.e.

NULL value)

#define MSGPACK_LONG (   obj,
  buffer 
)    msgpack_get_long(obj, buffer)

Get MessagePack object as a signed 64bit value.

See also
msgpack_get_int() for more info
#define MSGPACK_SET_WRITER (   context,
  _writer,
  _user 
)
Value:
context->writer = _writer; \
context->user = _user; \
context->buffer.buffer = NULL

Configure the given msgpack_context_t with a msgpack_writer_t.

Parameters
contextPointer to previously declared/allocated msgpack_context_t
_writerMessagePack data writer, see msgpack_writer_t
_userOptional user argument given to the data writer
#define MSGPACK_STR (   obj,
  buffer,
  max_length 
)    msgpack_get_str(obj, buffer, max_length)

Get MessagePack object as a null-terminated string.

See also
msgpack_get_str() for more info
#define MSGPACK_STR_VALUE (   obj)    ((const msgpack_object_str_t*)(obj))->data

Get string MessagePack object's string value.

Note
The string value is NOT null-terminated
See also
MSGPACK_STR()
#define MSGPACK_UINT (   obj)    msgpack_get_uint(obj)

Get MessagePack object as an unsigned 32bit value.

See also
msgpack_get_int() for more info
Examples:
cloud/s2cdemo/zentri_platform_streams.c.
#define MSGPACK_UINT16 (   obj)    _MSGPACK_GET_OBJ_VALUE_(obj, msgpack_object16_t, u)

Get MessagePack object as unsigned 16bit.

See also
MSGPACK_UINT() to automatically determine the integer bit size
#define MSGPACK_UINT32 (   obj)    _MSGPACK_GET_OBJ_VALUE_(obj, msgpack_object32_t, u)

Get MessagePack object as unsigned 32bit.

See also
MSGPACK_UINT() to automatically determine the integer bit size
#define MSGPACK_UINT64 (   obj)    _MSGPACK_GET_OBJ_VALUE_(obj, msgpack_object64_t, u)

Get MessagePack object as unsigned 64bit.

See also
MSGPACK_ULONG() to automatically determine the integer bit size
#define MSGPACK_UINT8 (   obj)    _MSGPACK_GET_OBJ_VALUE_(obj, msgpack_object8_t, u)

Get MessagePack object as unsigned 8bit.

See also
MSGPACK_UINT() to automatically determine the integer bit size
#define MSGPACK_ULONG (   obj,
  buffer 
)    msgpack_get_ulong(obj, buffer)

Get MessagePack object as an unsigned 64bit value.

See also
msgpack_get_int() for more info