edu.utah.janos.protocols.udp
Class UDPHeader
java.lang.Object
|
+--edu.utah.janos.protocols.udp.UDPHeader
- public class UDPHeader
- extends java.lang.Object
- implements PacketSegment
The UDPHeader is a PacketSegment for the standard UDP header.
Constructor Summary |
UDPHeader()
Construct an empty UDPHeader. |
UDPHeader(short sourcePort,
short destinationPort,
short bodyLength)
Construct a UDPHeader with the given values. |
Methods inherited from class java.lang.Object |
getClass,
notify,
notifyAll,
wait,
wait,
wait |
OFFSET_SOURCE_PORT
public static final int OFFSET_SOURCE_PORT
- Offsets into a UDP header in a buffer.
OFFSET_DESTINATION_PORT
public static final int OFFSET_DESTINATION_PORT
OFFSET_LENGTH
public static final int OFFSET_LENGTH
OFFSET_CHECKSUM
public static final int OFFSET_CHECKSUM
UDPHeader
public UDPHeader(short sourcePort,
short destinationPort,
short bodyLength)
- Construct a UDPHeader with the given values.
- Parameters:
sourcePort
- The source port of this packet.destinationPort
- The destination port of this packet.bodyLength
- The length of the packet body.
UDPHeader
public UDPHeader()
- Construct an empty UDPHeader.
matchSourcePort
public static void matchSourcePort(DemultiplexKey dk,
int offset,
short port)
matchDestinationPort
public static void matchDestinationPort(DemultiplexKey dk,
int offset,
short port)
getSourcePort
public short getSourcePort()
- Returns:
- The source port.
setSourcePort
public void setSourcePort(short port)
- Parameters:
port
- The new source port value.
getDestinationPort
public short getDestinationPort()
- Returns:
- The destination port.
setDestinationPort
public void setDestinationPort(short port)
- Parameters:
port
- The new destination port value.
getLength
public int getLength()
- Specified by:
- getLength in interface PacketSegment
- Returns:
- The length of a UDPHeader.
getBodyLength
public int getBodyLength()
- Returns:
- The length of the body.
getTotalLength
public int getTotalLength()
- Returns:
- The total length of the UDP portion of the packet.
marshal
public int marshal(BufferHandle bh,
int offset)
- Specified by:
- marshal in interface PacketSegment
- Tags copied from interface: PacketSegment
- Parameters:
bh
- The buffer to marshal this packet into.offset
- The offset in the buffer to start marshalling.
unmarshal
public int unmarshal(BufferHandle bh,
int offset)
throws InvalidPacketException
- Specified by:
- unmarshal in interface PacketSegment
- Tags copied from interface: PacketSegment
- Parameters:
bh
- The buffer that contains the marshalled packet segments.offset
- The offset in the buffer to start unmarshalling.
hashCode
public int hashCode()
- Overrides:
- hashCode in class java.lang.Object
equals
public boolean equals(java.lang.Object obj)
- Overrides:
- equals in class java.lang.Object
toString
public java.lang.String toString()
- Overrides:
- toString in class java.lang.Object
This documentation is Copyright (C) 1998-2001 The University of Utah. All Rights Reserved. See the file LICENSE for distribution terms.
Documentation, software, and mailing list archives for Janos can be found at the Janos Project: http://www.cs.utah.edu/flux/janos/