MAK RTIspy API Documentation for HLA 1.3
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes
DtForwarderNode Class Reference

The DtForwarderNode class defines a 3-way message distribution architecture for building forwarding networks of arbitrary complexity. More...

+ Collaboration diagram for DtForwarderNode:

List of all members.

Public Types

typedef DtMessageProcessor
< DtInetAddrAndPort,
DtForwarderPort::DtForwarderMsg
DtForwarderMessageProcessor
typedef DtForwarderNode *(* DtForwarderNodeCreatorFcn )(const DtRIDParameters *, DtForwarderMessageProcessor *, DtForwarderMessageProcessor *, int forwarderPort, MAKRti::DtInetAddr forwarderAddrToConnectTo, bool writeToPipeWhenReady)
 DtForwarderNode creator signature.

Public Member Functions

virtual ~DtForwarderNode ()
virtual int tick (double maxTime=0.0f)
 Forward pending inbound messages.
virtual void addTickCallback (DtTickCbFn fn, void *usr, MAKRti::DtTime interval)
 Register a callback to be called during tick, but only at the given interval.
virtual void removeTickCallback (DtTickCbFn fn, void *usr)
virtual bool ready () const
 Is the forwarder fully connected and actively forwarding?
virtual const DtRIDParametersparams () const
 Get the RID parameters object.
virtual DtBoost::shared_ptr
< DtRouteMap
routeMap () const
 Get the Route Map.
virtual DtForwarderPortinPort () const
 Get a pointer to the IN/OUT/LAN port.
virtual DtForwarderPortlanPort () const
virtual DtForwarderPortoutPort () const
virtual void selectParams (MAKRti::DtSelectParamWithWrite &selectParams)
 Get the current set of file descriptors to select against for notification.
virtual unsigned long localNodeId () const
 Get the ID of this Node for Routing purposes.
const DtInetAddrAndPortlocalNodeAddress () const
 Get the address of this Node for Routing purposes Not virtual as used in CTOR.
virtual MAKRti::DtString localNodeName () const
 Get the forwarder name.
virtual void processInToLanMsg (DtForwarderPort::DtAddressMsgPair &msg)
 Process and Send Msg from IN to LAN.
virtual void processInToOutMsg (DtForwarderPort::DtAddressMsgPair &msg)
 Process and Send Msg from IN to OUT.
virtual void processLanToOutMsg (DtForwarderPort::DtAddressMsgPair &msg)
 Process and Send Msg from LAN to OUT.
virtual void sendToLanPort (DtForwarderPort::DtAddressMsgPair &msg)
 Send message directly to LAN port.
virtual void sendToOutPort (DtForwarderPort::DtAddressMsgPair &msg)
 Send message directly to OUT port (all destinations)
virtual void sendToOutPort (DtForwarderPort::DtAddressMsgPair &msg, const DtRouteMap::DtAddressPortList &destinations)
 Send message directly to the specified OUT port destinations.
virtual void registerOutPortProcessor (DtForwarderMessageProcessor::Filter *processor)
 Add/Remove a Message Processor for IN or LAN to OUT messages (LAN to OUT messages identifiable since src == local)
virtual void unregisterOutPortProcessor (DtForwarderMessageProcessor::Filter *processor)
virtual void registerLanPortProcessor (DtForwarderMessageProcessor::Filter *processor)
 Add/Remove a Message Processor for IN to LAN messages.
virtual void unregisterLanPortProcessor (DtForwarderMessageProcessor::Filter *processor)
virtual void packageAndSendReliable (DtRtiMsg &msg, unsigned int sendViaIntfc)
 Wrap a DtRtiMsg in a DtForwarderMsg envelope and send to the indicated interfaces.
virtual void packageAndSendReliable (DtRtiMsg &msg, unsigned int sendViaIntfc, const DtRouteMap::DtAddressPortList &destinations)
virtual void setMetadataControl (DtMetadataType type, bool onOff)
 Set/Get metadata control indicators.
