45 lines
1.2 KiB
C++
45 lines
1.2 KiB
C++
#ifndef ESP32_FIREWALL_HPP
|
|
#define ESP32_FIREWALL_HPP
|
|
|
|
#include "EEPROM.h"
|
|
#include "FirewallTypes.h"
|
|
|
|
#define eeprom_start_firewall_rules 4
|
|
|
|
namespace firewall
|
|
{
|
|
class esp32Firewall
|
|
{
|
|
private:
|
|
uint16_t eeprom_size = 512;
|
|
uint8_t security_number = 93;
|
|
int eeprom_settings_head = 0;
|
|
int eeprom_rules_head = eeprom_start_firewall_rules;
|
|
|
|
void setup_eeprom();
|
|
void eeprom_write_firewall_rules();
|
|
void eeprom_read_firewall_rule(uint8_t &, uint8_t &);
|
|
void eeprom_read_firewall_rules();
|
|
|
|
protected:
|
|
uint8_t amount_of_rules = 0;
|
|
struct firewall_rule *head = NULL;
|
|
|
|
void add_rule_to_firewall(firewall_rule_t *);
|
|
firewall_rule_t *get_rule_from_firewall(uint8_t);
|
|
bool delete_rule_from_firewall(uint8_t);
|
|
|
|
void eeprom_write_firewall_rule(firewall_rule_t *);
|
|
|
|
String protocol_to_string(firewall_protocol_t &);
|
|
firewall_protocol_t string_to_protocol(std::string &);
|
|
String target_to_string(firewall_target_t &);
|
|
firewall_target_t string_to_target(std::string &);
|
|
|
|
public:
|
|
esp32Firewall();
|
|
~esp32Firewall();
|
|
};
|
|
}
|
|
|
|
#endif
|