使用winpcap写入DLT_USER0捕获时出现问题
Having trouble using winpcap to write DLT_USER0 captures
我正在使用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++应用程序。
遗憾的是,这是WinPcap 4.1.2中的一个错误。
希望WinPcap的未来版本将基于libpcap的更高版本,在该版本中修复了该错误。
相关文章:
- 警告处理为错误这里有什么问题
- 最小硬币更换问题(自上而下方法)
- 为"adjacent"变量赋值时出现问题
- 我的神经网络不起作用 [XOR 问题]
- 在Ubuntu 16.04上安装Cilk时出现问题
- C++我的数学有什么问题,为什么我的代码不能正确循环
- 编译包含字符串的代码时遇到问题
- Project Euler问题4的错误解决方案
- 问题:什么是QAbstractItemView::NoEditTriggers的反面
- 在编译C++代码(具有dlib和opencv)到WASM时面临问题
- 在进程中对同一管道进行读取和写入时C++管道出现问题
- 静态数据成员的问题-修复链接错误会导致编译器错误
- C++ 雷神库 - 使用资源加载器类时出现问题(不命名类型)
- 一个关于在C++中重载布尔运算符的问题
- 首要问题的答案让值班员搞错了
- setlocale的C++土耳其字符串问题
- 如何重构类层次结构以避免菱形问题
- 基于boost的程序的静态链接——zlib问题
- C++格式化输出问题
- 使用mongocxx驱动程序时包含头文件问题