SILC_STR_*_NSTRING

NAME

    #define SILC_STR_UI8_NSTRING() ...
    #define SILC_STR_UI8_NSTRING_ALLOC() ...
    #define SILC_STR_UI16_NSTRING() ...
    #define SILC_STR_UI16_NSTRING_ALLOC() ...
    #define SILC_STR_UI32_NSTRING() ...
    #define SILC_STR_UI32_NSTRING_ALLOC() ...

DESCRIPTION

Unsigned string. Second argument is the length of the string.

     Formatting:    SILC_STR_UI32_NSTRING(unsigned char *, SilcUInt32)
     Unformatting:  SILC_STR_UI32_NSTRING(unsigned char **, SilcUInt32 *)

Unformatting procedure will check for length of the string from the buffer before trying to get the string out. Thus, one *must* format the length as UINT32 or UINT16 or UINT8 into the buffer *before* formatting the actual string to the buffer, and, in unformatting one ignores the length of the string because unformatting procedure will take it automatically.

EXAMPLE

     Formatting:    ..., SILC_STR_UINT32(strlen(string)),
                         SILC_STR_UI32_NSTRING(string, strlen(string)), ...
     Unformatting:  ..., SILC_STR_UI32_NSTRING(&string, &len), ...

    I.e., you can ignore the formatted length field in unformatting. The
    length taken from the buffer is returned to the pointer sent as
    argument (&len in above example).

    UI8, UI16 and UI32 means that the length is considered to be
    either UINT8, UINT16 or UINT32 in unformatting.

    _ALLOC routines automatically allocates memory for the variable sent
    as argument in unformatting.