#ifndef TRIE_HEADER_843762518432898246756 #define TRIE_HEADER_843762518432898246756 #include "stdio.h" #include "stdlib.h" #include "string.h" #define VALID_RULE 1 #define INVALID_RULE 0 #define RULE_NOT_FOUND -1 union ipv6 { unsigned short s[8]; unsigned int i[4]; unsigned long l[2]; }; struct trie_node { struct trie_node* _l; struct trie_node* _r; unsigned _rule:16; 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*, ipv6_t key, int val, int mask); rule_t trie_search(struct trie_holder*, ipv6_t key); #endif