Public Types | Public Member Functions | Protected Member Functions | Protected Attributes

BaseApplLayer Class Reference
[applLayer - application layer modulesbaseModules - base module classes of MiXiM]

Base class for the application layer. More...

#include <BaseApplLayer.h>

Inherits BaseLayer.

Inherited by TestApplLayer, and TrafficGen.

Collaboration diagram for BaseApplLayer:
Collaboration graph
[legend]

List of all members.

Public Types

enum  BaseApplMessageKinds { LAST_BASE_APPL_MESSAGE_KIND = 25000 }
 

The message kinds this layer uses.

More...
enum  BaseApplControlKinds { LAST_BASE_APPL_CONTROL_KIND = 25500 }
 

The control message kinds this layer uses.

More...

Public Member Functions

virtual void initialize (int)
 Initialization of the module and some variables.

Protected Member Functions

void sendDelayedDown (cMessage *, simtime_t)
 Sends a message delayed to the lower layer.
virtual const int myApplAddr ()
 Return my application layer address.
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 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 handleLowerMsg (cMessage *msg)
 Handle messages from lower layer.
virtual void handleLowerControl (cMessage *msg)
 Handle control messages from lower layer.
virtual void handleUpperMsg (cMessage *msg)
 Handle messages from upper layer.
virtual void handleUpperControl (cMessage *msg)
 Handle control messages from upper layer.

Protected Attributes

int headerLength
 Length of the ApplPkt header.

Detailed Description

Base class for the application layer.

This is the generic class for all application layer modules. If you want to implement your own application layer you have to subclass your module from this class.

Author:
Daniel Willkomm

Definition at line 43 of file BaseApplLayer.h.


Member Enumeration Documentation

The control message kinds this layer uses.

Enumerator:
LAST_BASE_APPL_CONTROL_KIND 

Stores the id on which classes extending BaseAppl should continue their own control kinds.

Definition at line 53 of file BaseApplLayer.h.

The message kinds this layer uses.

Enumerator:
LAST_BASE_APPL_MESSAGE_KIND 

Stores the id on which classes extending BaseAppl should continue their own message kinds.

Definition at line 47 of file BaseApplLayer.h.


Member Function Documentation

virtual void BaseApplLayer::handleLowerControl ( cMessage *  msg  )  [inline, protected, virtual]

Handle control messages from lower layer.

The basic application layer just silently deletes all messages it receives.

Implements BaseLayer.

Definition at line 113 of file BaseApplLayer.h.

                                                 {
    EV << "BaseApplLayer: handleLowerControl not redefined; delete msg\n";
    delete msg;
  };

virtual void BaseApplLayer::handleLowerMsg ( cMessage *  msg  )  [inline, protected, virtual]

Handle messages from lower layer.

Redefine this function if you want to process messages from lower layers.

The basic application layer just silently deletes all messages it receives.

Implements BaseLayer.

Reimplemented in TestApplLayer, BurstApplLayerBattery, and TrafficGen.

Definition at line 102 of file BaseApplLayer.h.

                                             {
    EV << "BaseApplLayer: handleLowerMsg not redefined; delete msg\n";
    delete msg;
  };

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

Handle self messages such as timer...

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

Implements BaseLayer.

Reimplemented in TestApplLayer, BurstApplLayer, BurstApplLayerBattery, and TrafficGen.

Definition at line 88 of file BaseApplLayer.h.

                                            {
    EV << "BaseApplLayer: handleSelfMsg not redefined; delete msg\n";
    delete msg;
  };

virtual void BaseApplLayer::handleUpperMsg ( cMessage *  msg  )  [inline, protected, virtual]

Handle messages from upper layer.

This function is pure virtual here, because there is no reasonable guess what to do with it by default.

Implements BaseLayer.

Definition at line 123 of file BaseApplLayer.h.

                                             {
    assert(false);
    opp_error("Application has no upper layers!");
    delete msg;
  }

void BaseApplLayer::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 BaseLayer.

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

Reimplemented from BaseLayer.

Reimplemented in TestApplLayer, BurstApplLayer, BurstApplLayerBattery, and TrafficGen.

Definition at line 33 of file BaseApplLayer.cc.

References headerLength.

{
    BaseLayer::initialize(stage);
    if(stage==0){
        headerLength= par("headerLength");
    }
}

virtual const int BaseApplLayer::myApplAddr (  )  [inline, protected, virtual]

Return my application layer address.

We use the node module index as application address

Definition at line 146 of file BaseApplLayer.h.

Referenced by TrafficGen::sendBroadcast(), TestApplLayer::sendBroadcast(), and TestApplLayer::sendReply().

                                 {
    return getParentModule()->getIndex();
  };

void BaseApplLayer::sendDelayedDown ( cMessage *  msg,
simtime_t  delay 
) [protected]

Sends a message delayed to the lower layer.

Send message down to lower layer

Definition at line 44 of file BaseApplLayer.cc.

Referenced by TestApplLayer::sendReply().

                                                                  {
    recordPacket(PassedMessage::OUTGOING, PassedMessage::LOWER_DATA, msg);
    sendDelayed(msg, delay, lowerGateOut);
}


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