|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This interface defines functions that an unicast adapter should implement. An adapter provides timers and a network interface. It can send and receive messages. (Messages received are passed to an object implementing I_AdapterCallback.) The adapter keeps its own clock for the timers. It is important that any objects implementing I_AdapterCallback uses this clock, so that their code will work with a simulated network. It is implemented by the class UDP_UnicastAdapter.
Field Summary | |
static int |
CLOSED
value for state . |
static int |
STARTED
value for state . |
static int |
STARTING
value for state . |
static int |
STOPPED
value for state . |
static int |
STOPPING
value for state . |
Method Summary | |
void |
clearTimer(java.lang.Object timer_id)
Clears a timer. |
void |
close()
Close stops the adapter if it has not already been stopped. |
hypercast.I_PhysicalAddress |
createPhysicalAddress()
Create a physical address. |
hypercast.I_PhysicalAddress |
createPhysicalAddress(byte[] byteaddr,
int offset)
Creates an instance of an I_PhysicalAddress from a byte array. |
hypercast.I_PhysicalAddress |
createPhysicalAddress(java.lang.String addrString)
Creates IP_Address object from a string. |
hypercast.I_UnderlayAddress |
createUnderlayAddress()
Create a physical address. |
hypercast.I_UnderlayAddress |
createUnderlayAddress(byte[] byteaddr,
int offset)
Creates an instance of an I_UnderlayAddress from a byte array. |
hypercast.I_UnderlayAddress |
createUnderlayAddress(java.lang.String addrString)
Creates I_UnderlayAddress object from a string. |
long |
getCurrentTime()
USE THIS - DO NOT USE System.currentTimeMillis() !
This returns the time according to the adapter. |
java.lang.Object |
getInfo()
Get information of this adapter. |
int |
getPhysicalAddressSize()
Returns the size of physical address, when carried in a packet, of an I_UnicastAdapter object. |
long |
getTimer(java.lang.Object timer_id)
Returns expect delay until the timer goes off. |
int |
getUnderlayAddressSize()
Returns the size of physical address, when carried in a packet, of an I_UnicastAdapter object. |
boolean |
Reset(java.lang.Object socketObj)
Reset the adapter with a Object; |
void |
sendUnicastMessage(hypercast.I_NetworkAddress dst,
hypercast.I_Message msg)
Sends an I_Message to a specified destination from this Adapter. |
void |
setCallback(hypercast.I_AdapterCallback node)
Sets a Callback object to this Adapter. |
void |
setTimer(java.lang.Object timer_id,
long delay_ms)
Sets a timer. |
void |
Start()
Starts all the threads except timer thread in the UnicastAdapter. |
void |
Stop()
Stops all the threads in the UnicastAdapter. |
void |
Stop(long delay)
Stops all the threads in the UnicastAdapter after a delay When stop returns, the adapter is stopped. |
Methods inherited from interface hypercast.I_Stats |
getReadSchema, getStats, getStatsName, getWriteSchema, setStats, setStatsName |
Field Detail |
public static final int STOPPED
state
.
public static final int STARTING
state
.
public static final int STARTED
state
.
public static final int STOPPING
state
.
public static final int CLOSED
state
.
Method Detail |
public void Start()
java.lang.IllegalStateException
- if the adapter is already running.
java.lang.IllegalStateException
- if setCallback has not been called.public void Stop()
java.lang.IllegalStateException
- if the adapter is already stopped.public void Stop(long delay)
delay
- delay in milliseconds
java.lang.IllegalStateException
- if the adapter is already stopped.public void close()
java.lang.IllegalStateException
- if the adapter is already closedpublic void sendUnicastMessage(hypercast.I_NetworkAddress dst, hypercast.I_Message msg)
java.lang.IllegalStateException
- if adapter is not running.public hypercast.I_PhysicalAddress createPhysicalAddress(byte[] byteaddr, int offset)
java.lang.IllegalArgumentException
- if byte[] is corrupted
java.lang.ArrayIndexOutOfBoundsException
- if byte[] is too small.public hypercast.I_PhysicalAddress createPhysicalAddress(java.lang.String addrString)
addrString
- an string representing a physical address.public hypercast.I_PhysicalAddress createPhysicalAddress()
public int getPhysicalAddressSize()
public hypercast.I_UnderlayAddress createUnderlayAddress(byte[] byteaddr, int offset)
java.lang.IllegalArgumentException
- if byte[] is corrupted
java.lang.ArrayIndexOutOfBoundsException
- if byte[] is too small.public hypercast.I_UnderlayAddress createUnderlayAddress(java.lang.String addrString)
addrString
- an string representing a underlay address.public hypercast.I_UnderlayAddress createUnderlayAddress()
public int getUnderlayAddressSize()
public boolean Reset(java.lang.Object socketObj)
socketObj
- object passed to do reset.public java.lang.Object getInfo()
public void setCallback(hypercast.I_AdapterCallback node)
java.lang.IllegalStateException
- if called after adapter has been started.public void setTimer(java.lang.Object timer_id, long delay_ms)
java.lang.IllegalStateException
- if adapter is not running.public void clearTimer(java.lang.Object timer_id)
java.lang.IllegalStateException
- if adapter is not running.public long getTimer(java.lang.Object timer_id)
java.lang.IllegalStateException
- if adapter is not running.public long getCurrentTime()
System.currentTimeMillis()
!
This returns the time according to the adapter. It is
important that all code use this function and not the system
clock so that the code will work with a simulator (which may
be paused and restarted).
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |