#include #include "wifi-triangulator/core.h" using namespace std; using namespace wifi_triangulator; int main(int argc, char *argv[]) { if (argc != 2) { fprintf(stderr, "usage: %s [interface]\n", argv[0]); return EXIT_FAILURE; } string dev = argv[1]; GOOGLE_PROTOBUF_VERIFY_VERSION; string str; str.reserve(1 << 16); int ret = launch_capture(dev, [&](const data &data) { pb::envelope envelope; envelope.set_time_s(data.sec); envelope.set_time_us(data.usec); envelope.set_type(data.type); if (data.type == pb::packet_type::probe_request) { pb::probe *probe = envelope.mutable_probe(); probe->set_src(data.src); probe->set_dst(static_cast(data.dst)); probe->set_rssi(data.rssi); } envelope.SerializeToString(&str); cout << static_cast(str.length()) << str << flush; // static int count = 0; // cerr << "count=" << count << "!\r" << flush; // count++; }); google::protobuf::ShutdownProtobufLibrary(); cerr << "Capture exiting" << endl; cout.flush(); return ret; }