aboutsummaryrefslogtreecommitdiffstats
path: root/tool/PGListUtil/src/common/CIpList.h
diff options
context:
space:
mode:
authoru <u@noreply.codeberg.org>2020-11-11 03:32:05 +0100
committeru <u@noreply.codeberg.org>2020-11-11 03:32:05 +0100
commit359887b8afb8892f01f72a05ff63a88a6ffa9f4f (patch)
tree3e29683931748021dbcdfcf2d8e88541b221e082 /tool/PGListUtil/src/common/CIpList.h
parentab384049a1eda8c7676ef93771e0e040f08c880f (diff)
parentb346040be73f9e28998fde6fc27467ff24c0abad (diff)
downloadcloudflare-tor-359887b8afb8892f01f72a05ff63a88a6ffa9f4f.tar.lz
cloudflare-tor-359887b8afb8892f01f72a05ff63a88a6ffa9f4f.tar.xz
cloudflare-tor-359887b8afb8892f01f72a05ff63a88a6ffa9f4f.zip
🙆
Diffstat (limited to 'tool/PGListUtil/src/common/CIpList.h')
-rw-r--r--tool/PGListUtil/src/common/CIpList.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/tool/PGListUtil/src/common/CIpList.h b/tool/PGListUtil/src/common/CIpList.h
new file mode 100644
index 00000000..591c3877
--- /dev/null
+++ b/tool/PGListUtil/src/common/CIpList.h
@@ -0,0 +1,56 @@
+#ifndef CIPLIST_H
+#define CIPLIST_H
+
+#include <boost/pool/pool.hpp>
+#include <boost/xpressive/xpressive.hpp>
+#include "common.h"
+#include "CFilter.h"
+
+namespace pglu {
+namespace ip {
+
+struct CIp {
+ char * caption;
+ union {
+ ulong ip64;
+ uint ip32[2];
+ uchar ip8[8];
+ };
+ CIp * next;
+};
+
+class CIpList {
+private:
+ boost::pool<> m_poolIp;
+ CIp m_ipHead;
+ CIp * m_ipFoot;
+
+ filter::CFilter m_filter;
+
+ int m_count;
+ int m_countDisabled;
+
+ CIp * CreateIp(boost::xpressive::cmatch & match);
+
+public:
+ CIpList();
+ ~CIpList();
+
+ void Clear();
+
+ void SetFilter(const char *filter, const filter::EFilterMode mode, const bool del);
+ void UnSetFilter();
+
+ bool LoadListFile(const char *path);
+ bool SaveListFile(const char *path, const bool append);
+
+ void CheckAndSort(const bool sortCap, const bool sortIp, const bool delDupIp);
+
+ int Count();
+ int CountDisabled();
+};
+
+} // namespace ip
+} // namespace pglu
+
+#endif // CIPLIST_H