31 lines
798 B
C++
31 lines
798 B
C++
#ifndef ESP32_FIREWALL_HPP
|
|
#define ESP32_FIREWALL_HPP
|
|
|
|
#include "Utils.hpp"
|
|
#include "Storage.hpp"
|
|
#include "WiFiClient.h"
|
|
|
|
namespace fw
|
|
{
|
|
class Firewall : public Storage
|
|
{
|
|
public:
|
|
Firewall();
|
|
~Firewall();
|
|
|
|
firewall_rule_t *get_rule_head();
|
|
void add_rule_to_firewall(firewall_rule_t *rule_ptr, const bool save_in_eeprom = true);
|
|
firewall_rule_t *add_rule_to_firewall(String *args);
|
|
firewall_rule_t *get_rule_from_firewall(const uint8_t key);
|
|
ok_t delete_rule_from_firewall(const uint8_t key);
|
|
|
|
bool is_included_in_firewall(String &ip, const uint32_t &port);
|
|
bool is_client_allowed(WiFiClient client);
|
|
|
|
protected:
|
|
uint8_t amount_of_rules = 0;
|
|
firewall_rule_t *rule_head = NULL;
|
|
};
|
|
}
|
|
|
|
#endif
|