├── .gitattributes ├── .github ├── FUNDING.yml └── workflows │ ├── managed.yml │ └── native.yml ├── .gitignore ├── .gitmodules ├── changelog.md ├── ext ├── CMakeLists.txt ├── build.ps1 ├── readme.md └── toolchains │ ├── aarch64-linux-gnu.toolchain.cmake │ └── arm-linux-gnueabihf.toolchain.cmake ├── img └── logo.png ├── license.txt ├── readme.md └── src ├── SharpNng.Benchmarks ├── Program.cs └── SharpNng.Benchmarks.csproj ├── SharpNng.CodeGen ├── Program.cs └── SharpNng.CodeGen.csproj ├── SharpNng.Tests ├── MiscTests.cs ├── Properties │ └── launchSettings.json ├── RequestReplyTests.cs └── SharpNng.Tests.csproj ├── SharpNng.sln ├── SharpNng ├── SharpNng.csproj ├── nng.cs ├── nng.generated.cs └── runtimes │ ├── linux-arm │ └── native │ │ └── libnng_native.so │ ├── linux-arm64 │ └── native │ │ └── libnng_native.so │ ├── linux-x64 │ └── native │ │ └── libnng_native.so │ ├── osx-arm64 │ └── native │ │ └── libnng_native.dylib │ ├── osx-x64 │ └── native │ │ └── libnng_native.dylib │ ├── win-arm │ └── native │ │ └── nng_native.dll │ ├── win-arm64 │ └── native │ │ └── nng_native.dll │ ├── win-x64 │ └── native │ │ └── nng_native.dll │ └── win-x86 │ └── native │ └── nng_native.dll ├── dotnet-releaser.toml └── global.json /.gitattributes: -------------------------------------------------------------------------------- 1 | # Set the default behavior, in case people don't have core.autocrlf set. 2 | * text=auto 3 | *.sh text eol=lf -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [xoofx] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 13 | -------------------------------------------------------------------------------- /.github/workflows/managed.yml: -------------------------------------------------------------------------------- 1 | name: managed 2 | 3 | on: 4 | push: 5 | paths-ignore: 6 | - 'doc/**' 7 | - 'ext/**' 8 | - 'img/**' 9 | - '*.md' 10 | - '*.txt' 11 | pull_request: 12 | 13 | jobs: 14 | build: 15 | runs-on: windows-latest 16 | 17 | steps: 18 | - name: Checkout 19 | uses: actions/checkout@v2 20 | with: 21 | submodules: true 22 | fetch-depth: 0 23 | 24 | - name: Install .NET 6.0 25 | uses: actions/setup-dotnet@v1 26 | with: 27 | dotnet-version: '6.0.x' 28 | 29 | - name: Build, Test, Pack, Publish 30 | shell: bash 31 | run: | 32 | dotnet tool install -g dotnet-releaser 33 | dotnet-releaser run --nuget-token "${{secrets.NUGET_TOKEN}}" --github-token "${{secrets.GITHUB_TOKEN}}" src/dotnet-releaser.toml -------------------------------------------------------------------------------- /.github/workflows/native.yml: -------------------------------------------------------------------------------- 1 | name: native 2 | 3 | on: 4 | push: 5 | paths: 6 | - 'ext/**' 7 | pull_request: 8 | paths: 9 | - 'ext/**' 10 | 11 | defaults: 12 | run: 13 | working-directory: ext 14 | 15 | jobs: 16 | build: 17 | strategy: 18 | matrix: 19 | os: [ubuntu-latest, windows-latest, macOS-latest] 20 | runs-on: ${{ matrix.os }} 21 | steps: 22 | - name: Checkout 23 | uses: actions/checkout@v1 24 | with: 25 | submodules: recursive 26 | - name: Setup Linux 27 | if: matrix.os == 'ubuntu-latest' 28 | run: | 29 | sudo apt-get install gcc-aarch64-linux-gnu 30 | sudo apt-get install g++-aarch64-linux-gnu 31 | sudo apt-get install gcc-arm-linux-gnueabihf 32 | sudo apt-get install g++-arm-linux-gnueabihf 33 | - name: Build 34 | shell: pwsh 35 | run: | 36 | ./build.ps1 37 | - name: Artifacts 38 | uses: actions/upload-artifact@v2 39 | with: 40 | name: nng-native-${{ matrix.os }} 41 | path: ext/build/package -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # Rider 14 | .idea/ 15 | 16 | # User-specific files (MonoDevelop/Xamarin Studio) 17 | *.userprefs 18 | 19 | # Mono auto generated files 20 | mono_crash.* 21 | 22 | # Build results 23 | [Dd]ebug/ 24 | [Dd]ebugPublic/ 25 | [Rr]elease/ 26 | [Rr]eleases/ 27 | x64/ 28 | x86/ 29 | [Ww][Ii][Nn]32/ 30 | [Aa][Rr][Mm]/ 31 | [Aa][Rr][Mm]64/ 32 | build/ 33 | bld/ 34 | [Bb]in/ 35 | [Oo]bj/ 36 | [Ll]og/ 37 | [Ll]ogs/ 38 | 39 | # Visual Studio 2015/2017 cache/options directory 40 | .vs/ 41 | # Uncomment if you have tasks that create the project's static files in wwwroot 42 | #wwwroot/ 43 | 44 | # Visual Studio 2017 auto generated files 45 | Generated\ Files/ 46 | 47 | # MSTest test Results 48 | [Tt]est[Rr]esult*/ 49 | [Bb]uild[Ll]og.* 50 | 51 | # NUnit 52 | *.VisualState.xml 53 | TestResult.xml 54 | nunit-*.xml 55 | 56 | # Build Results of an ATL Project 57 | [Dd]ebugPS/ 58 | [Rr]eleasePS/ 59 | dlldata.c 60 | 61 | # Benchmark Results 62 | BenchmarkDotNet.Artifacts/ 63 | 64 | # .NET Core 65 | project.lock.json 66 | project.fragment.lock.json 67 | artifacts/ 68 | 69 | # ASP.NET Scaffolding 70 | ScaffoldingReadMe.txt 71 | 72 | # StyleCop 73 | StyleCopReport.xml 74 | 75 | # Files built by Visual Studio 76 | *_i.c 77 | *_p.c 78 | *_h.h 79 | *.ilk 80 | *.meta 81 | *.obj 82 | *.iobj 83 | *.pch 84 | *.pdb 85 | *.ipdb 86 | *.pgc 87 | *.pgd 88 | *.rsp 89 | *.sbr 90 | *.tlb 91 | *.tli 92 | *.tlh 93 | *.tmp 94 | *.tmp_proj 95 | *_wpftmp.csproj 96 | *.log 97 | *.vspscc 98 | *.vssscc 99 | .builds 100 | *.pidb 101 | *.svclog 102 | *.scc 103 | 104 | # Chutzpah Test files 105 | _Chutzpah* 106 | 107 | # Visual C++ cache files 108 | ipch/ 109 | *.aps 110 | *.ncb 111 | *.opendb 112 | *.opensdf 113 | *.sdf 114 | *.cachefile 115 | *.VC.db 116 | *.VC.VC.opendb 117 | 118 | # Visual Studio profiler 119 | *.psess 120 | *.vsp 121 | *.vspx 122 | *.sap 123 | 124 | # Visual Studio Trace Files 125 | *.e2e 126 | 127 | # TFS 2012 Local Workspace 128 | $tf/ 129 | 130 | # Guidance Automation Toolkit 131 | *.gpState 132 | 133 | # ReSharper is a .NET coding add-in 134 | _ReSharper*/ 135 | *.[Rr]e[Ss]harper 136 | *.DotSettings.user 137 | 138 | # TeamCity is a build add-in 139 | _TeamCity* 140 | 141 | # DotCover is a Code Coverage Tool 142 | *.dotCover 143 | 144 | # AxoCover is a Code Coverage Tool 145 | .axoCover/* 146 | !.axoCover/settings.json 147 | 148 | # Coverlet is a free, cross platform Code Coverage Tool 149 | coverage*[.json, .xml, .info] 150 | 151 | # Visual Studio code coverage results 152 | *.coverage 153 | *.coveragexml 154 | 155 | # NCrunch 156 | _NCrunch_* 157 | .*crunch*.local.xml 158 | nCrunchTemp_* 159 | 160 | # MightyMoose 161 | *.mm.* 162 | AutoTest.Net/ 163 | 164 | # Web workbench (sass) 165 | .sass-cache/ 166 | 167 | # Installshield output folder 168 | [Ee]xpress/ 169 | 170 | # DocProject is a documentation generator add-in 171 | DocProject/buildhelp/ 172 | DocProject/Help/*.HxT 173 | DocProject/Help/*.HxC 174 | DocProject/Help/*.hhc 175 | DocProject/Help/*.hhk 176 | DocProject/Help/*.hhp 177 | DocProject/Help/Html2 178 | DocProject/Help/html 179 | 180 | # Click-Once directory 181 | publish/ 182 | 183 | # Publish Web Output 184 | *.[Pp]ublish.xml 185 | *.azurePubxml 186 | # Note: Comment the next line if you want to checkin your web deploy settings, 187 | # but database connection strings (with potential passwords) will be unencrypted 188 | *.pubxml 189 | *.publishproj 190 | 191 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 192 | # checkin your Azure Web App publish settings, but sensitive information contained 193 | # in these scripts will be unencrypted 194 | PublishScripts/ 195 | 196 | # NuGet Packages 197 | *.nupkg 198 | # NuGet Symbol Packages 199 | *.snupkg 200 | # The packages folder can be ignored because of Package Restore 201 | **/[Pp]ackages/* 202 | # except build/, which is used as an MSBuild target. 203 | !**/[Pp]ackages/build/ 204 | # Uncomment if necessary however generally it will be regenerated when needed 205 | #!**/[Pp]ackages/repositories.config 206 | # NuGet v3's project.json files produces more ignorable files 207 | *.nuget.props 208 | *.nuget.targets 209 | 210 | # Microsoft Azure Build Output 211 | csx/ 212 | *.build.csdef 213 | 214 | # Microsoft Azure Emulator 215 | ecf/ 216 | rcf/ 217 | 218 | # Windows Store app package directories and files 219 | AppPackages/ 220 | BundleArtifacts/ 221 | Package.StoreAssociation.xml 222 | _pkginfo.txt 223 | *.appx 224 | *.appxbundle 225 | *.appxupload 226 | 227 | # Visual Studio cache files 228 | # files ending in .cache can be ignored 229 | *.[Cc]ache 230 | # but keep track of directories ending in .cache 231 | !?*.[Cc]ache/ 232 | 233 | # Others 234 | ClientBin/ 235 | ~$* 236 | *~ 237 | *.dbmdl 238 | *.dbproj.schemaview 239 | *.jfm 240 | *.pfx 241 | *.publishsettings 242 | orleans.codegen.cs 243 | 244 | # Including strong name files can present a security risk 245 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 246 | #*.snk 247 | 248 | # Since there are multiple workflows, uncomment next line to ignore bower_components 249 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 250 | #bower_components/ 251 | 252 | # RIA/Silverlight projects 253 | Generated_Code/ 254 | 255 | # Backup & report files from converting an old project file 256 | # to a newer Visual Studio version. Backup files are not needed, 257 | # because we have git ;-) 258 | _UpgradeReport_Files/ 259 | Backup*/ 260 | UpgradeLog*.XML 261 | UpgradeLog*.htm 262 | ServiceFabricBackup/ 263 | *.rptproj.bak 264 | 265 | # SQL Server files 266 | *.mdf 267 | *.ldf 268 | *.ndf 269 | 270 | # Business Intelligence projects 271 | *.rdl.data 272 | *.bim.layout 273 | *.bim_*.settings 274 | *.rptproj.rsuser 275 | *- [Bb]ackup.rdl 276 | *- [Bb]ackup ([0-9]).rdl 277 | *- [Bb]ackup ([0-9][0-9]).rdl 278 | 279 | # Microsoft Fakes 280 | FakesAssemblies/ 281 | 282 | # GhostDoc plugin setting file 283 | *.GhostDoc.xml 284 | 285 | # Node.js Tools for Visual Studio 286 | .ntvs_analysis.dat 287 | node_modules/ 288 | 289 | # Visual Studio 6 build log 290 | *.plg 291 | 292 | # Visual Studio 6 workspace options file 293 | *.opt 294 | 295 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 296 | *.vbw 297 | 298 | # Visual Studio LightSwitch build output 299 | **/*.HTMLClient/GeneratedArtifacts 300 | **/*.DesktopClient/GeneratedArtifacts 301 | **/*.DesktopClient/ModelManifest.xml 302 | **/*.Server/GeneratedArtifacts 303 | **/*.Server/ModelManifest.xml 304 | _Pvt_Extensions 305 | 306 | # Paket dependency manager 307 | .paket/paket.exe 308 | paket-files/ 309 | 310 | # FAKE - F# Make 311 | .fake/ 312 | 313 | # CodeRush personal settings 314 | .cr/personal 315 | 316 | # Python Tools for Visual Studio (PTVS) 317 | __pycache__/ 318 | *.pyc 319 | 320 | # Cake - Uncomment if you are using it 321 | # tools/** 322 | # !tools/packages.config 323 | 324 | # Tabs Studio 325 | *.tss 326 | 327 | # Telerik's JustMock configuration file 328 | *.jmconfig 329 | 330 | # BizTalk build output 331 | *.btp.cs 332 | *.btm.cs 333 | *.odx.cs 334 | *.xsd.cs 335 | 336 | # OpenCover UI analysis results 337 | OpenCover/ 338 | 339 | # Azure Stream Analytics local run output 340 | ASALocalRun/ 341 | 342 | # MSBuild Binary and Structured Log 343 | *.binlog 344 | 345 | # NVidia Nsight GPU debugger configuration file 346 | *.nvuser 347 | 348 | # MFractors (Xamarin productivity tool) working folder 349 | .mfractor/ 350 | 351 | # Local History for Visual Studio 352 | .localhistory/ 353 | 354 | # BeatPulse healthcheck temp database 355 | healthchecksdb 356 | 357 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 358 | MigrationBackup/ 359 | 360 | # Ionide (cross platform F# VS Code tools) working folder 361 | .ionide/ 362 | 363 | # Rust 364 | /lib/blake3_dotnet/target 365 | Cargo.lock 366 | 367 | # dotnet-releaser 368 | artifacts-dotnet-releaser/ 369 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "ext/nng"] 2 | path = ext/nng 3 | url = https://github.com/nanomsg/nng.git 4 | -------------------------------------------------------------------------------- /changelog.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | > This changelog is no longer used for newer version. Please visits https://github.com/xoofx/SharpNng/releases 4 | 5 | ## 0.1.0 6 | 7 | Initial version. -------------------------------------------------------------------------------- /ext/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(nng_native) 3 | 4 | set(BUILD_SHARED_LIBS ON) 5 | set(NNG_ELIDE_DEPRECATED ON) 6 | 7 | add_subdirectory(nng) 8 | 9 | # Force static CRT linking with MSVC 10 | if (MSVC) 11 | set_target_properties(nng PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") 12 | target_compile_options(nng PRIVATE "$<$:/Zi>") 13 | target_link_options(nng PRIVATE "$<$:/DEBUG>") 14 | target_link_options(nng PRIVATE "$<$:/OPT:REF>") 15 | target_link_options(nng PRIVATE "$<$:/OPT:ICF>") 16 | endif() 17 | set_target_properties(nng PROPERTIES OUTPUT_NAME "nng_native") 18 | -------------------------------------------------------------------------------- /ext/build.ps1: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env pwsh 2 | # 3 | # Build script for nng, building the following platforms: 4 | # 5 | # On Windows: 6 | # win-x86 7 | # win-x64 8 | # win-arm 9 | # win-arm64 10 | # 11 | # On Linux: 12 | # linux-x64 13 | # linux-arm 14 | # linux-arm64 15 | # 16 | # On Mac: 17 | # osx-x64 18 | # osx-arm64 19 | # ------------------------------------------------------------- 20 | $ErrorActionPreference = "Stop" 21 | Try { 22 | $BuildFolder = "build" 23 | 24 | # Common function used for building x86/x64/arm/arm64 25 | function Build-Project { 26 | 27 | param ( 28 | $NETArch 29 | ) 30 | 31 | # Setup the correct build system and outputs based on platform 32 | $NETPlatform = "linux" 33 | $NETSharedLibExtension = "so" 34 | $CMakeBuilder = "Unix Makefiles" 35 | $CMakeArch = "" 36 | $BuildPlatformSubFolder = "/nng" 37 | if ($IsMacOS) { 38 | $NETPlatform = "osx" 39 | $NETSharedLibExtension = "dylib" 40 | if ($NETArch -eq "arm64") { 41 | $CMakeArch = "-DCMAKE_OSX_ARCHITECTURES=arm64" 42 | } 43 | } 44 | elseif ($IsWindows) { 45 | $MsvcArch = $NETArch 46 | if ($MsvcArch -eq "x86") { 47 | $MsvcArch = "win32" 48 | } 49 | $NETPlatform = "win" 50 | $NETSharedLibExtension = "dll" 51 | $CMakeBuilder = "Visual Studio 16 2019" 52 | $CMakeArch = "-A$MsvcArch" 53 | $BuildPlatformSubFolder = "/nng/Release" 54 | } elseif ($IsLinux) { 55 | if ($NETArch -eq "arm64") { 56 | $CMakeArch = "-DCMAKE_TOOLCHAIN_FILE=toolchains/aarch64-linux-gnu.toolchain.cmake" 57 | } 58 | elseif ($NETArch -eq "arm") { 59 | $CMakeArch = "-DCMAKE_TOOLCHAIN_FILE=toolchains/arm-linux-gnueabihf.toolchain.cmake" 60 | } 61 | } 62 | 63 | Write-Host "Building nng $NETPlatform-$NETArch" -ForegroundColor Green 64 | 65 | $BuildPlatformFolder = "$BuildFolder/$NETPlatform-$NETArch" 66 | $PackageFolder = "$BuildFolder/package/$NETPlatform-$NETArch/native/" 67 | 68 | & cmake -G"$CMakeBuilder" $CMakeArch -B"$BuildPlatformFolder" 69 | if ($LastExitCode -ne 0) { 70 | throw "error with cmake" 71 | } 72 | & cmake --build "$BuildPlatformFolder" --config Release 73 | if ($LastExitCode -ne 0) { 74 | throw "error with cmake --build" 75 | } 76 | 77 | New-Item -type Directory -Path $PackageFolder -Force 78 | Copy-Item "$BuildPlatformFolder$BuildPlatformSubFolder/*.$NETSharedLibExtension" -Destination $PackageFolder 79 | } 80 | 81 | if (Test-Path $BuildFolder) { 82 | Remove-Item -Path $BuildFolder -Recurse 83 | } 84 | 85 | if ($IsWindows) { 86 | Build-Project x86 87 | } 88 | 89 | if ($IsWindows -Or $IsMacOS -Or $IsLinux) { 90 | Build-Project x64 91 | Build-Project arm64 92 | } 93 | 94 | if ($IsWindows -Or $IsLinux) { 95 | Build-Project arm 96 | } 97 | 98 | } Catch { 99 | $message = $_.Exception | Out-String 100 | $line = $_.InvocationInfo.ScriptLineNumber 101 | Write-Host "Error at line $line : $message" -ForegroundColor Red 102 | exit 1 103 | } 104 | -------------------------------------------------------------------------------- /ext/readme.md: -------------------------------------------------------------------------------- 1 | # Building `nng_native` shared library 2 | 3 | Prerequisites, you need to install: 4 | 5 | - Powershell core [pwsh](https://github.com/PowerShell/PowerShell) 6 | - [CMake >= 3.16](https://cmake.org/download/) 7 | 8 | Then per platform, you also need to install: 9 | - On Windows: VS 2022 + C++ toolchain x86/x64/arm/arm64 10 | - On Linux: C++ toolchain x64/arm/arm64 11 | 12 | The script can be run `.\build.ps1` and should generate `nng_native.dll` and platform equivalents to `build\package` folder. -------------------------------------------------------------------------------- /ext/toolchains/aarch64-linux-gnu.toolchain.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_SYSTEM_NAME Linux) 2 | set(CMAKE_SYSTEM_PROCESSOR aarch64) 3 | 4 | set(CMAKE_C_COMPILER "aarch64-linux-gnu-gcc") 5 | set(CMAKE_CXX_COMPILER "aarch64-linux-gnu-g++") 6 | 7 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 8 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 9 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 10 | 11 | set(CMAKE_C_FLAGS "-march=armv8-a") 12 | set(CMAKE_CXX_FLAGS "-march=armv8-a") 13 | 14 | # cache flags 15 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c flags") 16 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING "c++ flags") 17 | -------------------------------------------------------------------------------- /ext/toolchains/arm-linux-gnueabihf.toolchain.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_SYSTEM_NAME Linux) 2 | set(CMAKE_SYSTEM_PROCESSOR arm) 3 | 4 | set(CMAKE_C_COMPILER "arm-linux-gnueabihf-gcc") 5 | set(CMAKE_CXX_COMPILER "arm-linux-gnueabihf-g++") 6 | 7 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 8 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 9 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 10 | 11 | set(CMAKE_C_FLAGS "-march=armv7-a -mfloat-abi=hard -mfpu=neon") 12 | set(CMAKE_CXX_FLAGS "-march=armv7-a -mfloat-abi=hard -mfpu=neon") 13 | 14 | # cache flags 15 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c flags") 16 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING "c++ flags") 17 | -------------------------------------------------------------------------------- /img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xoofx/SharpNng/10190b307544833402d96780c9503054100baab4/img/logo.png -------------------------------------------------------------------------------- /license.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2021, Alexandre Mutel 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification 5 | , are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 18 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 21 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 22 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # SharpNng [![Build Status](https://github.com/xoofx/SharpNng/workflows/managed/badge.svg?branch=main)](https://github.com/xoofx/SharpNng/actions) [![Build Status](https://github.com/xoofx/SharpNng/workflows/native/badge.svg?branch=main)](https://github.com/xoofx/SharpNng/actions) [![NuGet](https://img.shields.io/nuget/v/SharpNng.svg)](https://www.nuget.org/packages/SharpNng/) 2 | 3 | 4 | 5 | SharpNng is a lightweight low-level managed wrapper around [NNG](https://nng.nanomsg.org/) a Lightweight Messaging Library. 6 | 7 | > **NOTE**: This project is archived as I had no use in the end about it. 8 | > The _native_ version of NNG used by SharpNng is `1.5.2` 9 | 10 | ## Features 11 | 12 | - Strict mapping with the C API 13 | - Pure DllImport library via `using static nng;` 14 | - Compatible with `netstandard2.0` and `netstandard2.1+` 15 | - Fast interop with `Span` friendly API. 16 | 17 | ## Usage 18 | 19 | - Install the [SharpNng](https://www.nuget.org/packages/SharpNng/) NuGet Package to your project. 20 | 21 | ```c# 22 | using static nng; 23 | // port of https://nanomsg.org/gettingstarted/nng/reqrep.html 24 | string ipcName = $"ipc:///tmp/SharpNng_{Guid.NewGuid():N}.ipc"; 25 | 26 | var sync = new EventWaitHandle(false, EventResetMode.ManualReset); 27 | 28 | void Node0() 29 | { 30 | nng_socket sock = default; 31 | 32 | int result = nng_rep0_open(ref sock); 33 | nng_assert(result); 34 | try 35 | { 36 | nng_listener listener = default; 37 | result = nng_listen(sock, ipcName, ref listener, 0); 38 | nng_assert(result); 39 | 40 | IntPtr buf; 41 | size_t sz = default; 42 | 43 | TestContext.Out.WriteLine("Server: Listening"); 44 | 45 | sync.Set(); 46 | 47 | unsafe 48 | { 49 | result = nng_recv(sock, new IntPtr(&buf), ref sz, NNG_FLAG_ALLOC); 50 | nng_assert(result); 51 | } 52 | 53 | Assert.AreEqual(4, sz.Value.ToInt64()); 54 | 55 | nng_free(buf, sz); 56 | } 57 | finally 58 | { 59 | result = nng_close(sock); 60 | } 61 | }; 62 | 63 | void Node1() 64 | { 65 | TestContext.Out.WriteLine("Client: Started"); 66 | 67 | nng_socket sock = default; 68 | 69 | int result = nng_req0_open(ref sock); 70 | nng_assert(result); 71 | 72 | try 73 | { 74 | nng_dialer dialer = default; 75 | result = nng_dial(sock, ipcName, ref dialer, 0); 76 | nng_assert(result); 77 | 78 | TestContext.Out.WriteLine("Client: Connected"); 79 | 80 | unsafe 81 | { 82 | int value = 0x6afedead; 83 | result = nng_send(sock, new IntPtr(&value), 4, 0); 84 | nng_assert(result); 85 | } 86 | } 87 | finally 88 | { 89 | result = nng_close(sock); 90 | } 91 | }; 92 | 93 | // Start the server 94 | var thread = new Thread(Node0) 95 | { 96 | IsBackground = true 97 | }; 98 | thread.Start(); 99 | 100 | // Wait for the server to start 101 | sync.WaitOne(1000); 102 | 103 | // Run the client 104 | Node1(); 105 | ``` 106 | 107 | ## Platforms 108 | 109 | SharpNng is supported on the following platforms: 110 | 111 | - `win-x64`, `win-x86`, `win-arm64`, `win-arm` 112 | - `linux-x64`, `linux-arm64`, `linux-arm` 113 | - `osx-x64`, `osx-arm64` 114 | 115 | > Note that the Linux version might probably only work on debian derivatives for now... 116 | 117 | ## How to Build? 118 | 119 | You need to install the [.NET 6 SDK](https://dotnet.microsoft.com/download/dotnet/6.0). Then from the root folder: 120 | 121 | ```console 122 | $ dotnet build src -c Release 123 | ``` 124 | 125 | In order to rebuild the native binaries, you need to run the build scripts from [ext](https://github.com/xoofx/SharpNng/blob/main/ext/readme.md) 126 | 127 | ## License 128 | 129 | This software is released under the [BSD-Clause 2 license](https://opensource.org/licenses/BSD-2-Clause). 130 | 131 | ## Author 132 | 133 | Alexandre Mutel aka [xoofx](https://xoofx.com). 134 | -------------------------------------------------------------------------------- /src/SharpNng.Benchmarks/Program.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | using static nng; 3 | 4 | const int count = 100000; 5 | 6 | if (args.Length == 2) 7 | { 8 | switch (args[0]) 9 | { 10 | case "--server": 11 | Server(args[1]); 12 | break; 13 | } 14 | } 15 | else 16 | { 17 | foreach (var size in new int[] { 128, 1024, 16384 }) 18 | { 19 | Benchmark($"ipc:///tmp/SharpNngBenchmarks_{Guid.NewGuid():N}.ipc", size); 20 | Benchmark($"tcp://127.0.0.1:6001", size); 21 | } 22 | } 23 | 24 | static void Benchmark(string ipcName, int size) 25 | { 26 | var benchKind = ipcName.Substring(0, ipcName.IndexOf(':')); 27 | Console.WriteLine($"==========================================================================================="); 28 | Console.WriteLine($"Benchmarking {benchKind} - Data Size = {size}"); 29 | 30 | var process = new Process(); 31 | process.StartInfo = new ProcessStartInfo(Process.GetCurrentProcess().MainModule.FileName, $"--server {ipcName}") 32 | { 33 | RedirectStandardError = true, 34 | RedirectStandardOutput = true, 35 | UseShellExecute = false, 36 | WindowStyle = ProcessWindowStyle.Hidden, 37 | CreateNoWindow = true 38 | }; 39 | 40 | process.ErrorDataReceived += server_ErrorDataReceived; 41 | process.OutputDataReceived += server_OutputDataReceived; 42 | process.EnableRaisingEvents = true; 43 | process.Start(); 44 | process.BeginOutputReadLine(); 45 | process.BeginErrorReadLine(); 46 | 47 | Thread.Sleep(1000); 48 | var clock = Stopwatch.StartNew(); 49 | bool processTerminated = false; 50 | try 51 | { 52 | Client(ipcName, 128); 53 | clock.Stop(); 54 | process.WaitForExit(1000); 55 | processTerminated = true; 56 | Console.WriteLine($"{benchKind}: {((double)count) / clock.Elapsed.TotalSeconds} request_reply/s"); 57 | Console.WriteLine($"{benchKind}: {clock.Elapsed.TotalMilliseconds * 1000.0 / (double)count} μs/request_reply"); 58 | } 59 | finally 60 | { 61 | if (!processTerminated) 62 | { 63 | process.Kill(); 64 | } 65 | } 66 | } 67 | 68 | static void Server(string ipcName) 69 | { 70 | nng_socket sock = default; 71 | 72 | long sizeInBytesReceived = 0; 73 | 74 | int result = nng_rep0_open(ref sock); 75 | nng_assert(result); 76 | try 77 | { 78 | Console.Out.WriteLine($"Server: Starting {ipcName}"); 79 | 80 | nng_listener listener = default; 81 | result = nng_listen(sock, ipcName, ref listener, 0); 82 | nng_assert(result); 83 | 84 | Console.Out.WriteLine("Server: Listening"); 85 | for (int i = 0; i < count; i++) 86 | { 87 | // Receive the buffer 88 | result = nng_recv(sock, out var buffer); 89 | nng_assert(result); 90 | sizeInBytesReceived += buffer.Length; 91 | // Send the same buffer back 92 | result = nng_send(sock, buffer.AsSpan()); 93 | nng_assert(result); 94 | buffer.Dispose(); 95 | } 96 | } 97 | finally 98 | { 99 | nng_close(sock); 100 | Console.WriteLine($"Server: Closed ({sizeInBytesReceived} bytes received)"); 101 | } 102 | }; 103 | 104 | static void Client(string ipcName, int size) 105 | { 106 | Console.Out.WriteLine("Client: Started"); 107 | 108 | nng_socket sock = default; 109 | 110 | int result = nng_req0_open(ref sock); 111 | nng_assert(result); 112 | var buffer = new byte[size]; 113 | 114 | try 115 | { 116 | nng_dialer dialer = default; 117 | for (int i = 0; i < 10; i++) 118 | { 119 | result = nng_dial(sock, ipcName, ref dialer, 0); 120 | if (result == 0) break; 121 | Console.WriteLine("Client: dial failed, waiting for server to listen - sleep 100ms"); 122 | Thread.Sleep(100); 123 | } 124 | 125 | nng_assert(result); 126 | 127 | Console.Out.WriteLine("Client: Connected"); 128 | Console.Out.WriteLine("Client: Sending"); 129 | for (int i = 0; i < count; i++) 130 | { 131 | result = nng_send(sock, buffer); 132 | nng_assert(result); 133 | 134 | result = nng_recv(sock, out var recvbuffer); 135 | nng_assert(result); 136 | if (recvbuffer.Length != buffer.Length) throw new InvalidOperationException("Size is not matching"); 137 | recvbuffer.Dispose(); 138 | } 139 | } 140 | finally 141 | { 142 | nng_close(sock); 143 | Console.WriteLine("Client: Closed"); 144 | } 145 | }; 146 | 147 | 148 | static void server_ErrorDataReceived(object sender, DataReceivedEventArgs e) 149 | { 150 | if (e.Data == null) return; 151 | Console.WriteLine(e.Data); 152 | } 153 | 154 | static void server_OutputDataReceived(object sender, DataReceivedEventArgs e) 155 | { 156 | if (e.Data == null) return; 157 | Console.WriteLine(e.Data); 158 | } 159 | -------------------------------------------------------------------------------- /src/SharpNng.Benchmarks/SharpNng.Benchmarks.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net6.0 6 | enable 7 | enable 8 | True 9 | false 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | PreserveNewest 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/SharpNng.CodeGen/Program.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Alexandre Mutel. All rights reserved. 2 | // Licensed under the BSD-Clause 2 license. 3 | // See license.txt file in the project root for full license information. 4 | using System; 5 | using System.IO; 6 | using System.Linq; 7 | using CppAst; 8 | using CppAst.CodeGen.Common; 9 | using CppAst.CodeGen.CSharp; 10 | using Zio.FileSystems; 11 | 12 | namespace SharpNng.CodeGen 13 | { 14 | /// 15 | /// Programs that generate the P/Invoke for SharpNng. 16 | /// 17 | class Program 18 | { 19 | private static readonly string NngFolder = Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, @"..\..\..\..\..\ext\nng")); 20 | 21 | static void Main(string[] args) 22 | { 23 | var program = new Program(); 24 | program.GeneratePInvoke(); 25 | } 26 | 27 | /// 28 | /// Generates the PInvoke layer from nng C header files. 29 | /// 30 | public void GeneratePInvoke() 31 | { 32 | var srcFolder = Path.Combine(NngFolder, "include"); 33 | var destFolder = Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, @"..\..\..\..\..\nng.NET")); 34 | 35 | if (!Directory.Exists(srcFolder)) 36 | { 37 | throw new DirectoryNotFoundException($"The source folder `{srcFolder}` doesn't exist"); 38 | } 39 | if (!Directory.Exists(destFolder)) 40 | { 41 | throw new DirectoryNotFoundException($"The destination folder `{destFolder}` doesn't exist"); 42 | } 43 | 44 | var csOptions = new CSharpConverterOptions() 45 | { 46 | DefaultClassLib = "nng", 47 | DefaultNamespace = "nng", 48 | DefaultOutputFilePath = "/nng.generated.cs", 49 | DefaultDllImportNameAndArguments = "nngDll", 50 | GenerateAsInternal = false, 51 | DispatchOutputPerInclude = false, 52 | DefaultMarshalForString = new CSharpMarshalAttribute(CSharpUnmanagedKind.CustomMarshaler) { MarshalTypeRef = "typeof(FastUtf8StringMarshaller)" }, 53 | Defines = 54 | { 55 | "NNG_SHARED_LIB", 56 | "NNG_ELIDE_DEPRECATED", 57 | }, 58 | MappingRules = 59 | { 60 | e => e.Map("nng_aio_alloc").Discard(), 61 | e => e.Map("nng_http_handler_alloc").Discard(), 62 | e => e.Map("nng_http_handler_set_data").Discard(), 63 | e => e.Map("nng_thread_create").Discard(), 64 | e => e.MapMacroToConst("NNG_DURATION_.*", "int"), 65 | e => e.MapMacroToConst("NNG_FLAG_.*", "int"), 66 | e => e.MapMacroToConst("NNG_OPT_.*", "char*"), 67 | } 68 | }; 69 | csOptions.IncludeFolders.Add(srcFolder); 70 | 71 | var files = Directory.GetFiles(srcFolder, "*.h", SearchOption.AllDirectories).Where(x => !x.Contains("compat") && !x.Contains("supplemental")).ToList(); 72 | 73 | var csCompilation = CSharpConverter.Convert(files, csOptions); 74 | 75 | if (csCompilation.HasErrors) 76 | { 77 | foreach (var message in csCompilation.Diagnostics.Messages) 78 | { 79 | Console.Error.WriteLine(message); 80 | } 81 | Console.Error.WriteLine("Unexpected parsing errors"); 82 | Environment.Exit(1); 83 | } 84 | 85 | // Remove the generated namespace 86 | var csFile = csCompilation.Members.OfType().First(); 87 | var csNamespace = csFile.Members.OfType().First(); 88 | 89 | var usings = csNamespace.Members.OfType().ToList(); 90 | foreach (var use in usings) 91 | { 92 | csNamespace.Members.Remove(use); 93 | } 94 | 95 | var nngClass = csNamespace.Members.OfType().First(); 96 | csNamespace.Members.Remove(nngClass); 97 | csFile.Members.Remove(csNamespace); 98 | 99 | foreach (var use in usings) 100 | { 101 | csFile.Members.Add(use); 102 | } 103 | csFile.Members.Add(nngClass); 104 | 105 | // Use proper string marshaller 106 | foreach (var member in nngClass.Members.OfType()) 107 | { 108 | if (member.ReturnType is CSharpTypeWithAttributes typeWithAttribute && typeWithAttribute.ElementType is CSharpPrimitiveType primitiveType && primitiveType.Kind == CSharpPrimitiveKind.String) 109 | { 110 | var marshalAttribute = typeWithAttribute.Attributes.OfType().First(); 111 | marshalAttribute.UnmanagedType = CSharpUnmanagedKind.CustomMarshaler; 112 | marshalAttribute.MarshalTypeRef = "typeof(ReturnUtf8StringMarshaller)"; 113 | } 114 | 115 | } 116 | nngClass.Attributes.Add(new CSharpFreeAttribute("System.Security.SuppressUnmanagedCodeSecurity")); 117 | 118 | // Make record struct for all structs postfix with `_s` 119 | foreach (var member in nngClass.Members.OfType()) 120 | { 121 | if (member.Name.EndsWith("_s")) 122 | { 123 | member.IsRecord = true; 124 | } 125 | } 126 | 127 | // Write generated file back to disk 128 | var fs = new PhysicalFileSystem(); 129 | { 130 | var subfs = new SubFileSystem(fs, fs.ConvertPathFromInternal(destFolder)); 131 | var codeWriter = new CodeWriter(new CodeWriterOptions(subfs)); 132 | csCompilation.DumpTo(codeWriter); 133 | } 134 | } 135 | } 136 | } 137 | -------------------------------------------------------------------------------- /src/SharpNng.CodeGen/SharpNng.CodeGen.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net6.0 6 | 7 | enable 8 | false 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/SharpNng.Tests/MiscTests.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Alexandre Mutel. All rights reserved. 2 | // Licensed under the BSD-Clause 2 license. 3 | // See license.txt file in the project root for full license information. 4 | using System; 5 | using System.Runtime.CompilerServices; 6 | using System.Runtime.InteropServices; 7 | using System.Threading; 8 | using NUnit.Framework; 9 | 10 | using static nng; 11 | 12 | namespace SharpNng.Tests 13 | { 14 | public class MiscTests 15 | { 16 | [Test] 17 | public void CheckVersion() 18 | { 19 | var version = nng_version(); 20 | Assert.NotNull(version); 21 | StringAssert.StartsWith("1.", version); 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /src/SharpNng.Tests/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "Nng.Tests": { 4 | "commandName": "Project", 5 | "nativeDebugging": true 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /src/SharpNng.Tests/RequestReplyTests.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Alexandre Mutel. All rights reserved. 2 | // Licensed under the BSD-Clause 2 license. 3 | // See license.txt file in the project root for full license information. 4 | using System; 5 | using System.Runtime.CompilerServices; 6 | using System.Runtime.InteropServices; 7 | using System.Threading; 8 | using NUnit.Framework; 9 | 10 | using static nng; 11 | 12 | namespace SharpNng.Tests 13 | { 14 | public class RequestReplyTests 15 | { 16 | [Test] 17 | public void TestRequestReply() 18 | { 19 | // https://nanomsg.org/gettingstarted/nng/reqrep.html 20 | string ipcName = $"ipc:///tmp/SharpNng_{Guid.NewGuid():N}.ipc"; 21 | 22 | var sync = new EventWaitHandle(false, EventResetMode.ManualReset); 23 | 24 | void Node0() 25 | { 26 | nng_socket sock = default; 27 | 28 | int result = nng_rep0_open(ref sock); 29 | nng_assert(result); 30 | try 31 | { 32 | nng_listener listener = default; 33 | result = nng_listen(sock, ipcName, ref listener, 0); 34 | nng_assert(result); 35 | 36 | IntPtr buf; 37 | size_t sz = default; 38 | 39 | TestContext.Out.WriteLine("Server: Listening"); 40 | 41 | sync.Set(); 42 | 43 | unsafe 44 | { 45 | result = nng_recv(sock, new IntPtr(&buf), ref sz, NNG_FLAG_ALLOC); 46 | nng_assert(result); 47 | } 48 | 49 | Assert.AreEqual(4, sz.Value.ToInt64()); 50 | 51 | nng_free(buf, sz); 52 | } 53 | finally 54 | { 55 | result = nng_close(sock); 56 | } 57 | }; 58 | 59 | void Node1() 60 | { 61 | TestContext.Out.WriteLine("Client: Started"); 62 | 63 | nng_socket sock = default; 64 | 65 | int result = nng_req0_open(ref sock); 66 | nng_assert(result); 67 | 68 | try 69 | { 70 | nng_dialer dialer = default; 71 | result = nng_dial(sock, ipcName, ref dialer, 0); 72 | nng_assert(result); 73 | 74 | TestContext.Out.WriteLine("Client: Connected"); 75 | 76 | unsafe 77 | { 78 | int value = 0x6afedead; 79 | result = nng_send(sock, new IntPtr(&value), 4, 0); 80 | nng_assert(result); 81 | } 82 | } 83 | finally 84 | { 85 | result = nng_close(sock); 86 | } 87 | }; 88 | 89 | // Start the server 90 | var thread = new Thread(Node0) 91 | { 92 | IsBackground = true 93 | }; 94 | thread.Start(); 95 | 96 | // Wait for the server to start 97 | sync.WaitOne(1000); 98 | 99 | // Run the client 100 | Node1(); 101 | } 102 | } 103 | } -------------------------------------------------------------------------------- /src/SharpNng.Tests/SharpNng.Tests.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net6.0 5 | enable 6 | false 7 | True 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | PreserveNewest 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/SharpNng.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.0.31903.59 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SharpNng", "SharpNng\SharpNng.csproj", "{C5D70498-5263-40F2-8909-51BE027E7E55}" 7 | EndProject 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SharpNng.CodeGen", "SharpNng.CodeGen\SharpNng.CodeGen.csproj", "{283A09E9-0A84-4E73-937C-E8FA6EDB5729}" 9 | EndProject 10 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SharpNng.Tests", "SharpNng.Tests\SharpNng.Tests.csproj", "{382AE5A4-5FAA-4971-8F74-5D6A39ADB48D}" 11 | EndProject 12 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{ABDCCD4D-8936-423B-AD35-3F19B5DC1EAA}" 13 | ProjectSection(SolutionItems) = preProject 14 | ..\.gitignore = ..\.gitignore 15 | ..\changelog.md = ..\changelog.md 16 | dotnet-releaser.toml = dotnet-releaser.toml 17 | global.json = global.json 18 | ..\license.txt = ..\license.txt 19 | ..\.github\workflows\managed.yml = ..\.github\workflows\managed.yml 20 | ..\.github\workflows\native.yml = ..\.github\workflows\native.yml 21 | ..\readme.md = ..\readme.md 22 | EndProjectSection 23 | EndProject 24 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SharpNng.Benchmarks", "SharpNng.Benchmarks\SharpNng.Benchmarks.csproj", "{B8B0BD36-78F1-44BD-AA67-0BB47912D06C}" 25 | EndProject 26 | Global 27 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 28 | Debug|Any CPU = Debug|Any CPU 29 | Release|Any CPU = Release|Any CPU 30 | EndGlobalSection 31 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 32 | {C5D70498-5263-40F2-8909-51BE027E7E55}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 33 | {C5D70498-5263-40F2-8909-51BE027E7E55}.Debug|Any CPU.Build.0 = Debug|Any CPU 34 | {C5D70498-5263-40F2-8909-51BE027E7E55}.Release|Any CPU.ActiveCfg = Release|Any CPU 35 | {C5D70498-5263-40F2-8909-51BE027E7E55}.Release|Any CPU.Build.0 = Release|Any CPU 36 | {283A09E9-0A84-4E73-937C-E8FA6EDB5729}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 37 | {283A09E9-0A84-4E73-937C-E8FA6EDB5729}.Debug|Any CPU.Build.0 = Debug|Any CPU 38 | {283A09E9-0A84-4E73-937C-E8FA6EDB5729}.Release|Any CPU.ActiveCfg = Release|Any CPU 39 | {283A09E9-0A84-4E73-937C-E8FA6EDB5729}.Release|Any CPU.Build.0 = Release|Any CPU 40 | {382AE5A4-5FAA-4971-8F74-5D6A39ADB48D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 41 | {382AE5A4-5FAA-4971-8F74-5D6A39ADB48D}.Debug|Any CPU.Build.0 = Debug|Any CPU 42 | {382AE5A4-5FAA-4971-8F74-5D6A39ADB48D}.Release|Any CPU.ActiveCfg = Release|Any CPU 43 | {382AE5A4-5FAA-4971-8F74-5D6A39ADB48D}.Release|Any CPU.Build.0 = Release|Any CPU 44 | {B8B0BD36-78F1-44BD-AA67-0BB47912D06C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 45 | {B8B0BD36-78F1-44BD-AA67-0BB47912D06C}.Debug|Any CPU.Build.0 = Debug|Any CPU 46 | {B8B0BD36-78F1-44BD-AA67-0BB47912D06C}.Release|Any CPU.ActiveCfg = Release|Any CPU 47 | {B8B0BD36-78F1-44BD-AA67-0BB47912D06C}.Release|Any CPU.Build.0 = Release|Any CPU 48 | EndGlobalSection 49 | GlobalSection(SolutionProperties) = preSolution 50 | HideSolutionNode = FALSE 51 | EndGlobalSection 52 | GlobalSection(ExtensibilityGlobals) = postSolution 53 | SolutionGuid = {63941435-7870-4703-A79A-E423494B39C1} 54 | EndGlobalSection 55 | EndGlobal 56 | -------------------------------------------------------------------------------- /src/SharpNng/SharpNng.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.0;netstandard2.1 5 | True 6 | 10.0 7 | 8 | 9 | $(NoWarn);CS1591;CS0419;CS1734;CS1572;CS1573;CS1574 10 | true 11 | SharpNng is a lightweight low-level managed wrapper around the Lightweight Messaging Library NNG - https://nng.nanomsg.org 12 | Alexandre Mutel 13 | en-US 14 | Alexandre Mutel 15 | nanomsg; nng; messaging; network 16 | logo.png 17 | readme.md 18 | https://github.com/xoofx/SharpNng 19 | BSD-2-Clause 20 | 21 | true 22 | true 23 | snupkg 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | %(Identity) 38 | true 39 | 40 | 41 | 42 | 43 | 44 | all 45 | runtime; build; native; contentfiles; analyzers; buildtransitive 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /src/SharpNng/nng.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Alexandre Mutel. All rights reserved. 2 | // Licensed under the BSD-Clause 2 license. 3 | // See license.txt file in the project root for full license information. 4 | using System; 5 | using System.Runtime.InteropServices; 6 | using System.Text; 7 | // ReSharper disable InconsistentNaming 8 | public static partial class nng 9 | { 10 | public const string nngDll = "nng_native"; 11 | 12 | /// 13 | /// nng_send sends (or arranges to send) the data on the socket. Note that 14 | /// this function may (will!) return before any receiver has actually 15 | /// received the data. The return value will be zero to indicate that the 16 | /// socket has accepted the entire data for send, or an errno to indicate 17 | /// failure. 18 | /// 19 | public static unsafe int nng_send(nng.nng_socket arg0, ReadOnlySpan arg2, bool nonBlocking = false) 20 | { 21 | fixed (byte* arg4 = &MemoryMarshal.GetReference(arg2)) 22 | { 23 | return nng_send(arg0, (IntPtr)arg4, arg2.Length, nonBlocking ? NNG_FLAG_NONBLOCK : 0); 24 | } 25 | } 26 | 27 | /// 28 | /// nng_recv receives message data into the socket, up to the supplied size. 29 | /// The actual size of the message data will be written to the value pointed 30 | /// to by size. The flags may include NNG_FLAG_NONBLOCK and NNG_FLAG_ALLOC. 31 | /// If NNG_FLAG_ALLOC is supplied then the library will allocate memory for 32 | /// the caller. In that case the pointer to the allocated will be stored 33 | /// instead of the data itself. The caller is responsible for freeing the 34 | /// associated memory with nng_free(). 35 | /// 36 | public static unsafe int nng_recv(nng.nng_socket arg0, out NngBuffer buffer, bool nonBlocking = false) 37 | { 38 | IntPtr pBuffer = default; 39 | size_t size = default; 40 | var result = nng_recv(arg0, new IntPtr(&pBuffer), ref size, (nonBlocking ? NNG_FLAG_NONBLOCK : 0) | NNG_FLAG_ALLOC); 41 | buffer = result == 0 ? new NngBuffer(pBuffer, size.Value.ToInt32()) : default; 42 | return result; 43 | } 44 | 45 | /// 46 | /// nng_aio_alloc allocates a new AIO, and associated the completion 47 | /// callback and its opaque argument. If NULL is supplied for the 48 | /// callback, then the caller must use nng_aio_wait() to wait for the 49 | /// operation to complete. If the completion callback is not NULL, then 50 | /// when a submitted operation completes (or is canceled or fails) the 51 | /// callback will be executed, generally in a different thread, with no 52 | /// locks held. 53 | /// 54 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 55 | public static extern unsafe int nng_aio_alloc(out nng_aio arg0, delegate* unmanaged[Cdecl] callback, IntPtr callbackContext = default); 56 | 57 | /// 58 | /// Throws a if the result is non zero. 59 | /// 60 | /// Result from the nng function 61 | public static void nng_assert(int result) 62 | { 63 | if (result == 0) return; 64 | throw NngException.Create((nng_errno_enum)result); 65 | } 66 | 67 | /// 68 | /// Wrapper around a memory buffer allocated by . 69 | /// 70 | public readonly struct NngBuffer : IDisposable 71 | { 72 | public NngBuffer(IntPtr pointer, int length) 73 | { 74 | if (pointer == IntPtr.Zero) throw new ArgumentException("pointer cannot be null", nameof(pointer)); 75 | if (length < 0) throw new ArgumentOutOfRangeException($"length ({length}) be < 0", nameof(length)); 76 | Pointer = pointer; 77 | Length = length; 78 | } 79 | 80 | public NngBuffer(int length) 81 | { 82 | if (length < 0) throw new ArgumentOutOfRangeException(nameof(length)); 83 | Pointer = nng_alloc(length); 84 | if (Pointer == IntPtr.Zero) throw new InvalidOperationException($"Unable to allocate {nameof(NngBuffer)} of size {length} bytes"); 85 | Length = length; 86 | } 87 | 88 | public readonly IntPtr Pointer; 89 | 90 | public readonly int Length; 91 | 92 | /// 93 | /// Calls 94 | /// 95 | public void Dispose() 96 | { 97 | nng_free(Pointer, Length); 98 | } 99 | 100 | public unsafe Span AsSpan() 101 | { 102 | return new Span((void*)Pointer, Length); 103 | } 104 | 105 | public override string ToString() 106 | { 107 | return $"{nameof(Pointer)}: 0x{Pointer.ToString("x8")}, {nameof(Length)}: {Length}"; 108 | } 109 | } 110 | 111 | public partial struct size_t 112 | { 113 | public static implicit operator size_t(int value) 114 | { 115 | return new size_t(new IntPtr(value)); 116 | } 117 | } 118 | 119 | /// 120 | /// Exception wrapping error code nng_errno_enum 121 | /// 122 | public class NngException : Exception 123 | { 124 | private NngException(nng_errno_enum result, string message) : base(message) 125 | { 126 | Value = result; 127 | } 128 | 129 | public nng_errno_enum Value { get; } 130 | 131 | public static NngException Create(nng_errno_enum result) 132 | { 133 | var errorString = nng_strerror((int)result); 134 | return new NngException(result, $"{errorString} ({result} = {(int)result})"); 135 | } 136 | } 137 | 138 | /// 139 | /// Marshaller used for returning string from nng 140 | /// 141 | private class ReturnUtf8StringMarshaller : ICustomMarshaler 142 | { 143 | private static readonly ReturnUtf8StringMarshaller Instance = new(); 144 | 145 | public static ICustomMarshaler GetInstance(string s) 146 | { 147 | return Instance; 148 | } 149 | 150 | public void CleanUpManagedData(object o) 151 | { 152 | } 153 | 154 | public void CleanUpNativeData(IntPtr pNativeData) 155 | { 156 | } 157 | 158 | public int GetNativeDataSize() 159 | { 160 | return IntPtr.Size; 161 | } 162 | 163 | public unsafe IntPtr MarshalManagedToNative(object obj) 164 | { 165 | throw new NotSupportedException(); 166 | } 167 | 168 | public object MarshalNativeToManaged(IntPtr pNativeData) 169 | { 170 | unsafe 171 | { 172 | int length = 0; 173 | byte* pNativeDataPtr = (byte*)pNativeData; 174 | while (*pNativeDataPtr != 0) 175 | { 176 | length++; 177 | pNativeDataPtr++; 178 | } 179 | 180 | return Encoding.UTF8.GetString((byte*)pNativeData, length); 181 | } 182 | } 183 | } 184 | 185 | /// 186 | /// Marshaller used for returning string from nng 187 | /// 188 | private class FastUtf8StringMarshaller : ICustomMarshaler 189 | { 190 | private static readonly FastUtf8StringMarshaller Instance = new(); 191 | 192 | public static ICustomMarshaler GetInstance(string s) 193 | { 194 | return Instance; 195 | } 196 | 197 | public void CleanUpManagedData(object o) 198 | { 199 | } 200 | 201 | public void CleanUpNativeData(IntPtr pNativeData) 202 | { 203 | Marshal.FreeHGlobal(pNativeData); 204 | } 205 | 206 | public int GetNativeDataSize() 207 | { 208 | return IntPtr.Size; 209 | } 210 | 211 | public unsafe IntPtr MarshalManagedToNative(object obj) 212 | { 213 | if (obj == null) return IntPtr.Zero; 214 | 215 | var str = (string)obj; 216 | var length = Encoding.UTF8.GetByteCount(str); 217 | var ptr = (byte*)Marshal.AllocHGlobal(length + 1); 218 | //Encoding.UTF8.GetBytes((string)obj, 0, 219 | fixed (char* pStr = str) 220 | Encoding.UTF8.GetEncoder().GetBytes(pStr, str.Length, ptr, length, true); 221 | ptr[length] = 0; 222 | return (IntPtr)ptr; 223 | } 224 | 225 | public object MarshalNativeToManaged(IntPtr pNativeData) 226 | { 227 | throw new NotSupportedException(); 228 | } 229 | } 230 | } 231 | -------------------------------------------------------------------------------- /src/SharpNng/nng.generated.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | using System; 11 | 12 | using System.Runtime.InteropServices; 13 | 14 | [System.Security.SuppressUnmanagedCodeSecurity] 15 | public static partial class nng 16 | { 17 | public enum nng_sockaddr_family : int 18 | { 19 | NNG_AF_UNSPEC = unchecked((int)0), 20 | 21 | NNG_AF_INPROC = unchecked((int)1), 22 | 23 | NNG_AF_IPC = unchecked((int)2), 24 | 25 | NNG_AF_INET = unchecked((int)3), 26 | 27 | NNG_AF_INET6 = unchecked((int)4), 28 | 29 | /// 30 | /// ZeroTier 31 | /// 32 | NNG_AF_ZT = unchecked((int)5), 33 | 34 | NNG_AF_ABSTRACT = unchecked((int)6), 35 | } 36 | 37 | public const nng.nng_sockaddr_family NNG_AF_UNSPEC = nng_sockaddr_family.NNG_AF_UNSPEC; 38 | 39 | public const nng.nng_sockaddr_family NNG_AF_INPROC = nng_sockaddr_family.NNG_AF_INPROC; 40 | 41 | public const nng.nng_sockaddr_family NNG_AF_IPC = nng_sockaddr_family.NNG_AF_IPC; 42 | 43 | public const nng.nng_sockaddr_family NNG_AF_INET = nng_sockaddr_family.NNG_AF_INET; 44 | 45 | public const nng.nng_sockaddr_family NNG_AF_INET6 = nng_sockaddr_family.NNG_AF_INET6; 46 | 47 | /// 48 | /// ZeroTier 49 | /// 50 | public const nng.nng_sockaddr_family NNG_AF_ZT = nng_sockaddr_family.NNG_AF_ZT; 51 | 52 | public const nng.nng_sockaddr_family NNG_AF_ABSTRACT = nng_sockaddr_family.NNG_AF_ABSTRACT; 53 | 54 | /// 55 | /// Arguably the pipe callback functions could be handled as an option, 56 | /// but with the need to specify an argument, we find it best to unify 57 | /// this as a separate function to pass in the argument and the callback. 58 | /// Only one callback can be set on a given socket, and there is no way 59 | /// to retrieve the old value. 60 | /// 61 | public enum nng_pipe_ev : int 62 | { 63 | /// 64 | /// Called just before pipe added to socket 65 | /// 66 | NNG_PIPE_EV_ADD_PRE, 67 | 68 | /// 69 | /// Called just after pipe added to socket 70 | /// 71 | NNG_PIPE_EV_ADD_POST, 72 | 73 | /// 74 | /// Called just after pipe removed from socket 75 | /// 76 | NNG_PIPE_EV_REM_POST, 77 | 78 | /// 79 | /// Used internally, must be last. 80 | /// 81 | NNG_PIPE_EV_NUM, 82 | } 83 | 84 | /// 85 | /// Called just before pipe added to socket 86 | /// 87 | public const nng.nng_pipe_ev NNG_PIPE_EV_ADD_PRE = nng_pipe_ev.NNG_PIPE_EV_ADD_PRE; 88 | 89 | /// 90 | /// Called just after pipe added to socket 91 | /// 92 | public const nng.nng_pipe_ev NNG_PIPE_EV_ADD_POST = nng_pipe_ev.NNG_PIPE_EV_ADD_POST; 93 | 94 | /// 95 | /// Called just after pipe removed from socket 96 | /// 97 | public const nng.nng_pipe_ev NNG_PIPE_EV_REM_POST = nng_pipe_ev.NNG_PIPE_EV_REM_POST; 98 | 99 | /// 100 | /// Used internally, must be last. 101 | /// 102 | public const nng.nng_pipe_ev NNG_PIPE_EV_NUM = nng_pipe_ev.NNG_PIPE_EV_NUM; 103 | 104 | public enum nng_stat_type_enum : int 105 | { 106 | /// 107 | /// Stat is for scoping, and carries no value 108 | /// 109 | NNG_STAT_SCOPE = unchecked((int)0), 110 | 111 | /// 112 | /// Numeric "absolute" value, diffs meaningless 113 | /// 114 | NNG_STAT_LEVEL = unchecked((int)1), 115 | 116 | /// 117 | /// Incrementing value (diffs are meaningful) 118 | /// 119 | NNG_STAT_COUNTER = unchecked((int)2), 120 | 121 | /// 122 | /// Value is a string 123 | /// 124 | NNG_STAT_STRING = unchecked((int)3), 125 | 126 | /// 127 | /// Value is a boolean 128 | /// 129 | NNG_STAT_BOOLEAN = unchecked((int)4), 130 | 131 | /// 132 | /// Value is a numeric ID 133 | /// 134 | NNG_STAT_ID = unchecked((int)5), 135 | } 136 | 137 | /// 138 | /// Stat is for scoping, and carries no value 139 | /// 140 | public const nng.nng_stat_type_enum NNG_STAT_SCOPE = nng_stat_type_enum.NNG_STAT_SCOPE; 141 | 142 | /// 143 | /// Numeric "absolute" value, diffs meaningless 144 | /// 145 | public const nng.nng_stat_type_enum NNG_STAT_LEVEL = nng_stat_type_enum.NNG_STAT_LEVEL; 146 | 147 | /// 148 | /// Incrementing value (diffs are meaningful) 149 | /// 150 | public const nng.nng_stat_type_enum NNG_STAT_COUNTER = nng_stat_type_enum.NNG_STAT_COUNTER; 151 | 152 | /// 153 | /// Value is a string 154 | /// 155 | public const nng.nng_stat_type_enum NNG_STAT_STRING = nng_stat_type_enum.NNG_STAT_STRING; 156 | 157 | /// 158 | /// Value is a boolean 159 | /// 160 | public const nng.nng_stat_type_enum NNG_STAT_BOOLEAN = nng_stat_type_enum.NNG_STAT_BOOLEAN; 161 | 162 | /// 163 | /// Value is a numeric ID 164 | /// 165 | public const nng.nng_stat_type_enum NNG_STAT_ID = nng_stat_type_enum.NNG_STAT_ID; 166 | 167 | public enum nng_unit_enum : int 168 | { 169 | /// 170 | /// No special units 171 | /// 172 | NNG_UNIT_NONE = unchecked((int)0), 173 | 174 | /// 175 | /// Bytes, e.g. bytes sent, etc. 176 | /// 177 | NNG_UNIT_BYTES = unchecked((int)1), 178 | 179 | /// 180 | /// Messages, one per message 181 | /// 182 | NNG_UNIT_MESSAGES = unchecked((int)2), 183 | 184 | /// 185 | /// Milliseconds 186 | /// 187 | NNG_UNIT_MILLIS = unchecked((int)3), 188 | 189 | /// 190 | /// Some other type of event 191 | /// 192 | NNG_UNIT_EVENTS = unchecked((int)4), 193 | } 194 | 195 | /// 196 | /// No special units 197 | /// 198 | public const nng.nng_unit_enum NNG_UNIT_NONE = nng_unit_enum.NNG_UNIT_NONE; 199 | 200 | /// 201 | /// Bytes, e.g. bytes sent, etc. 202 | /// 203 | public const nng.nng_unit_enum NNG_UNIT_BYTES = nng_unit_enum.NNG_UNIT_BYTES; 204 | 205 | /// 206 | /// Messages, one per message 207 | /// 208 | public const nng.nng_unit_enum NNG_UNIT_MESSAGES = nng_unit_enum.NNG_UNIT_MESSAGES; 209 | 210 | /// 211 | /// Milliseconds 212 | /// 213 | public const nng.nng_unit_enum NNG_UNIT_MILLIS = nng_unit_enum.NNG_UNIT_MILLIS; 214 | 215 | /// 216 | /// Some other type of event 217 | /// 218 | public const nng.nng_unit_enum NNG_UNIT_EVENTS = nng_unit_enum.NNG_UNIT_EVENTS; 219 | 220 | /// 221 | /// Error codes. These generally have different values from UNIX errnos, 222 | /// so take care about converting them. The one exception is that 0 is 223 | /// unambiguously "success". 224 | /// 225 | /// 226 | /// NNG_SYSERR is a special code, which allows us to wrap errors from the 227 | /// underlying operating system. We generally prefer to map errors to one 228 | /// of the above, but if we cannot, then we just encode an error this way. 229 | /// The bit is large enough to accommodate all known UNIX and Win32 error 230 | /// codes. We try hard to match things semantically to one of our standard 231 | /// errors. For example, a connection reset or aborted we treat as a 232 | /// closed connection, because that's basically what it means. (The remote 233 | /// peer closed the connection.) For certain kinds of resource exhaustion 234 | /// we treat it the same as memory. But for files, etc. that's OS-specific, 235 | /// and we use the generic below. Some of the above error codes we use 236 | /// internally, and the application should never see (e.g. NNG_EINTR).NNG_ETRANERR is like ESYSERR, but is used to wrap transport specific 237 | /// errors, from different transports. It should only be used when none 238 | /// of the other options are available. 239 | /// 240 | public enum nng_errno_enum : int 241 | { 242 | NNG_EINTR = unchecked((int)1), 243 | 244 | NNG_ENOMEM = unchecked((int)2), 245 | 246 | NNG_EINVAL = unchecked((int)3), 247 | 248 | NNG_EBUSY = unchecked((int)4), 249 | 250 | NNG_ETIMEDOUT = unchecked((int)5), 251 | 252 | NNG_ECONNREFUSED = unchecked((int)6), 253 | 254 | NNG_ECLOSED = unchecked((int)7), 255 | 256 | NNG_EAGAIN = unchecked((int)8), 257 | 258 | NNG_ENOTSUP = unchecked((int)9), 259 | 260 | NNG_EADDRINUSE = unchecked((int)10), 261 | 262 | NNG_ESTATE = unchecked((int)11), 263 | 264 | NNG_ENOENT = unchecked((int)12), 265 | 266 | NNG_EPROTO = unchecked((int)13), 267 | 268 | NNG_EUNREACHABLE = unchecked((int)14), 269 | 270 | NNG_EADDRINVAL = unchecked((int)15), 271 | 272 | NNG_EPERM = unchecked((int)16), 273 | 274 | NNG_EMSGSIZE = unchecked((int)17), 275 | 276 | NNG_ECONNABORTED = unchecked((int)18), 277 | 278 | NNG_ECONNRESET = unchecked((int)19), 279 | 280 | NNG_ECANCELED = unchecked((int)20), 281 | 282 | NNG_ENOFILES = unchecked((int)21), 283 | 284 | NNG_ENOSPC = unchecked((int)22), 285 | 286 | NNG_EEXIST = unchecked((int)23), 287 | 288 | NNG_EREADONLY = unchecked((int)24), 289 | 290 | NNG_EWRITEONLY = unchecked((int)25), 291 | 292 | NNG_ECRYPTO = unchecked((int)26), 293 | 294 | NNG_EPEERAUTH = unchecked((int)27), 295 | 296 | NNG_ENOARG = unchecked((int)28), 297 | 298 | NNG_EAMBIGUOUS = unchecked((int)29), 299 | 300 | NNG_EBADTYPE = unchecked((int)30), 301 | 302 | NNG_ECONNSHUT = unchecked((int)31), 303 | 304 | NNG_EINTERNAL = unchecked((int)1000), 305 | 306 | NNG_ESYSERR = unchecked((int)0x10000000), 307 | 308 | NNG_ETRANERR = unchecked((int)0x20000000), 309 | } 310 | 311 | public const nng.nng_errno_enum NNG_EINTR = nng_errno_enum.NNG_EINTR; 312 | 313 | public const nng.nng_errno_enum NNG_ENOMEM = nng_errno_enum.NNG_ENOMEM; 314 | 315 | public const nng.nng_errno_enum NNG_EINVAL = nng_errno_enum.NNG_EINVAL; 316 | 317 | public const nng.nng_errno_enum NNG_EBUSY = nng_errno_enum.NNG_EBUSY; 318 | 319 | public const nng.nng_errno_enum NNG_ETIMEDOUT = nng_errno_enum.NNG_ETIMEDOUT; 320 | 321 | public const nng.nng_errno_enum NNG_ECONNREFUSED = nng_errno_enum.NNG_ECONNREFUSED; 322 | 323 | public const nng.nng_errno_enum NNG_ECLOSED = nng_errno_enum.NNG_ECLOSED; 324 | 325 | public const nng.nng_errno_enum NNG_EAGAIN = nng_errno_enum.NNG_EAGAIN; 326 | 327 | public const nng.nng_errno_enum NNG_ENOTSUP = nng_errno_enum.NNG_ENOTSUP; 328 | 329 | public const nng.nng_errno_enum NNG_EADDRINUSE = nng_errno_enum.NNG_EADDRINUSE; 330 | 331 | public const nng.nng_errno_enum NNG_ESTATE = nng_errno_enum.NNG_ESTATE; 332 | 333 | public const nng.nng_errno_enum NNG_ENOENT = nng_errno_enum.NNG_ENOENT; 334 | 335 | public const nng.nng_errno_enum NNG_EPROTO = nng_errno_enum.NNG_EPROTO; 336 | 337 | public const nng.nng_errno_enum NNG_EUNREACHABLE = nng_errno_enum.NNG_EUNREACHABLE; 338 | 339 | public const nng.nng_errno_enum NNG_EADDRINVAL = nng_errno_enum.NNG_EADDRINVAL; 340 | 341 | public const nng.nng_errno_enum NNG_EPERM = nng_errno_enum.NNG_EPERM; 342 | 343 | public const nng.nng_errno_enum NNG_EMSGSIZE = nng_errno_enum.NNG_EMSGSIZE; 344 | 345 | public const nng.nng_errno_enum NNG_ECONNABORTED = nng_errno_enum.NNG_ECONNABORTED; 346 | 347 | public const nng.nng_errno_enum NNG_ECONNRESET = nng_errno_enum.NNG_ECONNRESET; 348 | 349 | public const nng.nng_errno_enum NNG_ECANCELED = nng_errno_enum.NNG_ECANCELED; 350 | 351 | public const nng.nng_errno_enum NNG_ENOFILES = nng_errno_enum.NNG_ENOFILES; 352 | 353 | public const nng.nng_errno_enum NNG_ENOSPC = nng_errno_enum.NNG_ENOSPC; 354 | 355 | public const nng.nng_errno_enum NNG_EEXIST = nng_errno_enum.NNG_EEXIST; 356 | 357 | public const nng.nng_errno_enum NNG_EREADONLY = nng_errno_enum.NNG_EREADONLY; 358 | 359 | public const nng.nng_errno_enum NNG_EWRITEONLY = nng_errno_enum.NNG_EWRITEONLY; 360 | 361 | public const nng.nng_errno_enum NNG_ECRYPTO = nng_errno_enum.NNG_ECRYPTO; 362 | 363 | public const nng.nng_errno_enum NNG_EPEERAUTH = nng_errno_enum.NNG_EPEERAUTH; 364 | 365 | public const nng.nng_errno_enum NNG_ENOARG = nng_errno_enum.NNG_ENOARG; 366 | 367 | public const nng.nng_errno_enum NNG_EAMBIGUOUS = nng_errno_enum.NNG_EAMBIGUOUS; 368 | 369 | public const nng.nng_errno_enum NNG_EBADTYPE = nng_errno_enum.NNG_EBADTYPE; 370 | 371 | public const nng.nng_errno_enum NNG_ECONNSHUT = nng_errno_enum.NNG_ECONNSHUT; 372 | 373 | public const nng.nng_errno_enum NNG_EINTERNAL = nng_errno_enum.NNG_EINTERNAL; 374 | 375 | public const nng.nng_errno_enum NNG_ESYSERR = nng_errno_enum.NNG_ESYSERR; 376 | 377 | public const nng.nng_errno_enum NNG_ETRANERR = nng_errno_enum.NNG_ETRANERR; 378 | 379 | /// 380 | /// Network status values. 381 | /// These values are supplied to help folks checking status. They are the 382 | /// return values from zt_opt_status. We avoid hard coding them as defines, 383 | /// to keep applications from baking in values that may change if the 384 | /// underlying ZeroTier transport changes. 385 | /// 386 | public enum nng_zt_status : int 387 | { 388 | NNG_ZT_STATUS_UP, 389 | 390 | NNG_ZT_STATUS_CONFIG, 391 | 392 | NNG_ZT_STATUS_DENIED, 393 | 394 | NNG_ZT_STATUS_NOTFOUND, 395 | 396 | NNG_ZT_STATUS_ERROR, 397 | 398 | NNG_ZT_STATUS_OBSOLETE, 399 | 400 | NNG_ZT_STATUS_UNKNOWN, 401 | } 402 | 403 | public const nng.nng_zt_status NNG_ZT_STATUS_UP = nng_zt_status.NNG_ZT_STATUS_UP; 404 | 405 | public const nng.nng_zt_status NNG_ZT_STATUS_CONFIG = nng_zt_status.NNG_ZT_STATUS_CONFIG; 406 | 407 | public const nng.nng_zt_status NNG_ZT_STATUS_DENIED = nng_zt_status.NNG_ZT_STATUS_DENIED; 408 | 409 | public const nng.nng_zt_status NNG_ZT_STATUS_NOTFOUND = nng_zt_status.NNG_ZT_STATUS_NOTFOUND; 410 | 411 | public const nng.nng_zt_status NNG_ZT_STATUS_ERROR = nng_zt_status.NNG_ZT_STATUS_ERROR; 412 | 413 | public const nng.nng_zt_status NNG_ZT_STATUS_OBSOLETE = nng_zt_status.NNG_ZT_STATUS_OBSOLETE; 414 | 415 | public const nng.nng_zt_status NNG_ZT_STATUS_UNKNOWN = nng_zt_status.NNG_ZT_STATUS_UNKNOWN; 416 | 417 | /// 418 | /// Identifiers are wrapped in a structure to improve compiler validation 419 | /// of incorrect passing. This gives us strong type checking. Modern 420 | /// compilers compile passing these by value to identical code as passing 421 | /// the integer type (at least with optimization applied). Please do not 422 | /// access the ID member directly. 423 | /// 424 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] 425 | public partial record struct nng_ctx_s 426 | { 427 | public uint id; 428 | } 429 | 430 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] 431 | public partial record struct nng_dialer_s 432 | { 433 | public uint id; 434 | } 435 | 436 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] 437 | public partial record struct nng_listener_s 438 | { 439 | public uint id; 440 | } 441 | 442 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] 443 | public partial record struct nng_pipe_s 444 | { 445 | public uint id; 446 | } 447 | 448 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] 449 | public partial record struct nng_socket_s 450 | { 451 | public uint id; 452 | } 453 | 454 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] 455 | public readonly partial struct nng_msg : IEquatable 456 | { 457 | private readonly IntPtr _handle; 458 | 459 | public nng_msg(IntPtr handle) => _handle = handle; 460 | 461 | public IntPtr Handle => _handle; 462 | 463 | public bool Equals(nng_msg other) => _handle.Equals(other._handle); 464 | 465 | public override bool Equals(object obj) => obj is nng_msg other && Equals(other); 466 | 467 | public override int GetHashCode() => _handle.GetHashCode(); 468 | 469 | public override string ToString() => "0x" + (IntPtr.Size == 8 ? _handle.ToString("X16") : _handle.ToString("X8")); 470 | 471 | public static bool operator ==(nng_msg left, nng_msg right) => left.Equals(right); 472 | 473 | public static bool operator !=(nng_msg left, nng_msg right) => !left.Equals(right); 474 | } 475 | 476 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] 477 | public readonly partial struct nng_stat : IEquatable 478 | { 479 | private readonly IntPtr _handle; 480 | 481 | public nng_stat(IntPtr handle) => _handle = handle; 482 | 483 | public IntPtr Handle => _handle; 484 | 485 | public bool Equals(nng_stat other) => _handle.Equals(other._handle); 486 | 487 | public override bool Equals(object obj) => obj is nng_stat other && Equals(other); 488 | 489 | public override int GetHashCode() => _handle.GetHashCode(); 490 | 491 | public override string ToString() => "0x" + (IntPtr.Size == 8 ? _handle.ToString("X16") : _handle.ToString("X8")); 492 | 493 | public static bool operator ==(nng_stat left, nng_stat right) => left.Equals(right); 494 | 495 | public static bool operator !=(nng_stat left, nng_stat right) => !left.Equals(right); 496 | } 497 | 498 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] 499 | public readonly partial struct nng_aio : IEquatable 500 | { 501 | private readonly IntPtr _handle; 502 | 503 | public nng_aio(IntPtr handle) => _handle = handle; 504 | 505 | public IntPtr Handle => _handle; 506 | 507 | public bool Equals(nng_aio other) => _handle.Equals(other._handle); 508 | 509 | public override bool Equals(object obj) => obj is nng_aio other && Equals(other); 510 | 511 | public override int GetHashCode() => _handle.GetHashCode(); 512 | 513 | public override string ToString() => "0x" + (IntPtr.Size == 8 ? _handle.ToString("X16") : _handle.ToString("X8")); 514 | 515 | public static bool operator ==(nng_aio left, nng_aio right) => left.Equals(right); 516 | 517 | public static bool operator !=(nng_aio left, nng_aio right) => !left.Equals(right); 518 | } 519 | 520 | /// 521 | /// Some address details. This is in some ways like a traditional sockets 522 | /// sockaddr, but we have our own to cope with our unique families, etc. 523 | /// The details of this structure are directly exposed to applications. 524 | /// These structures can be obtained via property lookups, etc. 525 | /// 526 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] 527 | public partial struct nng_sockaddr_inproc 528 | { 529 | public ushort sa_family; 530 | 531 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] 532 | public string sa_name; 533 | } 534 | 535 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] 536 | public partial struct nng_sockaddr_path 537 | { 538 | public ushort sa_family; 539 | 540 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] 541 | public string sa_path; 542 | } 543 | 544 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] 545 | public unsafe partial struct nng_sockaddr_in6 546 | { 547 | public ushort sa_family; 548 | 549 | public ushort sa_port; 550 | 551 | public fixed byte sa_addr[16]; 552 | 553 | public uint sa_scope; 554 | } 555 | 556 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] 557 | public partial struct nng_sockaddr_in 558 | { 559 | public ushort sa_family; 560 | 561 | public ushort sa_port; 562 | 563 | public uint sa_addr; 564 | } 565 | 566 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] 567 | public partial struct nng_sockaddr_zt 568 | { 569 | public ushort sa_family; 570 | 571 | public ulong sa_nwid; 572 | 573 | public ulong sa_nodeid; 574 | 575 | public uint sa_port; 576 | } 577 | 578 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] 579 | public unsafe partial struct nng_sockaddr_abstract 580 | { 581 | public ushort sa_family; 582 | 583 | /// 584 | /// will be 0 - 107 max. 585 | /// 586 | public ushort sa_len; 587 | 588 | /// 589 | /// 108 linux/windows, without leading NUL 590 | /// 591 | public fixed byte sa_name[107]; 592 | } 593 | 594 | /// 595 | /// nng_sockaddr_storage is the the size required to store any nng_sockaddr. 596 | /// This size must not change, and no individual nng_sockaddr type may grow 597 | /// larger than this without breaking binary compatibility. 598 | /// 599 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] 600 | public unsafe partial struct nng_sockaddr_storage 601 | { 602 | public ushort sa_family; 603 | 604 | public fixed ulong sa_pad[16]; 605 | } 606 | 607 | [StructLayout(LayoutKind.Explicit, CharSet = CharSet.Ansi)] 608 | public partial struct nng_sockaddr 609 | { 610 | [FieldOffset(0)] 611 | public ushort s_family; 612 | 613 | [FieldOffset(0)] 614 | public nng.nng_sockaddr_ipc s_ipc; 615 | 616 | [FieldOffset(0)] 617 | public nng.nng_sockaddr_inproc s_inproc; 618 | 619 | [FieldOffset(0)] 620 | public nng.nng_sockaddr_in6 s_in6; 621 | 622 | [FieldOffset(0)] 623 | public nng.nng_sockaddr_in s_in; 624 | 625 | [FieldOffset(0)] 626 | public nng.nng_sockaddr_zt s_zt; 627 | 628 | [FieldOffset(0)] 629 | public nng.nng_sockaddr_abstract s_abstract; 630 | 631 | [FieldOffset(0)] 632 | public nng.nng_sockaddr_storage s_storage; 633 | } 634 | 635 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] 636 | public readonly partial struct nng_sockaddr_ipc : IEquatable 637 | { 638 | public nng_sockaddr_ipc(nng.nng_sockaddr_path value) => this.Value = value; 639 | 640 | public readonly nng.nng_sockaddr_path Value; 641 | 642 | public bool Equals(nng_sockaddr_ipc other) => Value.Equals(other.Value); 643 | 644 | public override bool Equals(object obj) => obj is nng_sockaddr_ipc other && Equals(other); 645 | 646 | public override int GetHashCode() => Value.GetHashCode(); 647 | 648 | public override string ToString() => Value.ToString(); 649 | 650 | public static implicit operator nng.nng_sockaddr_path(nng_sockaddr_ipc from) => from.Value; 651 | 652 | public static implicit operator nng_sockaddr_ipc(nng.nng_sockaddr_path from) => new nng_sockaddr_ipc(from); 653 | 654 | public static bool operator ==(nng_sockaddr_ipc left, nng_sockaddr_ipc right) => left.Equals(right); 655 | 656 | public static bool operator !=(nng_sockaddr_ipc left, nng_sockaddr_ipc right) => !left.Equals(right); 657 | } 658 | 659 | /// 660 | /// Scatter/gather I/O. 661 | /// 662 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] 663 | public partial struct nng_iov 664 | { 665 | public IntPtr iov_buf; 666 | 667 | public nng.size_t iov_len; 668 | } 669 | 670 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] 671 | public readonly partial struct size_t : IEquatable 672 | { 673 | public size_t(IntPtr value) => this.Value = value; 674 | 675 | public readonly IntPtr Value; 676 | 677 | public bool Equals(size_t other) => Value.Equals(other.Value); 678 | 679 | public override bool Equals(object obj) => obj is size_t other && Equals(other); 680 | 681 | public override int GetHashCode() => Value.GetHashCode(); 682 | 683 | public override string ToString() => Value.ToString(); 684 | 685 | public static implicit operator IntPtr(size_t from) => from.Value; 686 | 687 | public static implicit operator size_t(IntPtr from) => new size_t(from); 688 | 689 | public static bool operator ==(size_t left, size_t right) => left.Equals(right); 690 | 691 | public static bool operator !=(size_t left, size_t right) => !left.Equals(right); 692 | } 693 | 694 | /// 695 | /// URL support. We frequently want to process a URL, and these methods 696 | /// give us a convenient way of doing so. 697 | /// 698 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] 699 | public partial struct nng_url 700 | { 701 | /// 702 | /// never NULL 703 | /// 704 | public IntPtr u_rawurl; 705 | 706 | /// 707 | /// never NULL 708 | /// 709 | public IntPtr u_scheme; 710 | 711 | /// 712 | /// will be NULL if not specified 713 | /// 714 | public IntPtr u_userinfo; 715 | 716 | /// 717 | /// including colon and port 718 | /// 719 | public IntPtr u_host; 720 | 721 | /// 722 | /// name only, will be "" if not specified 723 | /// 724 | public IntPtr u_hostname; 725 | 726 | /// 727 | /// port, will be "" if not specified 728 | /// 729 | public IntPtr u_port; 730 | 731 | /// 732 | /// path, will be "" if not specified 733 | /// 734 | public IntPtr u_path; 735 | 736 | /// 737 | /// without '?', will be NULL if not specified 738 | /// 739 | public IntPtr u_query; 740 | 741 | /// 742 | /// without '#', will be NULL if not specified 743 | /// 744 | public IntPtr u_fragment; 745 | 746 | /// 747 | /// includes query and fragment, "" if not specified 748 | /// 749 | public IntPtr u_requri; 750 | } 751 | 752 | /// 753 | /// nng_stream operations permit direct access to low level streams, 754 | /// which can have a variety of uses. Internally most of the transports 755 | /// are built on top of these. Streams are created by other dialers or 756 | /// listeners. The API for creating dialers and listeners varies. 757 | /// 758 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] 759 | public readonly partial struct nng_stream : IEquatable 760 | { 761 | private readonly IntPtr _handle; 762 | 763 | public nng_stream(IntPtr handle) => _handle = handle; 764 | 765 | public IntPtr Handle => _handle; 766 | 767 | public bool Equals(nng_stream other) => _handle.Equals(other._handle); 768 | 769 | public override bool Equals(object obj) => obj is nng_stream other && Equals(other); 770 | 771 | public override int GetHashCode() => _handle.GetHashCode(); 772 | 773 | public override string ToString() => "0x" + (IntPtr.Size == 8 ? _handle.ToString("X16") : _handle.ToString("X8")); 774 | 775 | public static bool operator ==(nng_stream left, nng_stream right) => left.Equals(right); 776 | 777 | public static bool operator !=(nng_stream left, nng_stream right) => !left.Equals(right); 778 | } 779 | 780 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] 781 | public readonly partial struct nng_stream_dialer : IEquatable 782 | { 783 | private readonly IntPtr _handle; 784 | 785 | public nng_stream_dialer(IntPtr handle) => _handle = handle; 786 | 787 | public IntPtr Handle => _handle; 788 | 789 | public bool Equals(nng_stream_dialer other) => _handle.Equals(other._handle); 790 | 791 | public override bool Equals(object obj) => obj is nng_stream_dialer other && Equals(other); 792 | 793 | public override int GetHashCode() => _handle.GetHashCode(); 794 | 795 | public override string ToString() => "0x" + (IntPtr.Size == 8 ? _handle.ToString("X16") : _handle.ToString("X8")); 796 | 797 | public static bool operator ==(nng_stream_dialer left, nng_stream_dialer right) => left.Equals(right); 798 | 799 | public static bool operator !=(nng_stream_dialer left, nng_stream_dialer right) => !left.Equals(right); 800 | } 801 | 802 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] 803 | public readonly partial struct nng_stream_listener : IEquatable 804 | { 805 | private readonly IntPtr _handle; 806 | 807 | public nng_stream_listener(IntPtr handle) => _handle = handle; 808 | 809 | public IntPtr Handle => _handle; 810 | 811 | public bool Equals(nng_stream_listener other) => _handle.Equals(other._handle); 812 | 813 | public override bool Equals(object obj) => obj is nng_stream_listener other && Equals(other); 814 | 815 | public override int GetHashCode() => _handle.GetHashCode(); 816 | 817 | public override string ToString() => "0x" + (IntPtr.Size == 8 ? _handle.ToString("X16") : _handle.ToString("X8")); 818 | 819 | public static bool operator ==(nng_stream_listener left, nng_stream_listener right) => left.Equals(right); 820 | 821 | public static bool operator !=(nng_stream_listener left, nng_stream_listener right) => !left.Equals(right); 822 | } 823 | 824 | /// 825 | /// Identifiers are wrapped in a structure to improve compiler validation 826 | /// of incorrect passing. This gives us strong type checking. Modern 827 | /// compilers compile passing these by value to identical code as passing 828 | /// the integer type (at least with optimization applied). Please do not 829 | /// access the ID member directly. 830 | /// 831 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] 832 | public readonly partial struct nng_ctx : IEquatable 833 | { 834 | public nng_ctx(nng.nng_ctx_s value) => this.Value = value; 835 | 836 | public readonly nng.nng_ctx_s Value; 837 | 838 | public bool Equals(nng_ctx other) => Value.Equals(other.Value); 839 | 840 | public override bool Equals(object obj) => obj is nng_ctx other && Equals(other); 841 | 842 | public override int GetHashCode() => Value.GetHashCode(); 843 | 844 | public override string ToString() => Value.ToString(); 845 | 846 | public static implicit operator nng.nng_ctx_s(nng_ctx from) => from.Value; 847 | 848 | public static implicit operator nng_ctx(nng.nng_ctx_s from) => new nng_ctx(from); 849 | 850 | public static bool operator ==(nng_ctx left, nng_ctx right) => left.Equals(right); 851 | 852 | public static bool operator !=(nng_ctx left, nng_ctx right) => !left.Equals(right); 853 | } 854 | 855 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] 856 | public readonly partial struct nng_dialer : IEquatable 857 | { 858 | public nng_dialer(nng.nng_dialer_s value) => this.Value = value; 859 | 860 | public readonly nng.nng_dialer_s Value; 861 | 862 | public bool Equals(nng_dialer other) => Value.Equals(other.Value); 863 | 864 | public override bool Equals(object obj) => obj is nng_dialer other && Equals(other); 865 | 866 | public override int GetHashCode() => Value.GetHashCode(); 867 | 868 | public override string ToString() => Value.ToString(); 869 | 870 | public static implicit operator nng.nng_dialer_s(nng_dialer from) => from.Value; 871 | 872 | public static implicit operator nng_dialer(nng.nng_dialer_s from) => new nng_dialer(from); 873 | 874 | public static bool operator ==(nng_dialer left, nng_dialer right) => left.Equals(right); 875 | 876 | public static bool operator !=(nng_dialer left, nng_dialer right) => !left.Equals(right); 877 | } 878 | 879 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] 880 | public readonly partial struct nng_listener : IEquatable 881 | { 882 | public nng_listener(nng.nng_listener_s value) => this.Value = value; 883 | 884 | public readonly nng.nng_listener_s Value; 885 | 886 | public bool Equals(nng_listener other) => Value.Equals(other.Value); 887 | 888 | public override bool Equals(object obj) => obj is nng_listener other && Equals(other); 889 | 890 | public override int GetHashCode() => Value.GetHashCode(); 891 | 892 | public override string ToString() => Value.ToString(); 893 | 894 | public static implicit operator nng.nng_listener_s(nng_listener from) => from.Value; 895 | 896 | public static implicit operator nng_listener(nng.nng_listener_s from) => new nng_listener(from); 897 | 898 | public static bool operator ==(nng_listener left, nng_listener right) => left.Equals(right); 899 | 900 | public static bool operator !=(nng_listener left, nng_listener right) => !left.Equals(right); 901 | } 902 | 903 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] 904 | public readonly partial struct nng_pipe : IEquatable 905 | { 906 | public nng_pipe(nng.nng_pipe_s value) => this.Value = value; 907 | 908 | public readonly nng.nng_pipe_s Value; 909 | 910 | public bool Equals(nng_pipe other) => Value.Equals(other.Value); 911 | 912 | public override bool Equals(object obj) => obj is nng_pipe other && Equals(other); 913 | 914 | public override int GetHashCode() => Value.GetHashCode(); 915 | 916 | public override string ToString() => Value.ToString(); 917 | 918 | public static implicit operator nng.nng_pipe_s(nng_pipe from) => from.Value; 919 | 920 | public static implicit operator nng_pipe(nng.nng_pipe_s from) => new nng_pipe(from); 921 | 922 | public static bool operator ==(nng_pipe left, nng_pipe right) => left.Equals(right); 923 | 924 | public static bool operator !=(nng_pipe left, nng_pipe right) => !left.Equals(right); 925 | } 926 | 927 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] 928 | public readonly partial struct nng_socket : IEquatable 929 | { 930 | public nng_socket(nng.nng_socket_s value) => this.Value = value; 931 | 932 | public readonly nng.nng_socket_s Value; 933 | 934 | public bool Equals(nng_socket other) => Value.Equals(other.Value); 935 | 936 | public override bool Equals(object obj) => obj is nng_socket other && Equals(other); 937 | 938 | public override int GetHashCode() => Value.GetHashCode(); 939 | 940 | public override string ToString() => Value.ToString(); 941 | 942 | public static implicit operator nng.nng_socket_s(nng_socket from) => from.Value; 943 | 944 | public static implicit operator nng_socket(nng.nng_socket_s from) => new nng_socket(from); 945 | 946 | public static bool operator ==(nng_socket left, nng_socket right) => left.Equals(right); 947 | 948 | public static bool operator !=(nng_socket left, nng_socket right) => !left.Equals(right); 949 | } 950 | 951 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] 952 | public readonly partial struct nng_duration : IEquatable 953 | { 954 | public nng_duration(int value) => this.Value = value; 955 | 956 | public readonly int Value; 957 | 958 | public bool Equals(nng_duration other) => Value.Equals(other.Value); 959 | 960 | public override bool Equals(object obj) => obj is nng_duration other && Equals(other); 961 | 962 | public override int GetHashCode() => Value.GetHashCode(); 963 | 964 | public override string ToString() => Value.ToString(); 965 | 966 | public static implicit operator int(nng_duration from) => from.Value; 967 | 968 | public static implicit operator nng_duration(int from) => new nng_duration(from); 969 | 970 | public static bool operator ==(nng_duration left, nng_duration right) => left.Equals(right); 971 | 972 | public static bool operator !=(nng_duration left, nng_duration right) => !left.Equals(right); 973 | } 974 | 975 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 976 | public delegate void nng_pipe_cb(nng.nng_pipe arg0, nng.nng_pipe_ev arg1, IntPtr arg2); 977 | 978 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 979 | public delegate void nng_aio_cancelfn(nng.nng_aio arg0, IntPtr arg1, int arg2); 980 | 981 | public const int NNG_DURATION_INFINITE = (-1); 982 | 983 | public const int NNG_DURATION_DEFAULT = (-2); 984 | 985 | public const int NNG_DURATION_ZERO = (0); 986 | 987 | /// 988 | /// Recv to allocate receive buffer 989 | /// 990 | public const int NNG_FLAG_ALLOC = 1; 991 | 992 | /// 993 | /// Non-blocking operations 994 | /// 995 | public const int NNG_FLAG_NONBLOCK = 2; 996 | 997 | /// 998 | /// nng_fini is used to terminate the library, freeing certain global resources. 999 | /// This should only be called during atexit() or just before dlclose(). 1000 | /// THIS FUNCTION MUST NOT BE CALLED CONCURRENTLY WITH ANY OTHER FUNCTION 1001 | /// IN THIS LIBRARY; IT IS NOT REENTRANT OR THREADSAFE. 1002 | /// 1003 | /// 1004 | /// For most cases, this call is unnecessary, but it is provided to assist 1005 | /// when debugging with memory checkers (e.g. valgrind). Calling this 1006 | /// function prevents global library resources from being reported incorrectly 1007 | /// as memory leaks. In those cases, we recommend doing this with atexit(). 1008 | /// 1009 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1010 | public static extern void nng_fini(); 1011 | 1012 | /// 1013 | /// nng_close closes the socket, terminating all activity and 1014 | /// closing any underlying connections and releasing any associated 1015 | /// resources. 1016 | /// 1017 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1018 | public static extern int nng_close(nng.nng_socket arg0); 1019 | 1020 | /// 1021 | /// nng_socket_id returns the positive socket id for the socket, or -1 1022 | /// if the socket is not valid. 1023 | /// 1024 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1025 | public static extern int nng_socket_id(nng.nng_socket arg0); 1026 | 1027 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1028 | public static extern int nng_socket_set(nng.nng_socket arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, IntPtr arg2, nng.size_t arg3); 1029 | 1030 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1031 | public static extern int nng_socket_set_bool(nng.nng_socket arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, [MarshalAs(UnmanagedType.U1)] bool arg2); 1032 | 1033 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1034 | public static extern int nng_socket_set_int(nng.nng_socket arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, int arg2); 1035 | 1036 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1037 | public static extern int nng_socket_set_size(nng.nng_socket arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, nng.size_t arg2); 1038 | 1039 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1040 | public static extern int nng_socket_set_uint64(nng.nng_socket arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ulong arg2); 1041 | 1042 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1043 | public static extern int nng_socket_set_string(nng.nng_socket arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg2); 1044 | 1045 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1046 | public static extern int nng_socket_set_ptr(nng.nng_socket arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, IntPtr arg2); 1047 | 1048 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1049 | public static extern int nng_socket_set_ms(nng.nng_socket arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, nng.nng_duration arg2); 1050 | 1051 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1052 | public static extern int nng_socket_set_addr(nng.nng_socket arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, in nng.nng_sockaddr arg2); 1053 | 1054 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1055 | public static extern int nng_socket_get(nng.nng_socket arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, IntPtr arg2, ref nng.size_t arg3); 1056 | 1057 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1058 | public static extern int nng_socket_get_bool(nng.nng_socket arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ref bool arg2); 1059 | 1060 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1061 | public static extern int nng_socket_get_int(nng.nng_socket arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ref int arg2); 1062 | 1063 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1064 | public static extern int nng_socket_get_size(nng.nng_socket arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ref nng.size_t arg2); 1065 | 1066 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1067 | public static extern int nng_socket_get_uint64(nng.nng_socket arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ref ulong arg2); 1068 | 1069 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1070 | public static extern int nng_socket_get_string(nng.nng_socket arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, out IntPtr arg2); 1071 | 1072 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1073 | public static extern int nng_socket_get_ptr(nng.nng_socket arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, out IntPtr arg2); 1074 | 1075 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1076 | public static extern int nng_socket_get_ms(nng.nng_socket arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ref nng.nng_duration arg2); 1077 | 1078 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1079 | public static extern int nng_socket_get_addr(nng.nng_socket arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ref nng.nng_sockaddr arg2); 1080 | 1081 | /// 1082 | /// nng_pipe_notify registers a callback to be executed when the 1083 | /// given event is triggered. To watch for different events, register 1084 | /// multiple times. Each event can have at most one callback registered. 1085 | /// 1086 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1087 | public static extern int nng_pipe_notify(nng.nng_socket arg0, nng.nng_pipe_ev arg1, nng.nng_pipe_cb arg2, IntPtr arg3); 1088 | 1089 | /// 1090 | /// nng_listen creates a listening endpoint with no special options, 1091 | /// and starts it listening. It is functionally equivalent to the legacy 1092 | /// nn_bind(). The underlying endpoint is returned back to the caller in the 1093 | /// endpoint pointer, if it is not NULL. The flags are ignored at present. 1094 | /// 1095 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1096 | public static extern int nng_listen(nng.nng_socket arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ref nng.nng_listener arg2, int arg3); 1097 | 1098 | /// 1099 | /// nng_dial creates a dialing endpoint, with no special options, and 1100 | /// starts it dialing. Dialers have at most one active connection at a time 1101 | /// This is similar to the legacy nn_connect(). The underlying endpoint 1102 | /// is returned back to the caller in the endpoint pointer, if it is not NULL. 1103 | /// The flags may be NNG_FLAG_NONBLOCK to indicate that the first attempt to 1104 | /// dial will be made in the background, returning control to the caller 1105 | /// immediately. In this case, if the connection fails, the function will 1106 | /// keep retrying in the background. (If the connection is dropped in either 1107 | /// case, it will still be reconnected in the background -- only the initial 1108 | /// connection attempt is normally synchronous.) 1109 | /// 1110 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1111 | public static extern int nng_dial(nng.nng_socket arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ref nng.nng_dialer arg2, int arg3); 1112 | 1113 | /// 1114 | /// nng_dialer_create creates a new dialer, that is not yet started. 1115 | /// 1116 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1117 | public static extern int nng_dialer_create(ref nng.nng_dialer arg0, nng.nng_socket arg1, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg2); 1118 | 1119 | /// 1120 | /// nng_listener_create creates a new listener, that is not yet started. 1121 | /// 1122 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1123 | public static extern int nng_listener_create(ref nng.nng_listener arg0, nng.nng_socket arg1, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg2); 1124 | 1125 | /// 1126 | /// nng_dialer_start starts the endpoint dialing. This is only possible if 1127 | /// the dialer is not already dialing. 1128 | /// 1129 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1130 | public static extern int nng_dialer_start(nng.nng_dialer arg0, int arg1); 1131 | 1132 | /// 1133 | /// nng_listener_start starts the endpoint listening. This is only possible if 1134 | /// the listener is not already listening. 1135 | /// 1136 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1137 | public static extern int nng_listener_start(nng.nng_listener arg0, int arg1); 1138 | 1139 | /// 1140 | /// nng_dialer_close closes the dialer, shutting down all underlying 1141 | /// connections and releasing all associated resources. 1142 | /// 1143 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1144 | public static extern int nng_dialer_close(nng.nng_dialer arg0); 1145 | 1146 | /// 1147 | /// nng_listener_close closes the listener, shutting down all underlying 1148 | /// connections and releasing all associated resources. 1149 | /// 1150 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1151 | public static extern int nng_listener_close(nng.nng_listener arg0); 1152 | 1153 | /// 1154 | /// nng_dialer_id returns the positive dialer ID, or -1 if the dialer is 1155 | /// invalid. 1156 | /// 1157 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1158 | public static extern int nng_dialer_id(nng.nng_dialer arg0); 1159 | 1160 | /// 1161 | /// nng_listener_id returns the positive listener ID, or -1 if the listener is 1162 | /// invalid. 1163 | /// 1164 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1165 | public static extern int nng_listener_id(nng.nng_listener arg0); 1166 | 1167 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1168 | public static extern int nng_dialer_set(nng.nng_dialer arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, IntPtr arg2, nng.size_t arg3); 1169 | 1170 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1171 | public static extern int nng_dialer_set_bool(nng.nng_dialer arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, [MarshalAs(UnmanagedType.U1)] bool arg2); 1172 | 1173 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1174 | public static extern int nng_dialer_set_int(nng.nng_dialer arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, int arg2); 1175 | 1176 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1177 | public static extern int nng_dialer_set_size(nng.nng_dialer arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, nng.size_t arg2); 1178 | 1179 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1180 | public static extern int nng_dialer_set_uint64(nng.nng_dialer arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ulong arg2); 1181 | 1182 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1183 | public static extern int nng_dialer_set_string(nng.nng_dialer arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg2); 1184 | 1185 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1186 | public static extern int nng_dialer_set_ptr(nng.nng_dialer arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, IntPtr arg2); 1187 | 1188 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1189 | public static extern int nng_dialer_set_ms(nng.nng_dialer arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, nng.nng_duration arg2); 1190 | 1191 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1192 | public static extern int nng_dialer_set_addr(nng.nng_dialer arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, in nng.nng_sockaddr arg2); 1193 | 1194 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1195 | public static extern int nng_dialer_get(nng.nng_dialer arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, IntPtr arg2, ref nng.size_t arg3); 1196 | 1197 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1198 | public static extern int nng_dialer_get_bool(nng.nng_dialer arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ref bool arg2); 1199 | 1200 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1201 | public static extern int nng_dialer_get_int(nng.nng_dialer arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ref int arg2); 1202 | 1203 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1204 | public static extern int nng_dialer_get_size(nng.nng_dialer arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ref nng.size_t arg2); 1205 | 1206 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1207 | public static extern int nng_dialer_get_uint64(nng.nng_dialer arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ref ulong arg2); 1208 | 1209 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1210 | public static extern int nng_dialer_get_string(nng.nng_dialer arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, out IntPtr arg2); 1211 | 1212 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1213 | public static extern int nng_dialer_get_ptr(nng.nng_dialer arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, out IntPtr arg2); 1214 | 1215 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1216 | public static extern int nng_dialer_get_ms(nng.nng_dialer arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ref nng.nng_duration arg2); 1217 | 1218 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1219 | public static extern int nng_dialer_get_addr(nng.nng_dialer arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ref nng.nng_sockaddr arg2); 1220 | 1221 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1222 | public static extern int nng_listener_set(nng.nng_listener arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, IntPtr arg2, nng.size_t arg3); 1223 | 1224 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1225 | public static extern int nng_listener_set_bool(nng.nng_listener arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, [MarshalAs(UnmanagedType.U1)] bool arg2); 1226 | 1227 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1228 | public static extern int nng_listener_set_int(nng.nng_listener arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, int arg2); 1229 | 1230 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1231 | public static extern int nng_listener_set_size(nng.nng_listener arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, nng.size_t arg2); 1232 | 1233 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1234 | public static extern int nng_listener_set_uint64(nng.nng_listener arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ulong arg2); 1235 | 1236 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1237 | public static extern int nng_listener_set_string(nng.nng_listener arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg2); 1238 | 1239 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1240 | public static extern int nng_listener_set_ptr(nng.nng_listener arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, IntPtr arg2); 1241 | 1242 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1243 | public static extern int nng_listener_set_ms(nng.nng_listener arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, nng.nng_duration arg2); 1244 | 1245 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1246 | public static extern int nng_listener_set_addr(nng.nng_listener arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, in nng.nng_sockaddr arg2); 1247 | 1248 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1249 | public static extern int nng_listener_get(nng.nng_listener arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, IntPtr arg2, ref nng.size_t arg3); 1250 | 1251 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1252 | public static extern int nng_listener_get_bool(nng.nng_listener arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ref bool arg2); 1253 | 1254 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1255 | public static extern int nng_listener_get_int(nng.nng_listener arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ref int arg2); 1256 | 1257 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1258 | public static extern int nng_listener_get_size(nng.nng_listener arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ref nng.size_t arg2); 1259 | 1260 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1261 | public static extern int nng_listener_get_uint64(nng.nng_listener arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ref ulong arg2); 1262 | 1263 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1264 | public static extern int nng_listener_get_string(nng.nng_listener arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, out IntPtr arg2); 1265 | 1266 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1267 | public static extern int nng_listener_get_ptr(nng.nng_listener arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, out IntPtr arg2); 1268 | 1269 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1270 | public static extern int nng_listener_get_ms(nng.nng_listener arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ref nng.nng_duration arg2); 1271 | 1272 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1273 | public static extern int nng_listener_get_addr(nng.nng_listener arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ref nng.nng_sockaddr arg2); 1274 | 1275 | /// 1276 | /// nng_strerror returns a human readable string associated with the error 1277 | /// code supplied. 1278 | /// 1279 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1280 | [return:MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ReturnUtf8StringMarshaller))] 1281 | public static extern string nng_strerror(int arg0); 1282 | 1283 | /// 1284 | /// nng_send sends (or arranges to send) the data on the socket. Note that 1285 | /// this function may (will!) return before any receiver has actually 1286 | /// received the data. The return value will be zero to indicate that the 1287 | /// socket has accepted the entire data for send, or an errno to indicate 1288 | /// failure. The flags may include NNG_FLAG_NONBLOCK or NNG_FLAG_ALLOC. 1289 | /// If the flag includes NNG_FLAG_ALLOC, then the function will call 1290 | /// nng_free() on the supplied pointer 1291 | /// & 1292 | /// size on success. (If the call 1293 | /// fails then the memory is not freed.) 1294 | /// 1295 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1296 | public static extern int nng_send(nng.nng_socket arg0, IntPtr arg1, nng.size_t arg2, int arg3); 1297 | 1298 | /// 1299 | /// nng_recv receives message data into the socket, up to the supplied size. 1300 | /// The actual size of the message data will be written to the value pointed 1301 | /// to by size. The flags may include NNG_FLAG_NONBLOCK and NNG_FLAG_ALLOC. 1302 | /// If NNG_FLAG_ALLOC is supplied then the library will allocate memory for 1303 | /// the caller. In that case the pointer to the allocated will be stored 1304 | /// instead of the data itself. The caller is responsible for freeing the 1305 | /// associated memory with nng_free(). 1306 | /// 1307 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1308 | public static extern int nng_recv(nng.nng_socket arg0, IntPtr arg1, ref nng.size_t arg2, int arg3); 1309 | 1310 | /// 1311 | /// nng_sendmsg is like nng_send, but offers up a message structure, which 1312 | /// gives the ability to provide more control over the message, including 1313 | /// providing backtrace information. It also can take a message that was 1314 | /// obtain via nn_recvmsg, allowing for zero copy forwarding. 1315 | /// 1316 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1317 | public static extern int nng_sendmsg(nng.nng_socket arg0, nng.nng_msg arg1, int arg2); 1318 | 1319 | /// 1320 | /// nng_recvmsg is like nng_recv, but is used to obtain a message structure 1321 | /// as well as the data buffer. This can be used to obtain more information 1322 | /// about where the message came from, access raw headers, etc. It also 1323 | /// can be passed off directly to nng_sendmsg. 1324 | /// 1325 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1326 | public static extern int nng_recvmsg(nng.nng_socket arg0, out nng.nng_msg arg1, int arg2); 1327 | 1328 | /// 1329 | /// nng_send_aio sends data on the socket asynchronously. As with nng_send, 1330 | /// the completion may be executed before the data has actually been delivered, 1331 | /// but only when it is accepted for delivery. The supplied AIO must have 1332 | /// been initialized, and have an associated message. The message will be 1333 | /// "owned" by the socket if the operation completes successfully. Otherwise 1334 | /// the caller is responsible for freeing it. 1335 | /// 1336 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1337 | public static extern void nng_send_aio(nng.nng_socket arg0, nng.nng_aio arg1); 1338 | 1339 | /// 1340 | /// nng_recv_aio receives data on the socket asynchronously. On a successful 1341 | /// result, the AIO will have an associated message, that can be obtained 1342 | /// with nng_aio_get_msg(). The caller takes ownership of the message at 1343 | /// this point. 1344 | /// 1345 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1346 | public static extern void nng_recv_aio(nng.nng_socket arg0, nng.nng_aio arg1); 1347 | 1348 | /// 1349 | /// nng_ctx_open creates a context. This returns NNG_ENOTSUP if the 1350 | /// protocol implementation does not support separate contexts. 1351 | /// 1352 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1353 | public static extern int nng_ctx_open(ref nng.nng_ctx arg0, nng.nng_socket arg1); 1354 | 1355 | /// 1356 | /// nng_ctx_close closes the context. 1357 | /// 1358 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1359 | public static extern int nng_ctx_close(nng.nng_ctx arg0); 1360 | 1361 | /// 1362 | /// nng_ctx_id returns the numeric id for the context; this will be 1363 | /// a positive value for a valid context, or 1364 | /// < 1365 | /// 0 for an invalid context. 1366 | /// A valid context is not necessarily an *open* context. 1367 | /// 1368 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1369 | public static extern int nng_ctx_id(nng.nng_ctx arg0); 1370 | 1371 | /// 1372 | /// nng_ctx_recv receives asynchronously. It works like nng_recv_aio, but 1373 | /// uses a local context instead of the socket global context. 1374 | /// 1375 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1376 | public static extern void nng_ctx_recv(nng.nng_ctx arg0, nng.nng_aio arg1); 1377 | 1378 | /// 1379 | /// nng_ctx_send sends asynchronously. It works like nng_send_aio, but 1380 | /// uses a local context instead of the socket global context. 1381 | /// 1382 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1383 | public static extern void nng_ctx_send(nng.nng_ctx arg0, nng.nng_aio arg1); 1384 | 1385 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1386 | public static extern int nng_ctx_get(nng.nng_ctx arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, IntPtr arg2, ref nng.size_t arg3); 1387 | 1388 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1389 | public static extern int nng_ctx_get_bool(nng.nng_ctx arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ref bool arg2); 1390 | 1391 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1392 | public static extern int nng_ctx_get_int(nng.nng_ctx arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ref int arg2); 1393 | 1394 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1395 | public static extern int nng_ctx_get_size(nng.nng_ctx arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ref nng.size_t arg2); 1396 | 1397 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1398 | public static extern int nng_ctx_get_uint64(nng.nng_ctx arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ref ulong arg2); 1399 | 1400 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1401 | public static extern int nng_ctx_get_string(nng.nng_ctx arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, out IntPtr arg2); 1402 | 1403 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1404 | public static extern int nng_ctx_get_ptr(nng.nng_ctx arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, out IntPtr arg2); 1405 | 1406 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1407 | public static extern int nng_ctx_get_ms(nng.nng_ctx arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ref nng.nng_duration arg2); 1408 | 1409 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1410 | public static extern int nng_ctx_get_addr(nng.nng_ctx arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ref nng.nng_sockaddr arg2); 1411 | 1412 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1413 | public static extern int nng_ctx_set(nng.nng_ctx arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, IntPtr arg2, nng.size_t arg3); 1414 | 1415 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1416 | public static extern int nng_ctx_set_bool(nng.nng_ctx arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, [MarshalAs(UnmanagedType.U1)] bool arg2); 1417 | 1418 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1419 | public static extern int nng_ctx_set_int(nng.nng_ctx arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, int arg2); 1420 | 1421 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1422 | public static extern int nng_ctx_set_size(nng.nng_ctx arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, nng.size_t arg2); 1423 | 1424 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1425 | public static extern int nng_ctx_set_uint64(nng.nng_ctx arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ulong arg2); 1426 | 1427 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1428 | public static extern int nng_ctx_set_string(nng.nng_ctx arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg2); 1429 | 1430 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1431 | public static extern int nng_ctx_set_ptr(nng.nng_ctx arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, IntPtr arg2); 1432 | 1433 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1434 | public static extern int nng_ctx_set_ms(nng.nng_ctx arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, nng.nng_duration arg2); 1435 | 1436 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1437 | public static extern int nng_ctx_set_addr(nng.nng_ctx arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, in nng.nng_sockaddr arg2); 1438 | 1439 | /// 1440 | /// nng_alloc is used to allocate memory. It's intended purpose is for 1441 | /// allocating memory suitable for message buffers with nng_send(). 1442 | /// Applications that need memory for other purposes should use their platform 1443 | /// specific API. 1444 | /// 1445 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1446 | public static extern IntPtr nng_alloc(nng.size_t arg0); 1447 | 1448 | /// 1449 | /// nng_free is used to free memory allocated with nng_alloc, which includes 1450 | /// memory allocated by nng_recv() when the NNG_FLAG_ALLOC message is supplied. 1451 | /// As the application is required to keep track of the size of memory, this 1452 | /// is probably less convenient for general uses than the C library malloc and 1453 | /// calloc. 1454 | /// 1455 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1456 | public static extern void nng_free(IntPtr arg0, nng.size_t arg1); 1457 | 1458 | /// 1459 | /// nng_strdup duplicates the source string, using nng_alloc. The result 1460 | /// should be freed with nng_strfree (or nng_free(strlen(s)+1)). 1461 | /// 1462 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1463 | public static extern IntPtr nng_strdup([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg0); 1464 | 1465 | /// 1466 | /// nng_strfree is equivalent to nng_free(strlen(s)+1). 1467 | /// 1468 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1469 | public static extern void nng_strfree(IntPtr arg0); 1470 | 1471 | /// 1472 | /// nng_aio_free frees the AIO and any associated resources. 1473 | /// It *must not* be in use at the time it is freed. 1474 | /// 1475 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1476 | public static extern void nng_aio_free(nng.nng_aio arg0); 1477 | 1478 | /// 1479 | /// nng_aio_reap is like nng_aio_free, but calls it from a background 1480 | /// reaper thread. This can be useful to free aio objects from aio 1481 | /// callbacks (e.g. when the result of the callback is to discard 1482 | /// the object in question.) The aio object must be in further use 1483 | /// when this is called. 1484 | /// 1485 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1486 | public static extern void nng_aio_reap(nng.nng_aio arg0); 1487 | 1488 | /// 1489 | /// nng_aio_stop stops any outstanding operation, and waits for the 1490 | /// AIO to be free, including for the callback to have completed 1491 | /// execution. Therefore the caller must NOT hold any locks that 1492 | /// are acquired in the callback, or deadlock will occur. 1493 | /// 1494 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1495 | public static extern void nng_aio_stop(nng.nng_aio arg0); 1496 | 1497 | /// 1498 | /// nng_aio_result returns the status/result of the operation. This 1499 | /// will be zero on successful completion, or an nng error code on 1500 | /// failure. 1501 | /// 1502 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1503 | public static extern int nng_aio_result(nng.nng_aio arg0); 1504 | 1505 | /// 1506 | /// nng_aio_count returns the number of bytes transferred for certain 1507 | /// I/O operations. This is meaningless for other operations (e.g. 1508 | /// DNS lookups or TCP connection setup). 1509 | /// 1510 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1511 | public static extern nng.size_t nng_aio_count(nng.nng_aio arg0); 1512 | 1513 | /// 1514 | /// nng_aio_cancel attempts to cancel any in-progress I/O operation. 1515 | /// The AIO callback will still be executed, but if the cancellation is 1516 | /// successful then the status will be NNG_ECANCELED. 1517 | /// 1518 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1519 | public static extern void nng_aio_cancel(nng.nng_aio arg0); 1520 | 1521 | /// 1522 | /// nng_aio_abort is like nng_aio_cancel, but allows for a different 1523 | /// error result to be returned. 1524 | /// 1525 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1526 | public static extern void nng_aio_abort(nng.nng_aio arg0, int arg1); 1527 | 1528 | /// 1529 | /// nng_aio_wait waits synchronously for any pending operation to complete. 1530 | /// It also waits for the callback to have completed execution. Therefore, 1531 | /// the caller of this function must not hold any locks acquired by the 1532 | /// callback or deadlock may occur. 1533 | /// 1534 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1535 | public static extern void nng_aio_wait(nng.nng_aio arg0); 1536 | 1537 | /// 1538 | /// nng_aio_set_msg sets the message structure to use for asynchronous 1539 | /// message send operations. 1540 | /// 1541 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1542 | public static extern void nng_aio_set_msg(nng.nng_aio arg0, nng.nng_msg arg1); 1543 | 1544 | /// 1545 | /// nng_aio_get_msg returns the message structure associated with a completed 1546 | /// receive operation. 1547 | /// 1548 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1549 | public static extern nng.nng_msg nng_aio_get_msg(nng.nng_aio arg0); 1550 | 1551 | /// 1552 | /// nng_aio_set_input sets an input parameter at the given index. 1553 | /// 1554 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1555 | public static extern int nng_aio_set_input(nng.nng_aio arg0, uint arg1, IntPtr arg2); 1556 | 1557 | /// 1558 | /// nng_aio_get_input retrieves the input parameter at the given index. 1559 | /// 1560 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1561 | public static extern IntPtr nng_aio_get_input(nng.nng_aio arg0, uint arg1); 1562 | 1563 | /// 1564 | /// nng_aio_set_output sets an output result at the given index. 1565 | /// 1566 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1567 | public static extern int nng_aio_set_output(nng.nng_aio arg0, uint arg1, IntPtr arg2); 1568 | 1569 | /// 1570 | /// nng_aio_get_output retrieves the output result at the given index. 1571 | /// 1572 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1573 | public static extern IntPtr nng_aio_get_output(nng.nng_aio arg0, uint arg1); 1574 | 1575 | /// 1576 | /// nng_aio_set_timeout sets a timeout on the AIO. This should be called for 1577 | /// operations that should time out after a period. The timeout should be 1578 | /// either a positive number of milliseconds, or NNG_DURATION_INFINITE to 1579 | /// indicate that the operation has no timeout. A poll may be done by 1580 | /// specifying NNG_DURATION_ZERO. The value NNG_DURATION_DEFAULT indicates 1581 | /// that any socket specific timeout should be used. 1582 | /// 1583 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1584 | public static extern void nng_aio_set_timeout(nng.nng_aio arg0, nng.nng_duration arg1); 1585 | 1586 | /// 1587 | /// nng_aio_set_iov sets a scatter/gather vector on the aio. The iov array 1588 | /// itself is copied. Data members (the memory regions referenced) *may* be 1589 | /// copied as well, depending on the operation. This operation is guaranteed 1590 | /// to succeed if n 1591 | /// < 1592 | /// = 4, otherwise it may fail due to NNG_ENOMEM. 1593 | /// 1594 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1595 | public static extern int nng_aio_set_iov(nng.nng_aio arg0, uint arg1, in nng.nng_iov arg2); 1596 | 1597 | /// 1598 | /// nng_aio_begin is called by the provider to mark the operation as 1599 | /// beginning. If it returns false, then the provider must take no 1600 | /// further action on the aio. 1601 | /// 1602 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1603 | [return:MarshalAs(UnmanagedType.U1)] 1604 | public static extern bool nng_aio_begin(nng.nng_aio arg0); 1605 | 1606 | /// 1607 | /// nng_aio_finish is used to "finish" an asynchronous operation. 1608 | /// It should only be called by "providers" (such as HTTP server API users). 1609 | /// The argument is the value that nng_aio_result() should return. 1610 | /// IMPORTANT: Callers must ensure that this is called EXACTLY ONCE on any 1611 | /// given aio. 1612 | /// 1613 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1614 | public static extern void nng_aio_finish(nng.nng_aio arg0, int arg1); 1615 | 1616 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1617 | public static extern void nng_aio_defer(nng.nng_aio arg0, nng.nng_aio_cancelfn arg1, IntPtr arg2); 1618 | 1619 | /// 1620 | /// nng_aio_sleep does a "sleeping" operation, basically does nothing 1621 | /// but wait for the specified number of milliseconds to expire, then 1622 | /// calls the callback. This returns 0, rather than NNG_ETIMEDOUT. 1623 | /// 1624 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1625 | public static extern void nng_sleep_aio(nng.nng_duration arg0, nng.nng_aio arg1); 1626 | 1627 | /// 1628 | /// Message API. 1629 | /// 1630 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1631 | public static extern int nng_msg_alloc(out nng.nng_msg arg0, nng.size_t arg1); 1632 | 1633 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1634 | public static extern void nng_msg_free(nng.nng_msg arg0); 1635 | 1636 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1637 | public static extern int nng_msg_realloc(nng.nng_msg arg0, nng.size_t arg1); 1638 | 1639 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1640 | public static extern int nng_msg_reserve(nng.nng_msg arg0, nng.size_t arg1); 1641 | 1642 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1643 | public static extern nng.size_t nng_msg_capacity(nng.nng_msg arg0); 1644 | 1645 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1646 | public static extern IntPtr nng_msg_header(nng.nng_msg arg0); 1647 | 1648 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1649 | public static extern nng.size_t nng_msg_header_len(nng.nng_msg arg0); 1650 | 1651 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1652 | public static extern IntPtr nng_msg_body(nng.nng_msg arg0); 1653 | 1654 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1655 | public static extern nng.size_t nng_msg_len(nng.nng_msg arg0); 1656 | 1657 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1658 | public static extern int nng_msg_append(nng.nng_msg arg0, IntPtr arg1, nng.size_t arg2); 1659 | 1660 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1661 | public static extern int nng_msg_insert(nng.nng_msg arg0, IntPtr arg1, nng.size_t arg2); 1662 | 1663 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1664 | public static extern int nng_msg_trim(nng.nng_msg arg0, nng.size_t arg1); 1665 | 1666 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1667 | public static extern int nng_msg_chop(nng.nng_msg arg0, nng.size_t arg1); 1668 | 1669 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1670 | public static extern int nng_msg_header_append(nng.nng_msg arg0, IntPtr arg1, nng.size_t arg2); 1671 | 1672 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1673 | public static extern int nng_msg_header_insert(nng.nng_msg arg0, IntPtr arg1, nng.size_t arg2); 1674 | 1675 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1676 | public static extern int nng_msg_header_trim(nng.nng_msg arg0, nng.size_t arg1); 1677 | 1678 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1679 | public static extern int nng_msg_header_chop(nng.nng_msg arg0, nng.size_t arg1); 1680 | 1681 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1682 | public static extern int nng_msg_header_append_u16(nng.nng_msg arg0, ushort arg1); 1683 | 1684 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1685 | public static extern int nng_msg_header_append_u32(nng.nng_msg arg0, uint arg1); 1686 | 1687 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1688 | public static extern int nng_msg_header_append_u64(nng.nng_msg arg0, ulong arg1); 1689 | 1690 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1691 | public static extern int nng_msg_header_insert_u16(nng.nng_msg arg0, ushort arg1); 1692 | 1693 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1694 | public static extern int nng_msg_header_insert_u32(nng.nng_msg arg0, uint arg1); 1695 | 1696 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1697 | public static extern int nng_msg_header_insert_u64(nng.nng_msg arg0, ulong arg1); 1698 | 1699 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1700 | public static extern int nng_msg_header_chop_u16(nng.nng_msg arg0, ref ushort arg1); 1701 | 1702 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1703 | public static extern int nng_msg_header_chop_u32(nng.nng_msg arg0, ref uint arg1); 1704 | 1705 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1706 | public static extern int nng_msg_header_chop_u64(nng.nng_msg arg0, ref ulong arg1); 1707 | 1708 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1709 | public static extern int nng_msg_header_trim_u16(nng.nng_msg arg0, ref ushort arg1); 1710 | 1711 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1712 | public static extern int nng_msg_header_trim_u32(nng.nng_msg arg0, ref uint arg1); 1713 | 1714 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1715 | public static extern int nng_msg_header_trim_u64(nng.nng_msg arg0, ref ulong arg1); 1716 | 1717 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1718 | public static extern int nng_msg_append_u16(nng.nng_msg arg0, ushort arg1); 1719 | 1720 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1721 | public static extern int nng_msg_append_u32(nng.nng_msg arg0, uint arg1); 1722 | 1723 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1724 | public static extern int nng_msg_append_u64(nng.nng_msg arg0, ulong arg1); 1725 | 1726 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1727 | public static extern int nng_msg_insert_u16(nng.nng_msg arg0, ushort arg1); 1728 | 1729 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1730 | public static extern int nng_msg_insert_u32(nng.nng_msg arg0, uint arg1); 1731 | 1732 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1733 | public static extern int nng_msg_insert_u64(nng.nng_msg arg0, ulong arg1); 1734 | 1735 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1736 | public static extern int nng_msg_chop_u16(nng.nng_msg arg0, ref ushort arg1); 1737 | 1738 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1739 | public static extern int nng_msg_chop_u32(nng.nng_msg arg0, ref uint arg1); 1740 | 1741 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1742 | public static extern int nng_msg_chop_u64(nng.nng_msg arg0, ref ulong arg1); 1743 | 1744 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1745 | public static extern int nng_msg_trim_u16(nng.nng_msg arg0, ref ushort arg1); 1746 | 1747 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1748 | public static extern int nng_msg_trim_u32(nng.nng_msg arg0, ref uint arg1); 1749 | 1750 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1751 | public static extern int nng_msg_trim_u64(nng.nng_msg arg0, ref ulong arg1); 1752 | 1753 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1754 | public static extern int nng_msg_dup(out nng.nng_msg arg0, nng.nng_msg arg1); 1755 | 1756 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1757 | public static extern void nng_msg_clear(nng.nng_msg arg0); 1758 | 1759 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1760 | public static extern void nng_msg_header_clear(nng.nng_msg arg0); 1761 | 1762 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1763 | public static extern void nng_msg_set_pipe(nng.nng_msg arg0, nng.nng_pipe arg1); 1764 | 1765 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1766 | public static extern nng.nng_pipe nng_msg_get_pipe(nng.nng_msg arg0); 1767 | 1768 | /// 1769 | /// Pipe API. Generally pipes are only "observable" to applications, but 1770 | /// we do permit an application to close a pipe. This can be useful, for 1771 | /// example during a connection notification, to disconnect a pipe that 1772 | /// is associated with an invalid or untrusted remote peer. 1773 | /// 1774 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1775 | public static extern int nng_pipe_get(nng.nng_pipe arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, IntPtr arg2, ref nng.size_t arg3); 1776 | 1777 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1778 | public static extern int nng_pipe_get_bool(nng.nng_pipe arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ref bool arg2); 1779 | 1780 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1781 | public static extern int nng_pipe_get_int(nng.nng_pipe arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ref int arg2); 1782 | 1783 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1784 | public static extern int nng_pipe_get_ms(nng.nng_pipe arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ref nng.nng_duration arg2); 1785 | 1786 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1787 | public static extern int nng_pipe_get_size(nng.nng_pipe arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ref nng.size_t arg2); 1788 | 1789 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1790 | public static extern int nng_pipe_get_uint64(nng.nng_pipe arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ref ulong arg2); 1791 | 1792 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1793 | public static extern int nng_pipe_get_string(nng.nng_pipe arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, out IntPtr arg2); 1794 | 1795 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1796 | public static extern int nng_pipe_get_ptr(nng.nng_pipe arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, out IntPtr arg2); 1797 | 1798 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1799 | public static extern int nng_pipe_get_addr(nng.nng_pipe arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ref nng.nng_sockaddr arg2); 1800 | 1801 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1802 | public static extern int nng_pipe_close(nng.nng_pipe arg0); 1803 | 1804 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1805 | public static extern int nng_pipe_id(nng.nng_pipe arg0); 1806 | 1807 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1808 | public static extern nng.nng_socket nng_pipe_socket(nng.nng_pipe arg0); 1809 | 1810 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1811 | public static extern nng.nng_dialer nng_pipe_dialer(nng.nng_pipe arg0); 1812 | 1813 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1814 | public static extern nng.nng_listener nng_pipe_listener(nng.nng_pipe arg0); 1815 | 1816 | /// 1817 | /// nng_stats_get takes a snapshot of the entire set of statistics. 1818 | /// While the operation can be somewhat expensive (allocations), it 1819 | /// is done in a way that minimizes impact to running operations. 1820 | /// Note that the statistics are provided as a tree, with parents 1821 | /// used for grouping, and with child statistics underneath. The 1822 | /// top stat returned will be of type NNG_STAT_SCOPE with name "". 1823 | /// Applications may choose to consider this root scope as "root", if 1824 | /// the empty string is not suitable. 1825 | /// 1826 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1827 | public static extern int nng_stats_get(out nng.nng_stat arg0); 1828 | 1829 | /// 1830 | /// nng_stats_free frees a previous list of snapshots. This should only 1831 | /// be called on the parent statistic that obtained via nng_stats_get. 1832 | /// 1833 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1834 | public static extern void nng_stats_free(nng.nng_stat arg0); 1835 | 1836 | /// 1837 | /// nng_stats_dump is a debugging function that dumps the entire set of 1838 | /// statistics to stdout. 1839 | /// 1840 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1841 | public static extern void nng_stats_dump(nng.nng_stat arg0); 1842 | 1843 | /// 1844 | /// nng_stat_next finds the next sibling for the current stat. If there 1845 | /// are no more siblings, it returns NULL. 1846 | /// 1847 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1848 | public static extern nng.nng_stat nng_stat_next(nng.nng_stat arg0); 1849 | 1850 | /// 1851 | /// nng_stat_child finds the first child of the current stat. If no children 1852 | /// exist, then NULL is returned. 1853 | /// 1854 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1855 | public static extern nng.nng_stat nng_stat_child(nng.nng_stat arg0); 1856 | 1857 | /// 1858 | /// nng_stat_name is used to determine the name of the statistic. 1859 | /// This is a human readable name. Statistic names, as well as the presence 1860 | /// or absence or semantic of any particular statistic are not part of any 1861 | /// stable API, and may be changed without notice in future updates. 1862 | /// 1863 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1864 | [return:MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ReturnUtf8StringMarshaller))] 1865 | public static extern string nng_stat_name(nng.nng_stat arg0); 1866 | 1867 | /// 1868 | /// nng_stat_type is used to determine the type of the statistic. 1869 | /// Counters generally increment, and therefore changes in the value over 1870 | /// time are likely more interesting than the actual level. Level 1871 | /// values reflect some absolute state however, and should be presented to the 1872 | /// user as is. 1873 | /// 1874 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1875 | public static extern int nng_stat_type(nng.nng_stat arg0); 1876 | 1877 | /// 1878 | /// nng_stat_find is used to find a specific named statistic within 1879 | /// a statistic tree. NULL is returned if no such statistic exists. 1880 | /// 1881 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1882 | public static extern nng.nng_stat nng_stat_find(nng.nng_stat arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1); 1883 | 1884 | /// 1885 | /// nng_stat_find_socket is used to find the stats for the given socket. 1886 | /// 1887 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1888 | public static extern nng.nng_stat nng_stat_find_socket(nng.nng_stat arg0, nng.nng_socket arg1); 1889 | 1890 | /// 1891 | /// nng_stat_find_dialer is used to find the stats for the given dialer. 1892 | /// 1893 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1894 | public static extern nng.nng_stat nng_stat_find_dialer(nng.nng_stat arg0, nng.nng_dialer arg1); 1895 | 1896 | /// 1897 | /// nng_stat_find_listener is used to find the stats for the given listener. 1898 | /// 1899 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1900 | public static extern nng.nng_stat nng_stat_find_listener(nng.nng_stat arg0, nng.nng_listener arg1); 1901 | 1902 | /// 1903 | /// nng_stat_unit provides information about the unit for the statistic, 1904 | /// such as NNG_UNIT_BYTES or NNG_UNIT_BYTES. If no specific unit is 1905 | /// applicable, such as a relative priority, then NN_UNIT_NONE is returned. 1906 | /// 1907 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1908 | public static extern int nng_stat_unit(nng.nng_stat arg0); 1909 | 1910 | /// 1911 | /// nng_stat_value returns returns the actual value of the statistic. 1912 | /// Statistic values reflect their value at the time that the corresponding 1913 | /// snapshot was updated, and are undefined until an update is performed. 1914 | /// 1915 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1916 | public static extern ulong nng_stat_value(nng.nng_stat arg0); 1917 | 1918 | /// 1919 | /// nng_stat_value returns returns the actual value of the statistic. 1920 | /// Statistic values reflect their value at the time that the corresponding 1921 | /// snapshot was updated, and are undefined until an update is performed. 1922 | /// 1923 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1924 | [return:MarshalAs(UnmanagedType.U1)] 1925 | public static extern bool nng_stat_bool(nng.nng_stat arg0); 1926 | 1927 | /// 1928 | /// nng_stat_string returns the string associated with a string statistic, 1929 | /// or NULL if the statistic is not part of the string. The value returned 1930 | /// is valid until the associated statistic is freed. 1931 | /// 1932 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1933 | [return:MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ReturnUtf8StringMarshaller))] 1934 | public static extern string nng_stat_string(nng.nng_stat arg0); 1935 | 1936 | /// 1937 | /// nng_stat_desc returns a human readable description of the statistic. 1938 | /// This may be useful for display in diagnostic interfaces, etc. 1939 | /// 1940 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1941 | [return:MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ReturnUtf8StringMarshaller))] 1942 | public static extern string nng_stat_desc(nng.nng_stat arg0); 1943 | 1944 | /// 1945 | /// nng_stat_timestamp returns a timestamp (milliseconds) when the statistic 1946 | /// was captured. The base offset is the same as used by nng_clock(). 1947 | /// We don't use nng_time though, because that's in the supplemental header. 1948 | /// 1949 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1950 | public static extern ulong nng_stat_timestamp(nng.nng_stat arg0); 1951 | 1952 | /// 1953 | /// Device functionality. This connects two sockets together in a device, 1954 | /// which means that messages from one side are forwarded to the other. 1955 | /// 1956 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1957 | public static extern int nng_device(nng.nng_socket arg0, nng.nng_socket arg1); 1958 | 1959 | /// 1960 | /// nng_url_parse parses a URL string into a structured form. 1961 | /// Note that the u_port member will be filled out with a numeric 1962 | /// port if one isn't specified and a default port is appropriate for 1963 | /// the scheme. The URL structure is allocated, along with individual 1964 | /// members. It can be freed with nng_url_free. 1965 | /// 1966 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1967 | public static extern int nng_url_parse(out IntPtr arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1); 1968 | 1969 | /// 1970 | /// nng_url_free frees a URL structure that was created by nng_url_parse(). 1971 | /// 1972 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1973 | public static extern void nng_url_free(ref nng.nng_url arg0); 1974 | 1975 | /// 1976 | /// nng_url_clone clones a URL structure. 1977 | /// 1978 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1979 | public static extern int nng_url_clone(out IntPtr arg0, in nng.nng_url arg1); 1980 | 1981 | /// 1982 | /// nng_version returns the library version as a human readable string. 1983 | /// 1984 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1985 | [return:MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ReturnUtf8StringMarshaller))] 1986 | public static extern string nng_version(); 1987 | 1988 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1989 | public static extern void nng_stream_free(nng.nng_stream arg0); 1990 | 1991 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1992 | public static extern void nng_stream_close(nng.nng_stream arg0); 1993 | 1994 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1995 | public static extern void nng_stream_send(nng.nng_stream arg0, nng.nng_aio arg1); 1996 | 1997 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 1998 | public static extern void nng_stream_recv(nng.nng_stream arg0, nng.nng_aio arg1); 1999 | 2000 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2001 | public static extern int nng_stream_get(nng.nng_stream arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, IntPtr arg2, ref nng.size_t arg3); 2002 | 2003 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2004 | public static extern int nng_stream_get_bool(nng.nng_stream arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ref bool arg2); 2005 | 2006 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2007 | public static extern int nng_stream_get_int(nng.nng_stream arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ref int arg2); 2008 | 2009 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2010 | public static extern int nng_stream_get_ms(nng.nng_stream arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ref nng.nng_duration arg2); 2011 | 2012 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2013 | public static extern int nng_stream_get_size(nng.nng_stream arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ref nng.size_t arg2); 2014 | 2015 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2016 | public static extern int nng_stream_get_uint64(nng.nng_stream arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ref ulong arg2); 2017 | 2018 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2019 | public static extern int nng_stream_get_string(nng.nng_stream arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, out IntPtr arg2); 2020 | 2021 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2022 | public static extern int nng_stream_get_ptr(nng.nng_stream arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, out IntPtr arg2); 2023 | 2024 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2025 | public static extern int nng_stream_get_addr(nng.nng_stream arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ref nng.nng_sockaddr arg2); 2026 | 2027 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2028 | public static extern int nng_stream_set(nng.nng_stream arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, IntPtr arg2, nng.size_t arg3); 2029 | 2030 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2031 | public static extern int nng_stream_set_bool(nng.nng_stream arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, [MarshalAs(UnmanagedType.U1)] bool arg2); 2032 | 2033 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2034 | public static extern int nng_stream_set_int(nng.nng_stream arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, int arg2); 2035 | 2036 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2037 | public static extern int nng_stream_set_ms(nng.nng_stream arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, nng.nng_duration arg2); 2038 | 2039 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2040 | public static extern int nng_stream_set_size(nng.nng_stream arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, nng.size_t arg2); 2041 | 2042 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2043 | public static extern int nng_stream_set_uint64(nng.nng_stream arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ulong arg2); 2044 | 2045 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2046 | public static extern int nng_stream_set_string(nng.nng_stream arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg2); 2047 | 2048 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2049 | public static extern int nng_stream_set_ptr(nng.nng_stream arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, IntPtr arg2); 2050 | 2051 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2052 | public static extern int nng_stream_set_addr(nng.nng_stream arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, in nng.nng_sockaddr arg2); 2053 | 2054 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2055 | public static extern int nng_stream_dialer_alloc(out nng.nng_stream_dialer arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1); 2056 | 2057 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2058 | public static extern int nng_stream_dialer_alloc_url(out nng.nng_stream_dialer arg0, in nng.nng_url arg1); 2059 | 2060 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2061 | public static extern void nng_stream_dialer_free(nng.nng_stream_dialer arg0); 2062 | 2063 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2064 | public static extern void nng_stream_dialer_close(nng.nng_stream_dialer arg0); 2065 | 2066 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2067 | public static extern void nng_stream_dialer_dial(nng.nng_stream_dialer arg0, nng.nng_aio arg1); 2068 | 2069 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2070 | public static extern int nng_stream_dialer_set(nng.nng_stream_dialer arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, IntPtr arg2, nng.size_t arg3); 2071 | 2072 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2073 | public static extern int nng_stream_dialer_get(nng.nng_stream_dialer arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, IntPtr arg2, ref nng.size_t arg3); 2074 | 2075 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2076 | public static extern int nng_stream_dialer_get_bool(nng.nng_stream_dialer arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ref bool arg2); 2077 | 2078 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2079 | public static extern int nng_stream_dialer_get_int(nng.nng_stream_dialer arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ref int arg2); 2080 | 2081 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2082 | public static extern int nng_stream_dialer_get_ms(nng.nng_stream_dialer arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ref nng.nng_duration arg2); 2083 | 2084 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2085 | public static extern int nng_stream_dialer_get_size(nng.nng_stream_dialer arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ref nng.size_t arg2); 2086 | 2087 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2088 | public static extern int nng_stream_dialer_get_uint64(nng.nng_stream_dialer arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ref ulong arg2); 2089 | 2090 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2091 | public static extern int nng_stream_dialer_get_string(nng.nng_stream_dialer arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, out IntPtr arg2); 2092 | 2093 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2094 | public static extern int nng_stream_dialer_get_ptr(nng.nng_stream_dialer arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, out IntPtr arg2); 2095 | 2096 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2097 | public static extern int nng_stream_dialer_get_addr(nng.nng_stream_dialer arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ref nng.nng_sockaddr arg2); 2098 | 2099 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2100 | public static extern int nng_stream_dialer_set_bool(nng.nng_stream_dialer arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, [MarshalAs(UnmanagedType.U1)] bool arg2); 2101 | 2102 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2103 | public static extern int nng_stream_dialer_set_int(nng.nng_stream_dialer arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, int arg2); 2104 | 2105 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2106 | public static extern int nng_stream_dialer_set_ms(nng.nng_stream_dialer arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, nng.nng_duration arg2); 2107 | 2108 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2109 | public static extern int nng_stream_dialer_set_size(nng.nng_stream_dialer arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, nng.size_t arg2); 2110 | 2111 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2112 | public static extern int nng_stream_dialer_set_uint64(nng.nng_stream_dialer arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ulong arg2); 2113 | 2114 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2115 | public static extern int nng_stream_dialer_set_string(nng.nng_stream_dialer arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg2); 2116 | 2117 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2118 | public static extern int nng_stream_dialer_set_ptr(nng.nng_stream_dialer arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, IntPtr arg2); 2119 | 2120 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2121 | public static extern int nng_stream_dialer_set_addr(nng.nng_stream_dialer arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, in nng.nng_sockaddr arg2); 2122 | 2123 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2124 | public static extern int nng_stream_listener_alloc(out nng.nng_stream_listener arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1); 2125 | 2126 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2127 | public static extern int nng_stream_listener_alloc_url(out nng.nng_stream_listener arg0, in nng.nng_url arg1); 2128 | 2129 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2130 | public static extern void nng_stream_listener_free(nng.nng_stream_listener arg0); 2131 | 2132 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2133 | public static extern void nng_stream_listener_close(nng.nng_stream_listener arg0); 2134 | 2135 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2136 | public static extern int nng_stream_listener_listen(nng.nng_stream_listener arg0); 2137 | 2138 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2139 | public static extern void nng_stream_listener_accept(nng.nng_stream_listener arg0, nng.nng_aio arg1); 2140 | 2141 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2142 | public static extern int nng_stream_listener_set(nng.nng_stream_listener arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, IntPtr arg2, nng.size_t arg3); 2143 | 2144 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2145 | public static extern int nng_stream_listener_get(nng.nng_stream_listener arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, IntPtr arg2, ref nng.size_t arg3); 2146 | 2147 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2148 | public static extern int nng_stream_listener_get_bool(nng.nng_stream_listener arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ref bool arg2); 2149 | 2150 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2151 | public static extern int nng_stream_listener_get_int(nng.nng_stream_listener arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ref int arg2); 2152 | 2153 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2154 | public static extern int nng_stream_listener_get_ms(nng.nng_stream_listener arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ref nng.nng_duration arg2); 2155 | 2156 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2157 | public static extern int nng_stream_listener_get_size(nng.nng_stream_listener arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ref nng.size_t arg2); 2158 | 2159 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2160 | public static extern int nng_stream_listener_get_uint64(nng.nng_stream_listener arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ref ulong arg2); 2161 | 2162 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2163 | public static extern int nng_stream_listener_get_string(nng.nng_stream_listener arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, out IntPtr arg2); 2164 | 2165 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2166 | public static extern int nng_stream_listener_get_ptr(nng.nng_stream_listener arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, out IntPtr arg2); 2167 | 2168 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2169 | public static extern int nng_stream_listener_get_addr(nng.nng_stream_listener arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ref nng.nng_sockaddr arg2); 2170 | 2171 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2172 | public static extern int nng_stream_listener_set_bool(nng.nng_stream_listener arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, [MarshalAs(UnmanagedType.U1)] bool arg2); 2173 | 2174 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2175 | public static extern int nng_stream_listener_set_int(nng.nng_stream_listener arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, int arg2); 2176 | 2177 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2178 | public static extern int nng_stream_listener_set_ms(nng.nng_stream_listener arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, nng.nng_duration arg2); 2179 | 2180 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2181 | public static extern int nng_stream_listener_set_size(nng.nng_stream_listener arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, nng.size_t arg2); 2182 | 2183 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2184 | public static extern int nng_stream_listener_set_uint64(nng.nng_stream_listener arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, ulong arg2); 2185 | 2186 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2187 | public static extern int nng_stream_listener_set_string(nng.nng_stream_listener arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg2); 2188 | 2189 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2190 | public static extern int nng_stream_listener_set_ptr(nng.nng_stream_listener arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, IntPtr arg2); 2191 | 2192 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2193 | public static extern int nng_stream_listener_set_addr(nng.nng_stream_listener arg0, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FastUtf8StringMarshaller))] string arg1, in nng.nng_sockaddr arg2); 2194 | 2195 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2196 | public static extern int nng_bus0_open(ref nng.nng_socket arg0); 2197 | 2198 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2199 | public static extern int nng_bus0_open_raw(ref nng.nng_socket arg0); 2200 | 2201 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2202 | public static extern int nng_pair0_open(ref nng.nng_socket arg0); 2203 | 2204 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2205 | public static extern int nng_pair0_open_raw(ref nng.nng_socket arg0); 2206 | 2207 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2208 | public static extern int nng_pair1_open(ref nng.nng_socket arg0); 2209 | 2210 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2211 | public static extern int nng_pair1_open_raw(ref nng.nng_socket arg0); 2212 | 2213 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2214 | public static extern int nng_pair1_open_poly(ref nng.nng_socket arg0); 2215 | 2216 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2217 | public static extern int nng_pull0_open(ref nng.nng_socket arg0); 2218 | 2219 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2220 | public static extern int nng_pull0_open_raw(ref nng.nng_socket arg0); 2221 | 2222 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2223 | public static extern int nng_push0_open(ref nng.nng_socket arg0); 2224 | 2225 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2226 | public static extern int nng_push0_open_raw(ref nng.nng_socket arg0); 2227 | 2228 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2229 | public static extern int nng_pub0_open(ref nng.nng_socket arg0); 2230 | 2231 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2232 | public static extern int nng_pub0_open_raw(ref nng.nng_socket arg0); 2233 | 2234 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2235 | public static extern int nng_sub0_open(ref nng.nng_socket arg0); 2236 | 2237 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2238 | public static extern int nng_sub0_open_raw(ref nng.nng_socket arg0); 2239 | 2240 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2241 | public static extern int nng_rep0_open(ref nng.nng_socket arg0); 2242 | 2243 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2244 | public static extern int nng_rep0_open_raw(ref nng.nng_socket arg0); 2245 | 2246 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2247 | public static extern int nng_req0_open(ref nng.nng_socket arg0); 2248 | 2249 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2250 | public static extern int nng_req0_open_raw(ref nng.nng_socket arg0); 2251 | 2252 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2253 | public static extern int nng_respondent0_open(ref nng.nng_socket arg0); 2254 | 2255 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2256 | public static extern int nng_respondent0_open_raw(ref nng.nng_socket arg0); 2257 | 2258 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2259 | public static extern int nng_surveyor0_open(ref nng.nng_socket arg0); 2260 | 2261 | [DllImport(nngDll, CallingConvention = CallingConvention.Cdecl)] 2262 | public static extern int nng_surveyor0_open_raw(ref nng.nng_socket arg0); 2263 | } 2264 | -------------------------------------------------------------------------------- /src/SharpNng/runtimes/linux-arm/native/libnng_native.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xoofx/SharpNng/10190b307544833402d96780c9503054100baab4/src/SharpNng/runtimes/linux-arm/native/libnng_native.so -------------------------------------------------------------------------------- /src/SharpNng/runtimes/linux-arm64/native/libnng_native.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xoofx/SharpNng/10190b307544833402d96780c9503054100baab4/src/SharpNng/runtimes/linux-arm64/native/libnng_native.so -------------------------------------------------------------------------------- /src/SharpNng/runtimes/linux-x64/native/libnng_native.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xoofx/SharpNng/10190b307544833402d96780c9503054100baab4/src/SharpNng/runtimes/linux-x64/native/libnng_native.so -------------------------------------------------------------------------------- /src/SharpNng/runtimes/osx-arm64/native/libnng_native.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xoofx/SharpNng/10190b307544833402d96780c9503054100baab4/src/SharpNng/runtimes/osx-arm64/native/libnng_native.dylib -------------------------------------------------------------------------------- /src/SharpNng/runtimes/osx-x64/native/libnng_native.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xoofx/SharpNng/10190b307544833402d96780c9503054100baab4/src/SharpNng/runtimes/osx-x64/native/libnng_native.dylib -------------------------------------------------------------------------------- /src/SharpNng/runtimes/win-arm/native/nng_native.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xoofx/SharpNng/10190b307544833402d96780c9503054100baab4/src/SharpNng/runtimes/win-arm/native/nng_native.dll -------------------------------------------------------------------------------- /src/SharpNng/runtimes/win-arm64/native/nng_native.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xoofx/SharpNng/10190b307544833402d96780c9503054100baab4/src/SharpNng/runtimes/win-arm64/native/nng_native.dll -------------------------------------------------------------------------------- /src/SharpNng/runtimes/win-x64/native/nng_native.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xoofx/SharpNng/10190b307544833402d96780c9503054100baab4/src/SharpNng/runtimes/win-x64/native/nng_native.dll -------------------------------------------------------------------------------- /src/SharpNng/runtimes/win-x86/native/nng_native.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xoofx/SharpNng/10190b307544833402d96780c9503054100baab4/src/SharpNng/runtimes/win-x86/native/nng_native.dll -------------------------------------------------------------------------------- /src/dotnet-releaser.toml: -------------------------------------------------------------------------------- 1 | # configuration file for dotnet-releaser 2 | [msbuild] 3 | project = "SharpNng.sln" 4 | [github] 5 | user = "xoofx" 6 | repo = "SharpNng" 7 | -------------------------------------------------------------------------------- /src/global.json: -------------------------------------------------------------------------------- 1 | { 2 | "sdk": { 3 | "version": "6.0.100", 4 | "rollForward": "latestMinor", 5 | "allowPrerelease": false 6 | } 7 | } --------------------------------------------------------------------------------