Hi All. It has been widely recognized that one of the lack of the current libpcap code is a call that allows avoiding callback functions when reading packets. We implemented a pcap_read_ex() in WinPcap to deal with this issue; however, several discussions (offline this mlist) convinced us that a pcap_next_ex() should be more appropriate because a pcap_next() is already in use within libpcap.
This new call can be invoked from within the main thread of the application
and it will return a single packet and a return code, which can be:
- 0: timeout (we're on a live capture, but we've no packet to read)
- -1: error
- -2: end of file (we're on an offline capture)
- >=1: OK
Although we implemented this call in WinPcap by means of platform-specific
code, we acknowledge that this leads to several code duplication (although
it is more efficient).
The current implementation (in the file attached) is platform independent,
although less optimized.
We would like to have some feeling from the mlist.
If the people here think this is an interesting feature, we're ready to
commit this on the cvs.
Otherwise, it will become a WinPcap-specific call.
Thanks for your attention,
fulvio
pcap.c
Description: Binary data
