adminList.h 972 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #pragma once
  2. #ifndef adminList_H_
  3. #define adminList_H_
  4. #include "unicode/uniFile.h"
  5. // class that manages lists of reserved IPs
  6. // these are remote addresses that must always be allowed in no matter what.
  7. class adminList
  8. {
  9. private:
  10. class impl;
  11. impl *m_impl;
  12. public:
  13. struct admin_t
  14. {
  15. uniString::utf8 m_numericIP;
  16. uniString::utf8 m_hostIP; // used to hold the converted IP from a hostname
  17. explicit admin_t(const uniString::utf8 &numericIP) throw() : m_numericIP(numericIP) {}
  18. admin_t() throw() {}
  19. };
  20. // throws if parameters are invalid
  21. bool add(const uniString::utf8 &ipAddr, const bool soft) throw(std::exception);
  22. // true if removed
  23. bool remove(const uniString::utf8 &ipAddr, const bool allStream) throw();
  24. // 1 if found, 0 if not, -1 if empty (assume allowed)
  25. int find(const uniString::utf8 &ipAddr) throw();
  26. bool load(const uniFile::filenameType &fn) throw();
  27. adminList();
  28. ~adminList() throw();
  29. };
  30. extern adminList g_adminList;
  31. #endif