Package nl.sidnlabs.pcap.decoder
Class IPDecoder
java.lang.Object
nl.sidnlabs.pcap.decoder.IPDecoder
Decode the IP header
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclearCache(int ipFragmentTTL) Clear expired cache entries in order to avoid memory problemscreatePacket(byte[] packetData, int ipStart) decode(byte[] packetData, int ipStart, long packetTimestampSecs, long packetTimestampMicros, boolean partial) com.google.common.collect.Multimap<Datagram,DatagramPayload> voidbyte[]reassemble(Packet packet, byte[] packetData) Reassemble the IP packet is it is fragmented.voidreset()voidsetDatagrams(com.google.common.collect.Multimap<Datagram, DatagramPayload> datagrams) voidsetTcpFlows(Map<TCPFlow, FlowData> flows)
-
Field Details
-
IP_PROTOCOL_VERSION_4
public static final int IP_PROTOCOL_VERSION_4- See Also:
-
IP_PROTOCOL_VERSION_6
public static final int IP_PROTOCOL_VERSION_6- See Also:
-
IP_TOTAL_LEN_OFFSET
public static final int IP_TOTAL_LEN_OFFSET- See Also:
-
IP_FLAGS
public static final int IP_FLAGS- See Also:
-
IP_FRAGMENT_OFFSET
public static final int IP_FRAGMENT_OFFSET- See Also:
-
-
Constructor Details
-
IPDecoder
-
-
Method Details
-
printStats
public void printStats() -
decode
public Packet decode(byte[] packetData, int ipStart, long packetTimestampSecs, long packetTimestampMicros, boolean partial) -
decode
-
decode
-
createPacket
-
reassemble
Reassemble the IP packet is it is fragmented. If it is not fragmented then the packetData bytes are returned as result. If the packet is fragmented and this packet is the final fragment then all the bytes from the fragments are concatenated and returned. if fragmented and current fragment is not yet the final fragment then an empty byte array is returned. the- Parameters:
packet- the current packetpacketData- the payload of the current packet- Returns:
- input, reassembled or no bytes
-
getDatagrams
-
setDatagrams
-
setTcpFlows
-
clearCache
public void clearCache(int ipFragmentTTL) Clear expired cache entries in order to avoid memory problems- Parameters:
ipFragmentTTL- timeout for IP fragments
-
reset
public void reset()
-