/* * firewall_list.h */ #include #include #include #include #include #include #include #include #include #include #include #include "constants.h" #include "ipq.h" #define NULL 0 #define NIPQUAD(addr) \ ((unsigned char *)&addr)[0], \ ((unsigned char *)&addr)[1], \ ((unsigned char *)&addr)[2], \ ((unsigned char *)&addr)[3] struct ipq_list_node { ipq_id_t n; struct ipq_list_node *next; }; struct ipq_list_head { struct ipq_list_node *head; struct ipq_list_node *tail; }; struct printable_buffer { char *buff; int offset; }; /*list manipulating functions here*/ struct ipq_list_node *create_node(void); void init_list(struct ipq_list_head **iplh); void add_to_list(struct ipq_list_head **iplh, struct ipq_list_node *ipln); void remove_from_list(struct ipq_list_head **iplh, struct ipq_list_node *ipln); void destroy_list(struct ipq_list_head **iplh); int apply_function_to_list(struct ipq_list_head **iplh, int (*func)(struct ipq_list_node *, void *), void *param); int check_list_for_duplicates(struct ipq_list_head **iplh, int (*func)(struct ipq_list_node *, void *), void *param); int test_func(struct ipq_list_node *gln, void *param); /******************************************************************************* * New functions to make this a list of lists. Actually an array containing the * list headers *******************************************************************************/ struct _ipq_list { ipq_list_head *ipqlst; unsigned int daddr; /*address queried for*/ int timer; }; /*in our current scenarios we are not gonna overshoot this*/ class IPQ_LIST { private: /*void getNewList();*/ /*void deleteList(ip_address);*/ //dont need this struct _ipq_list ipqList[1000]; int index; public: IPQ_LIST() { index = -1; } void printAll(); int isDestSeen(unsigned int ipAddr); void decrementTimer(int timeout); int nf_dropList(unsigned int ipAddr); int insertInList(unsigned int ipAddr, ipq_id_t id/*fix this type*/); int nf_acceptList(unsigned int ipAddr); int getTimerValue (int num); };