LibSmi.Net.Helpers 0.1.0-dev

This is a prerelease version of LibSmi.Net.Helpers.
dotnet add package LibSmi.Net.Helpers --version 0.1.0-dev                
NuGet\Install-Package LibSmi.Net.Helpers -Version 0.1.0-dev                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="LibSmi.Net.Helpers" Version="0.1.0-dev" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add LibSmi.Net.Helpers --version 0.1.0-dev                
#r "nuget: LibSmi.Net.Helpers, 0.1.0-dev"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install LibSmi.Net.Helpers as a Cake Addin
#addin nuget:?package=LibSmi.Net.Helpers&version=0.1.0-dev&prerelease

// Install LibSmi.Net.Helpers as a Cake Tool
#tool nuget:?package=LibSmi.Net.Helpers&version=0.1.0-dev&prerelease                

LibSmi.Net

.NET wrapper for libsmi

using LibSmi.Net;

Smi.Initialize("hello-world");

const string INDENT = "  ";

try
{
    // if SMIPATH env var is not set 
    // the mibs path must be manually set
    // Smi.SetPath("path/to/mibs/dir")
    
    // retrieve the module object
    var module = Smi.GetModule("SNMPV2-SMI");
    
    // get the 'org' node
    var node = module.GetNode("org");
    
    // alternatively module.GetFirstNode could
    // have been used to retrieve the first node
    // var node = module.GetFirstNode();

    var baseLevel = (int) node.OidLen;
    var level = 0;
    
    // traverse the subtree in lexicographic order
    while (node != null)
    {
        level = (int)node.OidLen - baseLevel;

        var indent = level > 0 
            ? Enumerable.Repeat(INDENT, level).Aggregate((a,b) => a + b)
            : string.Empty;

        Console.WriteLine($"{indent}{node.Name} ({node.ToOidString()})");

        node = node.GetNextNode();
    }
}
finally
{
    Smi.Cleanup();
}

Output

org (.1.3)
  dod (.1.3.6)
    internet (.1.3.6.1)
      directory (.1.3.6.1.1)
      mgmt (.1.3.6.1.2)
        mib-2 (.1.3.6.1.2.1)
          transmission (.1.3.6.1.2.1.10)
      experimental (.1.3.6.1.3)
      private (.1.3.6.1.4)
        enterprises (.1.3.6.1.4.1)
      security (.1.3.6.1.5)
      snmpV2 (.1.3.6.1.6)
        snmpDomains (.1.3.6.1.6.1)
        snmpProxys (.1.3.6.1.6.2)
        snmpModules (.1.3.6.1.6.3)
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.1.0-dev 112 12/6/2022