INET Framework for OMNeT++/OMNEST
|
This class offers a data dissemination service using probabilistic broadcast. More...
#include <ProbabilisticBroadcast.h>
Classes | |
struct | tMsgDesc |
Store messages in a structure so that we can keep some information needed by the protocol. More... | |
Public Member Functions | |
ProbabilisticBroadcast () | |
virtual int | numInitStages () const override |
Initialization of the module and some variables. More... | |
virtual void | initialize (int) override |
virtual void | finish () override |
Public Member Functions inherited from inet::OperationalBase | |
OperationalBase () | |
Public Member Functions inherited from inet::ILifecycle | |
virtual | ~ILifecycle () |
Public Member Functions inherited from inet::INetworkProtocol | |
virtual | ~INetworkProtocol () |
Protected Types | |
enum | messagesTypes { UNKNOWN = 0, BROADCAST_TIMER, NEIGHBOR_TIMER, BETA_TIMER } |
typedef struct inet::ProbabilisticBroadcast::tMsgDesc | tMsgDesc |
Store messages in a structure so that we can keep some information needed by the protocol. More... | |
typedef std::set< unsigned int > | MsgIdSet |
typedef std::multimap< simtime_t, tMsgDesc * > | TimeMsgMap |
Protected Member Functions | |
virtual void | handleUpperPacket (cPacket *msg) override |
Handle messages from upper layer. More... | |
virtual void | handleLowerPacket (cPacket *msg) override |
Handle messages from lower layer. More... | |
virtual void | handleSelfMessage (cMessage *msg) override |
Handle self messages. More... | |
virtual bool | messageKnown (unsigned int msgId) |
Checks whether a message is known (= kept in memory) or not. More... | |
virtual bool | debugMessageKnown (unsigned int msgId) |
Checks whether a message is known (= kept in memory) or not. More... | |
virtual void | insertMessage (simtime_t_cref bcastDelay, tMsgDesc *msgDesc) |
Insert a message in both known ID list and message queue. More... | |
virtual tMsgDesc * | popFirstMessageUpdateQueue (void) |
Returns the descriptor of the first message in the queue, then remove its pointer from the queue and its id from the known IDs list. More... | |
virtual cPacket * | encapsMsg (cPacket *msg) |
Returns a network layer packet which encapsulates the upper layer packet passed to the function. More... | |
virtual cPacket * | decapsMsg (ProbabilisticBroadcastDatagram *msg) |
extracts and returns the application layer packet which is encapsulated in the network layer packet given in argument. More... | |
virtual void | insertNewMessage (ProbabilisticBroadcastDatagram *pkt, bool iAmInitialSender=false) |
Insert a new message in both known ID list and message queue. More... | |
virtual cObject * | setDownControlInfo (cMessage *const pMsg, const MACAddress &pDestAddr) |
Attaches a "control info" (NetwToMac) structure (object) to the message pMsg. More... | |
Protected Member Functions inherited from inet::NetworkProtocolBase | |
NetworkProtocolBase () | |
virtual void | handleUpperCommand (cMessage *message) override |
virtual void | sendUp (cMessage *message, int transportProtocol) |
virtual void | sendDown (cMessage *message, int interfaceId=-1) |
virtual bool | isUpperMessage (cMessage *message) override |
virtual bool | isLowerMessage (cMessage *message) override |
virtual bool | isInitializeStage (int stage) override |
virtual bool | isNodeStartStage (int stage) override |
virtual bool | isNodeShutdownStage (int stage) override |
Protected Member Functions inherited from inet::LayeredProtocolBase | |
virtual void | handleMessageWhenUp (cMessage *message) override |
virtual void | handleLowerCommand (cMessage *message) |
Protected Member Functions inherited from inet::OperationalBase | |
virtual void | handleMessage (cMessage *msg) override |
virtual void | handleMessageWhenDown (cMessage *msg) |
virtual bool | handleOperationStage (LifecycleOperation *operation, int stage, IDoneCallback *doneCallback) override |
Perform one stage of a lifecycle operation. More... | |
virtual bool | handleNodeStart (IDoneCallback *doneCallback) |
virtual bool | handleNodeShutdown (IDoneCallback *doneCallback) |
virtual void | handleNodeCrash () |
virtual void | setOperational (bool isOperational) |
Static Protected Member Functions | |
static long | getNextID () |
Protected Attributes | |
simtime_t | broadcastPeriod |
Period (in sim time) between two broadcast attempts. More... | |
double | beta |
Probability of each broadcast attempt. More... | |
simtime_t | timeToLive |
int | maxNbBcast |
Maximal number of broadcast attempts for each packet. More... | |
int | maxFirstBcastBackoff |
Maximal back-off before first broadcast attempt [seconds]. More... | |
simtime_t | timeInQueueAfterDeath |
How long the message should be kept in queue after its died. More... | |
int | headerLength |
Length of the NetwPkt header Read from omnetpp.ini. More... | |
cMessage * | broadcastTimer |
MsgIdSet | knownMsgIds |
TimeMsgMap | msgQueue |
MsgIdSet | debugMsgIdSet |
long | nbDataPacketsReceived |
long | nbDataPacketsSent |
long | nbHops |
int | debugNbMessageKnown |
long | nbDataPacketsForwarded |
cOutVector | oneHopLatencies |
L3Address | myNetwAddr |
Protected Attributes inherited from inet::NetworkProtocolBase | |
ProtocolMapping | protocolMapping |
IInterfaceTable * | interfaceTable |
Protected Attributes inherited from inet::OperationalBase | |
bool | isOperational |
simtime_t | lastChange |
Static Protected Attributes | |
static long | id_counter = 0 |
Private Member Functions | |
ProbabilisticBroadcast (const ProbabilisticBroadcast &) | |
Copy constructor is not allowed. More... | |
ProbabilisticBroadcast & | operator= (const ProbabilisticBroadcast &) |
Assignment operator is not allowed. More... | |
Additional Inherited Members | |
Static Public Attributes inherited from inet::LayeredProtocolBase | |
static simsignal_t | packetSentToUpperSignal = registerSignal("packetSentToUpper") |
static simsignal_t | packetReceivedFromUpperSignal = registerSignal("packetReceivedFromUpper") |
static simsignal_t | packetFromUpperDroppedSignal = registerSignal("packetFromUpperDropped") |
static simsignal_t | packetSentToLowerSignal = registerSignal("packetSentToLower") |
static simsignal_t | packetReceivedFromLowerSignal = registerSignal("packetReceivedFromLower") |
static simsignal_t | packetFromLowerDroppedSignal = registerSignal("packetFromLowerDropped") |
This class offers a data dissemination service using probabilistic broadcast.
Each packet which arrives from upper layer or from the network is (re-)transmitted n times with n = floor(TTL/bcperiod) with probability beta.
|
protected |
|
protected |
|
protected |
Store messages in a structure so that we can keep some information needed by the protocol.
|
protected |
|
private |
Copy constructor is not allowed.
|
inline |
|
protectedvirtual |
Checks whether a message is known (= kept in memory) or not.
Referenced by handleLowerPacket().
|
protectedvirtual |
extracts and returns the application layer packet which is encapsulated in the network layer packet given in argument.
Referenced by handleLowerPacket().
|
protectedvirtual |
Returns a network layer packet which encapsulates the upper layer packet passed to the function.
Referenced by handleUpperPacket().
|
overridevirtual |
|
inlinestaticprotected |
Referenced by encapsMsg().
|
overrideprotectedvirtual |
Handle messages from lower layer.
Implements inet::LayeredProtocolBase.
Reimplemented in inet::AdaptiveProbabilisticBroadcast.
Referenced by inet::AdaptiveProbabilisticBroadcast::handleLowerPacket().
|
overrideprotectedvirtual |
Handle self messages.
Reimplemented from inet::LayeredProtocolBase.
Reimplemented in inet::AdaptiveProbabilisticBroadcast.
Referenced by inet::AdaptiveProbabilisticBroadcast::handleSelfMessage().
|
overrideprotectedvirtual |
Handle messages from upper layer.
Implements inet::LayeredProtocolBase.
|
overridevirtual |
Reimplemented from inet::NetworkProtocolBase.
Reimplemented in inet::AdaptiveProbabilisticBroadcast.
Referenced by inet::AdaptiveProbabilisticBroadcast::initialize().
|
protectedvirtual |
Insert a message in both known ID list and message queue.
If the message comes in front of the queue (i.e. it will be the next one to be broadcasted, the broadcastTimer is reset accordingly.
bcastDelay | relative (to now) simulator time of next broadcast attempt. |
msg | descriptor of the message to insert in the queue. |
Referenced by handleSelfMessage(), and insertNewMessage().
|
protectedvirtual |
Insert a new message in both known ID list and message queue.
The message comes either from upper layer or from lower layer. In both cases, it will be inserted in the queue with a broadcast attempt delay taken uniformly between 0 and min(broadcast period, TTL) in order to implement a random backoff for the first broadcast of a message.
msgDesc | descriptor of the message to insert in the queue. |
iAmInitialSender | message comes from upper layer, I am its creator and initial sender. |
Referenced by handleLowerPacket(), and handleUpperPacket().
|
protectedvirtual |
Checks whether a message is known (= kept in memory) or not.
Referenced by handleLowerPacket().
|
inlineoverridevirtual |
|
private |
Assignment operator is not allowed.
|
protectedvirtual |
Returns the descriptor of the first message in the queue, then remove its pointer from the queue and its id from the known IDs list.
Then re-schedule the broadcastTimer to the broadcast instant of the new first element in the list.
Referenced by handleSelfMessage().
|
protectedvirtual |
Attaches a "control info" (NetwToMac) structure (object) to the message pMsg.
Attaches a "control info" structure (object) to the down message pMsg.
This is most useful when passing packets between protocol layers of a protocol stack, the control info will contain the destination MAC address.
The "control info" object will be deleted when the message is deleted. Only one "control info" structure can be attached (the second setL3ToL2ControlInfo() call throws an error).
pMsg | The message where the "control info" shall be attached. |
pDestAddr | The MAC address of the message receiver. |
Referenced by encapsMsg(), handleLowerPacket(), and handleSelfMessage().
|
protected |
Probability of each broadcast attempt.
Read from omnetpp.ini
Referenced by handleSelfMessage(), inet::AdaptiveProbabilisticBroadcast::initialize(), initialize(), and inet::AdaptiveProbabilisticBroadcast::updateBeta().
|
protected |
Period (in sim time) between two broadcast attempts.
Read from omnetpp.ini
Referenced by handleSelfMessage(), initialize(), and insertNewMessage().
|
protected |
Referenced by finish(), handleSelfMessage(), initialize(), insertMessage(), and popFirstMessageUpdateQueue().
|
protected |
Referenced by debugMessageKnown(), and insertNewMessage().
|
protected |
Referenced by finish(), handleLowerPacket(), and initialize().
|
protected |
Length of the NetwPkt header Read from omnetpp.ini.
Referenced by encapsMsg(), and initialize().
|
staticprotected |
|
protected |
Referenced by insertMessage(), messageKnown(), and popFirstMessageUpdateQueue().
|
protected |
Maximal back-off before first broadcast attempt [seconds].
Read from omnetpp.ini
Referenced by initialize(), and insertNewMessage().
|
protected |
Maximal number of broadcast attempts for each packet.
Read from omnetpp.ini
Referenced by handleSelfMessage(), and initialize().
|
protected |
Referenced by finish(), insertMessage(), and popFirstMessageUpdateQueue().
|
protected |
|
protected |
Referenced by finish(), handleSelfMessage(), and initialize().
|
protected |
Referenced by finish(), handleLowerPacket(), and initialize().
|
protected |
Referenced by handleUpperPacket(), and initialize().
|
protected |
Referenced by finish(), handleLowerPacket(), and initialize().
|
protected |
Referenced by handleLowerPacket(), and initialize().
|
protected |
How long the message should be kept in queue after its died.
That way the message is known if the node receives one of its copy that isn't dead because of TTL de-synchronization due to MAC backoff, propagation delay and clock drift. Read from omnetpp.ini
Referenced by handleSelfMessage(), and initialize().
|
protected |
Referenced by encapsMsg(), and initialize().