#ifndef ESP32_FIREWALL_HPP #define ESP32_FIREWALL_HPP #include "../Utils.hpp" #include "Storage.hpp" #include "WiFiClient.h" #include "lwip/netif.h" #include "lwip/pbuf.h" #include "lwip/ip4.h" #include "lwip/udp.h" #include "lwip/tcp.h" #include "lwip/prot/tcp.h" namespace fw { class Firewall : public Storage { public: Firewall(); ~Firewall(); firewall_rule_t *get_rule_head(); void add_rule_to_firewall(firewall_rule_t *rule_ptr, const bool save_in_eeprom = true); firewall_rule_t *add_rule_to_firewall(String *args); firewall_rule_t *update_rule_of_firewall(String *args, const uint8_t key); firewall_rule_t *get_rule_from_firewall(const uint8_t key); ok_t delete_rule_from_firewall(const uint8_t key); bool is_packet_allowed(struct pbuf *pbuf); protected: bool rule_allows_packet(firewall_rule_t *rule_ptr, my_packet_t *packet); my_packet_t *get_packet_information(struct pbuf *pbuf); uint8_t amount_of_rules = 0; firewall_rule_t *rule_head = NULL; }; } #endif