From a3c2eb86925cf35ef6b0fbb12249cee6a15060cb Mon Sep 17 00:00:00 2001 From: FreeArtMan Date: Sat, 3 Jun 2017 16:31:12 +0100 Subject: Add type parser --- netbytes.h | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'netbytes.h') diff --git a/netbytes.h b/netbytes.h index 8b332b5..a73dcc6 100644 --- a/netbytes.h +++ b/netbytes.h @@ -5,6 +5,7 @@ #include #include #include +#include #include #include @@ -156,6 +157,28 @@ int nb_fread( netbyte_store *store, int fd); int nb_print(netbyte_store *store); //check if netbyte matches particular format -int nb_match(netbyte_store *store, char *frmt); +int nb_match(netbyte_store *store, int size); + +#define SIGN_UNSIGNED 1 +#define SIGN_SIGNED 2 + +typedef struct nb_tok +{ + int sign; + int type_size; + int len; + int arr; +} nb_tok; + +typedef struct nb_tok_arr +{ + int size; + int len; + nb_tok *tok; +} nb_tok_arr; + +nb_tok_arr *nb_tok_create(int size); +int nb_tok_add(nb_tok_arr *arr, int sign, int type_size, int len, int farr); +void nb_tok_destroy(nb_tok_arr *arr); #endif \ No newline at end of file -- cgit v1.2.3