Not.
libwireshark is not intended to be used outside of Wireshark itself, and trying to do this will let you do it yourself , trying to figure out what is going wrong. libwireshark is actually part of the Wireshark package analysis part (called epan for E ) pa cket a alyzer) that you can see in the Developer's Guide is not all Wireshark. In fact, which libwireshark provides is the main interface for all of the built-in protocols, hooks for the pluginβs disconsorters, and the full package teardown API. It relies on the mechanism created by the rest of Wireshark for things that are not batch parallelization tools but allow dissectors to do their job (e.g., allocate freeing pieces of memory, process compressed or encrypted data, etc.).
Write a dissector instead.
If your project needs to strictly analyze network traffic in some way, perhaps you should consider writing a dissector for Wireshark rather than reinventing the many wheels that Wireshark could provide you with. If you need to do something more complex, for example, monitor network traffic and then run other tasks or send data yourself, you are probably better off using tshark and shell scripts, as you already have (remember that you should not allow tshark work for very long periods of time anyway).
If you really want to use libwireshark directly, you need to somehow resolve all its dependencies (preferably by making it a real stand-alone library) and consider the assumptions that it makes about Wireshark (or tshark) actually running. The code for libwireshark is well organized, it just consists of the entire epan directory under the Wireshark source tree and is laid out in accordance with the conventions that were established when Wireshark was still Ethereal. The documentation for each function is provided in the header files when it is publicly available, and more deeply in the source files in each case. Also keep in mind that README.developer , distributed with the source code version, you have a good place to get some tips (and you can also read all the README. * Files if you want to complete this task).
multipleinterfaces
source share