sidnet.stack.std.mac
Class Mac802_11e

java.lang.Object
  extended by sidnet.stack.std.mac.Mac802_11e
All Implemented Interfaces:
JistAPI.Proxiable, JistAPI.Timeless, MacInterface, MacInterface.Mac802_11

public class Mac802_11e
extends java.lang.Object
implements MacInterface.Mac802_11

Implementation of IEEE 802_11b. Please refer to the standards document. For consistency, many of the variable names, constants and equations are taken directly from the specification.

Since:
SWANS1.0

Nested Class Summary
 
Nested classes/interfaces inherited from interface jist.swans.mac.MacInterface
MacInterface.Mac802_11
 
Field Summary
protected  int bandwidth
          link bandwidth (units: bytes/second).
protected  long bo
          backoff time remaining.
protected  long boStart
          backoff start time.
protected  short cw
          current contention window size.
static short CW_MAX
          Maximum collision window (for backoff).
static short CW_MIN
          Minimum collision window (for backoff).
static long DIFS
          Distributed inter frame space.
static boolean DSSS
          Physical specification constant: 802_11b-1999 Supplement 2_4GHz Direct Sequence.
static long EIFS
          Extended inter frame space.
static boolean FHSS
          Physical specification constant: 802_11b-1999 2_4GHz Frequency Hopping.
protected  MacAddress localAddr
          mac address of this interface.
protected  byte longRetry
          long retry counter.
static byte MAC_MODE_DIFS
          mac mode: waiting for difs or eifs timer.
static byte MAC_MODE_SBO
          mac mode: waiting for backoff.
static byte MAC_MODE_SIDLE
          mac mode: idle.
static byte MAC_MODE_SNAV
          mac mode: waiting for virtual carrier sense.
static byte MAC_MODE_SNAV_RTS
          mac mode: waiting for virtual carrier sense to RTS.
static byte MAC_MODE_SWFACK
          mac mode: waiting for ACK packet.
static byte MAC_MODE_SWFCTS
          mac mode: waiting for CTS packet.
static byte MAC_MODE_SWFDATA
          mac mode: waiting for DATA packet.
static byte MAC_MODE_XACK
          mac mode: transmitting ACK packet.
static byte MAC_MODE_XBROADCAST
          mac mode: transmitting broadcast DATA packet.
static byte MAC_MODE_XCTS
          mac mode: transmitting CTS packet.
static byte MAC_MODE_XRTS
          mac mode: transmitting RTS packet.
static byte MAC_MODE_XUNICAST
          mac mode: transmitting unicast DATA packet.
protected  byte mode
          current mac mode.
protected  long nav
          virtual carrier sense; next time when network available.
protected  boolean needEifs
          whether last reception had an error.
protected  NetInterface netEntity
          Network upcall entity interface.
protected  byte netId
          network interface number.
protected  Message packet
          packet currently being transmitted.
protected  MacAddress packetNextHop
          next hop of packet current being transmitted.
static long PIFS
          Point coordination inter frame space.
static long PLCP_HEADER
          Length of PLCP Header at 1Mb/s.
static long PREAMBLE
          Length of PHY preamble.
protected  boolean promisc
          whether mac is in promiscuous mode.
static long PROPAGATION
          Air propagation delay.
protected  RadioInterface radioEntity
          Radio downcall entity reference.
protected  byte radioMode
          radio mode used for carrier sense.
static byte RETRY_LIMIT_LONG
          Retransmissions attempted for long packets (those with RTS).
static byte RETRY_LIMIT_SHORT
          Retransmissions attempted for short packets (those without RTS).
static long RX_TX_TURNAROUND
          Receive-Transmit turnaround time.
protected  MacInterface.Mac802_11 self
          Self-referencing mac entity reference.
protected  short seq
          sequence number counter.
static short SEQ_CACHE_SIZE
          Sequence number cache size.
static short SEQ_INVALID
          Invalid sequence number.
protected  sidnet.stack.std.mac.Mac802_11e.SeqEntry seqCache
          received sequence number cache list.
