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/Firewall.h
2022-04-11 11:47:50 +02:00

36 lines
828 B
C++

#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