diff --git a/autoip.o b/autoip.o deleted file mode 100644 index 286311d..0000000 Binary files a/autoip.o and /dev/null differ 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 d06a689..4c63631 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.pbxproj b/integrations/apple/example_app/Example_OSX_App.xcodeproj/project.pbxproj index 2c165e8..e1c95ba 100644 --- a/integrations/apple/example_app/Example_OSX_App.xcodeproj/project.pbxproj +++ b/integrations/apple/example_app/Example_OSX_App.xcodeproj/project.pbxproj @@ -7,9 +7,10 @@ objects = { /* Begin PBXBuildFile section */ - 7CA571041D1B0D9500720883 /* ZeroTierSDK_OSX.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7CA571031D1B0D9500720883 /* ZeroTierSDK_OSX.framework */; }; 7CA571051D1B0DA100720883 /* ZeroTierSDK_OSX.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7CA571031D1B0D9500720883 /* ZeroTierSDK_OSX.framework */; }; - 7CA571061D1B0DA100720883 /* ZeroTierSDK_OSX.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 7CA571031D1B0D9500720883 /* ZeroTierSDK_OSX.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 7CF8E36C1D2C3E0A001A8401 /* ZeroTierSDK_OSX.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7CF8E36B1D2C3E0A001A8401 /* ZeroTierSDK_OSX.framework */; }; + 7CF8E3701D2C40F6001A8401 /* SDK_XcodeWrapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CF8E36E1D2C40F6001A8401 /* SDK_XcodeWrapper.cpp */; }; + 7CF8E3711D2C4338001A8401 /* ZeroTierSDK_OSX.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 7CF8E36B1D2C3E0A001A8401 /* ZeroTierSDK_OSX.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 7CFCB4311D1AFEE800D3E66C /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CFCB4301D1AFEE800D3E66C /* AppDelegate.swift */; }; 7CFCB4331D1AFEE800D3E66C /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CFCB4321D1AFEE800D3E66C /* ViewController.swift */; }; 7CFCB4351D1AFEE800D3E66C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7CFCB4341D1AFEE800D3E66C /* Assets.xcassets */; }; @@ -23,7 +24,7 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( - 7CA571061D1B0DA100720883 /* ZeroTierSDK_OSX.framework in Embed Frameworks */, + 7CF8E3711D2C4338001A8401 /* ZeroTierSDK_OSX.framework in Embed Frameworks */, ); name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -31,9 +32,12 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 7C3504EE1D2AD9D4007EBD64 /* Example_OSX-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Example_OSX-Bridging-Header.h"; sourceTree = ""; }; - 7CA571031D1B0D9500720883 /* ZeroTierSDK_OSX.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ZeroTierSDK_OSX.framework; path = ../../../build/OSX_app_framework/Debug/ZeroTierSDK_OSX.framework; sourceTree = ""; }; + 7CA571031D1B0D9500720883 /* ZeroTierSDK_OSX.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ZeroTierSDK_OSX.framework; path = /Users/Joseph/code/zerotiersdk/build/OSX_app_framework/Debug/ZeroTierSDK_OSX.framework; sourceTree = ""; }; 7CA571081D1B1DCB00720883 /* ZeroTierSDK_OSX.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ZeroTierSDK_OSX.h; path = ../../ZeroTierSDK_Apple/ZeroTierSDK_OSX/ZeroTierSDK_OSX.h; sourceTree = ""; }; + 7CF8E36B1D2C3E0A001A8401 /* ZeroTierSDK_OSX.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ZeroTierSDK_OSX.framework; path = ../../../build/osx_app_framework/Debug/ZeroTierSDK_OSX.framework; sourceTree = ""; }; + 7CF8E36D1D2C40F6001A8401 /* Example_OSX_App-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Example_OSX_App-Bridging-Header.h"; sourceTree = ""; }; + 7CF8E36E1D2C40F6001A8401 /* SDK_XcodeWrapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SDK_XcodeWrapper.cpp; path = ../../../../src/SDK_XcodeWrapper.cpp; sourceTree = ""; }; + 7CF8E36F1D2C40F6001A8401 /* SDK_XcodeWrapper.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = SDK_XcodeWrapper.hpp; path = ../../../../src/SDK_XcodeWrapper.hpp; sourceTree = ""; }; 7CFCB42D1D1AFEE800D3E66C /* Example_OSX_App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example_OSX_App.app; sourceTree = BUILT_PRODUCTS_DIR; }; 7CFCB4301D1AFEE800D3E66C /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 7CFCB4321D1AFEE800D3E66C /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; @@ -47,8 +51,8 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 7CF8E36C1D2C3E0A001A8401 /* ZeroTierSDK_OSX.framework in Frameworks */, 7CA571051D1B0DA100720883 /* ZeroTierSDK_OSX.framework in Frameworks */, - 7CA571041D1B0D9500720883 /* ZeroTierSDK_OSX.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -58,7 +62,7 @@ 7CFCB4241D1AFEE800D3E66C = { isa = PBXGroup; children = ( - 7CA571031D1B0D9500720883 /* ZeroTierSDK_OSX.framework */, + 7CF8E36B1D2C3E0A001A8401 /* ZeroTierSDK_OSX.framework */, 7CFCB42F1D1AFEE800D3E66C /* Example_OSX_App */, 7CFCB42E1D1AFEE800D3E66C /* Products */, ); @@ -75,13 +79,15 @@ 7CFCB42F1D1AFEE800D3E66C /* Example_OSX_App */ = { isa = PBXGroup; children = ( + 7CF8E36E1D2C40F6001A8401 /* SDK_XcodeWrapper.cpp */, + 7CF8E36F1D2C40F6001A8401 /* SDK_XcodeWrapper.hpp */, 7CA571081D1B1DCB00720883 /* ZeroTierSDK_OSX.h */, 7CFCB4301D1AFEE800D3E66C /* AppDelegate.swift */, 7CFCB4321D1AFEE800D3E66C /* ViewController.swift */, 7CFCB4341D1AFEE800D3E66C /* Assets.xcassets */, 7CFCB4361D1AFEE800D3E66C /* Main.storyboard */, 7CFCB4391D1AFEE800D3E66C /* Info.plist */, - 7C3504EE1D2AD9D4007EBD64 /* Example_OSX-Bridging-Header.h */, + 7CF8E36D1D2C40F6001A8401 /* Example_OSX_App-Bridging-Header.h */, ); path = Example_OSX_App; sourceTree = ""; @@ -158,6 +164,7 @@ buildActionMask = 2147483647; files = ( 7CFCB4331D1AFEE800D3E66C /* ViewController.swift in Sources */, + 7CF8E3701D2C40F6001A8401 /* SDK_XcodeWrapper.cpp in Sources */, 7CFCB4311D1AFEE800D3E66C /* AppDelegate.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -264,13 +271,16 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; COMBINE_HIDPI_IMAGES = YES; HEADER_SEARCH_PATHS = "$(SRCROOT)/../../../src"; INFOPLIST_FILE = Example_OSX_App/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "zerotier.Example-OSX-App"; PRODUCT_NAME = "$(TARGET_NAME)"; - "SWIFT_OBJC_BRIDGING_HEADER[arch=*]" = "Example_OSX_App/Example_OSX-Bridging-Header.h"; + SWIFT_OBJC_BRIDGING_HEADER = "Example_OSX_App/Example_OSX_App-Bridging-Header.h"; + "SWIFT_OBJC_BRIDGING_HEADER[arch=*]" = "Example_OSX_App/Example_OSX_App-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; }; name = Debug; }; @@ -278,12 +288,14 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; COMBINE_HIDPI_IMAGES = YES; HEADER_SEARCH_PATHS = "$(SRCROOT)/../../../src"; INFOPLIST_FILE = Example_OSX_App/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "zerotier.Example-OSX-App"; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Example_OSX_App/Example_OSX_App-Bridging-Header.h"; }; name = Release; }; 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 3405433..27fd567 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/Example_OSX-Bridging-Header.h b/integrations/apple/example_app/Example_OSX_App/Example_OSX_App-Bridging-Header.h similarity index 100% rename from integrations/apple/example_app/Example_OSX_App/Example_OSX-Bridging-Header.h rename to integrations/apple/example_app/Example_OSX_App/Example_OSX_App-Bridging-Header.h diff --git a/integrations/apple/example_app/Example_OSX_App/ViewController.swift b/integrations/apple/example_app/Example_OSX_App/ViewController.swift index b951878..54fa09b 100644 --- a/integrations/apple/example_app/Example_OSX_App/ViewController.swift +++ b/integrations/apple/example_app/Example_OSX_App/ViewController.swift @@ -16,7 +16,8 @@ class ViewController: NSViewController { let path = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomainMask.UserDomainMask, true) print("start_service()\n") // e5cd7a9e1c3511dd - start_service(path[0]) + start_service("/Users/Joseph/utest3") + //start_service(path[0]) } @@ -31,7 +32,6 @@ class ViewController: NSViewController { // Do any additional setup after loading the view. } - override var representedObject: AnyObject? { didSet { // Update the view, if already loaded. diff --git a/src/SDK_ServiceSetup.cpp b/src/SDK_ServiceSetup.cpp index aa775aa..09ec712 100644 --- a/src/SDK_ServiceSetup.cpp +++ b/src/SDK_ServiceSetup.cpp @@ -104,7 +104,7 @@ extern "C" { */ void init_service(int key, const char * path) { - service_path = path; + homeDir = path; pthread_key_create(&thr_id_key, NULL); intercept_thread_id = (int*)malloc(sizeof(int)); *intercept_thread_id = key; diff --git a/src/SDK_ServiceSetup.hpp b/src/SDK_ServiceSetup.hpp index 8c0a299..469bb26 100644 --- a/src/SDK_ServiceSetup.hpp +++ b/src/SDK_ServiceSetup.hpp @@ -25,6 +25,9 @@ * LLC. Start here: http://www.zerotier.com/ */ +#include + + #ifdef __cplusplus extern "C" { #endif @@ -38,13 +41,15 @@ extern "C" { #define INTERCEPT_ENABLED 111 #define INTERCEPT_DISABLED 222 - + + extern std::string homeDir; #if defined(__ANDROID__) // JNI naming convention: Java_PACKAGENAME_CLASSNAME_METHODNAME - /* If you define anything else in this file it *must* follow that convention - and any corresponding Java package/classes in your Android project must match this as well */ + /* 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); #else void *startOneService(void *thread_id); diff --git a/src/SDK_XcodeWrapper.cpp b/src/SDK_XcodeWrapper.cpp new file mode 100755 index 0000000..7603f90 --- /dev/null +++ b/src/SDK_XcodeWrapper.cpp @@ -0,0 +1,63 @@ +// +// NetconWrapper.cpp +// Netcon-iOS +// +// Created by Joseph Henry on 2/14/16. +// Copyright © 2016 ZeroTier. All rights reserved. +// + +#include "SDK.h" +#include "SDK_XcodeWrapper.hpp" +#include "SDK_Signatures.h" +#include + +#define INTERCEPT_ENABLED 111 +#define INTERCEPT_DISABLED 222 + +#include "SDK_ServiceSetup.hpp" + +// Starts a service at the specified path +extern "C" int start_service(const char * path) { + init_service(INTERCEPT_DISABLED, path); + return 1; +} + +// Joins a network +extern "C" void zt_join_network(const char * nwid){ + join_network(nwid); // Instruct ZeroTier service to join network + // zt_init_rpc(nwid); // Tells the RPC code where to contact the ZeroTier service +} + +// Leaves a network +extern "C" void zt_leave_network(const char * nwid){ + leave_network(nwid); +} + +// Explicit ZT API wrappers +extern "C" int zts_socket(SOCKET_SIG) { + return zt_socket(socket_family, socket_type, protocol); +} +extern "C" int zts_connect(CONNECT_SIG) { + return zt_connect(__fd, __addr, __len); +} +extern "C" int zt_bind(BIND_SIG){ + return zt_bind(sockfd, addr, addrlen); +} +extern "C" int zt_accept(ACCEPT_SIG) { + return zt_accept(sockfd, addr, addrlen); +} +extern "C" int zt_listen(LISTEN_SIG) { + return zt_listen(sockfd, backlog); +} +extern "C" int zt_setsockopt(SETSOCKOPT_SIG) { + return zt_setsockopt(socket, level, option_name, option_value, option_len); +} +extern "C" int zt_getsockopt(GETSOCKOPT_SIG) { + return zt_getsockopt(sockfd, level, optname, optval, optlen); +} +extern "C" int zt_close(CLOSE_SIG) { + return zt_close(fd); +} +extern "C" int zt_getsockname(GETSOCKNAME_SIG) { + return zt_getsockname(sockfd, addr, addrlen); +} diff --git a/src/SDK_XcodeWrapper.hpp b/src/SDK_XcodeWrapper.hpp new file mode 100755 index 0000000..df12052 --- /dev/null +++ b/src/SDK_XcodeWrapper.hpp @@ -0,0 +1,14 @@ +// +// SDK_XcodeWrapper.hpp +// Netcon-iOS +// +// Created by Joseph Henry on 2/14/16. +// Copyright © 2016 ZeroTier. All rights reserved. +// + +#ifndef SDK_XCODE_WRAPPER_HPP +#define SDK_XCODE_WRAPPER_HPP + +#include + +#endif /* SDK_XCODE_WRAPPER_HPP */ diff --git a/zerotier-idtool b/zerotier-idtool deleted file mode 120000 index 0974c8e..0000000 --- a/zerotier-idtool +++ /dev/null @@ -1 +0,0 @@ -zerotier-sdk-service \ No newline at end of file