mmstream_get_configuration()

Updated: April 19, 2023

Get the configuration for an instance

Synopsis:

#include <mmstream/mmstream.h>
ssize_t mmstream_get_configuration(mmstream_instance_t instance,
                                   char *config,
                                   const size_t size)

Arguments:

instance
A handle to the instance whose configuration is being retrieved
config
A pointer to a buffer for storing the configuration (can be NULL to request how many bytes are needed)
size
The maximum number of bytes to write into the buffer, including the null-terminator (can be 0 to request the buffer size needed)

Library:

libmmstream

Description:

This function writes the configuration for the specified instance as null-terminated JSON text into the buffer pointed to by config. The number of bytes written is at most size, including the null-terminator.

If you need to know how many bytes are needed to store the full configuration data, call this function with config set to NULL and size set to 0. You can use the return value to allocate sufficient memory and then call this function again, passing in the pointer to the new buffer and the previously returned size.

Returns:

On success, the size (in bytes) of the full configuration data, excluding the null-terminator. Thus, if this number is at least the value of size, the output was truncated. On failure, a negative value.