upload
This commit is contained in:
+34
@@ -0,0 +1,34 @@
|
||||
#include "IPTable.h"
|
||||
|
||||
IPTable::IPTable()
|
||||
{
|
||||
storage.clear();
|
||||
}
|
||||
|
||||
IPTable::IPTable(const IPTable& obj)
|
||||
{
|
||||
for (auto& ele : obj.storage)
|
||||
storage.insert(ele);
|
||||
}
|
||||
|
||||
void IPTable::Appened(DateTime expr_time, IPList list)
|
||||
{
|
||||
storage.insert(std::pair<DateTime, IPList>(expr_time, list));
|
||||
}
|
||||
|
||||
void IPTable::Update()
|
||||
{
|
||||
DateTime time = DateTime::Now();
|
||||
for (auto it = storage.begin(); it != storage.end(); it++)
|
||||
if ((*it).first.GetTimeStamp() <= time.GetTimeStamp())
|
||||
storage.erase(it);
|
||||
return;
|
||||
}
|
||||
|
||||
bool IPTable::IPExist(std::string ip)
|
||||
{
|
||||
for (auto& ele : storage)
|
||||
if (ele.second.Exist(ip))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
Reference in New Issue
Block a user