macOS static lib build target update, minor android/unity3d updates

This commit is contained in:
Joseph Henry
2016-12-20 12:57:59 -08:00
parent 7393c80ae6
commit 2741508520
27 changed files with 469 additions and 195 deletions

View File

@@ -67,8 +67,12 @@ typedef uint16_t u16_t;
typedef int16_t s16_t;
typedef uint32_t u32_t;
typedef int32_t s32_t;
#if defined(__ANDROID__)
typedef unsigned long mem_ptr_t;
#else
typedef uintptr_t mem_ptr_t;
#endif
#endif
/** Define this to 1 in arch/cc.h of your port if your compiler does not provide
* the inttypes.h header. This cannot be \#defined in lwipopts.h since

View File

@@ -19,7 +19,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>Temp\bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;UNITY_5_3_OR_NEWER;UNITY_5_3_5;UNITY_5_3;UNITY_5;ENABLE_NEW_BUGREPORTER;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_FRAME_DEBUGGER;ENABLE_GENERICS;ENABLE_HOME_SCREEN;ENABLE_IMAGEEFFECTS;ENABLE_LIGHT_PROBES_LEGACY;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_PLUGIN_INSPECTOR;ENABLE_SHADOWS;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_SPRITERENDERER_FLIPPING;ENABLE_SPRITES;ENABLE_SPRITE_POLYGON;ENABLE_TERRAIN;ENABLE_RAKNET;ENABLE_UNET;ENABLE_UNITYEVENTS;ENABLE_VR;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;INCLUDE_DYNAMIC_GI;INCLUDE_GI;INCLUDE_IL2CPP;INCLUDE_DIRECTX12;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;ENABLE_LOCALIZATION;ENABLE_ANDROID_ATLAS_ETC1_COMPRESSION;ENABLE_EDITOR_TESTS_RUNNER;UNITY_STANDALONE_OSX;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_GAMECENTER;ENABLE_TEXTUREID_MAP;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_LOG_MIXED_STACKTRACE;ENABLE_UNITYWEBREQUEST;ENABLE_CLUSTERINPUT;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;ENABLE_PROFILER;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_OSX;UNITY_TEAM_LICENSE</DefineConstants>
<DefineConstants>DEBUG;TRACE;UNITY_5_3_OR_NEWER;UNITY_5_4_OR_NEWER;UNITY_5_5_OR_NEWER;UNITY_5_5_0;UNITY_5_5;UNITY_5;UNITY_64;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_GENERICS;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_SPRITERENDERER_FLIPPING;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_RAKNET;ENABLE_UNET;ENABLE_LZMA;ENABLE_UNITYEVENTS;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES_COLLAB;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;INCLUDE_DYNAMIC_GI;INCLUDE_GI;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;INCLUDE_PUBNUB;ENABLE_PLAYMODE_TESTS_RUNNER;ENABLE_SCRIPTING_NEW_CSHARP_COMPILER;UNITY_STANDALONE_OSX;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_GAMECENTER;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_UNITYWEBREQUEST;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_VIDEO;ENABLE_VR;ENABLE_CLUSTERINPUT;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;ENABLE_PROFILER;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_OSX;UNITY_TEAM_LICENSE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>0169</NoWarn>
@@ -36,12 +36,13 @@
<Reference Include="System" />
<Reference Include="System.XML" />
<Reference Include="System.Core" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Xml.Linq" />
<Reference Include="UnityEngine">
<HintPath>/Applications/Unity/Unity.app/Contents/Frameworks/Managed/UnityEngine.dll</HintPath>
<HintPath>/Applications/Unity/Unity.app/Contents/Managed/UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEditor">
<HintPath>/Applications/Unity/Unity.app/Contents/Frameworks/Managed/UnityEditor.dll</HintPath>
<HintPath>/Applications/Unity/Unity.app/Contents/Managed/UnityEditor.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
@@ -49,11 +50,23 @@
<Compile Include="Assets\WorldMain.cs" />
<Compile Include="Assets\ZTSDK.cs" />
<Compile Include="Assets\ZeroTierSockets_Demo.cs" />
<Reference Include="UnityEngine.UI">
<HintPath>/Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/GUISystem/UnityEngine.UI.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.Networking">
<HintPath>/Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/Networking/UnityEngine.Networking.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UI">
<HintPath>/Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/GUISystem/UnityEngine.UI.dll</HintPath>
<Reference Include="UnityEngine.PlaymodeTestsRunner">
<HintPath>/Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/PlaymodeTestsRunner/UnityEngine.PlaymodeTestsRunner.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.Analytics">
<HintPath>/Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/UnityAnalytics/UnityEngine.Analytics.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.HoloLens">
<HintPath>/Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/UnityHoloLens/RuntimeEditor/UnityEngine.HoloLens.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.VR">
<HintPath>/Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/UnityVR/RuntimeEditor/UnityEngine.VR.dll</HintPath>
</Reference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

View File

@@ -217,6 +217,7 @@ public class ZeroTierSockets_Demo : MonoBehaviour
void Start()
{
Debug.Log ("Start()");
// Set defaults
InputField input;
GameObject go;
@@ -234,7 +235,7 @@ public class ZeroTierSockets_Demo : MonoBehaviour
input.text = "Welcome to the machine";
// Create new instance of ZeroTier in separate thread
zt = new ZTSDK ("zerotier/", "8056c2e21c000001");
zt = new ZTSDK (".", "8056c2e21c000001");
}
// Terminate the ZeroTier service when the application quits

View File

@@ -1,2 +1 @@
m_EditorVersion: 5.3.5f1
m_StandardAssetsVersion: 0
m_EditorVersion: 5.5.0f3

View File

@@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 11.00
Project("{0BF2C6BC-4121-AE75-A3F9-F3A441421429}") = "Unity3D", "Assembly-CSharp.csproj", "{7214E491-EE9D-B906-A42D-2F3EA3DCD8FE}"
EndProject
Project("{0BF2C6BC-4121-AE75-A3F9-F3A441421429}") = "Unity3D", "Assembly-CSharp-Editor.csproj", "{CCA76E42-E9D5-4CBF-3222-F488C499DCF3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -15,10 +13,6 @@ Global
{7214E491-EE9D-B906-A42D-2F3EA3DCD8FE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7214E491-EE9D-B906-A42D-2F3EA3DCD8FE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7214E491-EE9D-B906-A42D-2F3EA3DCD8FE}.Release|Any CPU.Build.0 = Release|Any CPU
{CCA76E42-E9D5-4CBF-3222-F488C499DCF3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CCA76E42-E9D5-4CBF-3222-F488C499DCF3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CCA76E42-E9D5-4CBF-3222-F488C499DCF3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CCA76E42-E9D5-4CBF-3222-F488C499DCF3}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@@ -2,35 +2,31 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
ZTSDK := ../../../../../src
ZT := ../../../../../zerotierone
ZTSDK := $(ZT1)/..
ZT := $(ZTSDK)/zerotierone
LWIP := $(ZTSDK)/ext/lwip/src
LOCAL_MODULE := ZeroTierOneJNI
LOCAL_C_INCLUDES := $(ZT1)/include
LOCAL_C_INCLUDES += $(ZT1)/ext/lwip/src/include
LOCAL_C_INCLUDES += $(ZT1)/ext/lwip/src/include/lwip
LOCAL_C_INCLUDES += $(ZT1)/ext/lwip/src/include/lwip/priv
LOCAL_C_INCLUDES := $(LWIP)/include
LOCAL_C_INCLUDES += $(LWIP)/include/lwip
LOCAL_C_INCLUDES += $(LWIP)/include/lwip/priv
LOCAL_C_INCLUDES += $(ZTSDK)/src
LOCAL_C_INCLUDES += $(ZTSDK)/src/stack_drivers/lwip
LOCAL_C_INCLUDES += $(ZTSDK)/src/stack_drivers
LOCAL_C_INCLUDES += $(ZT1)/include
LOCAL_C_INCLUDES += $(ZT1)/node
LOCAL_C_INCLUDES += $(ZT1)/
LOCAL_C_INCLUDES += $(ZT1)/service
LOCAL_C_INCLUDES += $(ZT1)/osdep
LOCAL_C_INCLUDES += $(ZTSDK)/src
LOCAL_C_INCLUDES += $(ZTSDK)/stack_drivers/lwip
LOCAL_LDLIBS := -llog
# LOCAL_CFLAGS := -g
# Netcon files
LOCAL_SRC_FILES := \
$(ZTSDK)/rpc.c \
$(ZTSDK)/proxy.cpp \
$(ZTSDK)/sockets.c \
$(ZTSDK)/service.cpp \
$(ZTSDK)/tap.cpp
# ZeroTierOne ext files
LOCAL_SRC_FILES += \
LOCAL_SRC_FILES := \
$(ZT1)/ext/lz4/lz4.c \
$(ZT1)/ext/json-parser/json.c \
$(ZT1)/ext/http-parser/http_parser.c \
@@ -42,7 +38,6 @@ LOCAL_SRC_FILES += \
$(ZT1)/node/C25519.cpp \
$(ZT1)/node/CertificateOfMembership.cpp \
$(ZT1)/node/DeferredPackets.cpp \
$(ZT1)/node/Dictionary.cpp \
$(ZT1)/node/Identity.cpp \
$(ZT1)/node/IncomingPacket.cpp \
$(ZT1)/node/InetAddress.cpp \
@@ -63,59 +58,67 @@ LOCAL_SRC_FILES += \
$(ZT)/node/Utils.cpp \
$(ZT)/osdep/Http.cpp \
$(ZT)/osdep/OSUtils.cpp \
$(ZT)/osdep/ManagedRoute.cpp \
$(ZT)/osdep/BackgroundResolver.cpp
# lwIP api files
LOCAL_SRC_FILES += \
$(ZT)/ext/lwip/src/api/api_lib.c \
$(ZT)/ext/lwip/src/api/api_msg.c \
$(ZT)/ext/lwip/src/api/err.c \
$(ZT)/ext/lwip/src/api/netbuf.c \
$(ZT)/ext/lwip/src/api/netdb.c \
$(ZT)/ext/lwip/src/api/netifapi.c \
$(ZT)/ext/lwip/src/api/sockets.c \
$(ZT)/ext/lwip/src/api/tcpip.c
# lwIP core files
LOCAL_SRC_FILES += \
$(ZT)/ext/lwip/src/core/def.c \
$(ZT)/ext/lwip/src/core/dhcp.c \
$(ZT)/ext/lwip/src/core/dns.c \
$(ZT)/ext/lwip/src/core/init.c \
$(ZT)/ext/lwip/src/core/mem.c \
$(ZT)/ext/lwip/src/core/memp.c \
$(ZT)/ext/lwip/src/core/netif.c \
$(ZT)/ext/lwip/src/core/pbuf.c \
$(ZT)/ext/lwip/src/core/raw.c \
$(ZT)/ext/lwip/src/core/stats.c \
$(ZT)/ext/lwip/src/core/sys.c \
$(ZT)/ext/lwip/src/core/tcp_in.c \
$(ZT)/ext/lwip/src/core/tcp_out.c \
$(ZT)/ext/lwip/src/core/tcp.c \
$(ZT)/ext/lwip/src/core/timers.c \
$(ZT)/ext/lwip/src/core/udp.c
#lwip
LOCAL_SRC_FILES += $(LWIP)/core/init.c \
$(LWIP)/core/def.c \
$(LWIP)/core/dns.c \
$(LWIP)/core/inet_chksum.c \
$(LWIP)/core/ip.c \
$(LWIP)/core/mem.c \
$(LWIP)/core/memp.c \
$(LWIP)/core/netif.c \
$(LWIP)/core/pbuf.c \
$(LWIP)/core/raw.c \
$(LWIP)/core/stats.c \
$(LWIP)/core/sys.c \
$(LWIP)/core/tcp.c \
$(LWIP)/core/tcp_in.c \
$(LWIP)/core/tcp_out.c \
$(LWIP)/core/timeouts.c \
$(LWIP)/core/udp.c
LOCAL_SRC_FILES += $(LWIP)/core/ipv4/autoip.c \
$(LWIP)/core/ipv4/dhcp.c \
$(LWIP)/core/ipv4/etharp.c \
$(LWIP)/core/ipv4/icmp.c \
$(LWIP)/core/ipv4/igmp.c \
$(LWIP)/core/ipv4/ip4_frag.c \
$(LWIP)/core/ipv4/ip4.c \
$(LWIP)/core/ipv4/ip4_addr.c
#LOCAL_SRC_FILES += $(LWIP)/core/ipv6/dhcp6.c \
# $(LWIP)/core/ipv6/ethip6.c \
# $(LWIP)/core/ipv6/icmp6.c \
# $(LWIP)/core/ipv6/inet6.c \
# $(LWIP)/core/ipv6/ip6.c \
# $(LWIP)/core/ipv6/ip6_addr.c \
# $(LWIP)/core/ipv6/ip6_frag.c \
# $(LWIP)/core/ipv6/mld6.c \
# $(LWIP)/core/ipv6/nd6.c
# lwIP core/ip4 files
LOCAL_SRC_FILES += \
$(ZT)/ext/lwip/src/core/ipv4/autoip.c \
$(ZT)/ext/lwip/src/core/ipv4/icmp.c \
$(ZT)/ext/lwip/src/core/ipv4/igmp.c \
$(ZT)/ext/lwip/src/core/ipv4/inet_chksum.c \
$(ZT)/ext/lwip/src/core/ipv4/inet.c \
$(ZT)/ext/lwip/src/core/ipv4/ip_addr.c \
$(ZT)/ext/lwip/src/core/ipv4/ip_frag.c \
$(ZT)/ext/lwip/src/core/ipv4/ip.c \
# lwIP netif files
LOCAL_SRC_FILES += \
$(ZT)/ext/lwip/src/netif/etharp.c \
$(ZT)/ext/lwip/src/netif/ethernetif.c \
$(ZT)/ext/lwip/src/netif/slipif.c
$(LWIP)/netif/ethernetif.c \
$(LWIP)/netif/ethernet.c
# Netcon files
LOCAL_SRC_FILES += \
$(ZTSDK)/src/rpc.c \
$(ZTSDK)/src/proxy.cpp \
$(ZTSDK)/src/sockets.c \
$(ZTSDK)/src/service.cpp \
$(ZTSDK)/src/tap.cpp \
$(ZTSDK)/src/stack_drivers/lwip/lwip.cpp
# JNI Files
LOCAL_SRC_FILES += \
com_zerotierone_sdk_Node.cpp \
ZT_jniutils.cpp \
ZT_jnilookup.cpp
#LOCAL_SRC_FILES += \
# com_zerotierone_sdk_Node.cpp \
# ZT_jniutils.cpp \
# ZT_jnilookup.cpp
include $(BUILD_SHARED_LIBRARY)

View File

@@ -0,0 +1,121 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
ZTSDK := $(ZT1)/..
ZT := $(ZTSDK)/zerotierone
PICO := $(ZTSDK)/ext/picotcp
LOCAL_MODULE := ZeroTierOneJNI
LOCAL_C_INCLUDES := $(PICO)/modules
LOCAL_C_INCLUDES += $(PICO)/include
LOCAL_C_INCLUDES += $(PICO)/build/include
LOCAL_C_INCLUDES += $(PICO)/build/include/arch
LOCAL_C_INCLUDES += $(ZTSDK)/src
LOCAL_C_INCLUDES += $(ZTSDK)/src/stack_drivers/picotcp
LOCAL_C_INCLUDES += $(ZTSDK)/src/stack_drivers
LOCAL_C_INCLUDES += $(ZT1)/include
LOCAL_C_INCLUDES += $(ZT1)/node
LOCAL_C_INCLUDES += $(ZT1)/
LOCAL_C_INCLUDES += $(ZT1)/service
LOCAL_C_INCLUDES += $(ZT1)/osdep
LOCAL_LDLIBS := -llog
# LOCAL_CFLAGS := -g
# ZeroTierOne ext files
LOCAL_SRC_FILES := \
$(ZT1)/ext/lz4/lz4.c \
$(ZT1)/ext/json-parser/json.c \
$(ZT1)/ext/http-parser/http_parser.c \
# ZeroTierOne files
LOCAL_SRC_FILES += \
$(ZT1)/service/OneService.cpp \
$(ZT1)/service/ControlPlane.cpp \
$(ZT1)/node/C25519.cpp \
$(ZT1)/node/CertificateOfMembership.cpp \
$(ZT1)/node/DeferredPackets.cpp \
$(ZT1)/node/Identity.cpp \
$(ZT1)/node/IncomingPacket.cpp \
$(ZT1)/node/InetAddress.cpp \
$(ZT1)/node/Multicaster.cpp \
$(ZT)/node/Network.cpp \
$(ZT)/node/NetworkConfig.cpp \
$(ZT)/node/Node.cpp \
$(ZT)/node/OutboundMulticast.cpp \
$(ZT)/node/Packet.cpp \
$(ZT)/node/Path.cpp \
$(ZT)/node/Peer.cpp \
$(ZT)/node/Poly1305.cpp \
$(ZT)/node/Salsa20.cpp \
$(ZT)/node/SelfAwareness.cpp \
$(ZT)/node/SHA512.cpp \
$(ZT)/node/Switch.cpp \
$(ZT)/node/Topology.cpp \
$(ZT)/node/Utils.cpp \
$(ZT)/osdep/Http.cpp \
$(ZT)/osdep/OSUtils.cpp \
$(ZT)/osdep/ManagedRoute.cpp \
$(ZT)/osdep/BackgroundResolver.cpp
# picoTCP files
LOCAL_SRC_FILES += \
$(PICO)/stack/pico_device.c \
$(PICO)/stack/pico_frame.c \
$(PICO)/stack/pico_md5.c \
$(PICO)/stack/pico_protocol.c \
$(PICO)/stack/pico_socket_multicast.c \
$(PICO)/stack/pico_socket.c \
$(PICO)/stack/pico_stack.c \
$(PICO)/stack/pico_tree.c \
# picoTCP files
LOCAL_SRC_FILES += \
$(PICO)/modules/pico_aodv.c \
$(PICO)/modules/pico_arp.c \
$(PICO)/modules/pico_dev_loop.c \
$(PICO)/modules/pico_dev_mock.c \
$(PICO)/modules/pico_dev_null.c \
$(PICO)/modules/pico_dev_tun.c \
$(PICO)/modules/pico_dns_client.c \
$(PICO)/modules/pico_dns_common.c \
$(PICO)/modules/pico_dns_sd.c \
$(PICO)/modules/pico_fragments.c \
$(PICO)/modules/pico_hotplug_detection.c \
$(PICO)/modules/pico_icmp4.c \
$(PICO)/modules/pico_icmp6.c \
$(PICO)/modules/pico_igmp.c \
$(PICO)/modules/pico_ipfilter.c \
$(PICO)/modules/pico_ipv4.c \
$(PICO)/modules/pico_ipv6_nd.c \
$(PICO)/modules/pico_ipv6.c \
$(PICO)/modules/pico_mdns.c \
$(PICO)/modules/pico_mld.c \
$(PICO)/modules/pico_mm.c \
$(PICO)/modules/pico_nat.c \
$(PICO)/modules/pico_olsr.c \
$(PICO)/modules/pico_posix.c \
$(PICO)/modules/pico_slaacv4.c \
$(PICO)/modules/pico_sntp_client.c \
$(PICO)/modules/pico_socket_tcp.c \
$(PICO)/modules/pico_socket_udp.c \
$(PICO)/modules/pico_strings.c \
$(PICO)/modules/pico_tcp.c \
$(PICO)/modules/pico_tftp.c \
$(PICO)/modules/pico_udp.c
# Netcon files
LOCAL_SRC_FILES += \
$(ZTSDK)/src/rpc.c \
$(ZTSDK)/src/proxy.cpp \
$(ZTSDK)/src/sockets.c \
$(ZTSDK)/src/service.cpp \
$(ZTSDK)/src/tap.cpp \
$(ZTSDK)/src/stack_drivers/picotcp/picotcp.cpp
include $(BUILD_SHARED_LIBRARY)

View File

@@ -1,7 +1,7 @@
NDK_TOOLCHAIN_VERSION := clang
APP_STL := c++_static
APP_CPPFLAGS := -g -O3 -DSDK_BUNDLED -DZT_DEBUG -DSDK_DEBUG -DLWIP_DEBUG -DSDK_LWIP=1 -DSDK_IPV4=1 -DSDK -fPIC -fPIE -fvectorize -Wall -fstack-protector -fexceptions -fno-strict-aliasing -Wno-deprecated-register -DZT_NO_TYPE_PUNNING=1
APP_CFLAGS := -g -DSDK_BUNDLED
APP_CPPFLAGS := -D__ANDROID__ -v -g -O3 -DSDK_BUNDLED -DSDK_DEBUG -DSDK_LWIP=1 -DSDK_IPV4=1 -DSDK -fPIC -fPIE -fvectorize -Wall -fstack-protector -fexceptions -fno-strict-aliasing -Wno-deprecated-register -DZT_NO_TYPE_PUNNING=1
APP_CFLAGS := -v -g -DSDK_BUNDLED
APP_PLATFORM := android-14
# Architectures

View File

@@ -0,0 +1,16 @@
NDK_TOOLCHAIN_VERSION := clang
APP_STL := c++_static
APP_CPPFLAGS := -v -g -O3 -DSDK_BUNDLED -DSDK_DEBUG -PICO_SUPPORT_IPV4=1 -DPICO_SUPPORT_TCP=1 -DSDK_PICOTCP=1 -DSDK_IPV4=1 -DIPV4=1 -DIPV6=1 -DSDK -fPIC -fPIE -fvectorize -Wall -fstack-protector -fexceptions -fno-strict-aliasing -Wno-deprecated-register -DZT_NO_TYPE_PUNNING=1
APP_CFLAGS := -g -DSDK_BUNDLED
APP_PLATFORM := android-14
# Architectures
# APP_ABI := all
#APP_ABI += arm64-v8a
#APP_ABI += armeabi
APP_ABI += armeabi-v7a
#APP_ABI += mips
#APP_ABI += mips64
#APP_ABI += x86
#APP_ABI += x86_64

View File

@@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
buildToolsVersion '25.0.2'
defaultConfig {
applicationId "com.example.joseph.example_app"
minSdkVersion 15
@@ -22,7 +22,7 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha1'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha5'
testCompile 'junit:junit:4.12'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
androidTestCompile 'com.android.support.test:runner:0.5'

View File

@@ -27,6 +27,7 @@ public class MainActivity extends AppCompatActivity {
String nwid = "8056c2e21c000001";
// Set up service
final ZTSDK zt = new ZTSDK();
final String homeDir = getApplicationContext().getFilesDir() + "/zerotier";
new Thread(new Runnable() {
public void run() {
@@ -133,8 +134,7 @@ public class MainActivity extends AppCompatActivity {
}
// UDP Echo ZTSDK
if(mode==4)
{
if(mode==4) {
// Remote server address (will be populated by recvfrom()
ZTAddress remoteServer = new ZTAddress();
ZTAddress bindAddr = new ZTAddress("0.0.0.0", 8080);
@@ -153,8 +153,7 @@ public class MainActivity extends AppCompatActivity {
if (addresses.size() < 0) {
Log.d("ZTSDK", "unable to obtain ZT address");
return;
}
else {
} else {
Log.d("ZTSDK", "App IP = " + addresses.get(0));
}

View File

@@ -5,19 +5,41 @@ Welcome!
Imagine a flat, encrypted, no-configuration LAN for all of the instances of your Android app. This short tutorial will show you how to enable ZeroTier functionality for your Android app with little to no code modification. Check out our [ZeroTier SDK](https://www.zerotier.com/blog) page for more info on how the integration works. In this example we aim to set up a minimal [Android Studio](https://developer.android.com/studio/index.html) project which contains all of the components necessary to enable ZeroTier for your app.
*NOTE: For Android JNI libraries to build you'll need to install [Android Studio](https://developer.android.com/studio/index.html) the [Android NDK](https://developer.android.com/ndk/index.html). Currently only Android NDK r10e is supported and can be found [here for OSX](http://dl.google.com/android/repository/android-ndk-r10e-darwin-x86_64.zip) and [here for Linux](http://dl.google.com/android/repository/android-ndk-r10e-linux-x86_64.zip). You'll need to tell our project where you put it by putting the path in [this file](android/proj/local.properties), you'll need to install the Android Build-Tools (this can typically be done through the editor the first time you start it up), and finally you should probably upgrade your Gradle plugin if it asks you to. If you don't have these things installed and configured we will detect that and just skip those builds automatically.*
*NOTE: For Android JNI libraries to build you'll need to install [Android Studio](https://developer.android.com/studio/index.html) the [Android NDK](https://developer.android.com/ndk/index.html). Currently only Android NDK r10e is supported and can be found [here for OSX](http://dl.google.com/android/repository/android-ndk-r10e-darwin-x86_64.zip) and [here for Linux](http://dl.google.com/android/repository/android-ndk-r10e-linux-x86_64.zip). You'll need to tell our project where you put it by putting the path in [this file](android_jni_lib/proj/local.properties), you'll need to install the Android Build-Tools (this can typically be done through the editor the first time you start it up), and finally you should probably upgrade your Gradle plugin if it asks you to. If you don't have these things installed and configured we will detect that and just skip those builds automatically.*
If you want to skip these steps and just take a look at the project, go [here](example_app).
If you want to skip the following steps and just take a look at the project, go [here](example_app).
***
**Step 1: Select build targets**
- Specify the target architectures you want to build in [Application.mk](android/java/jni/Application.mk). By default it will build `arm64-v8a`, `armeabi`, `armeabi-v7a`, `mips`, `mips64`, `x86`, and `x86_64`.
**Step 2: Build Shared Library**
- `make android_jni_lib`
- The resultant `build/android_jni_lib_YOUR_ARCH/libZeroTierOneJNI.so` is what you want to import into your own project to provide the API to your app. Select your architecture and copy the shared library into your project's JNI directory, possibly `/src/main/jniLibs/YOUR_ARCH/`. Selecting only the architectures you need will *significantly* reduce overall build time.
**Step 1: App Code Modifications**
- In your project, create a new package called `ZeroTier` and class file within called `ZTSDK.java` and copy contents from `src/wrappers/java/JavaWrapper.java`
**Step 3: App permissions**
- Start the service
```
String nwid = "8056c2e21c000001";
// Set up service
final ZTSDK zt = new ZTSDK();
final String homeDir = getApplicationContext().getFilesDir() + "/zerotier";
new Thread(new Runnable() {
public void run() {
// Calls to JNI code
zt.start_service(homeDir);
}
}).start();
while(!zt.running()) { }
```
- Join network and start doing network stuff!
```
zt.join_network(nwid);
int sock = zt.socket(zt.AF_INET, zt.SOCK_STREAM, 0);
int err = zt.connect(sock, "10.9.9.203", 8080, nwid);
// zt.recvfrom(), zt.write(), etc...
```
**Step 2: App permissions**
- In order for your application to write the auth keys and network files to the internal storage you'll need to set a few permissions in your `AndroidManifest.xml` file at the same scope level as `<application>`:
@@ -26,47 +48,18 @@ If you want to skip these steps and just take a look at the project, go [here](e
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
```
**Step 4: App Code Modifications**
- Create new package called `ZeroTierSDK` in your project and add a new file called `ZeroTierSDK.java` containing:
**Step 3: Set NDK/SDK paths**
- Specify your SDK/NDK path in `android_jni_lib/proj/local.properties`. For example:
```
package ZeroTier;
public class ZeroTierSDK {
public native void startOneService(String homeDir);
public native void joinNetwork(String nwid);
public native void leaveNetwork(String nwid);
public native boolean isRunning();
static { System.loadLibrary("ZeroTierOneJNI"); } // Loads JNI code
}
sdk.dir=/Users/Name/Library/Android/sdk
ndk.dir=/Users/Name/Library/Android/ndk-r10e
```
- Start the service
**Step 4: Select build targets**
- Specify the target architectures you want to build in [Application.mk](android_jni_lib/java/jni/Application.mk). By default it will build `arm64-v8a`, `armeabi`, `armeabi-v7a`, `mips`, `mips64`, `x86`, and `x86_64`. For each architecture you wish to support a different shared library will need to be built. This is all taken care of automatically by the build script.
```
final SDK zt = new SDK();
final String homeDir = getApplicationContext().getFilesDir() + "/zerotier";
new Thread(new Runnable() {
public void run() {
// Calls to JNI code
zt.zt_start_service(homeDir);
}
}).start();
```
- Join network and perform network call
```
while(!zt.zt_running()) { }
zt.zt_join_network("XXXXXXXXXXXXXXXX");
// Create ZeroTier socket
int sock = zt.zt_socket(zt.AF_INET, zt.SOCK_STREAM, 0);
// Connect to remote host
int err = zt.zt_connect(sock, "10.9.9.203", 8080);
```
***
*Note for the curious on JNI naming conventions: In order to reference a symbol in the JNI library you need to structure the package and class in your Android Studio project in a very particular way. For example, in the ZeroTierSDK we define a function called `Java_ZeroTier_SDK_zt_1start_1service`, the name can be broken down as follows: `Java_PACKAGENAME_CLASSNAME_zt_1start_1service`, so as we've defined it, you must create a package called `ZeroTier` and add a class called `SDK`.*
**Step 4: Build Shared Library**
- `make android_jni_lib`
- The resultant `build/android_jni_lib/ARCH/libZeroTierOneJNI.so` is what you want to import into your own project to provide our API implementation to your app. Select your architecture and copy the shared library `libZeroTierOneJNI.so` into your project's JNI directory, possibly `/src/main/jniLibs/ARCH/libZeroTierOneJNI.so`.
- Selecting only the architectures you need will *significantly* reduce overall build time.

View File

@@ -1,11 +1,12 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'com.android.tools.build:gradle:2.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files

View File

@@ -1,6 +1,6 @@
#Mon Dec 28 10:00:20 PST 2015
#Thu Dec 15 15:58:49 PST 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https://downloads.gradle.org/distributions/gradle-2.14-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip

View File

@@ -159,6 +159,71 @@
7CC004D11D131E37003E68DC /* http_parser.c in Sources */ = {isa = PBXBuildFile; fileRef = 7CC003571D1217A1003E68DC /* http_parser.c */; };
7CC005201D1324B3003E68DC /* lz4.c in Sources */ = {isa = PBXBuildFile; fileRef = 7CC0035A1D1217B2003E68DC /* lz4.c */; };
7CC005211D1324B3003E68DC /* http_parser.c in Sources */ = {isa = PBXBuildFile; fileRef = 7CC003571D1217A1003E68DC /* http_parser.c */; };
7CD785601E08C7B500E03BF0 /* lwip.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C2228CF1DCC1193006A2661 /* lwip.cpp */; };
7CD785611E08C7B500E03BF0 /* rpc.c in Sources */ = {isa = PBXBuildFile; fileRef = 7C7D527B1DBEADD200896C93 /* rpc.c */; };
7CD785621E08C7B500E03BF0 /* service.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C7D527D1DBEADD200896C93 /* service.cpp */; };
7CD785631E08C7B500E03BF0 /* sockets.c in Sources */ = {isa = PBXBuildFile; fileRef = 7C7D527F1DBEADD200896C93 /* sockets.c */; };
7CD785641E08C7B500E03BF0 /* tap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C7D52801DBEADD200896C93 /* tap.cpp */; };
7CD785661E08C7B500E03BF0 /* ManagedRoute.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C7AF0231DFA1B5C00AABE75 /* ManagedRoute.cpp */; };
7CD785671E08C7B500E03BF0 /* BackgroundResolver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CEAF58E1DBAD10A006585E7 /* BackgroundResolver.cpp */; };
7CD785681E08C7B500E03BF0 /* DeferredPackets.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CEAF5891DBAD0BF006585E7 /* DeferredPackets.cpp */; };
7CD785691E08C7B500E03BF0 /* OneService.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CEAF5821DBACB3E006585E7 /* OneService.cpp */; };
7CD7856A1E08C7B500E03BF0 /* C25519.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CEAF5121DBAC872006585E7 /* C25519.cpp */; };
7CD7856B1E08C7B500E03BF0 /* CertificateOfMembership.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CEAF5141DBAC872006585E7 /* CertificateOfMembership.cpp */; };
7CD7856C1E08C7B500E03BF0 /* Cluster.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CEAF5161DBAC872006585E7 /* Cluster.cpp */; };
7CD7856D1E08C7B500E03BF0 /* Identity.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CEAF51E1DBAC872006585E7 /* Identity.cpp */; };
7CD7856E1E08C7B500E03BF0 /* IncomingPacket.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CEAF5201DBAC872006585E7 /* IncomingPacket.cpp */; };
7CD7856F1E08C7B500E03BF0 /* InetAddress.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CEAF5221DBAC872006585E7 /* InetAddress.cpp */; };
7CD785701E08C7B500E03BF0 /* Multicaster.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CEAF5251DBAC872006585E7 /* Multicaster.cpp */; };
7CD785711E08C7B500E03BF0 /* Network.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CEAF5291DBAC872006585E7 /* Network.cpp */; };
7CD785721E08C7B500E03BF0 /* NetworkConfig.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CEAF52B1DBAC872006585E7 /* NetworkConfig.cpp */; };
7CD785731E08C7B500E03BF0 /* Node.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CEAF52F1DBAC872006585E7 /* Node.cpp */; };
7CD785741E08C7B500E03BF0 /* OutboundMulticast.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CEAF5321DBAC872006585E7 /* OutboundMulticast.cpp */; };
7CD785751E08C7B500E03BF0 /* Packet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CEAF5341DBAC872006585E7 /* Packet.cpp */; };
7CD785761E08C7B500E03BF0 /* Path.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CEAF5361DBAC872006585E7 /* Path.cpp */; };
7CD785771E08C7B500E03BF0 /* Peer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CEAF5381DBAC872006585E7 /* Peer.cpp */; };
7CD785781E08C7B500E03BF0 /* Poly1305.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CEAF53A1DBAC872006585E7 /* Poly1305.cpp */; };
7CD785791E08C7B500E03BF0 /* Salsa20.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CEAF53D1DBAC872006585E7 /* Salsa20.cpp */; };
7CD7857A1E08C7B500E03BF0 /* SelfAwareness.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CEAF53F1DBAC872006585E7 /* SelfAwareness.cpp */; };
7CD7857B1E08C7B500E03BF0 /* SHA512.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CEAF5411DBAC872006585E7 /* SHA512.cpp */; };
7CD7857C1E08C7B500E03BF0 /* Switch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CEAF5441DBAC872006585E7 /* Switch.cpp */; };
7CD7857D1E08C7B500E03BF0 /* Topology.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CEAF5461DBAC872006585E7 /* Topology.cpp */; };
7CD7857E1E08C7B500E03BF0 /* Utils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CEAF5481DBAC872006585E7 /* Utils.cpp */; };
7CD7857F1E08C7B500E03BF0 /* Arp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CEAF4F81DBAC841006585E7 /* Arp.cpp */; };
7CD785801E08C7B500E03BF0 /* Http.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CEAF4FD1DBAC841006585E7 /* Http.cpp */; };
7CD785811E08C7B500E03BF0 /* OSUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CEAF4FF1DBAC841006585E7 /* OSUtils.cpp */; };
7CD785821E08C7B500E03BF0 /* PortMapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CEAF5021DBAC841006585E7 /* PortMapper.cpp */; };
7CD785831E08C7B500E03BF0 /* ControlPlane.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CEAF4F11DBAC80C006585E7 /* ControlPlane.cpp */; };
7CD785841E08C7C300E03BF0 /* tcp_in.c in Sources */ = {isa = PBXBuildFile; fileRef = 7CEAF5901DBADA69006585E7 /* tcp_in.c */; };
7CD785851E08C7C300E03BF0 /* tcp_out.c in Sources */ = {isa = PBXBuildFile; fileRef = 7CEAF5911DBADA69006585E7 /* tcp_out.c */; };
7CD785861E08C7C300E03BF0 /* tcp.c in Sources */ = {isa = PBXBuildFile; fileRef = 7CEAF5921DBADA69006585E7 /* tcp.c */; };
7CD785871E08C7C300E03BF0 /* err.c in Sources */ = {isa = PBXBuildFile; fileRef = 7CEAF5871DBACEC3006585E7 /* err.c */; };
7CD785881E08C7C300E03BF0 /* ethernet.c in Sources */ = {isa = PBXBuildFile; fileRef = 7CEAF5851DBACE7E006585E7 /* ethernet.c */; };
7CD785891E08C7C300E03BF0 /* tcpip.c in Sources */ = {isa = PBXBuildFile; fileRef = 7C969C7B1DBAA61700BD3F7F /* tcpip.c */; };
7CD7858A1E08C7C300E03BF0 /* autoip.c in Sources */ = {isa = PBXBuildFile; fileRef = 7C969C731DBAA5FF00BD3F7F /* autoip.c */; };
7CD7858B1E08C7C300E03BF0 /* dhcp.c in Sources */ = {isa = PBXBuildFile; fileRef = 7C969C741DBAA5FF00BD3F7F /* dhcp.c */; };
7CD7858C1E08C7C300E03BF0 /* etharp.c in Sources */ = {isa = PBXBuildFile; fileRef = 7C969C751DBAA5FF00BD3F7F /* etharp.c */; };
7CD7858D1E08C7C300E03BF0 /* icmp.c in Sources */ = {isa = PBXBuildFile; fileRef = 7C969C761DBAA5FF00BD3F7F /* icmp.c */; };
7CD7858E1E08C7C300E03BF0 /* igmp.c in Sources */ = {isa = PBXBuildFile; fileRef = 7C969C771DBAA5FF00BD3F7F /* igmp.c */; };
7CD7858F1E08C7C300E03BF0 /* ip4_addr.c in Sources */ = {isa = PBXBuildFile; fileRef = 7C969C781DBAA5FF00BD3F7F /* ip4_addr.c */; };
7CD785901E08C7C300E03BF0 /* ip4_frag.c in Sources */ = {isa = PBXBuildFile; fileRef = 7C969C791DBAA5FF00BD3F7F /* ip4_frag.c */; };
7CD785911E08C7C300E03BF0 /* ip4.c in Sources */ = {isa = PBXBuildFile; fileRef = 7C969C7A1DBAA5FF00BD3F7F /* ip4.c */; };
7CD785921E08C7E200E03BF0 /* inet_chksum.c in Sources */ = {isa = PBXBuildFile; fileRef = 7C969B3E1DB99E7900BD3F7F /* inet_chksum.c */; };
7CD785931E08C7E200E03BF0 /* init.c in Sources */ = {isa = PBXBuildFile; fileRef = 7C969B3F1DB99E7900BD3F7F /* init.c */; };
7CD785941E08C7E200E03BF0 /* ip.c in Sources */ = {isa = PBXBuildFile; fileRef = 7C969B401DB99E7900BD3F7F /* ip.c */; };
7CD785951E08C7E200E03BF0 /* mem.c in Sources */ = {isa = PBXBuildFile; fileRef = 7C969B411DB99E7900BD3F7F /* mem.c */; };
7CD785961E08C7E200E03BF0 /* memp.c in Sources */ = {isa = PBXBuildFile; fileRef = 7C969B421DB99E7900BD3F7F /* memp.c */; };
7CD785971E08C7E200E03BF0 /* netif.c in Sources */ = {isa = PBXBuildFile; fileRef = 7C969B431DB99E7900BD3F7F /* netif.c */; };
7CD785981E08C7E200E03BF0 /* pbuf.c in Sources */ = {isa = PBXBuildFile; fileRef = 7C969B441DB99E7900BD3F7F /* pbuf.c */; };
7CD785991E08C7E200E03BF0 /* raw.c in Sources */ = {isa = PBXBuildFile; fileRef = 7C969B451DB99E7900BD3F7F /* raw.c */; };
7CD7859A1E08C7E200E03BF0 /* stats.c in Sources */ = {isa = PBXBuildFile; fileRef = 7C969B461DB99E7900BD3F7F /* stats.c */; };
7CD7859B1E08C7E200E03BF0 /* sys.c in Sources */ = {isa = PBXBuildFile; fileRef = 7C969B471DB99E7900BD3F7F /* sys.c */; };
7CD7859C1E08C7E200E03BF0 /* timeouts.c in Sources */ = {isa = PBXBuildFile; fileRef = 7C969B4B1DB99E7900BD3F7F /* timeouts.c */; };
7CD7859D1E08C7E200E03BF0 /* udp.c in Sources */ = {isa = PBXBuildFile; fileRef = 7C969B4C1DB99E7900BD3F7F /* udp.c */; };
7CD7859E1E08C7E200E03BF0 /* json.c in Sources */ = {isa = PBXBuildFile; fileRef = 7C0463251DE362BD003E2B0E /* json.c */; };
7CD7859F1E08C87A00E03BF0 /* proxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C7D527A1DBEADD200896C93 /* proxy.cpp */; };
7CD785A01E08C87A00E03BF0 /* def.c in Sources */ = {isa = PBXBuildFile; fileRef = 7C969B3C1DB99E7900BD3F7F /* def.c */; };
7CD785A11E08C87A00E03BF0 /* dns.c in Sources */ = {isa = PBXBuildFile; fileRef = 7C969B3D1DB99E7900BD3F7F /* dns.c */; };
7CEAF4F61DBAC80C006585E7 /* ControlPlane.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CEAF4F11DBAC80C006585E7 /* ControlPlane.cpp */; };
7CEAF5071DBAC841006585E7 /* Arp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CEAF4F81DBAC841006585E7 /* Arp.cpp */; };
7CEAF5091DBAC841006585E7 /* Http.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CEAF4FD1DBAC841006585E7 /* Http.cpp */; };
@@ -1148,6 +1213,71 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
7CD7859F1E08C87A00E03BF0 /* proxy.cpp in Sources */,
7CD7858A1E08C7C300E03BF0 /* autoip.c in Sources */,
7CD7858B1E08C7C300E03BF0 /* dhcp.c in Sources */,
7CD7858C1E08C7C300E03BF0 /* etharp.c in Sources */,
7CD7858D1E08C7C300E03BF0 /* icmp.c in Sources */,
7CD7858E1E08C7C300E03BF0 /* igmp.c in Sources */,
7CD7858F1E08C7C300E03BF0 /* ip4_addr.c in Sources */,
7CD785901E08C7C300E03BF0 /* ip4_frag.c in Sources */,
7CD785911E08C7C300E03BF0 /* ip4.c in Sources */,
7CD785A01E08C87A00E03BF0 /* def.c in Sources */,
7CD785A11E08C87A00E03BF0 /* dns.c in Sources */,
7CD785841E08C7C300E03BF0 /* tcp_in.c in Sources */,
7CD785851E08C7C300E03BF0 /* tcp_out.c in Sources */,
7CD785861E08C7C300E03BF0 /* tcp.c in Sources */,
7CD785921E08C7E200E03BF0 /* inet_chksum.c in Sources */,
7CD785931E08C7E200E03BF0 /* init.c in Sources */,
7CD785941E08C7E200E03BF0 /* ip.c in Sources */,
7CD785951E08C7E200E03BF0 /* mem.c in Sources */,
7CD785961E08C7E200E03BF0 /* memp.c in Sources */,
7CD785971E08C7E200E03BF0 /* netif.c in Sources */,
7CD785981E08C7E200E03BF0 /* pbuf.c in Sources */,
7CD785991E08C7E200E03BF0 /* raw.c in Sources */,
7CD7859A1E08C7E200E03BF0 /* stats.c in Sources */,
7CD7859B1E08C7E200E03BF0 /* sys.c in Sources */,
7CD7859C1E08C7E200E03BF0 /* timeouts.c in Sources */,
7CD7859D1E08C7E200E03BF0 /* udp.c in Sources */,
7CD7859E1E08C7E200E03BF0 /* json.c in Sources */,
7CD785871E08C7C300E03BF0 /* err.c in Sources */,
7CD785881E08C7C300E03BF0 /* ethernet.c in Sources */,
7CD785891E08C7C300E03BF0 /* tcpip.c in Sources */,
7CD785601E08C7B500E03BF0 /* lwip.cpp in Sources */,
7CD785611E08C7B500E03BF0 /* rpc.c in Sources */,
7CD785621E08C7B500E03BF0 /* service.cpp in Sources */,
7CD785631E08C7B500E03BF0 /* sockets.c in Sources */,
7CD785641E08C7B500E03BF0 /* tap.cpp in Sources */,
7CD785661E08C7B500E03BF0 /* ManagedRoute.cpp in Sources */,
7CD785671E08C7B500E03BF0 /* BackgroundResolver.cpp in Sources */,
7CD785681E08C7B500E03BF0 /* DeferredPackets.cpp in Sources */,
7CD785691E08C7B500E03BF0 /* OneService.cpp in Sources */,
7CD7856A1E08C7B500E03BF0 /* C25519.cpp in Sources */,
7CD7856B1E08C7B500E03BF0 /* CertificateOfMembership.cpp in Sources */,
7CD7856C1E08C7B500E03BF0 /* Cluster.cpp in Sources */,
7CD7856D1E08C7B500E03BF0 /* Identity.cpp in Sources */,
7CD7856E1E08C7B500E03BF0 /* IncomingPacket.cpp in Sources */,
7CD7856F1E08C7B500E03BF0 /* InetAddress.cpp in Sources */,
7CD785701E08C7B500E03BF0 /* Multicaster.cpp in Sources */,
7CD785711E08C7B500E03BF0 /* Network.cpp in Sources */,
7CD785721E08C7B500E03BF0 /* NetworkConfig.cpp in Sources */,
7CD785731E08C7B500E03BF0 /* Node.cpp in Sources */,
7CD785741E08C7B500E03BF0 /* OutboundMulticast.cpp in Sources */,
7CD785751E08C7B500E03BF0 /* Packet.cpp in Sources */,
7CD785761E08C7B500E03BF0 /* Path.cpp in Sources */,
7CD785771E08C7B500E03BF0 /* Peer.cpp in Sources */,
7CD785781E08C7B500E03BF0 /* Poly1305.cpp in Sources */,
7CD785791E08C7B500E03BF0 /* Salsa20.cpp in Sources */,
7CD7857A1E08C7B500E03BF0 /* SelfAwareness.cpp in Sources */,
7CD7857B1E08C7B500E03BF0 /* SHA512.cpp in Sources */,
7CD7857C1E08C7B500E03BF0 /* Switch.cpp in Sources */,
7CD7857D1E08C7B500E03BF0 /* Topology.cpp in Sources */,
7CD7857E1E08C7B500E03BF0 /* Utils.cpp in Sources */,
7CD7857F1E08C7B500E03BF0 /* Arp.cpp in Sources */,
7CD785801E08C7B500E03BF0 /* Http.cpp in Sources */,
7CD785811E08C7B500E03BF0 /* OSUtils.cpp in Sources */,
7CD785821E08C7B500E03BF0 /* PortMapper.cpp in Sources */,
7CD785831E08C7B500E03BF0 /* ControlPlane.cpp in Sources */,
7CC005201D1324B3003E68DC /* lz4.c in Sources */,
7CC005211D1324B3003E68DC /* http_parser.c in Sources */,
);
@@ -1411,7 +1541,6 @@
"-DSDK_BUNDLED",
"-DSDK_DEBUG",
"-D__XCODE__",
"-DLWIP_DEBUG",
"-DSDK_IPV4",
"-DUSING_BRIDGING_HEADER",
"-DSDK_LWIP",
@@ -1466,6 +1595,8 @@
"$(SRCROOT)/../../../ext/lwip/src/include/ipv4/",
"$(SRCROOT)/../../../zerotierone",
"$(SRCROOT)/../../../ext/lwip/src/include/",
"$(SRCROOT)/../../../ext",
"$(SRCROOT)/../../../src",
);
INFOPLIST_FILE = ZeroTierSDK_Unity3D_OSX/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles";
@@ -1474,6 +1605,8 @@
"-DSDK",
"-D__UNITY_3D__",
"-DSDK_BUNDLED",
"-DSDK_IPV4=1",
"-DSDK_LWIP=1",
);
PRODUCT_BUNDLE_IDENTIFIER = "zerotier.ZeroTierSDK-Unity3D-OSX";
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -1490,6 +1623,8 @@
"$(SRCROOT)/../../../ext/lwip/src/include/ipv4/",
"$(SRCROOT)/../../../zerotierone",
"$(SRCROOT)/../../../ext/lwip/src/include/",
"$(SRCROOT)/../../../ext",
"$(SRCROOT)/../../../src",
);
INFOPLIST_FILE = ZeroTierSDK_Unity3D_OSX/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles";
@@ -1499,6 +1634,8 @@
"-DUSE_SOCKS_PROXY",
"-D__UNITY_3D__",
"-DSDK_BUNDLED",
"-DSDK_IPV4=1",
"-DSDK_LWIP=1",
);
PRODUCT_BUNDLE_IDENTIFIER = "zerotier.ZeroTierSDK-Unity3D-OSX";
PRODUCT_NAME = "$(TARGET_NAME)";

