EDGESEC  0.1.0-alpha.0+sha.ca29a8277b72f80785649ea9ef9cd7edf642d939
Secure router - reference implementation
Data Structures | Functions
bridge_list.h File Reference

File containing the definition of the bridge creation functions. More...

#include <net/ethernet.h>
#include <utarray.h>
#include <list.h>
#include "../utils/allocs.h"
#include "../utils/os.h"
Include dependency graph for bridge_list.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  bridge_mac_tuple
 The bridge MAc tuple definition. More...
 
struct  bridge_mac_list
 The MAC bridge address store list. More...
 
struct  bridge_mac_list_tuple
 The structure for edge definition. More...
 

Functions

struct bridge_mac_listinit_bridge_list (void)
 Init the MAC brideg address list for bridge assignment. More...
 
void free_bridge_list (struct bridge_mac_list *ml)
 Free MAC bridge address list. More...
 
int add_bridge_mac (struct bridge_mac_list *ml, const uint8_t *mac_addr_left, const uint8_t *mac_addr_right)
 Add bridge connection to the MAC bridge address list. More...
 
int remove_bridge_mac (struct bridge_mac_list *ml, const uint8_t *mac_addr_left, const uint8_t *mac_addr_right)
 Removes a bridge connection from the MAC address list. More...
 
struct bridge_mac_list_tuple get_bridge_mac (struct bridge_mac_list *ml, const uint8_t *mac_addr_left, const uint8_t *mac_addr_right)
 Get the bridge mac object from a bridge connection. More...
 
int get_src_mac_list (struct bridge_mac_list *ml, const uint8_t *src_addr, UT_array **mac_list_arr)
 Get the MAC address dst list array for a src MAC address. More...
 
int get_all_bridge_edges (struct bridge_mac_list *ml, UT_array **tuple_list_arr)
 Get the all the bridge edges as tuple list array. More...
 
int check_bridge_exist (struct bridge_mac_list *ml, const uint8_t *mac_addr_left, const uint8_t *mac_addr_right)
 Check if a bridge exist. More...
 

Detailed Description

File containing the definition of the bridge creation functions.

Author
Alexandru Mereacre
Date
2020

Function Documentation

◆ add_bridge_mac()

int add_bridge_mac ( struct bridge_mac_list ml,
const uint8_t *  mac_addr_left,
const uint8_t *  mac_addr_right 
)

Add bridge connection to the MAC bridge address list.

Parameters
mlThe MAC bridge address list
mac_addr_leftThe MAC address in byte format for left node
mac_addr_rightThe MAC address in byte format for right node
Returns
int 1 added if edge not present, 0 not added if edge present, -1 on error

◆ check_bridge_exist()

int check_bridge_exist ( struct bridge_mac_list ml,
const uint8_t *  mac_addr_left,
const uint8_t *  mac_addr_right 
)

Check if a bridge exist.

Parameters
mlThe MAC bridge address list
mac_addr_leftThe MAC address in byte format for left node
mac_addr_rightThe MAC address in byte format for rigth node
Returns
int 1 exists, 0 otherwise

◆ free_bridge_list()

void free_bridge_list ( struct bridge_mac_list ml)

Free MAC bridge address list.

Parameters
mlThe MAC bridge address list

◆ get_all_bridge_edges()

int get_all_bridge_edges ( struct bridge_mac_list ml,
UT_array **  tuple_list_arr 
)

Get the all the bridge edges as tuple list array.

Parameters
mlThe MAC bridge address list
tuple_list_arrThe returned array of tuples
Returns
int The total number of tuples, -1 on error

◆ get_bridge_mac()

struct bridge_mac_list_tuple get_bridge_mac ( struct bridge_mac_list ml,
const uint8_t *  mac_addr_left,
const uint8_t *  mac_addr_right 
)

Get the bridge mac object from a bridge connection.

Parameters
mlThe MAC bridge address list
mac_addr_leftThe MAC address in byte format for left node
mac_addr_rightThe MAC address in byte format for rigth node
Returns
bridge_mac_list_tuple The MAC bridge edge element, structure elements set to NULL if edge not found

◆ get_src_mac_list()

int get_src_mac_list ( struct bridge_mac_list ml,
const uint8_t *  src_addr,
UT_array **  mac_list_arr 
)

Get the MAC address dst list array for a src MAC address.

Parameters
mlThe MAC bridge address list
src_addrThe source MAC address in byte format
mac_list_arrThe returned array of MAC addresses
Returns
int The total number of tuples, -1 on error

◆ init_bridge_list()

struct bridge_mac_list* init_bridge_list ( void  )

Init the MAC brideg address list for bridge assignment.

Returns
struct bridge_mac_list* The initialised list

◆ remove_bridge_mac()

int remove_bridge_mac ( struct bridge_mac_list ml,
const uint8_t *  mac_addr_left,
const uint8_t *  mac_addr_right 
)

Removes a bridge connection from the MAC address list.

Parameters
mlThe MAC bridge address list
mac_addr_leftThe MAC address in byte format for left node
mac_addr_rightThe MAC address in byte format for right node
Returns
int 0 on success, -1 on error