*/
-/****h* silcutil/SILC Buffer Format Interface
+/****h* silcutil/Buffer Format Interface
*
* DESCRIPTION
*
* macro provides many different flags that can change the behavior of the
* matching, with capabilities to also mimic Sed behavior.
*
- * As the SilcBuffer API is not thread-safe these routines may not be used
+ * As the SilcBuffer context is not thread-safe these routines may not be used
* in multithreaded environment with a same SilcBuffer context without
* concurrency control.
*
*
* SilcBufferStruct buffer;
*
+ * // Encode buffer
* memset(&buffer, 0, sizeof(buffer));
* ret = silc_buffer_format(&buffer,
* SILC_STR_UINT32(intval),
#ifndef SILCBUFFMT_H
#define SILCBUFFMT_H
-/****f* silcutil/SilcBufferFormatAPI/SilcBufferFormatFunc
+/****f* silcutil/SilcBufferFormatFunc
*
* SYNOPSIS
*
typedef int (*SilcBufferFormatFunc)(SilcStack stack, SilcBuffer buffer,
void *value, void *context);
-/****f* silcutil/SilcBufferFormatAPI/SilcBufferUnformatFunc
+/****f* silcutil/SilcBufferUnformatFunc
*
* SYNOPSIS
*
/* Prototypes */
-/****f* silcutil/SilcBufferFormatAPI/silc_buffer_format
+/****f* silcutil/silc_buffer_format
*
* SYNOPSIS
*
* silc_buffer_purge(&buffer);
*
* // Dynamically allocated zero size buffer
- * SilcBuffer buf;
+ * SilcBuffer buf;
* buf = silc_buffer_alloc(0);
* ret = silc_buffer_format(buf,
* SILC_STR_UINT32(intval),
***/
int silc_buffer_format(SilcBuffer dst, ...);
-/****f* silcutil/SilcBufferFormatAPI/silc_buffer_sformat
+/****f* silcutil/silc_buffer_sformat
*
* SYNOPSIS
*
***/
int silc_buffer_sformat(SilcStack stack, SilcBuffer dst, ...);
-/****f* silcutil/SilcBufferFormatAPI/silc_buffer_format_vp
+/****f* silcutil/silc_buffer_format_vp
*
* SYNOPSIS
*
***/
int silc_buffer_format_vp(SilcBuffer dst, va_list ap);
-/****f* silcutil/SilcBufferFormatAPI/silc_buffer_sformat_vp
+/****f* silcutil/silc_buffer_sformat_vp
*
* SYNOPSIS
*
***/
int silc_buffer_sformat_vp(SilcStack stack, SilcBuffer dst, va_list ap);
-/****f* silcutil/SilcBufferFormatAPI/silc_buffer_unformat
+/****f* silcutil/silc_buffer_unformat
*
* SYNOPSIS
*
***/
int silc_buffer_unformat(SilcBuffer src, ...);
-/****f* silcutil/SilcBufferFormatAPI/silc_buffer_sunformat
+/****f* silcutil/silc_buffer_sunformat
*
* SYNOPSIS
*
***/
int silc_buffer_sunformat(SilcStack stack, SilcBuffer src, ...);
-/****f* silcutil/SilcBufferFormatAPI/silc_buffer_unformat_vp
+/****f* silcutil/silc_buffer_unformat_vp
*
* SYNOPSIS
*
***/
int silc_buffer_unformat_vp(SilcBuffer src, va_list ap);
-/****f* silcutil/SilcBufferFormatAPI/silc_buffer_sunformat_vp
+/****f* silcutil/silc_buffer_sunformat_vp
*
* SYNOPSIS
*
***/
int silc_buffer_sunformat_vp(SilcStack stack, SilcBuffer src, va_list ap);
-/****f* silcutil/SilcBufferFormatAPI/silc_buffer_strformat
+/****f* silcutil/silc_buffer_strformat
*
* SYNOPSIS
*
***/
int silc_buffer_strformat(SilcBuffer dst, ...);
-/****f* silcutil/SilcBufferFormatAPI/silc_buffer_sstrformat
+/****f* silcutil/silc_buffer_sstrformat
*
* SYNOPSIS
*
***/
int silc_buffer_sstrformat(SilcStack stack, SilcBuffer dst, ...);
-/****d* silcutil/SilcBufferFormatAPI/SILC_STR_SINT8
+/****d* silcutil/SILC_STR_SINT8
*
* NAME
*
*
* One 8-bit signed integer.
*
- * Formatting: SILC_STR_SINT8(SilcInt8)
- * Unformatting: SILC_STR_SINT8(SilcInt8 *)
+ * Formatting: SILC_STR_SINT8(SilcInt8)
+ * Unformatting: SILC_STR_SINT8(SilcInt8 *)
*
***/
#define SILC_STR_SINT8(x) SILC_PARAM_SINT8, (x)
-/****d* silcutil/SilcBufferFormatAPI/SILC_STR_UINT8
+/****d* silcutil/SILC_STR_UINT8
*
* NAME
*
*
* One 8-bit unsigned integer.
*
- * Formatting: SILC_STR_UINT8(SilcUInt8)
- * Unformatting: SILC_STR_UINT8(SilcUInt8 *)
+ * Formatting: SILC_STR_UINT8(SilcUInt8)
+ * Unformatting: SILC_STR_UINT8(SilcUInt8 *)
*
***/
#define SILC_STR_UINT8(x) SILC_PARAM_UINT8, (x)
#define SILC_STR_SI_CHAR(x) SILC_PARAM_SINT8, (x)
#define SILC_STR_UI_CHAR(x) SILC_PARAM_UINT8, (x)
-/****d* silcutil/SilcBufferFormatAPI/SILC_STR_SINT16
+/****d* silcutil/SILC_STR_SINT16
*
* NAME
*
*
* SilcInt16.
*
- * Formatting: SILC_STR_SINT16(SilcInt16)
- * Unformatting: SILC_STR_SINT16(SilcInt16 *)
+ * Formatting: SILC_STR_SINT16(SilcInt16)
+ * Unformatting: SILC_STR_SINT16(SilcInt16 *)
*
***/
#define SILC_STR_SINT16(x) SILC_PARAM_SINT16, (x)
-/****d* silcutil/SilcBufferFormatAPI/SILC_STR_UINT16
+/****d* silcutil/SILC_STR_UINT16
*
* NAME
*
*
* SilcUInt16.
*
- * Formatting: SILC_STR_UINT16(SilcUInt16)
- * Unformatting: SILC_STR_UINT16(SilcUInt16 *)
+ * Formatting: SILC_STR_UINT16(SilcUInt16)
+ * Unformatting: SILC_STR_UINT16(SilcUInt16 *)
*
***/
#define SILC_STR_UINT16(x) SILC_PARAM_UINT16, (x)
#define SILC_STR_SI_SHORT(x) SILC_PARAM_SINT16, (x)
#define SILC_STR_UI_SHORT(x) SILC_PARAM_UINT16, (x)
-/****d* silcutil/SilcBufferFormatAPI/SILC_STR_SINT32
+/****d* silcutil/SILC_STR_SINT32
*
* NAME
*
*
* SilcInt32.
*
- * Formatting: SILC_STR_SINT32(SilcInt32)
- * Unformatting: SILC_STR_SINT32(SilcInt32 *)
+ * Formatting: SILC_STR_SINT32(SilcInt32)
+ * Unformatting: SILC_STR_SINT32(SilcInt32 *)
*
***/
#define SILC_STR_SINT32(x) SILC_PARAM_SINT32, (x)
-/****d* silcutil/SilcBufferFormatAPI/SILC_STR_UINT32
+/****d* silcutil/SILC_STR_UINT32
*
* NAME
*
*
* SilcUInt32.
*
- * Formatting: SILC_STR_UINT32(SilcUInt32)
- * Unformatting: SILC_STR_UINT32(SilcUInt32 *)
+ * Formatting: SILC_STR_UINT32(SilcUInt32)
+ * Unformatting: SILC_STR_UINT32(SilcUInt32 *)
*
***/
#define SILC_STR_UINT32(x) SILC_PARAM_UINT32, (x)
#define SILC_STR_SI_INT(x) SILC_PARAM_SINT32, (x)
#define SILC_STR_UI_INT(x) SILC_PARAM_UINT32, (x)
-/****d* silcutil/SilcBufferFormatAPI/SILC_STR_SINT64
+/****d* silcutil/SILC_STR_SINT64
*
* NAME
*
*
* SilcInt64.
*
- * Formatting: SILC_STR_SINT64(SilcInt64)
- * Unformatting: SILC_STR_SINT64(SilcInt64 *)
+ * Formatting: SILC_STR_SINT64(SilcInt64)
+ * Unformatting: SILC_STR_SINT64(SilcInt64 *)
*
***/
#define SILC_STR_SI_INT64(x) SILC_PARAM_SINT64, (x)
-/****d* silcutil/SilcBufferFormatAPI/SILC_STR_UINT64
+/****d* silcutil/SILC_STR_UINT64
*
* NAME
*
*
* SilcUInt64.
*
- * Formatting: SILC_STR_UINT64(SilcUInt64)
- * Unformatting: SILC_STR_UINT64(SilcUInt64 *)
+ * Formatting: SILC_STR_UINT64(SilcUInt64)
+ * Unformatting: SILC_STR_UINT64(SilcUInt64 *)
*
***/
#define SILC_STR_UI_INT64(x) SILC_PARAM_UINT64, (x)
#define SILC_STR_SI_INT64(x) SILC_PARAM_SINT64, (x)
#define SILC_STR_UI_INT64(x) SILC_PARAM_UINT64, (x)
-/****d* silcutil/SilcBufferFormatAPI/SILC_STR_STRING
+/****d* silcutil/SILC_STR_STRING
*
* NAME
*
*
* Encode NULL terminated string. Use this only for formatting.
*
- * Formatting: SILC_STR_STRING(char *)
+ * Formatting: SILC_STR_STRING(char *)
*
* For unformatting use one of the SILC_STR_*_STRING macros, which
* automatically gets the length of the string from the buffer. Note
* SILC_STR_STRING does not save the length of the string into the buffer.
* The caller must do that in order for the unformatting macros to work.
*
- * Example:
+ * EXAMPLE
*
* Formatting: ..., SILC_STR_UINT32(strlen(string)),
* SILC_STR_STRING(string), ...
***/
#define SILC_STR_STRING(x) SILC_PARAM_UI8_STRING, (x)
-/****d* silcutil/SilcBufferFormatAPI/SILC_STR_*_STRING
+/****d* silcutil/SILC_STR_*_STRING
*
* NAME
*
* NULL terminated because strlen() will be used to get the length of
* the string.
*
- * Formatting: SILC_STR_UI32_STRING(unsigned char *)
- * Unformatting: SILC_STR_UI32_STRING(unsigned char **)
+ * Formatting: SILC_STR_UI32_STRING(unsigned char *)
+ * Unformatting: SILC_STR_UI32_STRING(unsigned char **)
*
* 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 of the string because unformatting procedure will take it
* automatically.
*
- * Example:
+ * EXAMPLE
*
* Formatting: ..., SILC_STR_UINT32(strlen(string)),
* SILC_STR_UI32_STRING(string), ...
#define SILC_STR_UI32_STRING(x) SILC_PARAM_UI32_STRING, (x)
#define SILC_STR_UI32_STRING_ALLOC(x) SILC_PARAM_UI32_STRING | SILC_PARAM_ALLOC, (x)
-/****d* silcutil/SilcBufferFormatAPI/SILC_STR_*_NSTRING
+/****d* silcutil/SILC_STR_*_NSTRING
*
* NAME
*
*
* 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 *)
+ * 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 of the string because unformatting procedure will take it
* automatically.
*
- * Example:
+ * EXAMPLE
*
* Formatting: ..., SILC_STR_UINT32(strlen(string)),
* SILC_STR_UI32_NSTRING(string, strlen(string)), ...
#define SILC_STR_UI32_NSTRING_ALLOC(x, l) \
SILC_PARAM_UI32_NSTRING | SILC_PARAM_ALLOC, (x), (l)
-/****d* silcutil/SilcBufferFormatAPI/SILC_STR_DATA
+/****d* silcutil/SILC_STR_DATA
*
* NAME
*
*
* Binary data formatting. Second argument is the length of the data.
*
- * Formatting: SILC_STR_DATA(unsigned char *, SilcUInt32)
- * Unformatting: SILC_STR_DATA(unsigned char **, SilcUInt32)
+ * Formatting: SILC_STR_DATA(unsigned char *, SilcUInt32)
+ * Unformatting: SILC_STR_DATA(unsigned char **, SilcUInt32)
*
* This type can be used to take arbitrary size data block from the buffer
* by sending the requested amount of bytes as argument.
#define SILC_STR_UI_XNSTRING(x, l) SILC_PARAM_UICHAR, (x), (l)
#define SILC_STR_UI_XNSTRING_ALLOC(x, l) SILC_PARAM_UICHAR | SILC_PARAM_ALLOC, (x), (l)
-/****d* silcutil/SilcBufferFormatAPI/SILC_STR_BUFFER
+/****d* silcutil/SILC_STR_BUFFER
*
* NAME
*
*
* SilcBuffer formatting.
*
- * Formatting: SILC_STR_BUFFER(SilcBuffer)
- * Unformatting: SILC_STR_BUFFER(SilcBuffer)
+ * Formatting: SILC_STR_BUFFER(SilcBuffer)
+ * Unformatting: SILC_STR_BUFFER(SilcBuffer)
*
* This type can be used to format and unformat SilcBuffer. Note that, the
* length of the buffer will be automatically encoded into the buffer as
#define SILC_STR_BUFFER(x) SILC_PARAM_BUFFER, (x)
#define SILC_STR_BUFFER_ALLOC(x) SILC_PARAM_BUFFER | SILC_PARAM_ALLOC, (x)
-/****d* silcutil/SilcBufferFormatAPI/SILC_STR_REPLACE
+/****d* silcutil/SILC_STR_REPLACE
*
* NAME
*
*
* Use this only for formatting.
*
- * Formatting: SILC_STR_REPLACE(unsigned char *, SilcUInt32)
+ * Formatting: SILC_STR_REPLACE(unsigned char *, SilcUInt32)
*
- * Example:
+ * EXAMPLE
*
* Before replacing
* -------------------------
***/
#define SILC_STR_REPLACE(x, l) SILC_PARAM_UICHAR | SILC_PARAM_REPLACE, (x), (l)
-/****d* silcutil/SilcBufferFormatAPI/SILC_STR_FUNC
+/****d* silcutil/SILC_STR_FUNC
*
* NAME
*
*
* Formatting and unformatting of arbitrary data.
*
- * Formatting: SILC_STR_FUNC(function, void *value, void *context)
- * Unformatting: SILC_STR_FUNC(function, void **value, void *context)
+ * Formatting: SILC_STR_FUNC(function, void *value, void *context)
+ * Unformatting: SILC_STR_FUNC(function, void **value, void *context)
*
* This type can be used to call the `function' of the type
* SilcBufferFormatFunc or SilcBufferUnformatFunc to encode or decode
#define SILC_STR_FUNC(func, val, context) SILC_PARAM_FUNC, \
func, (val), (context)
-/****d* silcutil/SilcBufferFormatAPI/SilcBufferRegexFlags
+/****d* silcutil/SilcBufferRegexFlags
*
* NAME
*
} SilcBufferRegexFlags;
/***/
-/****d* silcutil/SilcBufferFormatAPI/SILC_STR_REGEX
+/****d* silcutil/SILC_STR_REGEX
*
* NAME
*
*
* Regular expression matching within the buffer.
*
- * Formatting: SILC_STR_REGEX(char *regex, SilcBufferRegexFlags flags)
- * Unformatting: SILC_STR_REGEX(char *regex, SilcBufferRegexFlags flags)
+ * Formatting: SILC_STR_REGEX(char *regex, SilcBufferRegexFlags flags)
+ * Unformatting: SILC_STR_REGEX(char *regex, SilcBufferRegexFlags flags)
*
* SILC_STR_REGEX can be used to do regular expression matching within
* the SilcBuffer. When the string in the buffer matches the regular
***/
#define SILC_STR_REGEX(regex, flags) SILC_PARAM_REGEX, (regex), (flags)
-/****d* silcutil/SilcBufferFormatAPI/SILC_STR_DELETE
+/****d* silcutil/SILC_STR_DELETE
*
* NAME
*
*
* Use this only for formatting.
*
- * Formatting: SILC_STR_DELETE(int bytes)
+ * Formatting: SILC_STR_DELETE(int bytes)
*
***/
#define SILC_STR_DELETE(x) SILC_PARAM_DELETE, (x)
-/****d* silcutil/SilcBufferFormatAPI/SILC_STR_OFFSET
+/****d* silcutil/SILC_STR_OFFSET
*
* NAME
*
* or backwards (negative offset). It can be used to for example skip
* some types during unformatting.
*
- * Example:
+ * EXAMPLE
*
* ..., SILC_STR_OFFSET(5), ...
* ..., SILC_STR_OFFSET(-3), ...
***/
#define SILC_STR_OFFSET(x) SILC_PARAM_OFFSET, (x)
-/****d* silcutil/SilcBufferFormatAPI/SILC_STR_OFFSET_START
+/****d* silcutil/SILC_STR_OFFSET_START
*
* NAME
*
*
* Moves the buffer position to the start of the data area.
*
- * Example:
+ * EXAMPLE
*
* ..., SILC_STR_OFFSET_START, ...
*
***/
#define SILC_STR_OFFSET_START SILC_PARAM_OFFSET_START
-/****d* silcutil/SilcBufferFormatAPI/SILC_STR_OFFSET_END
+/****d* silcutil/SILC_STR_OFFSET_END
*
* NAME
*
*
* Moves the buffer position to the end of the data area.
*
- * Example:
+ * EXAMPLE
*
* ..., SILC_STR_OFFSET_END, ...
*
***/
#define SILC_STR_OFFSET_END SILC_PARAM_OFFSET_END
-/****d* silcutil/SilcBufferFormatAPI/SILC_STR_ADVANCE
+/****d* silcutil/SILC_STR_ADVANCE
*
* NAME
*
***/
#define SILC_STR_ADVANCE SILC_PARAM_ADVANCE
-/****d* silcutil/SilcBufferFormatAPI/SILC_STR_END
+/****d* silcutil/SILC_STR_END
*
* NAME
*
***/
#define SILC_STR_END SILC_PARAM_END
-/****d* silcutil/SilcBufferFormatAPI/SILC_STRFMT_END
+/****d* silcutil/SILC_STRFMT_END
*
* NAME
*