|
WSF
|
#include <WsfCommProtocolIGMP.hpp>


Classes | |
| struct | RouteData |
| A simple data structure to hold routing data. More... | |
Public Member Functions | |
| ProtocolIGMP ()=default | |
| ~ProtocolIGMP () override=default | |
| Public Member Functions inherited from wsf::comm::ProtocolInterface | |
| ProtocolInterface ()=default | |
| ~ProtocolInterface () override=default | |
| const char * | GetScriptClassName () const override |
| WsfStringId | GetComponentName () const final |
| bool | Initialize (double aSimTime) override |
| bool | ProcessInput (UtInput &aInput) override |
| bool | operator< (const ProtocolInterface &aRhs) const |
| virtual ProcessResult | ApplicationSend (double aSimTime, size_t aLayerIndex, Message &aMessage) |
| virtual ProcessResult | ApplicationReceive (double aSimTime, size_t aLayerIndex, Message &aMessage) |
| virtual ProcessResult | PresentationSend (double aSimTime, size_t aLayerIndex, Message &aMessage) |
| virtual ProcessResult | PresentationReceive (double aSimTime, size_t aLayerIndex, Message &aMessage) |
| virtual ProcessResult | SessionSend (double aSimTime, size_t aLayerIndex, Message &aMessage) |
| virtual ProcessResult | SessionReceive (double aSimTime, size_t aLayerIndex, Message &aMessage) |
| virtual ProcessResult | TransportSend (double aSimTime, size_t aLayerIndex, Message &aMessage) |
| virtual ProcessResult | TransportReceive (double aSimTime, size_t aLayerIndex, Message &aMessage) |
| virtual ProcessResult | DatalinkSend (double aSimTime, size_t aLayerIndex, Message &aMessage) |
| virtual ProcessResult | DatalinkReceive (double aSimTime, size_t aLayerIndex, Message &aMessage) |
| virtual ProcessResult | PhysicalSend (double aSimTime, size_t aLayerIndex, Message &aMessage) |
| Public Member Functions inherited from wsf::comm::Component | |
| Component ()=default | |
| ~Component () override=default | |
| Comm * | GetComm () const |
| WsfPlatform * | GetPlatform () const |
| WsfSimulation * | GetSimulation () const |
| virtual void | TurnOn (double aSimTime) |
| virtual void | TurnOff (double aSimTime) |
| virtual void | PendingStart () |
| virtual bool | Initialize2 (double aSimTime) |
| virtual bool | PreInitialize (double aSimTime) |
| virtual void | AttemptToTransmit (double aSimTime, Result &aResult) |
| virtual void | AttemptToReceive (double aSimTime, Result &aResult) |
| virtual bool | CanInteractWith (const Comm *aXmtrPtr) |
| virtual bool | Receive (double aSimTime, Comm *aXmtrPtr, Message &aMessage) |
| virtual bool | Send (double aSimTime, const WsfMessage &aMessage, const Address &aAddress) |
| Public Member Functions inherited from WsfComponentT< Comm > | |
| WsfComponentT () | |
| WsfComponentT & | operator= (const WsfComponentT &) noexcept |
| ~WsfComponentT () override=default | |
| virtual void | ComponentParentChanged (ParentType *aParentPtr) |
| ParentType * | GetComponentParent () const |
| void | SetComponentParent (ParentType *aParentPtr) |
| Public Member Functions inherited from WsfComponent | |
| virtual | ~WsfComponent ()=default |
| virtual int | GetComponentInitializationOrder () const |
| template<typename T> | |
| bool | QueryInterfaceT (T *&aRolePtr) |
| bool | ComponentHasRole (int aRole) |
| Returns true if the component has the specified role. | |
| virtual void | PreInput () |
| Public Member Functions inherited from WsfObject | |
| WsfObject () | |
| This is the constructor for the WsfObject class. | |
| ~WsfObject () override | |
| This is the destructor for the WsfObject class. | |
| const char * | GetScriptClassName () const override |
| const std::string & | GetType () const |
| WsfStringId | GetTypeId () const |
| Get the string ID of the 'type' of the object. | |
| void | SetType (WsfStringId aType) |
| const std::string & | GetBaseType () const |
| WsfStringId | GetBaseTypeId () const |
| const TypeList & | GetTypeList () const |
| bool | IsA_TypeOf (WsfStringId aType) const |
| WsfObject & | operator= (const WsfObject &aRhs) |
| Assignment operator. | |
| template<typename T> | |
| void | Serialize (T &aBuff) |
| For XIO (de)serialization. | |
| const std::string & | GetName () const |
| WsfStringId | GetNameId () const |
| void | SetName (WsfStringId aName) |
Static Public Member Functions | |
| static ProtocolIGMP * | Find (const Comm &aParent) |
| static ProtocolIGMP * | FindOrCreate (Comm &aParent) |
| static void | AttemptToTransmit (Comm &aComm, double aSimTime, Result &aResult) |
| Called by model implementations when attempting to send a message. | |
| static void | AttemptToReceive (Comm &aComm, double aSimTime, Result &aResult) |
| Called by model implementations when attempting to receive a message. | |
| static bool | Receive (Comm &aComm, double aSimTime, Comm *aXmtrPtr, Message &aMessage) |
| static bool | Send (Comm &aComm, double aSimTime, const WsfMessage &aMessage, const Address &aAddress) |
Leave/Join Group protected methods | |
These methods are only intended for scenario input processing, prior to initialization. Joining and leaving groups during runtime requires different behaviors. | |
| void | JoinGroup (const Address &aAddress) |
| void | LeaveGroup (const Address &aAddress) |
Required ProtocolInterface interface. | |
| WsfComponent * | CloneComponent () const override |
| const int * | GetComponentRoles () const override |
| void * | QueryInterface (int aRole) override |
| ProtocolPriority | GetPriority () const override |
| ProtocolIGMP * | Clone () const override |
| void | Setup () override |
| const char * | GetScriptClassName () const override |
| bool | Initialize (double aSimTime) override |
| bool | ProcessInput (UtInput &aInput) override |
Explicit Protocol Emulation Methods | |
| |
| Address | GetQuerier () const |
| virtual void | LeaveGroup (double aSimTime, const Address &aAddress) |
| virtual void | JoinGroup (double aSimTime, const Address &aAddress) |
ProtocolProcess methods | |
These methods implement the IGMP logic in the interface layers. | |
| ProcessResult | NetworkSend (double aSimTime, size_t aLayerIndex, Message &aMessage) override |
| ProcessResult | NetworkReceive (double aSimTime, size_t aLayerIndex, Message &aMessage) override |
| ProcessResult | PhysicalReceive (double aSimTime, size_t aLayerIndex, Message &aMessage) override |
| std::vector< Address > | GetGroups () const |
| Address | GetMessageAddressFromAux (Message &aMessage) |
Additional Inherited Members | |
| Public Types inherited from wsf::comm::ProtocolInterface | |
| using | ProcessResult = std::pair<bool, bool> |
| Public Types inherited from WsfComponentT< Comm > | |
| typedef Comm | ParentType |
| This is needed to support the WsfComponentList template. | |
| Public Types inherited from WsfObject | |
| typedef std::vector< WsfStringId > | TypeList |
| The list of types returned by GetTypeList. | |
| WsfObject (const WsfObject &aSrc) | |
| Copy constructor (for Clone()). | |
This protocol is a lightweight implementation of the functionality of the Internet Group Management Protocol (IGMP). Typically, IGMP is a protocol that defines how comm interfaces and routers communicate with each other and determine how to propagate messages to relay joining and leaving multicast groups. This allows routers to have the prerequisite knowledge necessary to know how to route multicast messages.
This implementation uses perfect knowledge, and does not actually generate protocol messaging. It 'cheats' by using multicast data stored in the network manager, and is only intended to resolve addressing. This protocol is provided in this manner to reduce performance overhead and not clutter the simulation with message events when users strictly want multicast messaging without the potential pitfalls of a full, high fidelity implementation.
This protocol does not inherently provide routing capability, and is reliant on the inherent PIM router protocol to provide that service. As such, if PIM is removed from the router, multicast messaging that passes through such a router will fail without an analogue capability.
|
default |
Referenced by Clone(), CloneComponent(), Find(), FindOrCreate(), and ~ProtocolIGMP().
|
overridedefault |
References Clone(), CloneComponent(), GetComponentRoles(), GetPriority(), ProtocolIGMP(), QueryInterface(), and Setup().
|
overridevirtual |
Return a copy of this object. Must be implemented by all derived types. If cloning is impossible, a WsfUncloneableException should be thrown.
Implements wsf::comm::ProtocolInterface.
References ProtocolIGMP().
Referenced by ~ProtocolIGMP().
|
overridevirtual |
Clones a component. May return null if component does not support clone.
Implements wsf::comm::ProtocolInterface.
References ProtocolIGMP().
Referenced by ~ProtocolIGMP().
|
static |
References WsfComponentList::GetComponent(), wsf::comm::Comm::GetComponents(), and ProtocolIGMP().
Referenced by FindOrCreate().
|
static |
|
overridevirtual |
Returns a zero-terminated array of component roles. Note that the array should be in decreasing order of specificity and should generally the inheritance hierarchy. The first entry should be the components 'primary' role. For example a sensor would do the following:
Implements wsf::comm::ProtocolInterface.
References cWSF_COMPONENT_COMM, cWSF_COMPONENT_COMM_PROTOCOL, cWSF_COMPONENT_COMM_PROTOCOL_IGMP, and cWSF_COMPONENT_NULL.
Referenced by ~ProtocolIGMP().
|
inline |
References wsf::comm::Message::SourceMessage().
Referenced by NetworkReceive().
|
overridevirtual |
Required query for protocol priority. Protocols are evaluated in order based on their assigned priorities. A lower value indicates a higher priority.
Implements wsf::comm::ProtocolInterface.
References wsf::comm::cIGMP.
Referenced by ~ProtocolIGMP().
| Address wsf::comm::ProtocolIGMP::GetQuerier | ( | ) | const |
|
inlineoverride |
|
overridevirtual |
Perform phase 1 initialization. This is called by WsfPlatform::Initialize() during phase 1 initialization of the platform. The component should complete validation of input data that could not be done by ProcessInput, as well as any other functions to prepare for simulation use (subject to the next paragraph).
The order in which components are initialized is defined by GetComponentInitializationOrder. In general a component implementation of this method should not be dependent on the state of another component, i.e.: it should not assume that the other components Initialize() method has been called. If such a dependency exists one should use Initialize2() if possible, or specify a value GetComponentInitializationOrder to force things to initialize in a particular order.
| aSimTime | The current simulation time. |
Reimplemented from wsf::comm::Component.
References cWSF_COMPONENT_COMM_PROTOCOL_IGMP, wsf::comm::Component::GetComm(), wsf::comm::Comm::GetComponents(), and ok.
|
inlineprotected |
|
virtual |
References wsf::comm::Address::GetAddress(), wsf::comm::Component::GetComm(), WsfSimulation::GetCommNetworkManager(), GetQuerier(), wsf::comm::Component::GetSimulation(), WsfPlatformPart::GetSimulation(), wsf::comm::Address::GetSubnetMaskBitLength(), and wsf::comm::Comm::Send().
Referenced by ProcessInput().
|
protected |
|
virtual |
References wsf::comm::Address::GetAddress(), wsf::comm::Component::GetComm(), WsfSimulation::GetCommNetworkManager(), GetQuerier(), wsf::comm::Component::GetSimulation(), WsfPlatformPart::GetSimulation(), wsf::comm::Address::GetSubnetMaskBitLength(), and wsf::comm::Comm::Send().
Referenced by ProcessInput().
|
overridevirtual |
If we're the querier, handle the messages.
Reimplemented from wsf::comm::ProtocolInterface.
References WsfSimulation::AddEvent(), wsf::comm::Address::CheckInAddressRange(), wsf::comm::IGMP_SubscriptionEvent::cJOIN, wsf::comm::IGMP_SubscriptionEvent::cLEAVE, wsf::comm::cMulticastRange, wsf::comm::Component::GetComm(), GetMessageAddressFromAux(), GetQuerier(), WsfPlatformPart::GetSimulation(), and wsf::comm::Message::SourceMessage().
|
overridevirtual |
Determine if this is a multicast address destination.
If this comm device does has level 0 support, we can't send it.
Set the message destination to null, to avoid any further handling of the message.
Halt processing in the layer, don't send to next layer.
Halt protocol processing, continue to other layers
Don't stop protocol processing, continue to other layers.
Reimplemented from wsf::comm::ProtocolInterface.
References wsf::comm::Address::CheckInAddressRange(), wsf::comm::Comm::cLEVEL_0, wsf::comm::cMulticastRange, wsf::comm::Component::GetComm(), and wsf::comm::Message::SourceMessage().
|
overridevirtual |
With IGMP, multicast messages not valid for the owning comm are ignored at the physical layer. We listen for those we want, and ignore the rest. If the owning comm is doing routing, then we also must check for dependent hosts who may want this message as well.
This is a multicast address. Check to see if we can receive multicast messages. If not, short circuit.
Halt processing in the layer, don't send to next layer.
Determine if the multicast address is a group we are interested in.
If we made it to this point, the multicast message isn't destined for us. However, if we are a router, we must check if its destined for someone in our network. Note: This is done on the physical layer, as this action is taken via OS level controls and port assignments.
Note: We just pass along the message now. The actual addresses will be resolved in the network layer, and retransmitted there.
Reimplemented from wsf::comm::ProtocolInterface.
References wsf::comm::Address::CheckInAddressRange(), wsf::comm::Comm::cLEVEL_2, wsf::comm::cMulticastRange, wsf::comm::Component::GetComm(), WsfSimulation::GetCommNetworkManager(), WsfPlatformPart::GetSimulation(), and wsf::comm::Message::SourceMessage().
|
overridevirtual |
Evaluate the current input command and determine if it is one processed by the component. The component should get the current command from the input stream and determine if it is one that it recognizes. If it does not recognize the command then it should leave the command in the input stream and return false. If it does recognize the command then it should process the command and return true. If invalid arguments are encountered then it should throw an exception.
| aInput | The input stream. |
| UtInput::ExceptionBase | if an invalid input was encountered. |
Reimplemented from wsf::comm::Component.
References JoinGroup(), LeaveGroup(), wsf::comm::Address::ProcessInput(), and WsfRandomVariable::ProcessInput().
|
overridevirtual |
Requests a component's role interface. A component can support one or more roles.
| aRole | The role whose interface is to be returned. |
Implements wsf::comm::ProtocolInterface.
References cWSF_COMPONENT_COMM, cWSF_COMPONENT_COMM_PROTOCOL, cWSF_COMPONENT_COMM_PROTOCOL_IGMP, and wsf::comm::ProtocolInterface::ProtocolInterface().
Referenced by ~ProtocolIGMP().
|
overridevirtual |
Reimplemented from wsf::comm::Component.
References wsf::comm::Component::GetComm(), WsfSimulation::GetCommNetworkManager(), and WsfPlatformPart::GetSimulation().
Referenced by ~ProtocolIGMP().