I am working on a tool though which I am able to capture incoming packets (l2 buffer and L2 length, payload) in an interface and I am able to print that packet on console.
Now I want to write these packets to a pcap file so that I can transfer this file to other platform and read packet info.
How I can open a pcap file and write packet buffer to pcap file?
How can I fill struct pcap_file_header?