# Communications Class Reference

`#include <Communications.hh>`

List of all members.

## Public Member Functions
| Communications (int RTIA_port)
| Communications.
| ~Communications ()
| ~Communications.
void | sendMessage (NetworkMessage *Msg)
| Send a message to RTIG.
void | sendUN (Message *Msg)
void | receiveUN (Message *Msg)
void | readMessage (int &, NetworkMessage **, Message **, struct timeval *)
| read message.
void | requestFederateService (Message *req)
| Request a service to federate.
unsigned long | getAddress ()
unsigned int | getPort ()
NetworkMessage * | waitMessage (NetworkMessage::Type type_msg, FederateHandle numeroFedere)
| Wait for a message coming from RTIG and return when received.
## Public Attributes
MessageBuffer | NM_msgBufSend
MessageBuffer | NM_msgBufReceive
MessageBuffer | msgBufSend
MessageBuffer | msgBufReceive
## Protected Attributes
SocketUN * | socketUN
SocketTCP * | socketTCP
SocketUDP * | socketUDP
## Private Member Functions
bool | searchMessage (NetworkMessage::Type type_msg, FederateHandle numeroFedere, NetworkMessage **msg)
## Private Attributes
std::list< NetworkMessage * > | waitingList
| this is the wait list of message already received from RTIG but not dispatched message.

## Detailed Description

Definition at line 42 of file Communications.hh.

## Constructor & Destructor Documentation

Communications | ( | int | RTIA_port | ) |

Communications.

Definition at line 96 of file Communications.cc.

References SocketUN::acceptUN(), SocketUDP::createConnection(), SocketTCP::createConnection(), PORT_TCP_RTIG, PORT_UDP_RTIG, Communications::socketTCP, Communications::socketUDP, and Communications::socketUN.

Here is the call graph for this function:

~Communications | ( |  | ) |

~Communications.

Definition at line 145 of file Communications.cc.

References SocketTCP::close(), Communications::NM_msgBufSend, PrettyDebug::Out(), pdGendoc, NetworkMessage::send(), Communications::socketTCP, Communications::socketUDP, and Communications::socketUN.

Here is the call graph for this function:

## Member Function Documentation

void sendMessage | ( | NetworkMessage * | Msg | ) |

Send a message to RTIG.

Definition at line 344 of file Communications.cc.

References Communications::NM_msgBufSend, NetworkMessage::send(), and Communications::socketTCP.

Referenced by DataDistribution::associateRegion(), OwnershipManagement::attributeOwnedByFederate(), OwnershipManagement::attributeOwnershipAcquisition(), OwnershipManagement::attributeOwnershipAcquisitionIfAvailable(), OwnershipManagement::attributeOwnershipRealeaseResponse(), OwnershipManagement::cancelattributeOwnershipAcquisition(), OwnershipManagement::cancelnegotiatedAttributeOwnershipDivestiture(), ObjectManagement::changeAttributeOrderType(), ObjectManagement::changeAttributeTransportType(), ObjectManagement::changeInteractionOrderType(), ObjectManagement::changeInteractionTransportType(), DataDistribution::createRegion(), ObjectManagement::deleteObject(), DataDistribution::deleteRegion(), FederationManagement::destroyFederationExecution(), FederationManagement::federateRestoreStatus(), FederationManagement::federateSaveBegun(), FederationManagement::federateSaveStatus(), FederationManagement::joinFederationExecution(), DataDistribution::modifyRegion(), OwnershipManagement::negotiatedAttributeOwnershipDivestiture(), DeclarationManagement::publishInteractionClass(), DeclarationManagement::publishObjectClass(), OwnershipManagement::queryAttributeOwnership(), ObjectManagement::registerObject(), DataDistribution::registerObject(), FederationManagement::registerSynchronization(), FederationManagement::requestFederationRestore(), FederationManagement::requestFederationSave(), ObjectManagement::requestObjectAttributeValueUpdate(), FederationManagement::resignFederationExecution(), ObjectManagement::sendInteraction(), TimeManagement::sendNullMessage(), ObjectManagement::setAttributeRelevanceAdvisorySwitch(), ObjectManagement::setAttributeScopeAdvisorySwitch(), DeclarationManagement::setClassRelevanceAdvisorySwitch(), DeclarationManagement::setInteractionRelevanceAdvisorySwitch(), TimeManagement::setTimeConstrained(), TimeManagement::setTimeRegulating(), DataDistribution::subscribe(), DataDistribution::subscribeInteraction(), DeclarationManagement::subscribeInteractionClass(), DeclarationManagement::subscribeObjectClassAttribute(), DataDistribution::unassociateRegion(), OwnershipManagement::unconditionalAttributeOwnershipDivestiture(), DeclarationManagement::unpublishInteractionClass(), DeclarationManagement::unpublishObjectClass(), FederationManagement::unregisterSynchronization(), DataDistribution::unsubscribeAttributes(), DataDistribution::unsubscribeInteraction(), DeclarationManagement::unsubscribeInteractionClass(), DeclarationManagement::unsubscribeObjectClassAttribute(), and ObjectManagement::updateAttributeValues().

