#ifndef TRIE_HEADER_843762518432898246756 #define TRIE_HEADER_843762518432898246756 #include "stdio.h" #include "stdlib.h" #include "string.h" union ipv6 { unsigned short s[8]; unsigned long l[2]; }; #define VALID_RULE 1 #define INVALID_RULE 0 struct trie_node { struct trie_node* _l; struct trie_node* _r; int _rule:31; unsigned _rule_valid:1; }; struct trie_holder { struct trie_node* _root; size_t _size; }; typedef struct trie_node* trie_node_t; typedef struct trie_holder* trie_holder_t; typedef union ipv6 ipv6_t; typedef int rule_t; struct trie_holder* create_holder(); struct trie_node* create_node(); int destory_holder(struct trie_holder*); int destory_node(struct trie_node*); int trie_insert(struct trie_holder*, const unsigned key[4], int val, int mask); rule_t trie_search(struct trie_holder*, const unsigned key[4]); #endif