cleanup classes
This commit is contained in:
parent
0c7cbae18a
commit
73533e5d15
6 changed files with 43 additions and 2 deletions
11
SourceCode/arduino/lib/Firewall/esp32Eeprom.cpp
Normal file
11
SourceCode/arduino/lib/Firewall/esp32Eeprom.cpp
Normal 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()
|
||||
{
|
||||
}
|
16
SourceCode/arduino/lib/Firewall/esp32Eeprom.hpp
Normal file
16
SourceCode/arduino/lib/Firewall/esp32Eeprom.hpp
Normal 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
|
|
@ -5,6 +5,10 @@ esp32Firewall::esp32Firewall()
|
|||
this->setup_eeprom();
|
||||
}
|
||||
|
||||
esp32Firewall::~esp32Firewall()
|
||||
{
|
||||
}
|
||||
|
||||
String esp32Firewall::protocol_to_string(firewall_protocol_t &protocol)
|
||||
{
|
||||
switch (protocol)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -13,6 +13,10 @@ esp32FirewallApi::esp32FirewallApi(const uint16_t port)
|
|||
}
|
||||
}
|
||||
|
||||
esp32FirewallApi::~esp32FirewallApi()
|
||||
{
|
||||
}
|
||||
|
||||
void esp32FirewallApi::handle_clients()
|
||||
{
|
||||
this->server->loop();
|
||||
|
|
|
@ -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();
|
||||
};
|
||||
|
||||
|
|
Reference in a new issue