Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | Related Pages

Flood Class Reference
[netwLayer - network layer modules]

A simple flooding protocol. More...

#include <Flood.h>

Inherits SimpleNetwLayer.

Inheritance diagram for Flood:

Inheritance graph
[legend]
Collaboration diagram for Flood:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Module_Class_Members (Flood, SimpleNetwLayer, 0)
virtual void initialize (int)
 Initialization of omnetpp.ini parameters.
virtual void finish ()

Protected Types

typedef std::list< Bcast > cBroadcastList

Protected Member Functions

virtual void handleUpperMsg (cMessage *)
 Handle messages from upper layer.
virtual void handleLowerMsg (cMessage *)
 Handle messages from lower layer.
virtual void handleSelfMsg (cMessage *msg)
 we have no self messages
bool notBroadcasted (NetwPkt *)
 Checks whether a message was already broadcasted.

Protected Attributes

unsigned long seqNum
 Network layer sequence number.
int defaultTtl
 Default time-to-live (ttl) used for this module.
bool plainFlooding
 Defines whether to use plain flooding or not.
cBroadcastList bcMsgs
 List of already broadcasted messages.
unsigned int bcMaxEntries
 Max number of entries in the list of already broadcasted messages.
double bcDelTime
 Time after which an entry for an already broadcasted msg can be deleted.

Classes

class  Bcast

Detailed Description

A simple flooding protocol.

This implementation uses plain flooding, i.e. it "remembers" (stores) already broadcasted messages in a list and does not rebroadcast them again, if it gets another copy of that message.

The maximum number of entires for that list can be defined in the .ini file (bcMaxEntries) as well as the time after which an entry is deleted (bcDelTime).

If you prefere a memory-less version you can comment out the

#define PLAINFLOODING 

Author:
Daniel Willkomm


Member Function Documentation

void Flood::handleLowerMsg cMessage *  m  )  [protected, virtual]
 

Handle messages from lower layer.

Messages from the mac layer will be forwarded to the application only if the are broadcast or destined for this node.

If the arrived message is a broadcast message it is also reflooded only if the tll field is bigger than one. Before the message is handed back to the mac layer the ttl field is reduced by one to account for this hop.

In the case of plain flooding the message will only be processed if there is no corresponding entry in the bcMsgs list (notBroadcasted). Otherwise the message will be deleted.

Reimplemented from SimpleNetwLayer.

void Flood::handleUpperMsg cMessage *  m  )  [protected, virtual]
 

Handle messages from upper layer.

All messages have to get a sequence number and the ttl filed has to be specified. Afterwards the messages can be handed to the mac layer. The mac address is set to -1 (broadcast address) because the message is flooded (i.e. has to be send to all neighbors)

In the case of plain flooding the message sequence number and source address has also be stored in the bcMsgs list, so that this message will not be rebroadcasted, if a copy will be flooded back from the neigbouring nodes.

If the maximum number of entries is reached the first (oldest) entry is deleted.

Reimplemented from SimpleNetwLayer.

void Flood::initialize int  stage  )  [virtual]
 

Initialization of omnetpp.ini parameters.

Reads all parameters from the ini file. If a parameter is not specified in the ini file a default value will be set.

Reimplemented from SimpleNetwLayer.

bool Flood::notBroadcasted NetwPkt *  msg  )  [protected]
 

Checks whether a message was already broadcasted.

The bcMsgs list is searched for the arrived message. If the message is in the list, it was already broadcasted and the function returns false.

Concurrently all outdated (older than bcDelTime) are deleted. If the list is full and a new message has to be entered, the oldest entry is deleted.


The documentation for this class was generated from the following files:
Generated on Fri Jan 12 08:29:59 2007 for Mobility Framework by  doxygen 1.4.4