Open charleywright opened 6 months ago
Changing wrapper.h
to:
#include "wiretap/wtap.h"
#include "epan/packet.h"
#include "epan/decode_as.h"
Did the trick. Thanks!!
@charleywright Do you have any more information about the system you were using at the time? I was working on this, and I realised that there were some issues regarding system dependencies for wireshark.
Noticed some cmake compilation errors when trying to build from source which I realise ended up being due to the tag of wireshark being used not up to date with certain fixes as described https://github.com/amitrahman1026/wsdf/pull/1.
I was trying to reproduce your layout issue but I am developing on an m1 mac. I did not encounter further build problems when trying to reproduce your error when running:
cargo build --features bindgen
Before this, I had however, set up relevant wireshark dependancies from here.
I ran into this error while adding epan-sys to one of my projects and wanted to dig in and fix it. To reproduce simply try to compile the
epan-sys
crate with thebindgen
feature enabled:Leading to:
This is not the most helpful error message but can be improved by adding a warning before the panic:
This leads to the
wtap_pseudo_header
union which is used in epan/packet_info.h (included by epan/packet.h) and defined in wiretap/wtap.h which isn't included. Since bindgen doesn't know about the definition there is no layout, leading to the panic.There are two ways to fix this:
wiretap/wtap.h
inwrapper.h
- See bindgen-fix1wtap_pseudo_header
as an opaque type - See bindgen-fix2The CONTRIBUTING document states that "If we need more types, functions, etc. from Wireshark, we can just add the respective .h files [to wrapper.h]" which would line up with fix 1. The only potential issue with this fix is the additional bloat in bindings.rs which is why I gave both options.
Thanks for writing and maintaining this crate, I look forward to implementing my dissector in Rust :)