Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
openlcb::DatagramService Class Reference

Transport-agnostic dispatcher of datagrams. More...

#include <Datagram.hxx>

Inheritance diagram for openlcb::DatagramService:
Service openlcb::CanDatagramService openlcb::TcpDatagramService

Classes

class  DatagramDispatcher
 Class for routing incoming datagram messages to the datagram handlers. More...
 

Public Types

typedef TypedNodeHandlerMap< Node, DatagramHandlerRegistry
 

Public Member Functions

 DatagramService (If *iface, size_t num_registry_entries)
 Creates a datagram dispatcher.
 
Registryregistry ()
 
TypedQAsync< DatagramClient > * client_allocator ()
 Datagram clients.
 
Ififace ()
 
- Public Member Functions inherited from Service
 Service (ExecutorBase *e)
 Constructor.
 
 ~Service ()
 Destructor.
 
ExecutorBaseexecutor ()
 

Private Attributes

Ififace_
 Interface on which we are registered.
 
TypedQAsync< DatagramClientclients_
 Datagram clients.
 
DatagramDispatcher dispatcher_
 Datagram dispatch handler.
 

Detailed Description

Transport-agnostic dispatcher of datagrams.

There will be typically one instance of this for each interface with virtual nodes. This class is responsible for maintaining the registered datagram handlers, and taking the datagram MTI from the incoming messages and routing them to the datagra for datagram handlers.

The datagram handler needs to listen to the incoming queue for arriving datagrams.

Definition at line 160 of file Datagram.hxx.

Member Typedef Documentation

◆ Registry

Constructor & Destructor Documentation

◆ DatagramService()

openlcb::DatagramService::DatagramService ( If iface,
size_t  num_registry_entries 
)

Creates a datagram dispatcher.

Parameters
interfaceis the async interface to which to bind.
num_registry_entriesis the size of the registry map (how many datagram handlers can be registered)

Definition at line 44 of file Datagram.cxx.

◆ ~DatagramService()

openlcb::DatagramService::~DatagramService ( )

Definition at line 52 of file Datagram.cxx.

Member Function Documentation

◆ client_allocator()

TypedQAsync< DatagramClient > * openlcb::DatagramService::client_allocator ( )
inline

Datagram clients.

Use control flows from this allocator to send datagrams to remote nodes. When the client flow completes, it is the caller's responsibility to return it to this allocator, once the client is done examining the result codes.

Definition at line 186 of file Datagram.hxx.

◆ iface()

If * openlcb::DatagramService::iface ( )
inline

Definition at line 191 of file Datagram.hxx.

◆ registry()

Registry * openlcb::DatagramService::registry ( )
inline
Returns
the registry of datagram handlers.

Definition at line 175 of file Datagram.hxx.

Member Data Documentation

◆ clients_

TypedQAsync<DatagramClient> openlcb::DatagramService::clients_
private

Datagram clients.

Definition at line 243 of file Datagram.hxx.

◆ dispatcher_

DatagramDispatcher openlcb::DatagramService::dispatcher_
private

Datagram dispatch handler.

Definition at line 246 of file Datagram.hxx.

◆ iface_

If* openlcb::DatagramService::iface_
private

Interface on which we are registered.

Definition at line 240 of file Datagram.hxx.


The documentation for this class was generated from the following files: