I need to write a program in C to read in pcap files and extract the packets and send them out . It's like a traffic replay. I know there's tcpreplay but I didn't see its C library, it seems to be only a command-line application.
I know how to do it with pcap_open(), but it's only available in WinPcap, I need to do it in linux with libpcap. Anybody can provide some hint? Thanks in advance.
edit: I can parse the packets, but now I just don't know how to open an interface to send the packets out. Thanks.
Use either
pcap_open_live()
or, in newer versions of libpcap,pcap_create()
andpcap_activate()
- all of which are available in the current version of WinPcap, by the way.