jist.swans.route
Class RouteDsrMsg

java.lang.Object
  extended by jist.swans.route.RouteDsrMsg
All Implemented Interfaces:
java.lang.Cloneable, JistAPI.Timeless, Message

public class RouteDsrMsg
extends java.lang.Object
implements Message, java.lang.Cloneable

A message with a DSR Options header.

Since:
SWANS1.0
Version:
$Id: RouteDsrMsg.java,v 1.10 2004/04/06 16:07:50 barr Exp $
Author:
Ben Viglietta, Rimon Barr <barr+jist@cs.cornell.edu>

Nested Class Summary
static class RouteDsrMsg.Option
          The base class for all DSR header options.
static class RouteDsrMsg.OptionAck
          An Acknowledgement option.
static class RouteDsrMsg.OptionAckRequest
          An Acknowledgement Request option.
static class RouteDsrMsg.OptionPad1
          A Pad1 option.
static class RouteDsrMsg.OptionPadN
          A PadN option.
static class RouteDsrMsg.OptionRouteError
          A Route Error option.
static class RouteDsrMsg.OptionRouteReply
          A Route Reply option.
static class RouteDsrMsg.OptionRouteRequest
          A Route Request option.
static class RouteDsrMsg.OptionSourceRoute
          A Source Route option.
 
Field Summary
private  Message content
          The payload of the DSR message.
static byte ERROR_FLOW_STATE_NOT_SUPPORTED
          Error code for "flow state not supported".
static byte ERROR_NODE_UNREACHABLE
          Error code for "unreachable node".
static byte ERROR_OPTION_NOT_SUPPORTED
          Error code for "option not supported".
private  short nextHeaderType
          The protocol number of the message contained in this DSR header.
static byte OPT_ACK
          Type of an Acknowledgement option.
static byte OPT_ACK_REQUEST
          Type of an Acknowledgement Request option.
static byte OPT_PAD1
          Type of a Pad1 option.
static byte OPT_PADN
          Type of a PadN option.
static byte OPT_ROUTE_ERROR
          Type of a Route Error option.
static byte OPT_ROUTE_REPLY
          Type of a Route Reply option.
static byte OPT_ROUTE_REQUEST
          Type of a Route Request option.
static byte OPT_SOURCE_ROUTE
          Type of a Source Route option.
private  java.util.ArrayList options
          The list of options contained in the DSR header.
static int UNRECOGNIZED_OPT_DROP
          Code for dropping unrecognized options.
static int UNRECOGNIZED_OPT_IGNORE
          Code for ignoring unrecognized options.
static int UNRECOGNIZED_OPT_MARK
          Code for marking unrecognized options.
static int UNRECOGNIZED_OPT_REMOVE
          Code for removing unrecognized options.
 
Fields inherited from interface jist.swans.misc.Message
NULL
 
Constructor Summary
RouteDsrMsg(Message content)
          Creates a new RouteDsrMsg with the given payload.
 
Method Summary
 void addOption(byte[] opt)
          Adds a new option to the DSR message.
 java.lang.Object clone()
          
 void getBytes(byte[] buf, int offset)
          Store packet into byte array.
 Message getContent()
          Returns the the content of the DSR message.
 short getNextHeaderType()
          Returns the network protocol number of the content of the DSR message.
 java.util.List getOptions()
          Returns the options contained in the DSR header.
private  int getOptionsSize()
          Determines the size in bytes of the options contained in this DSR message.
 int getSize()
          Return packet size or Constants.ZERO_WIRE_SIZE.
 boolean hasOption(byte optType)
          Determines whether the DSR header contains an option of the given type.
 void setNextHeaderType(short nextHeaderType)
          Sets the protocol number of the content of the DSR message.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OPT_ROUTE_REQUEST

public static final byte OPT_ROUTE_REQUEST
Type of a Route Request option.

See Also:
Constant Field Values

OPT_ROUTE_REPLY

public static final byte OPT_ROUTE_REPLY
Type of a Route Reply option.

See Also:
Constant Field Values

OPT_ROUTE_ERROR

