cleanup classes

This commit is contained in:
Florian Hoss 2022-04-20 11:40:00 +02:00
parent 0c7cbae18a
commit 73533e5d15
6 changed files with 43 additions and 2 deletions

View file

@ -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()
{
}

View file

@ -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

View file

@ -5,6 +5,10 @@ esp32Firewall::esp32Firewall()
this->setup_eeprom(); this->setup_eeprom();
} }
esp32Firewall::~esp32Firewall()
{
}
String esp32Firewall::protocol_to_string(firewall_protocol_t &protocol) String esp32Firewall::protocol_to_string(firewall_protocol_t &protocol)
{ {
switch (protocol) switch (protocol)

View file

@ -8,6 +8,7 @@
class esp32Firewall class esp32Firewall
{ {
private:
uint16_t eeprom_size = 512; uint16_t eeprom_size = 512;
uint8_t security_number = 93; uint8_t security_number = 93;
int eeprom_settings_head = 0; int eeprom_settings_head = 0;
@ -18,11 +19,10 @@ class esp32Firewall
void eeprom_read_firewall_rule(uint8_t &, uint8_t &); void eeprom_read_firewall_rule(uint8_t &, uint8_t &);
void eeprom_read_firewall_rules(); void eeprom_read_firewall_rules();
public: protected:
uint8_t amount_of_rules = 0; uint8_t amount_of_rules = 0;
struct firewall_rule *head = NULL; struct firewall_rule *head = NULL;
esp32Firewall();
void add_rule_to_firewall(firewall_rule_t *); void add_rule_to_firewall(firewall_rule_t *);
firewall_rule_t *get_rule_from_firewall(uint8_t); firewall_rule_t *get_rule_from_firewall(uint8_t);
bool delete_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 &); firewall_protocol_t string_to_protocol(std::string &);
String target_to_string(firewall_target_t &); String target_to_string(firewall_target_t &);
firewall_target_t string_to_target(std::string &); firewall_target_t string_to_target(std::string &);
public:
esp32Firewall();
~esp32Firewall();
}; };
#endif #endif

View file

@ -13,6 +13,10 @@ esp32FirewallApi::esp32FirewallApi(const uint16_t port)
} }
} }
esp32FirewallApi::~esp32FirewallApi()
{
}
void esp32FirewallApi::handle_clients() void esp32FirewallApi::handle_clients()
{ {
this->server->loop(); this->server->loop();

View file

@ -13,6 +13,7 @@ using namespace httpsserver;
class esp32FirewallApi : public esp32Firewall class esp32FirewallApi : public esp32Firewall
{ {
private:
HTTPSServer *server; HTTPSServer *server;
SSLCert *certificate; SSLCert *certificate;
@ -33,6 +34,7 @@ class esp32FirewallApi : public esp32Firewall
public: public:
esp32FirewallApi(const uint16_t = 8080); esp32FirewallApi(const uint16_t = 8080);
~esp32FirewallApi();
void handle_clients(); void handle_clients();
}; };