#include "Firewall.h" ESPFirewall::ESPFirewall() { log_i("Firewall!"); firewall_api->on("/api/v1/firewall", HTTP_GET, std::bind(&ESPFirewall::get_firewall_rules, this)); firewall_api->begin(); } void ESPFirewall::get_firewall_rules() { this->custom_message_response("Firewall", 200); } void ESPFirewall::custom_message_response(const char *message, int response_code) { cJSON *json_response = cJSON_CreateObject(); cJSON_AddBoolToObject(json_response, "ok", true); cJSON_AddStringToObject(json_response, "message", message); firewall_api->send(response_code, "application/json", cJSON_Print(json_response)); cJSON_Delete(json_response); } void ESPFirewall::handle_clients() { this->firewall_api->handleClient(); }