diff --git a/integrations/Android/java/jni/Android.mk b/integrations/Android/java/jni/Android.mk index 638e029..859cb40 100644 --- a/integrations/Android/java/jni/Android.mk +++ b/integrations/Android/java/jni/Android.mk @@ -2,24 +2,28 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) +ZTSDK := ../../../../src +ZT := ../../../../zerotierone + LOCAL_MODULE := ZeroTierOneJNI LOCAL_C_INCLUDES := $(ZT1)/include LOCAL_C_INCLUDES += $(ZT1)/ext/lwip/src/include LOCAL_C_INCLUDES += $(ZT1)/ext/lwip/src/include/ipv4 -LOCAL_C_INCLUDES += $(ZT1)/netcon +LOCAL_C_INCLUDES += $(ZT1)/node +LOCAL_C_INCLUDES += $(ZT1)/ LOCAL_C_INCLUDES += $(ZT1)/service LOCAL_C_INCLUDES += $(ZT1)/osdep -LOCAL_C_INCLUDES += $(ZT1)/node +LOCAL_C_INCLUDES += $(ZTSDK)/src LOCAL_LDLIBS := -llog # LOCAL_CFLAGS := -g # Netcon files LOCAL_SRC_FILES := \ - $(ZT1)/src/SDK_RPC.c \ - $(ZT1)/src/SDK_Proxy.cpp \ - $(ZT1)/src/SDK_ServiceSetup.cpp \ - $(ZT1)/src/SDK_EthernetTap.cpp + $(ZTSDK)/SDK_RPC.c \ + $(ZTSDK)/SDK_Proxy.cpp \ + $(ZTSDK)/SDK_ServiceSetup.cpp \ + $(ZTSDK)/SDK_EthernetTap.cpp # ZeroTierOne ext files LOCAL_SRC_FILES += \ @@ -39,70 +43,70 @@ LOCAL_SRC_FILES += \ $(ZT1)/node/IncomingPacket.cpp \ $(ZT1)/node/InetAddress.cpp \ $(ZT1)/node/Multicaster.cpp \ - $(ZT1)/node/Network.cpp \ - $(ZT1)/node/NetworkConfig.cpp \ - $(ZT1)/node/Node.cpp \ - $(ZT1)/node/OutboundMulticast.cpp \ - $(ZT1)/node/Packet.cpp \ - $(ZT1)/node/Path.cpp \ - $(ZT1)/node/Peer.cpp \ - $(ZT1)/node/Poly1305.cpp \ - $(ZT1)/node/Salsa20.cpp \ - $(ZT1)/node/SelfAwareness.cpp \ - $(ZT1)/node/SHA512.cpp \ - $(ZT1)/node/Switch.cpp \ - $(ZT1)/node/Topology.cpp \ - $(ZT1)/node/Utils.cpp \ - $(ZT1)/osdep/Http.cpp \ - $(ZT1)/osdep/OSUtils.cpp \ - $(ZT1)/osdep/BackgroundResolver.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/BackgroundResolver.cpp # lwIP api files LOCAL_SRC_FILES += \ - $(ZT1)/ext/lwip/src/api/api_lib.c \ - $(ZT1)/ext/lwip/src/api/api_msg.c \ - $(ZT1)/ext/lwip/src/api/err.c \ - $(ZT1)/ext/lwip/src/api/netbuf.c \ - $(ZT1)/ext/lwip/src/api/netdb.c \ - $(ZT1)/ext/lwip/src/api/netifapi.c \ - $(ZT1)/ext/lwip/src/api/sockets.c \ - $(ZT1)/ext/lwip/src/api/tcpip.c + $(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 += \ - $(ZT1)/ext/lwip/src/core/def.c \ - $(ZT1)/ext/lwip/src/core/dhcp.c \ - $(ZT1)/ext/lwip/src/core/dns.c \ - $(ZT1)/ext/lwip/src/core/init.c \ - $(ZT1)/ext/lwip/src/core/mem.c \ - $(ZT1)/ext/lwip/src/core/memp.c \ - $(ZT1)/ext/lwip/src/core/netif.c \ - $(ZT1)/ext/lwip/src/core/pbuf.c \ - $(ZT1)/ext/lwip/src/core/raw.c \ - $(ZT1)/ext/lwip/src/core/stats.c \ - $(ZT1)/ext/lwip/src/core/sys.c \ - $(ZT1)/ext/lwip/src/core/tcp_in.c \ - $(ZT1)/ext/lwip/src/core/tcp_out.c \ - $(ZT1)/ext/lwip/src/core/tcp.c \ - $(ZT1)/ext/lwip/src/core/timers.c \ - $(ZT1)/ext/lwip/src/core/udp.c + $(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 core/ip4 files LOCAL_SRC_FILES += \ - $(ZT1)/ext/lwip/src/core/ipv4/autoip.c \ - $(ZT1)/ext/lwip/src/core/ipv4/icmp.c \ - $(ZT1)/ext/lwip/src/core/ipv4/igmp.c \ - $(ZT1)/ext/lwip/src/core/ipv4/inet_chksum.c \ - $(ZT1)/ext/lwip/src/core/ipv4/inet.c \ - $(ZT1)/ext/lwip/src/core/ipv4/ip_addr.c \ - $(ZT1)/ext/lwip/src/core/ipv4/ip_frag.c \ - $(ZT1)/ext/lwip/src/core/ipv4/ip.c \ + $(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 += \ - $(ZT1)/ext/lwip/src/netif/etharp.c \ - $(ZT1)/ext/lwip/src/netif/ethernetif.c \ - $(ZT1)/ext/lwip/src/netif/slipif.c + $(ZT)/ext/lwip/src/netif/etharp.c \ + $(ZT)/ext/lwip/src/netif/ethernetif.c \ + $(ZT)/ext/lwip/src/netif/slipif.c # JNI Files LOCAL_SRC_FILES += \ diff --git a/integrations/Android/proj/app/app.iml b/integrations/Android/proj/app/app.iml index 849ac37..ee8e8ab 100644 --- a/integrations/Android/proj/app/app.iml +++ b/integrations/Android/proj/app/app.iml @@ -51,6 +51,7 @@ + @@ -58,12 +59,14 @@ + + @@ -71,6 +74,7 @@ + @@ -78,16 +82,23 @@ + + + + + + + diff --git a/integrations/Android/proj/app/build.gradle b/integrations/Android/proj/app/build.gradle index 0716500..5f63419 100644 --- a/integrations/Android/proj/app/build.gradle +++ b/integrations/Android/proj/app/build.gradle @@ -29,9 +29,9 @@ android { } task ndkBuild(type: Exec) { if (Os.isFamily(Os.FAMILY_WINDOWS)) { - commandLine "${android.getNdkDirectory().getAbsolutePath()}/ndk-build.cmd", '-j8', '-C', file('../../java').absolutePath, "ZT1=${System.getProperty('user.dir')}/../../.." + commandLine "${android.getNdkDirectory().getAbsolutePath()}/ndk-build.cmd", '-j8', '-C', file('../../java').absolutePath, "ZT1=${System.getProperty('user.dir')}/../../../../zerotierone" } else { - commandLine "${android.getNdkDirectory().getAbsolutePath()}/ndk-build", '-j8', '-C', file('../../java').absolutePath, "ZT1=${System.getProperty('user.dir')}/../../.." + commandLine "${android.getNdkDirectory().getAbsolutePath()}/ndk-build", '-j8', '-C', file('../../java').absolutePath, "ZT1=${System.getProperty('user.dir')}/../../../zerotierone" } } tasks.withType(JavaCompile) { diff --git a/integrations/Android/proj/app/src/main/java/com/zerotier/one/service/ZeroTierOneService.java b/integrations/Android/proj/app/src/main/java/com/zerotier/one/service/ZeroTierOneService.java index bc64530..5aa1aa7 100644 --- a/integrations/Android/proj/app/src/main/java/com/zerotier/one/service/ZeroTierOneService.java +++ b/integrations/Android/proj/app/src/main/java/com/zerotier/one/service/ZeroTierOneService.java @@ -93,7 +93,7 @@ public class ZeroTierOneService extends VpnService implements Runnable, EventLis networkConfigs = new HashMap<>(); eventBus.register(this); - Netcon.NetconWrapper wrapper = new Netcon.NetconWrapper(); + Netcon.ZT_SDK_Wrapper wrapper = new Netcon.ZT_SDK_Wrapper(); wrapper.startOneService(); diff --git a/integrations/Android/proj/build.gradle b/integrations/Android/proj/build.gradle index 2174a6b..1f0a3fa 100644 --- a/integrations/Android/proj/build.gradle +++ b/integrations/Android/proj/build.gradle @@ -5,7 +5,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:1.3.0' + classpath 'com.android.tools.build:gradle:2.1.0' classpath 'com.google.gms:google-services:1.3.0-beta1' // NOTE: Do not place your application dependencies here; they belong diff --git a/integrations/Android/proj/build/intermediates/dex-cache/cache.xml b/integrations/Android/proj/build/intermediates/dex-cache/cache.xml new file mode 100644 index 0000000..9223a95 --- /dev/null +++ b/integrations/Android/proj/build/intermediates/dex-cache/cache.xml @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/integrations/Android/proj/gradle/wrapper/gradle-wrapper.properties b/integrations/Android/proj/gradle/wrapper/gradle-wrapper.properties index fd27bdf..d570517 100644 --- a/integrations/Android/proj/gradle/wrapper/gradle-wrapper.properties +++ b/integrations/Android/proj/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip diff --git a/integrations/Android/proj/gradlew b/integrations/Android/proj/gradlew old mode 100644 new mode 100755 diff --git a/integrations/Android/proj/proj.iml b/integrations/Android/proj/proj.iml index 16853d9..2c2e416 100644 --- a/integrations/Android/proj/proj.iml +++ b/integrations/Android/proj/proj.iml @@ -13,7 +13,7 @@ - + \ No newline at end of file diff --git a/integrations/Apple/ZeroTierSDK_Apple/ZeroTierSDK_Apple.xcodeproj/project.xcworkspace/xcuserdata/Joseph.xcuserdatad/UserInterfaceState.xcuserstate b/integrations/Apple/ZeroTierSDK_Apple/ZeroTierSDK_Apple.xcodeproj/project.xcworkspace/xcuserdata/Joseph.xcuserdatad/UserInterfaceState.xcuserstate index cb1d0ed..63bfc4a 100644 Binary files a/integrations/Apple/ZeroTierSDK_Apple/ZeroTierSDK_Apple.xcodeproj/project.xcworkspace/xcuserdata/Joseph.xcuserdatad/UserInterfaceState.xcuserstate and b/integrations/Apple/ZeroTierSDK_Apple/ZeroTierSDK_Apple.xcodeproj/project.xcworkspace/xcuserdata/Joseph.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/make-mac.mk b/make-mac.mk index abadbbe..235f819 100644 --- a/make-mac.mk +++ b/make-mac.mk @@ -67,21 +67,36 @@ else STRIP=strip endif -# Debug output for Network Containers -# Specific levels can be controlled in netcon/common.inc.c +# Debug output for SDK +# Specific levels can be controlled in src/debug.h ifeq ($(SDK_DEBUG),1) DEFS+=-DSDK_DEBUG endif CXXFLAGS=$(CFLAGS) -fno-rtti +all: + +# TODO: CHECK if XCODE TOOLS are installed # Build frameworks for application development +OSX_app_framework: + cd integrations/Apple/ZeroTierSDK_Apple; xcodebuild -scheme ZeroTierSDK_OSX build SYMROOT="../../../build/OSX_app_framework" +iOS_app_framework: + cd integrations/Apple/ZeroTierSDK_Apple; xcodebuild -scheme ZeroTierSDK_iOS build SYMROOT="../../../build/iOS_app_framework" + # Build bundles for Unity integrations -all: - cd integrations/Apple/ZeroTierSDK_Apple; xcodebuild -scheme ZeroTierSDK_OSX build SYMROOT="../../../build/OSX_Framework" - cd integrations/Apple/ZeroTierSDK_Apple; xcodebuild -scheme ZeroTierSDK_iOS build SYMROOT="../../../build/iOS_Framework" - cd integrations/Apple/ZeroTierSDK_Apple; xcodebuild -scheme ZeroTierSDK_Unity3D_OSX build SYMROOT="../../../build/OSX_Unity_Bundle" - cd integrations/Apple/ZeroTierSDK_Apple; xcodebuild -scheme ZeroTierSDK_Unity3D_iOS build SYMROOT="../../../build/iOS_Unity_Bundle" +OSX_unity3d_bundle: + cd integrations/Apple/ZeroTierSDK_Apple; xcodebuild -scheme ZeroTierSDK_Unity3D_OSX build SYMROOT="../../../build/OSX_unity3d_bundle" +iOS_unity3d_bundle: + cd integrations/Apple/ZeroTierSDK_Apple; xcodebuild -scheme ZeroTierSDK_Unity3D_iOS build SYMROOT="../../../build/iOS_unity3d_bundle" + +# TODO: CHECK if ANDROID/GRADLE TOOLS are installed + +# Build JNI library for Android app integration +Android_JNI_library: + cd integrations/Android/proj; ./gradlew assembleDebug + +# Build library for Android Unity integrations sdk: $(OBJS) rm -f *.o @@ -99,15 +114,13 @@ sdk: $(OBJS) ln -sf zerotier-netcon-service zerotier-cli ln -sf zerotier-netcon-service zerotier-idtool -selftest: $(OBJS) selftest.o - $(CXX) $(CXXFLAGS) -o zerotier-selftest selftest.o $(OBJS) $(LIBS) - $(STRIP) zerotier-selftest - clean: - rm -rf build + rm -rf build/* + find . -type f -name '*.o' -delete + find . -type f -name '*.so' -delete + find . -type f -name '*.o.d' -delete # Remove junk generated by Android builds - rm -rf netcon/Android/*.o.d - rm -rf netcon/Netcon-Android/proj/app/build/intermediates - rm -rf netcon/*.o netcon/*.so *.dSYM build-* *.pkg *.dmg *.o node/*.o controller/*.o service/*.o osdep/*.o ext/http-parser/*.o ext/lz4/*.o ext/json-parser/*.o $(OBJS) netcon/zerotier-intercept zerotier-netcon-service ztproxy libztapi.so libztkq.so libztintercept.so zerotier-one zerotier-idtool zerotier-selftest zerotier-cli ZeroTierOneInstaller-* mkworld - + cd integrations/Android/proj; ./gradlew clean + rm -rf integrations/Android/proj/.gradle + rm -rf integrations/Android/proj/.idea FORCE: diff --git a/src/SDK.h b/src/SDK.h index ff7eb31..06e0e1b 100644 --- a/src/SDK.h +++ b/src/SDK.h @@ -40,7 +40,6 @@ extern "C" { void zt_init_rpc(char *nwid); const char *get_netpath(); -bool check_intercept_enabled_for_thread(); #if defined(__linux__) static int (*realaccept4)(ACCEPT4_SIG) = 0; @@ -50,6 +49,7 @@ bool check_intercept_enabled_for_thread(); #endif #if !defined(__ANDROID__) + bool check_intercept_enabled_for_thread(); static int (*realbind)(BIND_SIG) = 0; static int (*realsendmsg)(SENDMSG_SIG) = 0; static ssize_t (*realsendto)(SENDTO_SIG) = 0; diff --git a/src/SDK_ServiceSetup.cpp b/src/SDK_ServiceSetup.cpp index 9aef71e..87b82ab 100644 --- a/src/SDK_ServiceSetup.cpp +++ b/src/SDK_ServiceSetup.cpp @@ -42,7 +42,7 @@ #include #include -#include "OneService.hpp" +#include "service/OneService.hpp" #include "Utils.hpp" #include "OSUtils.hpp"