diff --git a/SourceCode/arduino/lib/Firewall/esp32Eeprom.cpp b/SourceCode/arduino/lib/Firewall/esp32Eeprom.cpp new file mode 100644 index 0000000..51c99ee --- /dev/null +++ b/SourceCode/arduino/lib/Firewall/esp32Eeprom.cpp @@ -0,0 +1,11 @@ +#include "esp32Eeprom.hpp" + +esp32Eeprom::esp32Eeprom(const uint16_t eeprom_size) +{ + this->eeprom_size = eeprom_size; + EEPROM.begin(this->eeprom_size); +} + +esp32Eeprom::~esp32Eeprom() +{ +} diff --git a/SourceCode/arduino/lib/Firewall/esp32Eeprom.hpp b/SourceCode/arduino/lib/Firewall/esp32Eeprom.hpp new file mode 100644 index 0000000..17ed859 --- /dev/null +++ b/SourceCode/arduino/lib/Firewall/esp32Eeprom.hpp @@ -0,0 +1,16 @@ +#ifndef ESP32_EEPROM_HPP +#define ESP32_EEPROM_HPP + +#include "EEPROM.h" + +class esp32Eeprom +{ +private: + uint16_t eeprom_size; + +public: + esp32Eeprom(const uint16_t); + ~esp32Eeprom(); +}; + +#endif diff --git a/SourceCode/arduino/lib/Firewall/esp32Firewall.cpp b/SourceCode/arduino/lib/Firewall/esp32Firewall.cpp index d77e67a..6793a9d 100644 --- a/SourceCode/arduino/lib/Firewall/esp32Firewall.cpp +++ b/SourceCode/arduino/lib/Firewall/esp32Firewall.cpp @@ -5,6 +5,10 @@ esp32Firewall::esp32Firewall() this->setup_eeprom(); } +esp32Firewall::~esp32Firewall() +{ +} + String esp32Firewall::protocol_to_string(firewall_protocol_t &protocol) { switch (protocol) diff --git a/SourceCode/arduino/lib/Firewall/esp32Firewall.hpp b/SourceCode/arduino/lib/Firewall/esp32Firewall.hpp index 800f533..a9c6b39 100644 --- a/SourceCode/arduino/lib/Firewall/esp32Firewall.hpp +++ b/SourceCode/arduino/lib/Firewall/esp32Firewall.hpp @@ -8,6 +8,7 @@ class esp32Firewall { +private: uint16_t eeprom_size = 512; uint8_t security_number = 93; int eeprom_settings_head = 0; @@ -18,11 +19,10 @@ class esp32Firewall void eeprom_read_firewall_rule(uint8_t &, uint8_t &); void eeprom_read_firewall_rules(); -public: +protected: uint8_t amount_of_rules = 0; struct firewall_rule *head = NULL; - esp32Firewall(); void add_rule_to_firewall(firewall_rule_t *); firewall_rule_t *get_rule_from_firewall(uint8_t); bool delete_rule_from_firewall(uint8_t); @@ -33,6 +33,10 @@ public: 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 diff --git a/SourceCode/arduino/lib/Firewall/esp32FirewallAPI.cpp b/SourceCode/arduino/lib/Firewall/esp32FirewallAPI.cpp index 591e42b..c5275ff 100644 --- a/SourceCode/arduino/lib/Firewall/esp32FirewallAPI.cpp +++ b/SourceCode/arduino/lib/Firewall/esp32FirewallAPI.cpp @@ -13,6 +13,10 @@ esp32FirewallApi::esp32FirewallApi(const uint16_t port) } } +esp32FirewallApi::~esp32FirewallApi() +{ +} + void esp32FirewallApi::handle_clients() { this->server->loop(); diff --git a/SourceCode/arduino/lib/Firewall/esp32FirewallAPI.hpp b/SourceCode/arduino/lib/Firewall/esp32FirewallAPI.hpp index 95672a9..238ab57 100644 --- a/SourceCode/arduino/lib/Firewall/esp32FirewallAPI.hpp +++ b/SourceCode/arduino/lib/Firewall/esp32FirewallAPI.hpp @@ -13,6 +13,7 @@ using namespace httpsserver; class esp32FirewallApi : public esp32Firewall { +private: HTTPSServer *server; SSLCert *certificate; @@ -33,6 +34,7 @@ class esp32FirewallApi : public esp32Firewall public: esp32FirewallApi(const uint16_t = 8080); + ~esp32FirewallApi(); void handle_clients(); };