virtual bool isMetadataEnabled (DtMetadataType type)
virtual void lanPortListenToMulticastGroup (const MAKRti::DtInetAddr &mcastAddr)
 Listen/Drop multicast groups on LAN port's UDP receive socket.
virtual void lanPortDropMulticastGroup (const MAKRti::DtInetAddr &mcastAddr)
virtual bool lanPortUpdateFederateConnectionId (unsigned long orig, unsigned long final)
 Set locally connected federate's connectionId to final value specified by federate in its Connect Confirm message.
virtual DtInetAddrAndPort nextForwarderOnRoute (const DtInetAddrAndPort &target)
 Locate the next forwarder connection on the route to the targeted address.
virtual DtInetAddrAndPort nextForwarderOnRoute (const MAKRti::DtString &targetGroupName)
virtual DtInetAddrAndPort rootForwarder ()
 Return the IP address of the rtiexec's root forwarder.
virtual DtInetAddrAndPort nextHopToExec ()
 Return the next upstream outbound forwarder's IP address on the path toward the rtiexec's root forwarder.
virtual void abortPendingConnections ()
 Abort setting up embryonic connections.
virtual unsigned int abortedConnections ()
 Get the count of failed/aborted connection attempts.
virtual bool connectionInformation (unsigned int &numForwarderToForwarderConns, std::vector< MAKRti::DtString > &forwarderIdentifiers, std::vector< MAKRti::DtString > &forwarderConnectionHostNames, std::vector< DtInetAddrAndPort > &forwarderConnectionAddrs, unsigned int &numForwarderExecConns, unsigned int &numForwarderClientConns, std::vector< MAKRti::DtString > &clientConnectionHostNames, std::vector< MAKRti::DtInetAddr > &clientConnectionAddrs)
 Get connections information from the forwarder.
void continueWithoutUnconnectedFws ()
 If the forwarder is currently waiting for remote forwarder connections, this method tells it to abandon any unconnected forwarders and continue on without them.

Static Public Member Functions

static DtForwarderNodecreate (const DtRIDParameters *params, DtForwarderMessageProcessor *toOutProcessor, DtForwarderMessageProcessor *toLanProcessor, int forwarderPort, MAKRti::DtInetAddr forwarderAddrToConnectTo, bool writeToPipeWhenReady)
 Creates an instance of a DtForwarderNode.
static void setCreatorFunction (DtForwarderNodeCreatorFcn creator)
 Call this function to set an alternate creator function With this function, users can replace this DtForwarderNode with their own derived class.
static int newInPortConnection (const MAKRti::DtString &connName, unsigned int connID, const DtInetAddrAndPort &connAddr, void *usr)
 Callbacks.
static int newOutPortConnection (const MAKRti::DtString &connName, unsigned int connID, const DtInetAddrAndPort &connAddr, void *usr)
static int lostInPortConnection (const MAKRti::DtString &connName, unsigned int connID, const DtInetAddrAndPort &connAddr, void *usr)
static int lostOutPortConnection (const MAKRti::DtString &connName, unsigned int connID, const DtInetAddrAndPort &connAddr, void *usr)
static void inOutForwarderPortReady (unsigned long forwarderNodeId, void *usr)

Protected Member Functions

 DtForwarderNode (const DtRIDParameters *params, DtForwarderMessageProcessor *toOutProcessor, DtForwarderMessageProcessor *toLanProcessor, int forwarderPort, const MAKRti::DtInetAddr &forwarderAddrToConnectTo, bool writeToPipeWhenReady)
 Base Constructor.
 DtForwarderNode ()
 Default Ctor, Copy Ctor, and Assignment - unimplemented.
 DtForwarderNode (const DtForwarderNode &orig)
DtForwarderNodeoperator= (const DtForwarderNode &orig)
int refreshConnections ()
 Ensure that all connections are stable and connected.
