move files around
This commit is contained in:
parent
4594215a23
commit
a7540a9504
45 changed files with 21 additions and 3337 deletions
56
ESPFirewall/lib/Firewall/src/Utils.hpp
Normal file
56
ESPFirewall/lib/Firewall/src/Utils.hpp
Normal file
|
@ -0,0 +1,56 @@
|
|||
#ifndef UTILS_HPP
|
||||
#define UTILS_HPP
|
||||
|
||||
#include "string"
|
||||
#include "WString.h"
|
||||
#include "esp32-hal-log.h"
|
||||
|
||||
static const uint8_t IPV4ADDRESS_LENGTH = 16;
|
||||
|
||||
typedef enum firewall_targets : uint8_t
|
||||
{
|
||||
FW_REJECT = 0,
|
||||
FW_DROP = 1,
|
||||
FW_ACCEPT = 2,
|
||||
} firewall_target_t;
|
||||
|
||||
typedef enum firewall_protocols : uint8_t
|
||||
{
|
||||
FW_TCP = 0,
|
||||
FW_UDP = 1,
|
||||
FW_ALL = 255,
|
||||
} firewall_protocol_t;
|
||||
|
||||
typedef enum ok : uint8_t
|
||||
{
|
||||
SUCCESS = 0,
|
||||
ERROR = 1,
|
||||
NO_ACTION = 2,
|
||||
} ok_t;
|
||||
|
||||
typedef enum auth : uint8_t
|
||||
{
|
||||
AUTHENTICATED = 0,
|
||||
DENIED = 1,
|
||||
} auth_t;
|
||||
|
||||
typedef struct firewall_rules
|
||||
{
|
||||
uint8_t key;
|
||||
char source[IPV4ADDRESS_LENGTH];
|
||||
char destination[IPV4ADDRESS_LENGTH];
|
||||
firewall_protocol_t protocol;
|
||||
firewall_target_t target;
|
||||
struct firewall_rules *next;
|
||||
} firewall_rule_t;
|
||||
|
||||
namespace firewall
|
||||
{
|
||||
String protocol_to_string(firewall_protocol_t &protocol);
|
||||
firewall_protocol_t string_to_protocol(std::string &protocol);
|
||||
String target_to_string(firewall_target_t &target);
|
||||
firewall_target_t string_to_target(std::string &target);
|
||||
void endless_loop();
|
||||
}
|
||||
|
||||
#endif
|
Reference in a new issue