tcpdump mailing list archives

Re: Checking for specific return errors in libpcap


From: Fernando Gont <fernando () gont com ar>
Date: Thu, 29 Dec 2011 22:13:31 -0300

On 12/29/2011 09:27 PM, Guy Harris wrote:
While there exist functions such as pcap_geterr() to print an 
error-specific message, I'm rather interested in obtaining an error
code such that my program can act differently depending on the
specific return error.

If that's possible?

Setting errno to 0 before calling them, and, if they return -1,
checking the value of errno *might* work.  No guarantees, and bear in
mind that errno values for various conditions are
platform-dependent.

Ultimately, there should perhaps be different APIs, specified to
return PCAP_ERROR_ values on error, so that

How about a function along the lines of pcap_geterrcode() that obtains
the error code for the last error?

That aside, where do pcap_geterr() and pcap_perror() look at to convert
the error to a string that describes the error?

Thanks!

Best regards,
-- 
Fernando Gont
e-mail: fernando () gont com ar || fgont () si6networks com
PGP Fingerprint: 7809 84F5 322E 45C7 F1C9 3945 96EE A9EF D076 FFF1



-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.


Current thread: