_SI_ = signed
_UI_ = unsigned
+ Any XXX_STRING_ALLOC types will allocate space for the data and
+ memcpy the data to the pointer sent as argument (in unformatting).
+
+ Any XXX_STRING will not allocate or copy any data. Instead it
+ will set the pointer to the data. Note that the data pointer
+ returned (in unformatting) must not be freed.
+
*/
typedef enum {
SILC_BUFFER_PARAM_SI8_CHAR,
SILC_BUFFER_PARAM_SI32_INT,
SILC_BUFFER_PARAM_UI32_INT,
- SILC_BUFFER_PARAM_UI16_STRING,
- SILC_BUFFER_PARAM_UI16_STRING_ALLOC,
- SILC_BUFFER_PARAM_UI32_STRING,
- SILC_BUFFER_PARAM_UI32_STRING_ALLOC,
- SILC_BUFFER_PARAM_UI16_NSTRING,
- SILC_BUFFER_PARAM_UI16_NSTRING_ALLOC,
- SILC_BUFFER_PARAM_UI32_NSTRING,
- SILC_BUFFER_PARAM_UI32_NSTRING_ALLOC,
- SILC_BUFFER_PARAM_UI_XNSTRING,
- SILC_BUFFER_PARAM_UI_XNSTRING_ALLOC,
+ SILC_BUFFER_PARAM_UI16_STRING, /* No copy */
+ SILC_BUFFER_PARAM_UI16_STRING_ALLOC, /* Alloc + memcpy */
+ SILC_BUFFER_PARAM_UI32_STRING, /* No copy */
+ SILC_BUFFER_PARAM_UI32_STRING_ALLOC, /* Alloc + memcpy */
+ SILC_BUFFER_PARAM_UI16_NSTRING, /* No copy */
+ SILC_BUFFER_PARAM_UI16_NSTRING_ALLOC, /* Alloc + memcpy */
+ SILC_BUFFER_PARAM_UI32_NSTRING, /* No copy */
+ SILC_BUFFER_PARAM_UI32_NSTRING_ALLOC, /* Alloc + memcpy */
+ SILC_BUFFER_PARAM_UI_XNSTRING, /* No copy */
+ SILC_BUFFER_PARAM_UI_XNSTRING_ALLOC, /* Alloc + memcpy */
SILC_BUFFER_PARAM_END
} SilcBufferParamType;
#define SILC_STR_SI_CHAR(x) SILC_BUFFER_PARAM_SI8_CHAR, (x)
#define SILC_STR_UI_CHAR(x) SILC_BUFFER_PARAM_UI8_CHAR, (x)
-/* Signed/unsigned short.
+/* Signed/uint16.
Formatting: SILC_STR_SI_SHORT(short)
- SILC_STR_UI_SHORT(unsigned short)
+ SILC_STR_UI_SHORT(uint16)
Unformatting: SILC_STR_SI_SHORT(short *)
- SILC_STR_UI_SHORT(unsigned short *)
+ SILC_STR_UI_SHORT(uint16 *)
*/
#define SILC_STR_SI_SHORT(x) SILC_BUFFER_PARAM_SI16_SHORT, (x)
#define SILC_STR_UI_SHORT(x) SILC_BUFFER_PARAM_UI16_SHORT, (x)
-/* Signed/unsigned int.
+/* Signed/uint32.
Formatting: SILC_STR_SI_INT(int)
- SILC_STR_UI_INT(unsigned int)
+ SILC_STR_UI_INT(uint32)
Unformatting: SILC_STR_SI_INT(int *)
- SILC_STR_UI_INT(unsigned int *)
+ SILC_STR_UI_INT(uint32 *)
*/
#define SILC_STR_SI_INT(x) SILC_BUFFER_PARAM_SI32_INT, (x)
/* Unsigned string. Second argument is the length of the string.
- Formatting: SILC_STR_UI32_NSTRING(unsigned char *, unsigned int)
- Unformatting: SILC_STR_UI32_NSTRING(unsigned char **, unsigned int *)
+ Formatting: SILC_STR_UI32_NSTRING(unsigned char *, uint32)
+ Unformatting: SILC_STR_UI32_NSTRING(unsigned char **, uint32 *)
Unformatting procedure will check for length of the string from the
buffer before trying to get the string out. Thus, one *must* format the
the string.
Formatting: This is equal to using *_NSTRING
- Unformatting: SILC_STR_UI_XNSTRING(unsigned char **, unsigned int)
+ Unformatting: SILC_STR_UI_XNSTRING(unsigned char **, uint32)
This type can be used to take arbitrary length string from the buffer
by sending the requested amount of bytes as argument. This differs
#define SILC_STR_UI_XNSTRING_ALLOC(x, l) \
SILC_BUFFER_PARAM_UI_XNSTRING_ALLOC, (x), (l)
-/* Marks end of the argument list. This must the at the end of the
+/* Marks end of the argument list. This must be at the end of the
argument list or error will occur. */
#define SILC_STR_END SILC_BUFFER_PARAM_END