EDGESEC
0.1.0-alpha.0+sha.ca29a8277b72f80785649ea9ef9cd7edf642d939
Secure router - reference implementation
|
File containing the implementation of the network commands. More...
#include <libgen.h>
#include "mac_mapper.h"
#include "network_commands.h"
#include "sqlite_macconn_writer.h"
#include "supervisor.h"
#include "supervisor_utils.h"
#include "../ap/ap_config.h"
#include "../ap/ap_service.h"
#include <eloop.h>
#include "../capture/capture_service.h"
#include "../dhcp/dhcp_service.h"
#include "../firewall/firewall_service.h"
#include "../utils/allocs.h"
#include "../utils/base64.h"
#include "../utils/log.h"
#include "../utils/net.h"
#include "../utils/os.h"
Macros | |
#define | ANALYSER_FILTER_FORMAT "\"ether dst " MACSTR " or ether src " MACSTR "\"" |
Functions | |
void | free_ticket (struct supervisor_context *context) |
Frees an allocated ticket. More... | |
void | eloop_ticket_timeout_handler (void *eloop_ctx, void *user_ctx) |
int | accept_mac_cmd (struct supervisor_context *context, uint8_t *mac_addr, int vlanid) |
ACCEPT_MAC command. More... | |
int | deny_mac_cmd (struct supervisor_context *context, uint8_t *mac_addr) |
DENY_MAC command. More... | |
int | add_nat_ip (struct supervisor_context *context, char *ip_addr) |
Add an IP to NAT. More... | |
int | remove_nat_ip (struct supervisor_context *context, char *ip_addr) |
Remove an IP to NAT. More... | |
int | add_nat_cmd (struct supervisor_context *context, uint8_t *mac_addr) |
ADD_NAT command. More... | |
int | remove_nat_cmd (struct supervisor_context *context, uint8_t *mac_addr) |
REMOVE_NAT command. More... | |
int | assign_psk_cmd (struct supervisor_context *context, uint8_t *mac_addr, char *pass, int pass_len) |
ASSIGN_PSK command. More... | |
int | add_bridge_ip (struct supervisor_context *context, char *ip_addr_left, char *ip_addr_right) |
Add an IP bridge. More... | |
int | delete_bridge_ip (struct supervisor_context *context, char *ip_addr_left, char *ip_addr_right) |
Deletes an IP bridge. More... | |
int | add_bridge_mac_cmd (struct supervisor_context *context, uint8_t *left_mac_addr, uint8_t *right_mac_addr) |
ADD_BRIDGE command (MAC address input) More... | |
int | add_bridge_ip_cmd (struct supervisor_context *context, char *left_ip_addr, char *right_ip_addr) |
ADD_BRIDGE command (IP address input) More... | |
int | remove_bridge_cmd (struct supervisor_context *context, uint8_t *left_mac_addr, uint8_t *right_mac_addr) |
REMOVE_BRIDGE command. More... | |
int | clear_bridges_cmd (struct supervisor_context *context, uint8_t *mac_addr) |
CLEAR_BRIDGES command. More... | |
uint8_t * | register_ticket_cmd (struct supervisor_context *context, uint8_t *mac_addr, char *label, int vlanid) |
REGISTER_TICKET command. More... | |
int | clear_psk_cmd (struct supervisor_context *context, uint8_t *mac_addr) |
CLEAR_PSK command. More... | |
File containing the implementation of the network commands.
#define ANALYSER_FILTER_FORMAT "\"ether dst " MACSTR " or ether src " MACSTR "\"" |
int accept_mac_cmd | ( | struct supervisor_context * | context, |
uint8_t * | mac_addr, | ||
int | vlanid | ||
) |
ACCEPT_MAC command.
context | The supervisor structure instance |
mac_addr | The MAC address |
vlanid | The VLAN ID |
int add_bridge_ip | ( | struct supervisor_context * | context, |
char * | ip_addr_left, | ||
char * | ip_addr_right | ||
) |
Add an IP bridge.
context | The supervisor structure instance |
ip_addr_left | The left IP address string |
ip_addr_right | The right IP address string |
int add_bridge_ip_cmd | ( | struct supervisor_context * | context, |
char * | left_ip_addr, | ||
char * | right_ip_addr | ||
) |
ADD_BRIDGE command (IP address input)
context | The supervisor structure instance |
left_ip_addr | The left IP address |
right_ip_addr | The right IP address |
int add_bridge_mac_cmd | ( | struct supervisor_context * | context, |
uint8_t * | left_mac_addr, | ||
uint8_t * | right_mac_addr | ||
) |
ADD_BRIDGE command (MAC address input)
context | The supervisor structure instance |
left_mac_addr | The left MAC address |
right_mac_addr | The right MAC address |
int add_nat_cmd | ( | struct supervisor_context * | context, |
uint8_t * | mac_addr | ||
) |
ADD_NAT command.
context | The supervisor structure instance |
mac_addr | The MAC address |
int add_nat_ip | ( | struct supervisor_context * | context, |
char * | ip_addr | ||
) |
Add an IP to NAT.
context | The supervisor structure instance |
ip_addr | The IP address string |
int assign_psk_cmd | ( | struct supervisor_context * | context, |
uint8_t * | mac_addr, | ||
char * | pass, | ||
int | pass_len | ||
) |
ASSIGN_PSK command.
context | The supervisor structure instance |
mac_addr | The MAC address |
pass | The password |
pass_len | The password length |
int clear_bridges_cmd | ( | struct supervisor_context * | context, |
uint8_t * | mac_addr | ||
) |
CLEAR_BRIDGES command.
context | The supervisor structure instance |
mac_addr | The MAC address |
int clear_psk_cmd | ( | struct supervisor_context * | context, |
uint8_t * | mac_addr | ||
) |
CLEAR_PSK command.
context | The supervisor structure instance |
mac_addr | The MAC address string |
int delete_bridge_ip | ( | struct supervisor_context * | context, |
char * | ip_addr_left, | ||
char * | ip_addr_right | ||
) |
Deletes an IP bridge.
context | The supervisor structure instance |
ip_addr_left | The left IP address string |
ip_addr_right | The right IP address string |
int deny_mac_cmd | ( | struct supervisor_context * | context, |
uint8_t * | mac_addr | ||
) |
DENY_MAC command.
context | The supervisor structure instance |
mac_addr | The MAC address |
void eloop_ticket_timeout_handler | ( | void * | eloop_ctx, |
void * | user_ctx | ||
) |
void free_ticket | ( | struct supervisor_context * | context | ) |
Frees an allocated ticket.
context | The supervisor context |
uint8_t* register_ticket_cmd | ( | struct supervisor_context * | context, |
uint8_t * | mac_addr, | ||
char * | label, | ||
int | vlanid | ||
) |
REGISTER_TICKET command.
context | The supervisor structure instance |
mac_addr | The MAC address string |
label | The label string |
vlanid | The VLAN ID |
int remove_bridge_cmd | ( | struct supervisor_context * | context, |
uint8_t * | left_mac_addr, | ||
uint8_t * | right_mac_addr | ||
) |
REMOVE_BRIDGE command.
context | The supervisor structure instance |
left_mac_addr | The left MAC address |
right_mac_addr | The right MAC address |
int remove_nat_cmd | ( | struct supervisor_context * | context, |
uint8_t * | mac_addr | ||
) |
REMOVE_NAT command.
context | The supervisor structure instance |
mac_addr | The MAC address |
int remove_nat_ip | ( | struct supervisor_context * | context, |
char * | ip_addr | ||
) |
Remove an IP to NAT.
context | The supervisor structure instance |
ip_addr | The IP address string |