Routing table

File: csp/csp_rtable.h

Description: Routing table. The routing table maps a CSP destination address to an interface (and optional a via address). Normal routing: If the route’s via address is set to #CSP_NO_VIA_ADDRESS, the packet will be sent directly to the destination address specified in the CSP header, otherwise the packet will be sent the to the route’s via address.

Interface Functions

csp_route_t *csp_rtable_search_backward(csp_route_t *start_route)
[source]

Loop through routes backwards and find routes that match on addr and mask from start_route

csp_route_t *csp_rtable_find_route(uint16_t dest_address)
[source]
int csp_rtable_set(uint16_t dest_address, int netmask, csp_iface_t *ifc, uint16_t via)
[source]

Set route to destination address/node.

Parameters:
  • dest_address – destination address.

  • netmask – number of bits in netmask (set to -1 for maximum number of bits)

  • ifc – interface.

  • via – assosicated via address.

Returns:

#CSP_ERR_NONE on success, or an error code.

inline int csp_rtable_save(char *buffer, size_t buffer_size)
[source]
inline int csp_rtable_load(const char *rtable)
[source]
inline int csp_rtable_check(const char *rtable)
[source]
void csp_rtable_clear(void)
[source]

Clear routing table and add loopback route. @see csp_rtable_free()

void csp_rtable_free(void)
[source]

Clear/free all entries in the routing table.

void csp_rtable_iterate(csp_rtable_iterator_t iter, void *ctx)
[source]

Iterate routing table.

inline void csp_rtable_print(void)
[source]