void writeMessageToPipe (const MAKRti::DtString &msg)
 Write message to rtiexec pipe.
int newInPortConnection (const MAKRti::DtString &connName, unsigned int connID, const DtInetAddrAndPort &connAddr)
 Callbacks.
int newOutPortConnection (const MAKRti::DtString &connName, unsigned int connID, const DtInetAddrAndPort &connAddr)
int lostInPortConnection (const MAKRti::DtString &connName, unsigned int connID, const DtInetAddrAndPort &connAddr)
int lostOutPortConnection (const MAKRti::DtString &connName, unsigned int connID, const DtInetAddrAndPort &connAddr)
void inOutForwarderPortReady (unsigned long forwarderNodeId)

Protected Attributes

const DtRIDParametersmyParams
 RID file configuration.
DtForwarderMessageProcessormyToOutMsgProcessor
 Outgoing message processors allow user defined operations to be performed on messages before sending to specified port.
DtForwarderMessageProcessormyToLanMsgProcessor
DtForwarderFaultProcessormyFaultProcessor
 Fault handler.
DtClock myClock
 A clock used for basic timing.
bool myIsReady
 Is the Forwarder in a "Good" state and ready to forward?
DtBoost::shared_ptr< DtRouteMapmyRoutes
 Routing file configuration Keep this variable before myLocalPort in the class declaration!!
DtForwarderPortmyRemoteInputPort
 IN Port - incoming message path from other DtForwarderNodes.
DtForwarderPortmyRemoteOutputPort
 OUT Port - outgoing message path to other DtForwarderNodes.
DtForwarderPortmyLocalPort
 LAN Port - bidirectional message path to/from local message sources/sinks Keep this variable after myRoutes in the class declaration!!
DtInetAddrAndPort myLocalNodeAddress
 IP address and port of the local node.
bool myAddTcpDestinationListMetadata
 Metadata control indicators.
bool myAddUdpDestinationListMetadata
bool myAddTransportTypeMetadata
bool myAddMcastMetadata
bool myWriteToPipeWhenReady
 Whether the forwarder should write to the pipe once it is ready.
std::list< DtTickCallbackInfomyTickCallbacks
 List of tick callbacks.

Static Protected Attributes

static const MAKRti::DtInetAddr theFirstHostInetAddr = DtDefaultInterfaceAddr()
static DtForwarderNodeCreatorFcn theCreator = 0

Detailed Description

The DtForwarderNode class defines a 3-way message distribution architecture for building forwarding networks of arbitrary complexity.

The DtForwarderNode has 3 interfaces: IN: - incoming message path from other DtForwarderNodes OUT: - outgoing message path to other DtForwarderNodes LAN: - bidirectional message path to/from local message sources/sinks ( generally HLA Federates )

Forwarding Pathways: 1) Messages from LAN will be forwarded out to upstream/downstream forwarders in hierarchical configurations, to the portal forwarders in foreign Forwarder Groups, and to other LAN connections 2) Messages from IN will be forwarded out to LAN 3) Messages from IN can ONLY be forwarded out to OUT under the following conditions: (a) The forwarder is acting as a bridge (aka "link") node between upstream forwarders and downstream forwarders in a hierarchical network. In this case the user must configure the route and specify the endpoints and the bridge forwarder. This will create an entry in the DtRouteMap myRoutesByLinkAddrMap map. Messages can be forwarded FROM upstream sources TO downstream recipients and vice-versa. (b) The forwarder is acting as a portal forwarder in a Forwarder Group. Only certain internal messages will be forwarded, and only FROM foreign Forwarder Groups TO members of the local group, not in the reverse direction. The reverse direction is taken care of by virtue of the fact that all the local group members will have a connection to a portal in the foreign Forwarder Groups so the messages do not need to pass through the local portal. Some messages require the local portal to aggregate responses of the local group members, but the group members individual response messages are not forwarded in those cases.

