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 4c63631..bf2c8bb 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 27fd567..0db74a7 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/Base.lproj/Main.storyboard b/integrations/apple/example_app/Example_OSX_App/Base.lproj/Main.storyboard index 2e8d50d..0a00bd1 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 @@ -685,6 +685,9 @@ + + + @@ -729,6 +735,9 @@ + + + @@ -786,6 +801,9 @@ + + + @@ -841,6 +859,9 @@ + + + @@ -917,6 +938,23 @@ + + + + + + + + + + + + + + + + + diff --git a/integrations/apple/example_app/Example_OSX_App/Example_OSX_App-Bridging-Header.h b/integrations/apple/example_app/Example_OSX_App/Example_OSX_App-Bridging-Header.h index 811b2ff..d2012ca 100644 --- a/integrations/apple/example_app/Example_OSX_App/Example_OSX_App-Bridging-Header.h +++ b/integrations/apple/example_app/Example_OSX_App/Example_OSX_App-Bridging-Header.h @@ -6,8 +6,8 @@ #define Example_OSX_Bridging_Header_h int start_intercept(); -int start_service(const char * path); -int join_network(const char * nwid); +void start_service(const char * path); +void join_network(const char * nwid); void disable_intercept(); void enable_intercept(); diff --git a/integrations/apple/example_app/Example_OSX_App/ViewController.swift b/integrations/apple/example_app/Example_OSX_App/ViewController.swift index 54fa09b..723aeb5 100644 --- a/integrations/apple/example_app/Example_OSX_App/ViewController.swift +++ b/integrations/apple/example_app/Example_OSX_App/ViewController.swift @@ -10,6 +10,44 @@ import Cocoa class ViewController: NSViewController { + @IBOutlet weak var btnJoinNetwork: NSButton! + @IBOutlet weak var btnLeaveNetwork: NSButton! + @IBOutlet weak var txtNWID: NSTextField! + @IBOutlet weak var segmentAPISelector: NSSegmentedCell! + @IBOutlet weak var segmentProtocolSelector: NSSegmentedCell! + @IBOutlet weak var txtAddr: NSTextField! + @IBOutlet weak var txtPort: NSTextField! + @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! + + + @IBAction func UI_JoinNetwork(sender: AnyObject) { + zt_join_network(txtNWID.stringValue); + } + + @IBAction func UI_LeaveNetwork(sender: AnyObject) { + zt_leave_network(txtNWID.stringValue); + } + + @IBAction func UI_SelectAPI(sender: AnyObject) { + } + + @IBAction func UI_SelectProtocol(sender: AnyObject) { + } + + @IBAction func UI_Connect(sender: AnyObject) { + } + + @IBAction func UI_Bind(sender: AnyObject) { + } + + @IBAction func UI_SendData(sender: AnyObject) { + } + + var service_thread : NSThread! func ztnc_start_service() { diff --git a/src/SDK_LWIPStack.hpp b/src/SDK_LWIPStack.hpp index e0bd4be..1672586 100644 --- a/src/SDK_LWIPStack.hpp +++ b/src/SDK_LWIPStack.hpp @@ -180,12 +180,12 @@ namespace ZeroTier { #define __STATIC_LWIP__ // iOS Simulator or iOS device // Do nothing, symbols are statically-linked - #elif TARGET_OS_MAC + #elif TARGET_OS_MAC && !defined(SDK_BUNDLED) #define __DYNAMIC_LWIP__ // Dynamically load liblwip.so _libref = dlopen(path, RTLD_NOW); #else - error "Unknown Apple platform" + #define __STATIC_LWIP__ #endif #endif diff --git a/src/SDK_XcodeWrapper.cpp b/src/SDK_XcodeWrapper.cpp index 7603f90..9b06bfd 100755 --- a/src/SDK_XcodeWrapper.cpp +++ b/src/SDK_XcodeWrapper.cpp @@ -16,25 +16,23 @@ #include "SDK_ServiceSetup.hpp" -// Starts a service at the specified path -extern "C" int start_service(const char * path) { +// Starts a ZeroTier service at the specified path +extern "C" void start_service(const char * path) { init_service(INTERCEPT_DISABLED, path); - return 1; } -// Joins a network +// Joins a ZeroTier virtual 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 + join_network(nwid); } -// Leaves a network +// Leaves a ZeroTier virtual network extern "C" void zt_leave_network(const char * nwid){ leave_network(nwid); } // Explicit ZT API wrappers -extern "C" int zts_socket(SOCKET_SIG) { +extern "C" int zt_socket(SOCKET_SIG) { return zt_socket(socket_family, socket_type, protocol); } extern "C" int zts_connect(CONNECT_SIG) {