EMANE  1.2.1
EMANE::NEMQueuedLayer Class Referenceabstract

A layer stack with a porcessing queue between each layer to decouple to intra queue processing. More...

#include <nemqueuedlayer.h>

Inheritance diagram for EMANE::NEMQueuedLayer:
EMANE::NEMLayer EMANE::FileDescriptorServiceProvider EMANE::Component EMANE::UpstreamTransport EMANE::DownstreamTransport EMANE::PlatformServiceUser EMANE::Buildable EMANE::RunningStateMutable EMANE::EventServiceUser EMANE::TimerServiceUser EMANE::MACLayer EMANE::PHYLayer EMANE::ShimLayer EMANE::TransportLayer

Public Types

enum  DescriptorType { DescriptorType::READ, DescriptorType::WRITE }
 

Public Member Functions

 ~NEMQueuedLayer ()
 
void initialize (Registrar &registrar) override
 
void start () override
 
void stop () override
 
void processConfiguration (const ConfigurationUpdate &update) override
 
void processDownstreamControl (const ControlMessages &msgs) override
 
void processDownstreamPacket (DownstreamPacket &pkt, const ControlMessages &msgs) override
 
void processUpstreamPacket (UpstreamPacket &pkt, const ControlMessages &msgs) override
 
void processUpstreamControl (const ControlMessages &msgs) override
 
void processEvent (const EventId &eventId, const Serialization &serialization) override
 
void processTimedEvent (TimerEventId eventId, const TimePoint &expireTime, const TimePoint &scheduleTime, const TimePoint &fireTime, const void *arg) override
 
template<typename Function >
void processTimer (Function fn, const TimePoint &expireTime, const TimePoint &scheduleTime, const TimePoint &fireTime)
 
NEMId getNEMId () const
 
virtual void configure (const ConfigurationUpdate &update)=0
 
virtual void postStart ()
 
virtual void destroy ()=0 throw ()
 
virtual void setDownstreamTransport (DownstreamTransport *pDownstreamTransport)
 
void sendDownstreamPacket (DownstreamPacket &pkt, const ControlMessages &msgs=empty)
 
void sendDownstreamControl (const ControlMessages &msgs)
 
virtual void setUpstreamTransport (UpstreamTransport *pUpstreamTransport)
 
void sendUpstreamPacket (UpstreamPacket &pkt, const ControlMessages &msgs=empty)
 
void sendUpstreamControl (const ControlMessages &msgs)
 
BuildId getBuildId () const
 
void setBuildId (BuildId bid)
 
template<typename Function >
void addFileDescriptor (int iFd, DescriptorType type, Function fn)
 

Static Public Attributes

static const ControlMessages empty
 
static const ControlMessages empty
 

Protected Types

using Callback = std::function< void(int iFd)>
 

Protected Member Functions

 NEMQueuedLayer (NEMId id, PlatformServiceProvider *pPlatformService)
 
virtual void doProcessConfiguration (const ConfigurationUpdate &)=0
 
virtual void doProcessDownstreamControl (const ControlMessages &)=0
 
virtual void doProcessDownstreamPacket (DownstreamPacket &, const ControlMessages &)=0
 
virtual void doProcessUpstreamPacket (UpstreamPacket &, const ControlMessages &)=0
 
virtual void doProcessUpstreamControl (const ControlMessages &)=0
 
virtual void doProcessEvent (const EventId &, const Serialization &)=0
 
virtual void doProcessTimedEvent (TimerEventId eventId, const TimePoint &expireTime, const TimePoint &scheduleTime, const TimePoint &fireTime, const void *arg)=0
 

Protected Attributes

NEMId id_
 

Detailed Description

A layer stack with a porcessing queue between each layer to decouple to intra queue processing.

Note
Transport processing is deferred using function objects. A processing thread is then used to work the function object queue processing packets, control, and events in a thread safe sequential manner.

Definition at line 63 of file nemqueuedlayer.h.

Member Typedef Documentation

◆ Callback

using EMANE::FileDescriptorServiceProvider::Callback = std::function<void(int iFd)>
protectedinherited

Definition at line 83 of file filedescriptorserviceprovider.h.

Member Enumeration Documentation

◆ DescriptorType

Enumerator
READ 

Process when data is ready to read

WRITE 

Process when data is ready to write

Definition at line 53 of file filedescriptorserviceprovider.h.

Constructor & Destructor Documentation

◆ ~NEMQueuedLayer()

EMANE::NEMQueuedLayer::~NEMQueuedLayer ( )

Definition at line 86 of file nemqueuedlayer.cc.

◆ NEMQueuedLayer()

EMANE::NEMQueuedLayer::NEMQueuedLayer ( NEMId  id,
PlatformServiceProvider pPlatformService 
)
protected

Definition at line 51 of file nemqueuedlayer.cc.

Member Function Documentation

◆ addFileDescriptor()

