Examples/HttpAnalyzer/main.cpp
/**
 * packet capture callback - called whenever a packet arrives
 */
packet capture callback - called whenever a packet arrives
packet capture callback - called whenever a packet arrives
void httpPacketArrive(pcpp::RawPacket* packet, pcpp::PcapLiveDevice* dev, void* cookie)
{
	pcpp::Packet parsedPacket(packet);
	HttpPacketArrivedData* data  = (HttpPacketArrivedData*)cookie;
	data->statsCollector->collectStats(&parsedPacket);
	if (data->pcapWriter != NULL)
	{
		data->pcapWriter->writePacket(*packet);
	}
}
void httpPacketArrive ( pcpp :: RawPacket * packet , pcpp :: PcapLiveDevice * dev , void * cookie ) { pcpp :: Packet parsedPacket ( packet ) ; HttpPacketArrivedData * data = ( HttpPacketArrivedData * ) cookie ; data -> statsCollector -> collectStats ( & parsedPacket ) ; if ( data -> pcapWriter != NULL ) { data -> pcapWriter -> writePacket ( * packet ) ; } }
packet capture callback - called whenever a packet arrives
packet capture callback - called whenever a packet arrives
// parse the packet
 // give the packet to the collector
 // if needed - write the packet to the output pcap file
