Examples/PcapPrinter/main.cpp
/**
* print all requested packets in a pcap file
*/
print all requested packets in a pcap file
print all requested packets in a pcap file
int printPcapPackets(pcpp::PcapFileReaderDevice* reader, std::ostream* out, int packetCount)
{
	int packetCountSoFar = 0;
	pcpp::RawPacket rawPacket;
	while (reader->getNextPacket(rawPacket) && packetCountSoFar != packetCount)
	{
		pcpp::Packet parsedPacket(&rawPacket);
		(*out) << parsedPacket.toString() << std::endl;
		packetCountSoFar++;
	}
	return packetCountSoFar;
}
int printPcapPackets ( pcpp :: PcapFileReaderDevice * reader , std :: ostream * out , int packetCount ) { int packetCountSoFar = 0 ; pcpp :: RawPacket rawPacket ; while ( reader -> getNextPacket ( rawPacket ) && packetCountSoFar != packetCount ) { pcpp :: Packet parsedPacket ( & rawPacket ) ; ( * out ) << parsedPacket . toString ( ) << std :: endl ; packetCountSoFar ++ ; } return packetCountSoFar ; }
print all requested packets in a pcap file
print all requested packets in a pcap file
// read packets from the file until end-of-file or until reached user requested packet count
 // parse the raw packet into a parsed packet
 // print packet to string
 // return the nubmer of packets that were printed
