SatCat5
ip_table.h File Reference

Detailed Description

Internet Protocol v4 (IPv4) forwarding table.

The ip::Table class is used to store and retrieve IPv4 forwarding info for a given destination address, i.e., the parameters for the next hop including IP-address, MAC-address, and interface number. Retrieval uses longest-prefix matching for classless inter-domain routing (CIDR). Storing both IP and MAC address allows the use of numberless routes.

The table provides an API for loading permanent or temporary routes. It does not implement OSPF or any other routing protocol. Routes may be marked semi-permanent (i.e., stored until explicitly altered) or ephemeral (i.e., may be discarded or overwritten at any time). The latter allows the table to be used as part of an ARP cache.

For each route, the gateway address controls the mode:

  • ADDR_BROADCAST indicates a subnet on the local area network. i.e., Destinations on this subnet are sent directly to the endpoint.
  • Any unicast address sets the next-hop gateway/router. i.e., Destinations on this subnet are relayed to the next-hop of many. Unicast routes may set the next-hop MAC address if known. Otherwise, it will be populated at runtime with an ARP query.
  • ADDR_NONE with a MAC address indicates a numberless route (rare). i.e., Same as a unicast address, but with no visible IPv4 address. Numberless routes must set the next-hop MAC address.
  • ADDR_NONE without a MAC address indicates an unreachable subnet. i.e., Any attempt to connect to this subnet should fail.

By default, all routes are assumed to be local (i.e., the next hop is the final destination with no intermediate routers). To change this behavior, call the route_** methods to configure the default route and populate the static routing table.

If in doubt, start with the route_simple(...) method. This streamlined option is sufficient for simple networks with a single WAN access point.

Definition in file ip_table.h.

#include <satcat5/eth_header.h>
#include <satcat5/ip_core.h>
Include dependency graph for ip_table.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  satcat5::ip::Route
 A single entry in the static routing table. More...
 
class  satcat5::ip::RouteArray
 An array of routes with read and write accessors. More...
 
class  satcat5::ip::Table
 IPv4 forwarding table. More...
 

Macros

#define SATCAT5_ROUTING_TABLE   8