typedef struct dp_conf { int pktint; int interval; int debug; int bltime; int queue; int dryrun; } dp_conf; typedef struct dp_accounting { unsigned char remoteid[256]; int len; int count; UT_hash_handle hh; } dp_accounting; typedef struct dp_blacklist { unsigned char remoteid[256]; int len; time_t expire; UT_hash_handle hh; } dp_blacklist; // global hash lists static dp_accounting *accountings = NULL; static dp_blacklist *blacklists = NULL; // timestamp for cleanup interval static time_t dp_accountingtime = 0; static time_t dp_cleanuptime = 0; static int dp_callback ( struct nfq_q_handle*, struct nfgenmsg*, struct nfq_data*, void*); void dp_usage (char*); dp_conf *dp_load_config (dp_conf*, char*); void dp_nfq_start (dp_conf*); void dp_accounting_add (dp_conf*, unsigned char *, int); int dp_accounting_check (dp_conf*, unsigned char *, int); void dp_blacklist_add (dp_conf*, unsigned char *, int); int dp_blacklist_check (dp_conf*, unsigned char *, int); void dp_hash_cleanup (dp_conf*); void dp_log (unsigned char *, int, char *, ...); int dp_dhcp_check (struct nfq_data*, dp_conf*); void dp_dhcpv4_check ( dp_conf*, unsigned char*, int, int, unsigned char**, int*); void dp_dhcpv6_check ( dp_conf*, unsigned char*, int, int, unsigned char**, int*);