123456789101112131415161718192021 |
- #ifndef __IPTABLES_H
- #define __IPTABLES_H
- #include "IPAddress.h"
- #include "Tree.h"
- #include <forward_list>
- class IPTables
- {
- public:
- static const char *IPSetName(); // This is the list name that will be used in ipset to store the IPs to ban.
- static bool ReadFromIptables(Tree<IPAddress> &tree,bool useIpset,bool readAll); // Reads all the IPs from the iptables program.
- static void CreateIpsetSetname(); // // Create the ipset name. The program must already know it doesn't exist before calling.
- static void MakeSureIptablesHasIpsetRule(); // Make sure iptables has the right ban rule for ipset.
- static void BanThisIP(IPAddress &ip,bool useIpset); // Ban this IP using ipset or iptables.
- static void ClearCurrent(bool useIpset); // Clear the current list of IPs from iptables or ipset.
- static void ClearIPList(std::forward_list<IPAddress*> *ipList,bool useIpset); // Clears a list of IPs from iptables or ipset.
- static void BanIPsUsingRestore(std::forward_list<IPAddress*> &ipsToAddFast,bool shouldAdd); // Ban a list of IPs using ipset and restore.
- static IPAddress* Parse(const char *line,bool fromIPset); // Convert a line from iptables or ipset to an IPAddress object.
- };
- #endif
|