eth_hdr to pico_eth_hdr reference fix, doc updates, picoTCP build for xcode
This commit is contained in:
39
docs/rxtx.md
39
docs/rxtx.md
@@ -15,12 +15,14 @@ Our library's implementation of `socket()` is executed instead of the kernel's.
|
||||
|
||||
From your app's perspective nothing out of the ordinary has happened. It called `socket()`, and got a file descriptor back.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
***
|
||||
|
||||
## Establishing a connection
|
||||
|
||||
When your app attempts to establish a connection over a socket the following happens:
|
||||
|
||||
You app connects to a remote host:
|
||||
|
||||
```
|
||||
@@ -35,16 +37,21 @@ pico_handleConnect()
|
||||
pico_socket_connect()
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
***
|
||||
|
||||
## Acception a connection
|
||||
## Accepting a connection
|
||||
|
||||
Your app places a socket into a listen state:
|
||||
|
||||
```
|
||||
listen()
|
||||
```
|
||||
An RPC_LISTEN call is sent to the **tap service** and **stack driver**
|
||||
An `RPC_LISTEN` call is sent to the **tap service** and **stack driver**
|
||||
|
||||
You app accepts a connection:
|
||||
|
||||
@@ -54,7 +61,13 @@ accept()
|
||||
|
||||
The **network stack** raises a `PICO_SOCK_EV_CONN` event which calls `pico_cb_socket_activity()`. From here we request a new `pico_socket` be created to represent the new connection. This is done via `pico_socket_accept()`. Once we have a valid `pico_socket`, we create an `AF_UNIX` socket pair. We associate one end with the newly-created `pico_socket` via a `Connection` object. And we send the other end of the socket pair to the app.
|
||||
|
||||
Out library's implementation of `accept()` will read and return the new file descriptor representing one end of the socket pair. From your app's prespective this is a normal file descriptor.
|
||||
Our library's implementation of `accept()` will read and return the new file descriptor representing one end of the socket pair. From your app's prespective this is a normal file descriptor.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
***
|
||||
|
||||
@@ -72,22 +85,22 @@ Periodically the **network stack** thread will call `pico_eth_poll()`, this is r
|
||||
|
||||
```
|
||||
pico_eth_poll()
|
||||
<pico_frame_rxbuf> ---> pico_stack_recv
|
||||
<pico_frame_rxbuf> ---> pico_stack_recv()
|
||||
```
|
||||
|
||||
After some time has passed and the **network stack** has processed the incoming frames a `PICO_SOCK_EV_RD` event will be triggered which calls `pico_cb_socket_activity()`, and ultimately `pico_cb_tcp_read()`. This is where we copy the incoming data from the `pico_socket` to the `Connection`'s `rxbuf` (different from `pico_frame_rxbuf`). We then notify the **tap service** that the `PhySocket` (a wrapped file descriptor with one end visible to the application) associated with this `Connection` has data in its `rxbuf` that needs to be written so the app can read it.
|
||||
|
||||
```
|
||||
pico_cb_socket_activity()
|
||||
pico_cb_tcp_read() ---> conn->rxbuf
|
||||
setNotifyWritable=TRUE
|
||||
pico_cb_tcp_read() ---> <rxbuf>
|
||||
setNotifyWritable(TRUE)
|
||||
```
|
||||
|
||||
After some (more) time, the **tap service** thread will call `pico_handleRead()`, this will copy the data from the `rxbuf` to the `AF_UNIX` socket which links the service and your application.
|
||||
|
||||
```
|
||||
pico_handleRead()
|
||||
streamSend(): conn->rxbuf --- conn->sock
|
||||
streamSend(): <rxbuf> ---> PhySock
|
||||
```
|
||||
|
||||
After this point it's up to your application to read the data via a conventional `read()`, `recv()`, or `recvfrom()` call.
|
||||
@@ -97,6 +110,12 @@ read()
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
***
|
||||
|
||||
## Sending data
|
||||
@@ -112,7 +131,7 @@ The other end of the `AF_UNIX` socket which was written to is monitored by the *
|
||||
```
|
||||
phyOnUnixData()
|
||||
handleWrite()
|
||||
pico_socket_write(): conn->txbuf ---> conn->picosock
|
||||
pico_socket_write(): <txbuf> ---> picosock
|
||||
```
|
||||
|
||||
Periodically a `PICO_SOCK_EV_WR` event will be raised by the **network stack**, this will call `pico_cb_socket_activity()` and ultimately `pico_cb_tcp_write()` where a `pico_socket_write()` call will be made to copy any remaining `txbuf` contents into the stack.
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:ZeroTierSDK_Apple.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "E606611F311EBBA46CDC9112D11FA5B7A3480FA9",
|
||||
"DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : {
|
||||
|
||||
},
|
||||
"DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : {
|
||||
"ABA3617E9F0148F844A82502F0D808DE6591AA97" : 0,
|
||||
"E606611F311EBBA46CDC9112D11FA5B7A3480FA9" : 0
|
||||
},
|
||||
"DVTSourceControlWorkspaceBlueprintIdentifierKey" : "0231F1D2-335A-48B9-9ED2-F5EC32297E1C",
|
||||
"DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : {
|
||||
"ABA3617E9F0148F844A82502F0D808DE6591AA97" : "zerotiersdk\/zerotierone\/",
|
||||
"E606611F311EBBA46CDC9112D11FA5B7A3480FA9" : "zerotiersdk\/"
|
||||
},
|
||||
"DVTSourceControlWorkspaceBlueprintNameKey" : "ZeroTierSDK_Apple",
|
||||
"DVTSourceControlWorkspaceBlueprintVersion" : 204,
|
||||
"DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "integrations\/apple\/ZeroTierSDK_Apple\/ZeroTierSDK_Apple.xcodeproj",
|
||||
"DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [
|
||||
{
|
||||
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "http:\/\/git.int.zerotier.com\/ZeroTier\/ZeroTierOne.git",
|
||||
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
|
||||
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "ABA3617E9F0148F844A82502F0D808DE6591AA97"
|
||||
},
|
||||
{
|
||||
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "http:\/\/git.int.zerotier.com\/zerotier\/zerotiersdk.git",
|
||||
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
|
||||
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "E606611F311EBBA46CDC9112D11FA5B7A3480FA9"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0730"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "7CC0032F1D1216F8003E68DC"
|
||||
BuildableName = "ZeroTierSDK_OSX.framework"
|
||||
BlueprintName = "ZeroTierSDK_OSX"
|
||||
ReferencedContainer = "container:ZeroTierSDK_Apple.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "7CC0032F1D1216F8003E68DC"
|
||||
BuildableName = "ZeroTierSDK_OSX.framework"
|
||||
BlueprintName = "ZeroTierSDK_OSX"
|
||||
ReferencedContainer = "container:ZeroTierSDK_Apple.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "7CC0032F1D1216F8003E68DC"
|
||||
BuildableName = "ZeroTierSDK_OSX.framework"
|
||||
BlueprintName = "ZeroTierSDK_OSX"
|
||||
ReferencedContainer = "container:ZeroTierSDK_Apple.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0730"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "7CC0033B1D121741003E68DC"
|
||||
BuildableName = "ZeroTierSDK_Unity3D_OSX.bundle"
|
||||
BlueprintName = "ZeroTierSDK_Unity3D_OSX"
|
||||
ReferencedContainer = "container:ZeroTierSDK_Apple.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "7CC0033B1D121741003E68DC"
|
||||
BuildableName = "ZeroTierSDK_Unity3D_OSX.bundle"
|
||||
BlueprintName = "ZeroTierSDK_Unity3D_OSX"
|
||||
ReferencedContainer = "container:ZeroTierSDK_Apple.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "7CC0033B1D121741003E68DC"
|
||||
BuildableName = "ZeroTierSDK_Unity3D_OSX.bundle"
|
||||
BlueprintName = "ZeroTierSDK_Unity3D_OSX"
|
||||
ReferencedContainer = "container:ZeroTierSDK_Apple.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0730"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "7CC003171D1216B0003E68DC"
|
||||
BuildableName = "ZeroTierSDK_Unity3D_iOS.bundle"
|
||||
BlueprintName = "ZeroTierSDK_Unity3D_iOS"
|
||||
ReferencedContainer = "container:ZeroTierSDK_Apple.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "7CC003171D1216B0003E68DC"
|
||||
BuildableName = "ZeroTierSDK_Unity3D_iOS.bundle"
|
||||
BlueprintName = "ZeroTierSDK_Unity3D_iOS"
|
||||
ReferencedContainer = "container:ZeroTierSDK_Apple.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "7CC003171D1216B0003E68DC"
|
||||
BuildableName = "ZeroTierSDK_Unity3D_iOS.bundle"
|
||||
BlueprintName = "ZeroTierSDK_Unity3D_iOS"
|
||||
ReferencedContainer = "container:ZeroTierSDK_Apple.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0730"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "7CC003221D1216E3003E68DC"
|
||||
BuildableName = "ZeroTierSDK_iOS.framework"
|
||||
BlueprintName = "ZeroTierSDK_iOS"
|
||||
ReferencedContainer = "container:ZeroTierSDK_Apple.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "7CC003221D1216E3003E68DC"
|
||||
BuildableName = "ZeroTierSDK_iOS.framework"
|
||||
BlueprintName = "ZeroTierSDK_iOS"
|
||||
ReferencedContainer = "container:ZeroTierSDK_Apple.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "7CC003221D1216E3003E68DC"
|
||||
BuildableName = "ZeroTierSDK_iOS.framework"
|
||||
BlueprintName = "ZeroTierSDK_iOS"
|
||||
ReferencedContainer = "container:ZeroTierSDK_Apple.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Bucket
|
||||
type = "1"
|
||||
version = "2.0">
|
||||
</Bucket>
|
||||
@@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>SchemeUserState</key>
|
||||
<dict>
|
||||
<key>ZeroTierSDK_OSX.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>3</integer>
|
||||
</dict>
|
||||
<key>ZeroTierSDK_Unity3D_OSX.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>4</integer>
|
||||
</dict>
|
||||
<key>ZeroTierSDK_Unity3D_iOS.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
<key>ZeroTierSDK_iOS.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>2</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>SuppressBuildableAutocreation</key>
|
||||
<dict>
|
||||
<key>7CC003041D12164D003E68DC</key>
|
||||
<dict>
|
||||
<key>primary</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>7CC003171D1216B0003E68DC</key>
|
||||
<dict>
|
||||
<key>primary</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>7CC003221D1216E3003E68DC</key>
|
||||
<dict>
|
||||
<key>primary</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>7CC0032F1D1216F8003E68DC</key>
|
||||
<dict>
|
||||
<key>primary</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>7CC0033B1D121741003E68DC</key>
|
||||
<dict>
|
||||
<key>primary</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2016 ZeroTier Inc. All rights reserved.</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// ZeroTierSDK_OSX.h
|
||||
// ZeroTierSDK_OSX
|
||||
//
|
||||
// Created by Joseph Henry on 6/15/16.
|
||||
// Copyright © 2016 ZeroTier Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
//! Project version number for ZeroTierSDK_OSX.
|
||||
FOUNDATION_EXPORT double ZeroTierSDK_OSXVersionNumber;
|
||||
|
||||
//! Project version string for ZeroTierSDK_OSX.
|
||||
FOUNDATION_EXPORT const unsigned char ZeroTierSDK_OSXVersionString[];
|
||||
|
||||
// In this header, you should import all the public headers of your framework using statements like #import <ZeroTierSDK_OSX/PublicHeader.h>
|
||||
#import <ZeroTierSDK_OSX/SDK.h>
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>BNDL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2016 ZeroTier Inc. All rights reserved.</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>BNDL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2016 ZeroTier Inc. All rights reserved.</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// ZeroTierSDK_iOS.h
|
||||
// ZeroTierSDK_iOS
|
||||
//
|
||||
// Created by Joseph Henry on 6/15/16.
|
||||
// Copyright © 2016 ZeroTier Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
//! Project version number for ZeroTierSDK_iOS.
|
||||
FOUNDATION_EXPORT double ZeroTierSDK_iOSVersionNumber;
|
||||
|
||||
//! Project version string for ZeroTierSDK_iOS.
|
||||
FOUNDATION_EXPORT const unsigned char ZeroTierSDK_iOSVersionString[];
|
||||
|
||||
// In this header, you should import all the public headers of your framework using statements like #import <ZeroTierSDK_iOS/PublicHeader.h>
|
||||
|
||||
|
||||
@@ -124,6 +124,7 @@
|
||||
TargetAttributes = {
|
||||
7CFCB42C1D1AFEE800D3E66C = {
|
||||
CreatedOnToolsVersion = 7.3;
|
||||
LastSwiftMigration = 0810;
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -286,6 +287,7 @@
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "$(PROJECT_DIR)/../../../../src/wrappers/swift/Apple-Bridging-Header.h";
|
||||
"SWIFT_OBJC_BRIDGING_HEADER[arch=*]" = "$(PROJECT_DIR)/../../../../src/wrappers/swift/Apple-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 2.3;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -305,6 +307,7 @@
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "zerotier.Example-OSX-App";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "$(PROJECT_DIR)/../../../../src/wrappers/swift/Apple-Bridging-Header.h";
|
||||
SWIFT_VERSION = 2.3;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
||||
@@ -95,7 +95,7 @@ class ViewController: NSViewController {
|
||||
// Connect to remote host on ZeroTier virtual network
|
||||
@IBAction func UI_Connect(sender: AnyObject) {
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), {
|
||||
self.connect_thread = NSThread(target:self, selector:"attempt_connect", object:nil)
|
||||
self.connect_thread = NSThread(target:self, selector:#selector(ViewController.attempt_connect), object:nil)
|
||||
self.connect_thread.start()
|
||||
});
|
||||
}
|
||||
@@ -134,7 +134,7 @@ class ViewController: NSViewController {
|
||||
// Bind a ZeroTier socket
|
||||
@IBAction func UI_Bind(sender: AnyObject) {
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), {
|
||||
self.bind_thread = NSThread(target:self, selector:"attempt_bind", object:nil)
|
||||
self.bind_thread = NSThread(target:self, selector:#selector(ViewController.attempt_bind), object:nil)
|
||||
self.bind_thread.start()
|
||||
});
|
||||
}
|
||||
@@ -181,7 +181,7 @@ class ViewController: NSViewController {
|
||||
{
|
||||
sleep(1)
|
||||
dispatch_async(dispatch_get_main_queue()) {
|
||||
var str_buf = [Int8](count: 16, repeatedValue: 0)
|
||||
let str_buf = [Int8](count: 16, repeatedValue: 0)
|
||||
print("addr = ", String.fromCString(str_buf))
|
||||
}
|
||||
|
||||
@@ -261,7 +261,7 @@ class ViewController: NSViewController {
|
||||
|
||||
// Update UI on RX of data
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), {
|
||||
self.rx_thread = NSThread(target:self, selector:"update_rx", object:nil)
|
||||
self.rx_thread = NSThread(target:self, selector:#selector(ViewController.update_rx), object:nil)
|
||||
self.rx_thread.start()
|
||||
});
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "pico_dev_tap.h"
|
||||
#include "pico_protocol.h"
|
||||
#include "pico_socket.h"
|
||||
#include "pico_eth.h"
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
@@ -79,8 +80,8 @@ namespace ZeroTier {
|
||||
if(ip.isV4())
|
||||
{
|
||||
struct pico_ip4 ipaddr, netmask;
|
||||
ipaddr.addr = *((u32_t *)ip.rawIpData());
|
||||
netmask.addr = *((u32_t *)ip.netmask().rawIpData());
|
||||
ipaddr.addr = *((uint32_t *)ip.rawIpData());
|
||||
netmask.addr = *((uint32_t *)ip.netmask().rawIpData());
|
||||
uint8_t mac[PICO_SIZE_ETH];
|
||||
picotap->_mac.copyTo(mac, PICO_SIZE_ETH);
|
||||
DEBUG_ATTN("mac = %s", picotap->_mac.toString().c_str());
|
||||
@@ -365,16 +366,16 @@ namespace ZeroTier {
|
||||
int pico_eth_send(struct pico_device *dev, void *buf, int len)
|
||||
{
|
||||
DEBUG_INFO("len=%d", len);
|
||||
struct eth_hdr *ethhdr;
|
||||
ethhdr = (struct eth_hdr *)buf;
|
||||
struct pico_eth_hdr *ethhdr;
|
||||
ethhdr = (struct pico_eth_hdr *)buf;
|
||||
|
||||
MAC src_mac;
|
||||
MAC dest_mac;
|
||||
src_mac.setTo(ethhdr->src.addr, 6);
|
||||
dest_mac.setTo(ethhdr->dest.addr, 6);
|
||||
src_mac.setTo(ethhdr->saddr, 6);
|
||||
dest_mac.setTo(ethhdr->daddr, 6);
|
||||
|
||||
picotap->_handler(picotap->_arg,picotap->_nwid,src_mac,dest_mac,
|
||||
Utils::ntoh((uint16_t)ethhdr->type),0, ((char*)buf) + sizeof(struct eth_hdr),len - sizeof(struct eth_hdr));
|
||||
Utils::ntoh((uint16_t)ethhdr->proto),0, ((char*)buf) + sizeof(struct pico_eth_hdr),len - sizeof(struct pico_eth_hdr));
|
||||
return len;
|
||||
}
|
||||
|
||||
@@ -402,11 +403,11 @@ namespace ZeroTier {
|
||||
//}
|
||||
|
||||
// assemble new eth header
|
||||
struct eth_hdr ethhdr;
|
||||
from.copyTo(ethhdr.src.addr, 6);
|
||||
to.copyTo(ethhdr.dest.addr, 6);
|
||||
ethhdr.type = Utils::hton((uint16_t)etherType);
|
||||
int newlen = len+sizeof(struct eth_hdr);
|
||||
struct pico_eth_hdr ethhdr;
|
||||
from.copyTo(ethhdr.saddr, 6);
|
||||
to.copyTo(ethhdr.daddr, 6);
|
||||
ethhdr.proto = Utils::hton((uint16_t)etherType);
|
||||
int newlen = len+sizeof(struct pico_eth_hdr);
|
||||
//
|
||||
memcpy(tap->pico_frame_rxbuf + tap->pico_frame_rxbuf_tot, &newlen, sizeof(newlen)); // size of frame
|
||||
memcpy(tap->pico_frame_rxbuf + tap->pico_frame_rxbuf_tot + sizeof(newlen), ðhdr, sizeof(ethhdr)); // new eth header
|
||||
|
||||
@@ -44,7 +44,6 @@
|
||||
#include "Phy.hpp"
|
||||
|
||||
#include "debug.h"
|
||||
#include "tap.hpp"
|
||||
|
||||
#include "pico_stack.h"
|
||||
#include "pico_ipv4.h"
|
||||
@@ -52,6 +51,10 @@
|
||||
#include "pico_dev_tap.h"
|
||||
#include "pico_protocol.h"
|
||||
#include "pico_socket.h"
|
||||
#include "pico_device.h"
|
||||
#include "pico_ipv6.h"
|
||||
|
||||
#include "tap.hpp"
|
||||
|
||||
// picoTCP API function signatures
|
||||
#define PICO_IPV4_TO_STRING_SIG char *ipbuf, const uint32_t ip
|
||||
@@ -78,7 +81,6 @@
|
||||
#define PICO_SOCKET_SHUTDOWN_SIG struct pico_socket *s, int mode
|
||||
#define PICO_SOCKET_ACCEPT_SIG struct pico_socket *s, void *orig, uint16_t *port
|
||||
#define PICO_IPV6_LINK_ADD_SIG struct pico_device *dev, struct pico_ip6 address, struct pico_ip6 netmask
|
||||
//#define PICO_IPV6_SOURCE_FIND_SIG strut pico_ip6 *dst
|
||||
|
||||
|
||||
namespace ZeroTier {
|
||||
@@ -163,7 +165,6 @@ namespace ZeroTier {
|
||||
int (*_pico_socket_shutdown)(PICO_SOCKET_SHUTDOWN_SIG);
|
||||
struct pico_socket *(*_pico_socket_accept)(PICO_SOCKET_ACCEPT_SIG);
|
||||
int (*_pico_ipv6_link_add)(PICO_IPV6_LINK_ADD_SIG);
|
||||
//struct pico_ip6 *(*pico_ipv6_source_find)(PICO_IPV6_SOURCE_FIND_SIG);
|
||||
|
||||
Mutex _lock;
|
||||
Mutex _lock_mem;
|
||||
@@ -213,7 +214,7 @@ namespace ZeroTier {
|
||||
_pico_socket_recvfrom = (int32_t(*)(PICO_SOCKET_RECVFROM_SIG))&pico_socket_recvfrom;
|
||||
_pico_socket_open = (struct pico_socket*(*)(PICO_SOCKET_OPEN_SIG))&pico_socket_open;
|
||||
_pico_socket_bind = (int(*)(PICO_SOCKET_BIND_SIG))&pico_socket_bind;
|
||||
_pico_socket_connect = (int(*)(PICO_SOCKET_CONNECT_SIG))&pico_socket_connect;
|
||||
_pico_socket_connect = (int(*)(PICO_SOCKET_CONNECT_SIG))xt;
|
||||
_pico_socket_listen = (int(*)(PICO_SOCKET_LISTEN_SIG))&pico_socket_listen;
|
||||
_pico_socket_read = (int(*)(PICO_SOCKET_READ_SIG))&pico_socket_read;
|
||||
_pico_socket_write = (int(*)(PICO_SOCKET_WRITE_SIG))&pico_socket_write;
|
||||
@@ -221,7 +222,6 @@ namespace ZeroTier {
|
||||
_pico_socket_shutdown = (int(*)(PICO_SOCKET_SHUTDOWN_SIG))&pico_socket_shutdown;
|
||||
_pico_socket_accept = (struct pico_socket*(*)(PICO_SOCKET_ACCEPT_SIG))&pico_socket_accept;
|
||||
_pico_ipv6_link_add = (int(*)(PICO_IPV6_LINK_ADD_SIG))&pico_ipv6_link_add;
|
||||
//_pico_ipv6_source_find = (struct pico_ip6 *(*))(PICO_IPV6_SOURCE_FIND_SIG))&pico_ipv6_source_find;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -256,7 +256,6 @@ namespace ZeroTier {
|
||||
_pico_socket_shutdown = (int(*)(PICO_SOCKET_SHUTDOWN_SIG))dlsym(_libref, "pico_socket_shutdown");
|
||||
_pico_socket_accept = (struct pico_socket*(*)(PICO_SOCKET_ACCEPT_SIG))dlsym(_libref, "pico_socket_accept");
|
||||
_pico_ipv6_link_add = (int(*)(PICO_IPV6_LINK_ADD_SIG))dlsym(_libref, "pico_ipv6_link_add");
|
||||
//_pico_ipv6_source_find = (struct pico_ip6 *(*))(PICO_IPV6_SOURCE_FIND_SIG))dlsym(_libref, "pico_ipv6_source_find");
|
||||
|
||||
#endif
|
||||
}
|
||||
@@ -293,7 +292,6 @@ namespace ZeroTier {
|
||||
inline int __pico_socket_shutdown(PICO_SOCKET_SHUTDOWN_SIG) throw() { DEBUG_STACK(); Mutex::Lock _l(_lock); return _pico_socket_shutdown(s, mode); }
|
||||
inline struct pico_socket * __pico_socket_accept(PICO_SOCKET_ACCEPT_SIG) throw() { DEBUG_ATTN(); /*Mutex::Lock _l(_lock);*/ return _pico_socket_accept(s, orig, port); }
|
||||
inline int __pico_ipv6_link_add(PICO_IPV6_LINK_ADD_SIG) throw() { DEBUG_STACK(); Mutex::Lock _l(_lock); return _pico_ipv6_link_add(dev, address, netmask); }
|
||||
//inline struct pico_ipv6 * __pico_ipv6_source_find(PICO_IPV6_SOURCE_FIND_SIG) throw() { DEBUG_STACK(); Mutex::Lock _l(_lock)l return _pico_ipv6_source_find(dst); }
|
||||
};
|
||||
|
||||
} // namespace ZeroTier
|
||||
|
||||
13
src/tap.hpp
13
src/tap.hpp
@@ -44,12 +44,13 @@
|
||||
#include "Thread.hpp"
|
||||
#include "Phy.hpp"
|
||||
|
||||
#include "netif/etharp.h"
|
||||
#if defined(SDK_LWIP)
|
||||
#include "lwip.hpp"
|
||||
#include "netif/etharp.h"
|
||||
#endif
|
||||
|
||||
#include "defs.h"
|
||||
#include "rpc.h"
|
||||
#include "lwip.hpp"
|
||||
// #include "jip.hpp"
|
||||
|
||||
#if defined(SDK_PICOTCP)
|
||||
#include "picotcp.hpp"
|
||||
@@ -172,6 +173,7 @@ namespace ZeroTier {
|
||||
|
||||
// lwIP
|
||||
#if defined(SDK_LWIP)
|
||||
netif interface, interface6;
|
||||
lwIP_stack *lwipstack;
|
||||
#endif
|
||||
// jip
|
||||
@@ -366,12 +368,7 @@ namespace ZeroTier {
|
||||
void closeConnection(PhySocket *sock);
|
||||
|
||||
std::vector<Connection*> _Connections;
|
||||
|
||||
std::map<uint64_t, std::pair<PhySocket*, void*> > jobmap;
|
||||
pid_t rpcCounter;
|
||||
|
||||
netif interface;
|
||||
netif interface6;
|
||||
|
||||
Thread _thread;
|
||||
std::string _dev; // path to Unix domain socket
|
||||
|
||||
@@ -137,7 +137,7 @@ class ZTSDK : NSObject
|
||||
while(true) { // politely wait until an address is provided. simulates a blocking call
|
||||
var addrbuf = [Int8](count: 16, repeatedValue: 0)
|
||||
self.get_ipv4_address(nwid!, &addrbuf)
|
||||
var addr_str:String = String.fromCString(addrbuf)!
|
||||
let addr_str:String = String.fromCString(addrbuf)!
|
||||
if(addr_str != "-1.-1.-1.-1/-1") {
|
||||
return zt_connect(Int32(fd), addr.to_sockaddr_in(), UInt32(addr.len()));
|
||||
}
|
||||
@@ -150,7 +150,7 @@ class ZTSDK : NSObject
|
||||
while(true) { // politely wait until an address is provided. simulates a blocking call
|
||||
var addrbuf = [Int8](count: 16, repeatedValue: 0)
|
||||
self.get_ipv4_address(nwid!, &addrbuf)
|
||||
var addr_str:String = String.fromCString(addrbuf)!
|
||||
let addr_str:String = String.fromCString(addrbuf)!
|
||||
if(addr_str != "-1.-1.-1.-1/-1") {
|
||||
return zt_bind(Int32(fd), addr.to_sockaddr_in(), UInt32(addr.len()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user