9 static const uint8_t IPV4ADDRESS_LENGTH = 16;
10 static const uint8_t CREDENTIALS_LENGTH = 32;
11 static const uint8_t firewall_fields_amount = 6;
12 const char firewall_fields[firewall_fields_amount][10] = {
"key",
"ip",
"port_from",
"port_to",
"protocol",
"target"};
16 typedef enum firewall_targets : uint8_t
24 typedef enum firewall_protocols : uint8_t
29 } firewall_protocol_t;
33 typedef enum ok : uint8_t
42 typedef enum auth : uint8_t
50 typedef struct firewall_rules
53 char ip[IPV4ADDRESS_LENGTH];
56 firewall_protocol_t protocol;
57 firewall_target_t target;
58 struct firewall_rules *next;
63 typedef struct my_packet
65 char ip[IPV4ADDRESS_LENGTH];
66 firewall_protocol_t protocol;
72 typedef enum firewall_fields : uint8_t
84 typedef struct credentials
86 char password[CREDENTIALS_LENGTH];
87 char username[CREDENTIALS_LENGTH];
92 typedef struct api_endpoints
97 struct api_endpoints *next;
106 String protocol_to_string(firewall_protocol_t &protocol);
114 firewall_protocol_t string_to_protocol(String &protocol);
122 String target_to_string(firewall_target_t &target);
130 firewall_target_t string_to_target(String &target);
147 bool is_in_range(
const uint16_t number,
const uint16_t lower,
const uint16_t upper);