protected  byte seqCacheSize
          size of received sequence number cache list.
protected  byte shortRetry
          short retry counter.
static long SIFS
          Short interframe space.
static long SLOT_TIME
          Minimum time to sense medium.
static long SYNCHRONIZATION
          PHY synchronization time.
static int THRESHOLD_FRAGMENT
          Threshold packet size for fragmentation.
static int THRESHOLD_RTS
          Threshold packet size to activate RTS.
protected  byte timerId
          timer identifier.
static long TX_DIFS
          Transmit start DIFS.
static long TX_SIFS
          Transmit start SIFS.
 
Constructor Summary
Mac802_11e(MacAddress addr, RadioInfo radioInfo, EnergyConsumptionModel energyConsumptionModel, long toSleepTimerPeriod, Node myNode)
          Instantiate new 802_11b entity.
Mac802_11e(MacAddress addr, RadioInfo radioInfo, EnergyConsumptionModel energyConsumptionModel, Node myNode)
          Instantiate new 802_11b entity.
 
Method Summary
 void cfDone(boolean backoff, boolean delPacket)
          Collision free send sequence complete.
static java.lang.String getModeString(byte mode)
           
 MacInterface.Mac802_11 getProxy()
          Return proxy entity of this mac.
 boolean hasPacket()
          Return whether mac currently has a packet to send.
 boolean isAwaitingResponse()
          Return whether the mac is currently waiting for a response.
 boolean isTransmitting()
          Return whether the mac is currently transmitting.
 void peek(Message msg)
          Radio has locked onto a packet signal; mac may have a peek.
 void receive(Message msg)
          Radio has received a packet for mac to process.
 void send(Message msg, MacAddress nextHop)
          Network layer would like to send the following packet.
 void setNetEntity(NetInterface net, byte netid)
          Hook up with the network entity.
 void setPromiscuous(boolean promisc)
          Set promiscuous mode (whether to pass all packets through).
 void setRadioEntity(RadioInterface radio)
          Hook up with the radio entity.
 void setRadioMode(byte mode)
          Update mac regarding new mode of its radio.
 void startTimer(long delay, byte mode)
          Initiate a timer event.
 void timeout(int timerId)
          Process mac timeout.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DSSS

public static final boolean DSSS
Physical specification constant: 802_11b-1999 Supplement 2_4GHz Direct Sequence.

See Also:
Constant Field Values

FHSS

public static final boolean FHSS
Physical specification constant: 802_11b-1999 2_4GHz Frequency Hopping.

See Also:
Constant Field Values

PREAMBLE

public static final long PREAMBLE
Length of PHY preamble.

See Also:
Constant Field Values

PLCP_HEADER

public static final long PLCP_HEADER
Length of PLCP Header at 1Mb/s.

See Also:
Constant Field Values

SYNCHRONIZATION

public static final long SYNCHRONIZATION
PHY synchronization time.

See Also:
Constant Field Values

RX_TX_TURNAROUND

public static final long RX_TX_TURNAROUND
Receive-Transmit turnaround time.

See Also:
Constant Field Values

PROPAGATION

public static final long PROPAGATION
Air propagation delay.

See Also:
Constant Field Values

SLOT_TIME

public static final long SLOT_TIME
Minimum time to sense medium.


SIFS

public static final long SIFS
Short interframe space. Minimum wait time between two frames in the same communication session.


PIFS

public static final long PIFS
Point coordination inter frame space. Wait used by the access point (point coordinator) to gain access to the medium before any of the stations.


DIFS

public static final long DIFS
Distributed inter frame space. Wait used by stations to gain access to the medium.


TX_SIFS

public static final long TX_SIFS
Transmit start SIFS.


TX_DIFS

public static final long TX_DIFS
Transmit start DIFS.


EIFS

public static final long EIFS
Extended inter frame space. Wait used by stations to gain access to the medium after an error.


THRESHOLD_RTS

public static final int THRESHOLD_RTS
Threshold packet size to activate RTS. Default=3000. Broadcast packets never use RTS. Set to zero to always use RTS.

