diff options
author | FreeArtMan <dos21h@gmail.com> | 2017-06-03 16:31:12 +0100 |
---|---|---|
committer | FreeArtMan <dos21h@gmail.com> | 2017-06-03 16:31:12 +0100 |
commit | a3c2eb86925cf35ef6b0fbb12249cee6a15060cb (patch) | |
tree | 641262b323159f85adfcb79143f4fbec79436083 /netbytes.h | |
parent | a877a8ed7b508eb8cc5f7911dfcec8b8612470b3 (diff) | |
download | netbytes-a3c2eb86925cf35ef6b0fbb12249cee6a15060cb.tar.gz netbytes-a3c2eb86925cf35ef6b0fbb12249cee6a15060cb.zip |
Add type parser
Diffstat (limited to 'netbytes.h')
-rw-r--r-- | netbytes.h | 25 |
1 files changed, 24 insertions, 1 deletions
@@ -5,6 +5,7 @@ #include <stdio.h> #include <stdint.h> #include <string.h> +#include <ctype.h> #include <sys/types.h> #include <unistd.h> @@ -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 |