I am new with the pcap library and I am building a program that loads pcap file and process it for my needs with winpcap
.
this is part of my pseudo code:
pcap_file= pcap_open_offline(pcap_path, errbuff);
while ( !EOF )
{
//read the next packet from pcap file
pcap_next_ex(pcap_file, &header, &data);
if ( the packet belongs to ETH->IP->UDP->RTP->H264 protocol)
process_packet(header, data);
}
I found the function pcap_compile()
but from my understanding this is for live capture.
Since I load pcap file offline I struggled to find similar filter function.
How can I filter packet that loaded from pcap file? The filter should pass only packets from the ETH->IP->UDP->RTP->H264 protocol.