See Also:
Constant Field Values

THRESHOLD_FRAGMENT

public static final int THRESHOLD_FRAGMENT
Threshold packet size for fragmentation. Default=2346. Broadcast packets are not fragmented.

See Also:
Constant Field Values

RETRY_LIMIT_SHORT

public static final byte RETRY_LIMIT_SHORT
Retransmissions attempted for short packets (those without RTS).

See Also:
Constant Field Values

RETRY_LIMIT_LONG

public static final byte RETRY_LIMIT_LONG
Retransmissions attempted for long packets (those with RTS).

See Also:
Constant Field Values

CW_MIN

public static final short CW_MIN
Minimum collision window (for backoff).


CW_MAX

public static final short CW_MAX
Maximum collision window (for backoff).

See Also:
Constant Field Values

SEQ_INVALID

public static final short SEQ_INVALID
Invalid sequence number.

See Also:
Constant Field Values

SEQ_CACHE_SIZE

public static final short SEQ_CACHE_SIZE
Sequence number cache size.

See Also:
Constant Field Values

MAC_MODE_SIDLE

public static final byte MAC_MODE_SIDLE
mac mode: idle.

See Also:
Constant Field Values

MAC_MODE_DIFS

public static final byte MAC_MODE_DIFS
mac mode: waiting for difs or eifs timer.

See Also:
Constant Field Values

MAC_MODE_SBO

public static final byte MAC_MODE_SBO
mac mode: waiting for backoff.

See Also:
Constant Field Values

MAC_MODE_SNAV

public static final byte MAC_MODE_SNAV
mac mode: waiting for virtual carrier sense.

See Also:
Constant Field Values

MAC_MODE_SNAV_RTS

public static final byte MAC_MODE_SNAV_RTS
mac mode: waiting for virtual carrier sense to RTS.

See Also:
Constant Field Values

MAC_MODE_SWFCTS

public static final byte MAC_MODE_SWFCTS
mac mode: waiting for CTS packet.

See Also:
Constant Field Values

MAC_MODE_SWFDATA

public static final byte MAC_MODE_SWFDATA
mac mode: waiting for DATA packet.

See Also:
Constant Field Values

MAC_MODE_SWFACK

public static final byte MAC_MODE_SWFACK
mac mode: waiting for ACK packet.

See Also:
Constant Field Values

MAC_MODE_XRTS

public static final byte MAC_MODE_XRTS
mac mode: transmitting RTS packet.

See Also:
Constant Field Values

MAC_MODE_XCTS

public static final byte MAC_MODE_XCTS
mac mode: transmitting CTS packet.

See Also:
Constant Field Values

MAC_MODE_XUNICAST

public static final byte MAC_MODE_XUNICAST
mac mode: transmitting unicast DATA packet.

See Also:
Constant Field Values

MAC_MODE_XBROADCAST

public static final byte MAC_MODE_XBROADCAST
mac mode: transmitting broadcast DATA packet.

See Also:
Constant Field Values

MAC_MODE_XACK

public static final byte MAC_MODE_XACK
mac mode: transmitting ACK packet.

See Also:
Constant Field Values

self

protected final MacInterface.Mac802_11 self
Self-referencing mac entity reference.


radioEntity

protected RadioInterface radioEntity
Radio downcall entity reference.


netEntity

protected NetInterface netEntity
Network upcall entity interface.


netId

protected byte netId
network interface number.


bandwidth

protected final int bandwidth
link bandwidth (units: bytes/second).


localAddr

protected MacAddress localAddr
mac address of this interface.


promisc

protected boolean promisc
whether mac is in promiscuous mode.


mode

protected byte mode
current mac mode.


radioMode

protected byte radioMode
radio mode used for carrier sense.


needEifs

protected boolean needEifs
whether last reception had an error.


timerId

protected byte timerId
timer identifier.


bo

protected long bo
backoff time remaining.


boStart

protected long boStart
backoff start time.


cw

protected short cw
current contention window size.