View File

@@ -32,7 +32,7 @@ CXXFLAGS=$(CFLAGS) -fno-rtti
include objects.mk
# Target output filenames
SHARED_LIB_NAME = libztlinux.so
STATIC_LIB_NAME = libzt.a
SDK_INTERCEPT_NAME = libztintercept.so
SDK_SERVICE_NAME = zerotier-sdk-service
ONE_SERVICE_NAME = zerotier-one
@@ -41,7 +41,7 @@ ONE_ID_TOOL_NAME = zerotier-idtool
LWIP_LIB_NAME = liblwip.so
PICO_LIB_NAME = libpicotcp.so
#
SHARED_LIB = $(BUILD)/$(SHARED_LIB_NAME)
STATIC_LIB = $(BUILD)/$(STATIC_LIB_NAME)
SDK_INTERCEPT = $(BUILD)/$(SDK_INTERCEPT_NAME)
SDK_SERVICE = $(BUILD)/$(SDK_SERVICE_NAME)
ONE_SERVICE = $(BUILD)/$(ONE_SERVICE_NAME)
@@ -178,7 +178,7 @@ jip:
# ------------------------------------------------------------------------------
# Build everything
linux: one linux_service_and_intercept linux_shared_lib
linux: one linux_service_and_intercept linux_static_lib
# Build vanilla ZeroTier One binary
one: $(OBJS) $(ZT1)/service/OneService.o $(ZT1)/one.o $(ZT1)/osdep/LinuxEthernetTap.o
@@ -216,10 +216,10 @@ endif
# Build both intercept library and SDK service (separate)
linux_service_and_intercept: linux_intercept linux_sdk_service
# Builds a single shared library which contains everything
# Builds a single static library which contains everything
linux_static_lib: pico $(OBJS)
$(CXX) $(CXXFLAGS) $(STACK_FLAGS) $(DEFS) $(INCLUDES) $(ZTFLAGS) -DSDK_SERVICE -DSDK -DSDK_BUNDLED $(PICO_DRIVER_FILES) $(SDK_INTERCEPT_C_FILES) $(SDK_SERVICE_CPP_FILES) src/service.cpp -c
ar -rcs build/libzt.a picotcp.o proxy.o tap.o one.o OneService.o service.o sockets.o rpc.o intercept.o OneService.o $(OBJS)
ar -rcs build/libzt.a picotcp.o proxy.o tap.o one.o OneService.o service.o sockets.o rpc.o intercept.o $(OBJS)
# Builds zts_* library tests
linux_static_lib_tests:
@@ -308,7 +308,7 @@ check:
-./check.sh $(SDK_INTERCEPT)
-./check.sh $(ONE_SERVICE)
-./check.sh $(SDK_SERVICE)
-./check.sh $(SHARED_LIB)
-./check.sh $(STATIC_LIB)
-./check.sh $(BUILD)/android_jni_lib/arm64-v8a/libZeroTierOneJNI.so
-./check.sh $(BUILD)/android_jni_lib/armeabi/libZeroTierOneJNI.so
-./check.sh $(BUILD)/android_jni_lib/armeabi-v7a/libZeroTierOneJNI.so
@@ -323,16 +323,9 @@ TEST_OBJDIR := $(BUILD)/tests
TEST_SOURCES := $(wildcard tests/api_test/*.c)
TEST_TARGETS := $(addprefix $(BUILD)/tests/$(OSTYPE).,$(notdir $(TEST_SOURCES:.c=.out)))
LIB_TEST_SOURCES := $(wildcard tests/shared_test/*.c)
LIB_TEST_TARGETS := $(addprefix $(BUILD)/tests/$(OSTYPE).,$(notdir $(LIB_TEST_SOURCES:.c=.out)))
$(BUILD)/tests/$(OSTYPE).%.out: tests/api_test/%.c
-$(CC) $(CC_FLAGS) -o $@ $<
$(BUILD)/tests/$(OSTYPE).%.out: tests/shared_test/%.c
#-$(CC) $(CC_FLAGS) -o $@ $<
-$(CXX) $(CXXFLAGS) $(LDFLAGS) $(INCLUDES) $(STACK_FLAGS) $(DEFS) -DSDK_SERVICE -DSDK -DSDK_BUNDLED -Isrc tests/shared_test/zts.tcpserver4.c -Lbuild -lzt -ldl -o $@ $<
$(TEST_OBJDIR):
mkdir -p $(TEST_OBJDIR)

View File

@@ -32,7 +32,7 @@ CXXFLAGS=$(CFLAGS) -fno-rtti
include objects.mk
# Target output filenames
SHARED_LIB_NAME = libztosx.so
STATIC_LIB_NAME = libzt.a
INTERCEPT_NAME = libztintercept.so
SDK_SERVICE_NAME = zerotier-sdk-service
ONE_SERVICE_NAME = zerotier-one
@@ -41,7 +41,7 @@ ONE_ID_TOOL_NAME = zerotier-idtool
LWIP_LIB_NAME = liblwip.so
PICO_LIB_NAME = libpicotcp.so
#
SHARED_LIB = $(BUILD)/$(SHARED_LIB_NAME)
STATIC_LIB = $(BUILD)/$(STATIC_LIB_NAME)
SDK_INTERCEPT = $(BUILD)/$(INTERCEPT_NAME)
SDK_SERVICE = $(BUILD)/$(SDK_SERVICE_NAME)
ONE_SERVICE = $(BUILD)/$(ONE_SERVICE_NAME)
@@ -91,6 +91,7 @@ CODESIGN_INSTALLER_CERT=
# Debug output for ZeroTier service
ifeq ($(ZT_DEBUG),1)
DEFS+=-DZT_TRACE
#CFLAGS+=-Wall -fPIE -fvisibility=hidden -pthread $(INCLUDES) $(DEFS)
CFLAGS+=-Wall -g -pthread $(INCLUDES) $(DEFS)
STRIP=echo
# The following line enables optimization for the crypto code, since
@@ -98,7 +99,8 @@ ifeq ($(ZT_DEBUG),1)
#ext/lz4/lz4.o node/Salsa20.o node/SHA512.o node/C25519.o node/Poly1305.o: CFLAGS = -Wall -O2 -g -pthread $(INCLUDES) $(DEFS)
else
CFLAGS?=-Ofast -fstack-protector
CFLAGS+=$(ARCH_FLAGS) -Wall -flto -fPIE -pthread -mmacosx-version-min=10.7 -DNDEBUG -Wno-unused-private-field $(INCLUDES) $(DEFS)
CFLAGS+=-Wall -fPIE -fvisibility=hidden -pthread $(INCLUDES) $(DEFS)
#CFLAGS+=$(ARCH_FLAGS) -Wall -flto -fPIC -pthread -mmacosx-version-min=10.7 -DNDEBUG -Wno-unused-private-field $(INCLUDES) $(DEFS)
STRIP=strip
endif
@@ -184,7 +186,7 @@ one: $(OBJS) $(ZT1)/service/OneService.o $(ZT1)/one.o $(ZT1)/osdep/OSXEthernetTa
ios: ios_app_framework ios_unity3d_bundle
# Build all OSX targets
osx: osx_app_framework osx_unity3d_bundle osx_sdk_service osx_intercept
osx: osx_app_framework osx_unity3d_bundle osx_sdk_service osx_intercept osx_static_lib
# ---------------------------------------
# ----------- App Frameworks ------------
@@ -248,11 +250,11 @@ osx_service_and_intercept: osx_intercept osx_sdk_service
ifeq ($(SDK_LWIP),1)
osx_static_lib: lwip $(OBJS)
$(CXX) $(CXXFLAGS) $(STACK_FLAGS) $(DEFS) $(INCLUDES) $(ZTFLAGS) -DSDK_SERVICE -DSDK -DSDK_BUNDLED $(LWIP_DRIVER_FILES) $(SDK_INTERCEPT_C_FILES) $(SDK_SERVICE_CPP_FILES) src/service.cpp -c
libtool -static -o build/libzt.a lwip.o proxy.o tap.o one.o OneService.o service.o sockets.o rpc.o intercept.o OneService.o $(OBJS)
ar -rcs build/libzt.a lwip.o proxy.o tap.o one.o OneService.o service.o sockets.o rpc.o intercept.o $(OBJS)
else
osx_static_lib: pico $(OBJS)
$(CXX) $(CXXFLAGS) $(STACK_FLAGS) $(DEFS) $(INCLUDES) $(ZTFLAGS) -DSDK_SERVICE -DSDK -DSDK_BUNDLED $(PICO_DRIVER_FILES) $(SDK_INTERCEPT_C_FILES) $(SDK_SERVICE_CPP_FILES) src/service.cpp -c
libtool -static -o build/libzt.a picotcp.o proxy.o tap.o one.o OneService.o service.o sockets.o rpc.o intercept.o OneService.o $(OBJS)
libtool -static -o build/libzt.a lwip.o proxy.o tap.o one.o OneService.o service.o sockets.o rpc.o intercept.o OneService.o $(OBJS)
endif
# Builds zts_* library tests
@@ -261,10 +263,6 @@ osx_static_lib_tests:
$(CXX) $(CXXFLAGS) $(LDFLAGS) $(INCLUDES) $(STACK_FLAGS) $(DEFS) -DSDK_SERVICE -DSDK -DSDK_BUNDLED -Isrc tests/shared_test/zts.tcpserver4.c -o $(TEST_OBJDIR)/$(OSTYPE).zts.tcpserver4.out -Lbuild -lzt -ldl
$(CXX) $(CXXFLAGS) $(LDFLAGS) $(INCLUDES) $(STACK_FLAGS) $(DEFS) -DSDK_SERVICE -DSDK -DSDK_BUNDLED -Isrc tests/shared_test/zts.tcpclient4.c -o $(TEST_OBJDIR)/$(OSTYPE).zts.tcpclient4.out -Lbuild -lzt -ldl
osx_dynamic_lib:
osx_dynamic_lib_tests:
# ------------------------------------------------------------------------------
# ---------------------------------- Android -----------------------------------
# ------------------------------------------------------------------------------
@@ -277,7 +275,6 @@ android: android_jni_lib
# Build library for Android Unity integrations
# Build JNI library for Android app integration
android_jni_lib:
-./increment.sh
cd $(INT)/android/android_jni_lib/proj; ./gradlew assembleDebug
mkdir -p $(BUILD)/android_jni_lib
cp docs/android.md $(BUILD)/android_jni_lib/README.md
@@ -295,7 +292,7 @@ check:
-./check.sh $(SDK_INTERCEPT)
-./check.sh $(ONE_SERVICE)
-./check.sh $(SDK_SERVICE)
-./check.sh $(SHARED_LIB)
-./check.sh $(STATIC_LIB)
-./check.sh $(BUILD)/osx_unity3d_bundle/Debug/ZeroTierSDK_Unity3D_OSX.bundle
-./check.sh $(BUILD)/osx_app_framework/Debug/ZeroTierSDK_OSX.framework
-./check.sh $(BUILD)/ios_app_framework/Debug-iphoneos/ZeroTierSDK_iOS.framework

View File

@@ -95,6 +95,8 @@ extern "C" {
#if defined(__ANDROID__)
#define DEBUG_INFO(fmt, args...) ((void)__android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, "ZT_INFO : %14s:%4d:%20s: " fmt "\n", __FILENAME__, __LINE__, __FUNCTION__, ##args))
#define DEBUG_BLANK(fmt, args...) ((void)__android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, "ZT_INFO : %14s:%4d:" fmt "\n", __FILENAME__, __LINE__, __FUNCTION__, ##args))
#define DEBUG_ATTN(fmt, args...) ((void)__android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, "ZT_INFO : %14s:%4d:%25s: " fmt "\n", __FILENAME__, __LINE__, __FUNCTION__, ##args))
#define DEBUG_STACK(fmt, args...) ((void)__android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, "ZT_STACK: %14s:%4d:%25s: " fmt "\n", __FILENAME__, __LINE__, __FUNCTION__, ##args))
#else
#define DEBUG_INFO(fmt, args...) fprintf(stderr, "ZT_INFO : %14s:%4d:%25s: " fmt "\n", __FILENAME__, __LINE__, __FUNCTION__, ##args)
#define DEBUG_ATTN(fmt, args...) fprintf(stderr, CYN "ZT_INFO : %14s:%4d:%25s: " fmt "\n" RESET, __FILENAME__, __LINE__, __FUNCTION__, ##args)

View File

@@ -163,7 +163,10 @@ void zts_stop_service() {
bool zts_has_address(const char *nwid)
{
DEBUG_ERROR();
char ipv4_addr[64], ipv6_addr[64];
memset(ipv4_addr, 0, 64);
memset(ipv6_addr, 0, 64);
zts_get_ipv4_address(nwid, ipv4_addr);
zts_get_ipv6_address(nwid, ipv6_addr);
if(!strcmp(ipv4_addr, "-1.-1.-1.-1/-1") && !strcmp(ipv4_addr, "-1.-1.-1.-1/-1")) {
@@ -363,7 +366,7 @@ void zts_start_service(const char *path)
const char *nwid_str = env->GetStringUTFChars(nwid, NULL);
char address_string[32];
memset(address_string, 0, 32);
zts_get_addresses(nwid_str, address_string);
zts_get_ipv4_address(nwid_str, address_string);
jclass clazz = (*env).FindClass("java/util/ArrayList");
jobject addresses = (*env).NewObject(clazz, (*env).GetMethodID(clazz, "<init>", "()V"));
jstring _str = (*env).NewStringUTF(address_string);
@@ -375,7 +378,7 @@ void zts_start_service(const char *path)
const char *nwid_str = env->GetStringUTFChars(nwid, NULL);
char address_string[32];
memset(address_string, 0, 32);
zts_get_addresses(nwid_str, address_string);
zts_get_ipv6_address(nwid_str, address_string);
jclass clazz = (*env).FindClass("java/util/ArrayList");
jobject addresses = (*env).NewObject(clazz, (*env).GetMethodID(clazz, "<init>", "()V"));
jstring _str = (*env).NewStringUTF(address_string);
@@ -436,13 +439,10 @@ void zts_start_service(const char *path)
void *zts_start_core_service(void *thread_id) {
#if defined(SDK_BUNDLED)
if(thread_id)
homeDir = std::string((char*)thread_id);
#endif
#if defined(__ANDROID__)
DEBUG_INFO("ZTSDK_BUILD_VERSION = %d", ZTSDK_BUILD_VERSION);
#endif
char current_dir[MAX_DIR_SZ];
//#if defined(SDK_BUNDLED) && !defined(__ANDROID__)
@@ -510,6 +510,7 @@ void *zts_start_core_service(void *thread_id) {
#if defined(__UNITY_3D__)
DEBUG_INFO("starting service...");
#endif
DEBUG_INFO("starting service...");
// Initialize RPC
// TODO: remove?

View File

@@ -130,7 +130,7 @@ int (*realclose)(CLOSE_SIG);
DEBUG_ATTN("waiting for service to assign address to network stack");
// wait for zt service to assign the network stack an address
sleep(1);
while(!zts_has_address(nwid)) { }
while(!zts_has_address(nwid)) { usleep(1000); }
}
#endif
}

View File

@@ -350,8 +350,10 @@ namespace ZeroTier {
#define __DYNAMIC_STACK__
// Dynamically load liblwip.so
_libref = dlopen(path, RTLD_NOW);
#else
#define __STATIC_STACK__
#elif TARGET_OS_MAC && defined(SDK_BUNDLED)
#define __DYNAMIC_STACK__ // TODO: Implement static version
// Dynamically load liblwip.so
_libref = dlopen(path, RTLD_NOW);
#endif
#endif

View File

@@ -137,7 +137,6 @@ namespace ZeroTier {
void (*_pico_stack_tick)(void);
int (*_pico_string_to_ipv4)(PICO_STRING_TO_IPV4_SIG);
int (*_pico_ipv4_to_string)(PICO_IPV4_TO_STRING_SIG);
struct pico_device* (*_pico_tap_create)(PICO_TAP_CREATE_SIG);
int (*_pico_ipv4_link_add)(PICO_IPV4_LINK_ADD_SIG);
int (*_pico_device_init)(PICO_DEVICE_INIT_SIG);
int32_t (*_pico_stack_recv)(PICO_STACK_RECV_SIG);
@@ -200,7 +199,6 @@ namespace ZeroTier {
_pico_stack_init = (void(*)(void))&pico_stack_init;
_pico_stack_tick = (void(*)(void))&pico_stack_tick;
_pico_tap_create = (struct pico_device*(*)(PICO_TAP_CREATE_SIG))&pico_tap_create;
_pico_string_to_ipv4 = (int(*)(PICO_STRING_TO_IPV4_SIG))&pico_string_to_ipv4;
_pico_ipv4_to_string = (int(*)(PICO_IPV4_TO_STRING_SIG))&pico_ipv4_to_string;
_pico_ipv4_link_add = (int(*)(PICO_IPV4_LINK_ADD_SIG))&pico_ipv4_link_add;
@@ -234,7 +232,6 @@ namespace ZeroTier {
_pico_stack_init = (void(*)(void))dlsym(_libref, "pico_stack_init");
_pico_stack_tick = (void(*)(void))dlsym(_libref, "pico_stack_tick");
_pico_tap_create = (struct pico_device*(*)(PICO_TAP_CREATE_SIG))dlsym(_libref, "pico_tap_create");
_pico_string_to_ipv4 = (int(*)(PICO_STRING_TO_IPV4_SIG))dlsym(_libref, "pico_string_to_ipv4");
_pico_ipv4_to_string = (int(*)(PICO_IPV4_TO_STRING_SIG))dlsym(_libref, "pico_ipv4_to_string");
_pico_ipv4_link_add = (int(*)(PICO_IPV4_LINK_ADD_SIG))dlsym(_libref, "pico_ipv4_link_add");
@@ -270,7 +267,6 @@ namespace ZeroTier {
inline void __pico_stack_init(void) throw() { DEBUG_STACK(); Mutex::Lock _l(_lock); _pico_stack_init(); }
inline void __pico_stack_tick(void) throw() { /*DEBUG_STACK();*/ Mutex::Lock _l(_lock); _pico_stack_tick(); }
inline struct pico_device * __pico_tap_create(PICO_TAP_CREATE_SIG) throw() { DEBUG_STACK(); Mutex::Lock _l(_lock); return _pico_tap_create(name); }
inline int __pico_ipv4_to_string(PICO_IPV4_TO_STRING_SIG) throw() { DEBUG_STACK(); Mutex::Lock _l(_lock); return _pico_ipv4_to_string(ipbuf, ip); }
inline int __pico_ipv4_link_add(PICO_IPV4_LINK_ADD_SIG) throw() { DEBUG_STACK(); /*Mutex::Lock _l(_lock);*/ return _pico_ipv4_link_add(dev, address, netmask); }
inline int __pico_device_init(PICO_DEVICE_INIT_SIG) throw() { DEBUG_STACK(); Mutex::Lock _l(_lock); return _pico_device_init(dev, name, mac); }

View File

@@ -50,9 +50,7 @@
#if defined(SDK_LWIP)
#include "netif/etharp.h"
#include "lwip.hpp"
#endif
#if defined(SDK_PICOTCP)
#elif defined(SDK_PICOTCP)
#include "picotcp.hpp"
#include "pico_protocol.h"
#endif

View File

@@ -164,6 +164,7 @@ public:
#else // not __WINDOWS__
/*
struct ifaddrs *ifatbl = (struct ifaddrs *)0;
struct ifaddrs *ifa;
if ((getifaddrs(&ifatbl) == 0)&&(ifatbl)) {
@@ -188,6 +189,7 @@ public:
}
freeifaddrs(ifatbl);
}
*/
#endif

View File

@@ -177,6 +177,7 @@ std::vector<InetAddress> OSUtils::resolve(const char *name)
std::vector<InetAddress>::iterator i;
InetAddress tmp;
struct addrinfo *ai = (struct addrinfo *)0,*p;
/*
if (!getaddrinfo(name,(const char *)0,(const struct addrinfo *)0,&ai)) {
try {
p = ai;
@@ -196,6 +197,7 @@ skip_add_inetaddr:
freeaddrinfo(ai);
}
std::sort(r.begin(),r.end());
*/
return r;
}