summaryrefslogtreecommitdiff
path: root/pcap/pcap.h
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2019-01-07 22:53:30 -0800
committerGuy Harris <guy@alum.mit.edu>2019-01-07 22:53:30 -0800
commit83c8c0b38dfdfd992bdfc2e6a370c5472d55c3d4 (patch)
treefe8c07c058dee92a5a7c7f30a1085099214a5953 /pcap/pcap.h
parent9225ae2eca86dc75ee9d4c8a626e0c9c1d5a7831 (diff)
downloadlibpcap-83c8c0b38dfdfd992bdfc2e6a370c5472d55c3d4.tar.gz
Don't include pcap/pcap.h just to get SOCKET defined.
Put it in portability.h as well, with redefinition protections.
Diffstat (limited to 'pcap/pcap.h')
-rw-r--r--pcap/pcap.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/pcap/pcap.h b/pcap/pcap.h
index 8a69a2f3..848ebbe6 100644
--- a/pcap/pcap.h
+++ b/pcap/pcap.h
@@ -929,6 +929,9 @@ PCAP_API struct pcap_samp *pcap_setsampling(pcap_t *p);
/*
* Some minor differences between UN*X sockets and and Winsock sockets.
+ * These are also defined by pcap/pcap.h, due to some APIs from WinPcap
+ * for active-mode remote captures returning sockets, so we check to
+ * make sure they aren't already defined.
*/
#ifndef _WIN32
/*!
@@ -937,7 +940,9 @@ PCAP_API struct pcap_samp *pcap_setsampling(pcap_t *p);
* We define SOCKET to be a signed integer on UN*X, so that it can
* be used on both platforms.
*/
- #define SOCKET int
+ #ifndef SOCKET
+ #define SOCKET int
+ #endif
/*!
* \brief In Winsock, the error return if socket() fails is INVALID_SOCKET;
@@ -945,7 +950,9 @@ PCAP_API struct pcap_samp *pcap_setsampling(pcap_t *p);
* We define INVALID_SOCKET to be -1 on UN*X, so that it can be used on
* both platforms.
*/
- #define INVALID_SOCKET -1
+ #ifndef INVALID_SOCKET
+ #define INVALID_SOCKET -1
+ #endif
#endif
PCAP_API SOCKET pcap_remoteact_accept(const char *address, const char *port,