Note: These pathways do not guarantee that a message will be forwarded as described above. Outlets may be altered by filters and destinations can be added or removed based on the type of message and the network topology. An optional filter may be applied to all messages forwarded to OUT to allow a final message processing step before passing the message.


Member Typedef Documentation

typedef DtForwarderNode*(* DtForwarderNode::DtForwarderNodeCreatorFcn)(const DtRIDParameters *, DtForwarderMessageProcessor *, DtForwarderMessageProcessor *, int forwarderPort, MAKRti::DtInetAddr forwarderAddrToConnectTo, bool writeToPipeWhenReady)

DtForwarderNode creator signature.


Constructor & Destructor Documentation

DtForwarderNode::DtForwarderNode ( const DtRIDParameters params,
DtForwarderMessageProcessor toOutProcessor,
DtForwarderMessageProcessor toLanProcessor,
int  forwarderPort,
const MAKRti::DtInetAddr &  forwarderAddrToConnectTo,
bool  writeToPipeWhenReady 
) [protected]

Default Ctor, Copy Ctor, and Assignment - unimplemented.

Referenced by create().

DtForwarderNode::DtForwarderNode ( const DtForwarderNode orig) [protected]

Member Function Documentation

unsigned int DtForwarderNode::abortedConnections ( ) [inline, virtual]

Get the count of failed/aborted connection attempts.

References lanPort(), and outPort().

void DtForwarderNode::addTickCallback ( DtTickCbFn  fn,
void *  usr,
MAKRti::DtTime  interval 
) [virtual]

Register a callback to be called during tick, but only at the given interval.

References myTickCallbacks.

bool DtForwarderNode::connectionInformation ( unsigned int &  numForwarderToForwarderConns,
std::vector< MAKRti::DtString > &  forwarderIdentifiers,
std::vector< MAKRti::DtString > &  forwarderConnectionHostNames,
std::vector< DtInetAddrAndPort > &  forwarderConnectionAddrs,
unsigned int &  numForwarderExecConns,
unsigned int &  numForwarderClientConns,
std::vector< MAKRti::DtString > &  clientConnectionHostNames,
std::vector< MAKRti::DtInetAddr > &  clientConnectionAddrs 
) [virtual]

If the forwarder is currently waiting for remote forwarder connections, this method tells it to abandon any unconnected forwarders and continue on without them.

References DtForwarderPort::abortPendingConnections(), DtForwarderPort::clearNeededConnections(), myIsReady, myRemoteInputPort, and myRemoteOutputPort.

DtForwarderNode * DtForwarderNode::create ( const DtRIDParameters params,
DtForwarderMessageProcessor toOutProcessor,
DtForwarderMessageProcessor toLanProcessor,
int  forwarderPort,
MAKRti::DtInetAddr  forwarderAddrToConnectTo,
bool  writeToPipeWhenReady 
) [static]

Creates an instance of a DtForwarderNode.

References DtForwarderNode(), params(), and theCreator.

Referenced by DtForwarderNode(), and setCreatorFunction().

void DtForwarderNode::inOutForwarderPortReady ( unsigned long  forwarderNodeId,
void *  usr 
) [static]
void DtForwarderNode::inOutForwarderPortReady ( unsigned long  forwarderNodeId) [protected]
DtForwarderPort * DtForwarderNode::inPort ( ) const [inline, virtual]
DtForwarderPort * DtForwarderNode::lanPort ( ) const [inline, virtual]
void DtForwarderNode::lanPortDropMulticastGroup ( const MAKRti::DtInetAddr &  mcastAddr) [virtual]
void DtForwarderNode::lanPortListenToMulticastGroup ( const MAKRti::DtInetAddr &  mcastAddr) [virtual]

Listen/Drop multicast groups on LAN port's UDP receive socket.

References lanPort(), and DtForwarderPort::listenToMulticastGroup().

bool DtForwarderNode::lanPortUpdateFederateConnectionId ( unsigned long  orig,
unsigned long  final 
) [virtual]

