EDGESEC  0.1.0-alpha.0+sha.ca29a8277b72f80785649ea9ef9cd7edf642d939
Secure router - reference implementation
Functions
mac_mapper.c File Reference

File containing the implementation of the mac mapper. More...

#include <stdbool.h>
#include "utils/allocs.h"
#include "utils/log.h"
#include "utils/net.h"
#include "utils/os.h"
#include "bridge_list.h"
#include "mac_mapper.h"
Include dependency graph for mac_mapper.c:

Functions

int get_mac_mapper (hmap_mac_conn **hmap, uint8_t mac_addr[ETHER_ADDR_LEN], struct mac_conn_info *info)
 Get the MAC connection info structure for a given MAC address. More...
 
bool put_mac_mapper (hmap_mac_conn **hmap, struct mac_conn conn)
 Insert a MAC into the MAC mapper connection object. More...
 
void free_mac_mapper (hmap_mac_conn **hmap)
 Frees the MAC mapper connection object. More...
 
int get_mac_list (hmap_mac_conn **hmap, struct mac_conn **list)
 Get the MAC list from the MAC mapper connection object. More...
 
void init_default_mac_info (struct mac_conn_info *info, int default_open_vlanid, bool allow_all_nat)
 Generate a default mac info configuration. More...
 
int get_ip_mapper (hmap_mac_conn **hmap, char *ip, uint8_t *mac_addr)
 Get the MAC address for a given IP address. More...
 

Detailed Description

File containing the implementation of the mac mapper.

Author
Alexandru Mereacre
Date
2020

Function Documentation

◆ free_mac_mapper()

void free_mac_mapper ( hmap_mac_conn **  hmap)

Frees the MAC mapper connection object.

Parameters
hmapMAC mapper connection object

◆ get_ip_mapper()

int get_ip_mapper ( hmap_mac_conn **  hmap,
char *  ip,
uint8_t *  mac_addr 
)

Get the MAC address for a given IP address.

Parameters
hmapMAC mapper object
ipThe AP address
mac_addrOutput MAC address
Returns
int 1 if MAC address found, -1 error and 0 if MAC address not found

◆ get_mac_list()

int get_mac_list ( hmap_mac_conn **  hmap,
struct mac_conn **  list 
)

Get the MAC list from the MAC mapper connection object.

Parameters
hmapMAC mapper connection object
listOutput MAC list
Returns
int

◆ get_mac_mapper()

int get_mac_mapper ( hmap_mac_conn **  hmap,
uint8_t  mac_addr[ETHER_ADDR_LEN],
struct mac_conn_info info 
)

Get the MAC connection info structure for a given MAC address.

Parameters
hmapMAC mapper object
mac_addrMAC address in byte format
infoOutput MAC connection info structure
Returns
int 1 if MAC address found, -1 error and 0 if MAC address not found

◆ init_default_mac_info()

void init_default_mac_info ( struct mac_conn_info info,
int  default_open_vlanid,
bool  allow_all_nat 
)

Generate a default mac info configuration.

Parameters
infoThe input mac info structure
default_open_vlanidThe default VLAN ID
allow_all_natThe NAT flag

◆ put_mac_mapper()

bool put_mac_mapper ( hmap_mac_conn **  hmap,
struct mac_conn  conn 
)

Insert a MAC into the MAC mapper connection object.

Parameters
hmapMAC mapper object
connMAC connection structure
Returns
true on success, false otherwise