SilcBufferFormatFunc

SYNOPSIS

    typedef int (*SilcBuffeSFormatFunc)(SilcStack stack,
                                        SilcBuffer buffer,
                                        void *value,
                                        void *context);

DESCRIPTION

Formatting function callback given with SILC_STR_FUNC type. The `buffer' is the buffer being formatted at the location where the SILC_STR_FUNC was placed in formatting. The function should call silc_buffer_senlarge before it adds the data to the buffer to make sure that it has enough space. The buffer->head points to the start of the buffer and silc_buffer_headlen() gives the length of the currently formatted data area. It is also possible to use silc_buffer_sformat with `buffer' which will enlarge the buffer if needed.

The `value' is the value given to SILC_STR_FUNC that is to be formatted into the buffer. It may be NULL if the function is not formatting new data into the buffer. The `context' is caller specific context. Returns -1 on error and length of the formatted value otherwise, and 0 if nothing was formatted.