#include "Utils.hpp" namespace fw { String protocol_to_string(firewall_protocol_t &protocol) { switch (protocol) { case PROTOCOL_TCP: return "TCP"; case PROTOCOL_UDP: return "UDP"; default: return "ALL"; } } firewall_protocol_t string_to_protocol(String &protocol) { if (protocol.equals("TCP")) return PROTOCOL_TCP; else if (protocol.equals("UDP")) return PROTOCOL_UDP; else return PROTOCOL_ALL; } String target_to_string(firewall_target_t &target) { switch (target) { case TARGET_REJECT: return "REJECT"; case TARGET_DROP: return "DROP"; default: return "ACCEPT"; } } firewall_target_t string_to_target(String &target) { if (target.equals("REJECT")) return TARGET_REJECT; else if (target.equals("DROP")) return TARGET_DROP; else return TARGET_ACCEPT; } void endless_loop() { Serial.printf("Something went wrong. Running endless loop until fixed..."); while (true) delay(500); } }