OpenNMS API 1.2.3

org.opennms.protocols.ip
Class IPHeader.RouteOption

java.lang.Object
  extended byorg.opennms.protocols.ip.IPHeader.Option
      extended byorg.opennms.protocols.ip.IPHeader.RouteOption
Direct Known Subclasses:
IPHeader.LooseSourceRouteOption, IPHeader.RouteRecordOption, IPHeader.StrictSourceRouteOption
Enclosing class:
IPHeader

public static class IPHeader.RouteOption
extends IPHeader.Option

This class represents routing options that may be part of an IP header. The route defines a set of IP addresses that a packet may have or should pass though.

Author:
Brian Weaver , OpenNMS

Field Summary
protected  java.util.List m_addrs
          The list of addresses for the packet to hit on it's way to it's destination
 
Fields inherited from class org.opennms.protocols.ip.IPHeader.Option
CODE_END_OF_OPTION_LIST, CODE_LOOSE_SOURCE_ROUTE, CODE_ROUTE_RECORD, CODE_STRICT_SOURCE_ROUTE, m_code
 
Constructor Summary
(package private) IPHeader.RouteOption(byte code)
          Constructs a new, empty instance of the class.
(package private) IPHeader.RouteOption(byte code, IPv4Address[] addrs)
          Constructs a new instance of the class with the passed addresses used for the routing.
(package private) IPHeader.RouteOption(byte code, java.util.List addrs)
          Constructs a new instance of the class with the passed addresses used for the routing.
 
Method Summary
(package private)  void add(IPv4Address addr)
          Adds an address to the end of the set of addresses to hit on its lan trip
(package private)  int bytesRequired()
          The number of bytes required to represent this option in an IP header
 java.util.Iterator iterator()
          Returns the iterator that may be used to look at the encapsulated addresses.
 int size()
          Returns the number of addresses contained in the option list.
(package private)  int writeBytes(byte[] dest, int offset)
          This method is used to serialized the data contained in the option to the passed array, starting at the offset passed.
 
Methods inherited from class org.opennms.protocols.ip.IPHeader.Option
getOptionClass, getOptionNumber, isOptionCopied
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_addrs

protected java.util.List m_addrs
The list of addresses for the packet to hit on it's way to it's destination

Constructor Detail

IPHeader.RouteOption

IPHeader.RouteOption(byte code)
Constructs a new, empty instance of the class.


IPHeader.RouteOption

IPHeader.RouteOption(byte code,
                     IPv4Address[] addrs)
Constructs a new instance of the class with the passed addresses used for the routing. If the set of addresses is larger than the option can hold an exception is thrown.

Parameters:
addrs - The list of addresses for the loose source route.
Throws:
java.lang.IndexOutOfBoundsException - Thrown if the number of addresses is to large for the option

IPHeader.RouteOption

IPHeader.RouteOption(byte code,
                     java.util.List addrs)
Constructs a new instance of the class with the passed addresses used for the routing. If the set of addresses is larger than the option can hold an exception is thrown.

Parameters:
addrs - The list of addresses for the loose source route.
Throws:
java.lang.IndexOutOfBoundsException - Thrown if the number of addresses is to large for the option
Method Detail

add

void add(IPv4Address addr)
Adds an address to the end of the set of addresses to hit on its lan trip

Parameters:
addr - The address to add to the loose source route
Throws:
java.lang.IndexOutOfBoundsException - Thrown if the address list is full

bytesRequired

int bytesRequired()
The number of bytes required to represent this option in an IP header

Specified by:
bytesRequired in class IPHeader.Option
Returns:
The bytes used by this option

writeBytes

int writeBytes(byte[] dest,
               int offset)
This method is used to serialized the data contained in the option to the passed array, starting at the offset passed. If an insufficient amount of space exists then an exception is thrown.

Specified by:
writeBytes in class IPHeader.Option
Parameters:
dest - The destination buffer
offset - The offset to start writing data
Returns:
The new offset after writing data
Throws:
java.lang.ArrayIndexOutOfBounds - Thrown if there is not sufficent space in the passed buffer.

iterator

public java.util.Iterator iterator()
Returns the iterator that may be used to look at the encapsulated addresses. The class IPv4Address is used to represent the addresses in the list.

Returns:
An iterator that can be used to operate on the list.

size

public int size()
Returns the number of addresses contained in the option list.


OpenNMS API 1.2.3

Generated by eevans on May 29 2005 2015.