ripList.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #pragma once
  2. #ifndef ripList_H_
  3. #define ripList_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 ripList
  8. {
  9. private:
  10. class impl;
  11. impl *m_impl;
  12. public:
  13. struct rip_t
  14. {
  15. uniString::utf8 m_numericIP;
  16. uniString::utf8 m_hostIP; // used to hold the converted IP from a hostname
  17. size_t m_stream_ID; // used to differentiate
  18. rip_t(const uniString::utf8 &numericIP, const size_t stream_ID) throw() : m_numericIP(numericIP), m_stream_ID(stream_ID) {}
  19. rip_t() throw() : m_stream_ID(0) {}
  20. };
  21. // throws if parameters are invalid
  22. bool add(const uniString::utf8 &ipAddr, const size_t stream_ID, const bool soft) throw(std::exception);
  23. // true if removed
  24. bool remove(const uniString::utf8 &ipAddr, const size_t stream_ID, const bool allStream) throw();
  25. // true if found
  26. bool find(const uniString::utf8 &ipAddr, const size_t stream_ID) throw();
  27. bool load(const uniFile::filenameType &fn, const size_t stream_ID) throw();
  28. bool save(const uniFile::filenameType &fn, const size_t stream_ID) throw();
  29. ripList();
  30. ~ripList() throw();
  31. // for web administration reference
  32. void get(std::vector<rip_t> &rl, size_t stream_ID) throw();
  33. };
  34. extern ripList g_ripList;
  35. #endif