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/SourceCode/arduino/lib/Firewall/esp32Firewall.hpp

43 lines
1 KiB
C++
Raw Normal View History

2022-04-19 21:26:43 +02:00
#ifndef ESP32_FIREWALL_HPP
#define ESP32_FIREWALL_HPP
2022-04-10 20:46:54 +02:00
2022-04-18 11:16:01 +02:00
#include "EEPROM.h"
2022-04-19 21:15:55 +02:00
#include "FirewallTypes.h"
2022-04-18 17:35:52 +02:00
#define eeprom_start_firewall_rules 4
2022-04-19 21:26:43 +02:00
class esp32Firewall
2022-04-10 20:46:54 +02:00
{
2022-04-20 11:40:00 +02:00
private:
2022-04-18 13:11:02 +02:00
uint16_t eeprom_size = 512;
uint8_t security_number = 93;
2022-04-18 17:35:52 +02:00
int eeprom_settings_head = 0;
int eeprom_rules_head = eeprom_start_firewall_rules;
2022-04-11 21:27:27 +02:00
2022-04-18 13:11:02 +02:00
void setup_eeprom();
void eeprom_write_firewall_rules();
void eeprom_read_firewall_rule(uint8_t &, uint8_t &);
2022-04-18 13:11:02 +02:00
void eeprom_read_firewall_rules();
2022-04-18 11:16:01 +02:00
2022-04-20 11:40:00 +02:00
protected:
2022-04-20 08:17:55 +02:00
uint8_t amount_of_rules = 0;
struct firewall_rule *head = NULL;
2022-04-11 21:27:27 +02:00
void add_rule_to_firewall(firewall_rule_t *);
firewall_rule_t *get_rule_from_firewall(uint8_t);
bool delete_rule_from_firewall(uint8_t);
2022-04-11 21:27:27 +02:00
2022-04-20 08:17:55 +02:00
void eeprom_write_firewall_rule(firewall_rule_t *);
2022-04-10 20:46:54 +02:00
2022-04-20 08:17:55 +02:00
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 &);
2022-04-20 11:40:00 +02:00
public:
esp32Firewall();
~esp32Firewall();
2022-04-10 20:46:54 +02:00
};
#endif