All Implemented Interfaces:
Direct Known Subclasses:

public class Packet extends Object implements Comparable<Packet>
  • Field Details

    • raw

      protected byte[] raw
    • ipOffset

      protected int ipOffset
    • etherProtocol

      protected int etherProtocol
    • protocol

      protected int protocol
    • isRoutingV6

      protected boolean isRoutingV6
    • isCorrupt

      protected boolean isCorrupt
  • Constructor Details

    • Packet

      public Packet()
  • Method Details

    • readPcap

      public boolean readPcap(InputStream in, boolean byteOrder, int maxLength) throws IOException
    • decodePcap

      public int decodePcap(byte[] buffer, int offset, boolean byteOrder, int maxLength)
    • getPacketType

      public String getPacketType()
    • isIpV4Packet

      public boolean isIpV4Packet()
    • isIpV6Packet

      public boolean isIpV6Packet()
    • isPPPoV6Packet

      public boolean isPPPoV6Packet()
    • isTcpPacket

      public boolean isTcpPacket()
    • isUdpPacket

      public boolean isUdpPacket()
    • isArpPacket

      public boolean isArpPacket()
    • isIcmpPacket

      public boolean isIcmpPacket()
    • getSessionHash

      public long getSessionHash()
    • getTimestamp

      public long getTimestamp()
    • getTimestampMicro

      public long getTimestampMicro()
    • getPacketLength

      public int getPacketLength()
    • getSrc_ip

      public InetAddress getSrc_ip()
    • getDst_ip

      public InetAddress getDst_ip()
    • getSourceIpAddressString

      public String getSourceIpAddressString()
    • getDestinationIpAddressString

      public String getDestinationIpAddressString()
    • getEthernetSource

      public String getEthernetSource()
    • getEthernetDestination

      public String getEthernetDestination()
    • getSequenceNumber

      public int getSequenceNumber()
    • getAckNumber

      public int getAckNumber()
    • getFlags

      public int getFlags()
    • getParsedFlags

      public String getParsedFlags()
    • setIsCorrupt

      public void setIsCorrupt(boolean value)
    • getUrgFlag

      public boolean getUrgFlag()
    • getPshFlag

      public boolean getPshFlag()
    • getEceFlag

      public boolean getEceFlag()
    • getSynFlag

      public boolean getSynFlag()
    • getAckFlag

      public boolean getAckFlag()
    • getRstFlag

      public boolean getRstFlag()
    • getFinFlag

      public boolean getFinFlag()
    • getNSFlag

      public boolean getNSFlag()
    • getCwrFlag

      public boolean getCwrFlag()
    • formatFlags

      public static String formatFlags(int flags)
    • getSrc_port

      public int getSrc_port()
    • getDst_port

      public int getDst_port()
    • isCorrupt

      public boolean isCorrupt()
    • getData

      public byte[] getData()
    • ipVersion

      protected int ipVersion()
    • processIpV4Packet

      protected int processIpV4Packet()
    • processIpV6Packet

      protected int processIpV6Packet()
    • compareTo

      public int compareTo(Packet o)
      This function is here so that packets can be sorted for re-sessionization. Packets in TCP streams are ordered by the sequence number, so being able to order the packets is necessary to reassemble the TCP session.
      Specified by:
      compareTo in interface Comparable<Packet>
      o - The packet to which the current packet is compared to.
      Returns the difference in sequence number.