adding port to firewall rule
This commit is contained in:
parent
bbebb4060e
commit
84991434ec
6 changed files with 121 additions and 19 deletions
|
@ -6,9 +6,6 @@
|
|||
|
||||
namespace fw
|
||||
{
|
||||
static const uint8_t IPV4ADDRESS_LENGTH = 16;
|
||||
static const uint8_t CREDENTIALS_LENGTH = 32;
|
||||
|
||||
typedef enum firewall_targets : uint8_t
|
||||
{
|
||||
TARGET_REJECT = 0,
|
||||
|
@ -36,22 +33,45 @@ namespace fw
|
|||
DENIED = 1,
|
||||
} auth_t;
|
||||
|
||||
static const uint8_t IPV4ADDRESS_LENGTH = 16;
|
||||
typedef struct firewall_rules
|
||||
{
|
||||
uint8_t key;
|
||||
char source[IPV4ADDRESS_LENGTH];
|
||||
char destination[IPV4ADDRESS_LENGTH];
|
||||
uint16_t port_from; // port is max 65565
|
||||
uint16_t port_to;
|
||||
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",
|
||||
"source",
|
||||
"destination",
|
||||
"port_from",
|
||||
"port_to",
|
||||
"protocol",
|
||||
"target",
|
||||
};
|
||||
|
||||
static const uint8_t CREDENTIALS_LENGTH = 32;
|
||||
typedef struct credentials
|
||||
{
|
||||
char password[CREDENTIALS_LENGTH];
|
||||
char username[CREDENTIALS_LENGTH];
|
||||
} credential_t;
|
||||
|
||||
typedef struct api_endpoints
|
||||
{
|
||||
char uri[40];
|
||||
char method[7];
|
||||
char description[30];
|
||||
struct api_endpoints *next;
|
||||
} api_endpoint_t;
|
||||
|
||||
String protocol_to_string(firewall_protocol_t &protocol);
|
||||
firewall_protocol_t string_to_protocol(String &protocol);
|
||||
String target_to_string(firewall_target_t &target);
|
||||
|
|
Reference in a new issue