45 #include <satcat5/ip_core.h>
49 #ifndef SATCAT5_ROUTING_TABLE
50 #define SATCAT5_ROUTING_TABLE 8
83 {
return (
dstmac != satcat5::eth::MACADDR_NONE); }
86 {
return (
gateway != satcat5::ip::ADDR_NONE); }
120 {
return m_route_default; }
128 {
return m_route_table[idx]; }
173 u8 port = 0, u8 flags = 0);
188 u8 port = 0, u8 flags = 0);
194 u8 port = 0, u8 flags = 0)
197 satcat5::ip::ADDR_BROADCAST,
198 satcat5::eth::MACADDR_NONE,
223 unsigned m_wridx_static;
224 unsigned m_wridx_ephemeral;
An array of routes with read and write accessors.
RouteArray()
Create an empty table.
virtual bool route_wrdef(const satcat5::ip::Route &route)
Internal methods used to access "m_route_default".
virtual bool route_write(unsigned idx, const satcat5::ip::Route &route)
Internal methods used to access "m_route_table".
const satcat5::ip::Route & route_rddef() const
Internal methods used to access "m_route_default".
const satcat5::ip::Route & route_read(unsigned idx) const
Internal methods used to access "m_route_table".
Table()
Construct an empty table with a local default route.
bool route_default(const satcat5::ip::Addr &gateway, const satcat5::eth::MacAddr &dstmac=satcat5::eth::MACADDR_NONE, u8 port=0, u8 flags=0)
Set the default behavior when no other routes match.
satcat5::ip::Route route_lookup(const satcat5::ip::Addr &dstaddr) const
Next-hop routing lookup for the given destination address.
void route_clear(bool lockdown=true)
Clear all routes, including the default.
bool route_static(const satcat5::ip::Subnet &subnet, const satcat5::ip::Addr &gateway, const satcat5::eth::MacAddr &dstmac=satcat5::eth::MACADDR_NONE, u8 port=0, u8 flags=0)
Create or update a single static route.
void log_to(satcat5::log::LogBuffer &wr) const
Create a log entry with the full contents of this table.
bool route_local(const satcat5::ip::Subnet &subnet, u8 port=0, u8 flags=0)
Create or update a local static route.
bool route_cache(const satcat5::ip::Addr &gateway, const satcat5::eth::MacAddr &dstmac)
Update matching MAC address cache entries.
bool route_remove(const satcat5::ip::Subnet &subnet)
Remove a single static route.
bool route_simple(const satcat5::ip::Addr &gateway, const satcat5::ip::Mask &subnet=satcat5::ip::MASK_24)
Simplified one-step setup for a typical home network.
void route_flush()
Flush cached MAC-addresses.
Internal buffer used by the Log class.
An Ethernet MAC address (with serializable interface).
bool is_multicast() const
Broadcast, L2 multicast, or L3 multicast.
bool is_unicast() const
Any normal single-destination address.
IPv4 address is a 32-bit unsigned integer.
bool is_multicast() const
IP multicast (224.*.*.*)
bool is_unicast() const
Any normal single-destination address.
IPv4 subnet masks share functionality with a basic address, but are constructed differently to match ...
A single entry in the static routing table.
bool is_multicast() const
Is the next-hop address a multicast address?
satcat5::eth::MacAddr dstmac
Next-hop MAC address.
bool has_gateway() const
Does this route have a known next-hop IPv4 address?
u8 flags
Additional flags.
void log_to(satcat5::log::LogBuffer &wr) const
Format a one-line log entry containing all route parameters.
static constexpr u8 FLAG_MAC_FIXED
Fixed MAC-address for this route? If this flag is set, then the user specified the MAC address.
bool has_dstmac() const
Does this route have a known next-hop MAC address?
static constexpr u8 FLAG_PROXY_ARP
Enable proxy-ARP for this route? If proxy-ARP is enabled, then the router should respond to ARP queri...
bool is_deliverable() const
Does this route have a valid next-hop address of any kind?
satcat5::ip::Subnet subnet
Subnet address + mask.
u8 port
Next-hop port number.
bool is_proxy_arp() const
Is proxy-ARP enabled for this route?
bool is_unicast() const
Is the next-hop address an ordinary unicast address?
satcat5::ip::Addr gateway
Next-hop IPv4 address.
An IPv4 subnet consists of a base address and a subnet mask.