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

P2PPhyLayer Class Reference
[phyLayer - physical layer modules]

A very simple physical layer. More...

#include <P2PPhyLayer.h>

Inherits ChannelAccess.

Inheritance diagram for P2PPhyLayer:

Inheritance graph
[legend]
Collaboration diagram for P2PPhyLayer:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Module_Class_Members (P2PPhyLayer, ChannelAccess, 0)
virtual void initialize (int)
 Initialization of the module and some variables.
virtual void finish ()
void handleMessage (cMessage *)
 Called every time a message arrives.
virtual void receiveBBItem (int category, const BBItem *details, int scopeModuleId)
 Called by the Blackboard whenever a change occurs we're interested in.

Protected Types

enum  P2PPhyKinds { RECEPTION_COMPLETE = 1350101811 }
 The kind field of messages. More...

Protected Member Functions

virtual double calcDuration (cMessage *)
 This function calculates the duration of the AirFrame.
Handle Messages
Functions to redefine by the programmer

These are the functions provided to add own functionality to your modules. These functions are called whenever a blackboard message, a self message or a data message from the upper or lower layer arrives respectively.

virtual void handleSelfMsg (cMessage *msg)
 Handle self messages such as timer...
virtual void handleUpperMsg (AirFrame *, int)
 Handle messages from upper layer.
virtual void handleLowerMsg (AirFrame *)
 Handle messages from lower layer.
Convenience Functions
Functions for convenience - NOT to be modified

These are functions taking care of message encapsulation and message sending. Normally you should not need to alter these but should use them to handle message encasulation and sending. They will wirte all necessary information into packet headers and add or strip the appropriate headers for each layer.

AirFrame * encapsMsg (cMessage *)
 Encapsulate the MacPkt into an AirFrame.
void bufferMsg (AirFrame *)
 Buffer message upon reception.
AirFrame * unbufferMsg (cMessage *)
 Unbuffer message after it is completely received.
void sendP2P (AirFrame *, int)
 Sends a unicast message; waits delay seconds before sending.
void sendDown (AirFrame *, int)
 Sends a message to the channel; waits delay seconds before sending.
void sendUp (AirFrame *)
 Sends a message to the upper layer; waits delay seconds before sending.
void sendDelayedP2P (AirFrame *, double, int)
 Sends a unicast message.
void sendDelayedDown (AirFrame *, double, int)
 Sends a message to the channel.
void sendDelayedUp (AirFrame *, double)
 Sends a message to the upper layer.
void sendControlUp (cMessage *)
 Sends a control message to the upper layer.
Abstraction layer
Factory function to create AirFrame into which a MAC frame is encapsulated.

SnrEval authors should be able to use their own SnrEval packets. The framework does not need to know about them, but must be able to produce new ones. Both goals can be reached by using a factory method.

Overwrite this function in derived classes to use your own AirFrames

virtual AirFrame * createCapsulePkt ()
 Create a new AirFrame.

Protected Attributes

double bitrate
 bitrate read from omnetpp.ini
int headerLength
 length of the AirFrame header
double pBit
 bit error rate (including all other loss possibilities for message losses)
double transmitterPower
 power used to transmit messages
cMessage * txOverTimer
 Timer to indicate the end of a transmission to a higher layer.
ActiveChannel channel
 Currently active channel, set using radio, updated via BB.
int catActiveChannel
 category number given by bb for ActiveChannel
int uppergateOut
 gate ids
int uppergateIn
 gate ids
int upperControlOut
 gate ids

Detailed Description

A very simple physical layer.

This is the simplest physical layer you can think of.

It decides upon one simple parameter pBit (bit error rate) about the correctness of a frame. Collisions, bit errors, interference and anything else you can think of are combined in this single parameter.

Author:
Marc Loebbers, Daniel Willkomm


Member Enumeration Documentation

enum P2PPhyLayer::P2PPhyKinds [protected]
 

The kind field of messages.

that are used internally by this class have one of these values


Member Function Documentation

void P2PPhyLayer::bufferMsg AirFrame *  frame  )  [protected]
 

Buffer message upon reception.

The packet is put in a buffer for the time the transmission would last in reality. A timer indicates when the transmission is complete. So, look at unbufferMsg to see what happens when the transmission is complete..

double P2PPhyLayer::calcDuration cMessage *  af  )  [protected, virtual]
 

This function calculates the duration of the AirFrame.

Usually the duration is just the frame length divided by the bitrate. However there may be cases (like 802.11) where the header has a different modulation (and thus a different bitrate) than the rest of the message.

Just redefine this function in such a case!