template<typename Function >
void EMANE::FileDescriptorServiceProvider::addFileDescriptor ( int  iFd,
DescriptorType  type,
Function  fn 
)
inherited

Adds a file descriptor for processing

Parameters
iFdFile descriptor
typeType of descriptor processing
fnA callable object

Definition at line 34 of file filedescriptorserviceprovider.inl.

◆ configure()

◆ destroy()

◆ doProcessConfiguration()

virtual void EMANE::NEMQueuedLayer::doProcessConfiguration ( const ConfigurationUpdate )
protectedpure virtual

◆ doProcessDownstreamControl()

virtual void EMANE::NEMQueuedLayer::doProcessDownstreamControl ( const ControlMessages )
protectedpure virtual

◆ doProcessDownstreamPacket()

virtual void EMANE::NEMQueuedLayer::doProcessDownstreamPacket ( DownstreamPacket ,
const ControlMessages  
)
protectedpure virtual

◆ doProcessEvent()

virtual void EMANE::NEMQueuedLayer::doProcessEvent ( const EventId ,
const Serialization  
)
protectedpure virtual

◆ doProcessTimedEvent()

virtual void EMANE::NEMQueuedLayer::doProcessTimedEvent ( TimerEventId  eventId,
const TimePoint expireTime,
const TimePoint scheduleTime,
const TimePoint fireTime,
const void *  arg 
)
protectedpure virtual

◆ doProcessUpstreamControl()

virtual void EMANE::NEMQueuedLayer::doProcessUpstreamControl ( const ControlMessages )
protectedpure virtual

◆ doProcessUpstreamPacket()

virtual void EMANE::NEMQueuedLayer::doProcessUpstreamPacket ( UpstreamPacket ,
const ControlMessages  
)
protectedpure virtual

◆ getBuildId()

EMANE::BuildId EMANE::Buildable::getBuildId ( ) const
inlineinherited

Gets the application wide unique BuildId of this object.

Returns
the BuildId

Definition at line 34 of file buildable.inl.

◆ getNEMId()

NEMId EMANE::NEMLayer::getNEMId ( ) const
inlineinherited

Get the NEM identifier.

Returns
NEM identifier

Definition at line 72 of file nemlayer.h.

◆ initialize()

void EMANE::NEMQueuedLayer::initialize ( Registrar registrar)
overridevirtual

Initialize the component.

Exceptions
InitializeExceptionthrown when an error is encountered during initialization

Implements EMANE::Component.

Reimplemented in EMANE::PHYLayer, EMANE::ShimLayer, and EMANE::TransportLayer.

Definition at line 104 of file nemqueuedlayer.cc.

◆ postStart()

◆ processConfiguration()

void EMANE::NEMQueuedLayer::processConfiguration ( const ConfigurationUpdate update)
overridevirtual

Process dynamic running-state configuration updates

Parameters
updateConfiguration update
Note
Running state configuration errors are indicated using a validator. Validators can be registered using the ConfigurationRegistrar.

Reimplemented from EMANE::RunningStateMutable.

Definition at line 192 of file nemqueuedlayer.cc.

◆ processDownstreamControl()

void EMANE::NEMQueuedLayer::processDownstreamControl ( const ControlMessages msgs)
overridevirtual

Process downstream control message

Parameters
msgsReference to the ControlMessages

Implements EMANE::DownstreamTransport.

Definition at line 200 of file nemqueuedlayer.cc.

◆ processDownstreamPacket()

void EMANE::NEMQueuedLayer::processDownstreamPacket ( DownstreamPacket pkt,
const ControlMessages msgs 
)
overridevirtual

Process downstream packet

Parameters
pktReference to the DownstreamPacket to process
msgsoptional reference to the ControlMessages

Implements EMANE::DownstreamTransport.

Definition at line 208 of file nemqueuedlayer.cc.

◆ processEvent()

void EMANE::NEMQueuedLayer::processEvent ( const EventId eventId,
const Serialization serialization 
)
overridevirtual

Process an event.

Parameters
eventIdevent identifier corresponding to the serialized event
serializationopaque event object data

Reimplemented from EMANE::EventServiceUser.

Definition at line 236 of file nemqueuedlayer.cc.

◆ processTimedEvent()

void EMANE::NEMQueuedLayer::processTimedEvent ( TimerEventId  eventId,
const TimePoint expireTime,
const TimePoint scheduleTime,
const TimePoint fireTime,
const void *  arg 
)
overridevirtual

Process a timed event

Parameters
eventIdIdentifier corresponding to the timer being processed
expireTimeThe time the timer was scheduled to expire
scheduleTimeThe Time the timer was scheduled
fireTimeTime time The time the timer actually fired
argOpaque timed event data
Note
All times are abosulte using CLOCK_REALTIME

Reimplemented from EMANE::TimerServiceUser.

Definition at line 247 of file nemqueuedlayer.cc.

◆ processTimer()

