Hi I'm doing a sniffer with c++ and libpcap and I would want to stop the capture when I press ctrl+c, this is my code:
void Capture::terminate_process(int s){
pcap_breakloop(descr);
pcap_close(descr);
}
void Capture::capturar(){
signal(SIGINT, terminate_process);
pcap_loop (descr, -1, mycallback, NULL);
}
At the .h I have declared:
pcap_t *descr;
I've seen similar solutions for my problem like this: How to use pcap_breakloop? But I can't compile, I get this error:
capture.cpp: 138:35: error: argument of type 'void (Capture ::) (int)' does not match '{aka __sighandler_t void (*) (int)}'