simplify
This commit is contained in:
parent
09a04b60a9
commit
3cf4f4445a
3 changed files with 10 additions and 16 deletions
|
@ -187,12 +187,12 @@ namespace fw
|
|||
return false;
|
||||
else
|
||||
{
|
||||
return this->server->hasArg("source") ||
|
||||
this->server->hasArg("destination") ||
|
||||
this->server->hasArg("protocol") ||
|
||||
this->server->hasArg("port_from") ||
|
||||
this->server->hasArg("port_to") ||
|
||||
this->server->hasArg("target");
|
||||
for (uint8_t i = 0; i < firewall_fields_amount; i++)
|
||||
{
|
||||
if (!this->server->hasArg(firewall_fields[i]))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -54,11 +54,6 @@ namespace fw
|
|||
uint16_t server_port;
|
||||
void handle_client();
|
||||
String get_url_base();
|
||||
String protocol_to_string(firewall_protocol_t &protocol);
|
||||
firewall_protocol_t string_to_protocol(String &protocol);
|
||||
String target_to_string(firewall_target_t &target);
|
||||
firewall_target_t string_to_target(String &target);
|
||||
String response_code_to_string(const uint16_t response_code);
|
||||
|
||||
public:
|
||||
API(const char *cert, const char *key, const char *username, const char *password, const String ip, const uint16_t port);
|
||||
|
|
|
@ -39,16 +39,15 @@ namespace fw
|
|||
uint8_t key;
|
||||
char source[IPV4ADDRESS_LENGTH];
|
||||
char destination[IPV4ADDRESS_LENGTH];
|
||||
uint16_t port_from; // port is max 65565
|
||||
uint16_t port_to;
|
||||
uint32_t port_from; // port can be max 65565
|
||||
uint32_t port_to; // range of uint16_t: 0 to 65535
|
||||
firewall_protocol_t protocol;
|
||||
firewall_target_t target;
|
||||
struct firewall_rules *next;
|
||||
} firewall_rule_t;
|
||||
|
||||
const byte numChars = 12;
|
||||
const char firewall_fields[][numChars] = {
|
||||
"key",
|
||||
static const uint8_t firewall_fields_amount = 6;
|
||||
const char firewall_fields[firewall_fields_amount][12] = {
|
||||
"source",
|
||||
"destination",
|
||||
"port_from",
|
||||
|
|
Reference in a new issue