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)

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)
int csp_rtable_set(uint16_t dest_address, int netmask, csp_iface_t *ifc, uint16_t via)

Set route to destination address/node.

  • dest_address – destination address.

  • ifc – interface.

  • via – assosicated via address.

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


#CSP_ERR_NONE on success, or an error code.

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

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

void csp_rtable_free(void)

Clear/free all entries in the routing table.

void csp_rtable_iterate(csp_rtable_iterator_t iter, void *ctx)

Iterate routing table.

inline void csp_rtable_print(void)