org.jnetpcap.packet
Interface JPacketHandler<T>

All Known Implementing Classes:
JController, JPacketSupport

public interface JPacketHandler<T>

A dispatchable packet hadler. The handler receives fully decoded packets from libpcap library.

Author:
Mark Bednarczyk, Sly Technologies, Inc.

Method Summary
 void nextPacket(JPacket packet, T user)
          Callback function called on by libpcap and jNetPcap scanner once a new packet arrives and has passed the set BPF filter.
 

Method Detail

nextPacket

void nextPacket(JPacket packet,
                T user)
Callback function called on by libpcap and jNetPcap scanner once a new packet arrives and has passed the set BPF filter. The packet object dispatched is not allocated on a per call basis, but is shared between every call made. At the time the pcap dispatch or loop is established a freshly allocated packet is used to peer with received packet buffers from libpcap, scanned then dispatched to this method for the user to process. The packet memory and state is not persistent between calls. If a more persistent state is need it must be copied outof the supplied packet into a more permanent packet.
 public void nextPacket(JPacket packet, T user) {
        JPacket permanentPacket = new JPacket(packet);// creates a permanent packet
 }
 

Parameters:
packet - a non persistent between invokations decoded packet
user - user supplied object of type