EDGESEC  0.1.0-alpha.0+sha.ca29a8277b72f80785649ea9ef9cd7edf642d939
Secure router - reference implementation
Macros | Functions
network_commands.h File Reference

File containing the definition of the network commands. More...

#include <stdbool.h>
#include <inttypes.h>
#include "../ap/ap_config.h"
#include "supervisor_config.h"
Include dependency graph for network_commands.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define TICKET_PASSPHRASE_SIZE   16
 
#define TICKET_TIMEOUT   60
 

Functions

void free_ticket (struct supervisor_context *context)
 Frees an allocated ticket. More...
 
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_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_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...
 
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_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...
 

Detailed Description

File containing the definition of the network commands.

Author
Alexandru Mereacre
Date
2021

Macro Definition Documentation

◆ TICKET_PASSPHRASE_SIZE

#define TICKET_PASSPHRASE_SIZE   16

◆ TICKET_TIMEOUT

#define TICKET_TIMEOUT   60

Function Documentation

◆ accept_mac_cmd()

int accept_mac_cmd ( struct supervisor_context context,
uint8_t *  mac_addr,
int  vlanid 
)

ACCEPT_MAC command.

Parameters
contextThe supervisor structure instance
mac_addrThe MAC address
vlanidThe VLAN ID
Returns
int 0 on success, -1 on failure

◆ add_bridge_ip()

int add_bridge_ip ( struct supervisor_context context,
char *  ip_addr_left,
char *  ip_addr_right 
)

Add an IP bridge.

Parameters
contextThe supervisor structure instance
ip_addr_leftThe left IP address string
ip_addr_rightThe right IP address string
Returns
0 on success, -1 on failure

◆ add_bridge_ip_cmd()

int add_bridge_ip_cmd ( struct supervisor_context context,
char *  left_ip_addr,
char *  right_ip_addr 
)

ADD_BRIDGE command (IP address input)

Parameters
contextThe supervisor structure instance
left_ip_addrThe left IP address
right_ip_addrThe right IP address
Returns
int 0 on success, -1 on failure

◆ add_bridge_mac_cmd()

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)

Parameters
contextThe supervisor structure instance
left_mac_addrThe left MAC address
right_mac_addrThe right MAC address
Returns
int 0 on success, -1 on failure

◆ add_nat_cmd()

int add_nat_cmd ( struct supervisor_context context,
uint8_t *  mac_addr 
)

ADD_NAT command.

Parameters
contextThe supervisor structure instance
mac_addrThe MAC address
Returns
int 0 on success, -1 on failure

◆ add_nat_ip()

int add_nat_ip ( struct supervisor_context context,
char *  ip_addr 
)

Add an IP to NAT.

Parameters
contextThe supervisor structure instance
ip_addrThe IP address string
Returns
0 on success, -1 on failure

◆ assign_psk_cmd()

int assign_psk_cmd ( struct supervisor_context context,
uint8_t *  mac_addr,
char *  pass,
int  pass_len 
)

ASSIGN_PSK command.

Parameters
contextThe supervisor structure instance
mac_addrThe MAC address
passThe password
pass_lenThe password length
Returns
int 0 on success, -1 on failure

◆ clear_bridges_cmd()

int clear_bridges_cmd ( struct supervisor_context context,
uint8_t *  mac_addr 
)

CLEAR_BRIDGES command.

Parameters
contextThe supervisor structure instance
mac_addrThe MAC address
Returns
int 0 on success, -1 on failure

◆ clear_psk_cmd()

int clear_psk_cmd ( struct supervisor_context context,
uint8_t *  mac_addr 
)

CLEAR_PSK command.

Parameters
contextThe supervisor structure instance
mac_addrThe MAC address string
Returns
0 on success, -1 on failure

◆ delete_bridge_ip()

int delete_bridge_ip ( struct supervisor_context context,
char *  ip_addr_left,
char *  ip_addr_right 
)

Deletes an IP bridge.

Parameters
contextThe supervisor structure instance
ip_addr_leftThe left IP address string
ip_addr_rightThe right IP address string
Returns
0 on success, -1 on failure

◆ deny_mac_cmd()

int deny_mac_cmd ( struct supervisor_context context,
uint8_t *  mac_addr 
)

DENY_MAC command.

Parameters
contextThe supervisor structure instance
mac_addrThe MAC address
Returns
int 0 on success, -1 on failure

◆ free_ticket()

void free_ticket ( struct supervisor_context context)

Frees an allocated ticket.

Parameters
contextThe supervisor context

◆ register_ticket_cmd()

uint8_t* register_ticket_cmd ( struct supervisor_context context,
uint8_t *  mac_addr,
char *  label,
int  vlanid 
)

REGISTER_TICKET command.

Parameters
contextThe supervisor structure instance
mac_addrThe MAC address string
labelThe label string
vlanidThe VLAN ID
Returns
char* passphrase string, NULL on failure

◆ remove_bridge_cmd()

int remove_bridge_cmd ( struct supervisor_context context,
uint8_t *  left_mac_addr,
uint8_t *  right_mac_addr 
)

REMOVE_BRIDGE command.

Parameters
contextThe supervisor structure instance
left_mac_addrThe left MAC address
right_mac_addrThe right MAC address
Returns
int 0 on success, -1 on failure

◆ remove_nat_cmd()

int remove_nat_cmd ( struct supervisor_context context,
uint8_t *  mac_addr 
)

REMOVE_NAT command.

Parameters
contextThe supervisor structure instance
mac_addrThe MAC address
Returns
int 0 on success, -1 on failure

◆ remove_nat_ip()

int remove_nat_ip ( struct supervisor_context context,
char *  ip_addr 
)

Remove an IP to NAT.

Parameters
contextThe supervisor structure instance
ip_addrThe IP address string
Returns
0 on success, -1 on failure