UanMac Class Reference

Basic UAN MAC class. More...

#include <uan-mac.h>

Inheritance diagram for UanMac:

Inheritance graph
[legend]
Collaboration diagram for UanMac:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 UanMac ()
 Creates UAN Mac.
virtual void recv (Packet *p, Handler *h)
 Standard NS2 recv method.
virtual void send (Packet *p, Handler *h)
 Starts send algorithm for packet p.
virtual int command (int argc, const char *const *argv)
 NS2 command method.
virtual void transStateChange (int s)
 Reports change of phy to new state s, which is of type UanPhy::TransState.
double bw ()
 Returns bandwidth.

Protected Member Functions

void startSendTimer (void)
 Randomly picks slot inside CW and starts sendTimer.
void debugf (char *fmt,...)
 Method to output debug messages to stderr.

Static Protected Member Functions

static void sendHandler (void *)
 Method that is called when timer sendTimer expires. Sends packet pktTx.

Protected Attributes

int CW
 The Contention window.
double slotSize
 Slot time in seconds.
double bandwidth
 Bandwidth in bits/second.
bool useCS
 Boolean wether to use carrier sensing.
UanEventTimersendTimer
 Timer used to count down backoff time until send.
double sendTime
 Member used to save send time when timer is paused (-1 if no time saved).
Packet * pktTx
 Pointer to packet awaiting transmission.
Handler * hanTx
 Handler to call when pktTx is transmitted (notifies queue that we are done with pktTx).
UanPhyphy
 Link to UanPhy.

Friends

class UanEventTimer

Detailed Description

Basic UAN MAC class.

Structure: In the UAN framwork the MAC only receives complete packets. Unlike standard NS2, collisions are detected and handled in the PHY layer. This is designed to allow for easier MAC development and simulation.

This is a simple but complete MAC class that uses a backoff algorithm similar (but much simpler) to IEEE 802.11. When there is a packet to send, a node chooses a slot, S between 0 and CW-1. A counter is then set to S*SlotSize. Whenever the channel is perceived to be idle, the counter runs. If the channel is perceived to be busy (either Carrier sensed busy or this node is currently in the RX state), the counter is paused. When the counter reaches 0, the node transmits.

This class depends on the PHY layer being a UanPhy class

Note:
Requires UAN Physical layer
Author:
Leonard Tracy
Date:
9-28-2007
Contact: lentracy@u.washington.edu Created on: June 2007


Member Function Documentation

void UanMac::recv ( Packet *  p,
Handler *  h 
) [virtual]

Standard NS2 recv method.

Parameters:
p Packet being received at layer
h Handler to call if packet is moving down the stack when MAC is done with packet
Calls send(p, h) if packet p is outgoing Does address filtering and sends up to LL for incoming packets.

Reimplemented in UanMacPAloha.

void UanMac::send ( Packet *  p,
Handler *  h 
) [virtual]

Starts send algorithm for packet p.

Parameters:
p Pointer to Packet to send
h Pointer to Handler to call handle function of when packet is sent This MAC only has a single packet buffer, so if a packet is already waiting to be sent, then the new packet p will be freed and the handler h called.
Sets pktTx to p. If channel is idle, calls startSendTiemr.

Reimplemented in UanMacPAloha.

int UanMac::command ( int  argc,
const char *const *  argv 
) [virtual]

NS2 command method.

Parameters:
argc Number of arguments
argv Array of C String commands/arguments
Handles commands for MAC layer. The only new command is setphy which builds a link between this class and UanPhy. It is required that phy point to the physical layer. Currently the command is called from ns-mobilenode.tcl, but this is something slated for change. This link may already be built into NS2.


The documentation for this class was generated from the following files:
Generated on Mon Oct 1 12:12:48 2007 for UANModule by  doxygen 1.5.1