tcpdump mailing list archives
Re: Problems with libpcap and C++
From: Guy Harris <guy () alum mit edu>
Date: Wed, 14 Jun 2006 09:37:46 -0700
David Rosal wrote:
I've tried to use a class function member as a callback for pcap_loop(), but the compiler complains that arguments don't match. The code is something like this (I have simplified it):
...
Should I avoid C++ and use C instead (don't say that please...)
Should you avoid C++ completely? No.Should you avoid writing the callback routine passed to pcap_loop() in C++? No, but you should avoid, as far as I know, making it a class method, because it's not going to be passed a "self" pointer.
I'd suggest writing your own capture loop and using pcap_next_ex() instead, if you want to have the packet processing done by a class member.
- This is the tcpdump-workers list. Visit https://lists.sandelman.ca/ to unsubscribe.
Current thread:
- Problems with libpcap and C++ David Rosal (Jun 14)
- Re: Problems with libpcap and C++ Guy Harris (Jun 14)
- Re: Problems with libpcap and C++ Ury Segal (Jun 14)
- Re: Problems with libpcap and C++ David Rosal (Jun 14)
- Re: Problems with libpcap and C++ Mike Kershaw (Jun 14)