我正在使用MINGW制作一个C++程序,它使用Winpcap库将BTLE包保存到一个PCAP文件中。
我正在尝试打开一个使用DLT_USER0链路层类型的PCAP文件。
我可以使用对pcap_open_dead()的调用打开DLT_USER0,但是pcap_dump_open()报告说它不知道相应的链接类型。
在调用pcap_geterr()后,我收到以下消息:
out-dump.pcap: link-layer type -1 isn't supported in savefiles下面是我的代码。
#define OUT_FILENAME "out-dump.pcap"
pcap_t *pcap_dumpfile; // Descriptor of an open capture instance
pcap_dumper_t *dumper; // libpcap savefile descriptor"
// pcap_open_dead() creates a pcap_t structure to use when
// calling other functions in libpacp
pcap_dumpfile = pcap_open_dead(DLT_USER0, 128);
// Check if pcap_dumpfile was created. If it was not it will return a NULL
if (NULL == pcap_dumpfile)
{
cout << "\npcap_open_dead() FAILED!!!" << endl;
}
else
{
// Open a save file to write to!
dumper = pcap_dump_open(pcap_dumpfile, OUT_FILENAME);
pcap_dump_flush(dumper);
// Check if the dumper was created
if (NULL == dumper)
{
// Printout the FAIL status
cout << "\npcap_dump_open() FAILED!!!" << endl;
// Printout the PCAP Error
cout << "\n" << pcap_geterr(pcap_dumpfile) << endl;
// Close the pcap_dumpfile and deallocate it's resources
pcap_close(pcap_dumpfile);
}
} 我正在使用WinPcap 4.1.2开发人员包构建我的C++应用程序。
发布于 2014-11-03 15:08:12
遗憾的是,这是WinPcap 4.1.2中的一个错误。
希望未来的WinPcap版本将基于libpcap的更高版本,在该版本中修复了该错误。
https://stackoverflow.com/questions/26152995
复制相似问题