|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.sun.multicast.reliable.applications.tree.TreeSTPPacket | +--com.sun.multicast.reliable.applications.tree.TreeSTPDataPacket
The STPDataPacket defines the format of data packets in STP. It extends the base class STPPacket which defines the common elements of all STP packets. A users buffer (byte array) is required to create an outbound data packet. The users buffer is copied into a new buffer large enough to hold the users data and the STP headers. The headers are filled in and the users buffer is released. A DatagramPacket is required to create an inbound data packet. The buffer in the DatagramPacket is saved and the headers are parsed. The header information is stored in local variables and the DatagramPacket is released.
Field Summary | |
static int |
CHECKSUM
|
static byte |
FLAGBIT_CONGESTION
|
static byte |
FLAGBIT_PRUNE
|
static int |
HAINTERVAL
|
static int |
PAYLOAD
|
static int |
SEQUENCENUMBER
|
static int |
STP_VERSION
|
static int |
STPDATA
|
static int |
STPDATAHEADERLENGTH
|
static int |
STPFLAGS
|
static int |
STPHEADERLENGTH
|
static int |
STPLENGTH
|
static int |
STPMAXPKT
|
static int |
STPMESSAGETYPE
|
static int |
STPSUBTYPE
|
static int |
STPVERSION
|
Constructor Summary | |
TreeSTPDataPacket(byte[] buff,
int length)
Create an outbound STPDataPacket. |
Method Summary | |
int |
computeChecksum()
The compute checksum method is called from any class that requires a checksum field. |
java.net.DatagramPacket |
createDatagramPacket()
Create a DatagramPacket from the existing data in this class. |
void |
setAddress(java.net.InetAddress address)
The the address for this packet. |
void |
setFlags(byte flags)
Set the packet flags field. |
void |
setMessageType(int type)
Set the message type field. |
void |
setPort(int port)
Set the port for this packet. |
void |
setSequenceNumber(int i)
Set the sequence number for this packet. |
void |
setSubType(int type)
Set the message subtype field. |
void |
setTTL(byte ttl)
Set the TTL value for this packet. |
void |
writeBuffer(byte[] buffer,
int length,
int offset)
Write a byte array to the buffer. |
void |
writeByte(byte value,
int offset)
Write a byte to the buffer. |
void |
writeInt(int value,
int offset)
Write an int to the buffer. |
void |
writeShort(short value,
int offset)
Write a short to the buffer. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final byte FLAGBIT_CONGESTION
public static final byte FLAGBIT_PRUNE
public static final int CHECKSUM
public static final int SEQUENCENUMBER
public static final int HAINTERVAL
public static final int PAYLOAD
public static final int STPDATAHEADERLENGTH
public static final int STPMAXPKT
public static final int STPVERSION
public static final int STPMESSAGETYPE
public static final int STPSUBTYPE
public static final int STPFLAGS
public static final int STPLENGTH
public static final int STPDATA
public static final int STPHEADERLENGTH
public static final int STP_VERSION
Constructor Detail |
public TreeSTPDataPacket(byte[] buff, int length)
buff[]
- a byte array of user data to be sent on the network.Method Detail |
public void setSequenceNumber(int i)
i
- the sequence number for this packet. (integer greater than 0)public void setTTL(byte ttl)
ttl
- a byte containing the TTL value for this packet.public java.net.DatagramPacket createDatagramPacket()
createDatagramPacket
in class com.sun.multicast.reliable.applications.tree.TreeSTPPacket
public void setMessageType(int type)
type
- an integer message type value.public void setSubType(int type)
type
- an integer message subtype value.public void setAddress(java.net.InetAddress address)
address
- the InetAddress for this packet.public void setPort(int port)
port
- the port number for this packet.public void setFlags(byte flags)
the
- packet flags field.public void writeByte(byte value, int offset)
value
- the data to be written.offset
- the offset into the buffer to write the data.
This offset is relative to the childs view of the packet and
does not include this layers header.public void writeShort(short value, int offset)
value
- the data to be written.offset
- the offset into the buffer to write the data.
This offset is relative to the childs view of the packet and
does not include this layers header.public void writeInt(int value, int offset)
value
- the data to be written.offset
- the offset into the buffer to write the data.
This offset is relative to the childs view of the packet and
does not include this layers header.public void writeBuffer(byte[] buffer, int length, int offset)
value
- the data to be written.offset
- the offset into the buffer to write the data.
This offset is relative to the childs view of the packet and
does not include this layers header.public int computeChecksum()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
JavaTM Reliable MulticastTM Service version 1.1
Copyright (c) 2001, Sun Microsystems Laboratories, All rights reserved.