net.sourceforge.jpcap.net
Class UDPPacket

java.lang.Object
  extended bynet.sourceforge.jpcap.net.Packet
      extended bynet.sourceforge.jpcap.net.EthernetPacket
          extended bynet.sourceforge.jpcap.net.IPPacket
              extended bynet.sourceforge.jpcap.net.UDPPacket
All Implemented Interfaces:
EthernetFields, IPFields, java.io.Serializable, UDPFields

public class UDPPacket
extends IPPacket
implements UDPFields, java.io.Serializable

A UDP packet.

Extends an IP packet, adding a UDP header and UDP data payload.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class net.sourceforge.jpcap.net.IPPacket
IPPacket.TestProbe
 
Field Summary
 
Fields inherited from class net.sourceforge.jpcap.net.IPPacket
_ipOffset
 
Fields inherited from class net.sourceforge.jpcap.net.EthernetPacket
_bytes, _ethOffset
 
Fields inherited from interface net.sourceforge.jpcap.net.UDPFields
UDP_CSUM_LEN, UDP_CSUM_POS, UDP_DP_POS, UDP_HEADER_LEN, UDP_LEN_LEN, UDP_LEN_POS, UDP_PORT_LEN, UDP_SP_POS
 
Fields inherited from interface net.sourceforge.jpcap.net.IPFields
IP_CODE_LEN, IP_CODE_POS, IP_CSUM_LEN, IP_CSUM_POS, IP_DST_POS, IP_FRAG_LEN, IP_FRAG_POS, IP_HEADER_LEN, IP_ID_LEN, IP_ID_POS, IP_LEN_LEN, IP_LEN_POS, IP_SRC_POS, IP_TOS_LEN, IP_TOS_POS, IP_TTL_LEN, IP_TTL_POS, IP_VER_LEN, IP_VER_POS
 
Fields inherited from interface net.sourceforge.jpcap.net.EthernetFields
ETH_CODE_LEN, ETH_CODE_POS, ETH_DST_POS, ETH_HEADER_LEN, ETH_SRC_POS
 
Constructor Summary
UDPPacket(int lLen, byte[] bytes)
          Create a new UDP packet.
 
Method Summary
 int getChecksum()
          Fetch the header checksum.
 java.lang.String getColor()
          Fetch ascii escape sequence of the color associated with this packet type.
 byte[] getData()
          Fetch the UDP data as a byte array.
 int getDestinationPort()
          Fetch the port number on the target host.
 byte[] getHeader()
          Fetch the UDP header as a byte array.
 int getLength()
          Fetch the total length of the UDP packet, including header and data payload, in bytes.
 int getSourcePort()
          Fetch the port number on the source host.
 int getUDPChecksum()
          Fetch the header checksum.
 byte[] getUDPData()
          Fetch the UDP data as a byte array.
 byte[] getUDPHeader()
          Fetch the UDP header a byte array.
 java.lang.String toColoredString(boolean colored)
          Generate string with contents describing this UDP packet.
 java.lang.String toString()
          Convert this UDP packet to a readable string.
 
Methods inherited from class net.sourceforge.jpcap.net.IPPacket
computeReceiverChecksum, computeReceiverIPChecksum, computeSenderChecksum, computeSenderIPChecksum, getDestinationAddress, getDestinationAddressAsLong, getDestinationAddressBytes, getFragmentFlags, getFragmentOffset, getHeaderLength, getId, getIPChecksum, getIPData, getIPHeader, getIpHeaderLength, getIPHeaderLength, getIPProtocol, getProtocol, getSourceAddress, getSourceAddressAsLong, getSourceAddressBytes, getTimeToLive, getTypeOfService, getVersion, isValidChecksum, isValidIPChecksum, onesCompSum, toColoredVerboseString
 
Methods inherited from class net.sourceforge.jpcap.net.EthernetPacket
getDestinationHwAddress, getEthernetData, getEthernetHeader, getEthernetHeaderLength, getEthernetProtocol, getSourceHwAddress
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UDPPacket

public UDPPacket(int lLen,
                 byte[] bytes)
Create a new UDP packet.

Method Detail

getSourcePort

public int getSourcePort()
Fetch the port number on the source host.


getDestinationPort

public int getDestinationPort()
Fetch the port number on the target host.


getLength

public int getLength()
Fetch the total length of the UDP packet, including header and data payload, in bytes.

Overrides:
getLength in class IPPacket

getUDPChecksum

public int getUDPChecksum()
Fetch the header checksum.


getChecksum

public int getChecksum()
Fetch the header checksum.

Overrides:
getChecksum in class IPPacket

getUDPHeader

public byte[] getUDPHeader()
Fetch the UDP header a byte array.


getHeader

public byte[] getHeader()
Fetch the UDP header as a byte array.

Overrides:
getHeader in class IPPacket

getUDPData

public byte[] getUDPData()
Fetch the UDP data as a byte array.


getData

public byte[] getData()
Fetch the UDP data as a byte array.

Overrides:
getData in class IPPacket

toString

public java.lang.String toString()
Convert this UDP packet to a readable string.

Overrides:
toString in class IPPacket

toColoredString

public java.lang.String toColoredString(boolean colored)
Generate string with contents describing this UDP packet.

Overrides:
toColoredString in class IPPacket
Parameters:
colored - whether or not the string should contain ansi color escape sequences.

getColor

public java.lang.String getColor()
Fetch ascii escape sequence of the color associated with this packet type.

Overrides:
getColor in class IPPacket