Set locally connected federate's connectionId to final value specified by federate in its Connect Confirm message.

References lanPort(), and DtForwarderPort::updateFederateConnectionId().

unsigned long DtForwarderNode::localNodeId ( ) const [virtual]

Get the ID of this Node for Routing purposes.

References myRoutes.

Referenced by DtForwarderFaultProcessor::lostConnection().

MAKRti::DtString DtForwarderNode::localNodeName ( ) const [virtual]

Get the forwarder name.

References localNodeAddress(), and myRoutes.

int DtForwarderNode::lostInPortConnection ( const MAKRti::DtString &  connName,
unsigned int  connID,
const DtInetAddrAndPort connAddr,
void *  usr 
) [static]
int DtForwarderNode::lostInPortConnection ( const MAKRti::DtString &  connName,
unsigned int  connID,
const DtInetAddrAndPort connAddr 
) [protected]
int DtForwarderNode::lostOutPortConnection ( const MAKRti::DtString &  connName,
unsigned int  connID,
const DtInetAddrAndPort connAddr,
void *  usr 
) [static]
int DtForwarderNode::lostOutPortConnection ( const MAKRti::DtString &  connName,
unsigned int  connID,
const DtInetAddrAndPort connAddr 
) [protected]
int DtForwarderNode::newInPortConnection ( const MAKRti::DtString &  connName,
unsigned int  connID,
const DtInetAddrAndPort connAddr,
void *  usr 
) [static]

Callbacks.

Referenced by DtForwarderNode(), and ~DtForwarderNode().

int DtForwarderNode::newInPortConnection ( const MAKRti::DtString &  connName,
unsigned int  connID,
const DtInetAddrAndPort connAddr 
) [protected]
int DtForwarderNode::newOutPortConnection ( const MAKRti::DtString &  connName,
unsigned int  connID,
const DtInetAddrAndPort connAddr,
void *  usr 
) [static]
int DtForwarderNode::newOutPortConnection ( const MAKRti::DtString &  connName,
unsigned int  connID,
const DtInetAddrAndPort connAddr 
) [protected]

Locate the next forwarder connection on the route to the targeted address.

Returns the address only if connection is active (ie. the socket is connected).

References DtForwarderPort::checkConnectionStatus(), outPort(), and routeMap().

Referenced by DtForwarderFaultProcessor::locateGroupPortal().

DtInetAddrAndPort DtForwarderNode::nextForwarderOnRoute ( const MAKRti::DtString &  targetGroupName) [virtual]

Return the next upstream outbound forwarder's IP address on the path toward the rtiexec's root forwarder.

References myFaultProcessor, and DtForwarderFaultProcessor::nextHopTowardRootForwarder().

DtForwarderNode& DtForwarderNode::operator= ( const DtForwarderNode orig) [protected]
DtForwarderPort * DtForwarderNode::outPort ( ) const [inline, virtual]
void DtForwarderNode::packageAndSendReliable ( DtRtiMsg msg,
unsigned int  sendViaIntfc 
) [virtual]
void DtForwarderNode::packageAndSendReliable ( DtRtiMsg msg,
unsigned int  sendViaIntfc,
const DtRouteMap::DtAddressPortList destinations 
) [virtual]
const DtRIDParameters * DtForwarderNode::params ( ) const [inline, virtual]

Get the RID parameters object.

References myParams.

Referenced by create().

bool DtForwarderNode::ready ( ) const [inline, virtual]

Is the forwarder fully connected and actively forwarding?

References myIsReady.

Add/Remove a Message Processor for IN or LAN to OUT messages (LAN to OUT messages identifiable since src == local)

References DtMessageProcessor< Address, Message >::addDestinationFilter(), DtMessageProcessor< Address, Message >::addMessageFilter(), and myToOutMsgProcessor.

Referenced by DtForwarderFaultProcessor::DtForwarderFaultProcessor().