AirFrame * P2PPhyLayer::encapsMsg cMessage *  msg  )  [protected]
 

Encapsulate the MacPkt into an AirFrame.

Encapsulate the received MacPkt into an AirFrame and set all needed header fields.

See also:
AirFrame

void P2PPhyLayer::handleLowerMsg AirFrame *  msg  )  [protected, virtual]
 

Handle messages from lower layer.

Redefine this function if you want to process messages from the channel before they are forwarded to upper layers

This basic implementation just checks whether a received packet had errors. Decision depends only on pBit (defined in omnetppp.ini) and the message length. The length field is assumed to be in bits.

If you want to forward the message to upper layers please use sendUp which will decapsulate the MacPkt before sending

void P2PPhyLayer::handleMessage cMessage *  msg  ) 
 

Called every time a message arrives.

The basic handle message function.

Depending on the gate a message arrives handleMessage just calls different handle*Msg functions to further process the message.

Messages from the channel are also buffered here in order to simulate a transmission delay

You should not make any changes in this function but implement all your functionality into the handle*Msg functions called from here.

See also:
handleUpperMsg, handleLowerMsg, handleSelfMsg

virtual void P2PPhyLayer::handleSelfMsg cMessage *  msg  )  [inline, protected, virtual]
 

Handle self messages such as timer...

Define this function if you want to timer or other kinds of self messages

void P2PPhyLayer::handleUpperMsg AirFrame *  msg,
int  dest
[protected, virtual]
 

Handle messages from upper layer.

Redefine this function if you want to process messages from upper layers before they are send to the channel.

The MacPkt is already encapsulated in an AirFrame and all standard header fields are set.

To forward the message to lower layers after processing it please use sendDown. It will take care of decapsulation and anything else needed

Parameters:
dest Destination nic module id() in order to find the destination gate for sending the message

void P2PPhyLayer::initialize int  stage  )  [virtual]
 

Initialization of the module and some variables.

First we have to initialize the module from which we derived ours, in this case ChannelAccess.

Then we have to intialize the gates and - if necessary - some own variables.

Reimplemented from ChannelAccess.

void P2PPhyLayer::sendControlUp cMessage *  msg  )  [protected]
 

Sends a control message to the upper layer.

send a control message to the upper layer

void P2PPhyLayer::sendDelayedDown AirFrame *  msg,
double  delay,
int  dest
[protected]
 

Sends a message to the channel.

For this special case the sending of the message as broadcast and unicast messages are handled differently.

This function is only for convenience so that the programmer does not have to take care about the details of message sending

Parameters:
dest Destination nic module id() in order to find the destination gate for sending the message

void P2PPhyLayer::sendDelayedP2P AirFrame *  frame,
double  delay,
int  dest
[protected]
 

Sends a unicast message.

Finds the destination gate of the recipient and sends the message only via the link which is connected to that gate..

This function is only used for the point-to-point sending and thus the specialily of the P2P network.

Although the wireless channel is a broadcast channel and all hosts within interference distance should receive all messages sendP2P sends a message directly via unicast to the desired destination.

This is only possible because we do not assume lost messages due to interference or collitions. All possible message losses are summed up in one parameter pBit.

See also:
ChannelControl::getOutGateTo()

void P2PPhyLayer::sendDelayedUp AirFrame *  msg,
double  delay
[protected]
 

Sends a message to the upper layer.

decapsulate message and send it to the upper layer.

to be called within handleLowerMsg.

void P2PPhyLayer::sendDown AirFrame *  msg,
int  dest
[protected]
 

Sends a message to the channel; waits delay seconds before sending.

Convenience function which calls sendDelayedDown with delay set to 0.0.

See also:
sendDelayedDown

void P2PPhyLayer::sendP2P AirFrame *  msg,
int  dest
[protected]
 

Sends a unicast message; waits delay seconds before sending.

Convenience function which calls sendDelayedP2P with delay set to 0.0.

See also:
sendDelayedP2P

void P2PPhyLayer::sendUp AirFrame *  msg  )  [protected]
 

Sends a message to the upper layer; waits delay seconds before sending.

Convenience function which calls sendDelayedUp with delay set to 0.0.

See also:
sendDelayedUp

AirFrame * P2PPhyLayer::unbufferMsg cMessage *  msg  )  [protected]
 

Unbuffer message after it is completely received.

Get the context pointer to the now completely received AirFrame and delete the self message


Member Data Documentation

int P2PPhyLayer::headerLength [protected]
 

length of the AirFrame header

Todo:
for now it is read from omnetpp.ini but should be easily settable by the user later


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