Routing Table API

group RoutingTable

Defines

CSP_NODE_MAC
CSP_ROUTE_COUNT
CSP_ROUTE_TABLE_SIZE
csp_route_set(node, ifc, mac)

Setup routing entry to single node (deprecated, please use csp_rtable_set)

Return
CSP error type
Parameters
  • node: Host
  • ifc: Interface
  • mac: MAC address

csp_route_print_table

Print routing table (deprecated, please use csp_rtable_print)

csp_route_print_interfaces

Print list of interfaces (deprecated, please use csp_iflist_print)

Functions

csp_iface_t *csp_rtable_find_iface(uint8_t id)

Find outgoing interface in routing table.

Return
pointer to outgoing interface or NULL
Parameters
  • id: Destination node

uint8_t csp_rtable_find_mac(uint8_t id)

Find MAC address associated with node.

Return
MAC address
Parameters
  • id: Destination node

int csp_rtable_set(uint8_t node, uint8_t mask, csp_iface_t *ifc, uint8_t mac)

Setup routing entry.

Return
CSP error type
Parameters
  • node: Host
  • mask: Number of bits in netmask
  • ifc: Interface
  • mac: MAC address

void csp_rtable_print(void)

Print routing table to stdout.

void csp_route_table_load(uint8_t route_table_in[CSP_ROUTE_TABLE_SIZE])

Load the routing table from a buffer (deprecated, please use new csp_rtable_load)

Warning: The table will be RAW from memory and contains direct pointers, not interface names. Therefore it’s very important that a saved routing table is deleted after a firmware update

Parameters
  • route_table_in: pointer to routing table buffer

void csp_route_table_save(uint8_t route_table_out[CSP_ROUTE_TABLE_SIZE])

Save the routing table to a buffer (deprecated, please use new csp_rtable_save)

Warning: The table will be RAW from memory and contains direct pointers, not interface names. Therefore it’s very important that a saved routing table is deleted after a firmware update

Parameters
  • route_table_out: pointer to routing table buffer

int csp_rtable_save(char *buffer, int maxlen)

Save routing table as a string to a buffer, which can be parsed again by csp_rtable_load.

Return
length of saved string
Parameters
  • buffer: pointer to buffer
  • maxlen: length of buffer

void csp_rtable_load(char *buffer)

Load routing table from a string in the format u/u s u.

  • Address
  • Netmask
  • Ifname
  • Mac Address (this field is optional) An example routing string is “0/0 I2C, 8/2 KISS” The string must be \0 null terminated The string must NOT be const.
    Parameters
    • buffer: Pointer to string

int csp_rtable_check(char *buffer)

Check string for valid routing table.

Return
number of valid entries found
Parameters
  • buffer: Pointer to string

void csp_rtable_clear(void)

Clear routing table: This could be done before load to ensure an entire clean table is loaded.