tcpdump mailing list archives
Re: Problems with libpcap and C++
From: David Rosal <david.rosal () upf edu>
Date: Wed, 14 Jun 2006 19:08:50 +0200
Ury Segal wrote:
The buttom of the problem is this: You excpect libpcap to call X::dumper in the context of an instance of class X. (The "real" first parameter of "X::dumper" is a variable named "this" of the type "X*".)But the libpcap API is not defining a`void (X::)(u_char*, const pcap_pkthdr*, const u_char*)'Therefore, you cannot pass a non-static memberfunction to libpcap. You can make dumper() a static member.
Yes. If I make dumper() a static member of class X, then the compiler accepts it.
It works even if I use it whithin a concrete instance of X. I mean the following two ways are accepted:
X x; pcap_loop(..., x.dumper, ...); pcap_loop(..., X::dumper, ...); Thanks. __david - 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)