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

Mac80211 Class Reference
[macLayer - MAC layer modules]

An implementation of the 802.11b MAC. More...

#include <Mac80211.h>

Inherits BasicLayer.

Inheritance diagram for Mac80211:

Inheritance graph
Collaboration diagram for Mac80211:

Collaboration graph
List of all members.

Public Member Functions

 Module_Class_Members (Mac80211, BasicLayer, 0)
virtual void initialize (int)
 Initialization of the module and some variables.
virtual void finish ()

Protected Types

typedef std::list< Mac80211Pkt * > MacPktList
typedef std::list< NeighborEntry > NeighborList
enum  State {
  WFDATA = 0, QUIET = 1, IDLE = 2, CONTEND = 3,
  WFCTS = 4, WFACK = 5, BUSY = 6

Protected Member Functions

virtual void receiveBBItem (int category, const BBItem *details, int scopeModuleId)
 Called by the Blackboard whenever a change occurs we're interested in.
virtual void handleSelfMsg (cMessage *)
 Handle self messages such as timer...
virtual void handleUpperMsg (cMessage *)
 Handle messages from upper layer.
virtual void handleLowerMsg (cMessage *)
 Handle messages from lower layer.
virtual void handleLowerControl (cMessage *)
 Handle messages from lower layer.
virtual void handleEndContentionTimer ()
 handle end of contention
void handleMsgNotForMe (cMessage *af, double duration)
 handle a message that is not for me or errornous
void handleMsgForMe (Mac80211Pkt *)
 handle a message that was meant for me
void handleBroadcastMsg (Mac80211Pkt *)
void handleEndTransmission ()
 handle the end of a transmission...
void handleEndSifsTimer ()
 handle end of SIFS
void handleTimeoutTimer ()
 handle time out
void handleNavTimer ()
 NAV timer expired, the exchange of messages of other stations is done.
void handleRTSframe (Mac80211Pkt *)
void handleDATAframe (Mac80211Pkt *)
void handleACKframe (Mac80211Pkt *)
void handleCTSframe (Mac80211Pkt *)
virtual void sendDATAframe (Mac80211Pkt *)
 send data frame
void sendACKframe (Mac80211Pkt *)
 send Acknoledgement
void sendCTSframe (Mac80211Pkt *)
 send CTS frame
virtual void sendRTSframe ()
 send RTS frame
void sendBROADCASTframe ()
 send broadcast frame
Mac80211Pkt * encapsMsg (cMessage *netw)
 encapsulate packet
cMessage * decapsMsg (Mac80211Pkt *frame)
 decapsulate packet
virtual void beginNewCycle ()
 start a new contention period
double backoff ()
 Compute a backoff value.
int contentionWindow ()
 Compute a new contention window.
void testMaxAttempts ()
 Test if maximum number of retries to transmit is exceeded.
double timeOut (frameType_802_11 type, double br)
 return a timeOut value for a certain type of frame
double packetDuration (double bits, double br)
 computes the duration of a transmission over the physical channel, given a certain bitrate
const char * stateName (State state)
 Produce a readable name of the given state.
void setState (State state)
 Sets the state, and produces a log message in between.
bool rtsCts (Mac80211Pkt *m)
 Check whether the next packet should be send with RTS/CTS.
void suspendContention ()
 suspend an ongoing contention, pick it up again when the channel becomes idle
double retrieveBitrate (int destAddress)
 figure out at which bitrate to send to this particular destination
void addNeighbor (Mac80211Pkt *af)
 add a new entry to the neighbor list
NeighborList::iterator findNeighbor (int id)
 find a neighbor based on his address
NeighborList::iterator findOldestNeighbor ()
 find the oldest neighbor -- usually in order to overwrite this entry

Protected Attributes

int myMacAddr
 MAC address (simply module id).
cMessage * timeout
 Timer used for time-outs after the transmission of a RTS, a CTS, or a DATA packet.
cMessage * nav
 Timer used for the defer time of a node. Also called NAV : networks allocation vector.
cMessage * contention
 Timer used for contention periods.
cMessage * endSifs
 Timer used to indicate the end of a SIFS.
State state
 Current state of the MAC.
RadioState::States radioState
 Current state of active channel (radio), set using radio, updated via BB.
int catRadioState
 category number given by bb for RadioState
MediumIndication::States medium
 last medium state
int catMedium
 category number given by bb for RSSI
double defaultBitrate
 Default bitrate.
double bitrate
 Current bit rate at which data is transmitted.
int catBitrate
 and category number
bool autoBitrate
 Auto bit rate adaptation -- switch.
std::vector< double > snrThresholds
 Hold RSSI thresholds at which to change the bitrates.
 cached pointer to radio module
unsigned queueLength
 Maximal number of packets in the queue; should be set in the omnetpp.ini.
bool nextIsBroadcast
 Boolean used to know if the next packet is a broadcast packet.
MacPktList fromUpperLayer
 Buffering of messages from upper layer.
unsigned longRetryCounter
 Number of frame transmission attempt.
unsigned shortRetryCounter
 Number of frame transmission attempt.
simtime_t remainingBackoff
 remaining backoff time. If the backoff timer is interrupted, this variable holds the remaining backoff time.
int rtsCtsThreshold
 Number of bits in a packet before RTS/CTS is used.
double delta
 Very small value used in timer scheduling in order to avoid multiple changements of state in the same simulation time.
unsigned neighborhoodCacheSize
 Keep information for this many neighbors.
simtime_t neighborhoodCacheMaxAge
 Consider information in cache outdate if it is older than this.
NeighborList neighbors
bool switching
int fsc


struct  NeighborEntry

Detailed Description

An implementation of the 802.11b MAC.

For more info, see the NED file.

David Raguin

Member Enumeration Documentation

enum Mac80211::State [protected]

Definition of the states

enum Mac80211::timerType [protected]

Definition of the timer types

Member Function Documentation

double Mac80211::backoff  )  [protected]