Here is the call graph for this function:

void sendUN | ( | Message * | Msg | ) |

Definition at line 351 of file Communications.cc.

References Communications::msgBufSend, Message::send(), and Communications::socketUN.

Referenced by RTIA::processFederateRequest(), DeclarationManagement::stopRegistrationForObjectClass(), DeclarationManagement::turnInteractionsOff(), and DeclarationManagement::turnInteractionsOn().

Here is the call graph for this function:

void receiveUN | ( | Message * | Msg | ) |

Definition at line 358 of file Communications.cc.

References Communications::msgBufReceive, Message::receive(), and Communications::socketUN.

Referenced by DeclarationManagement::stopRegistrationForObjectClass(), DeclarationManagement::turnInteractionsOff(), and DeclarationManagement::turnInteractionsOn().

Here is the call graph for this function:

void readMessage | ( | int & | n,
|  | NetworkMessage ** | msg_reseau,
|  | Message ** | msg,
|  | struct timeval * | timeout |
| ) |  |  |

read message.

Reads a message either from the network or from the federate Returns the actual source in the 1st parameter (RTIG=>1 federate=>2)

Definition at line 197 of file Communications.cc.

References SocketUN::isDataReady(), SocketUDP::isDataReady(), SocketTCP::isDataReady(), Communications::msgBufReceive, NM_Factory::receive(), SocketUN::returnSocket(), SocketUDP::returnSocket(), SocketTCP::returnSocket(), Communications::socketTCP, Communications::socketUDP, Communications::socketUN, and Communications::waitingList.

Referenced by RTIA::execute().

Here is the call graph for this function:

void requestFederateService | ( | Message * | req | ) |

Request a service to federate.

Definition at line 167 of file Communications.cc.

References Communications::msgBufSend, PrettyDebug::Out(), pdRequest, Message::send(), Communications::socketUN, and Message::type.

Referenced by FederationManagement::announceSynchronizationPoint(), OwnershipManagement::attributeIsNotOwned(), OwnershipManagement::attributeOwnershipAcquisitionNotification(), OwnershipManagement::attributeOwnershipDivestitureNotification(), OwnershipManagement::attributeOwnershipUnavailable(), ObjectManagement::attributesInScope(), ObjectManagement::attributesOutOfScope(), OwnershipManagement::confirmAttributeOwnershipAcquisitionCancellation(), ObjectManagement::discoverObject(), FederationManagement::federationRestoreBegun(), FederationManagement::federationRestoredStatus(), FederationManagement::federationSavedStatus(), FederationManagement::federationSynchronized(), OwnershipManagement::informAttributeOwnership(), FederationManagement::initiateFederateRestore(), FederationManagement::initiateFederateSave(), RTIA::processOngoingTick(), ObjectManagement::provideAttributeValueUpdate(), ObjectManagement::receiveInteraction(), ObjectManagement::reflectAttributeValues(), ObjectManagement::removeObject(), OwnershipManagement::requestAttributeOwnershipAssumption(), OwnershipManagement::requestAttributeOwnershipRelease(), FederationManagement::requestFederationRestoreStatus(), DeclarationManagement::startRegistrationForObjectClass(), FederationManagement::synchronizationPointRegistrationFailed(), FederationManagement::synchronizationPointRegistrationSucceeded(), TimeManagement::timeAdvanceGrant(), TimeManagement::timeConstrainedEnabled(), TimeManagement::timeRegulationEnabled(), ObjectManagement::turnUpdatesOffForObjectInstance(), and ObjectManagement::turnUpdatesOnForObjectInstance().

Here is the call graph for this function:

unsigned long getAddress | ( |  | ) |

Definition at line 179 of file Communications.cc.

References SocketUDP::getAddr(), and Communications::socketUDP.

Referenced by FederationManagement::joinFederationExecution().

Here is the call graph for this function:

unsigned int getPort | ( |  | ) |

Definition at line 186 of file Communications.cc.

References SocketUDP::getPort(), and Communications::socketUDP.

Referenced by FederationManagement::joinFederationExecution().

Here is the call graph for this function:

NetworkMessage * waitMessage | ( | NetworkMessage::Type | type_msg,
|  | FederateHandle | numeroFedere |
| ) |  |  |

Wait for a message coming from RTIG and return when received.

