jist.swans.mac
Class MacDumb

java.lang.Object
  extended by jist.swans.mac.MacDumb
All Implemented Interfaces:
JistAPI.Proxiable, JistAPI.Timeless, MacInterface

public class MacDumb
extends java.lang.Object
implements MacInterface

A dumb, pass-through mac implementation.

Since:
SWANS1.0
Version:
$Id: MacDumb.java,v 1.17 2005/03/13 16:11:55 barr Exp $
Author:
Rimon Barr <barr+jist@cs.cornell.edu>

Nested Class Summary
private static class MacDumb.MacDumbMessage
          MacDumbMessage is the packet sent out by the MacDumb mac.
 
Nested classes/interfaces inherited from interface jist.swans.mac.MacInterface
MacInterface.Mac802_11
 
Field Summary
private  int bandwidth
          link bandwidth.
private  MacAddress localAddr
          local mac address.
private  NetInterface netEntity
          network entity.
private  byte netId
          network interface identifier.
private  boolean promisc
          whether in promiscuous mode.
private  RadioInterface radioEntity
          radio entity.
private  byte radioMode
          radio mode: transmit, receive, etc.
private  MacInterface self
          self-referencing proxy entity.
 
Constructor Summary
MacDumb(MacAddress addr, RadioInfo radioInfo)
          Create a new "dumb" mac entity.
 
Method Summary
 MacInterface getProxy()
          Return self-referencing proxy entity.
 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.
 java.lang.String toString()
          
private  long transmitTime(Message msg)
          Compute packet transmission time at current bandwidth.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

radioEntity

private RadioInterface radioEntity
radio entity.


netEntity

private NetInterface netEntity
network entity.


netId

private byte netId
network interface identifier.


self

private final MacInterface self
self-referencing proxy entity.


radioMode

private byte radioMode
radio mode: transmit, receive, etc.


localAddr

private MacAddress localAddr
local mac address.


bandwidth

private final int bandwidth
link bandwidth.


promisc

private boolean promisc
whether in promiscuous mode.

Constructor Detail

MacDumb

public MacDumb(MacAddress addr,
               RadioInfo radioInfo)
Create a new "dumb" mac entity. Does not perform any collision avoidance or detection. Simply does not transmit (drops) packet if it is current receiving.

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

setPromiscuous

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

Parameters:
promisc - promiscuous flag

setNetEntity

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

Parameters:
net - network entity
netid - network interface number

setRadioEntity

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

Parameters:
radio - radio entity

getProxy

public MacInterface getProxy()
Return self-referencing proxy entity.

Returns:
proxy entity

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

setRadioMode

public void setRadioMode(byte mode)
Update mac regarding new mode of its radio.

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

peek

public void peek(Message msg)
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)
Radio has received a packet for mac to process.

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

transmitTime

private long transmitTime(Message msg)
Compute packet transmission time at current bandwidth.

Parameters:
msg - packet to transmit
Returns:
time to transmit given packet at current bandwidth

send

public void send(Message msg,
                 MacAddress nextHop)
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