path trickery update, direct-call API bugfix
This commit is contained in:
@@ -1435,6 +1435,7 @@
|
||||
"-DSDK",
|
||||
"-D__IOS__",
|
||||
"-DLWIP_DEBUG",
|
||||
"-DSDK_BUNDLED",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "zerotier.ZeroTierSDK-iOS";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
@@ -1467,6 +1468,7 @@
|
||||
OTHER_CFLAGS = (
|
||||
"-DSDK",
|
||||
"-D__IOS__",
|
||||
"-DSDK_BUNDLED",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "zerotier.ZeroTierSDK-iOS";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
|
||||
@@ -83,5 +83,21 @@
|
||||
landmarkType = "5">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
shouldBeEnabled = "No"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "../../../../src/SDK_XcodeWrapper.cpp"
|
||||
timestampString = "490505377.469632"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "50"
|
||||
endingLineNumber = "50"
|
||||
landmarkName = "zts_socket(SOCKET_SIG)"
|
||||
landmarkType = "7">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
</Breakpoints>
|
||||
</Bucket>
|
||||
|
||||
@@ -23,8 +23,8 @@ class ViewController: NSViewController {
|
||||
@IBOutlet weak var txtTX: NSTextField!
|
||||
@IBOutlet weak var txtRX: NSTextField!
|
||||
|
||||
var serverPort:Int32 = 8080
|
||||
var serverAddr:String = "10.147.18.5"
|
||||
var serverPort:Int32 = 5658
|
||||
var serverAddr:String = "10.9.9.203"
|
||||
|
||||
var sock:Int32 = -1
|
||||
var accepted_sock:Int32 = -1
|
||||
@@ -227,11 +227,12 @@ class ViewController: NSViewController {
|
||||
|
||||
var service_thread : NSThread!
|
||||
func ztnc_start_service() {
|
||||
let path = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomainMask.UserDomainMask, true)
|
||||
print("start_service()\n")
|
||||
// e5cd7a9e1c3511dd
|
||||
start_service("/Users/Joseph/utest3")
|
||||
//start_service(path[0])
|
||||
|
||||
// If you plan on using SOCKS Proxy
|
||||
//start_service("/Users/Joseph/utest3")
|
||||
|
||||
// If you plan on using direct calls via RPC
|
||||
start_service_and_rpc("/Users/Joseph/utest3","565799d8f65063e5");
|
||||
}
|
||||
|
||||
|
||||
@@ -241,15 +242,13 @@ class ViewController: NSViewController {
|
||||
// Set initial UI values for demo
|
||||
txtAddr.stringValue = serverAddr
|
||||
txtPort.intValue = serverPort
|
||||
txtNWID.stringValue = "565799d8f65063e5"
|
||||
|
||||
// ZeroTier Service thread
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), {
|
||||
self.service_thread = NSThread(target:self, selector:"ztnc_start_service", object:nil)
|
||||
self.service_thread.start()
|
||||
});
|
||||
|
||||
// Set RPC path for this thread
|
||||
zts_init_rpc("/Users/Joseph/utest3/nc_","e5cd7a9e1c2e194f");
|
||||
}
|
||||
|
||||
override var representedObject: AnyObject? {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10116" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
|
||||
@@ -40,7 +40,7 @@
|
||||
<textInputTraits key="textInputTraits"/>
|
||||
</textField>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Protocol" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Fn2-mn-MjK">
|
||||
<rect key="frame" x="20" y="147" width="64" height="21"/>
|
||||
<rect key="frame" x="20" y="171" width="64" height="21"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
@@ -63,21 +63,21 @@
|
||||
<textInputTraits key="textInputTraits"/>
|
||||
</textField>
|
||||
<segmentedControl opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="0" translatesAutoresizingMaskIntoConstraints="NO" id="mgD-Qw-uwg">
|
||||
<rect key="frame" x="20" y="96" width="121" height="29"/>
|
||||
<rect key="frame" x="38" y="133" width="121" height="29"/>
|
||||
<segments>
|
||||
<segment title="First"/>
|
||||
<segment title="Second"/>
|
||||
</segments>
|
||||
</segmentedControl>
|
||||
<segmentedControl opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="0" translatesAutoresizingMaskIntoConstraints="NO" id="vwT-sy-CRY">
|
||||
<rect key="frame" x="20" y="176" width="121" height="29"/>
|
||||
<rect key="frame" x="38" y="200" width="121" height="29"/>
|
||||
<segments>
|
||||
<segment title="First"/>
|
||||
<segment title="Second"/>
|
||||
</segments>
|
||||
</segmentedControl>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="API" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bOi-uD-nTW">
|
||||
<rect key="frame" x="20" y="67" width="26" height="21"/>
|
||||
<rect key="frame" x="20" y="104" width="26" height="21"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
@@ -118,6 +118,27 @@
|
||||
<rect key="frame" x="20" y="492" width="45" height="30"/>
|
||||
<state key="normal" title="write()"/>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="IXS-rJ-KKM">
|
||||
<rect key="frame" x="141" y="55" width="90" height="30"/>
|
||||
<state key="normal" title="Join Network"/>
|
||||
<connections>
|
||||
<action selector="UI_JoinNetwork:" destination="BYZ-38-t0r" eventType="touchUpInside" id="kem-tf-1h1"/>
|
||||
<action selector="btnJoinNetwork:" destination="BYZ-38-t0r" eventType="touchUpInside" id="LSj-sJ-YEs"/>
|
||||
</connections>
|
||||
</button>
|
||||
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" text="nwid" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="TvY-qZ-Zjm">
|
||||
<rect key="frame" x="20" y="55" width="97" height="30"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<textInputTraits key="textInputTraits"/>
|
||||
</textField>
|
||||
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="fU2-IH-aMf">
|
||||
<rect key="frame" x="141" y="83" width="102" height="30"/>
|
||||
<state key="normal" title="Leave Network"/>
|
||||
<connections>
|
||||
<action selector="UI_LeaveNetwork:" destination="BYZ-38-t0r" eventType="touchUpInside" id="7Pg-IK-dMo"/>
|
||||
<action selector="btnLeaveNetwork:" destination="BYZ-38-t0r" eventType="touchUpInside" id="hmg-2Y-GCl"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
||||
<variation key="default">
|
||||
@@ -128,6 +149,11 @@
|
||||
</mask>
|
||||
</variation>
|
||||
</view>
|
||||
<connections>
|
||||
<outlet property="btnJoinNetwork" destination="IXS-rJ-KKM" id="C88-pL-2CT"/>
|
||||
<outlet property="btnLeaveNetwork" destination="fU2-IH-aMf" id="YwN-GB-2tc"/>
|
||||
<outlet property="txtNWID" destination="TvY-qZ-Zjm" id="1Jc-3U-PIE"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
|
||||
@@ -10,13 +10,22 @@ import UIKit
|
||||
|
||||
class ViewController: UIViewController {
|
||||
|
||||
@IBOutlet weak var txtNWID: UITextField!
|
||||
|
||||
@IBOutlet weak var btnJoinNetwork: UIButton!
|
||||
@IBAction func UI_JoinNetwork(sender: AnyObject) {
|
||||
zt_join_network("565799d8f65063e5")
|
||||
}
|
||||
|
||||
@IBOutlet weak var btnLeaveNetwork: UIButton!
|
||||
@IBAction func UI_LeaveNetwork(sender: AnyObject) {
|
||||
zt_leave_network("565799d8f65063e5")
|
||||
}
|
||||
|
||||
var service_thread : NSThread!
|
||||
func ztnc_start_service() {
|
||||
let path = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomainMask.UserDomainMask, true)
|
||||
print("start_service()\n")
|
||||
// e5cd7a9e1c3511dd
|
||||
start_service("/Users/Joseph/utest3")
|
||||
//start_service(path[0])
|
||||
start_service(path[0])
|
||||
}
|
||||
|
||||
override func viewDidLoad() {
|
||||
@@ -28,9 +37,6 @@ class ViewController: UIViewController {
|
||||
self.service_thread.start()
|
||||
});
|
||||
|
||||
// Set RPC path for this thread
|
||||
zts_init_rpc("/Users/Joseph/utest3/nc_","e5cd7a9e1c2e194f");
|
||||
|
||||
// Do any additional setup after loading the view, typically from a nib.
|
||||
}
|
||||
|
||||
@@ -38,7 +44,5 @@ class ViewController: UIViewController {
|
||||
super.didReceiveMemoryWarning()
|
||||
// Dispose of any resources that can be recreated.
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Use this file to import your target's public headers that you would like to expose to Swift.
|
||||
// Implementations located in src/SDK_XcodeWrapper.cpp
|
||||
//
|
||||
|
||||
#ifndef Example_OSX_Bridging_Header_h
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
int start_intercept();
|
||||
void start_service(const char * path);
|
||||
void start_service_and_rpc(const char * path, const char * nwid);
|
||||
void join_network(const char * nwid);
|
||||
void disable_intercept();
|
||||
void enable_intercept();
|
||||
@@ -30,7 +31,6 @@ int zts_getsockopt(GETSOCKOPT_SIG);
|
||||
int zts_close(CLOSE_SIG);
|
||||
int zts_getsockname(GETSOCKNAME_SIG);
|
||||
|
||||
|
||||
#endif /* Example_OSX_Bridging_Header_h */
|
||||
|
||||
|
||||
|
||||
@@ -139,19 +139,19 @@ int rpc_join(char * sockname)
|
||||
strncpy(addr.sun_path, sockname, sizeof(addr.sun_path)-1);
|
||||
int sock;
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
if((sock = socket(AF_UNIX, SOCK_STREAM, 0)) < 0){
|
||||
#else
|
||||
#if defined(SDK_INTERCEPT)
|
||||
if((sock = realsocket(AF_UNIX, SOCK_STREAM, 0)) < 0){
|
||||
#else
|
||||
if((sock = socket(AF_UNIX, SOCK_STREAM, 0)) < 0){
|
||||
#endif
|
||||
LOGV(stderr, "Error while creating RPC socket\n");
|
||||
return -1;
|
||||
}
|
||||
while((conn_err != 0) && (attempts < SERVICE_CONNECT_ATTEMPTS)){
|
||||
#if defined(__ANDROID__)
|
||||
if((conn_err = connect(sock, (struct sockaddr*)&addr, sizeof(addr))) != 0) {
|
||||
#else
|
||||
#if defined(SDK_INTERCEPT)
|
||||
if((conn_err = realconnect(sock, (struct sockaddr*)&addr, sizeof(addr))) != 0) {
|
||||
#else
|
||||
if((conn_err = connect(sock, (struct sockaddr*)&addr, sizeof(addr))) != 0) {
|
||||
#endif
|
||||
LOGV("Error while connecting to RPC socket. Re-attempting...\n");
|
||||
sleep(1);
|
||||
|
||||
@@ -42,12 +42,11 @@
|
||||
#include <sys/types.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#include "service/OneService.hpp"
|
||||
#include "OneService.hpp"
|
||||
#include "Utils.hpp"
|
||||
#include "OSUtils.hpp"
|
||||
|
||||
#include "SDK.h"
|
||||
|
||||
#include "SDK_Debug.h"
|
||||
#include "SDK_ServiceSetup.hpp"
|
||||
|
||||
@@ -56,7 +55,10 @@ pthread_t intercept_thread;
|
||||
int * intercept_thread_id;
|
||||
pthread_key_t thr_id_key;
|
||||
static ZeroTier::OneService *volatile zt1Service;
|
||||
std::string homeDir;
|
||||
|
||||
std::string localHomeDir; // Local shortened path
|
||||
std::string givenHomeDir; // What the user/application provides as a suggestion
|
||||
std::string homeDir; // The resultant platform-specific dir we *must* use internally
|
||||
std::string netDir;
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -145,20 +147,24 @@ void zt_init_rpc(const char * path, const char * nwid);
|
||||
/*
|
||||
* Starts a service thread and performs basic setup tasks
|
||||
*/
|
||||
void init_service(int key, const char * path)
|
||||
{
|
||||
homeDir = path;
|
||||
void init_service(int key, const char * path) {
|
||||
givenHomeDir = path;
|
||||
pthread_key_create(&thr_id_key, NULL);
|
||||
intercept_thread_id = (int*)malloc(sizeof(int));
|
||||
*intercept_thread_id = key;
|
||||
pthread_create(&intercept_thread, NULL, startOneService, (void *)(intercept_thread_id));
|
||||
}
|
||||
|
||||
void init_service_and_rpc(int key, const char * path, const char * nwid)
|
||||
{
|
||||
init_service(key, path);
|
||||
zt_init_rpc(path, nwid);
|
||||
}
|
||||
|
||||
/*
|
||||
* Enables or disables intercept for current thread using key in thread-local storage
|
||||
*/
|
||||
void set_intercept_status(int mode)
|
||||
{
|
||||
void set_intercept_status(int mode) {
|
||||
fprintf(stderr, "set_intercept_status(mode=%d): tid = %d\n", mode, pthread_mach_thread_np(pthread_self()));
|
||||
pthread_key_create(&thr_id_key, NULL);
|
||||
intercept_thread_id = (int*)malloc(sizeof(int));
|
||||
@@ -192,6 +198,12 @@ void zt_init_rpc(const char * path, const char * nwid);
|
||||
// homeDir according to platform and build type
|
||||
if(!homeDir.length())
|
||||
{
|
||||
#if defined(__UNITY_3D__) && !defined(__ANDROID__) && !defined(__IOS__)
|
||||
// Unity3D on a non-mobile platform
|
||||
homeDir = current_dir; // homeDir shall be current dir
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(__UNITY_3D__)
|
||||
int MAX_DIR_SZ = 256;
|
||||
char current_dir[MAX_DIR_SZ];
|
||||
@@ -199,20 +211,16 @@ void zt_init_rpc(const char * path, const char * nwid);
|
||||
chdir(service_path.c_str());
|
||||
#endif
|
||||
|
||||
#if defined(__UNITY_3D__) && !defined(__ANDROID__) && !defined(__IOS__)
|
||||
// Unity3D on a non-mobile platform
|
||||
homeDir = current_dir; // homeDir shall be current dir
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#include "TargetConditionals.h"
|
||||
#if TARGET_IPHONE_SIMULATOR
|
||||
// homeDir = "dont/run/this/in/the/simulator";
|
||||
// homeDir = "dont/run/this/in/the/simulator/it/wont/work";
|
||||
#elif TARGET_OS_IPHONE
|
||||
homeDir = "ZeroTier/One";
|
||||
localHomeDir = "ZeroTier/One";
|
||||
std::string del = givenHomeDir.length() && givenHomeDir[givenHomeDir.length()-1]!='/' ? "/" : "";
|
||||
homeDir = givenHomeDir + del + localHomeDir;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
/* NOTE: Since on Android devices the sdcard is formatted as fat32, we can't use this
|
||||
@@ -223,13 +231,16 @@ void zt_init_rpc(const char * path, const char * nwid);
|
||||
//join_network("565799d8f65063e5");
|
||||
#endif
|
||||
|
||||
LOGV("homeDir = %s", homeDir.c_str());
|
||||
#if defined(__APPLE__) && !defined(__IOS__)
|
||||
homeDir = givenHomeDir;
|
||||
#endif
|
||||
|
||||
LOGV("homeDir = %s", givenHomeDir.c_str());
|
||||
// Where network .conf files will be stored
|
||||
netDir = homeDir + "/networks.d";
|
||||
|
||||
zt1Service = (ZeroTier::OneService *)0;
|
||||
LOGV("Starting ZT service...\n");
|
||||
|
||||
// Construct path for network config and supporting service files
|
||||
if (!homeDir.length()) {
|
||||
#if defined(__ANDROID__)
|
||||
return;
|
||||
@@ -254,6 +265,18 @@ void zt_init_rpc(const char * path, const char * nwid);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#if defined(__IOS__)
|
||||
// Go to the app's data directory so we can shorten the sun_path we bind to
|
||||
int MAX_DIR_SZ = 256;
|
||||
char current_dir[MAX_DIR_SZ];
|
||||
getcwd(current_dir, MAX_DIR_SZ);
|
||||
std::string targetDir = homeDir + "/../../";
|
||||
chdir(targetDir.c_str());
|
||||
homeDir = localHomeDir;
|
||||
#endif
|
||||
|
||||
//chdir(current_dir); // Return to previous current working directory (at the request of Unity3D)
|
||||
//Debug(homeDir.c_str());
|
||||
|
||||
|
||||
@@ -57,6 +57,7 @@ extern std::string homeDir;
|
||||
#else
|
||||
void *startOneService(void *thread_id);
|
||||
void init_service(int key, const char * path);
|
||||
void init_service_and_rpc(int key, const char * path, const char * nwid);
|
||||
void init_intercept(int key);
|
||||
#endif
|
||||
void set_intercept_status(int mode);
|
||||
|
||||
@@ -92,24 +92,28 @@ int (*realclose)(CLOSE_SIG);
|
||||
void zt_init_rpc(const char *path, const char *nwid)
|
||||
{
|
||||
dwr(MSG_DEBUG, "zt_init_rpc\n");
|
||||
// Just double check we have
|
||||
#if !defined(__IOS__)
|
||||
// Since we don't use function interposition in iOS
|
||||
if(!realconnect) {
|
||||
load_symbols_rpc();
|
||||
}
|
||||
|
||||
#endif
|
||||
// If no path, construct one or get it fron system env vars
|
||||
if(!api_netpath) {
|
||||
#if defined(SDK_BUNDLED)
|
||||
// Get the path/nwid from the user application
|
||||
// netpath = [path + "/nc_" + nwid]
|
||||
char *fullpath = malloc(strlen(path)+strlen(nwid)+1);
|
||||
char *fullpath = malloc(strlen(path)+strlen(nwid)+1+4);
|
||||
if(fullpath) {
|
||||
strcpy(fullpath, path);
|
||||
strcat(fullpath, "/nc_");
|
||||
strcat(fullpath, nwid);
|
||||
//api_netpath = fullpath;
|
||||
api_netpath = "/data/data/com.example.joseph.example_app/files/zerotier/nc_565799d8f65063e5";
|
||||
api_netpath = fullpath;
|
||||
//api_netpath = "/data/data/com.example.joseph.example_app/files/zerotier/nc_565799d8f65063e5";
|
||||
}
|
||||
#else
|
||||
// Get path/nwid from environment variables
|
||||
// This is used when you're dynamically-linking our library into your application at runtime
|
||||
if (!api_netpath) {
|
||||
api_netpath = getenv("ZT_NC_NETWORK");
|
||||
dwr(MSG_DEBUG, "$ZT_NC_NETWORK = %s\n", api_netpath);
|
||||
@@ -370,7 +374,7 @@ int (*realclose)(CLOSE_SIG);
|
||||
printf("path = %s\n", api_netpath);
|
||||
LOGV("path = %s\n", api_netpath);
|
||||
int err = rpc_send_command(api_netpath, RPC_SOCKET, -1, &rpc_st, sizeof(struct socket_st));
|
||||
LOGV("socket() = %s\n", err);
|
||||
//LOGV("socket() = %d\n", err);
|
||||
dwr(MSG_DEBUG," socket() = %d\n", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -17,10 +17,17 @@
|
||||
#include "SDK_ServiceSetup.hpp"
|
||||
|
||||
// Starts a ZeroTier service at the specified path
|
||||
// This will only support SOCKS5 Proxy
|
||||
extern "C" void start_service(const char * path) {
|
||||
init_service(INTERCEPT_DISABLED, path);
|
||||
}
|
||||
|
||||
// Starts a ZeroTier service at the specified path and initializes the RPC mechanism
|
||||
// This will allow direct API calls
|
||||
extern "C" void start_service_and_rpc(const char * path, const char * nwid) {
|
||||
init_service_and_rpc(INTERCEPT_DISABLED, path, nwid);
|
||||
}
|
||||
|
||||
// Joins a ZeroTier virtual network
|
||||
extern "C" void zt_join_network(const char * nwid){
|
||||
join_network(nwid);
|
||||
@@ -32,9 +39,13 @@ extern "C" void zt_leave_network(const char * nwid){
|
||||
}
|
||||
|
||||
// Explicit ZT API wrappers
|
||||
extern "C" void zts_init_rpc(const char *path, const char *nwid) {
|
||||
#if !defined(__IOS__)
|
||||
// This isn't available for iOS since function interposition isn't as reliable
|
||||
extern "C" void zts_init_rpc(const char *path, const char *nwid) {
|
||||
zt_init_rpc(path, nwid);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
extern "C" int zts_socket(SOCKET_SIG) {
|
||||
return zt_socket(socket_family, socket_type, protocol);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user