INET Framework for OMNeT++/OMNEST
Ieee80211MgmtAPBase Class Reference

#include <Ieee80211MgmtAPBase.h>

Inheritance diagram for Ieee80211MgmtAPBase:
Ieee80211MgmtBase PassiveQueueBase INotifiable IPassiveQueue Ieee80211MgmtAP Ieee80211MgmtAPSimplified

List of all members.

Protected Member Functions

virtual int numInitStages () const
virtual void initialize (int)
virtual void distributeReceivedDataFrame (Ieee80211DataFrame *frame)
virtual Ieee80211DataFrame * convertFromEtherFrame (EtherFrame *ethframe)
virtual EtherFrame * convertToEtherFrame (Ieee80211DataFrame *frame)

Protected Attributes

bool hasRelayUnit

Detailed Description

Used in 802.11 infrastructure mode: abstract base class for management frame handling for access points (APs). This class extends Ieee80211MgmtBase with utility functions that are useful for implementing AP functionality.

Author:
Andras Varga

Member Function Documentation

Ieee80211DataFrame * Ieee80211MgmtAPBase::convertFromEtherFrame ( EtherFrame *  ethframe) [protected, virtual]

Utility function: converts EtherFrame to Ieee80211Frame. This is needed because MACRelayUnit which we use for LAN bridging functionality deals with EtherFrames.

Referenced by Ieee80211MgmtAPSimplified::handleUpperMessage(), and Ieee80211MgmtAP::handleUpperMessage().

{
    // create new frame
    Ieee80211DataFrame *frame = new Ieee80211DataFrame(ethframe->getName());
    frame->setFromDS(true);

    // copy addresses from ethernet frame (transmitter addr will be set to our addr by MAC)
    frame->setReceiverAddress(ethframe->getDest());
    frame->setAddress3(ethframe->getSrc());

    // encapsulate payload
    cPacket *payload = ethframe->decapsulate();
    if (!payload)
        error("received empty EtherFrame from upper layer");
    frame->encapsulate(payload);
    delete ethframe;

    // done
    return frame;
}
EtherFrame * Ieee80211MgmtAPBase::convertToEtherFrame ( Ieee80211DataFrame *  frame) [protected, virtual]

Utility function: converts the given frame to EtherFrame, deleting the original frame. This function is needed for LAN bridging functionality: MACRelayUnit deals with EtherFrames.

Referenced by Ieee80211MgmtAPSimplified::handleDataFrame(), and Ieee80211MgmtAP::handleDataFrame().

{
    // create a matching ethernet frame
    EtherFrame *ethframe = new EthernetIIFrame(frame->getName()); //TODO option to use EtherFrameWithSNAP instead
    ethframe->setDest(frame->getAddress3());
    ethframe->setSrc(frame->getTransmitterAddress());
    //XXX set ethertype

    // encapsulate the payload in there
    cPacket *payload = frame->decapsulate();
    delete frame;
    ASSERT(payload!=NULL);
    ethframe->encapsulate(payload);

    // done
    return ethframe;
}
void Ieee80211MgmtAPBase::distributeReceivedDataFrame ( Ieee80211DataFrame *  frame) [protected, virtual]

Utility function for APs: sends back a data frame we received from a STA to the wireless LAN, after tweaking fromDS/toDS bits and shuffling addresses as needed.

Referenced by Ieee80211MgmtAPSimplified::handleDataFrame(), and Ieee80211MgmtAP::handleDataFrame().

{
    // adjust toDS/fromDS bits, and shuffle addresses
    frame->setToDS(false);
    frame->setFromDS(true);

    // move destination address to address1 (receiver address),
    // and fill address3 with original source address;
    // sender address (address2) will be filled in by MAC
    ASSERT(!frame->getAddress3().isUnspecified());
    frame->setReceiverAddress(frame->getAddress3());
    frame->setAddress3(frame->getTransmitterAddress());

    sendOrEnqueue(frame);
}
void Ieee80211MgmtAPBase::initialize ( int  stage) [protected, virtual]

Reimplemented from Ieee80211MgmtBase.

Reimplemented in Ieee80211MgmtAP, and Ieee80211MgmtAPSimplified.

{
    Ieee80211MgmtBase::initialize(stage);

    if (stage==0)
    {
        hasRelayUnit = gate("uppergateOut")->getPathEndGate()->isConnected();
        WATCH(hasRelayUnit);
    }
}
virtual int Ieee80211MgmtAPBase::numInitStages ( ) const [inline, protected, virtual]

Reimplemented from Ieee80211MgmtBase.

Reimplemented in Ieee80211MgmtAP, and Ieee80211MgmtAPSimplified.

{return 2;}

Member Data Documentation


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