EDGESEC  0.1.0-alpha.0+sha.ca29a8277b72f80785649ea9ef9cd7edf642d939
Secure router - reference implementation
uci_wrt.h
Go to the documentation of this file.
1 
11 #ifndef UCI_H_
12 #define UCI_H_
13 
14 #include <uci.h>
15 #include <utarray.h>
16 
17 #include "os.h"
18 #include "squeue.h"
19 
20 struct uctx {
21  struct uci_context *uctx;
23 };
24 
26  char *device;
27  int auth_algs;
28  int wpa;
29  char *wpa_key_mgmt;
30  char *rsn_pairwise;
37  char *vlan_file;
40  char *vlan_bridge;
41  char *ssid;
43 };
44 
52 struct uctx *uwrt_init_context(const char *path);
53 
59 void uwrt_free_context(struct uctx *context);
60 
69 UT_array *uwrt_get_interfaces(const struct uctx *context, const char *ifname);
70 
80 int uwrt_set_interface_ip(const struct uctx *context, const char *ifname,
81  const char *ip_addr, const char *netmask);
93 int uwrt_create_interface(const struct uctx *context, const char *ifname,
94  const char *type, const char *ip_addr,
95  const char *brd_addr, const char *netmask);
96 
104 int uwrt_commit_section(const struct uctx *context, const char *section);
105 
116 int uwrt_gen_dnsmasq_instance(const struct uctx *context,
117  const struct string_queue *ifname_queue,
118  const UT_array *server_array,
119  const char *leasefile, const char *scriptfile);
120 
132 int uwrt_add_dhcp_pool(const struct uctx *context, const char *ifname,
133  const char *ip_addr_low, const char *ip_addr_upp,
134  const char *subnet_mask, const char *lease_time);
135 
143 int uwrt_gen_hostapd_instance(const struct uctx *context,
144  const struct hostapd_params *params);
145 
153 int uwrt_gen_firewall_zone(const struct uctx *context, const char *brname);
154 
164 int uwrt_add_firewall_nat(const struct uctx *context, const char *brname,
165  const char *ip_addr, const char *nat_name);
166 
174 int uwrt_delete_firewall_nat(const struct uctx *context, const char *ip_addr);
175 
186 int uwrt_add_firewall_bridge(const struct uctx *context, const char *sip,
187  const char *sbr, const char *dip, const char *dbr);
188 
197 int uwrt_delete_firewall_bridge(const struct uctx *context, const char *sip,
198  const char *dip);
199 
206 int uwrt_cleanup_firewall(const struct uctx *context);
207 #endif
File containing the definition of the os functionalities.
#define MAX_OS_PATH_LEN
Definition: os.h:29
File containing the definition of the string queue utilities.
Definition: uci_wrt.h:25
int wpa
Definition: uci_wrt.h:28
char * wpa_key_mgmt
Definition: uci_wrt.h:29
char * device
Definition: uci_wrt.h:26
int dynamic_vlan
Definition: uci_wrt.h:36
int ignore_broadcast_ssid
Definition: uci_wrt.h:38
char * rsn_pairwise
Definition: uci_wrt.h:30
char * vlan_bridge
Definition: uci_wrt.h:40
int auth_algs
Definition: uci_wrt.h:27
int radius_port
Definition: uci_wrt.h:33
char * wpa_passphrase
Definition: uci_wrt.h:42
char * radius_server_ip
Definition: uci_wrt.h:32
char * ssid
Definition: uci_wrt.h:41
char * vlan_file
Definition: uci_wrt.h:37
char * radius_client_ip
Definition: uci_wrt.h:31
char * radius_secret
Definition: uci_wrt.h:34
int macaddr_acl
Definition: uci_wrt.h:35
int wpa_psk_radius
Definition: uci_wrt.h:39
String queue structure definition.
Definition: squeue.h:24
Definition: uci_wrt.h:20
char path[MAX_OS_PATH_LEN]
Definition: uci_wrt.h:22
struct uci_context * uctx
Definition: uci_wrt.h:21
int uwrt_gen_dnsmasq_instance(const struct uctx *context, const struct string_queue *ifname_queue, const UT_array *server_array, const char *leasefile, const char *scriptfile)
Generates a dnsmasq uci instance.
Definition: uci_wrt.c:804
int uwrt_commit_section(const struct uctx *context, const char *section)
Commit a uci section.
Definition: uci_wrt.c:779
int uwrt_cleanup_firewall(const struct uctx *context)
Removes all the firewall rules.
Definition: uci_wrt.c:1827
int uwrt_add_firewall_bridge(const struct uctx *context, const char *sip, const char *sbr, const char *dip, const char *dbr)
Adds a firewall bridge rule for two IP addresses.
Definition: uci_wrt.c:1620
int uwrt_delete_firewall_bridge(const struct uctx *context, const char *sip, const char *dip)
Deletes a firewall bridge rule for two IP addresses.
Definition: uci_wrt.c:1773
int uwrt_add_firewall_nat(const struct uctx *context, const char *brname, const char *ip_addr, const char *nat_name)
Adds a firewall rule for an IP address.
Definition: uci_wrt.c:1357
int uwrt_set_interface_ip(const struct uctx *context, const char *ifname, const char *ip_addr, const char *netmask)
Assigns an IP to an interface.
Definition: uci_wrt.c:654
int uwrt_delete_firewall_nat(const struct uctx *context, const char *ip_addr)
Deletes a firewall rule for an IP address.
Definition: uci_wrt.c:1571
int uwrt_create_interface(const struct uctx *context, const char *ifname, const char *type, const char *ip_addr, const char *brd_addr, const char *netmask)
Creates and interface and assigns an IP.
Definition: uci_wrt.c:701
int uwrt_gen_firewall_zone(const struct uctx *context, const char *brname)
Generate a firewall zone for a bridge.
Definition: uci_wrt.c:1162
UT_array * uwrt_get_interfaces(const struct uctx *context, const char *ifname)
Get the array of struct netif_info_t for each available interface.
Definition: uci_wrt.c:605
void uwrt_free_context(struct uctx *context)
Frees the uci context.
Definition: uci_wrt.c:569
struct uctx * uwrt_init_context(const char *path)
Initialises the uci context.
Definition: uci_wrt.c:578
int uwrt_gen_hostapd_instance(const struct uctx *context, const struct hostapd_params *params)
Generate the hostapd config.
Definition: uci_wrt.c:995
int uwrt_add_dhcp_pool(const struct uctx *context, const char *ifname, const char *ip_addr_low, const char *ip_addr_upp, const char *subnet_mask, const char *lease_time)
Adds a dhcp pool entry.
Definition: uci_wrt.c:899