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/esp32Storage.hpp

37 lines
838 B
C++
Raw Normal View History

2022-04-20 14:37:21 +02:00
#ifndef ESP32_STORAGE_HPP
#define ESP32_STORAGE_HPP
2022-04-20 11:40:00 +02:00
#include "EEPROM.h"
2022-04-20 13:08:12 +02:00
#include "FirewallTypes.h"
2022-04-20 14:37:21 +02:00
#include "mbedtls/md.h"
2022-04-20 11:40:00 +02:00
2022-04-20 13:08:12 +02:00
namespace firewall
2022-04-20 11:40:00 +02:00
{
2022-04-20 13:08:12 +02:00
class Storage
{
private:
uint16_t eeprom_size;
uint16_t settings_start = 0;
uint16_t settings_head = settings_start;
2022-04-20 14:37:21 +02:00
uint16_t rules_start = 100;
2022-04-20 13:08:12 +02:00
uint16_t rules_head = rules_start;
2022-04-20 14:37:21 +02:00
uint16_t certificate_start = 800;
2022-04-20 13:08:12 +02:00
uint16_t certificate_head = certificate_start;
2022-04-20 11:40:00 +02:00
2022-04-20 14:37:21 +02:00
void clear_eeprom();
void get_eeprom_hash();
unsigned char *Storage::get_hash(const char *);
2022-04-20 13:08:12 +02:00
protected:
uint8_t amount_of_rules;
uint8_t get_amount_of_firewall_rules();
void set_amount_of_firewall_rules(const uint8_t);
public:
2022-04-20 14:37:21 +02:00
Storage(const uint16_t = 1000);
2022-04-20 13:08:12 +02:00
~Storage();
};
}
2022-04-20 11:40:00 +02:00
#endif