void DtForwarderNode::removeTickCallback ( DtTickCbFn  fn,
void *  usr 
) [virtual]

References myTickCallbacks.

Return the IP address of the rtiexec's root forwarder.

References myFaultProcessor, and DtForwarderFaultProcessor::rootForwarder().

DtBoost::shared_ptr< DtRouteMap > DtForwarderNode::routeMap ( ) const [inline, virtual]
void DtForwarderNode::selectParams ( MAKRti::DtSelectParamWithWrite &  selectParams) [virtual]

Get the current set of file descriptors to select against for notification.

References myLocalPort, myRemoteInputPort, myRemoteOutputPort, and DtForwarderPort::selectParams().

Send message directly to the specified OUT port destinations.

References myRemoteOutputPort, and DtForwarderPort::sendToListReliable().

Call this function to set an alternate creator function With this function, users can replace this DtForwarderNode with their own derived class.

References create(), DtBindCreator(), and theCreator.

void DtForwarderNode::setMetadataControl ( DtMetadataType  type,
bool  onOff 
) [virtual]
int DtForwarderNode::tick ( double  maxTime = 0.0f) [virtual]

Forward pending inbound messages.

  • maxTime allows the caller to specify a time-out after which tick will return even if msgs are still pending
  • default: 0.0f implies process msgs until there are NO more pending

References DtForwarderPort::flush(), DtForwarderPort::getNextMsg(), myClock, myIsReady, myLocalPort, myRemoteInputPort, myRemoteOutputPort, myTickCallbacks, myWriteToPipeWhenReady, processInToLanMsg(), processInToOutMsg(), processLanToOutMsg(), refreshConnections(), and writeMessageToPipe().

void DtForwarderNode::writeMessageToPipe ( const MAKRti::DtString &  msg) [protected]

Write message to rtiexec pipe.

References NULL.

Referenced by tick(), and ~DtForwarderNode().


Member Data Documentation

Metadata control indicators.

Referenced by DtForwarderNode().

Referenced by DtForwarderNode().

DtClock DtForwarderNode::myClock [protected]

A clock used for basic timing.

Referenced by DtForwarderNode(), and tick().

Is the Forwarder in a "Good" state and ready to forward?

Referenced by abortPendingConnections(), continueWithoutUnconnectedFws(), ready(), refreshConnections(), tick(), and ~DtForwarderNode().

IP address and port of the local node.

Referenced by DtForwarderNode(), and localNodeAddress().

LAN Port - bidirectional message path to/from local message sources/sinks Keep this variable after myRoutes in the class declaration!!

Referenced by abortPendingConnections(), DtForwarderNode(), inOutForwarderPortReady(), lanPort(), refreshConnections(), selectParams(), sendToLanPort(), tick(), and ~DtForwarderNode().

RID file configuration.

Referenced by DtForwarderNode(), and params().

DtBoost::shared_ptr<DtRouteMap> DtForwarderNode::myRoutes [protected]

Routing file configuration Keep this variable before myLocalPort in the class declaration!!

Referenced by DtForwarderNode(), localNodeId(), localNodeName(), and routeMap().

List of tick callbacks.

Referenced by addTickCallback(), removeTickCallback(), and tick().

Outgoing message processors allow user defined operations to be performed on messages before sending to specified port.

Referenced by processInToOutMsg(), processLanToOutMsg(), registerOutPortProcessor(), and unregisterOutPortProcessor().

Whether the forwarder should write to the pipe once it is ready.

Referenced by tick(), and ~DtForwarderNode().

Referenced by create(), and setCreatorFunction().

const MAKRti::DtInetAddr DtForwarderNode::theFirstHostInetAddr = DtDefaultInterfaceAddr() [static, protected]

Referenced by DtForwarderNode().


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

Document ID: Generated on Thu Jun 14 14:15:04 EDT 2012 from SVN revision 116116
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)