public class IPv6 extends IP implements IExtensionHeader
Modifier and Type | Field and Description |
---|---|
protected byte[] |
destinationAddress |
static byte |
FIXED_HEADER_LENGTH |
protected int |
flowLabel |
protected byte |
hopLimit |
static byte |
LINK_LOCAL_0 |
static byte |
LINK_LOCAL_1 |
protected byte |
nextHeader |
protected short |
payloadLength |
static byte |
PROTOCOL_AH |
static java.util.Map<java.lang.Byte,Deserializer<? extends IPacket>> |
PROTOCOL_DESERIALIZER_MAP |
static byte |
PROTOCOL_DSTOPT |
static byte |
PROTOCOL_ESP |
static byte |
PROTOCOL_FRAG |
static byte |
PROTOCOL_HOPOPT |
static byte |
PROTOCOL_ICMP6 |
static byte |
PROTOCOL_ROUTING |
static byte |
PROTOCOL_TCP |
static byte |
PROTOCOL_UDP |
protected byte[] |
sourceAddress |
protected byte |
trafficClass |
protected byte |
version |
parent, payload
Constructor and Description |
---|
IPv6()
Default constructor that sets the version to 6.
|
Modifier and Type | Method and Description |
---|---|
static Deserializer<IPv6> |
deserializer()
Deserializer function for IPv6 packets.
|
boolean |
equals(java.lang.Object obj) |
byte[] |
getDestinationAddress()
Gets destination address.
|
int |
getFlowLabel()
Gets flow label.
|
byte |
getHopLimit()
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.
|
byte |
getNextHeader()
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.
|
byte |
getTrafficClass()
Gets traffic class.
|
byte |
getVersion()
Gets IP version number.
|
int |
hashCode() |
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.
|
byte[] |
serialize()
Sets all payloads parent packet if applicable, then serializes this
packet and all payloads.
|
IPv6 |
setDestinationAddress(byte[] destinationAddress)
Sets destination address.
|
IPv6 |
setFlowLabel(int flowLabel)
Sets flow label.
|
IPv6 |
setHopLimit(byte hopLimit)
Sets hop limit.
|
IPv6 |
setNextHeader(byte nextHeader)
Sets the type of next header.
|
IPv6 |
setSourceAddress(byte[] sourceAddress)
Sets source address.
|
IPv6 |
setTrafficClass(byte trafficClass)
Sets traffic class.
|
IPv6 |
setVersion(byte version)
Sets IP version number.
|
java.lang.String |
toString() |
clone, getParent, getPayload, resetChecksum, setParent, setPayload
public static final byte FIXED_HEADER_LENGTH
public static final byte PROTOCOL_TCP
public static final byte PROTOCOL_UDP
public static final byte PROTOCOL_ICMP6
public static final byte PROTOCOL_HOPOPT
public static final byte PROTOCOL_ROUTING
public static final byte PROTOCOL_FRAG
public static final byte PROTOCOL_ESP
public static final byte PROTOCOL_AH
public static final byte PROTOCOL_DSTOPT
public static final byte LINK_LOCAL_0
public static final byte LINK_LOCAL_1
public static final java.util.Map<java.lang.Byte,Deserializer<? extends IPacket>> PROTOCOL_DESERIALIZER_MAP
protected byte version
protected byte trafficClass
protected int flowLabel
protected short payloadLength
protected byte nextHeader
protected byte hopLimit
protected byte[] sourceAddress
protected byte[] destinationAddress
public byte getVersion()
IP
getVersion
in class IP
public IPv6 setVersion(byte version)
IP
setVersion
in class IP
version
- the version to setpublic byte getTrafficClass()
public IPv6 setTrafficClass(byte trafficClass)
trafficClass
- the traffic class to setpublic int getFlowLabel()
public IPv6 setFlowLabel(int flowLabel)
flowLabel
- the flow label to setpublic byte getNextHeader()
IExtensionHeader
getNextHeader
in interface IExtensionHeader
public IPv6 setNextHeader(byte nextHeader)
IExtensionHeader
setNextHeader
in interface IExtensionHeader
nextHeader
- the next header to setpublic byte getHopLimit()
public IPv6 setHopLimit(byte hopLimit)
hopLimit
- the hop limit to setpublic byte[] getSourceAddress()
public IPv6 setSourceAddress(byte[] sourceAddress)
sourceAddress
- the IPv6 source address to setpublic byte[] getDestinationAddress()
public IPv6 setDestinationAddress(byte[] destinationAddress)
destinationAddress
- the IPv6 destination address to setpublic byte[] serialize()
IPacket
public int hashCode()
hashCode
in class BasePacket
public boolean equals(java.lang.Object obj)
equals
in class BasePacket
public static Deserializer<IPv6> deserializer()
public java.lang.String toString()
toString
in class java.lang.Object
public static byte[] getSolicitNodeAddress(byte[] targetIp)
targetIp
- the unicast or anycast addresspublic static byte[] getMCastMacAddress(byte[] targetIp)
targetIp
- the multicast address.public static boolean isLinkLocalAddress(byte[] targetIp)
targetIp
- the ip address to verifypublic static byte[] getLinkLocalAddress(byte[] macAddress)
macAddress
- the mac address to usepublic static byte[] getMacAddress(byte[] linkLocalAddress)
linkLocalAddress
- the ipv6 to use