diff --git a/integrations/android/android_jni_lib/java/jni/Android.mk b/integrations/android/android_jni_lib/java/jni/Android.mk
index 85d3943..8b5d5a7 100644
--- a/integrations/android/android_jni_lib/java/jni/Android.mk
+++ b/integrations/android/android_jni_lib/java/jni/Android.mk
@@ -22,6 +22,8 @@ LOCAL_LDLIBS := -llog
LOCAL_SRC_FILES := \
$(ZTSDK)/SDK_RPC.c \
$(ZTSDK)/SDK_Proxy.cpp \
+ $(ZTSDK)/SDK_Sockets.c \
+ $(ZTSDK)/SDK_Debug.c \
$(ZTSDK)/SDK_ServiceSetup.cpp \
$(ZTSDK)/SDK_EthernetTap.cpp
diff --git a/integrations/android/android_jni_lib/java/jni/Application.mk b/integrations/android/android_jni_lib/java/jni/Application.mk
index 3da5d95..25bc603 100644
--- a/integrations/android/android_jni_lib/java/jni/Application.mk
+++ b/integrations/android/android_jni_lib/java/jni/Application.mk
@@ -1,6 +1,6 @@
NDK_TOOLCHAIN_VERSION := clang
APP_STL := c++_static
-APP_CPPFLAGS := -O3 -DUSE_SOCKS_PROXY -DZT_SDK -fPIC -fPIE -fvectorize -Wall -fstack-protector -fexceptions -fno-strict-aliasing -Wno-deprecated-register -DZT_NO_TYPE_PUNNING=1
+APP_CPPFLAGS := -O3 -DUSE_SOCKS_PROXY -DSDK -fPIC -fPIE -fvectorize -Wall -fstack-protector -fexceptions -fno-strict-aliasing -Wno-deprecated-register -DZT_NO_TYPE_PUNNING=1
APP_PLATFORM := android-14
# Architectures
diff --git a/integrations/android/example_app/app/src/main/java/com/example/joseph/example_app/MainActivity.java b/integrations/android/example_app/app/src/main/java/com/example/joseph/example_app/MainActivity.java
index 1b21212..996d011 100644
--- a/integrations/android/example_app/app/src/main/java/com/example/joseph/example_app/MainActivity.java
+++ b/integrations/android/example_app/app/src/main/java/com/example/joseph/example_app/MainActivity.java
@@ -29,8 +29,5 @@ public class MainActivity extends AppCompatActivity {
SocketAddress proxyAddr = new InetSocketAddress("0.0.0.0", 1337);
Proxy proxy = new Proxy(Proxy.Type.SOCKS, proxyAddr);
- // proxy.
-
-
}
}
\ 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 d2a7053..711fd6a 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/integrations/apple/example_app/Example_OSX_App.xcodeproj/project.xcworkspace/xcuserdata/Joseph.xcuserdatad/UserInterfaceState.xcuserstate b/integrations/apple/example_app/Example_OSX_App.xcodeproj/project.xcworkspace/xcuserdata/Joseph.xcuserdatad/UserInterfaceState.xcuserstate
index 40b22cd..f1741d2 100644
Binary files a/integrations/apple/example_app/Example_OSX_App.xcodeproj/project.xcworkspace/xcuserdata/Joseph.xcuserdatad/UserInterfaceState.xcuserstate and b/integrations/apple/example_app/Example_OSX_App.xcodeproj/project.xcworkspace/xcuserdata/Joseph.xcuserdatad/UserInterfaceState.xcuserstate differ
diff --git a/integrations/apple/example_app/Example_OSX_App.xcodeproj/xcuserdata/Joseph.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/integrations/apple/example_app/Example_OSX_App.xcodeproj/xcuserdata/Joseph.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
index e888a96..f23cc86 100644
--- a/integrations/apple/example_app/Example_OSX_App.xcodeproj/xcuserdata/Joseph.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
+++ b/integrations/apple/example_app/Example_OSX_App.xcodeproj/xcuserdata/Joseph.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
@@ -10,15 +10,47 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Example_OSX_App/ViewController.swift"
- timestampString = "489532561.868006"
+ timestampString = "489623400.349295"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "79"
- endingLineNumber = "79"
+ startingLineNumber = "78"
+ endingLineNumber = "78"
landmarkName = "UI_Connect(_:)"
landmarkType = "5">
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/integrations/apple/example_app/Example_OSX_App/Base.lproj/Main.storyboard b/integrations/apple/example_app/Example_OSX_App/Base.lproj/Main.storyboard
index 30d14c9..0a9b861 100644
--- a/integrations/apple/example_app/Example_OSX_App/Base.lproj/Main.storyboard
+++ b/integrations/apple/example_app/Example_OSX_App/Base.lproj/Main.storyboard
@@ -798,20 +798,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -823,45 +809,9 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -950,17 +898,15 @@
+
-
-
-
-
-
+
+
diff --git a/integrations/apple/example_app/Example_OSX_App/ViewController.swift b/integrations/apple/example_app/Example_OSX_App/ViewController.swift
index f25075d..10b0d4c 100644
--- a/integrations/apple/example_app/Example_OSX_App/ViewController.swift
+++ b/integrations/apple/example_app/Example_OSX_App/ViewController.swift
@@ -20,15 +20,14 @@ class ViewController: NSViewController {
@IBOutlet weak var btnConnect: NSButton!
@IBOutlet weak var btnBind: NSButton!
- @IBOutlet weak var txtTX: NSScrollView!
- @IBOutlet weak var txtRX: NSScrollView!
-
- @IBOutlet weak var btnSend: NSButton!
+ @IBOutlet weak var txtTX: NSTextField!
+ @IBOutlet weak var txtRX: NSTextField!
var serverPort:Int32 = 8080
var serverAddr:String = "10.147.18.5"
var sock:Int32 = -1
+ var accepted_sock:Int32 = -1
@IBAction func txtAddrChanged(sender: AnyObject) {
if(sender.stringValue != nil) {
@@ -119,6 +118,7 @@ class ViewController: NSViewController {
inet_pton(AF_INET, serverAddr, &(addr.sin_addr));
let bind_err = zts_bind(sock, UnsafePointer([addr]), UInt32(addr.sin_len))
+
print("bind_err = \(bind_err),\(errno)")
if bind_err < 0 {
@@ -126,6 +126,17 @@ class ViewController: NSViewController {
print("Error binding IPv4 socket \(err)")
return
}
+
+ // Put socket into listening state
+ zts_listen(sock, 1);
+
+ // Accept connection
+ var len:socklen_t = 0;
+ var legIntPtr = withUnsafeMutablePointer(&len, { $0 })
+ while(accepted_sock < 0) {
+ accepted_sock = zts_accept(sock, UnsafeMutablePointer([addr]), legIntPtr)
+ }
+ print("accepted connection")
}
// UDP
@@ -135,23 +146,85 @@ class ViewController: NSViewController {
}
}
- // Send data to a remote host
+ // TX
+ @IBOutlet weak var btnSend: NSButton!
@IBAction func UI_SendData(sender: AnyObject) {
// Use ordinary read/write calls on ZeroTier socket
// TCP
if(selectedProtocol == SOCK_STREAM)
{
- write(sock, "test", 4);
+ write(sock, txtTX.description, 4);
}
// UDP
if(selectedProtocol == SOCK_DGRAM)
{
-
+ // sendto
}
}
+ // RX
+ @IBOutlet weak var btnReadData: NSButton!
+ @IBAction func UI_ReadData(sender: AnyObject) {
+ // Use ordinary read/write calls on ZeroTier socket
+
+ // TCP
+ if(selectedProtocol == SOCK_STREAM)
+ {
+ var buffer = [UInt8](count: 100, repeatedValue: 0)
+ let str = "GET / HTTP/1.0\r\n\r\n"
+ //let str = "Welcome to the machine"
+ print("strlen = %d\n", str.characters.count)
+ let encodedDataArray = [UInt8](str.utf8)
+
+// read(accepted_sock, UnsafeMutablePointer([txtTX.stringValue]), 128);
+ read(accepted_sock, &buffer, 100);
+ print(buffer)
+
+ }
+ // UDP
+ if(selectedProtocol == SOCK_DGRAM)
+ {
+ // recvfrom
+ }
+ }
+ func test_client_proxy_nsstream()
+ {
+ // For HTTP request
+ var buffer = [UInt8](count: 100, repeatedValue: 0)
+ let str = "GET / HTTP/1.0\r\n\r\n"
+ //let str = "Welcome to the machine"
+ print("strlen = %d\n", str.characters.count)
+ let encodedDataArray = [UInt8](str.utf8)
+
+ var inputStream:NSInputStream?
+ var outputStream:NSOutputStream?
+
+ // As usual, get our streams to our desired "local" address
+ NSStream.getStreamsToHostWithName(serverAddr, port: Int(serverPort), inputStream: &inputStream, outputStream: &outputStream)
+
+ // SOCKS Proxy config dictionary
+ let myDict:NSDictionary = [NSStreamSOCKSProxyHostKey : "0.0.0.0",
+ NSStreamSOCKSProxyPortKey : 1337,
+ NSStreamSOCKSProxyVersionKey : NSStreamSOCKSProxyVersion5]
+
+ // Give configuration to NSStreams
+ inputStream!.setProperty(myDict, forKey: NSStreamSOCKSProxyConfigurationKey)
+ outputStream!.setProperty(myDict, forKey: NSStreamSOCKSProxyConfigurationKey)
+
+ inputStream!.open()
+ outputStream!.open()
+
+ // TX
+ outputStream?.write(encodedDataArray, maxLength: encodedDataArray.count)
+
+ // RX
+ //sleep(5)
+ //inputStream?.read(&buffer, maxLength: 100)
+ //print("buffer = \(buffer)\n")
+ }
+
var service_thread : NSThread!
func ztnc_start_service() {
let path = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomainMask.UserDomainMask, true)
diff --git a/integrations/apple/example_app/Example_iOS_App/Example_iOS_App.xcodeproj/project.pbxproj b/integrations/apple/example_app/Example_iOS_App/Example_iOS_App.xcodeproj/project.pbxproj
new file mode 100644
index 0000000..8a99381
--- /dev/null
+++ b/integrations/apple/example_app/Example_iOS_App/Example_iOS_App.xcodeproj/project.pbxproj
@@ -0,0 +1,299 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 46;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 7C8BC03C1D3348A6001E1B6F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C8BC03B1D3348A6001E1B6F /* AppDelegate.swift */; };
+ 7C8BC03E1D3348A6001E1B6F /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C8BC03D1D3348A6001E1B6F /* ViewController.swift */; };
+ 7C8BC0411D3348A6001E1B6F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7C8BC03F1D3348A6001E1B6F /* Main.storyboard */; };
+ 7C8BC0431D3348A6001E1B6F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7C8BC0421D3348A6001E1B6F /* Assets.xcassets */; };
+ 7C8BC0461D3348A6001E1B6F /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7C8BC0441D3348A6001E1B6F /* LaunchScreen.storyboard */; };
+ 7C8BC04E1D334911001E1B6F /* ZeroTierSDK_iOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7C8BC04D1D334911001E1B6F /* ZeroTierSDK_iOS.framework */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+ 7C8BC0381D3348A6001E1B6F /* Example_iOS_App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example_iOS_App.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 7C8BC03B1D3348A6001E1B6F /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
+ 7C8BC03D1D3348A6001E1B6F /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; };
+ 7C8BC0401D3348A6001E1B6F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
+ 7C8BC0421D3348A6001E1B6F /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
+ 7C8BC0451D3348A6001E1B6F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
+ 7C8BC0471D3348A6001E1B6F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
+ 7C8BC04D1D334911001E1B6F /* ZeroTierSDK_iOS.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ZeroTierSDK_iOS.framework; path = "../../../../build/ios_app_framework/Debug-iphoneos/ZeroTierSDK_iOS.framework"; sourceTree = ""; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 7C8BC0351D3348A6001E1B6F /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 7C8BC04E1D334911001E1B6F /* ZeroTierSDK_iOS.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 7C8BC02F1D3348A6001E1B6F = {
+ isa = PBXGroup;
+ children = (
+ 7C8BC04D1D334911001E1B6F /* ZeroTierSDK_iOS.framework */,
+ 7C8BC03A1D3348A6001E1B6F /* Example_iOS_App */,
+ 7C8BC0391D3348A6001E1B6F /* Products */,
+ );
+ sourceTree = "";
+ };
+ 7C8BC0391D3348A6001E1B6F /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 7C8BC0381D3348A6001E1B6F /* Example_iOS_App.app */,
+ );
+ name = Products;
+ sourceTree = "";
+ };
+ 7C8BC03A1D3348A6001E1B6F /* Example_iOS_App */ = {
+ isa = PBXGroup;
+ children = (
+ 7C8BC03B1D3348A6001E1B6F /* AppDelegate.swift */,
+ 7C8BC03D1D3348A6001E1B6F /* ViewController.swift */,
+ 7C8BC03F1D3348A6001E1B6F /* Main.storyboard */,
+ 7C8BC0421D3348A6001E1B6F /* Assets.xcassets */,
+ 7C8BC0441D3348A6001E1B6F /* LaunchScreen.storyboard */,
+ 7C8BC0471D3348A6001E1B6F /* Info.plist */,
+ );
+ path = Example_iOS_App;
+ sourceTree = "";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 7C8BC0371D3348A6001E1B6F /* Example_iOS_App */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 7C8BC04A1D3348A6001E1B6F /* Build configuration list for PBXNativeTarget "Example_iOS_App" */;
+ buildPhases = (
+ 7C8BC0341D3348A6001E1B6F /* Sources */,
+ 7C8BC0351D3348A6001E1B6F /* Frameworks */,
+ 7C8BC0361D3348A6001E1B6F /* Resources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = Example_iOS_App;
+ productName = Example_iOS_App;
+ productReference = 7C8BC0381D3348A6001E1B6F /* Example_iOS_App.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 7C8BC0301D3348A6001E1B6F /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ LastSwiftUpdateCheck = 0730;
+ LastUpgradeCheck = 0730;
+ ORGANIZATIONNAME = "ZeroTier Inc.";
+ TargetAttributes = {
+ 7C8BC0371D3348A6001E1B6F = {
+ CreatedOnToolsVersion = 7.3;
+ };
+ };
+ };
+ buildConfigurationList = 7C8BC0331D3348A6001E1B6F /* Build configuration list for PBXProject "Example_iOS_App" */;
+ compatibilityVersion = "Xcode 3.2";
+ developmentRegion = English;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ en,
+ Base,
+ );
+ mainGroup = 7C8BC02F1D3348A6001E1B6F;
+ productRefGroup = 7C8BC0391D3348A6001E1B6F /* Products */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 7C8BC0371D3348A6001E1B6F /* Example_iOS_App */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 7C8BC0361D3348A6001E1B6F /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 7C8BC0461D3348A6001E1B6F /* LaunchScreen.storyboard in Resources */,
+ 7C8BC0431D3348A6001E1B6F /* Assets.xcassets in Resources */,
+ 7C8BC0411D3348A6001E1B6F /* Main.storyboard in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 7C8BC0341D3348A6001E1B6F /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 7C8BC03E1D3348A6001E1B6F /* ViewController.swift in Sources */,
+ 7C8BC03C1D3348A6001E1B6F /* AppDelegate.swift in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXVariantGroup section */
+ 7C8BC03F1D3348A6001E1B6F /* Main.storyboard */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 7C8BC0401D3348A6001E1B6F /* Base */,
+ );
+ name = Main.storyboard;
+ sourceTree = "";
+ };
+ 7C8BC0441D3348A6001E1B6F /* LaunchScreen.storyboard */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 7C8BC0451D3348A6001E1B6F /* Base */,
+ );
+ name = LaunchScreen.storyboard;
+ sourceTree = "";
+ };
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+ 7C8BC0481D3348A6001E1B6F /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_ANALYZER_NONNULL = YES;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = dwarf;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ ENABLE_TESTABILITY = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 9.3;
+ MTL_ENABLE_DEBUG_INFO = YES;
+ ONLY_ACTIVE_ARCH = YES;
+ SDKROOT = iphoneos;
+ SWIFT_OPTIMIZATION_LEVEL = "-Onone";
+ TARGETED_DEVICE_FAMILY = "1,2";
+ };
+ name = Debug;
+ };
+ 7C8BC0491D3348A6001E1B6F /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_ANALYZER_NONNULL = YES;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ ENABLE_NS_ASSERTIONS = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 9.3;
+ MTL_ENABLE_DEBUG_INFO = NO;
+ SDKROOT = iphoneos;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ VALIDATE_PRODUCT = YES;
+ };
+ name = Release;
+ };
+ 7C8BC04B1D3348A6001E1B6F /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ INFOPLIST_FILE = Example_iOS_App/Info.plist;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ PRODUCT_BUNDLE_IDENTIFIER = "zerotier.Example-iOS-App";
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Debug;
+ };
+ 7C8BC04C1D3348A6001E1B6F /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ INFOPLIST_FILE = Example_iOS_App/Info.plist;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ PRODUCT_BUNDLE_IDENTIFIER = "zerotier.Example-iOS-App";
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 7C8BC0331D3348A6001E1B6F /* Build configuration list for PBXProject "Example_iOS_App" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 7C8BC0481D3348A6001E1B6F /* Debug */,
+ 7C8BC0491D3348A6001E1B6F /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 7C8BC04A1D3348A6001E1B6F /* Build configuration list for PBXNativeTarget "Example_iOS_App" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 7C8BC04B1D3348A6001E1B6F /* Debug */,
+ 7C8BC04C1D3348A6001E1B6F /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 7C8BC0301D3348A6001E1B6F /* Project object */;
+}
diff --git a/integrations/apple/example_app/Example_iOS_App/Example_iOS_App.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/integrations/apple/example_app/Example_iOS_App/Example_iOS_App.xcodeproj/project.xcworkspace/contents.xcworkspacedata
new file mode 100644
index 0000000..92c673d
--- /dev/null
+++ b/integrations/apple/example_app/Example_iOS_App/Example_iOS_App.xcodeproj/project.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,7 @@
+
+
+
+
+
diff --git a/integrations/apple/example_app/Example_iOS_App/Example_iOS_App.xcodeproj/project.xcworkspace/xcuserdata/Joseph.xcuserdatad/UserInterfaceState.xcuserstate b/integrations/apple/example_app/Example_iOS_App/Example_iOS_App.xcodeproj/project.xcworkspace/xcuserdata/Joseph.xcuserdatad/UserInterfaceState.xcuserstate
new file mode 100644
index 0000000..f7b63f1
Binary files /dev/null and b/integrations/apple/example_app/Example_iOS_App/Example_iOS_App.xcodeproj/project.xcworkspace/xcuserdata/Joseph.xcuserdatad/UserInterfaceState.xcuserstate differ
diff --git a/integrations/apple/example_app/Example_iOS_App/Example_iOS_App.xcodeproj/xcuserdata/Joseph.xcuserdatad/xcschemes/Example_iOS_App.xcscheme b/integrations/apple/example_app/Example_iOS_App/Example_iOS_App.xcodeproj/xcuserdata/Joseph.xcuserdatad/xcschemes/Example_iOS_App.xcscheme
new file mode 100644
index 0000000..f7c9333
--- /dev/null
+++ b/integrations/apple/example_app/Example_iOS_App/Example_iOS_App.xcodeproj/xcuserdata/Joseph.xcuserdatad/xcschemes/Example_iOS_App.xcscheme
@@ -0,0 +1,91 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/integrations/apple/example_app/Example_iOS_App/Example_iOS_App.xcodeproj/xcuserdata/Joseph.xcuserdatad/xcschemes/xcschememanagement.plist b/integrations/apple/example_app/Example_iOS_App/Example_iOS_App.xcodeproj/xcuserdata/Joseph.xcuserdatad/xcschemes/xcschememanagement.plist
new file mode 100644
index 0000000..ce178c4
--- /dev/null
+++ b/integrations/apple/example_app/Example_iOS_App/Example_iOS_App.xcodeproj/xcuserdata/Joseph.xcuserdatad/xcschemes/xcschememanagement.plist
@@ -0,0 +1,22 @@
+
+
+
+
+ SchemeUserState
+
+ Example_iOS_App.xcscheme
+
+ orderHint
+ 0
+
+
+ SuppressBuildableAutocreation
+
+ 7C8BC0371D3348A6001E1B6F
+
+ primary
+
+
+
+
+
diff --git a/integrations/apple/example_app/Example_iOS_App/Example_iOS_App/AppDelegate.swift b/integrations/apple/example_app/Example_iOS_App/Example_iOS_App/AppDelegate.swift
new file mode 100644
index 0000000..ef6f9cd
--- /dev/null
+++ b/integrations/apple/example_app/Example_iOS_App/Example_iOS_App/AppDelegate.swift
@@ -0,0 +1,46 @@
+//
+// AppDelegate.swift
+// Example_iOS_App
+//
+// Created by Joseph Henry on 7/10/16.
+// Copyright © 2016 ZeroTier Inc. All rights reserved.
+//
+
+import UIKit
+
+@UIApplicationMain
+class AppDelegate: UIResponder, UIApplicationDelegate {
+
+ var window: UIWindow?
+
+
+ func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
+ // Override point for customization after application launch.
+ return true
+ }
+
+ func applicationWillResignActive(application: UIApplication) {
+ // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
+ // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
+ }
+
+ func applicationDidEnterBackground(application: UIApplication) {
+ // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
+ // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
+ }
+
+ func applicationWillEnterForeground(application: UIApplication) {
+ // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
+ }
+
+ func applicationDidBecomeActive(application: UIApplication) {
+ // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
+ }
+
+ func applicationWillTerminate(application: UIApplication) {
+ // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
+ }
+
+
+}
+
diff --git a/integrations/apple/example_app/Example_iOS_App/Example_iOS_App/Assets.xcassets/AppIcon.appiconset/Contents.json b/integrations/apple/example_app/Example_iOS_App/Example_iOS_App/Assets.xcassets/AppIcon.appiconset/Contents.json
new file mode 100644
index 0000000..36d2c80
--- /dev/null
+++ b/integrations/apple/example_app/Example_iOS_App/Example_iOS_App/Assets.xcassets/AppIcon.appiconset/Contents.json
@@ -0,0 +1,68 @@
+{
+ "images" : [
+ {
+ "idiom" : "iphone",
+ "size" : "29x29",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "iphone",
+ "size" : "29x29",
+ "scale" : "3x"
+ },
+ {
+ "idiom" : "iphone",
+ "size" : "40x40",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "iphone",
+ "size" : "40x40",
+ "scale" : "3x"
+ },
+ {
+ "idiom" : "iphone",
+ "size" : "60x60",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "iphone",
+ "size" : "60x60",
+ "scale" : "3x"
+ },
+ {
+ "idiom" : "ipad",
+ "size" : "29x29",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "ipad",
+ "size" : "29x29",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "ipad",
+ "size" : "40x40",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "ipad",
+ "size" : "40x40",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "ipad",
+ "size" : "76x76",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "ipad",
+ "size" : "76x76",
+ "scale" : "2x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
\ No newline at end of file
diff --git a/integrations/apple/example_app/Example_iOS_App/Example_iOS_App/Base.lproj/LaunchScreen.storyboard b/integrations/apple/example_app/Example_iOS_App/Example_iOS_App/Base.lproj/LaunchScreen.storyboard
new file mode 100644
index 0000000..2e721e1
--- /dev/null
+++ b/integrations/apple/example_app/Example_iOS_App/Example_iOS_App/Base.lproj/LaunchScreen.storyboard
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/integrations/apple/example_app/Example_iOS_App/Example_iOS_App/Base.lproj/Main.storyboard b/integrations/apple/example_app/Example_iOS_App/Example_iOS_App/Base.lproj/Main.storyboard
new file mode 100644
index 0000000..32e3df7
--- /dev/null
+++ b/integrations/apple/example_app/Example_iOS_App/Example_iOS_App/Base.lproj/Main.storyboard
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/integrations/apple/example_app/Example_iOS_App/Example_iOS_App/Info.plist b/integrations/apple/example_app/Example_iOS_App/Example_iOS_App/Info.plist
new file mode 100644
index 0000000..40c6215
--- /dev/null
+++ b/integrations/apple/example_app/Example_iOS_App/Example_iOS_App/Info.plist
@@ -0,0 +1,47 @@
+
+
+
+
+ CFBundleDevelopmentRegion
+ en
+ CFBundleExecutable
+ $(EXECUTABLE_NAME)
+ CFBundleIdentifier
+ $(PRODUCT_BUNDLE_IDENTIFIER)
+ CFBundleInfoDictionaryVersion
+ 6.0
+ CFBundleName
+ $(PRODUCT_NAME)
+ CFBundlePackageType
+ APPL
+ CFBundleShortVersionString
+ 1.0
+ CFBundleSignature
+ ????
+ CFBundleVersion
+ 1
+ LSRequiresIPhoneOS
+
+ UILaunchStoryboardName
+ LaunchScreen
+ UIMainStoryboardFile
+ Main
+ UIRequiredDeviceCapabilities
+
+ armv7
+
+ UISupportedInterfaceOrientations
+
+ UIInterfaceOrientationPortrait
+ UIInterfaceOrientationLandscapeLeft
+ UIInterfaceOrientationLandscapeRight
+
+ UISupportedInterfaceOrientations~ipad
+
+ UIInterfaceOrientationPortrait
+ UIInterfaceOrientationPortraitUpsideDown
+ UIInterfaceOrientationLandscapeLeft
+ UIInterfaceOrientationLandscapeRight
+
+
+
diff --git a/integrations/apple/example_app/Example_iOS_App/Example_iOS_App/ViewController.swift b/integrations/apple/example_app/Example_iOS_App/Example_iOS_App/ViewController.swift
new file mode 100644
index 0000000..cea6934
--- /dev/null
+++ b/integrations/apple/example_app/Example_iOS_App/Example_iOS_App/ViewController.swift
@@ -0,0 +1,25 @@
+//
+// ViewController.swift
+// Example_iOS_App
+//
+// Created by Joseph Henry on 7/10/16.
+// Copyright © 2016 ZeroTier Inc. All rights reserved.
+//
+
+import UIKit
+
+class ViewController: UIViewController {
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+ // Do any additional setup after loading the view, typically from a nib.
+ }
+
+ override func didReceiveMemoryWarning() {
+ super.didReceiveMemoryWarning()
+ // Dispose of any resources that can be recreated.
+ }
+
+
+}
+
diff --git a/src/SDK_ServiceSetup.cpp b/src/SDK_ServiceSetup.cpp
index 1ea1ca4..e5149dc 100644
--- a/src/SDK_ServiceSetup.cpp
+++ b/src/SDK_ServiceSetup.cpp
@@ -47,7 +47,6 @@
#include "OSUtils.hpp"
#include "SDK.h"
-void zt_init_rpc(const char * path, const char * nwid);
#include "SDK_Debug.h"
#include "SDK_ServiceSetup.hpp"
@@ -64,6 +63,8 @@ std::string netDir;
extern "C" {
#endif
+void zt_init_rpc(const char * path, const char * nwid);
+
#if defined(__UNITY_3D__)
// .NET Interop-friendly debug mechanism
typedef void (*FuncPtr)( const char * );
@@ -134,7 +135,7 @@ extern "C" {
// JNI naming convention: Java_PACKAGENAME_CLASSNAME_METHODNAME
JNIEXPORT void JNICALL Java_ZeroTier_SDK_startOneService(JNIEnv *env, jobject thisObj, jstring path) {
//char * path;
- homeDir = (*env)->GetStringUTFChars(env, path, NULL);
+ homeDir = env->GetStringUTFChars(path, NULL);
#else
void *startOneService(void *thread_id) {
#endif
diff --git a/src/SDK_ServiceSetup.hpp b/src/SDK_ServiceSetup.hpp
index 469bb26..493698b 100644
--- a/src/SDK_ServiceSetup.hpp
+++ b/src/SDK_ServiceSetup.hpp
@@ -50,7 +50,7 @@ extern std::string homeDir;
/* If you define anything else in this file it that you wish to expose to your Android
Java application you *must* follow that convention and any corresponding Java package/classes
in your Android project must match this as well */
- JNIEXPORT void JNICALL Java_ZeroTier_SDK_startOneService(JNIEnv *env, jobject thisObj);
+ JNIEXPORT void JNICALL Java_ZeroTier_SDK_startOneService(JNIEnv *env, jobject thisObj, jstring path);
#else
void *startOneService(void *thread_id);
void init_service(int key, const char * path);