style="display:inline-block;width:728px;height:90px"
data-ad-client="ca-pub-7505528228218001"
data-ad-slot="1225241371">

3.1 - JPacket and PcapPacket classes

The main packet classes, PcapPacket and JPacket, are the center point of the packet framework. Everything else revolves around these two classes. A packet is made up of 3 parts:

  • Packet data buffer - received from libpcap or read from a file
  • Packet state structure - generated by jNetPcap
  • Packet capture header - also received from libpcap

All 3 parts are manipulated and maintained separately of each other. That is the capture header and packet data buffer are both supplied by libpcap, and the packet state structure maintained by JScanner class. These structures and the packet buffer are stored in native memory outside of java address space or byte arrays. Packet state and its data buffer are the two most important parts, as they are used in decoding and then subsequent access to individual headers.