#ifndef FIREWALL_H
#define FIREWALL_H
#include "WebServer.h"
#include "cJSON.h"
#include "esp32-hal-log.h"
typedef struct firewall_rule
{
int key;
char source[IP4ADDR_STRLEN_MAX];
char destination[IP4ADDR_STRLEN_MAX];
char protocol[4];
char target[7];
struct firewall_rule *next;
} firewall_rule_t;
class ESPFirewall
WebServer *firewall_api;
int amount_of_rules;
struct firewall_rule *head;
void setup_routing();
void custom_message_response(const char *message, int response_code);
void prepare_firewall_json(cJSON *jsonResponse, firewall_rule_t *link);
firewall_rule_t *add_rule_to_firewall(char *source, char *destination, char *protocol, char *target);
void get_firewall_rules();
public:
ESPFirewall(int port = 8080);
void handle_clients();
};
#endif