blacklist.h 791 B

1234567891011121314151617181920212223242526272829303132333435
  1. #include <stdlib.h>
  2. #include <stdint.h>
  3. #ifndef BLACKLIST_H
  4. #define BLACKLIST_H
  5. typedef struct bl_cidr_node {
  6. uint32_t ip_address;
  7. int prefix_len;
  8. struct bl_cidr_node *next;
  9. } bl_cidr_node_t;
  10. uint32_t blacklist_lookup_index(uint64_t index);
  11. int blacklist_is_allowed(uint32_t s_addr);
  12. void blacklist_prefix(char *ip, int prefix_len);
  13. void whitelist_prefix(char *ip, int prefix_len);
  14. int blacklist_init(char *whitelist, char *blacklist,
  15. char **whitelist_entries,
  16. size_t whitelist_entries_len,
  17. char **blacklist_entries,
  18. size_t blacklist_entries_len,
  19. int ignore_invalid_hosts);
  20. uint64_t blacklist_count_allowed();
  21. uint64_t blacklist_count_not_allowed();
  22. bl_cidr_node_t *get_blacklisted_cidrs(void);
  23. bl_cidr_node_t *get_whitelisted_cidrs(void);
  24. #endif