Package org.onlab.packet
Class IPv6
- java.lang.Object
- 
- org.onlab.packet.BasePacket
- 
- org.onlab.packet.IP
- 
- org.onlab.packet.IPv6
 
 
 
- 
- All Implemented Interfaces:
- IPacket,- IExtensionHeader
 
 public class IPv6 extends IP implements IExtensionHeader Implements IPv6 packet format. (RFC 2460)
- 
- 
Field SummaryFields Modifier and Type Field Description protected byte[]destinationAddressstatic byteFIXED_HEADER_LENGTHprotected intflowLabelprotected bytehopLimitstatic byteLINK_LOCAL_0static byteLINK_LOCAL_1protected bytenextHeaderprotected shortpayloadLengthstatic bytePROTOCOL_AHstatic Map<Byte,Deserializer<? extends IPacket>>PROTOCOL_DESERIALIZER_MAPstatic bytePROTOCOL_DSTOPTstatic bytePROTOCOL_ESPstatic bytePROTOCOL_FRAGstatic bytePROTOCOL_HOPOPTstatic bytePROTOCOL_ICMP6static bytePROTOCOL_ROUTINGstatic bytePROTOCOL_TCPstatic bytePROTOCOL_UDPprotected byte[]sourceAddressprotected bytetrafficClassprotected byteversion- 
Fields inherited from class org.onlab.packet.BasePacketparent, payload
 
- 
 - 
Constructor SummaryConstructors Constructor Description IPv6()Default constructor that sets the version to 6.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Deserializer<IPv6>deserializer()Deserializer function for IPv6 packets.booleanequals(Object obj)byte[]getDestinationAddress()Gets destination address.intgetFlowLabel()Gets flow label.bytegetHopLimit()Gets hop limit.static byte[]getLinkLocalAddress(byte[] macAddress)Returns the auto-generated link local address using the mac address as parameter.static byte[]getMacAddress(byte[] linkLocalAddress)Returns the mac address from the auto-generated link local address.static byte[]getMCastMacAddress(byte[] targetIp)According to the RFC 2464, an IPv6 packet with a multicast destination address DST, consisting of the sixteen octets DST[1] through DST[16], is transmitted to the Ethernet multicast address whose first two octets are the value 3333 hexadecimal and whose last four octets are the last four octets of DST.bytegetNextHeader()Gets the type of next header.static byte[]getSolicitNodeAddress(byte[] targetIp)According to the RFC 4291, the solicitation node addresses are formed by taking the low-order 24 bits of an address (unicast or anycast) and appending those bits to the prefix FF02:0:0:0:0:1:FF00::/104.byte[]getSourceAddress()Gets source address.bytegetTrafficClass()Gets traffic class.bytegetVersion()Gets IP version number.inthashCode()static booleanisLinkLocalAddress(byte[] targetIp)According to the RFC 4291, an IPv6 link local address is an IPv6 unicast address that can be automatically configured on any interface using the link-local prefix FE80::/10 (1111 1110 10) and the interface identifier in the modified EUI-64 format.byte[]serialize()Sets all payloads parent packet if applicable, then serializes this packet and all payloads.IPv6setDestinationAddress(byte[] destinationAddress)Sets destination address.IPv6setFlowLabel(int flowLabel)Sets flow label.IPv6setHopLimit(byte hopLimit)Sets hop limit.IPv6setNextHeader(byte nextHeader)Sets the type of next header.IPv6setSourceAddress(byte[] sourceAddress)Sets source address.IPv6setTrafficClass(byte trafficClass)Sets traffic class.IPv6setVersion(byte version)Sets IP version number.StringtoString()- 
Methods inherited from class org.onlab.packet.BasePacketclone, getParent, getPayload, resetChecksum, setParent, setPayload
 
- 
 
- 
- 
- 
Field Detail- 
FIXED_HEADER_LENGTHpublic static final byte FIXED_HEADER_LENGTH - See Also:
- Constant Field Values
 
 - 
PROTOCOL_TCPpublic static final byte PROTOCOL_TCP - See Also:
- Constant Field Values
 
 - 
PROTOCOL_UDPpublic static final byte PROTOCOL_UDP - See Also:
- Constant Field Values
 
 - 
PROTOCOL_ICMP6public static final byte PROTOCOL_ICMP6 - See Also:
- Constant Field Values
 
 - 
PROTOCOL_HOPOPTpublic static final byte PROTOCOL_HOPOPT - See Also:
- Constant Field Values
 
 - 
PROTOCOL_ROUTINGpublic static final byte PROTOCOL_ROUTING - See Also:
- Constant Field Values
 
 - 
PROTOCOL_FRAGpublic static final byte PROTOCOL_FRAG - See Also:
- Constant Field Values
 
 - 
PROTOCOL_ESPpublic static final byte PROTOCOL_ESP - See Also:
- Constant Field Values
 
 - 
PROTOCOL_AHpublic static final byte PROTOCOL_AH - See Also:
- Constant Field Values
 
 - 
PROTOCOL_DSTOPTpublic static final byte PROTOCOL_DSTOPT - See Also:
- Constant Field Values
 
 - 
LINK_LOCAL_0public static final byte LINK_LOCAL_0 - See Also:
- Constant Field Values
 
 - 
LINK_LOCAL_1public static final byte LINK_LOCAL_1 - See Also:
- Constant Field Values
 
 - 
PROTOCOL_DESERIALIZER_MAPpublic static final Map<Byte,Deserializer<? extends IPacket>> PROTOCOL_DESERIALIZER_MAP 
 - 
versionprotected byte version 
 - 
trafficClassprotected byte trafficClass 
 - 
