Swarm is the C++ based lightweight and high-speed network traffic decoding library.
- Zero-copy based high-speed decoding of packet
- Extracting parameters of network protocol (example)
- Extendable protocol decoding module (example)
- libpcap
- pthread
% cd swarm
% cmake . && make
% sudo make install
#include <swarm.h>
#include <iostream>
class DnsHandler : public swarm::Handler {
public:
void recv (swarm::ev_id ev, const swarm::Property &p) {
// print domain name of dns query
std::cout << p.value("dns.qd_name").repr () << std::endl;
}
};
int main () {
swarm::NetDec *nd = new swarm::NetDec ();
nd->set_handler ("dns.packet", new DnsHandler());
swarm::NetCap *nc = new swarm::CapPcapDev("eth0");
nc->bind_netdec (nd);
nc->start ();
}
More examples are available in example directory.