public static final byte OPT_ROUTE_ERROR
Type of a Route Error option.

See Also:
Constant Field Values

OPT_ACK_REQUEST

public static final byte OPT_ACK_REQUEST
Type of an Acknowledgement Request option.

See Also:
Constant Field Values

OPT_ACK

public static final byte OPT_ACK
Type of an Acknowledgement option.

See Also:
Constant Field Values

OPT_SOURCE_ROUTE

public static final byte OPT_SOURCE_ROUTE
Type of a Source Route option.

See Also:
Constant Field Values

OPT_PAD1

public static final byte OPT_PAD1
Type of a Pad1 option.

See Also:
Constant Field Values

OPT_PADN

public static final byte OPT_PADN
Type of a PadN option.

See Also:
Constant Field Values

ERROR_NODE_UNREACHABLE

public static final byte ERROR_NODE_UNREACHABLE
Error code for "unreachable node".

See Also:
Constant Field Values

ERROR_FLOW_STATE_NOT_SUPPORTED

public static final byte ERROR_FLOW_STATE_NOT_SUPPORTED
Error code for "flow state not supported".

See Also:
Constant Field Values

ERROR_OPTION_NOT_SUPPORTED

public static final byte ERROR_OPTION_NOT_SUPPORTED
Error code for "option not supported".

See Also:
Constant Field Values

UNRECOGNIZED_OPT_IGNORE

public static final int UNRECOGNIZED_OPT_IGNORE
Code for ignoring unrecognized options.

See Also:
Constant Field Values

UNRECOGNIZED_OPT_REMOVE

public static final int UNRECOGNIZED_OPT_REMOVE
Code for removing unrecognized options.

See Also:
Constant Field Values

UNRECOGNIZED_OPT_MARK

public static final int UNRECOGNIZED_OPT_MARK
Code for marking unrecognized options.

See Also:
Constant Field Values

UNRECOGNIZED_OPT_DROP

public static final int UNRECOGNIZED_OPT_DROP
Code for dropping unrecognized options.

See Also:
Constant Field Values

content

private Message content
The payload of the DSR message.


options

private java.util.ArrayList options
The list of options contained in the DSR header.


nextHeaderType

private short nextHeaderType
The protocol number of the message contained in this DSR header.

Constructor Detail

RouteDsrMsg

public RouteDsrMsg(Message content)
Creates a new RouteDsrMsg with the given payload.

Parameters:
content - the payload of the DSR message. This can be null.
Method Detail

getOptions

public java.util.List getOptions()
Returns the options contained in the DSR header.

Returns:
List of options.

getContent

public Message getContent()
Returns the the content of the DSR message.

Returns:
the content of the DSR message, or null if none.

getNextHeaderType

public short getNextHeaderType()
Returns the network protocol number of the content of the DSR message.

Returns:
the protocol number of the content of the DSR message. This is equal to IPv6's No Next Header protocol number if the DSR header has no content.

setNextHeaderType

public void setNextHeaderType(short nextHeaderType)
Sets the protocol number of the content of the DSR message.

Parameters:
nextHeaderType - the protocol number of the content of the DSR message.

getBytes

public void getBytes(byte[] buf,
                     int offset)
Store packet into byte array.

Specified by:
getBytes in interface Message
Parameters:
buf - destination byte array
offset - byte array starting offset

getSize

public int getSize()
Return packet size or Constants.ZERO_WIRE_SIZE.

Specified by:
getSize in interface Message
Returns:
packet size

addOption

public void addOption(byte[] opt)
Adds a new option to the DSR message.

Parameters:
opt - the option to add

hasOption

public boolean hasOption(byte optType)
Determines whether the DSR header contains an option of the given type.

Parameters:
optType - the type of option to search for
Returns:
whether the DSR header contains an option of type optType.

getOptionsSize

private int getOptionsSize()
Determines the size in bytes of the options contained in this DSR message.

Returns:
the size in bytes of the options contained in this DSR message. This value does not include the size of the fixed portion of the DSR header or the payload of the message.

clone

public java.lang.Object clone()

Overrides:
clone in class java.lang.Object