Put it in portability.h as well, with redefinition protections.
/*
* 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
/*!
* 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;
* 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,
#endif
#endif /* _WIN32 */
+/*
+ * 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
+ /*!
+ * \brief In Winsock, a socket handle is of type SOCKET; in UN*X, it's
+ * a file descriptor, and therefore a signed integer.
+ * We define SOCKET to be a signed integer on UN*X, so that it can
+ * be used on both platforms.
+ */
+ #ifndef SOCKET
+ #define SOCKET int
+ #endif
+
+ /*!
+ * \brief In Winsock, the error return if socket() fails is INVALID_SOCKET;
+ * in UN*X, it's -1.
+ * We define INVALID_SOCKET to be -1 on UN*X, so that it can be used on
+ * both platforms.
+ */
+ #ifndef INVALID_SOCKET
+ #define INVALID_SOCKET -1
+ #endif
+#endif
+
#ifdef __cplusplus
}
#endif
#ifdef HAVE_OPENSSL
#include <stdlib.h>
-#include "portability.h"
#include "sslutils.h"
-#include "pcap/pcap.h"
static const char *ssl_keyfile = ""; //!< file containing the private key in PEM format
static const char *ssl_certfile = ""; //!< file containing the server's certificate in PEM format
#ifdef HAVE_OPENSSL
#include <openssl/ssl.h>
#include <openssl/err.h>
-#include "pcap/pcap.h" // for SOCKET
+#include "portability.h" // for SOCKET
/*
* Utility functions