On Sep 23, 2007, at 9:08 PM, Varuna De Silva wrote:
On 9/23/07, Guy Harris <[EMAIL PROTECTED]> wrote:
If you're modifying libpcap to support a new type of capture, you
don't
write the callback function,
I am doing this for my device to be supported by wireshark. As I
understand
I dont need to write the callback function???
You don't need to write the callback function. Wireshark already has
a callback function, capture_pcap_cb(), in it.
you write code in the read_op routine to call the callback function;
Yes, I did so as following, ( I am guilty, of copying it directly from
pcap-septel.c)
int muwis_read(pcap_t *p, int cnt, pcap_handler callback, u_char
*user)
{
callback(user, &pcap_header, dp);
:
:
}
As I understand this need to be called for each packet captured.
Yes.
a pointer to the callback function is passed to the read_op routine.
This is the "user" in the above code.
No. That's the "callback" in the above code.
"user" is a "u_char *" that's passed to your routine, and that you
pass directly through to the callback; you don't need to do anything
with it - and, as you don't know what it is (it's something that the
callback routine uses), you *shouldn't* do anything with it other than
pass it to the callback routine.
Now my question is what will
be this "user" function in my case. That is when I call xxxx_read()
pointer to what function will I have to pass to it as " *user "
You don't call xxxx_read() - libpcap does that, in pcap_dispatch(),
pcap_loop(), pcap_next(), and pcap_next_ex().
Your read routine will just take the "user" argument passed to it, and
pass it to the callback function.
-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.