JNodeOS v1.2.0 API

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.


Field Summary
static int OFFSET_CHECKSUM
           
static int OFFSET_DESTINATION_PORT
           
static int OFFSET_LENGTH
           
static int OFFSET_SOURCE_PORT
          Offsets into a UDP header in a buffer.
 
Constructor Summary
UDPHeader()
          Construct an empty UDPHeader.
UDPHeader(short sourcePort, short destinationPort, short bodyLength)
          Construct a UDPHeader with the given values.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 int getBodyLength()
           
 short getDestinationPort()
           
 int getLength()
           
 short getSourcePort()
           
 int getTotalLength()
           
 int hashCode()
           
 int marshal(BufferHandle bh, int offset)
           
static void matchDestinationPort(DemultiplexKey dk, int offset, short port)
           
static void matchSourcePort(DemultiplexKey dk, int offset, short port)
           
 void setDestinationPort(short port)
           
 void setSourcePort(short port)
           
 java.lang.String toString()
           
 int unmarshal(BufferHandle bh, int offset)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

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
Constructor Detail

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.
Method Detail

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

JNodeOS v1.2.0 API

This documentation is Copyright (C) 1998-2002 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 web site: http://www.cs.utah.edu/flux/janos/
Generated on Mar 17, 2002