mirror of
https://github.com/ntop/n2n.git
synced 2024-09-19 16:41:11 +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
|
||||
example_edge_embed
|
||||
supernode
|
||||
build
|
|
@ -2,7 +2,7 @@ project(n2n)
|
|||
cmake_minimum_required(VERSION 2.6)
|
||||
|
||||
# N2n information
|
||||
set(N2N_VERSION 2.3.0)
|
||||
set(N2N_VERSION 2.5.0)
|
||||
set(N2N_OSNAME ${CMAKE_SYSTEM})
|
||||
|
||||
# N2n specific params
|
||||
|
@ -70,7 +70,8 @@ target_link_libraries(n2n n2n_win32)
|
|||
endif(DEFINED WIN32)
|
||||
|
||||
if(N2N_OPTION_AES)
|
||||
target_link_libraries(n2n crypto)
|
||||
target_link_libraries(n2n ${OPENSSL_LIBRARIES})
|
||||
include_directories(${OPENSSL_INCLUDE_DIR})
|
||||
endif(N2N_OPTION_AES)
|
||||
|
||||
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 */
|
||||
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));
|
||||
#endif
|
||||
|
||||
mreq.imr_multiaddr.s_addr = inet_addr(N2N_MULTICAST_GROUP);
|
||||
mreq.imr_interface.s_addr = htonl(INADDR_ANY);
|
||||
|
|
14
edge_utils.c
14
edge_utils.c
|
@ -19,6 +19,10 @@
|
|||
#include "n2n.h"
|
||||
#include "lzoconf.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#include <process.h>
|
||||
#endif
|
||||
|
||||
#ifdef __ANDROID_NDK__
|
||||
#include "android/edge_android.h"
|
||||
#include <tun2tap/tun2tap.h>
|
||||
|
@ -1690,11 +1694,11 @@ const char *random_device_mac(void)
|
|||
continue;
|
||||
}
|
||||
#ifdef WIN32
|
||||
#define random() rand()
|
||||
#define random rand
|
||||
#endif
|
||||
mac[i] = key[random() % sizeof(key)];
|
||||
#ifdef WIN32
|
||||
#undef random()
|
||||
#undef random
|
||||
#endif
|
||||
}
|
||||
mac[sizeof(mac) - 1] = '\0';
|
||||
|
@ -1743,8 +1747,10 @@ int quick_edge_init(char *device_name, char *community_name,
|
|||
|
||||
/* 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_REUSEPORT, &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));
|
||||
#endif
|
||||
|
||||
mreq.imr_multiaddr.s_addr = inet_addr(N2N_MULTICAST_GROUP);
|
||||
mreq.imr_interface.s_addr = htonl(INADDR_ANY);
|
||||
if (setsockopt(eee.udp_multicast_sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof(mreq)) < 0) {
|
||||
|
|
4
n2n.h
4
n2n.h
|
@ -37,11 +37,13 @@
|
|||
/* Moved here to define _CRT_SECURE_NO_WARNINGS before all the including takes place */
|
||||
#ifdef WIN32
|
||||
#include "win32/n2n_win32.h"
|
||||
#include "win32/winconfig.h"
|
||||
#undef N2N_HAVE_DAEMON
|
||||
#undef N2N_HAVE_SETUID
|
||||
#else
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <time.h>
|
||||
#include <ctype.h>
|
||||
|
|
8
sn.c
8
sn.c
|
@ -20,6 +20,10 @@
|
|||
|
||||
#include "n2n.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
#define N2N_SN_LPORT_DEFAULT 7654
|
||||
#define N2N_SN_PKTBUF_SIZE 2048
|
||||
|
||||
|
@ -919,7 +923,11 @@ int main(int argc, char * const argv[]) {
|
|||
|
||||
traceEvent(TRACE_NORMAL, "supernode started");
|
||||
|
||||
#ifndef WIN32
|
||||
signal(SIGHUP, dump_registrations);
|
||||
#else
|
||||
signal(SIGINT, dump_registrations);
|
||||
#endif
|
||||
|
||||
return run_loop(&sss_node);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
#ifndef WIN32
|
||||
#include "config.h"
|
||||
#else
|
||||
#include "win32/winconfig.h"
|
||||
#endif
|
||||
|
||||
const char * n2n_sw_version = PACKAGE_VERSION;
|
||||
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