public final class IPv6PacketImpl extends AbstractPacket implements IPv6Packet
| Modifier and Type | Field and Description |
|---|---|
static int |
FIXED_HEADER_LENGTH |
EXTENSION_AH, EXTENSION_DESTINATION_OPTIONS, EXTENSION_ESP, EXTENSION_FRAGMENT, EXTENSION_HOP_BY_HOP, EXTENSION_MOBILITY, EXTENSION_ROUTING, VERSION_IDENTIFIER| Constructor and Description |
|---|
IPv6PacketImpl(Packet parent,
Buffer headers,
int nextProtocol,
Buffer payload) |
| Modifier and Type | Method and Description |
|---|---|
IPv6Packet |
clone() |
long |
getArrivalTime()
The arrival time of this packet in microseconds relative to epoch
(midnight UTC of January 1, 1970).
|
String |
getDestinationIP()
Convenience method for returning the destination IP in a more human readable form.
|
int |
getFlowLabel() |
short |
getFragmentOffset()
The fragment offset field, measured in units of eight-byte blocks, is 13
bits long and specifies the offset of a particular fragment relative to
the beginning of the original unfragmented IP datagram.
|
int |
getHeaderLength()
The length of the IPv6 headers
|
int |
getHopLimit() |
int |
getIdentification()
Note, this should be treated as a unsigned short.
|
Packet |
getNextPacket()
Get the next frame, or null if there is none.
|
byte[] |
getRawDestinationIP()
Get the raw destination ip.
|
byte[] |
getRawSourceIP()
Get the raw source ip.
|
String |
getSourceIP()
Convenience method for returning the source IP in a more human readable form.
|
int |
getTotalIPLength()
This 16-bit field defines the entire packet (fragment) size, including
header and data, in bytes.
|
short |
getTrafficClass() |
int |
getVersion()
The IP version (4 or 6)
|
boolean |
isFragmented() |
void |
setDestinationIP(String destinationIP)
Set the destination IP of this
IPPacket. |
void |
setRawDestinationIP(byte[] ip) |
void |
setRawSourceIP(byte[] ip) |
void |
setSourceIP(String sourceIp)
Set the source IP of this
IPPacket. |
String |
toString() |
void |
verify()
Calling this method will force the packet to completely parse its data
and check so that all the information conforms to whatever rules this
packet needs to follow.
|
void |
write(OutputStream out,
Buffer payload)
Writes this packet to the
OutputStream with the supplied payload. |
checkParent, getName, getPacket, getParentPacket, getPayload, getProtocol, hasProtocol, writeequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetName, getPacket, getParentPacket, getPayload, getProtocol, hasProtocol, writepublic static final int FIXED_HEADER_LENGTH
public byte[] getRawSourceIP()
getRawSourceIP in interface IPPacketpublic void setSourceIP(String sourceIp)
IPPacketIPPacket.setSourceIP in interface IPPacketpublic String getSourceIP()
getSourceIP in interface IPPacketpublic byte[] getRawDestinationIP()
getRawDestinationIP in interface IPPacketpublic void setDestinationIP(String destinationIP)
IPPacketIPPacket.setDestinationIP in interface IPPacketpublic String getDestinationIP()
getDestinationIP in interface IPPacketpublic void verify()
IPPacket, hardly does anything
in this method but more complex protocols such as SIP (once again), HTTP
etc can spend quite some time verifying everything, which is why you
don't want to do it unless you really have to.
In general, yajpcap has the philosophy of
"assume that everything is ok until things blow up and then deal with it"verify in interface Packetverify in class AbstractPacketpublic short getTrafficClass()
getTrafficClass in interface IPv6Packetpublic int getFlowLabel()
getFlowLabel in interface IPv6Packetpublic int getHopLimit()
getHopLimit in interface IPv6Packetpublic long getArrivalTime()
PacketSimpleDateFormat but it can
only handle milliseconds precision (you will have to write your own date
formatter if you want microseconds).
Here is a snippet illustrating how to turn the arrival time of the packet
into a human readable date
Packet p = ...;
SimpleDateFormat formatter = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss.SSS");
Date date = new Date(p.getArrivalTime() / 1000);
System.out.println("Arrival time: " + formatter.format(date));
Note how an integer devision is performed on the arrival time to
"cut off" the microseconds from the time stampgetArrivalTime in interface Packetpublic void write(OutputStream out, Buffer payload) throws IOException
PacketOutputStream with the supplied payload.
You can use this method to e.g. write a raw UDPPacket to the
stream with this payload. Note, if the UDPPacket already had a
payload it will be ignored so use this method with care.write in interface PacketIOExceptionpublic int getTotalIPLength()
IPPacketgetTotalIPLength in interface IPPacketpublic void setRawSourceIP(byte[] ip)
public void setRawDestinationIP(byte[] ip)
public IPv6Packet clone()
public Packet getNextPacket() throws IOException
PacketgetNextPacket in interface PacketIOExceptionpublic int getVersion()
IPPacketgetVersion in interface IPPacketpublic int getHeaderLength()
getHeaderLength in interface IPPacketpublic int getIdentification()
IPPacketgetIdentification in interface IPPacketpublic boolean isFragmented()
isFragmented in interface IPPacketpublic short getFragmentOffset()
IPPacketgetFragmentOffset in interface IPPacketCopyright © 2021. All Rights Reserved.