diff options
author | Jonas Gunz <himself@jonasgunz.de> | 2019-12-20 13:50:42 +0100 |
---|---|---|
committer | Jonas Gunz <himself@jonasgunz.de> | 2019-12-20 13:50:42 +0100 |
commit | 9dc2a544f88ddedea24d16f05170cb90858c3e9a (patch) | |
tree | 08b296c874aaa9780527a27ef9985f15ecc2e2ac /src/zonefile.h | |
parent | 5124da870f85b23ea8e46d48a9cccc38df6323fb (diff) | |
download | dns-9dc2a544f88ddedea24d16f05170cb90858c3e9a.tar.gz |
started rousource record storeage and query
Diffstat (limited to 'src/zonefile.h')
-rw-r--r-- | src/zonefile.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/zonefile.h b/src/zonefile.h new file mode 100644 index 0000000..94a0de7 --- /dev/null +++ b/src/zonefile.h @@ -0,0 +1,47 @@ +/* + * zonefile.h + * (c) 2019 Jonas Gunz + * License: MIT + * */ + +#pragma once + +#include <stdint.h> +#include <stdlib.h> + +struct record_entry { + char* name; + uint32_t ttl; + uint16_t class; + uint16_t type; + uint16_t rdlength; + char* rd; +}; + +struct record_node { + struct record_entry* rr; + struct record_node* below; + struct record_node* above; +}; + +/** + * */ +int zonefile_parse ( char* _filename, struct record_node* _dns_zone ); + +int zonefile_query ( char* _hostname, struct record_entry* _entry ); + +static int tree_insert ( struct record_node* _root, struct record_entry* _node ); + +static int tree_balance ( struct record_node* _root ); + +static struct record_entry* tree_get ( struct record_node* _root, char* _query ); + +static int tree_destroy ( struct record_node* _root ); + +/** + * returns: + * 0 :: _1 == _2 + * -1 :: _1 < _2 + * +1 :: _1 > _2 + * */ +int string_compare ( char* _1, char* _2 ); |