nav

protected long nav
virtual carrier sense; next time when network available.


seq

protected short seq
sequence number counter.


seqCache

protected sidnet.stack.std.mac.Mac802_11e.SeqEntry seqCache
received sequence number cache list.


seqCacheSize

protected byte seqCacheSize
size of received sequence number cache list.


shortRetry

protected byte shortRetry
short retry counter.


longRetry

protected byte longRetry
long retry counter.


packet

protected Message packet
packet currently being transmitted.


packetNextHop

protected MacAddress packetNextHop
next hop of packet current being transmitted.

Constructor Detail

Mac802_11e

public Mac802_11e(MacAddress addr,
                  RadioInfo radioInfo,
                  EnergyConsumptionModel energyConsumptionModel,
                  Node myNode)
Instantiate new 802_11b entity.

Parameters:
addr - local mac address
radioInfo - radio properties

Mac802_11e

public Mac802_11e(MacAddress addr,
                  RadioInfo radioInfo,
                  EnergyConsumptionModel energyConsumptionModel,
                  long toSleepTimerPeriod,
                  Node myNode)
Instantiate new 802_11b entity.

Parameters:
addr - local mac address
radioInfo - radio properties
Method Detail

getModeString

public static java.lang.String getModeString(byte mode)

getProxy

public MacInterface.Mac802_11 getProxy()
Return proxy entity of this mac.

Returns:
self-referencing proxy entity.

setRadioEntity

public void setRadioEntity(RadioInterface radio)
Hook up with the radio entity.

Parameters:
radio - radio entity

setNetEntity

public void setNetEntity(NetInterface net,
                         byte netid)
Hook up with the network entity.

Parameters:
net - network entity
netid - network interface number

setPromiscuous

public void setPromiscuous(boolean promisc)
Set promiscuous mode (whether to pass all packets through).

Parameters:
promisc - promiscuous flag

isAwaitingResponse

public boolean isAwaitingResponse()
Return whether the mac is currently waiting for a response.

Returns:
whether mac waiting for response

isTransmitting

public boolean isTransmitting()
Return whether the mac is currently transmitting.

Returns:
whether mac is currently transmitting

hasPacket

public boolean hasPacket()
Return whether mac currently has a packet to send.

Returns:
whether mac has packet to send.

send

public void send(Message msg,
                 MacAddress nextHop)
Description copied from interface: MacInterface
Network layer would like to send the following packet. Should be called only after Mac has notified that it is wants a packet.

Specified by:
send in interface MacInterface
Parameters:
msg - packet to send
nextHop - destination mac

cfDone

public void cfDone(boolean backoff,
                   boolean delPacket)
Description copied from interface: MacInterface.Mac802_11
Collision free send sequence complete.

Specified by:
cfDone in interface MacInterface.Mac802_11
Parameters:
backoff - is a backoff required
delPacket - is processing for this packet complete

peek

public void peek(Message msg)
Description copied from interface: MacInterface
Radio has locked onto a packet signal; mac may have a peek.

Specified by:
peek in interface MacInterface
Parameters:
msg - packet currently in flight

receive

public void receive(Message msg)
Description copied from interface: MacInterface
Radio has received a packet for mac to process.

Specified by:
receive in interface MacInterface
Parameters:
msg - packet received

setRadioMode

public void setRadioMode(byte mode)
Description copied from interface: MacInterface
Update mac regarding new mode of its radio.

Specified by:
setRadioMode in interface MacInterface
Parameters:
mode - new radio mode

startTimer

public void startTimer(long delay,
                       byte mode)
Description copied from interface: MacInterface.Mac802_11
Initiate a timer event. Note that only one timer event can be active at a given time.

Specified by:
startTimer in interface MacInterface.Mac802_11
Parameters:
delay - timer duration
mode - new mode

timeout

public void timeout(int timerId)
Description copied from interface: MacInterface.Mac802_11
Process mac timeout.

Specified by:
timeout in interface MacInterface.Mac802_11
Parameters:
timerId - timer identifier