Compute a backoff value.

Compute the backoff value.

void Mac80211::beginNewCycle  )  [protected, virtual]

start a new contention period

Start a new contention period if the channel is free and if there's a packet to send. Called at the end of a deferring period, a busy period, or after a failure. Called by the HandleMsgForMe(), HandleTimer() HandleUpperMsg(), and, without RTS/CTS, by handleMsgNotForMe().

int Mac80211::contentionWindow  )  [protected]

Compute a new contention window.

Compute the contention window with the binary backoff algorithm.

Mac80211Pkt * Mac80211::encapsMsg cMessage *  netw  )  [protected]

encapsulate packet

Encapsulates the received network-layer packet into a MacPkt and set all needed header fields.

void Mac80211::handleACKframe Mac80211Pkt *  af  )  [protected]

Handle ACK and delete corresponding packet from queue

void Mac80211::handleBroadcastMsg Mac80211Pkt *  af  )  [protected]

Handle a broadcast packet. This packet is simply passed to the upper layer. No acknowledgement is needed. Called by handleLowerMsg(Mac80211Pkt *af)

void Mac80211::handleCTSframe Mac80211Pkt *  af  )  [protected]

Handle a CTS frame. Called by HandleMsgForMe(Mac80211Pkt* af)

void Mac80211::handleDATAframe Mac80211Pkt *  af  )  [protected]

Handle a frame which expected to be a DATA frame. Called by HandleMsgForMe()

void Mac80211::handleEndContentionTimer  )  [protected, virtual]

handle end of contention

The node has won the contention, and is now allowed to send an RTS/DATA or Broadcast packet. The backoff value is deleted and will be newly computed in the next contention period

void Mac80211::handleEndSifsTimer  )  [protected]

handle end of SIFS

Handle the end sifs timer. Then sends a CTS, a DATA, or an ACK frame

void Mac80211::handleEndTransmission  )  [protected]

handle the end of a transmission...

Handle the end of transmission timer (end of the transmission of an ACK or a broadcast packet). Called by HandleTimer(cMessage* msg)

void Mac80211::handleLowerMsg cMessage *  msg  )  [protected, virtual]

Handle messages from lower layer.

Handle all messages from lower layer. Checks the destination MAC adress of the packet. Then calls one of the three functions : handleMsgNotForMe(), handleBroadcastMsg(), or handleMsgForMe(). Called by handleMessage().

