mirror of
https://github.com/ntop/n2n.git
synced 2024-09-20 00:51:10 +02:00
Submit minor changes to enable Windows CMake builds w/o further mods.
This commit is contained in:
parent
5feb00bcf8
commit
ba0ecabbf6
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -9,3 +9,4 @@ benchmark
|
||||||
edge
|
edge
|
||||||
example_edge_embed
|
example_edge_embed
|
||||||
supernode
|
supernode
|
||||||
|
build
|
|
@ -2,7 +2,7 @@ project(n2n)
|
||||||
cmake_minimum_required(VERSION 2.6)
|
cmake_minimum_required(VERSION 2.6)
|
||||||
|
|
||||||
# N2n information
|
# N2n information
|
||||||
set(N2N_VERSION 2.3.0)
|
set(N2N_VERSION 2.5.0)
|
||||||
set(N2N_OSNAME ${CMAKE_SYSTEM})
|
set(N2N_OSNAME ${CMAKE_SYSTEM})
|
||||||
|
|
||||||
# N2n specific params
|
# N2n specific params
|
||||||
|
@ -70,7 +70,8 @@ target_link_libraries(n2n n2n_win32)
|
||||||
endif(DEFINED WIN32)
|
endif(DEFINED WIN32)
|
||||||
|
|
||||||
if(N2N_OPTION_AES)
|
if(N2N_OPTION_AES)
|
||||||
target_link_libraries(n2n crypto)
|
target_link_libraries(n2n ${OPENSSL_LIBRARIES})
|
||||||
|
include_directories(${OPENSSL_INCLUDE_DIR})
|
||||||
endif(N2N_OPTION_AES)
|
endif(N2N_OPTION_AES)
|
||||||
|
|
||||||
add_executable(edge edge.c)
|
add_executable(edge edge.c)
|
||||||
|
|
2
edge.c
2
edge.c
|
@ -730,7 +730,9 @@ int main(int argc, char* argv[]) {
|
||||||
|
|
||||||
/* allow multiple sockets to use the same PORT number */
|
/* allow multiple sockets to use the same PORT number */
|
||||||
setsockopt(eee.udp_multicast_sock, SOL_SOCKET, SO_REUSEADDR, &enable_reuse, sizeof(enable_reuse));
|
setsockopt(eee.udp_multicast_sock, SOL_SOCKET, SO_REUSEADDR, &enable_reuse, sizeof(enable_reuse));
|
||||||
|
#ifndef WIN32 /* no SO_REUSEPORT in Windows */
|
||||||
setsockopt(eee.udp_multicast_sock, SOL_SOCKET, SO_REUSEPORT, &enable_reuse, sizeof(enable_reuse));
|
setsockopt(eee.udp_multicast_sock, SOL_SOCKET, SO_REUSEPORT, &enable_reuse, sizeof(enable_reuse));
|
||||||
|
#endif
|
||||||
|
|
||||||
mreq.imr_multiaddr.s_addr = inet_addr(N2N_MULTICAST_GROUP);
|
mreq.imr_multiaddr.s_addr = inet_addr(N2N_MULTICAST_GROUP);
|
||||||
mreq.imr_interface.s_addr = htonl(INADDR_ANY);
|
mreq.imr_interface.s_addr = htonl(INADDR_ANY);
|
||||||
|
|
10
edge_utils.c
10
edge_utils.c
|
@ -19,6 +19,10 @@
|
||||||
#include "n2n.h"
|
#include "n2n.h"
|
||||||
#include "lzoconf.h"
|
#include "lzoconf.h"
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
#include <process.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __ANDROID_NDK__
|
#ifdef __ANDROID_NDK__
|
||||||
#include "android/edge_android.h"
|
#include "android/edge_android.h"
|
||||||
#include <tun2tap/tun2tap.h>
|
#include <tun2tap/tun2tap.h>
|
||||||
|
@ -1690,11 +1694,11 @@ const char *random_device_mac(void)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#define random() rand()
|
#define random rand
|
||||||
#endif
|
#endif
|
||||||
mac[i] = key[random() % sizeof(key)];
|
mac[i] = key[random() % sizeof(key)];
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#undef random()
|
#undef random
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
mac[sizeof(mac) - 1] = '\0';
|
mac[sizeof(mac) - 1] = '\0';
|
||||||
|
@ -1743,7 +1747,9 @@ int quick_edge_init(char *device_name, char *community_name,
|
||||||
|
|
||||||
/* allow multiple sockets to use the same PORT number */
|
/* allow multiple sockets to use the same PORT number */
|
||||||
setsockopt(eee.udp_multicast_sock, SOL_SOCKET, SO_REUSEADDR, &enable_reuse, sizeof(enable_reuse));
|
setsockopt(eee.udp_multicast_sock, SOL_SOCKET, SO_REUSEADDR, &enable_reuse, sizeof(enable_reuse));
|
||||||
|
#ifndef WIN32 /* no SO_REUSEPORT in Windows */
|
||||||
setsockopt(eee.udp_multicast_sock, SOL_SOCKET, SO_REUSEPORT, &enable_reuse, sizeof(enable_reuse));
|
setsockopt(eee.udp_multicast_sock, SOL_SOCKET, SO_REUSEPORT, &enable_reuse, sizeof(enable_reuse));
|
||||||
|
#endif
|
||||||
|
|
||||||
mreq.imr_multiaddr.s_addr = inet_addr(N2N_MULTICAST_GROUP);
|
mreq.imr_multiaddr.s_addr = inet_addr(N2N_MULTICAST_GROUP);
|
||||||
mreq.imr_interface.s_addr = htonl(INADDR_ANY);
|
mreq.imr_interface.s_addr = htonl(INADDR_ANY);
|
||||||
|
|
4
n2n.h
4
n2n.h
|
@ -37,11 +37,13 @@
|
||||||
/* Moved here to define _CRT_SECURE_NO_WARNINGS before all the including takes place */
|
/* Moved here to define _CRT_SECURE_NO_WARNINGS before all the including takes place */
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include "win32/n2n_win32.h"
|
#include "win32/n2n_win32.h"
|
||||||
|
#include "win32/winconfig.h"
|
||||||
#undef N2N_HAVE_DAEMON
|
#undef N2N_HAVE_DAEMON
|
||||||
#undef N2N_HAVE_SETUID
|
#undef N2N_HAVE_SETUID
|
||||||
|
#else
|
||||||
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
8
sn.c
8
sn.c
|
@ -20,6 +20,10 @@
|
||||||
|
|
||||||
#include "n2n.h"
|
#include "n2n.h"
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
#include <signal.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define N2N_SN_LPORT_DEFAULT 7654
|
#define N2N_SN_LPORT_DEFAULT 7654
|
||||||
#define N2N_SN_PKTBUF_SIZE 2048
|
#define N2N_SN_PKTBUF_SIZE 2048
|
||||||
|
|
||||||
|
@ -919,7 +923,11 @@ int main(int argc, char * const argv[]) {
|
||||||
|
|
||||||
traceEvent(TRACE_NORMAL, "supernode started");
|
traceEvent(TRACE_NORMAL, "supernode started");
|
||||||
|
|
||||||
|
#ifndef WIN32
|
||||||
signal(SIGHUP, dump_registrations);
|
signal(SIGHUP, dump_registrations);
|
||||||
|
#else
|
||||||
|
signal(SIGINT, dump_registrations);
|
||||||
|
#endif
|
||||||
|
|
||||||
return run_loop(&sss_node);
|
return run_loop(&sss_node);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
|
#ifndef WIN32
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#else
|
||||||
|
#include "win32/winconfig.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
const char * n2n_sw_version = PACKAGE_VERSION;
|
const char * n2n_sw_version = PACKAGE_VERSION;
|
||||||
const char * n2n_sw_osName = PACKAGE_OSNAME;
|
const char * n2n_sw_osName = PACKAGE_OSNAME;
|
||||||
|
|
7
win32/winconfig.h
Normal file
7
win32/winconfig.h
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
/* winconfig.h. Win32 replacement for file generated from config.h.in by configure. */
|
||||||
|
|
||||||
|
/* OS name */
|
||||||
|
#define PACKAGE_OSNAME N2N_OSNAME
|
||||||
|
|
||||||
|
/* Define to the version of this package. */
|
||||||
|
#define PACKAGE_VERSION N2N_VERSION
|
Loading…
Reference in New Issue
Block a user