I have question about seek in files.
I have pcap file and I need to seek for a specific packet. so far, this is my code for finding that packet:
while (!find_the_packet)
{
pcap_next_ex(p_pcap, &header, &data); //read the next packet
check_if_the_packet_found();
}
and it is working great.
my goal is finding that packet faster- not checking packet by packet until I find it.
so I built data base- Hash Map with (key,value). lets say that the
key -> No. of the packet
value -> the packet itself (or the location of the packet)
I also noticed the pcapnav library function:
pcapnav_goto_offset(pcapnav_t *pn, off_t offset, pcapnav_cmp_t boundary)
and I saw that this function uses FSEEK. so my data base is not very helpful because the FSEEK works serially (correct me if I wrong).
so my question-
is the FSEEK really works serially? read chunk by chunk? how does it works? I am bit confused..
if so, is there faster way to get specific packet\chunk of data from pcap file?
thanks in advanced.