EDGESEC  0.1.0-alpha.0+sha.ca29a8277b72f80785649ea9ef9cd7edf642d939
Secure router - reference implementation
firewall_service.h
Go to the documentation of this file.
1 
11 #ifndef FIREWALL_SERVICE_H
12 #define FIREWALL_SERVICE_H
13 
14 #include <stdbool.h>
15 #include <inttypes.h>
16 #include <utarray.h>
17 
18 #include "../supervisor/supervisor_config.h"
19 #include "../utils/hashmap.h"
20 #include "../utils/iface_mapper.h"
21 
22 #include "firewall_config.h"
23 
41  UT_array *config_ifinfo_array, char *nat_bridge,
42  char *nat_interface, bool exec_firewall,
43  char *path);
44 
50 void fw_free_context(struct fwctx *context);
51 
59 int fw_add_nat(struct fwctx *context, char *ip_addr);
60 
68 int fw_remove_nat(struct fwctx *context, char *ip_addr);
69 
78 int fw_add_bridge(struct fwctx *context, char *ip_addr_left,
79  char *ip_addr_right);
80 
89 int fw_remove_bridge(struct fwctx *context, char *ip_addr_left,
90  char *ip_addr_right);
91 
98 int fw_set_ip_forward(void);
99 
100 #endif
File containing the definition of the firewall structures.
struct fwctx * fw_init_context(hmap_if_conn *if_mapper, hmap_vlan_conn *vlan_mapper, hmap_str_keychar *hmap_bin_paths, UT_array *config_ifinfo_array, char *nat_bridge, char *nat_interface, bool exec_firewall, char *path)
Initialises the firewall service context.
Definition: firewall_service.c:71
int fw_add_bridge(struct fwctx *context, char *ip_addr_left, char *ip_addr_right)
Adds bridge rule for two IPs.
Definition: firewall_service.c:262
int fw_add_nat(struct fwctx *context, char *ip_addr)
Adds NAT rule to an IP.
Definition: firewall_service.c:182
int fw_remove_nat(struct fwctx *context, char *ip_addr)
Removes NAT rule to an IP.
Definition: firewall_service.c:226
int fw_set_ip_forward(void)
Set the ip forward os system param.
Definition: firewall_service.c:369
void fw_free_context(struct fwctx *context)
Frees the firewall service context.
Definition: firewall_service.c:38
int fw_remove_bridge(struct fwctx *context, char *ip_addr_left, char *ip_addr_right)
Removes bridge rule for two IPs.
Definition: firewall_service.c:323
Definition: firewall_config.h:33
hmap_vlan_conn * vlan_mapper
Definition: firewall_config.h:35
char * nat_interface
Definition: firewall_config.h:40
hmap_if_conn * if_mapper
Definition: firewall_config.h:34
bool exec_firewall
Definition: firewall_config.h:41
hmap_str_keychar * hmap_bin_paths
Definition: firewall_config.h:36
char * nat_bridge
Definition: firewall_config.h:39
UT_array * config_ifinfo_array
Definition: firewall_config.h:37
Subnet to interface connection mapper.
Definition: iface_mapper.h:76
keyd array hasmap structure definition
Definition: hashmap.h:23
VLAN to interface connection mapper.
Definition: iface_mapper.h:96