flowLabelprotected int flowLabel 
 - 
payloadLengthprotected short payloadLength 
 - 
nextHeaderprotected byte nextHeader 
 - 
hopLimitprotected byte hopLimit 
 - 
sourceAddressprotected byte[] sourceAddress 
 - 
destinationAddressprotected byte[] destinationAddress 
 
- 
 - 
Method Detail- 
getVersionpublic byte getVersion() Description copied from class:IPGets IP version number.- Specified by:
- getVersionin class- IP
- Returns:
- IP version number
 
 - 
setVersionpublic IPv6 setVersion(byte version) Description copied from class:IPSets IP version number.- Specified by:
- setVersionin class- IP
- Parameters:
- version- the version to set
- Returns:
- IP class
 
 - 
getTrafficClasspublic byte getTrafficClass() Gets traffic class.- Returns:
- the traffic class
 
 - 
setTrafficClasspublic IPv6 setTrafficClass(byte trafficClass) Sets traffic class.- Parameters:
- trafficClass- the traffic class to set
- Returns:
- this
 
 - 
getFlowLabelpublic int getFlowLabel() Gets flow label.- Returns:
- the flow label
 
 - 
setFlowLabelpublic IPv6 setFlowLabel(int flowLabel) Sets flow label.- Parameters:
- flowLabel- the flow label to set
- Returns:
- this
 
 - 
getNextHeaderpublic byte getNextHeader() Description copied from interface:IExtensionHeaderGets the type of next header.- Specified by:
- getNextHeaderin interface- IExtensionHeader
- Returns:
- next header
 
 - 
setNextHeaderpublic IPv6 setNextHeader(byte nextHeader) Description copied from interface:IExtensionHeaderSets the type of next header.- Specified by:
- setNextHeaderin interface- IExtensionHeader
- Parameters:
- nextHeader- the next header to set
- Returns:
- this
 
 - 
getHopLimitpublic byte getHopLimit() Gets hop limit.- Returns:
- the hop limit
 
 - 
setHopLimitpublic IPv6 setHopLimit(byte hopLimit) Sets hop limit.- Parameters:
- hopLimit- the hop limit to set
- Returns:
- this
 
 - 
getSourceAddresspublic byte[] getSourceAddress() Gets source address.- Returns:
- the IPv6 source address
 
 - 
setSourceAddresspublic IPv6 setSourceAddress(byte[] sourceAddress) Sets source address.- Parameters:
- sourceAddress- the IPv6 source address to set
- Returns:
- this
 
 - 
getDestinationAddresspublic byte[] getDestinationAddress() Gets destination address.- Returns:
- the IPv6 destination address
 
 - 
setDestinationAddresspublic IPv6 setDestinationAddress(byte[] destinationAddress) Sets destination address.- Parameters:
- destinationAddress- the IPv6 destination address to set
- Returns:
- this
 
 - 
serializepublic byte[] serialize() Description copied from interface:IPacketSets all payloads parent packet if applicable, then serializes this packet and all payloads.
 - 
hashCodepublic int hashCode() - Overrides:
- hashCodein class- BasePacket
 
 - 
equalspublic boolean equals(Object obj) - Overrides:
- equalsin class- BasePacket
 
 - 
deserializerpublic static Deserializer<IPv6> deserializer() Deserializer function for IPv6 packets.- Returns:
- deserializer function
 
 - 
getSolicitNodeAddresspublic static byte[] getSolicitNodeAddress(byte[] targetIp) According to the RFC 4291, the solicitation node addresses are formed by taking the low-order 24 bits of an address (unicast or anycast) and appending those bits to the prefix FF02:0:0:0:0:1:FF00::/104. Solicited-Node Address: FF02:0:0:0:0:1:FFXX:XXXX- Parameters:
- targetIp- the unicast or anycast address
- Returns:
- the computed solicitation node address
 
 - 
getMCastMacAddresspublic static byte[] getMCastMacAddress(byte[] targetIp) According to the RFC 2464, an IPv6 packet with a multicast destination address DST, consisting of the sixteen octets DST[1] through DST[16], is transmitted to the Ethernet multicast address whose first two octets are the value 3333 hexadecimal and whose last four octets are the last four octets of DST. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |0 0 1 1 0 0 1 1|0 0 1 1 0 0 1 1| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | DST[13] | DST[14] | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | DST[15] | DST[16] | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- Parameters:
- targetIp- the multicast address.
- Returns:
- the multicast mac address
 
 - 
isLinkLocalAddresspublic static boolean isLinkLocalAddress(byte[] targetIp) According to the RFC 4291, an IPv6 link local address is an IPv6 unicast address that can be automatically configured on any interface using the link-local prefix FE80::/10 (1111 1110 10) and the interface identifier in the modified EUI-64 format. +----------------------------------------------------------------+ | 10 bits | 54 bits | 64 bits | +----------- +-------------------------+-------------------------+ | 1111111010 | 0 | interface ID | +----------- +-------------------------+-------------------------+- Parameters:
- targetIp- the ip address to verify
- Returns:
- true if the ipv6 address is link local, false otherwise
 
 - 
getLinkLocalAddresspublic static byte[] getLinkLocalAddress(byte[] macAddress) Returns the auto-generated link local address using the mac address as parameter.- Parameters:
- macAddress- the mac address to use
- Returns:
- the ipv6 link local address
 
 - 
getMacAddresspublic static byte[] getMacAddress(byte[] linkLocalAddress) Returns the mac address from the auto-generated link local address.- Parameters:
- linkLocalAddress- the ipv6 to use
- Returns:
- the mac address
 
 
- 
 
-