diff options
author | Guy Harris <guy@alum.mit.edu> | 2017-09-06 22:01:38 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2017-09-06 22:01:38 -0700 |
commit | f290068cc95f6e635791ee7f871e7118b6458502 (patch) | |
tree | 9f3fd77cf51551ccbc12bf6598218978c2fe33e4 /pcap-linux.c | |
parent | bad8c25c99cf5511125c7a7e688113c0811841c4 (diff) |
Push pcap_lib_version() into the pcap-XXX.c files.
This lets us move the Windows version to pcap-win32.c, so we don't have
to include packet32.h in pcap.c.
It also gets rid of some #ifdefs, and lets us construct the version
string on UN*X platforms, and MS-DOS, at compile time.
Diffstat (limited to 'pcap-linux.c')
-rw-r--r-- | pcap-linux.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/pcap-linux.c b/pcap-linux.c index 9934c5e1..fd839416 100644 --- a/pcap-linux.c +++ b/pcap-linux.c @@ -6946,30 +6946,32 @@ reset_kernel_filter(pcap_t *handle) } #endif +int +pcap_set_protocol(pcap_t *p, int protocol) +{ + if (pcap_check_activated(p)) + return (PCAP_ERROR_ACTIVATED); + p->opt.protocol = protocol; + return (0); +} + +#include "pcap_version.h" + /* - * Platform-specific information. + * Libpcap version string. */ const char * -pcap_platform_lib_version(void) +pcap_lib_version(void) { #ifdef HAVE_PACKET_RING #if defined(HAVE_TPACKET3) - return ("with TPACKET_V3"); + return (PCAP_VERSION_STRING " (with TPACKET_V3)"); #elif defined(HAVE_TPACKET2) - return ("with TPACKET_V2"); + return (PCAP_VERSION_STRING " (with TPACKET_V2)"); #else - return ("with TPACKET_V1"); + return (PCAP_VERSION_STRING " (with TPACKET_V1)"); #endif #else - return ("without TPACKET"); + return (PCAP_VERSION_STRING " (without TPACKET)"); #endif } - -int -pcap_set_protocol(pcap_t *p, int protocol) -{ - if (pcap_check_activated(p)) - return (PCAP_ERROR_ACTIVATED); - p->opt.protocol = protocol; - return (0); -} |