Parameters:

  `[in]` | type_msg,expected | message type,
  `[in]` | numeroFedere,federate | which sent the message, 0 if indifferent.

Returns:
  the pointer to new awaited message

Definition at line 63 of file Communications.cc.

References NetworkMessage::federate, NetworkMessage::getType(), NetworkMessage::LAST, PrettyDebug::Out(), pdProtocol, NM_Factory::receive(), Communications::searchMessage(), Communications::socketTCP, and Communications::waitingList.

Referenced by DataDistribution::associateRegion(), OwnershipManagement::attributeOwnedByFederate(), OwnershipManagement::attributeOwnershipAcquisition(), OwnershipManagement::attributeOwnershipAcquisitionIfAvailable(), OwnershipManagement::attributeOwnershipRealeaseResponse(), OwnershipManagement::cancelattributeOwnershipAcquisition(), OwnershipManagement::cancelnegotiatedAttributeOwnershipDivestiture(), ObjectManagement::changeAttributeOrderType(), ObjectManagement::changeAttributeTransportType(), ObjectManagement::changeInteractionOrderType(), ObjectManagement::changeInteractionTransportType(), DataDistribution::createRegion(), ObjectManagement::deleteObject(), DataDistribution::deleteRegion(), FederationManagement::destroyFederationExecution(), FederationManagement::joinFederationExecution(), DataDistribution::modifyRegion(), OwnershipManagement::negotiatedAttributeOwnershipDivestiture(), DeclarationManagement::publishInteractionClass(), DeclarationManagement::publishObjectClass(), OwnershipManagement::queryAttributeOwnership(), ObjectManagement::registerObject(), DataDistribution::registerObject(), ObjectManagement::requestObjectAttributeValueUpdate(), FederationManagement::resignFederationExecution(), ObjectManagement::sendInteraction(), DataDistribution::subscribe(), DataDistribution::subscribeInteraction(), DeclarationManagement::subscribeInteractionClass(), DeclarationManagement::subscribeObjectClassAttribute(), DataDistribution::unassociateRegion(), OwnershipManagement::unconditionalAttributeOwnershipDivestiture(), DeclarationManagement::unpublishInteractionClass(), DeclarationManagement::unpublishObjectClass(), DataDistribution::unsubscribeAttributes(), DataDistribution::unsubscribeInteraction(), DeclarationManagement::unsubscribeInteractionClass(), DeclarationManagement::unsubscribeObjectClassAttribute(), and ObjectManagement::updateAttributeValues().

Here is the call graph for this function:

bool searchMessage | ( | NetworkMessage::Type | type_msg,
|  | FederateHandle | numeroFedere,
|  | NetworkMessage ** | msg |
| ) |  |  | `[private]`

Returns true if a 'type_msg' message coming from federate 'numeroFedere' (or any other federate if numeroFedere == 0) was in the queue and was copied in 'msg'. If no such message is found, returns RTI_FALSE.

Definition at line 318 of file Communications.cc.

References PrettyDebug::Out(), pdProtocol, and Communications::waitingList.

Referenced by Communications::waitMessage().

Here is the call graph for this function:

## Member Data Documentation

MessageBuffer NM_msgBufSend

Definition at line 66 of file Communications.hh.

Referenced by Communications::sendMessage(), and Communications::~Communications().

MessageBuffer NM_msgBufReceive

Definition at line 66 of file Communications.hh.

MessageBuffer msgBufSend

Definition at line 67 of file Communications.hh.

Referenced by Communications::requestFederateService(), and Communications::sendUN().

MessageBuffer msgBufReceive

Definition at line 67 of file Communications.hh.

Referenced by Communications::readMessage(), and Communications::receiveUN().

SocketUN* socketUN`[protected]`

Definition at line 70 of file Communications.hh.

Referenced by Communications::Communications(), Communications::readMessage(), Communications::receiveUN(), Communications::requestFederateService(), Communications::sendUN(), and Communications::~Communications().

SocketTCP* socketTCP`[protected]`

Definition at line 74 of file Communications.hh.

Referenced by Communications::Communications(), Communications::readMessage(), Communications::sendMessage(), Communications::waitMessage(), and Communications::~Communications().

SocketUDP* socketUDP`[protected]`

Definition at line 75 of file Communications.hh.

Referenced by Communications::Communications(), Communications::getAddress(), Communications::getPort(), Communications::readMessage(), and Communications::~Communications().

std::list<NetworkMessage *> waitingList`[private]`

this is the wait list of message already received from RTIG but not dispatched message.

Definition at line 83 of file Communications.hh.

Referenced by Communications::readMessage(), Communications::searchMessage(), and Communications::waitMessage().

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

- Communications.hh
- Communications.cc