diff --git a/CMakeLists.txt b/CMakeLists.txt index 7bc323af512ef0b1f476e7f6dfea7827067e0dd8..e1575eb7b42e921fc854b2bb76857854ce9737fb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,8 @@ cmake_minimum_required(VERSION 3.0) project (dap_chain_net) set(DAP_CHAIN_NET_SRCS - dap_chain_net.c + dap_chain_net.c + dap_chain_net_remote.c dap_chain_node.c dap_chain_node_cli.c dap_chain_node_cli_cmd.c @@ -14,6 +15,7 @@ set(DAP_CHAIN_NET_SRCS set(DAP_CHAIN_NET_HEADERS dap_chain_net.h + dap_chain_net_remote.h dap_chain_node.h dap_chain_node_cli.h dap_chain_node_cli_cmd.h @@ -23,6 +25,12 @@ set(DAP_CHAIN_NET_HEADERS dap_chain_node_ping.h ) +#if (ANDROID) +# set(DAP_CHAIN_NET_HEADERS ${DAP_CHAIN_NET_HEADERS} +# android/ifaddrs-android.h +# ) +#endif() + set(IPUTILS_INCLUDE_DIRS iputils/traceroute/ ) @@ -47,8 +55,6 @@ if(WIN32) add_definitions ("-D_POSIX_THREAD_SAFE_FUNCTIONS") add_definitions ("-DNODE_NETNAME=\"cellframe\"") include_directories(../libdap/src/win32/) - include_directories(../3rdparty/libmemcached/) - include_directories(../3rdparty/libmemcached/win32/) include_directories(../3rdparty/wepoll/include/) include_directories(../3rdparty/uthash/src/) include_directories(../3rdparty/libjson-c/) @@ -63,7 +69,10 @@ if(WIN32) endif() if(UNIX) - target_link_libraries(dap_chain_net dap_core dap_crypto dap_client dap_stream_ch_chain dap_chain_gdb dap_stream_ch_chain_net dap_chain dap_chain_crypto dap_chain_wallet dap_chain_net_srv dap_chain_net_srv_vpn dap_chain_mempool dap_chain_global_db -lresolv) + target_link_libraries(dap_chain_net dap_core dap_crypto dap_client dap_stream_ch_chain dap_chain_gdb dap_stream_ch_chain_net dap_chain + dap_chain_crypto dap_chain_wallet dap_chain_net_srv dap_chain_net_srv_vpn dap_chain_mempool dap_chain_global_db + resolv + ) endif() target_include_directories(dap_chain_net INTERFACE . PUBLIC ${IPUTILS_INCLUDE_DIRS}) diff --git a/dap_chain_net.c b/dap_chain_net.c old mode 100644 new mode 100755 index 425ac39452d3acac9d1b16f2d17cfda27ed70945..ad42a7190b4e3b4ae4523ca8a80b36b2d05f370a --- a/dap_chain_net.c +++ b/dap_chain_net.c @@ -38,14 +38,11 @@ #endif #ifdef WIN32 -#undef _WIN32_WINNT -#define _WIN32_WINNT 0x0600 #include <winsock2.h> #include <windows.h> #include <mswsock.h> #include <ws2tcpip.h> #include <io.h> -#include <wepoll.h> #endif #include <pthread.h> @@ -1247,7 +1244,7 @@ int s_net_load(const char * a_net_name) l_node_info->hdr.address.uint64 = l_seed_node_addr->uint64; if ( l_node_info->hdr.ext_addr_v4.s_addr || - l_node_info->hdr.ext_addr_v6.__in6_u.__u6_addr32[0] ){ + l_node_info->hdr.ext_addr_v6.s6_addr32[0] ){ int l_ret; if ( (l_ret = dap_chain_node_info_save(l_net, l_node_info)) ==0 ){ if (dap_chain_node_alias_register(l_net,PVT(l_net)->seed_aliases[i],l_seed_node_addr)) diff --git a/dap_chain_net_remote.c b/dap_chain_net_remote.c new file mode 100644 index 0000000000000000000000000000000000000000..65ecddbf07ec61c836dcb3f52cca6c7c35d12f88 --- /dev/null +++ b/dap_chain_net_remote.c @@ -0,0 +1,27 @@ +/* +* Authors: +* Dmitriy Gerasimov <naeper@demlabs.net> +* Cellframe https://cellframe.net +* DeM Labs Inc. https://demlabs.net +* Copyright (c) 2017-2019 +* All rights reserved. + +This file is part of CellFrame SDK the open source project + +CellFrame SDK is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +CellFrame SDK is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with any CellFrame SDK based project. If not, see <http://www.gnu.org/licenses/>. +*/ +#include "dap_common.h" +#include "dap_chain_net_remote.h" + +#define LOG_TAG "dap_chain_net_remote" diff --git a/dap_chain_net_remote.h b/dap_chain_net_remote.h new file mode 100644 index 0000000000000000000000000000000000000000..e3e35be850eb3ec77cc4bc2d27ee4867abc52230 --- /dev/null +++ b/dap_chain_net_remote.h @@ -0,0 +1,31 @@ +/* +* Authors: +* Dmitriy Gerasimov <naeper@demlabs.net> +* Cellframe https://cellframe.net +* DeM Labs Inc. https://demlabs.net +* Copyright (c) 2017-2019 +* All rights reserved. + +This file is part of CellFrame SDK the open source project + +CellFrame SDK is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +CellFrame SDK is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with any CellFrame SDK based project. If not, see <http://www.gnu.org/licenses/>. +*/ +#pragma once + +#include "dap_chain_common.h" + +typedef struct dap_chain_net_remote { + dap_chain_node_addr_t remote_addr; + char remote_channel; +} dap_chain_net_remote_t; diff --git a/dap_chain_node.c b/dap_chain_node.c index 1fb9ae970c2cd5b2eda0b3bc9e9e4cfe6385f54c..790b627340eec20b503ee059c6491ea1e4aeb0a1 100644 --- a/dap_chain_node.c +++ b/dap_chain_node.c @@ -28,14 +28,11 @@ #include <string.h> #ifdef WIN32 -#undef _WIN32_WINNT -#define _WIN32_WINNT 0x0600 #include <winsock2.h> #include <windows.h> #include <mswsock.h> #include <ws2tcpip.h> #include <io.h> -#include <wepoll.h> #include <pthread.h> #else #include <sys/socket.h> diff --git a/dap_chain_node_cli.c b/dap_chain_node_cli.c old mode 100644 new mode 100755 index 1fee8dd96ac3f950e8ba81b7930c9f0c2e060c2b..1aaf97dbe823a9d93af5dd8e6b9d3078dd4808a0 --- a/dap_chain_node_cli.c +++ b/dap_chain_node_cli.c @@ -46,14 +46,11 @@ //#define INVALID_SOCKET -1 // for win32 = (SOCKET)(~0) // for Windows #else -#undef _WIN32_WINNT -#define _WIN32_WINNT 0x0600 #include <winsock2.h> #include <windows.h> #include <mswsock.h> #include <ws2tcpip.h> #include <io.h> -#include <wepoll.h> #endif #include <pthread.h> @@ -763,7 +760,7 @@ int dap_chain_node_cli_init(dap_config_t * g_config) #ifndef _WIN32 struct sockaddr_un l_server_addr={0}; l_server_addr.sun_family = AF_UNIX; - snprintf(l_server_addr.sun_path,sizeof(l_server_addr.sun_path), dap_config_get_item_str( g_config, "conserver", "listen_unix_socket_path") ); + snprintf(l_server_addr.sun_path,sizeof(l_server_addr.sun_path), "%s", dap_config_get_item_str( g_config, "conserver", "listen_unix_socket_path") ); #else pthread_t threadId; #endif diff --git a/dap_chain_node_cli_cmd.c b/dap_chain_node_cli_cmd.c index d69df1f7ff98edcaab52496205b4b278910beeac..2e859dea541072365f7d00a36f768ea87c87272a 100644 --- a/dap_chain_node_cli_cmd.c +++ b/dap_chain_node_cli_cmd.c @@ -37,8 +37,6 @@ #include <dirent.h> #ifdef WIN32 -#undef _WIN32_WINNT -#define _WIN32_WINNT 0x0600 #include <winsock2.h> #include <windows.h> #include <mswsock.h> diff --git a/dap_chain_node_client.c b/dap_chain_node_client.c index 9ff0cb15d60b563ba56ad65a96169da5f525246b..bce0989d71e738eb7d3953a1b5d1953ee0a3a0e3 100644 --- a/dap_chain_node_client.c +++ b/dap_chain_node_client.c @@ -31,14 +31,11 @@ #include <string.h> #ifdef WIN32 -#undef _WIN32_WINNT -#define _WIN32_WINNT 0x0600 #include <winsock2.h> #include <windows.h> #include <mswsock.h> #include <ws2tcpip.h> #include <io.h> -#include <wepoll.h> #include <pthread.h> #endif diff --git a/dap_chain_node_remote.c b/dap_chain_node_remote.c index 515d1123b8f99cb0effe8f4c77fb3fad138a2a1c..cabf4dd34e4b5e07bcf67b93169b5a38f6a54636 100644 --- a/dap_chain_node_remote.c +++ b/dap_chain_node_remote.c @@ -28,14 +28,11 @@ #include <pthread.h> #ifdef WIN32 -#undef _WIN32_WINNT -#define _WIN32_WINNT 0x0600 #include <winsock2.h> #include <windows.h> #include <mswsock.h> #include <ws2tcpip.h> #include <io.h> -#include <wepoll.h> #endif #include "uthash.h" diff --git a/iputils/iputils.c b/iputils/iputils.c old mode 100644 new mode 100755 index 7d73d1a085a7ed2686740c4eb5f84e35b843a65b..263590139c76977ee7e4f7ce37800825fd27e542 --- a/iputils/iputils.c +++ b/iputils/iputils.c @@ -41,7 +41,7 @@ int log_printf(const char *format, ...) if(log_str) { - ret = printf(log_str); + ret = printf("%s", log_str); DAP_DELETE(log_str); } } diff --git a/iputils/tracepath.c b/iputils/tracepath.c old mode 100644 new mode 100755 index bb9d329a9ae94d6daeb7dc80f5a5e118af0c0b0d..2dce76420ca7396496ba18068819f85011b0a0a7 --- a/iputils/tracepath.c +++ b/iputils/tracepath.c @@ -12,6 +12,7 @@ #include <arpa/inet.h> #include <errno.h> #include <limits.h> +#include <time.h> #include <linux/errqueue.h> #include <linux/icmp.h> #include <linux/icmpv6.h> diff --git a/iputils/traceroute/flowlabel.h b/iputils/traceroute/flowlabel.h old mode 100644 new mode 100755 index af5a65ae28c349c193388ca719ee2563d579b591..e6241c4f8e9cdd00558ffd3494cfe1b5d40a1c80 --- a/iputils/traceroute/flowlabel.h +++ b/iputils/traceroute/flowlabel.h @@ -6,7 +6,7 @@ conflicts with "netinet/in.h" . */ -struct in6_flowlabel_req +struct in6_flowlabel_req_ { struct in6_addr flr_dst; __u32 flr_label; diff --git a/iputils/traceroute/traceroute.c b/iputils/traceroute/traceroute.c old mode 100644 new mode 100755 index 40a5d2489eb8bfd4885cd7313f80324b0a3e4445..8f0ec111330e3be9a0b8e42a365ed3eb4361584b --- a/iputils/traceroute/traceroute.c +++ b/iputils/traceroute/traceroute.c @@ -1204,7 +1204,7 @@ void tune_socket(int sk) { error("setsockopt IPV6_MTU_DISCOVER"); if(flow_label) { - struct in6_flowlabel_req flr; + struct in6_flowlabel_req_ flr; memset(&flr, 0, sizeof(flr)); flr.flr_label = htonl(flow_label & 0x000fffff);