edu.virginia.cs.mng.hypercast
Interface I_AdapterCallBack
- All Known Implementing Classes:
- OL_Socket, HC_Node, DT_Node, OverlayObject
- public abstract interface I_AdapterCallBack
This interface is implemented by a UDP/TCP unicast adapter or a UDP multicast adapter.
The method is called whenever there is a message arriving the adapter.
messageArrivedFromAdapter
public void messageArrivedFromAdapter(I_Message msg)
- Handles the incoming message (unicast, server, or multicast).
- Throws:
- java.lang.IllegalArgumentException - if I_Message is of incorrect type.
(An incorrect type being one different than that returned by restoreMessage(). )
timerExpired
public void timerExpired(int timerID)
- Handles the arrival of a timer
- Throws:
- java.lang.IllegalArgumentException - if timerID is unexpected.
restoreMessage
public I_Message restoreMessage(byte[] receiveBuffer,
int[] validBytesStart,
int validBytesEnd)
- Creates a message from bytes in a buffer.
validBytesStart[0] is the start of the segment of unread bytes in receiveBuffer.
validBytesEnd is one beyond the end of the segment of unread bytes in receiveBuffer.
If a message is contained in the buffer, the function increases validBytesStart[0] to
point to the new beginning of unread bytes in the buffer. If no message is contained
in the buffer, null is returned. If the buffer contains corrupt or bad messages,
an IllegalArgumentException should be thrown.
- Parameters:
recvbuff - the byte array buffer of a incoming streamvalidBytesStart - the start index to create a message fromvalidBytesEnd - the total length of bytes in this buffer- Throws:
- java.lang.IllegalArgumentException -