I want to sniff one ethernet UDP packet coming from my raspberry using the c++ tins library, I can receive the packet and save it to vector but I can't access the payload to print it, which I acculay need to check. I'm so thankful for any help.
int main() {
std::vector<Packet> vt;
Sniffer sniffer("enp0s25");
vt.push_back(sniffer.next_packet());
}
looking in the
libtinstutorial (http://libtins.github.io/tutorial/sniffing/) about sniffing, I found this function implementation:Note that the
doofunction in this example only prints the destination address - but you can adjust to your needs.Please also note the use of
sniff_loopwithdooas a callback function.