diff options
author | FreeArtMan <dos21h@gmail.com> | 2017-08-22 22:08:56 +0100 |
---|---|---|
committer | FreeArtMan <dos21h@gmail.com> | 2017-08-22 22:08:56 +0100 |
commit | 1885184932474907f67208e12902fc7a64818112 (patch) | |
tree | 03f37b8024179a949890c679126a8295e3aac2b3 /extlibs/netbytes.h | |
parent | 240be5c4bed01c83a8d9168d5dde7d1f4a716986 (diff) | |
download | agni-1885184932474907f67208e12902fc7a64818112.tar.gz agni-1885184932474907f67208e12902fc7a64818112.zip |
update netbyte lib, add rpc lib
Diffstat (limited to 'extlibs/netbytes.h')
-rw-r--r-- | extlibs/netbytes.h | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/extlibs/netbytes.h b/extlibs/netbytes.h index 3960142..6e008bc 100644 --- a/extlibs/netbytes.h +++ b/extlibs/netbytes.h @@ -47,25 +47,25 @@ #define __NBT_MAX_TYPES (256) //creating netbyte structure -typedef struct __nb_type { +typedef struct __attribute__((packed)) __nb_type { __NBT_TYPED type; uint8_t *nb_val; -} __nb_type; +} __nb_type ; -typedef struct netbyte_store +typedef struct __attribute__((packed)) netbyte_store { __NBT_SIZE size; int count; __nb_type types[__NBT_MAX_TYPES]; } netbyte_store; -typedef struct nb_u8 +typedef struct __attribute__((packed)) nb_u8 { __NBT_TYPED type; uint8_t val; } nb_u8; -typedef struct nb_u8arr +typedef struct __attribute__((packed)) nb_u8arr { __NBT_TYPED type; __NBT_U8ARR_LEN len; @@ -74,13 +74,13 @@ typedef struct nb_u8arr /*-----------------*/ -typedef struct nb_u16 +typedef struct __attribute__((packed)) nb_u16 { __NBT_TYPED type; uint16_t val; } nb_u16; -typedef struct nb_u16arr +typedef struct __attribute__((packed)) nb_u16arr { __NBT_TYPED type; __NBT_U16ARR_LEN len; @@ -89,13 +89,13 @@ typedef struct nb_u16arr /*-----------------*/ -typedef struct nb_u32 +typedef struct __attribute__((packed)) nb_u32 { __NBT_TYPED type; uint32_t val; } nb_u32; -typedef struct nb_u32arr +typedef struct __attribute__((packed)) nb_u32arr { __NBT_TYPED type; __NBT_U32ARR_LEN len; @@ -104,13 +104,13 @@ typedef struct nb_u32arr /*------------------*/ -typedef struct nb_u64 +typedef struct __attribute__((packed)) nb_u64 { __NBT_TYPED type; uint64_t val; } nb_u64; -typedef struct nb_u64arr +typedef struct __attribute__((packed)) nb_u64arr { __NBT_TYPED type; __NBT_U64ARR_LEN len; @@ -118,7 +118,7 @@ typedef struct nb_u64arr } nb_u64arr; //loading/parsing netbyte structure -typedef struct netbyte_load +typedef struct __attribute__((packed)) netbyte_load { __NBT_SIZE size; uint8_t *buf; @@ -148,24 +148,24 @@ 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_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_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_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_free(netbyte_store *store); -int nb_load( netbyte_store *store, uint8_t *data ); +int nb_load( netbyte_store *store, uint8_t *data ); int nb_count( netbyte_store *store ); -int nb_type( netbyte_store *store, int count, __NBT_TYPED **type ); -int nb_val( netbyte_store *store, int count, __nb_type **type ); +int nb_type( netbyte_store *store, int count, __NBT_TYPED **type ); +int nb_val( netbyte_store *store, int count, __nb_type **type ); int nb_fread( netbyte_store *store, int fd); //print all all values in netbyte string |