kw_add_binary_type()

kw_add_binary_type()#

Add a custom binary type to the system for handling serialization and deserialization with json_t * and gbuffer_t *.

Prototype

PUBLIC int kw_add_binary_type(
    const char  *type_name,
    int         (*serialize)(json_t *, gbuffer_t *),
    json_t      *(*deserialize)(gbuffer_t *)
);
        

Parameters

Key

Type

Description

type_name

const char *

The name of the binary type to add.

serialize

int (*)(json_t *, gbuffer_t *)

A function pointer for serializing data of this type.

deserialize

json_t *(*)(gbuffer_t *)

A function pointer for deserializing data of this type.


Return Value

Returns 0 on success, or a negative value on error.

Prototype

// Not applicable in JS

Prototype

# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples