This repository has been archived on 2024-10-30. You can view files and clone it, but cannot push or open issues or pull requests.
esp-firewall/ESPFirewall/lib/Firewall/src/Firewall.hpp

32 lines
798 B
C++
Raw Normal View History

2022-05-03 20:15:01 +02:00
#ifndef ESP32_FIREWALL_HPP
#define ESP32_FIREWALL_HPP
2022-04-24 00:13:20 +02:00
2022-05-03 20:15:01 +02:00
#include "Utils.hpp"
#include "Storage.hpp"
2022-05-03 20:40:42 +02:00
#include "WiFiClient.h"
2022-04-24 00:13:20 +02:00
namespace fw
{
2022-05-03 20:15:01 +02:00
class Firewall : public Storage
2022-04-24 00:13:20 +02:00
{
public:
2022-05-03 20:15:01 +02:00
Firewall();
2022-04-24 00:13:20 +02:00
~Firewall();
2022-05-03 20:15:01 +02:00
firewall_rule_t *get_rule_head();
void add_rule_to_firewall(firewall_rule_t *rule_ptr, const bool save_in_eeprom = true);
2022-05-04 18:24:22 +02:00
firewall_rule_t *add_rule_to_firewall(String *args);
2022-05-03 20:15:01 +02:00
firewall_rule_t *get_rule_from_firewall(const uint8_t key);
ok_t delete_rule_from_firewall(const uint8_t key);
2022-06-12 14:58:24 +02:00
bool is_included_in_firewall(String &ip, const uint32_t &port);
2022-05-03 20:40:42 +02:00
bool is_client_allowed(WiFiClient client);
2022-05-03 20:15:01 +02:00
protected:
uint8_t amount_of_rules = 0;
firewall_rule_t *rule_head = NULL;
};
2022-04-24 00:13:20 +02:00
}
#endif