mirror of
https://github.com/ntop/n2n.git
synced 2024-09-19 00:21:11 +02:00
Add tweaks to support windows XP
This commit is contained in:
parent
439939dc7b
commit
3bf584c580
|
@ -17,6 +17,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
|
#include <iphlpapi.h>
|
||||||
|
|
||||||
#include "edge_utils_win32.h"
|
#include "edge_utils_win32.h"
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
(C) 2007-22 - Luca Deri <deri@ntop.org>
|
(C) 2007-22 - Luca Deri <deri@ntop.org>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <winsock2.h>
|
||||||
|
#include <iphlpapi.h>
|
||||||
|
|
||||||
#include "n2n.h"
|
#include "n2n.h"
|
||||||
#include "n2n_win32.h"
|
#include "n2n_win32.h"
|
||||||
|
|
||||||
|
@ -333,6 +336,15 @@ int open_wintap(struct tuntap_dev *device,
|
||||||
|
|
||||||
/* ****************** */
|
/* ****************** */
|
||||||
|
|
||||||
|
#ifdef _WIN64
|
||||||
|
/* Setting the metric is not actually 64-bit specific.
|
||||||
|
* The assumption here is that anyone needing a metric set will also
|
||||||
|
* need a new enough OS that they will be on 64-bit.
|
||||||
|
*
|
||||||
|
* The alternative is that people trying to run old games are probably on
|
||||||
|
* Windows XP and are probably 32-bit.
|
||||||
|
*/
|
||||||
|
|
||||||
/* metric */
|
/* metric */
|
||||||
|
|
||||||
PMIB_IPINTERFACE_ROW Row;
|
PMIB_IPINTERFACE_ROW Row;
|
||||||
|
@ -357,6 +369,7 @@ int open_wintap(struct tuntap_dev *device,
|
||||||
|
|
||||||
free(Row);
|
free(Row);
|
||||||
}
|
}
|
||||||
|
#endif /* _WIN64 */
|
||||||
|
|
||||||
/* ****************** */
|
/* ****************** */
|
||||||
|
|
||||||
|
@ -452,6 +465,8 @@ int tuntap_open(struct tuntap_dev *device,
|
||||||
|
|
||||||
void tuntap_close(struct tuntap_dev *tuntap) {
|
void tuntap_close(struct tuntap_dev *tuntap) {
|
||||||
|
|
||||||
|
#ifdef _WIN64
|
||||||
|
/* See comment in open_wintap for notes about this ifdef */
|
||||||
PMIB_IPINTERFACE_ROW Row;
|
PMIB_IPINTERFACE_ROW Row;
|
||||||
|
|
||||||
if(tuntap->metric) { /* only required if a value has been given (and thus stored) */
|
if(tuntap->metric) { /* only required if a value has been given (and thus stored) */
|
||||||
|
@ -471,6 +486,7 @@ void tuntap_close(struct tuntap_dev *tuntap) {
|
||||||
|
|
||||||
free(Row);
|
free(Row);
|
||||||
}
|
}
|
||||||
|
#endif /* _WIN64 */
|
||||||
|
|
||||||
CloseHandle(tuntap->device_handle);
|
CloseHandle(tuntap->device_handle);
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,14 @@
|
||||||
#include <sys/socket.h> // for send, socket, AF_INET, recv, connect
|
#include <sys/socket.h> // for send, socket, AF_INET, recv, connect
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined (__linux__) || defined(_WIN32) /* currently, Linux and Windows only */
|
#if defined (__linux__) || defined(_WIN64) /* currently, Linux and Windows only */
|
||||||
|
/* Technically, this could be supported on some 32-bit windows.
|
||||||
|
* The assumption here is that a version of Windows new enough to
|
||||||
|
* support the features needed is probably running with 64-bit.
|
||||||
|
*
|
||||||
|
* The alternative is that people trying to run old games are probably on
|
||||||
|
* Windows XP and are probably 32-bit.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#define WITH_ADDRESS 1
|
#define WITH_ADDRESS 1
|
||||||
|
@ -1088,16 +1095,16 @@ end_route_tool:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#else /* if defined(__linux__) || defined(_WIN32) -- currently, Linux and Windows only */
|
#else /* if defined(__linux__) || defined(_WIN64) -- currently, Linux and Windows only */
|
||||||
|
|
||||||
|
|
||||||
int main (int argc, char* argv[]) {
|
int main (int argc, char* argv[]) {
|
||||||
|
|
||||||
traceEvent(TRACE_WARNING, "currently, only Linux and Windows are supported");
|
traceEvent(TRACE_WARNING, "currently, only Linux and 64-bit Windows are supported");
|
||||||
traceEvent(TRACE_WARNING, "if you want to port to other OS, please find the source code having clearly marked the platform-dependant portions");
|
traceEvent(TRACE_WARNING, "if you want to port to other OS, please find the source code having clearly marked the platform-dependant portions");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* if defined (__linux__) || defined(_WIN32) -- currently, Linux and Windows only */
|
#endif /* if defined (__linux__) || defined(_WIN64) -- currently, Linux and Windows only */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user