summaryrefslogtreecommitdiff
path: root/netbytes.h
diff options
context:
space:
mode:
Diffstat (limited to 'netbytes.h')
-rw-r--r--netbytes.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/netbytes.h b/netbytes.h
index cab61f6..e4937fb 100644
--- a/netbytes.h
+++ b/netbytes.h
@@ -38,6 +38,9 @@
#define __NBT_SIZE uint32_t
#define __NBT_TYPED uint8_t
#define __NBT_U8ARR_LEN uint16_t
+#define __NBT_U16ARR_LEN uint16_t
+#define __NBT_U32ARR_LEN uint16_t
+#define __NBT_U64ARR_LEN uint16_t
#define __NBT_MINIMAL_SIZE (sizeof(__NBT_SIZE))
#define __NBT_MAX_TYPES (256)
@@ -68,6 +71,51 @@ typedef struct nb_u8arr
uint8_t *val;
} nb_u8arr;
+
+/*-----------------*/
+typedef struct nb_u16
+{
+ __NBT_TYPED type;
+ uint16_t val;
+} nb_u16;
+
+typedef struct nb_u16arr
+{
+ __NBT_TYPED type;
+ __NBT_U16ARR_LEN len;
+ uint16_t *val;
+} nb_u16arr;
+
+
+/*-----------------*/
+typedef struct nb_u32
+{
+ __NBT_TYPED type;
+ uint32_t val;
+} nb_u32;
+
+typedef struct nb_u32arr
+{
+ __NBT_TYPED type;
+ __NBT_U32ARR_LEN len;
+ uint32_t *val;
+} nb_u32arr;
+
+
+/*------------------*/
+typedef struct nb_u64
+{
+ __NBT_TYPED type;
+ uint64_t val;
+} nb_u64;
+
+typedef struct nb_u64arr
+{
+ __NBT_TYPED type;
+ __NBT_U64ARR_LEN len;
+ uint64_t *val;
+} nb_u64arr;
+
//loading/parsing netbyte structure
typedef struct netbyte_load
{
@@ -77,11 +125,23 @@ typedef struct netbyte_load
int nb_u8_create( nb_u8 *s, uint8_t val );
int nb_u8arr_create( nb_u8arr *s, __NBT_U8ARR_LEN len, uint8_t *val );
+int nb_u16_create( nb_u16 *s, uint16_t val );
+int nb_u16arr_create( nb_u16arr *s, __NBT_U16ARR_LEN len, uint16_t *val );
+int nb_u32_create( nb_u32 *s, uint32_t val );
+int nb_u32arr_create( nb_u32arr *s, __NBT_U32ARR_LEN len, uint32_t *val );
+int nb_u64_create( nb_u64 *s, uint64_t val );
+int nb_u64arr_create( nb_u64arr *s, __NBT_U64ARR_LEN len, uint64_t *val );
int nb_init( netbyte_store *store );
int nb_add_u8( netbyte_store *store, nb_u8 *u8 );
int nb_add_u8arr( netbyte_store *store, nb_u8arr *u8arr );
+int nb_add_u16( netbyte_store *store, nb_u16 *u16 );
+int nb_add_u16arr( netbyte_store *store, nb_u16arr *u16arr );
+int nb_add_u32( netbyte_store *store, nb_u32 *u32 );
+int nb_add_u32arr( netbyte_store *store, nb_u32arr *u32arr );
+int nb_add_u64( netbyte_store *store, nb_u64 *u64 );
+int nb_add_u64arr( netbyte_store *store, nb_u64arr *u64arr );
uint8_t *nb_create( netbyte_store *store );
int nb_load( netbyte_store *store, uint8_t *data );