36#ifndef _OPENLCB_ROUTNGLOGIC_HXX_
37#define _OPENLCB_ROUTNGLOGIC_HXX_
41#include <unordered_map>
91 if (it.second == port)
193 for (
auto im = ip->second.registeredConsumers_.begin();
194 im != ip->second.registeredConsumers_.end(); ++im)
198 if (im->second.find(event) != im->second.end())
201 else if (im->first == 64)
203 if (!im->second.empty())
208 EventId masked_range =
209 event & ~((UINT64_C(1) << im->first) - 1);
210 if (im->second.find(masked_range) != im->second.end())
Class to allow convenient locking and unlocking of mutexes in a C context.
This class provides a mutex API.
Routing table for gateways and routers in OpenLCB.
void register_consumer_range(Port *port, EventId encoded_range)
Declares that there is a consumer for the given event ID range on the given port.
Port * lookup_port_for_address(Address dest)
Looks up which port an addressed packet should be sent to.
std::unordered_map< Address, Port * > addressRoutingTable_
Stores all known addresses and which port they route to.
void remove_port(Port *port)
Clears all entries in the routing table related to a given port, as the given port is being removed.
void register_producer_range(Port *port, EventId encoded_range)
Declares that there is a producer for the given event ID range on the given port.
bool check_pcer(Port *port, EventId event)
Checks if a given PCER message should be forwarded to the given port.
void add_node_id_to_route(Port *port, Address source)
Declares that a given node ID is reachable via a specific port.
void register_producer(Port *port, EventId event)
Declares that there is a producer for the given event ID on the given port.
OSMutex lock_
Protects all internal data structures.
std::map< Port *, EventSet > eventRoutingTable_
Stores per-port event information.
void register_consumer(Port *port, EventId event)
Declares that there is a consumer for the given event ID on the given port.
uint8_t event_range_to_bit_count(EventId *event)
Decodes an event range, encoded according to the Event Transport protocol specification.
The per-port event information.
std::map< uint8_t, std::set< EventId > > registeredConsumers_
key: number of bits set in the mask part.