|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.savarese.vserv.tcpip.IPPacket org.savarese.vserv.tcpip.UDPPacket
UDPPacket extends IPPacket
to handle UDP packets. The UDP
packet structure is described in
RFC 768.
Field Summary | |
static int |
LENGTH_UDP_HEADER
Length of the UDP packet header in bytes. |
static int |
OFFSET_DESTINATION_PORT
Offset into the UDP packet of the destination port header value. |
static int |
OFFSET_SOURCE_PORT
Offset into the UDP packet of the source port header value. |
static int |
OFFSET_UDP_CHECKSUM
Offset into the UDP packet of the UDP checksum. |
static int |
OFFSET_UDP_TOTAL_LENGTH
Offset into the UDP packet of UDP total packet length header value. |
Fields inherited from class org.savarese.vserv.tcpip.IPPacket |
_data_, LENGTH_DESTINATION_ADDRESS, LENGTH_SOURCE_ADDRESS, OFFSET_DESTINATION_ADDRESS, OFFSET_FLAGS, OFFSET_IDENTIFICATION, OFFSET_IP_CHECKSUM, OFFSET_PROTOCOL, OFFSET_SOURCE_ADDRESS, OFFSET_TOTAL_LENGTH, OFFSET_TTL, OFFSET_TYPE_OF_SERVICE, PROTOCOL_ICMP, PROTOCOL_IP, PROTOCOL_TCP, PROTOCOL_UDP |
Constructor Summary | |
UDPPacket(int size)
Creates a new UDP packet of a given size. |
|
UDPPacket(UDPPacket packet)
Creates a new UDP packet that is a copy of a given packet. |
Method Summary | |
int |
computeUDPChecksum()
Same as computeUDPChecksum(true); |
int |
computeUDPChecksum(boolean update)
Computes the UDP checksum, optionally updating the UDP checksum header. |
void |
copyData(UDPPacket packet)
Copies the contents of a UDPPacket. |
int |
getCombinedHeaderByteLength()
|
int |
getDestinationPort()
|
int |
getSourcePort()
|
int |
getUDPChecksum()
|
int |
getUDPDataByteLength()
|
int |
getUDPPacketByteLength()
|
int |
getUDPPacketLength()
|
void |
setData(byte[] data)
Sets the raw packet byte array. |
void |
setDestinationPort(int port)
Sets the destination port. |
void |
setIPHeaderLength(int length)
Sets the IP header length field. |
void |
setSourcePort(int port)
Sets the source port. |
void |
setUDPDataByteLength(int length)
Sets the length of the UDP data payload. |
void |
setUDPPacketLength(int length)
Sets the UDP total length header field. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int OFFSET_SOURCE_PORT
public static final int OFFSET_DESTINATION_PORT
public static final int OFFSET_UDP_TOTAL_LENGTH
public static final int OFFSET_UDP_CHECKSUM
public static final int LENGTH_UDP_HEADER
Constructor Detail |
public UDPPacket(int size)
size
- The number of bytes in the packet.public UDPPacket(UDPPacket packet)
packet
- The packet to replicate.Method Detail |
public final void copyData(UDPPacket packet)
packet
- The UDPPacket to copy.public void setData(byte[] data)
IPPacket
setData
in class IPPacket
data
- The raw packet byte array to wrap.public final void setSourcePort(int port)
port
- The new source port.public final void setDestinationPort(int port)
port
- The new destination port.public final int getSourcePort()
public final int getDestinationPort()
public void setIPHeaderLength(int length)
IPPacket
setIPHeaderLength
in class IPPacket
length
- The length of the IP header in 32-bit words.public void setUDPPacketLength(int length)
length
- The length of the UDP packet in bytes.public final int getUDPPacketLength()
public final int getUDPChecksum()
public final int getUDPPacketByteLength()
getUDPPacketLength()
).public final int getCombinedHeaderByteLength()
public final void setUDPDataByteLength(int length)
length
- The length of the UDP data payload in bytes.public final int getUDPDataByteLength()
public final int computeUDPChecksum(boolean update)
update
- Specifies whether or not to update the UDP checksum
header after computing the checksum. A value of true indicates
the header should be updated, a value of false indicates it
should not be updated.
public final int computeUDPChecksum()
computeUDPChecksum(true);
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |