I am writing code that scan the packets of pcap file.
I use the command
pcap_next_ex()
to get the next packet.
is there a way to get the first packet- somewhere in the middle of the code, without close and reopen the pcap file?
Thanks.
I am writing code that scan the packets of pcap file.
I use the command
pcap_next_ex()
to get the next packet.
is there a way to get the first packet- somewhere in the middle of the code, without close and reopen the pcap file?
Thanks.
You can use
long pos = ftell(pcap_file(p));
before the first pcap_next_ex()
, and
fseek(pcap_file(p), pos, SEEK_SET);
when you want to get the first packet again.