diff --git a/CMakeLists.txt b/CMakeLists.txt index e1575eb7b42e921fc854b2bb76857854ce9737fb..2594c15a5c4feb7603676ee11c7bc466c923f8ab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,6 +54,7 @@ if(WIN32) add_definitions ("-D_POSIX_") add_definitions ("-D_POSIX_THREAD_SAFE_FUNCTIONS") add_definitions ("-DNODE_NETNAME=\"cellframe\"") + add_compile_definitions(_GNU_SOURCE) include_directories(../libdap/src/win32/) include_directories(../3rdparty/wepoll/include/) include_directories(../3rdparty/uthash/src/) diff --git a/dap_chain_net.h b/dap_chain_net.h index 1a7171f19d41c71bace4a85634f932bd06fd0f91..239a08cd1f7911ae2b6952728add0d612ce15fda 100644 --- a/dap_chain_net.h +++ b/dap_chain_net.h @@ -36,6 +36,7 @@ along with any CellFrame SDK based project. If not, see <http://www.gnu.org/lic #include "win32/ip.h" #include "win32/iphdr.h" +#define s6_addr32 s6_addr #define herror perror #endif diff --git a/dap_chain_node.h b/dap_chain_node.h index 1c7bff5ce37baf32e88b577b280888d8f2719994..95ca8c1bdd2cc5773f3d9d77aec27e68034d1081 100644 --- a/dap_chain_node.h +++ b/dap_chain_node.h @@ -36,8 +36,6 @@ #include "win32/ip.h" #include "win32/iphdr.h" -#define __in6_u _S6_un -#define __u6_addr32 _S6_u8 #endif diff --git a/dap_chain_node_ping.c b/dap_chain_node_ping.c index cd7d84492b218edd144b85c73bfcee133d08bd54..c3c870d55827dfbd67064f8055d6c6d0d1096148 100644 --- a/dap_chain_node_ping.c +++ b/dap_chain_node_ping.c @@ -160,8 +160,11 @@ int wait_node_ping(pthread_t l_thread, int timeout_ms) timeout_ms *= 1000; l_wait_time.tv_sec += timeout_ms / DAP_USEC_PER_SEC; l_wait_time.tv_nsec += 1000 * (timeout_ms % DAP_USEC_PER_SEC); - +#ifndef _WIN32 int res = pthread_timedjoin_np(l_thread, (void **) &l_ping_time, &l_wait_time); +#else + int res = pthread_join(l_thread, (void **) &l_ping_time); +#endif if(res == ETIMEDOUT) { pthread_kill(l_thread, 3); // SIGQUIT SIGABRT } diff --git a/dap_chain_node_ping.h b/dap_chain_node_ping.h index 8289031c8fab5b8ebfef3aa799ec38f48dc8b659..98453ce3eb28b78237c380ed172eea6211110715 100644 --- a/dap_chain_node_ping.h +++ b/dap_chain_node_ping.h @@ -20,7 +20,11 @@ */ #pragma once +#ifndef _WIN32 #include <netinet/in.h> +#else +#include <windows.h> +#endif #include <pthread.h> // start sending ping diff --git a/iputils/iputils.h b/iputils/iputils.h index 4ec59b51a4d869ec05460bb48dbe54b43fd7c604..677bcc2951a274ead3a5b88e367a5dac85196c71 100644 --- a/iputils/iputils.h +++ b/iputils/iputils.h @@ -7,7 +7,18 @@ #include <stdint.h> #include <stdlib.h> +#ifndef _WIN32 #include <netinet/ip.h> +#else +#include <winsock2.h> +#include <windows.h> +#include <mswsock.h> +#include <ws2tcpip.h> +#include <io.h> +#include "win32/iphdr.h" +#include "win32/ip.h" +#define uid_t uint32_t +#endif #include <setjmp.h> #ifdef __cplusplus