Implements BasicLayer.

void Mac80211::handleMsgForMe Mac80211Pkt *  af  )  [protected]

handle a message that was meant for me

Handle a packet for the node. The result of this reception is a function of the type of the received message (RTS,CTS,DATA, or ACK), and of the current state of the MAC (WFDATA, CONTEND, IDLE, WFCTS, or WFACK). Called by handleLowerMsg()

void Mac80211::handleMsgNotForMe cMessage *  af,
double  duration

handle a message that is not for me or errornous

Handle all ACKs,RTS, CTS, or DATA not for the node. If RTS/CTS is used the node must stay quiet until the current handshake between the two communicating nodes is over. This is done by scheduling the timer message nav (Network Allocation Vector). Without RTS/CTS a new contention is started. If an error occured the node must defer for EIFS. Called by handleLowerMsg()

void Mac80211::handleNavTimer  )  [protected]

NAV timer expired, the exchange of messages of other stations is done.

Handle the NAV timer (end of a defering period). Called by HandleTimer(cMessage* msg)

void Mac80211::handleRTSframe Mac80211Pkt *  af  )  [protected]

Handle aframe wich is expected to be an RTS. Called by HandleMsgForMe()

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

Handle self messages such as timer...

handle timers

Implements BasicLayer.

void Mac80211::handleTimeoutTimer  )  [protected]

handle time out

Handle the time out timer. Called by handleTimer(cMessage* msg)

void Mac80211::handleUpperMsg cMessage *  msg  )  [protected, virtual]

Handle messages from upper layer.

This implementation does not support fragmentation, so it is tested if the maximum length of the MPDU is exceeded.

Implements BasicLayer.

void Mac80211::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 BasicModule. This module takes care of the gate initialization.

Reimplemented from BasicLayer.

double Mac80211::packetDuration double  bits,
double  br

computes the duration of a transmission over the physical channel, given a certain bitrate

Computes the duration of the transmission of a frame over the physical channel. 'bits' should be the total length of the MAC packet in bits.

void Mac80211::receiveBBItem int  category,
const BBItem details,
int  scopeModuleId
[protected, virtual]

Called by the Blackboard whenever a change occurs we're interested in.

Handle change nofitications. In this layer it is usually information about the radio channel, i.e. if it is IDLE etc.

Reimplemented from BasicModule.

void Mac80211::sendACKframe Mac80211Pkt *  af  )  [protected]

send Acknoledgement

Send an ACK frame.Called by HandleEndSifsTimer()

void Mac80211::sendBROADCASTframe  )  [protected]

send broadcast frame

Send a BROADCAST frame.Called by handleContentionTimer()

void Mac80211::sendCTSframe Mac80211Pkt *  af  )  [protected]

send CTS frame

Send a CTS frame.Called by HandleEndSifsTimer()

void Mac80211::sendDATAframe Mac80211Pkt *  af  )  [protected, virtual]

send data frame

Send a DATA frame. Called by HandleEndSifsTimer() or handleEndContentionTimer()

void Mac80211::sendRTSframe  )  [protected, virtual]

send RTS frame

Send a RTS frame.Called by handleContentionTimer()

void Mac80211::testMaxAttempts  )  [protected]

Test if maximum number of retries to transmit is exceeded.

Test if the maximal retry limit is reached, and delete the frame to send in this case.

double Mac80211::timeOut frameType_802_11  type,
double  br

return a timeOut value for a certain type of frame

Return a time-out value for a type of frame. Called by SendRTSframe, sendCTSframe, etc.

Member Data Documentation

double Mac80211::defaultBitrate [protected]

Default bitrate.

The default bitrate must be set in the omnetpp.ini. It is used whenever an auto bitrate is not appropriate, like broadcasts.

int Mac80211::fsc [protected]

sequence control -- to detect duplicates

unsigned Mac80211::longRetryCounter [protected]

Number of frame transmission attempt.

Incremented when the SHORT_RETRY_LIMIT is hit, or when an ACK or CTS is missing.

bool Mac80211::switching [protected]

take care of switchover times

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