Advertisement
Ghostriax-Atrocity

RBL.h

Apr 11th, 2015
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. #ifndef RBL_H
  2. #define RBL_H
  3.  
  4. class RBL
  5. {
  6. public:
  7. bool check(const char* ip);
  8. private:
  9. struct IP2TYPE
  10. {
  11. const char* type;
  12. const IP4_ADDRESS ip;
  13. };
  14. struct RBLINFO
  15. {
  16. const IP2TYPE* types;
  17. unsigned int numberOfTypes;
  18. const char* domain;
  19. };
  20.  
  21. /*
  22. \brief Returns a RBL server to do the lookup on - for now only SpamHaus ZEN
  23. */
  24. void get_RBL_info(RBLINFO* info);
  25.  
  26. /*
  27. \brief This function does the actual lookup.
  28. \param name The domain to lookup.
  29. \param result The resulting IP
  30. \return True if the domain could be resolved to a IP - in that case the result needs to be checked further.
  31. If it returns false the IP isn't blacklisted
  32. */
  33. bool lookup(const char* name, PIP4_ADDRESS result);
  34. /*
  35. \brief The RBL server expects the IP reversed. This function builds the lookup domain
  36. \param ip The IP which shall be looked up
  37. \param end What shall be appended to build the final lookup domain
  38. \param result Output param.
  39. */
  40. void build_request_domain(const std::string& ip, const std::string& end, std::string& result);
  41. };
  42. #endif // RBL_H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement