Package org.onlab.packet.ipv6
Class BaseOptions
- java.lang.Object
-
- org.onlab.packet.BasePacket
-
- org.onlab.packet.ipv6.BaseOptions
-
- All Implemented Interfaces:
IPacket
,IExtensionHeader
- Direct Known Subclasses:
DestinationOptions
,HopByHopOptions
public class BaseOptions extends BasePacket implements IExtensionHeader
Base class for hop-by-hop options and destination options.
-
-
Field Summary
Fields Modifier and Type Field Description static byte
FIXED_HEADER_LENGTH
static byte
FIXED_OPTIONS_LENGTH
protected byte
headerExtLength
static byte
LENGTH_UNIT
protected byte
nextHeader
protected byte[]
options
protected byte
type
-
Fields inherited from class org.onlab.packet.BasePacket
parent, payload
-
-
Constructor Summary
Constructors Constructor Description BaseOptions()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Deserializer<BaseOptions>
deserializer()
Deserializer function for IPv6 base options.boolean
equals(Object obj)
byte
getHeaderExtLength()
Gets the extension length of this header.byte
getNextHeader()
Gets the type of next header.byte[]
getOptions()
Gets the options.protected byte
getType()
Gets the type of this option.int
hashCode()
byte[]
serialize()
Sets all payloads parent packet if applicable, then serializes this packet and all payloads.BaseOptions
setHeaderExtLength(byte headerExtLength)
Sets the extension length of this header.BaseOptions
setNextHeader(byte nextHeader)
Sets the type of next header.BaseOptions
setOptions(byte[] options)
Sets the options.protected BaseOptions
setType(byte type)
Sets the type of this option.String
toString()
-
Methods inherited from class org.onlab.packet.BasePacket
clone, getParent, getPayload, resetChecksum, setParent, setPayload
-
-
-
-
Field Detail
-
FIXED_HEADER_LENGTH
public static final byte FIXED_HEADER_LENGTH
- See Also:
- Constant Field Values
-
FIXED_OPTIONS_LENGTH
public static final byte FIXED_OPTIONS_LENGTH
- See Also:
- Constant Field Values
-
LENGTH_UNIT
public static final byte LENGTH_UNIT
- See Also:
- Constant Field Values
-
nextHeader
protected byte nextHeader
-
headerExtLength
protected byte headerExtLength
-
options
protected byte[] options
-
type
protected byte type
-
-
Method Detail
-
getNextHeader
public byte getNextHeader()
Description copied from interface:IExtensionHeader
Gets the type of next header.- Specified by:
getNextHeader
in interfaceIExtensionHeader
- Returns:
- next header
-
setNextHeader
public BaseOptions setNextHeader(byte nextHeader)
Description copied from interface:IExtensionHeader
Sets the type of next header.- Specified by:
setNextHeader
in interfaceIExtensionHeader
- Parameters:
nextHeader
- the next header to set- Returns:
- this
-
getHeaderExtLength
public byte getHeaderExtLength()
Gets the extension length of this header.- Returns:
- header length
-
setHeaderExtLength
public BaseOptions setHeaderExtLength(byte headerExtLength)
Sets the extension length of this header.- Parameters:
headerExtLength
- the header length to set- Returns:
- this
-
getOptions
public byte[] getOptions()
Gets the options.- Returns:
- the options
-
setOptions
public BaseOptions setOptions(byte[] options)
Sets the options.- Parameters:
options
- the options to set- Returns:
- this
-
getType
protected byte getType()
Gets the type of this option.- Returns:
- the type
-
setType
protected BaseOptions setType(byte type)
Sets the type of this option. Must be either IPv6.PROTOCOL_HOPOPT or IPv6.PROTOCOL_DSTOPT- Parameters:
type
- the type to set- Returns:
- this
-
serialize
public byte[] serialize()
Description copied from interface:IPacket
Sets all payloads parent packet if applicable, then serializes this packet and all payloads.
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classBasePacket
-
equals
public boolean equals(Object obj)
- Overrides:
equals
in classBasePacket
-
deserializer
public static Deserializer<BaseOptions> deserializer()
Deserializer function for IPv6 base options.- Returns:
- deserializer function
-
-