3 ms·
PcapPlusPlus: a multiplatform C++ network sniffing and packet crafting library
- nunez 9y agoWow. This was literally my senior design project 8 years ago. I started writing a wrapper library in C++ with a few colleagues. It's harder than people without experience in this sort of thing realize!
- lfowles 9y agoThere have been some good CPPCon talks on the subject of wrapping C libraries. CppCon 2014: Lisa Lippincott "How to call C libraries from C++" https://www.youtube.com/watch?v=3ZO0V4Prefc https://www.youtube.com/watch?v=3ZO0V4Prefc - This is the first one that comes to mind
- hackits 9y agoGive credit to Lisa for the presentation. Although she starts with the premise that don't build a OOP over a C API instead use rules instead! Although by the end of the presentation I have to question her recommendations and solution to the problem. Namely her final result is harder to read and understand than the original C code she showed at the start of the presentation. I would have to question the whole C++ language where still to this day they're still talking about communicating with C API from the C++ layers. The STL/BOOST library are a step in the right direction but also a step back with the language that in a nightmare to work with unless you stick a very small sub-set of the language.
- jacobparker 9y agoI've used libtins (a C++ wrapper on libpcap) for its high-level interface before and enjoyed it. Some benchmarks in the README indicate this library has marginal-to-significantly better performance: https://github.com/seladb/PcapPlusPlus https://github.com/seladb/PcapPlusPlus Comparing to http://libtins.github.io/benchmark/ http://libtins.github.io/benchmark/ at a glance it looks reasonable - libcrafter is a lot slower than both, and libpcap is often much faster. (scapy (Python) is really, really slow.) Personally, if I was using libtins and really needed more perf I'd strongly consider just using libpcap directly. But the high-level APIs are really handy. I don't have anything substantive to say about PcapPlusPlus but I'll check it out :)