Routing table
The routing table contains all routes known to the networking within the NetworkManager of given module. The table itself manages underlying lwip’s forwarding table (an addition of the RoFI platform) which should be left intact by the user.
-
class RoutingTable
Class representing routing table of the platform.
This class also manages the underlying lwip library, therefore users should not interfere and manage the forwarding table in lwip themselves.
Public Functions
-
inline std::size_t size() const
Get the count of records (number of known networks).
-
inline bool empty() const
Check if the table contains any record.
- Returns:
true if there are no records.
-
inline bool add(const Record &r, const Protocol *learnedFrom = nullptr)
Add a new network to the table.
If the record exists, it merges gateways of both records.
- Returns:
true if a record was added or (in case it exists) merging added a new gateway.
-
inline bool add(const Ip6Addr &ip, uint8_t mask, const Interface::Name &n, Cost c, const Protocol *learned = nullptr)
Overloaded version of
add.
-
inline bool remove(const Ip6Addr &ip, uint8_t mask, const Gateway &gw)
Remove all gateways from the given network record with given Gateways.
-
inline bool removeNetwork(const Ip6Addr &ip, uint8_t mask)
Removes record for given network with all of its gateways.
-
inline bool removeInterface(const Ip6Addr &ip, uint8_t mask, const Interface::Name &gwn)
Remove all gateways from the given network record with given output interface.
Friends
-
friend std::ostream &operator<<(std::ostream&, const RoutingTable&)
-
class Gateway
Class representing single gateway with its cost, output interface, and protocol via witch the gateway was discovered.
-
class Record
Class representing a record of the routing table.
Each network (i.e., ip + mask) has its own record.
Public Functions
-
inline Record(const Ip6Addr &ip, uint8_t mask)
-
inline Record(const Ip6Addr &ip, uint8_t mask, const Interface::Name &n, Cost c, const Protocol *from = nullptr)
-
inline bool addGateway(const Interface::Name &n, Cost c)
Add a new gateway for the given record.
- Returns:
true if the gateway was added.
-
inline bool addGateway(Interface::Name n, Cost c, const Protocol *learnedFrom)
Overloaded version of the previous function.
-
inline bool removeGateway(const Gateway &gw)
Remove given gateway.
- Returns:
true if the gateway was succesfully removed.
-
inline bool removeGateway(const Interface::Name &n, Cost c, const Protocol *learnedFrom = nullptr)
Overloaded version of removeGateway.
-
inline bool removeGateway(const Interface::Name &n)
Remove all gateways from the record with given interface name.
-
inline std::size_t size() const
Get number of gateways.
-
inline std::optional<Gateway> best() const
Get the best (with the lowest cost) gateway for given network if it exists.
-
inline bool compareNetworks(const Ip6Addr &ip, uint8_t mask) const
-
inline Record(const Ip6Addr &ip, uint8_t mask)
-
inline std::size_t size() const