updates.
[silc.git] / lib / silcutil / silcbuffmt.h
index e50e45502ed7d306120ee210ac44009dfe928651..c22b6f05801fc36c5893d2d50a503ea00354d9e1 100644 (file)
@@ -44,6 +44,9 @@ typedef enum {
   SILC_BUFFER_PARAM_SI32_INT,
   SILC_BUFFER_PARAM_UI32_INT,
 
   SILC_BUFFER_PARAM_SI32_INT,
   SILC_BUFFER_PARAM_UI32_INT,
 
+  SILC_BUFFER_PARAM_SI64_INT,
+  SILC_BUFFER_PARAM_UI64_INT,
+
   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_UI16_STRING,        /* No copy */
   SILC_BUFFER_PARAM_UI16_STRING_ALLOC, /* Alloc + memcpy */
   SILC_BUFFER_PARAM_UI32_STRING,       /* No copy */
@@ -73,28 +76,39 @@ typedef enum {
 #define SILC_STR_SI_CHAR(x) SILC_BUFFER_PARAM_SI8_CHAR, (x)
 #define SILC_STR_UI_CHAR(x) SILC_BUFFER_PARAM_UI8_CHAR, (x)
 
 #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)
 
    Formatting:    SILC_STR_SI_SHORT(short)
-                  SILC_STR_UI_SHORT(unsigned short)
+                  SILC_STR_UI_SHORT(uint16)
    Unformatting:  SILC_STR_SI_SHORT(short *)
    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)
 
 
 */
 #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)
 
    Formatting:    SILC_STR_SI_INT(int)
-                  SILC_STR_UI_INT(unsigned int)
+                  SILC_STR_UI_INT(uint32)
    Unformatting:  SILC_STR_SI_INT(int *)
    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)
 #define SILC_STR_UI_INT(x) SILC_BUFFER_PARAM_UI32_INT, (x)
 
 
 */
 #define SILC_STR_SI_INT(x) SILC_BUFFER_PARAM_SI32_INT, (x)
 #define SILC_STR_UI_INT(x) SILC_BUFFER_PARAM_UI32_INT, (x)
 
+/* Signed/uint64. 
+
+   Formatting:    SILC_STR_SI_INT64(int)
+                  SILC_STR_UI_INT64(uint32)
+   Unformatting:  SILC_STR_SI_INT64(int *)
+                  SILC_STR_UI_INT64(uint32 *)
+
+*/
+#define SILC_STR_SI_INT64(x) SILC_BUFFER_PARAM_SI64_INT, (x)
+#define SILC_STR_UI_INT64(x) SILC_BUFFER_PARAM_UI64_INT, (x)
+
 /* Unsigned NULL terminated string. Note that the string must be
    NULL terminated because strlen() will be used to get the length of
    the string. 
 /* Unsigned NULL terminated string. Note that the string must be
    NULL terminated because strlen() will be used to get the length of
    the string. 
@@ -130,8 +144,8 @@ typedef enum {
 
 /* Unsigned string. Second argument is the length of the string.
 
 
 /* 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
 
    Unformatting procedure will check for length of the string from the
    buffer before trying to get the string out. Thus, one *must* format the
@@ -169,7 +183,7 @@ typedef enum {
    the string.
 
    Formatting:    This is equal to using *_NSTRING
    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
 
    This type can be used to take arbitrary length string from the buffer
    by sending the requested amount of bytes as argument. This differs
@@ -192,7 +206,61 @@ typedef enum {
 #define SILC_STR_END SILC_BUFFER_PARAM_END
 
 /* Prototypes */
 #define SILC_STR_END SILC_BUFFER_PARAM_END
 
 /* Prototypes */
+
+/****f* silcutil/SilcBufferFormatAPI/silc_buffer_format
+ *
+ * SYNOPSIS
+ *
+ *    int silc_buffer_format(SilcBuffer dst, ...);
+ *
+ * DESCRIPTION
+ *
+ *    Formats a buffer from a variable argument list.  Returns -1 on error
+ *    and the length of the formatted buffer otherwise.
+ *
+ ***/
 int silc_buffer_format(SilcBuffer dst, ...);
 int silc_buffer_format(SilcBuffer dst, ...);
+
+/****f* silcutil/SilcBufferFormatAPI/silc_buffer_unformat
+ *
+ * SYNOPSIS
+ *
+ *    int silc_buffer_unformat(SilcBuffer src, ...);
+ *
+ * DESCRIPTION
+ *
+ *    Formats a buffer from a variable argument list.  Returns -1 on error
+ *    and the length of the formatted buffer otherwise.
+ *
+ ***/
 int silc_buffer_unformat(SilcBuffer src, ...);
 
 int silc_buffer_unformat(SilcBuffer src, ...);
 
+/****f* silcutil/SilcBufferFormatAPI/silc_buffer_format
+ *
+ * SYNOPSIS
+ *
+ *    int silc_buffer_format_vp(SilcBuffer dst, va_list vp);
+ *
+ * DESCRIPTION
+ *
+ *    Formats a buffer from a variable argument list indicated by the `ap'.
+ *    Returns -1 on error and the length of the formatted buffer otherwise.
+ *
+ ***/
+int silc_buffer_format_vp(SilcBuffer dst, va_list ap);
+
+/****f* silcutil/SilcBufferFormatAPI/silc_buffer_unformat
+ *
+ * SYNOPSIS
+ *
+ *    int silc_buffer_unformat_vp(SilcBuffer src, va_list vp);
+ *
+ * DESCRIPTION
+ *
+ *    Formats a buffer from a variable argument list indicated by the `ap'.
+ *    Returns -1 on error and the length of the formatted buffer otherwise.
+ *
+ ***/
+int silc_buffer_unformat_vp(SilcBuffer src, va_list ap);
+
 #endif
 #endif