template<typename Function >
void EMANE::NEMQueuedLayer::processTimer ( Function  fn,
const TimePoint expireTime,
const TimePoint scheduleTime,
const TimePoint fireTime 
)

Definition at line 34 of file nemqueuedlayer.inl.

◆ processUpstreamControl()

void EMANE::NEMQueuedLayer::processUpstreamControl ( const ControlMessages msgs)
overridevirtual

Process upstream control message

Parameters
msgsreference to the ControlMessages

Implements EMANE::UpstreamTransport.

Definition at line 228 of file nemqueuedlayer.cc.

◆ processUpstreamPacket()

void EMANE::NEMQueuedLayer::processUpstreamPacket ( UpstreamPacket pkt,
const ControlMessages msgs 
)
overridevirtual

Process upstream packet

Parameters
pktreference to the UpstreamPacket to process
msgsoptional reference to the ControlMessages

Implements EMANE::UpstreamTransport.

Definition at line 219 of file nemqueuedlayer.cc.

◆ sendDownstreamControl()

void EMANE::UpstreamTransport::sendDownstreamControl ( const ControlMessages msgs)
inlineinherited

Send downstream control message

Parameters
msgsreference to the ControlMessages

Definition at line 44 of file upstreamtransport.inl.

◆ sendDownstreamPacket()

void EMANE::UpstreamTransport::sendDownstreamPacket ( DownstreamPacket pkt,
const ControlMessages msgs = empty 
)
inlineinherited

Send downsteam packet

Parameters
pktreference to the DownstreamPacket to process
msgsoptional reference to the ControlMessages

Definition at line 37 of file upstreamtransport.inl.

◆ sendUpstreamControl()

void EMANE::DownstreamTransport::sendUpstreamControl ( const ControlMessages msgs)
inlineinherited

Send upstream control message

Parameters
msgsReference to the ControlMessages

Definition at line 44 of file downstreamtransport.inl.

◆ sendUpstreamPacket()

void EMANE::DownstreamTransport::sendUpstreamPacket ( UpstreamPacket pkt,
const ControlMessages msgs = empty 
)
inlineinherited

Send upstream packet

Parameters
pktReference to the UpstreamPacket to process
msgsoptional reference to the ControlMessages

Definition at line 37 of file downstreamtransport.inl.

◆ setBuildId()

void EMANE::Buildable::setBuildId ( BuildId  bid)
inlineinherited

Sets the application wide unique BuildId of this object. Builders assign a BuildId to objects at instantiation.

Parameters
bidthe BuildId
Note
: This method is for internal framework use only.

Definition at line 40 of file buildable.inl.

◆ setDownstreamTransport()

virtual void EMANE::UpstreamTransport::setDownstreamTransport ( DownstreamTransport pDownstreamTransport)
inlinevirtualinherited

Set the downstream transport.

Parameters
pDownstreamTransportPointer to the downstream transport of this upstream transport.
Note
: This method is for internal framework use only.

Reimplemented in EMANE::NEMStatefulLayer, EMANE::PHYLayer, EMANE::MACLayer, EMANE::ShimLayer, and EMANE::TransportLayer.

Definition at line 82 of file upstreamtransport.h.

◆ setUpstreamTransport()

virtual void EMANE::DownstreamTransport::setUpstreamTransport ( UpstreamTransport pUpstreamTransport)
inlinevirtualinherited

Set the upstream transport.

Parameters
pUpstreamTransportPointer to the upstream transport of this downstream transport.

Reimplemented in EMANE::NEMStatefulLayer, EMANE::MACLayer, EMANE::ShimLayer, EMANE::PHYLayer, and EMANE::TransportLayer.

Definition at line 79 of file downstreamtransport.h.

◆ start()

void EMANE::NEMQueuedLayer::start ( )
overridevirtual

Start the component.

Exceptions
StartExceptionthrown when an error is encountered during start.

Implements EMANE::Component.

Reimplemented in EMANE::PHYLayer, EMANE::ShimLayer, and EMANE::TransportLayer.

Definition at line 169 of file nemqueuedlayer.cc.

◆ stop()

void EMANE::NEMQueuedLayer::stop ( )
overridevirtual

Stop the component.

Exceptions
StopExceptionthrown when an error is encountered during stop

Implements EMANE::Component.

Reimplemented in EMANE::PHYLayer, EMANE::ShimLayer, and EMANE::TransportLayer.

Definition at line 174 of file nemqueuedlayer.cc.

Member Data Documentation

◆ empty [1/2]

const EMANE::ControlMessages EMANE::DownstreamTransport::empty
staticinherited

Definition at line 102 of file downstreamtransport.h.

◆ empty [2/2]

const EMANE::ControlMessages EMANE::UpstreamTransport::empty
staticinherited

Definition at line 106 of file upstreamtransport.h.

◆ id_

NEMId EMANE::NEMLayer::id_
protectedinherited

Definition at line 81 of file nemlayer.h.


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