ARL table configuration

Overview

// typedefs

typedef enum arl_entry_type arl_entry_type;
typedef struct arl_entry_t arl_entry_t;

// enums

enum arl_entry_type;

// structs

struct arl_entry_t;

// global functions

typedef TAILQ_HEAD(arl_table_t, arl_entry_t);
static void tapi_mac_next(uint8_t* mac);
static te_bool tapi_mac_is_broadcast(const uint8_t* mac);
static te_bool tapi_mac_is_multicast(const uint8_t* mac);
int tapi_cfg_arl_get_table(const char* ta, te_bool sync, arl_table_t* p_table);
int tapi_cfg_arl_del_entry(const char* ta, arl_entry_type type, unsigned int port_num, const uint8_t* mac_addr, const char* vlan_name);
int tapi_cfg_arl_add_entry(const char* ta, arl_entry_type type, unsigned int port_num, const uint8_t* mac_addr, const char* vlan_name);
int tapi_cfg_arl_get_entry(const char* oid, arl_entry_t* p);
void tapi_arl_free_entry(arl_entry_t* p);
void tapi_arl_free_table(arl_table_t* p_table);
arl_entry_t* tapi_arl_find(const arl_table_t* p_table, const uint8_t* mac, const char* vlan, unsigned int port, enum arl_entry_type type);
void tapi_arl_print_table(const arl_table_t* p_table);

// macros

#define DEFAULT_VLAN_NAME

Detailed Documentation

Typedefs

typedef enum arl_entry_type arl_entry_type

Types of ARL entries

typedef struct arl_entry_t arl_entry_t

ARL table entry structure

Global Functions

typedef TAILQ_HEAD(arl_table_t, arl_entry_t)

ARL table head

static void tapi_mac_next(uint8_t* mac)

Update MAC address to sequntially next.

Parameters:

mac

  • MAC address

static te_bool tapi_mac_is_broadcast(const uint8_t* mac)

Is MAC address broadcast?

Parameters:

mac

  • MAC address

TRUE

  • broadcast

FALSE

  • not broadcast

static te_bool tapi_mac_is_multicast(const uint8_t* mac)

Is MAC address multicast?

Parameters:

mac

  • MAC address

TRUE

  • multicast

FALSE

  • not multicast

int tapi_cfg_arl_get_table(const char* ta, te_bool sync, arl_table_t* p_table)

Get ARL table from TA.

Parameters:

ta

  • Test agent name

sync

  • synchronize tree before get

p_table

  • pointer to head of ARL table (initialized as empty in the function)

Returns:

Status code.

int tapi_cfg_arl_del_entry(const char* ta, arl_entry_type type, unsigned int port_num, const uint8_t* mac_addr, const char* vlan_name)

Delete an ARL entry from ARL table

Parameters:

ta

  • Test agent name

type

  • Entry type (static/dynamic)

port_num

  • Bridge port number of the new ARL entry

mac_addr

  • MAC address of the ARL entry

vlan_name

  • VLAN name associated with the ARL entry

Returns:

Status of the operation

int tapi_cfg_arl_add_entry(const char* ta, arl_entry_type type, unsigned int port_num, const uint8_t* mac_addr, const char* vlan_name)

Add a new ARL entry in ARL table

Parameters:

ta

  • Test agent name

type

  • Entry type (static/dynamic)

port_num

  • Bridge port number of the new ARL entry

mac_addr

  • MAC address of the ARL entry

vlan_name

  • VLAN name associated with the ARL entry

Returns:

Status of the operation

int tapi_cfg_arl_get_entry(const char* oid, arl_entry_t* p)

Get ARL table entry from TA.

Parameters:

oid

  • ARL table OID

p

  • pointer to ARL entry

Returns:

Status code.

void tapi_arl_free_entry(arl_entry_t* p)

Free resources allocated inside ARL entry. DO NOT free memory used by ARL entry itself.

Parameters:

p

  • pointer to ARL entry

void tapi_arl_free_table(arl_table_t* p_table)

Free resources allocated for ARL table. DO NOT free memory used by ARL table head.

Parameters:

p_table

  • pointer to ARL table

arl_entry_t* tapi_arl_find(const arl_table_t* p_table, const uint8_t* mac, const char* vlan, unsigned int port, enum arl_entry_type type)

Find ARL entry with specified fields.

Parameters:

p_table

  • ARL table

mac

  • ARL MAC address

vlan

  • name of VLAN

port

  • ARL port

type

  • type of ARL entry

Returns:

Pointer to ARL entry or NULL

void tapi_arl_print_table(const arl_table_t* p_table)

Dump the content of ARL table into log file.

Parameters:

p_table

  • ARL table

Macros

#define DEFAULT_VLAN_NAME

Default VLAN name used on the Switch