EnumPduType Enumeration

Snmp Source Component

Getting Started

Getting Started

Welcome to SnmpSource .NET component , a comprehensive toolkit for rapid development of SNMP-based management applications that are reliable and scalable. SnmpSource component is a powerful 100% .net library to build cross-platform, real-time application for monitoring and tracking the performance of network elements.

Overview:

  • Multi SNMP version support: Complete support for SNMPv1 (RFC 1155, RFC 1157), SNMPv2c (RFC 3416) and SNMPv3.
  • Simple MIB file to XML convertion and display
  • Support SMIv1 and SMIv2
  • Synchronized and Asynchronized Snmp request
  • SNMPV3 support both DES and 128 bits AES encryption algorithms
  • SNMPV3 support both MD5 and SHA authentication algorithms
  • Full set of C# and VB.net examples to perform many functionalities such as, SNMP GET, SNMP GETNEXT, SNMP BULK, SNMP WALK, SNMP TRAP etc.
  • Easy to use for .net developer

Note*

Currently version 1, version 2c and version 3 snmp are supported in this release.

Copyright ©2006, SnmpSource All Rights Reserved


Overview

SnmpSource Component

Getting Started

Getting Started

Welcome to SnmpSource .NET component , a comprehensive toolkit for rapid development of SNMP-based management applications that are reliable and scalable. SnmpSource component is a powerful 100% .net library to build cross-platform, real-time application for monitoring and tracking the performance of network elements.

Overview:

  • Multi SNMP version support: Complete support for SNMPv1 (RFC 1155, RFC 1157), SNMPv2c (RFC 3416) and SNMPv3.
  • Simple MIB file to XML convertion and display
  • Support SMIv1 and SMIv2
  • Synchronized and Asynchronized Snmp request
  • SNMPV3 support both DES and 128 bits AES encryption algorithms
  • SNMPV3 support both MD5 and SHA authentication algorithms
  • Full set of C# and VB.net examples to perform many functionalities such as, SNMP GET, SNMP GETNEXT, SNMP BULK, SNMP WALK, SNMP TRAP etc.
  • Easy to use for .net developer

Note*

Currently version 1, version 2c and version 3 snmp are supported in this release.


Installation

Installation

To install this product double click the .MSI file and follow the installation steps.

Prerequisites

The Microsoft .NET framework runtime must already be installed on your computer. The Microsoft .NET framework redistributable may be downloaded from msdn.microsoft.com.

You will also need a development environment such as Visual Studio .NET.

30 Day Trial License

The SnmpSource.com component comes with a 30 day trial license upon installation. A full license must be purchased from SnmpSource.com after the 30 days.

License Installation

Copy the license file Snmpsource.Snmp.lic to the binary directory, the default directory is \Program Files\SnmpSource\bin.


Distributables

SnmpSource Component

Redistributables

The SnmpSource Component may be redistributed royalty free by customers who have purchased a valid license.

Method 1:

Copy the license file Snmpsource.Snmp.lic and SnmpSource.dll into your application's directory on the target machine. Those two files should be in the same directory.

Method 2:

The steps to embed the license file into your excutables:

  • Add a text file named "licenses.licx" into your project.
  • Change the file's "Bulid Action" property into "Embeded Resource"
  • Add a line "SnmpSource.Snmp, SnmpSource" in the file
  • Compile your project

You may also manually invoke the License Compiler (lc.exe) to create a binary license file from the .licx file which is then linked into the application EXE or DLL if VS IDE is not used.


Support

SnmpSource is committed to delivering quality products that exceed our customers' expectations. In order to help you solve your issues quickly, we have endeavored to make our documentation as thorough and clear as possible so that can you resolve most problems using this resource.

If, after consulting the documentation you are still experiencing a problem with SnmpSource, please email support@snmpsource.com with a description of your problem. For licensing questions, please contact sales@snmpsource.com.


Examples

Examples

The following C# and VB.net examples is shipped with this installation

  • snmpget -- an example to demonstrate how to make simple snmp query.
  • snmpasyncget -- an example to make asynchronized snmp query.
  • snmpbulk -- an example shows how to using SnmpSource componenet to GET v1/v2 bulk snmp.
  • snmpwalk -- an example shows how to using SnmpSource componenet to do the basic SNMP WALK.
  • snmptrapreceiver -- an example shows how to using SnmpSource componenet to receive trap.
  • trapv1generator -- an example shows how to using SnmpSource componenet to generate V1 Trap.
  • MibXMLReader -- an example display Mib file in tree view and convert the file to XML format.


Examples

SnmpSource Component

Examples - MibXMLReader

Use SnmpSource component to read Mib file and convert to XML file.

To use this code sample, add a reference to the following assemblies:
SnmpSource.dll

Then import the following namespaces at the top of your code file with using (for C#) or Imports (for VB) keywords:
SnmpSource.Mib


Examples

SnmpSource Component

Examples - snmpget

Use SnmpSource component to make a simple snmp query.

To use this code sample, add a reference to the following assemblies:
SnmpSource.dll

Then import the following namespaces at the top of your code file with using (for C#) or Imports (for VB) keywords:
SnmpSource

[C#]
    //create snmp session
    SnmpSession s1 = new SnmpSession();

    //create snmp pdu
    SnmpPdu pdu = new SnmpPdu();
    //Specify the Pdu type
    pdu.PduType = EnumPduType.GetPdu;
    //Set the community string
    pdu.Community = "public";
    pdu.Version =  SnmpVersion.Version1;

    //creat response pdu
    SnmpPdu response = null;

    // Try to retrieve snmp record
    try
    {
        // Add snmp variable
        SnmpVariable var = SnmpVariable.CreateSnmpVariable("1.3.6.1.2.1.1.5.0");
        pdu.AddRequestVariables(var);
        // Synchronized request snmp SyncRequest(hostip, port, pdu)
        response = s1.SyncRequest("127.0.0.1", 161, pdu);
    }
    catch (Exception	ex)
    {
        System.Console.Error.WriteLine("Sending PDU: " + ex.Message);
        System.Environment.Exit(1);
    }

    // Display the result
    try
    {
        if(response.ErrorStatus == 0)
        {
            System.Console.WriteLine("Response oid: "  + response.InnerVariables[0].OID);
            System.Console.WriteLine("Response value: "  + response.InnerVariables[0].Data.ToString());
            System.Console.WriteLine("");
        }
        else
        {
        System.Console.WriteLine("Response error code: "  + response.ErrorStatus);
        }

    }
    catch (Exception	ex)
    {
        System.Console.WriteLine("Error in output: " + ex.Message);
    }

[Vb]
    'create snmp session
    Dim s1 As New SnmpSession

    'create snmp pdu
    Dim pdu As New SnmpPdu
    'Specify the Pdu type
    pdu.PduType = EnumPduType.GetPdu
    'Set the community string
    pdu.Community = "public"
    pdu.Version =  SnmpVersion.Version1

    'creat response pdu
    Dim response As SnmpPdu = Nothing

    ' Try to retrieve snmp record
    Try

        ' Add snmp variable
        Dim variable1 As SnmpVariable = SnmpVariable.CreateSnmpVariable("1.3.6.1.2.1.1.5.0")
        pdu.AddRequestVariables(variable1)
        response = s1.SyncRequest("127.0.0.1", 161, pdu)
    Catch exception1	As	Exception
        Console.Error.WriteLine(("Sending PDU: " & exception1.Message))
        Environment.Exit(1)
    End Try

    ' Display the result
    Try
        If (response.ErrorStatus = SnmpErrorStatus.noError) Then
            Console.WriteLine(("Response oid: " & response.InnerVariables.Item(0).OID))
            Console.WriteLine(("Response value: " & response.InnerVariables.Item(0).Data.ToString))
            Console.WriteLine("")
        Else
            Console.WriteLine(("Response error code: " & response.ErrorStatus))
        End If
    Catch exception2 As Exception
        Console.WriteLine(("Error in output: " & exception2.Message))
        Return
    End Try

The syntax to use the included command line example.

Syntax: snmpget [Options] host oid [oid] ...

Options:

/version:v1|v2 or /v:v1|v2 Specify the version number.
/port:portnumber or /p:portnumber Specify the port number.
/timeout:ms or /t:ms Time out in milliseconds.
/debug or /d Turn on the debug setting.
/community:community or /c:community Set community.
/? or /help Display this usage message.

Example: snmpget /d /v:v2 /c:public 127.0.0.1 1.3.6.1.2.1.1.5.0


Examples

SnmpSource Component

Examples - snmpasyncget

Use SnmpSource component to asynchronizely retrieve snmp value by oid.

To use this code sample, add a reference to the following assemblies:
SnmpSource.dll

Then import the following namespaces at the top of your code file with using (for C#) or Imports (for VB) keywords:
SnmpSource

System.Net

[C#]
public void  Asyncget()
{
    //create snmp session
    SnmpSession s1 = new SnmpSession();
    //setup callback function
    s1.Processes += new AsyncProcesses(callbackexample);

    //create snmp pdu
    SnmpPdu pdu = new SnmpPdu();
    //Specify the Pdu type
    pdu.PduType = EnumPduType.GetPdu;
    //Set the community string
    pdu.Community = "public";
    pdu.Version =  SnmpVersion.Version1;

    // Try to retrieve snmp record
    try
    {
        // Add snmp variable
        SnmpVariable var = SnmpVariable.CreateSnmpVariable("1.3.6.1.2.1.1.5.0");
        pdu.AddRequestVariables(var);
        // Asynchronized request snmp SyncRequest(hostip, port, pdu)
        s1.AsyncRequest("127.0.0.1", 161, pdu);
    }
    catch (Exception	ex)
    {
        System.Console.Error.WriteLine("Sending PDU: " + ex.Message);
        System.Environment.Exit(1);
    }

    //Waiting for the result
    while(true)
    {
        try
        {
            System.Threading.Thread.Sleep(new System.TimeSpan((System.Int64) 10000 * 100));
        }
        catch (System.Exception )
        {
        }
        if (s1.AsyncPendingCount == 0)
        {
            System.Environment.Exit(0);
        }
    }
}
//callback function
public void callbackexample(SnmpErrorStatus ErrorCode, SnmpPdu s, EndPoint SendToRemoteAddress, EndPoint RecvFromRemoteAddress)
{
    try
    {
        if (ErrorCode == 0)
        {
            System.Console.WriteLine("Response oid: "  + s.InnerVariables[0].OID);
            System.Console.WriteLine("Response value: "  + s.InnerVariables[0].Data.ToString());
            System.Console.WriteLine("");
        }
    }
    catch(System.Exception ex)
    {
            System.Console.WriteLine("Error in output: " + ex.Message);
    }
}

[Vb]
Public Sub Asyncget
    'create snmp session
    Dim s1 As New SnmpSession
    AddHandler s1.Processes, AddressOf callbackexample

    'create snmp pdu
    Dim pdu As New SnmpPdu
    'Specify the Pdu type
    pdu.PduType = EnumPduType.GetPdu
    'Set the community string
    pdu.Community = "public"
    pdu.Version =  SnmpVersion.Version1

    ' Try to retrieve snmp record
    Try

        ' Add snmp variable
        Dim variable1 As SnmpVariable = SnmpVariable.CreateSnmpVariable("1.3.6.1.2.1.1.5.0")
        pdu.AddRequestVariables(variable1)
        s1.AsyncRequest("127.0.0.1", 161, pdu)
    Catch exception1	As	Exception
        Console.Error.WriteLine(("Sending PDU: " & exception1.Message))
        Environment.Exit(1)
    End Try

    'Waiting for the result
    While (True)
        Try
            System.Threading.Thread.Sleep(New System.TimeSpan(CType(10000, System.Int64) * 100))
        Catch ex1 As System.Exception
        End Try
        If (s1.AsyncPendingCount = 0) Then
            System.Environment.Exit(0)
        End If
    End While
End Sub

'callback function
Public Sub callbackexample(ByVal ErrorCode As SnmpErrorStatus, ByVal s As SnmpPdu, ByVal SendToRemoteAddress As EndPoint, ByVal RecvFromRemoteAddress As EndPoint)
    Try
        If (ErrorCode = 0) Then
            Dim k As Integer
                Console.WriteLine("Response oid: " & s.InnerVariables(k).OID)
                Console.WriteLine("Response value: " & s.InnerVariables(k).Data.ToString)
                Console.WriteLine("")
        Else
            Dim objArray1 As Object() = New Object() {"Asnyc Request Send to: ", SendToRemoteAddress.ToString, "; With Error code: ", ErrorCode}
            Console.WriteLine(String.Concat(objArray1))
        End If
    Catch exception1 As Exception
            Console.WriteLine(("Error in output: " & exception1.Message))
    End Try
End Sub

The syntax to use included command line example.

Syntax: snmpasyncget [Options] host oid [oid] ...

Options:

/version:v1|v2 or /v:v1|v2 Specify the version number.
/port:portnumber or /p:portnumber Specify the port number.
/timeout:ms or /t:ms Time out in milliseconds.
/debug or /d Turn on the debug setting.
/community:community or /c:community Set community.
/? or /help Display this usage message.

Example: snmpasyncget /d /v:v2 /c:public 127.0.0.1 1.3.6.1.2.1.1.5.0


Examples

SnmpSource Component

Examples - snmpbulk

Use SnmpSource component to GET bulk snmp. Snmp version 1 doesn't support bulk request.

To use this code sample, add a reference to the following assemblies:
SnmpSource.dll

Then import the following namespaces at the top of your code file with using (for C#) or Imports (for VB) keywords:
SnmpSource

[C#]
    //create snmp session
    SnmpSession s1 = new SnmpSession();

    //create snmp pdu
    SnmpPdu pdu = new SnmpPdu();
    //Specify the Pdu type
    pdu.PduType = EnumPduType.GetBulkPdu;
    //Set the community string
    pdu.Community = "public";
    pdu.Version =  SnmpVersion.Version2;

    // set non-repeaters
    pdu.BulkNonRepeaters = 1;
    // set max-repetitions
    pdu.BulkMaxRepetitions = 2;

    //creat response pdu
    SnmpPdu response = null;

    // Try to retrieve bulk snmp record
    try
    {
        // Add snmp variable
        SnmpVariable var = SnmpVariable.CreateSnmpVariable("1.3.6.1.2.1.1.5.0");
        pdu.AddRequestVariables(var);
        var = SnmpVariable.CreateSnmpVariable("1.3.6.1.2.1.2.2.1.1.0");
        pdu.AddRequestVariables(var);
        var = SnmpVariable.CreateSnmpVariable("1.3.6.1.2.1.2.2.1.2.0");
        pdu.AddRequestVariables(var);
        // Asynchronized request snmp SyncRequest(hostip, port, pdu)
        response = s1.SyncRequest("127.0.0.1", 161, pdu);
    }
    catch (Exception	ex)
    {
        System.Console.Error.WriteLine("Sending PDU: " + ex.Message);
        System.Environment.Exit(1);
    }

    // Display the result
    try
    {
        if(response.ErrorStatus == 0)
        {
            for (int k=0; k< response.InnerVariables.Count; k++)
            {
                System.Console.WriteLine("Response oid: "  + response.InnerVariables[k].OID);
                System.Console.WriteLine("Response value: "  + response.InnerVariables[k].Data.ToString());
                System.Console.WriteLine("");
            }
        }
        else
        {
        System.Console.WriteLine("Response error code: "  + response.ErrorStatus);
        }

    }
    catch (Exception	ex)
    {
        System.Console.WriteLine("Error in output: " + ex.Message);
    }

[Vb]
    'create snmp session
        Dim
    s1 As New SnmpSession

    'create snmp pdu
    Dim pdu As New SnmpPdu
    'Specify the Pdu type
    pdu.PduType = EnumPduType.GetBulkPdu
    'Set the community string
    pdu.Community = "public"
    pdu.Version =  SnmpVersion.Version2

    ' set non-repeaters
    pdu.BulkNonRepeaters = 1
    ' set max-repetitions
    pdu.BulkMaxRepetitions = 2

    'creat response pdu
    Dim response As SnmpPdu = Nothing

    ' Try to retrieve snmp record
    Try
        ' Add snmp variable
        Dim variable1 As SnmpVariable = SnmpVariable.CreateSnmpVariable("1.3.6.1.2.1.1.5.0")
        pdu.AddRequestVariables(variable1)
        variable1 = SnmpVariable.CreateSnmpVariable("1.3.6.1.2.1.2.2.1.1.0")
        pdu.AddRequestVariables(variable1)
        variable1 = SnmpVariable.CreateSnmpVariable("1.3.6.1.2.1.2.2.1.2.0")
        pdu.AddRequestVariables(variable1)
        response = s1.SyncRequest("127.0.0.1", 161, pdu)
    Catch exception1	As	Exception
        Console.Error.WriteLine(("Sending PDU: " & exception1.Message))
        Environment.Exit(1)
    End Try

    ' Display the result
    Try
        If (response.ErrorStatus = SnmpErrorStatus.noError) Then
            Dim i As Integer
            For i = 0 To response.InnerVariables.Count - 1
                Console.WriteLine(("Response oid: " & response.InnerVariables.Item(i).OID))
                Console.WriteLine(("Response value: " & response.InnerVariables.Item(i).Data.ToString))
                Console.WriteLine("")
            Next i
        Else
            Console.WriteLine(("Response error code: " & response.ErrorStatus))
        End If
    Catch exception2 As Exception
        Console.WriteLine(("Error in output: " & exception2.Message))
        Return
    End Try

The syntax to use the included command line example.

Syntax: snmpbulk [Options] NonRepeaters MaxRepetions host oid [oid] ...

Options:

/version:v1|v2 or /v:v1|v2 Specify the version number.
/port:portnumber or /p:portnumber Specify the port number.
/timeout:ms or /t:ms Time out in milliseconds.
/debug or /d Turn on the debug setting.
/community:community or /c:community Set community.
/? or /help Display this usage message.

Example: snmpbulk /d /v:v2 /c:public 1 2  127.0.0.1 1.3.6.1.2.1.1.5.0 1.3.6.1.2.1.2.2.1.1.0 1.3.6.1.2.1.2.2.1.2.0


Examples

SnmpSource Component

Examples - snmpwalk

Use SnmpSource component to do the basic SNMP WALK.

To use this code sample, add a reference to the following assemblies:
SnmpSource.dll

Then import the following namespaces at the top of your code file with using (for C#) or Imports (for VB) keywords:
SnmpSource

[C#]
    //create snmp session
    SnmpSession s1 = new SnmpSession();

    //create snmp pdu
    SnmpPdu pdu = new SnmpPdu();
    //Specify the Pdu type
    pdu.PduType = EnumPduType.GetNextPdu;
    //Set the community string
    pdu.Community = "public";
    pdu.Version =  SnmpVersion.Version2;

    //Creat response pdu.
    SnmpPdu response = null;

    //Assign the walked oid.
    string oid = "1.3.6.1.2.1.1";
    string conoid = oid;

    // loop for each PDU in the walk
    while (oid.StartsWith(conoid))
    {
        pdu.InnerVariables.Clear();
        SnmpVariable var = SnmpVariable.CreateSnmpVariable(oid);
        pdu.AddRequestVariables(var);
        try
        {
            response = s1.SyncRequest("127.0.0.1", 161, pdu);
        }
        catch(Exception ex)
        {
            System.Console.WriteLine(ex.Message);
            oid = "";
            break;
        }
        if (response.ErrorIndex!= 0)
        {
            System.Console.WriteLine("Response Error:" + response.ErrorStatus);
            break;
        }
        else
        {
            //Display result and assign new oid
            for (int k=0; k< response.InnerVariables.Count; k++)
            {
                oid = response.InnerVariables[k].OID;
                System.Console.WriteLine("Response oid: "  + response.InnerVariables[k].OID);
                System.Console.WriteLine("Response value: "  + response.InnerVariables[k].Data.ToString());
                System.Console.WriteLine("");
            }
        }
        response.InnerVariables.Clear();
    }

[Vb]
    'create snmp session
        Dim
    s1 As New SnmpSession

    'create snmp pdu
    Dim pdu As New SnmpPdu
    'Specify the Pdu type
    pdu.PduType = EnumPduType.GetNextPdu
    'Set the community string
    pdu.Community = "public"
    pdu.Version =  SnmpVersion.Version2

    'creat response pdu
    Dim response As SnmpPdu = Nothing

    'Assign the walked oid.
    Dim oid As String = "1.3.6.1.2.1.1"
    Dim conoid As String = oid

     'loop for each PDU in the walk
    Do While oid.StartsWith(conoid)
        pdu.InnerVariables.Clear()
        Dim variable1 As SnmpVariable = SnmpVariable.CreateSnmpVariable(oid)
        pdu.AddRequestVariables(variable1)
        Try
            response = s1.SyncRequest("127.0.0.1", 161, pdu)
        Catch exception1  As	Exception
            Console.WriteLine(exception1.Message)
            oid = ""
            Exit Do
        End Try

        If (response.ErrorIndex <>  0) Then
            Console.WriteLine(("Response Error:" & response.ErrorStatus))
            Exit Do
        End If
        'Display result and assign new oid
        Dim i As Integer
        For i = 0 To response.InnerVariables.Count - 1
            oid = response.InnerVariables.Item(i).OID
            Console.WriteLine(("Response oid: " & response.InnerVariables.Item(i).OID))
            Console.WriteLine(("Response value: " & response.InnerVariables.Item(i).Data.ToString))
            Console.WriteLine("")
        Next i
        response.InnerVariables.Clear()
    Loop

The syntax to use the included command line example.

Syntax: snmpwalk [Options] host oid

Options:

/version:v1|v2 or /v:v1|v2 Specify the version number.
/port:portnumber or /p:portnumber Specify the port number.
/timeout:ms or /t:ms Time out in milliseconds.
/debug or /d Turn on the debug setting.
/community:community or /c:community Set community.
/? or /help Display this usage message.

Example: snmpwalk /d /c:public /p:161 127.0.0.1 1.3.6.1.2.1.1


Examples

SnmpSource Component

Examples - snmptrapreceiver

Use SnmpSource component to receive trap.

To use this code sample, add a reference to the following assemblies:
SnmpSource.dll

Then import the following namespaces at the top of your code file with using (for C#) or Imports (for VB) keywords:
SnmpSource

The syntax to use the included command line example.

Syntax: snmptrapreceiver


Examples

SnmpSource Component

Examples - trapv1generator

Use SnmpSource component to Generate V1 Trap.

To use this code sample, add a reference to the following assemblies:
SnmpSource.dll

Then import the following namespaces at the top of your code file with using (for C#) or Imports (for VB) keywords:
SnmpSource
System.Net.sockets
System.Net

[C#]
    //create snmp pdu
    SnmpPdu pdu = new SnmpPdu();
    //Specify the Pdu type
    pdu.PduType = EnumPduType.TrapV1Pdu;
    //Set the community string
    pdu.Community = "public";
    pdu.Version =  SnmpVersion.Version1;

    //Trap sample value
    pdu.V1Enterprise = "1.3.6.1.4.1.12345.1";
    pdu.V1remoteipaddress = "127.0.0.1";
    pdu.V1GenericTrap = SnmpV1TrapType.coldStart;

    SnmpVariable var = SnmpVariable.CreateSnmpVariable("1.3.6.1.4.1.12345.1.1", 123, SnmpVarType.INT);
    pdu.AddRequestVariables(var);

    //send the trap
    byte[] trapdata = pdu.Encoding();

    UdpClient client = new UdpClient("127.0.0.1", 162);
    client.Send(trapdata,trapdata.Length);
    client.Close();

[Vb]
    'create snmp pdu
    Dim pdu As New SnmpPdu
    'Specify the Pdu type
    pdu.PduType = EnumPduType.TrapV1Pdu
    'Set the community string
    pdu.Community = "public"
    pdu.Version =  SnmpVersion.Version1

    'Trap sample value
    pdu.V1Enterprise = "1.3.6.1.4.1.12345.1"
    pdu.V1remoteipaddress = "127.0.0.1"
    pdu.V1GenericTrap = SnmpV1TrapType.coldStart

    Dim var As SnmpVariable = SnmpVariable.CreateSnmpVariable("1.3.6.1.4.1.12345.1.1", 123, SnmpVarType.INT)
    pdu.AddRequestVariables(var)

    'send the trap
    Dim buffer1 As Byte() = pdu.Encoding()
    Dim client As New UdpClient("127.0.0.1", 162)
    client.Send(buffer1,buffer1.Length)
    client.Close()

The syntax to use the included command line example.

Syntax: trapv1generator [Options] host enterprise agentip generictrap specifictrap timeticks [OID type value] ...

Options:

/port:portnumber or /p:portnumber Specify the port number.
/community:community or /c:community Set community.
/? or /help Display this usage message.

Example: trapv1generator /p:162 /c:public 127.0.0.1 1.3.6.1.4.1.12345.1 192.168.0.1 0 1234 0 1.3.6.1.4.1.12345.1.1 2 123


Examples

SnmpSource Component

Examples - snmpget

Use SnmpSource component to make a simple snmp v3 query.

To use this code sample, add a reference to the following assemblies:
SnmpSource.dll

Then import the following namespaces at the top of your code file with using (for C#) or Imports (for VB) keywords:
SnmpSource

[C#]

//discover snmp engine
    try
    {

// Add snmp variable
        SnmpPdu discover = SnmpPdu.V3Discover("127.0.0.1", 161, "iniuser", 1000);

    }
    catch (Exception	ex)
    {
        System.Console.Error.WriteLine("Discover PDU: " + ex.Message);
        System.Environment.Exit(1);
    }

    //create snmp session
    SnmpSession s1 = new SnmpSession();

    //create snmp v3 pdu
    SnmpPdu pdu = new SnmpPdu();
    //Specify the Pdu type
    pdu.PduType = EnumPduType.GetPdu;
    //Set the snmp v3 setting
    pdu.Version =  SnmpVersion.Version3;

     version3.V3UserName = "Admin";
         version3.V3AuthenticationEncryptionFlags = SnmpV3AuthenticationEncryptionFlags.NoAuthNoEncr;
         version3.V3AuthoritativeEngineBoots = discovery.V3AuthoritativeEngineBoots;
         version3.V3AuthoritativeEngineID = discovery.V3AuthoritativeEngineID;
         version3.V3AuthoritativeEngineTime = discovery.V3AuthoritativeEngineTime;
         version3.V3ContextEngineID = discovery.V3AuthoritativeEngineID;
         version3.V3ContextName = "context";
         version3.V3MessageID = new Random().Next(0, 0x7fffffff);

    //creat response pdu
    SnmpPdu response = null;

    // Try to retrieve snmp record
    try
    {
        // Add snmp variable
        SnmpVariable var = SnmpVariable.CreateSnmpVariable("1.3.6.1.2.1.1.5.0");
        pdu.AddRequestVariables(var);
        // Synchronized request snmp SyncRequest(hostip, port, pdu)
        response = s1.SyncRequest("127.0.0.1", 161, pdu);
    }
    catch (Exception	ex)
    {
        System.Console.Error.WriteLine("Sending PDU: " + ex.Message);
        System.Environment.Exit(1);
    }

    // Display the result
    try
    {
        if(response.ErrorStatus == 0)
        {
            System.Console.WriteLine("Response oid: "  + response.InnerVariables[0].OID);
            System.Console.WriteLine("Response value: "  + response.InnerVariables[0].Data.ToString());
            System.Console.WriteLine("");
        }
        else
        {
        System.Console.WriteLine("Response error code: "  + response.ErrorStatus);
        }

    }
    catch (Exception	ex)
    {
        System.Console.WriteLine("Error in output: " + ex.Message);
    }

Please refer to the SnmpV3Get example with the download.


SnmpSource References

SnmpSource Help

SnmpSource Namespace

Namespace hierarchy

Classes

Class | Description
SnmpPdu | The Pdu will be sent out inside each snmp session. Different Pdu property should be assigned according to pdu type which is defined in EnumPduType.
SnmpSession | SnmpSession sends snmp request synchronizely or asynchronizely.
SnmpVariable | SnmpVariable class create Snmp variable to be used in PDU.
Trap | The trap class is for receiving trap only.

Delegates

Delegate | Description
AsyncProcesses | The asynchronized event will be raised for when a asyncronized snmp request returns value.

Enumerations

Enumeration | Description
EnumPduType | The enum defines the acceptable Pdu type.
SnmpErrorStatus | The enum defines the acceptable snmp error status.
SnmpV1TrapType | The enum defines the acceptable snmp version 1 trap type.
SnmpVarType | The enum defines the acceptable snmp variable type.
SnmpV3EncryptionMethods | The enum defines the encryption methods for Version 3, DES and AES.
SnmpV3AuthenticationMethods | The enum defines the authentication methods for Version 3, MD5 and SHA.
SnmpV3AuthenticationEncryptionFlags | The enum defines the snmp version 3's message flags
SnmpVersion | The enum defines the acceptable Snmp version. Only version 1, version 2c and version 3 are support in this release.


SnmpSource

SnmpSource Help

SnmpSource Namespace

Namespace hierarchy

Classes

Class | Description
SnmpPdu | The Pdu will be sent out inside each snmp session. Different Pdu property should be assigned according to pdu type which is defined in EnumPduType.
SnmpSession | SnmpSession sends snmp request synchronizely or asynchronizely.
SnmpVariable | SnmpVariable class create Snmp variable to be used in PDU.
Trap | The trap class is for receiving trap only.

Delegates

Delegate | Description
AsyncProcesses | The asynchronized event will be raised for when a asyncronized snmp request returns value.

Enumerations

Enumeration | Description
EnumPduType | The enum defines the acceptable Pdu type.
SnmpErrorStatus | The enum defines the acceptable snmp error status.
SnmpV1TrapType | The enum defines the acceptable snmp version 1 trap type.
SnmpVarType | The enum defines the acceptable snmp variable type.
SnmpVersion | The enum defines the acceptable Snmp version. Only version 1, 2c and 3 are support in this release.
SnmpV3EncryptionMethods | The enum defines the encryption methods for Version 3, DES and AES.
SnmpV3AuthenticationMethods | The enum defines the authentication methods for Version 3, MD5 and SHA.
SnmpV3AuthenticationEncryptionFlags | The enum defines the snmp version 3's message flags


SnmpPdu Class

The Pdu will be sent out inside each snmp session. Different Pdu property should be assigned according to pdu type which is defined in EnumPduType.

For a list of all members of this type, see SnmpPdu Members.

System.Object
SnmpSource.SnmpPdu

public class SnmpPdu

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

If the pdu type is GetPdu, GetNextPdu, InformPdu, ResponsePdu, ReportPdu, TrapV2Pdu or SetPdu, Community (Default Public), Version (Default Version1) RequestID (Default 1), ErrorStatus(Default 0), ErrorIndex (Default SnmpErrorStatus.noError) and the proper SnmpVariable should be added. If the pdu type is GetBulkPdu, two additional properties, BulkMaxRepetitions and BulkNonRepeaters should be assigned. If the pdu is TrapV1Pdu, V1remoteipaddress, V1Enterprise, V1GenericTrap, V1SpecificTrap, V1TimeStamp could be assighed.

Requirements

Namespace: SnmpSource

Assembly: SnmpSource (in SnmpSource.dll)

See Also

SnmpPdu Members | SnmpSource Namespace


SnmpPdu Members

SnmpPdu overview

Public Instance Constructors

SnmpPdu Constructor Constructor of SnmpPdu

Public Instance Properties

BulkMaxRepetitions | Only available for GetBulkPdu pdu type. This type is only available for version 2 snmp.
BulkNonRepeaters | Only available for GetBulkPdu pdu type. This type is only available for version 2 snmp.
Community | Community property get and set the community string. The default community is "public".
ErrorIndex | This property return and set current error index.
ErrorStatus | This property return and set current error status.
InnerVariables | The SnmpVariable collection for PDU.
PduType | Get and Set the Pdu Type of this SnmpPdu.
RequestID | This property return and set current Request ID. The default Request ID is 1.
V1Enterprise | Only available for TrapV1Pdu pdu type. This type is only available for version 1 snmp.
V1GenericTrap | Only available for TrapV1Pdu pdu type. This type is only available for version 1 snmp.
V1remoteipaddress | Only available for TrapV1Pdu pdu type. This type is only available for version 1 snmp.
V1SpecificTrap | Only available for TrapV1Pdu pdu type. This type is only available for version 1 snmp.
V1TimeStamp | Only available for TrapV1Pdu pdu type. This type is only available for version 1 snmp.
Version | This property get and set current snmp request's version.
V3AuthenticationMethod | Define the authentication method for SNMP V3
V3EncryptionMethod | Define the encryption method for SNMP V3
V3AuthoritativeEngineBoots | Define the Authoritative Engine Boots count for SNMP V3
V3AuthoritativeEngineID | Define the byte array Authoritative Engine ID for SNMP V3
V3AuthoritativeEngineTime | Define the Authoritative Engine Time for SNMP V3
V3ContextEngineID | Define the Context Engine ID for SNMP V3
V3ContextName | Define the Context Name for SNMP V3
V3MaxMessageSize | Define the Maximum Message Size for SNMP V3
V3MessageID | Define the Message ID for SNMP V3
V3AuthenticationEncryptionFlags | Define the Authentication and Privacy flag for SNMP V3
V3UserName | Define the User Name for SNMP V3
V3AuthenticationPassword | Define the Authentication Password for SNMP V3
V3EncryptionPassword | Define the Encryption Password

Public Instance Methods

AddRequestVariables | Add a SnmpVariable to a SnmpPdu.
Decoding | The Decoding method of snmp packets.
Encoding | The encoding method of SnmpPDU.
Equals (inherited from Object) | Determines whether the specified Object is equal to the current Object.
GetHashCode (inherited from Object) | Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.
GetType (inherited from Object) | Gets the Type of the current instance.
ToString (inherited from Object) | Returns a String that represents the current Object.

Protected Instance Methods

Finalize (inherited from Object) | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
MemberwiseClone (inherited from Object) | Creates a shallow copy of the current Object.

See Also

SnmpPdu Class | SnmpSource Namespace


SnmpPdu Constructor

Constructor of SnmpPdu

public SnmpPdu();

See Also

SnmpPdu Class | SnmpSource Namespace


SnmpPdu Properties

The properties of the SnmpPdu class are listed below. For a complete list of SnmpPdu class members, see the SnmpPdu Members topic.

Public Instance Properties

BulkMaxRepetitions | Only available for GetBulkPdu pdu type. This type is only available for version 2 snmp.
BulkNonRepeaters | Only available for GetBulkPdu pdu type. This type is only available for version 2 snmp.
Community | Community property get and set the community string. The default community is "public".
ErrorIndex | This property return and set current error index.
ErrorStatus | This property return and set current error status.
InnerVariables | The SnmpVariable collection for PDU.
PduType | Get and Set the Pdu Type of this SnmpPdu.
RequestID | This property return and set current Request ID. The default Request ID is 1.
V1Enterprise | Only available for TrapV1Pdu pdu type. This type is only available for version 1 snmp.
V1GenericTrap | Only available for TrapV1Pdu pdu type. This type is only available for version 1 snmp.
V1remoteipaddress | Only available for TrapV1Pdu pdu type. This type is only available for version 1 snmp.
V1SpecificTrap | Only available for TrapV1Pdu pdu type. This type is only available for version 1 snmp.
V1TimeStamp | Only available for TrapV1Pdu pdu type. This type is only available for version 1 snmp.
Version | This property get and set current snmp request's version.
V3AuthenticationMethod | Define the authentication method for SNMP V3
V3EncryptionMethod | Define the encryption method for SNMP V3
V3AuthoritativeEngineBoots | Define the Authoritative Engine Boots count for SNMP V3
V3AuthoritativeEngineID | Define the byte array Authoritative Engine ID for SNMP V3
V3AuthoritativeEngineTime | Define the Authoritative Engine Time for SNMP V3
V3ContextEngineID | Define the Context Engine ID for SNMP V3
V3ContextName | Define the Context Name for SNMP V3
V3MaxMessageSize | Define the Maximum Message Size for SNMP V3
V3MessageID | Define the Message ID for SNMP V3
V3AuthenticationEncryptionFlags | Define the Authentication and Privacy flag for SNMP V3
V3UserName | Define the User Name for SNMP V3
V3AuthenticationPassword | Define the Authentication Password for SNMP V3
V3EncryptionPassword | Define the Encryption Password

See Also

SnmpPdu Class | SnmpSource Namespace


BulkMaxRepetitions Property

SnmpSource Help

SnmpPdu.BulkMaxRepetitions Property

Only available for GetBulkPdu pdu type. This type is only available for version 2 snmp.

public int BulkMaxRepetitions {get; set;}

See Also

SnmpPdu Class | SnmpSource Namespace


BulkNonRepeaters Property

SnmpSource Help

SnmpPdu.BulkNonRepeaters Property

Only available for GetBulkPdu pdu type. This type is only available for version 2 snmp.

public int BulkNonRepeaters {get; set;}

See Also

SnmpPdu Class | SnmpSource Namespace


Community Property

SnmpSource Help

SnmpPdu.Community Property

Community property get and set the community string. The default community is "public".

public string Community {get; set;}

See Also

SnmpPdu Class | SnmpSource Namespace


ErrorIndex Property

SnmpSource Help

SnmpPdu.ErrorIndex Property

This property return and set current error index.

public int ErrorIndex {get; set;}

See Also

SnmpPdu Class | SnmpSource Namespace


ErrorStatus Property

SnmpSource Help

SnmpPdu.ErrorStatus Property

This property return and set current error status.

public SnmpErrorStatus ErrorStatus {get; set;}

See Also

SnmpPdu Class | SnmpSource Namespace


InnerVariables Property

SnmpSource Help

SnmpPdu.InnerVariables Property

The SnmpVariable collection for PDU.

public SnmpVarCollection InnerVariables {get;}

See Also

SnmpPdu Class | SnmpSource Namespace


PduType Property

SnmpSource Help

SnmpPdu.PduType Property

Get and Set the Pdu Type of this SnmpPdu.

public EnumPduType PduType {get; set;}

Property Value

You must set this property in order to use Snmp query.

See Also

SnmpPdu Class | SnmpSource Namespace


RequestID Property

SnmpSource Help

SnmpPdu.RequestID Property

This property return and set current Request ID. The default Request ID is 1.

public int RequestID {get; set;}

See Also

SnmpPdu Class | SnmpSource Namespace


V1Enterprise Property

SnmpSource Help

SnmpPdu.V1Enterprise Property

Only available for TrapV1Pdu pdu type. This type is only available for version 1 snmp.

public string V1Enterprise {get; set;}

See Also

SnmpPdu Class | SnmpSource Namespace


V1GenericTrap Property

SnmpSource Help

SnmpPdu.V1GenericTrap Property

Only available for TrapV1Pdu pdu type. This type is only available for version 1 snmp.

public SnmpV1TrapType V1GenericTrap {get; set;}

See Also

SnmpPdu Class | SnmpSource Namespace


V1remoteipaddress Property

SnmpSource Help

SnmpPdu.V1remoteipaddress Property

Only available for TrapV1Pdu pdu type. This type is only available for version 1 snmp.

public string V1remoteipaddress {get; set;}

See Also

SnmpPdu Class | SnmpSource Namespace


V1SpecificTrap Property

SnmpSource Help

SnmpPdu.V1SpecificTrap Property

Only available for TrapV1Pdu pdu type. This type is only available for version 1 snmp.

public int V1SpecificTrap {get; set;}

See Also

SnmpPdu Class | SnmpSource Namespace


V1TimeStamp Property

SnmpSource Help

SnmpPdu.V1TimeStamp Property

Only available for TrapV1Pdu pdu type. This type is only available for version 1 snmp.

public uint V1TimeStamp {get; set;}

See Also

SnmpPdu Class | SnmpSource Namespace


Version Property

SnmpSource Help

SnmpPdu.Version Property

This property get and set current snmp request's version.

public SnmpVersion Version {get; set;}

See Also

SnmpPdu Class | SnmpSource Namespace


V1Enterprise Property

SnmpSource Help

SnmpPdu.V1Enterprise Property

This type is only available for version 3 snmp.

public SnmpV3AuthenticationMethods V3AuthenticationMethod {get; set;}

See Also

SnmpPdu Class | SnmpSource Namespace


V3EncryptionMethod Property

SnmpSource Help

SnmpPdu.V3EncryptionMethod Property

This type is only available for version 3 snmp.

public SnmpV3EncryptionMethods V3EncryptionMethod {get; set;}

See Also

SnmpPdu Class | SnmpSource Namespace


V3AuthoritativeEngineBoots Property

SnmpSource Help

SnmpPdu.V3AuthoritativeEngineBoots Property

This type is only available for version 3 snmp.

public int V3AuthoritativeEngineBoots {get; set;}

See Also

SnmpPdu Class | SnmpSource Namespace


V3AuthoritativeEngineID Property

SnmpSource Help

SnmpPdu.V3AuthoritativeEngineID Property

This type is only available for version 3 snmp.

public byte[] V3AuthoritativeEngineID {get; set;}

See Also

SnmpPdu Class | SnmpSource Namespace


V3AuthoritativeEngineTime Property

SnmpSource Help

SnmpPdu.V3AuthoritativeEngineTime Property

This type is only available for version 3 snmp.

public int V3AuthoritativeEngineTime {get; set;}

See Also

SnmpPdu Class | SnmpSource Namespace


V3ContextEngineID Property

SnmpSource Help

SnmpPdu.V3ContextEngineID Property

This type is only available for version 3 snmp.

public btye[] V3ContextEngineID {get; set;}

See Also

SnmpPdu Class | SnmpSource Namespace


V3ContextName Property

SnmpSource Help

SnmpPdu.V3ContextName Property

This type is only available for version 3 snmp.

public string V3ContextName {get; set;}

See Also

SnmpPdu Class | SnmpSource Namespace


V3MaxMessageSize Property

SnmpSource Help

SnmpPdu.V3MaxMessageSize Property

This type is only available for version 3 snmp.

public int V3MaxMessageSize {get; set;}

See Also

SnmpPdu Class | SnmpSource Namespace


V3MessageID Property

SnmpSource Help

SnmpPdu.V3MessageID Property

This type is only available for version 3 snmp.

public int V3MessageID {get; set;}

See Also

SnmpPdu Class | SnmpSource Namespace


V3AuthenticationEncryptionFlags Property

SnmpSource Help

SnmpPdu.V3AuthenticationEncryptionFlags Property

This type is only available for version 3 snmp.

public SnmpV3AuthenticationEncryptionFlags V3AuthenticationEncryptionFlags {get; set;}

See Also

SnmpPdu Class | SnmpSource Namespace


V3UserName Property

SnmpSource Help

SnmpPdu.V3UserName Property

This type is only available for version 3 snmp.

public string V3UserName {get; set;}

See Also

SnmpPdu Class | SnmpSource Namespace


V3AuthenticationPassword Property

SnmpSource Help

SnmpPdu.V3AuthenticationPassword Property

This type is only available for version 3 snmp.

public string V3AuthenticationPassword {get; set;}

See Also

SnmpPdu Class | SnmpSource Namespace


V3EncryptionPassword Property

SnmpSource Help

SnmpPdu.V3EncryptionPassword Property

This type is only available for version 3 snmp.

public string V3EncryptionPassword {get; set;}

See Also

SnmpPdu Class | SnmpSource Namespace


SnmpPdu Methods

The methods of the SnmpPdu class are listed below. For a complete list of SnmpPdu class members, see the SnmpPdu Members topic.

Public Instance Methods

AddRequestVariables | Add a SnmpVariable to a SnmpPdu.
Decoding | The Decoding method of snmp packets.
Encoding | The encoding method of SnmpPDU.
Equals (inherited from Object) | Determines whether the specified Object is equal to the current Object.
GetHashCode (inherited from Object) | Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.
GetType (inherited from Object) | Gets the Type of the current instance.
ToString (inherited from Object) | Returns a String that represents the current Object.

Protected Instance Methods

Finalize (inherited from Object) | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
MemberwiseClone (inherited from Object) | Creates a shallow copy of the current Object.

See Also

SnmpPdu Class | SnmpSource Namespace


SnmpPdu.AddRequestVariables Method

Add a SnmpVariable to a SnmpPdu.

public void AddRequestVariables(
SnmpVariable var
);

Parameters

var

See Also

SnmpPdu Class | SnmpSource Namespace


SnmpPdu.Decoding Method

The Decoding method of snmp packets.

public void Decoding(
byte[] g
);

Parameters

g

See Also

SnmpPdu Class | SnmpSource Namespace


SnmpPdu.Encoding Method

The encoding method of SnmpPDU.

public byte[] Encoding();

Return Value

See Also

SnmpPdu Class | SnmpSource Namespace


SnmpSession Class

SnmpSession sends snmp request synchronizely or asynchronizely.

For a list of all members of this type, see SnmpSession Members.

System.Object
SnmpSource.SnmpSession

public class SnmpSession

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Example

//create snmp session
SnmpSession s1 = new SnmpSession();
//create snmp pdu
SnmpPdu pdu = new SnmpPdu();
//Specify the Pdu type
pdu.PduType = EnumPduType.GetPdu;
//Set the community string
pdu.Community = "public";
pdu.Version =  SnmpVersion.Version1;

//creat response pdu
SnmpPdu response = null;

// Try to retrieve snmp record
try
{
    // Add snmp variable
    SnmpVariable var = SnmpVariable.CreateSnmpVariable("1.3.6.1.2.1.1.5.0");
    pdu.AddRequestVariables(var);
    // Synchronized request snmp SyncRequest(hostip, port, pdu)
    response = s1.SyncRequest("127.0.0.1", 161, pdu);
}
catch (Exception    ex)
{
    System.Console.Error.WriteLine("Sending PDU: " + ex.Message);
    System.Environment.Exit(1);
}

// Display the result
try
{
    if(response.ErrorStatus == 0)
    {
        System.Console.WriteLine("Response oid: "  + response.InnerVariables[0].OID);
        System.Console.WriteLine("Response value: "  + response.InnerVariables[0].Data.ToString());
        System.Console.WriteLine("");
    }
    else
    {
    System.Console.WriteLine("Response error code: "  + response.ErrorStatus);
    }

}
catch (Exception    ex)
{
    System.Console.WriteLine("Error in output: " + ex.Message);
}

Requirements

Namespace: SnmpSource

Assembly: SnmpSource (in SnmpSource.dll)

See Also

SnmpSession Members | SnmpSource Namespace


SnmpSession Members

SnmpSession overview

Public Instance Constructors

SnmpSession Constructor Constructor for SnmpSession.

Public Instance Properties

AsyncPendingCount | The AsyncPendingCount returns the current pending async request count.
IsLogging | Enable/Disable logging.
LogFileName | The log file name. The default name is "debug.log"
Timeout | The Timeout property of the snmp request. The default time out is 5000 ms.

Public Instance Methods

AsyncRequest | Overloaded. Asynchronize snmp request. The default port is 161.
Equals (inherited from Object) | Determines whether the specified Object is equal to the current Object.
GetHashCode (inherited from Object) | Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.
GetType (inherited from Object) | Gets the Type of the current instance.
SyncRequest | Overloaded. Synchronize snmp request. The default port is 161.
ToString (inherited from Object) | Returns a String that represents the current Object.

Public Instance Events

Processes

Protected Instance Methods

Finalize (inherited from Object) | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
MemberwiseClone (inherited from Object) | Creates a shallow copy of the current Object.

See Also

SnmpSession Class | SnmpSource Namespace


SnmpSession Constructor

Constructor for SnmpSession.

public SnmpSession();

See Also

SnmpSession Class | SnmpSource Namespace


SnmpSession Properties

The properties of the SnmpSession class are listed below. For a complete list of SnmpSession class members, see the SnmpSession Members topic.

Public Instance Properties

AsyncPendingCount | The AsyncPendingCount returns the current pending async request count.
IsLogging | Enable/Disable logging.
LogFileName | The log file name. The default name is "debug.log"
Timeout | The Timeout property of the snmp request. The default time out is 5000 ms.

See Also

SnmpSession Class | SnmpSource Namespace


AsyncPendingCount Property

SnmpSource Help

SnmpSession.AsyncPendingCount Property

The AsyncPendingCount returns the current pending async request count.

public int AsyncPendingCount {get;}

See Also

SnmpSession Class | SnmpSource Namespace


IsLogging Property

SnmpSource Help

SnmpSession.IsLogging Property

Enable/Disable logging.

public bool IsLogging {get; set;}

See Also

SnmpSession Class | SnmpSource Namespace


LogFileName Property

SnmpSource Help

SnmpSession.LogFileName Property

The log file name. The default name is "debug.log"

public string LogFileName {get; set;}

See Also

SnmpSession Class | SnmpSource Namespace


Timeout Property

SnmpSource Help

SnmpSession.Timeout Property

The Timeout property of the snmp request. The default time out is 5000 ms.

public int Timeout {get; set;}

See Also

SnmpSession Class | SnmpSource Namespace


SnmpSession Methods

The methods of the SnmpSession class are listed below. For a complete list of SnmpSession class members, see the SnmpSession Members topic.

Public Instance Methods

AsyncRequest | Overloaded. Asynchronize snmp request. The default port is 161.
Equals (inherited from Object) | Determines whether the specified Object is equal to the current Object.
GetHashCode (inherited from Object) | Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.
GetType (inherited from Object) | Gets the Type of the current instance.
SyncRequest | Overloaded. Synchronize snmp request. The default port is 161.
ToString (inherited from Object) | Returns a String that represents the current Object.

Protected Instance Methods

Finalize (inherited from Object) | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
MemberwiseClone (inherited from Object) | Creates a shallow copy of the current Object.

See Also

SnmpSession Class | SnmpSource Namespace


AsyncRequest Method

SnmpSource Help

SnmpSession.AsyncRequest Method

Asynchronize snmp request. The default port is 161.

Overload List

Asynchronize snmp request. The default port is 161.

public void AsyncRequest(string,SnmpPdu);

Asynchronize snmp request.

public void AsyncRequest(string,int,SnmpPdu);

See Also

SnmpSession Class | SnmpSource Namespace


SnmpSession.AsyncRequest Method (String, SnmpPdu)

Asynchronize snmp request. The default port is 161.

public void AsyncRequest(
string remoteipaddress,
SnmpPdu r1
);

Parameters

remoteipaddress
The remote ip address of the snmp request will be sent to.
r1
SnmpPdu

See Also

SnmpSession Class | SnmpSource Namespace | SnmpSession.AsyncRequest Overload List


SnmpSession.AsyncRequest Method (String, Int32, SnmpPdu)

Asynchronize snmp request.

public void AsyncRequest(
string remoteipaddress,
int remoteport,
SnmpPdu r1
);

Parameters

remoteipaddress
The remote ip address of the snmp request will be sent to.
remoteport
The remote port of this snmp request will be sent to.
r1
SnmpPdu

See Also

SnmpSession Class | SnmpSource Namespace | SnmpSession.AsyncRequest Overload List


SyncRequest Method

SnmpSource Help

SnmpSession.SyncRequest Method

Synchronize snmp request. The default port is 161.

Overload List

Synchronize snmp request. The default port is 161.

public SnmpPdu SyncRequest(string,SnmpPdu);

Synchronize snmp request.

public SnmpPdu SyncRequest(string,int,SnmpPdu);

See Also

SnmpSession Class | SnmpSource Namespace


SnmpSession.SyncRequest Method (String, SnmpPdu)

Synchronize snmp request. The default port is 161.

public SnmpPdu SyncRequest(
string remoteipaddress,
SnmpPdu r1
);

Parameters

remoteipaddress
The remote ip address of the snmp request should send to.
r1
SnmpPdu

Return Value

The received SnmpPdu

See Also

SnmpSession Class | SnmpSource Namespace | SnmpSession.SyncRequest Overload List


SnmpSession.SyncRequest Method (String, Int32, SnmpPdu)

Synchronize snmp request.

public SnmpPdu SyncRequest(
string remoteipaddress,
int remoteport,
SnmpPdu r1
);

Parameters

remoteipaddress
The remote ip address of the snmp request will be sent to.
remoteport
The remote port of this snmp request will be sent to.
r1
SnmpPdu

Return Value

The received SnmpPdu

See Also

SnmpSession Class | SnmpSource Namespace | SnmpSession.SyncRequest Overload List


SnmpSession Events

The events of the SnmpSession class are listed below. For a complete list of SnmpSession class members, see the SnmpSession Members topic.

Public Instance Events

Processes

See Also

SnmpSession Class | SnmpSource Namespace


SnmpSession.Processes Event

public event AsyncProcesses Processes;

See Also

SnmpSession Class | SnmpSource Namespace


SnmpVariable Class

SnmpVariable class create Snmp variable to be used in PDU.

For a list of all members of this type, see SnmpVariable Members.

System.Object
SnmpSource.SnmpVariable

public class SnmpVariable

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Requirements

Namespace: SnmpSource

Assembly: SnmpSource (in SnmpSource.dll)

See Also

SnmpVariable Members | SnmpSource Namespace


SnmpVariable Members

SnmpVariable overview

Public Static Methods

CreateSnmpVariable Overloaded. This static method create SnmpVariable when a single Object Identifier is available.

Public Instance Constructors

SnmpVariable Constructor Constructor of SnmpVariable

Public Instance Properties

BinData | The BinData is not null only when the SnmpVarType is OCTET STRING(4).
Data | The snmp variable value. The real data type of Data depends on the Type property.
OID | The Object Identifier for this snmp variable. A snmp variable must have one OID.
Type | The type of the snmp variable. The type is defined in SnmpVarType.

Public Instance Methods

Equals (inherited from Object) | Determines whether the specified Object is equal to the current Object.
GetHashCode (inherited from Object) | Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.
GetType (inherited from Object) | Gets the Type of the current instance.
ToString (inherited from Object) | Returns a String that represents the current Object.

Protected Instance Methods

Finalize (inherited from Object) | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
MemberwiseClone (inherited from Object) | Creates a shallow copy of the current Object.

See Also

SnmpVariable Class | SnmpSource Namespace


SnmpVariable Constructor

Constructor of SnmpVariable

public SnmpVariable();

See Also

SnmpVariable Class | SnmpSource Namespace


SnmpVariable Properties

The properties of the SnmpVariable class are listed below. For a complete list of SnmpVariable class members, see the SnmpVariable Members topic.

Public Instance Properties

BinData | The BinData is not null only when the SnmpVarType is OCTET STRING(4).
Data | The snmp variable value. The real data type of Data depends on the Type property.
OID | The Object Identifier for this snmp variable. A snmp variable must have one OID.
Type | The type of the snmp variable. The type is defined in SnmpVarType.

See Also

SnmpVariable Class | SnmpSource Namespace


BinData Property

SnmpSource Help

SnmpVariable.BinData Property

The BinData is not null only when the SnmpVarType is OCTET STRING(4).

public byte[] BinData {get;}

See Also

SnmpVariable Class | SnmpSource Namespace


Data Property

SnmpSource Help

SnmpVariable.Data Property

The snmp variable value. The real data type of Data depends on the Type property.

public object Data {get; set;}

See Also

SnmpVariable Class | SnmpSource Namespace


OID Property

SnmpSource Help

SnmpVariable.OID Property

The Object Identifier for this snmp variable. A snmp variable must have one OID.

public string OID {get; set;}

See Also

SnmpVariable Class | SnmpSource Namespace


Type Property

SnmpSource Help

SnmpVariable.Type Property

The type of the snmp variable. The type is defined in SnmpVarType.

public int Type {get; set;}

See Also

SnmpVariable Class | SnmpSource Namespace


SnmpVariable Methods

The methods of the SnmpVariable class are listed below. For a complete list of SnmpVariable class members, see the SnmpVariable Members topic.

Public Static Methods

CreateSnmpVariable Overloaded. This static method create SnmpVariable when a single Object Identifier is available.

Public Instance Methods

Equals (inherited from Object) | Determines whether the specified Object is equal to the current Object.
GetHashCode (inherited from Object) | Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.
GetType (inherited from Object) | Gets the Type of the current instance.
ToString (inherited from Object) | Returns a String that represents the current Object.

Protected Instance Methods

Finalize (inherited from Object) | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
MemberwiseClone (inherited from Object) | Creates a shallow copy of the current Object.

See Also

SnmpVariable Class | SnmpSource Namespace


CreateSnmpVariable Method

SnmpSource Help

SnmpVariable.CreateSnmpVariable Method

This static method create SnmpVariable when a single Object Identifier is available.

Overload List

This static method create SnmpVariable when a single Object Identifier is available.

public static SnmpVariable CreateSnmpVariable(string);

This static method create a SnmpVariable with a value and type associated with an Object Identifier.

public static SnmpVariable CreateSnmpVariable(string,object,SnmpVarType);

See Also

SnmpVariable Class | SnmpSource Namespace


SnmpVariable.CreateSnmpVariable Method (String)

This static method create SnmpVariable when a single Object Identifier is available.

public static SnmpVariable CreateSnmpVariable(
string objectidentifier
);

Parameters

objectidentifier
The objectidentifier to be created for this variable.

Return Value

See Also

SnmpVariable Class | SnmpSource Namespace | SnmpVariable.CreateSnmpVariable Overload List


SnmpVariable.CreateSnmpVariable Method (String, Object, SnmpVarType)

This static method create a SnmpVariable with a value and type associated with an Object Identifier.

public static SnmpVariable CreateSnmpVariable(
string objectidentifier,
object val,
SnmpVarType type
);

Parameters

objectidentifier
The objectidentifier to be created for this variable.
val
The value to be created for this variable. The real type of val should match the type parameter.
type
The type of the variable. See SnmpVarType

Return Value

See Also

SnmpVariable Class | SnmpSource Namespace | SnmpVariable.CreateSnmpVariable Overload List


Trap Class

The trap class is for receiving trap only.

For a list of all members of this type, see Trap Members.

System.Object
SnmpSource.Trap

public class Trap

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Requirements

Namespace: SnmpSource

Assembly: SnmpSource (in SnmpSource.dll)

See Also

Trap Members | SnmpSource Namespace


Trap Members

Trap overview

Public Instance Constructors

Trap Constructor Constructor of Trap class. The default trap listening port is 162. If the computer running this trap receive has firewall installed. You should unblock port 162 to receive trap.

Public Instance Properties

IsLogging | Enable/Disable logging.
LogFileName | The log file name. The default name is "debug.log"
TrapListenPort | The trap listen port. Default 162.

Public Instance Methods

Disable | Disable the trap listening.
Enable | Enable the trap listening.
Equals (inherited from Object) | Determines whether the specified Object is equal to the current Object.
GetHashCode (inherited from Object) | Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.
GetType (inherited from Object) | Gets the Type of the current instance.
ToString (inherited from Object) | Returns a String that represents the current Object.

Public Instance Events

TrapProcesses Customer code should handle the trap process.

Protected Instance Methods

Finalize (inherited from Object) | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
MemberwiseClone (inherited from Object) | Creates a shallow copy of the current Object.

See Also

Trap Class | SnmpSource Namespace


Trap Constructor

Constructor of Trap class. The default trap listening port is 162. If the computer running this trap receive has firewall installed. You should unblock port 162 to receive trap.

public Trap();

See Also

Trap Class | SnmpSource Namespace


Trap Properties

The properties of the Trap class are listed below. For a complete list of Trap class members, see the Trap Members topic.

Public Instance Properties

IsLogging | Enable/Disable logging.
LogFileName | The log file name. The default name is "debug.log"
TrapListenPort | The trap listen port. Default 162.

See Also

Trap Class | SnmpSource Namespace


IsLogging Property

SnmpSource Help

Trap.IsLogging Property

Enable/Disable logging.

public bool IsLogging {get; set;}

See Also

Trap Class | SnmpSource Namespace


LogFileName Property

SnmpSource Help

Trap.LogFileName Property

The log file name. The default name is "debug.log"

public string LogFileName {get; set;}

See Also

Trap Class | SnmpSource Namespace


TrapListenPort Property

SnmpSource Help

Trap.TrapListenPort Property

The trap listen port. Default 162.

public int TrapListenPort {get; set;}

See Also

Trap Class | SnmpSource Namespace


Trap Methods

The methods of the Trap class are listed below. For a complete list of Trap class members, see the Trap Members topic.

Public Instance Methods

Disable | Disable the trap listening.
Enable | Enable the trap listening.
Equals (inherited from Object) | Determines whether the specified Object is equal to the current Object.
GetHashCode (inherited from Object) | Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.
GetType (inherited from Object) | Gets the Type of the current instance.
ToString (inherited from Object) | Returns a String that represents the current Object.

Protected Instance Methods

Finalize (inherited from Object) | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
MemberwiseClone (inherited from Object) | Creates a shallow copy of the current Object.

See Also

Trap Class | SnmpSource Namespace


Trap.Disable Method

Disable the trap listening.

public void Disable();

See Also

Trap Class | SnmpSource Namespace


Trap.Enable Method

Enable the trap listening.

public void Enable();

See Also

Trap Class | SnmpSource Namespace


Trap Events

The events of the Trap class are listed below. For a complete list of Trap class members, see the Trap Members topic.

Public Instance Events

TrapProcesses Customer code should handle the trap process.

See Also

Trap Class | SnmpSource Namespace


Trap.TrapProcesses Event

Customer code should handle the trap process.

public event TrapProcess TrapProcesses;

See Also

Trap Class | SnmpSource Namespace


AsyncProcesses Delegate

The asynchronized event will be raised when an asynchronized snmp request returns value.

public delegate void AsyncProcesses(
SnmpErrorStatus ErrorCode,
SnmpPdu s,
EndPoint SendToRemoteAddress,
EndPoint RecvFromRemoteAddress
);

Requirements

Namespace: SnmpSource

Assembly: SnmpSource (in SnmpSource.dll)

See Also

SnmpSource Namespace


SnmpVersion Enumeration

The enum defines the acceptable Snmp version. Version 1, version 2c and version 3 are support in this release.

public enum SnmpVersion

Members

Member Name | Description
Version1 | Snmp Version 1 (0)
Version2 | Snmp Version 2 (1)
Version3 | Snmp Version 3 (3)

Requirements

Namespace: SnmpSource

Assembly: SnmpSource (in SnmpSource.dll)

See Also

SnmpSource Namespace


EnumPduType Enumeration

The enum defines the acceptable Pdu type.

public enum EnumPduType

Members

Member Name | Description
GetPdu | The GetPdu type (160).
GetNextPdu | The GetNextPdu type (161).
ResponsePdu | The ResponsePdu type (162).
SetPdu | The SetPdu type (163).
TrapV1Pdu | The TrapV1Pdu type (164).
GetBulkPdu | The GetBulkPdu type (165).
InformPdu | The InformPdu type (166).
TrapV2Pdu | The TrapV2Pdu type (167).
ReportPdu | The ReportPdu type (168).

Requirements

Namespace: SnmpSource

Assembly: SnmpSource (in SnmpSource.dll)

See Also

SnmpSource Namespace


SnmpErrorStatus Enumeration

The enum defines the acceptable snmp error status.

public enum SnmpErrorStatus

Members

Member Name | Description
noError | No error (0)
tooBig | Too big (1)
noSuchName | No such name (2)
badValue | Bad value (3)
readOnly | Read only (4)
genErr | Gen error (5)
noAccess | No access (6)
wrongType | Wrong type (7)
wrongLength | Wrong length (8)
wrongEncoding | Wrong encoding (9)
wrongValue | Wrong value (10)
noCreation | No creation (11)
inconsistentValue | Inconsistent value (12)
resourceUnavailable | Resource unavailable (13)
commitFailed | Commit failed (14)
undoFailed | Undo failed (15)
authorizationErr | Authorization err (16)
notWritable | Not writable (17)
inconsistentName | Inconsistent name (18)
socketErr | Socket err (19)
versionIncompatible | Version incompatible (20)

Requirements

Namespace: SnmpSource

Assembly: SnmpSource (in SnmpSource.dll)

See Also

SnmpSource Namespace


SnmpVarType Enumeration

The enum defines the acceptable snmp variable type.

public enum SnmpVarType

Members

Member Name | Description
Null | The Snmp variable type is NULL (5).
INT | The Snmp Variable type is Integer (2).
STRING | The Snmp Variable type is Octet String (4).
OID | The Snmp Variable type is Object Identifier (6).
IP | The Snmp Variable type is IP address (64).
COUNTER32 | The Snmp Variable type is 32 bit Counter (65).
GAUGE32 | The Snmp Variable type is 32 bit Gauge (66).
TIMERTICKS | The Snmp Variable type is Time Tick (67).
OPAQUE | The Snmp Variable type is Opaque (68).
COUNTER64 | The Snmp Variable type is 64 bit Counter (70).
UINT | The Snmp Variable type is Unsigned Integer (71).

Requirements

Namespace: SnmpSource

Assembly: SnmpSource (in SnmpSource.dll)

See Also

SnmpSource Namespace


SnmpV1TrapType Enumeration

The enum defines the acceptable snmp version 1 trap type.

public enum SnmpV1TrapType

Members

Member Name | Description
coldStart | Cold Start (0)
warmStart | Warm Start (1)
linkDown | Link Down (2)
linkUp | Link Up (3)
authenticationFailure | Authentication Failure (4)
egpNeighborLoss | Egp NeighborLoss (5)
enterpriseSpecific | Enterprise Specific (6)

Requirements

Namespace: SnmpSource

Assembly: SnmpSource (in SnmpSource.dll)

See Also

SnmpSource Namespace


SnmpV3EncryptionMethods Enumeration

The enum defines the snmp version 3 encryption algorithms.

public enum SnmpV3EncryptionMethods

Members

Member Name | Description
DES | DES (0) encryption method
AES | AES (1) 128 bits encryption method

Requirements

Namespace: SnmpSource

Assembly: SnmpSource (in SnmpSource.dll)

See Also

SnmpSource Namespace


SnmpV1TrapType Enumeration

SnmpSource Help

SnmpV3AuthenticationEncryptionFlags Enumeration

The enum defines the snmp version 3's message flags.

public enum SnmpV3AuthenticationEncryptionFlags

Members

Member Name | Description
NoAuthNoEncr | No authentication and no Encryption (0)
AuthNoEncr | Authentication without Encryption (1)
AuthEncr | Authentication and Encryption (3)
ReportableNoAuthNoEncr | Reportable without authentication and Encryption (4)
ReportableAuthNoEncr | Reportable authentication without Encryption (5)
ReportableAuthEncr | Reportable authencation and Encryption (7)

Requirements

Namespace: SnmpSource

Assembly: SnmpSource (in SnmpSource.dll)

See Also

SnmpSource Namespace


SnmpV1TrapType Enumeration

SnmpSource Help

SnmpV3AuthenticationMethods Enumeration

The enum defines the authentication methods for Version 3, MD5 and SHA.

public enum SnmpV3AuthenticationMethods

Members

Member Name | Description
MD5 | MD5 authentication methods (0)
SHA | SHA authentication methods (1)

Requirements

Namespace: SnmpSource

Assembly: SnmpSource (in SnmpSource.dll)

See Also

SnmpSource Namespace


SnmpSource.Mib

SnmpSource Help

SnmpSource.Mib Namespace

Namespace hierarchy

Classes

Class | Description
MibReader | Mib Reader class can read Mib files and convert the data to xml format. The mib files are not required to loading in sequence. However, the correct sequence of mib files loading will save processing time.
MibXmlDoc | MibXmlDoc is based XmlDocument class. All processed Mib information is saved in this object.


MibReader Class

Mib Reader class can read Mib files and convert the data to xml format. The mib files are not required to loading in sequence. However, the correct sequence of mib files loading will save processing time.

For a list of all members of this type, see MibReader Members.

System.Object
SnmpSource.Mib.MibReader

public class MibReader

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Requirements

Namespace: SnmpSource.Mib

Assembly: SnmpSource (in SnmpSource.dll)

See Also

MibReader Members | SnmpSource.Mib Namespace


MibReader Members

MibReader overview

Public Instance Constructors

MibReader Constructor

Public Instance Properties

ErrMsg | Return unknown objects that MibReader finds when it processes mib data.
XmlDocBuffer | Return MibXMLDoc property.

Public Instance Methods

ClearBuffer | This function will clear all mib data loaded in MibReader buffer.
Equals (inherited from Object) | Determines whether the specified Object is equal to the current Object.
GetHashCode (inherited from Object) | Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.
GetType (inherited from Object) | Gets the Type of the current instance.
Process | Process function will convert Mib data loaded in buffer to XML format.
Read | Read mib data into buffer.
ToString (inherited from Object) | Returns a String that represents the current Object.

Protected Instance Methods

Finalize (inherited from Object) | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
MemberwiseClone (inherited from Object) | Creates a shallow copy of the current Object.

See Also

MibReader Class | SnmpSource.Mib Namespace


MibReader Constructor

public MibReader();

See Also

MibReader Class | SnmpSource.Mib Namespace


MibReader Properties

The properties of the MibReader class are listed below. For a complete list of MibReader class members, see the MibReader Members topic.

Public Instance Properties

ErrMsg | Return unknown objects that MibReader finds when it processes mib data.
XmlDocBuffer | Return MibXMLDoc property.

See Also

MibReader Class | SnmpSource.Mib Namespace


ErrMsg Property

SnmpSource Help

MibReader.ErrMsg Property

Return unknown objects that MibReader finds when it processes mib data.

public string ErrMsg {get;}

See Also

MibReader Class | SnmpSource.Mib Namespace


XmlDocBuffer Property

SnmpSource Help

MibReader.XmlDocBuffer Property

Return MibXMLDoc property.

public MibXmlDoc XmlDocBuffer {get;}

See Also

MibReader Class | SnmpSource.Mib Namespace


MibReader Methods

The methods of the MibReader class are listed below. For a complete list of MibReader class members, see the MibReader Members topic.

Public Instance Methods

ClearBuffer | This function will clear all mib data loaded in MibReader buffer.
Equals (inherited from Object) | Determines whether the specified Object is equal to the current Object.
GetHashCode (inherited from Object) | Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.
GetType (inherited from Object) | Gets the Type of the current instance.
Process | Process function will convert Mib data loaded in buffer to XML format.
Read | Read mib data into buffer.
ToString (inherited from Object) | Returns a String that represents the current Object.

Protected Instance Methods

Finalize (inherited from Object) | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
MemberwiseClone (inherited from Object) | Creates a shallow copy of the current Object.

See Also

MibReader Class | SnmpSource.Mib Namespace


MibReader.ClearBuffer Method

This function will clear all mib data loaded in MibReader buffer.

public void ClearBuffer();

See Also

MibReader Class | SnmpSource.Mib Namespace


MibReader.Process Method

Process function will convert Mib data loaded in buffer to XML format.

public void Process();

See Also

MibReader Class | SnmpSource.Mib Namespace


MibReader.Read Method

Read mib data into buffer.

public void Read(
string filename
);

Parameters

filename
The path of target mib file.

See Also

MibReader Class | SnmpSource.Mib Namespace


MibXmlDoc Class

MibXmlDoc is based XmlDocument class. All processed Mib information is saved in this object.

For a list of all members of this type, see MibXmlDoc Members.

System.Object
System.Xml.XmlNode
System.Xml.XmlDocument
SnmpSource.Mib.MibXmlDoc

public class MibXmlDoc : XmlDocument

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Requirements

Namespace: SnmpSource.Mib

Assembly: SnmpSource (in SnmpSource.dll)

See Also

MibXmlDoc Members | SnmpSource.Mib Namespace


MibXmlDoc Members

MibXmlDoc overview

Public Instance Constructors

MibXmlDoc Constructor Constructor of object MibXmlDoc

Public Instance Properties

Attributes (inherited from XmlNode) | Gets an XmlAttributeCollection containing the attributes of this node.
BaseURI (inherited from XmlDocument) | Gets the base URI of the current node.
ChildNodes (inherited from XmlNode) | Gets all the child nodes of the node.
DocumentElement (inherited from XmlDocument) | Gets the root XmlElement for the document.
DocumentType (inherited from XmlDocument) | Gets the node containing the DOCTYPE declaration.
FirstChild (inherited from XmlNode) | Gets the first child of the node.
HasChildNodes (inherited from XmlNode) | Gets a value indicating whether this node has any child nodes.
Implementation (inherited from XmlDocument) | Gets the XmlImplementation object for the current document.
InnerText (inherited from XmlNode) | Gets or sets the concatenated values of the node and all its child nodes.
InnerXml (inherited from XmlDocument) | Gets or sets the markup representing the children of the current node.
IsReadOnly (inherited from XmlDocument) | Gets a value indicating whether the current node is read-only.
Item (inherited from XmlNode) | Gets the first child element with the specified Name .
Item (inherited from XmlNode) | Gets the first child element with the specified LocalName and NamespaceURI .
LastChild (inherited from XmlNode) | Gets the last child of the node.
LocalName (inherited from XmlDocument) | Gets the local name of the node.
Name (inherited from XmlDocument) | Gets the qualified name of the node.
NamespaceURI (inherited from XmlNode) | Gets the namespace URI of this node.
NameTable (inherited from XmlDocument) | Gets the XmlNameTable associated with this implementation.
NextSibling (inherited from XmlNode) | Gets the node immediately following this node.
NodeType (inherited from XmlDocument) | Gets the type of the current node.
OuterXml (inherited from XmlNode) | Gets the markup representing this node and all its child nodes.
OwnerDocument (inherited from XmlDocument) | Gets the XmlDocument to which the current node belongs.
ParentNode (inherited from XmlNode) | Gets the parent of this node (for nodes that can have parents).
Prefix (inherited from XmlNode) | Gets or sets the namespace prefix of this node.
PreserveWhitespace (inherited from XmlDocument) | Gets or sets a value indicating whether to preserve white space.
PreviousSibling (inherited from XmlNode) | Gets the node immediately preceding this node.
Value (inherited from XmlNode) | Gets or sets the value of the node.
XmlResolver (inherited from XmlDocument) | Sets the XmlResolver to use for resolving external resources.

Public Instance Methods

AppendChild (inherited from XmlNode) | Adds the specified node to the end of the list of child nodes, of this node.
Clone (inherited from XmlNode) | Creates a duplicate of this node.
CloneNode (inherited from XmlDocument) | Creates a duplicate of this node.
CreateAttribute (inherited from XmlDocument) | Overloaded. Creates an XmlAttribute with the specified Prefix, LocalName, and NamespaceURI .
CreateCDataSection (inherited from XmlDocument) | Creates an XmlCDataSection containing the specified data.
CreateComment (inherited from XmlDocument) | Creates an XmlComment containing the specified data.
CreateDocumentFragment (inherited from XmlDocument) | Creates an XmlDocumentFragment .
CreateDocumentType (inherited from XmlDocument) | Returns a new XmlDocumentType object.
CreateElement (inherited from XmlDocument) | Overloaded. Creates an element with the specified Prefix, LocalName, and NamespaceURI .
CreateEntityReference (inherited from XmlDocument) | Creates an XmlEntityReference with the specified name.
CreateNavigator (inherited from XmlNode) | Overloaded. Creates an XPathNavigator for navigating this object.
CreateNode (inherited from XmlDocument) | Overloaded. Creates an XmlNode with the specified XmlNodeType, Name, and NamespaceURI .
CreateProcessingInstruction (inherited from XmlDocument) | Creates an XmlProcessingInstruction with the specified name and data.
CreateSignificantWhitespace (inherited from XmlDocument) | Creates an XmlSignificantWhitespace node.
CreateTextNode (inherited from XmlDocument) | Creates an XmlText with the specified text.
CreateWhitespace (inherited from XmlDocument) | Creates an XmlWhitespace node.
CreateXmlDeclaration (inherited from XmlDocument) | Creates an XmlDeclaration node with the specified values.
Equals (inherited from Object) | Determines whether the specified Object is equal to the current Object.
FindChildNodeByAttibute | This function will check whether a child xml node is availale by specified name in a target parent node.
FindNodeByOID | To check whether a specified object ID exist in MibXMLDoc. If it exists, return true and return the XMLNode object by output parameter.
GetElementById (inherited from XmlDocument) | Gets the XmlElement with the specified ID.
GetElementsByTagName (inherited from XmlDocument) | Overloaded. Returns an XmlNodeList containing a list of all descendant elements that match the specified LocalName and NamespaceURI .
GetEnumerator (inherited from XmlNode) | Provides support for the for each style iteration over the nodes in the XmlNode .
GetHashCode (inherited from Object) | Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.
GetNamespaceOfPrefix (inherited from XmlNode) | Looks up the closest xmlns declaration for the given prefix that is in scope for the current node and returns the namespace URI in the declaration.
GetNodeIDByName | To check whether a specified Object ID is available. If yes, return true and pass the OID by output parameter.
GetPrefixOfNamespace (inherited from XmlNode) | Looks up the closest xmlns declaration for the given namespace URI that is in scope for the current node and returns the prefix defined in that declaration.
GetType (inherited from Object) | Gets the Type of the current instance.
ImportNode (inherited from XmlDocument) | Imports a node from another document to the current document.
InsertAfter (inherited from XmlNode) | Inserts the specified node immediately after the specified reference node.
InsertBefore (inherited from XmlNode) | Inserts the specified node immediately before the specified reference node.
Load (inherited from XmlDocument) | Overloaded. Loads the XML document from the specified XmlReader .
LoadXml (inherited from XmlDocument) | Loads the XML document from the specified string.
NodeNameExist | To check if a node name exists or not.
Normalize (inherited from XmlNode) | Puts all XmlText nodes in the full depth of the sub-tree underneath this XmlNode into a "normal" form where only markup (that is, tags, comments, processing instructions, CDATA sections, and entity references) separates XmlText nodes, that is, there are no adjacent XmlText nodes.
OIDExist | To check if a specified OID exists.
PrependChild (inherited from XmlNode) | Adds the specified node to the beginning of the list of child nodes for this node.
ReadNode (inherited from XmlDocument) | Creates an XmlNode object based on the information in the XmlReader . The reader must be positioned on a node or attribute.
RemoveAll (inherited from XmlNode) | Removes all the child nodes and/or attributes of the current node.
RemoveChild (inherited from XmlNode) | Removes specified child node.
ReplaceChild (inherited from XmlNode) | Replaces the child node oldChild with newChild node.
Save (inherited from XmlDocument) | Overloaded. Saves the XML document to the specified XmlWriter .
SelectNodes (inherited from XmlNode) | Overloaded. Selects a list of nodes matching the XPath expression.
SelectSingleNode (inherited from XmlNode) | Overloaded. Selects the first XmlNode that matches the XPath expression.
Supports (inherited from XmlNode) | Test if the DOM implementation implements a specific feature.
ToString (inherited from Object) | Returns a String that represents the current Object.
WriteContentTo (inherited from XmlDocument) | Saves all the children of the XmlDocument node to the specified XmlWriter .
WriteTo (inherited from XmlDocument) | Saves the XmlDocument node to the specified XmlWriter .

Public Instance Events

NodeChanged (inherited from XmlDocument) | Occurs when the Value of a node belonging to this document has been changed.
NodeChanging (inherited from XmlDocument) | Occurs when the Value of a node belonging to this document is about to be changed.
NodeInserted (inherited from XmlDocument) | Occurs when a node belonging to this document has been inserted into another node.
NodeInserting (inherited from XmlDocument) | Occurs when a node belonging to this document is about to be inserted into another node.
NodeRemoved (inherited from XmlDocument) | Occurs when a node belonging to this document has been removed from its parent.
NodeRemoving (inherited from XmlDocument) | Occurs when a node belonging to this document is about to be removed from the document.

Protected Instance Methods

Finalize (inherited from Object) | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
MemberwiseClone (inherited from Object) | Creates a shallow copy of the current Object.

Protected Internal Instance Methods

CreateDefaultAttribute (inherited from XmlDocument) | Creates a default attribute with the specified prefix, local name and namespace URI.
CreateNavigator (inherited from XmlDocument) | Overloaded. Creates an XPathNavigator object for navigating this document.

See Also

MibXmlDoc Class | SnmpSource.Mib Namespace


MibXmlDoc Constructor

Constructor of object MibXmlDoc

public MibXmlDoc();

See Also

MibXmlDoc Class | SnmpSource.Mib Namespace


MibXmlDoc Methods

The methods of the MibXmlDoc class are listed below. For a complete list of MibXmlDoc class members, see the MibXmlDoc Members topic.

Public Instance Methods

AppendChild (inherited from XmlNode) | Adds the specified node to the end of the list of child nodes, of this node.
Clone (inherited from XmlNode) | Creates a duplicate of this node.
CloneNode (inherited from XmlDocument) | Creates a duplicate of this node.
CreateAttribute (inherited from XmlDocument) | Overloaded. Creates an XmlAttribute with the specified Prefix, LocalName, and NamespaceURI .
CreateCDataSection (inherited from XmlDocument) | Creates an XmlCDataSection containing the specified data.
CreateComment (inherited from XmlDocument) | Creates an XmlComment containing the specified data.
CreateDocumentFragment (inherited from XmlDocument) | Creates an XmlDocumentFragment .
CreateDocumentType (inherited from XmlDocument) | Returns a new XmlDocumentType object.
CreateElement (inherited from XmlDocument) | Overloaded. Creates an element with the specified Prefix, LocalName, and NamespaceURI .
CreateEntityReference (inherited from XmlDocument) | Creates an XmlEntityReference with the specified name.
CreateNavigator (inherited from XmlNode) | Overloaded. Creates an XPathNavigator for navigating this object.
CreateNode (inherited from XmlDocument) | Overloaded. Creates an XmlNode with the specified XmlNodeType, Name, and NamespaceURI .
CreateProcessingInstruction (inherited from XmlDocument) | Creates an XmlProcessingInstruction with the specified name and data.
CreateSignificantWhitespace (inherited from XmlDocument) | Creates an XmlSignificantWhitespace node.
CreateTextNode (inherited from XmlDocument) | Creates an XmlText with the specified text.
CreateWhitespace (inherited from XmlDocument) | Creates an XmlWhitespace node.
CreateXmlDeclaration (inherited from XmlDocument) | Creates an XmlDeclaration node with the specified values.
Equals (inherited from Object) | Determines whether the specified Object is equal to the current Object.
FindChildNodeByAttibute | This function will check whether a child xml node is availale by specified name in a target parent node.
FindNodeByOID | To check whether a specified object ID exist in MibXMLDoc. If it exists, return true and return the XMLNode object by output parameter.
GetElementById (inherited from XmlDocument) | Gets the XmlElement with the specified ID.
GetElementsByTagName (inherited from XmlDocument) | Overloaded. Returns an XmlNodeList containing a list of all descendant elements that match the specified LocalName and NamespaceURI .
GetEnumerator (inherited from XmlNode) | Provides support for the for each style iteration over the nodes in the XmlNode .
GetHashCode (inherited from Object) | Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.
GetNamespaceOfPrefix (inherited from XmlNode) | Looks up the closest xmlns declaration for the given prefix that is in scope for the current node and returns the namespace URI in the declaration.
GetNodeIDByName | To check whether a specified Object ID is available. If yes, return true and pass the OID by output parameter.
GetPrefixOfNamespace (inherited from XmlNode) | Looks up the closest xmlns declaration for the given namespace URI that is in scope for the current node and returns the prefix defined in that declaration.
GetType (inherited from Object) | Gets the Type of the current instance.
ImportNode (inherited from XmlDocument) | Imports a node from another document to the current document.
InsertAfter (inherited from XmlNode) | Inserts the specified node immediately after the specified reference node.
InsertBefore (inherited from XmlNode) | Inserts the specified node immediately before the specified reference node.
Load (inherited from XmlDocument) | Overloaded. Loads the XML document from the specified XmlReader .
LoadXml (inherited from XmlDocument) | Loads the XML document from the specified string.
NodeNameExist | To check if a node name exists or not.
Normalize (inherited from XmlNode) | Puts all XmlText nodes in the full depth of the sub-tree underneath this XmlNode into a "normal" form where only markup (that is, tags, comments, processing instructions, CDATA sections, and entity references) separates XmlText nodes, that is, there are no adjacent XmlText nodes.
OIDExist | To check if a specified OID exists.
PrependChild (inherited from XmlNode) | Adds the specified node to the beginning of the list of child nodes for this node.
ReadNode (inherited from XmlDocument) | Creates an XmlNode object based on the information in the XmlReader . The reader must be positioned on a node or attribute.
RemoveAll (inherited from XmlNode) | Removes all the child nodes and/or attributes of the current node.
RemoveChild (inherited from XmlNode) | Removes specified child node.
ReplaceChild (inherited from XmlNode) | Replaces the child node oldChild with newChild node.
Save (inherited from XmlDocument) | Overloaded. Saves the XML document to the specified XmlWriter .
SelectNodes (inherited from XmlNode) | Overloaded. Selects a list of nodes matching the XPath expression.
SelectSingleNode (inherited from XmlNode) | Overloaded. Selects the first XmlNode that matches the XPath expression.
Supports (inherited from XmlNode) | Test if the DOM implementation implements a specific feature.
ToString (inherited from Object) | Returns a String that represents the current Object.
WriteContentTo (inherited from XmlDocument) | Saves all the children of the XmlDocument node to the specified XmlWriter .
WriteTo (inherited from XmlDocument) | Saves the XmlDocument node to the specified XmlWriter .

Protected Instance Methods

Finalize (inherited from Object) | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
MemberwiseClone (inherited from Object) | Creates a shallow copy of the current Object.

Protected Internal Instance Methods

CreateDefaultAttribute (inherited from XmlDocument) | Creates a default attribute with the specified prefix, local name and namespace URI.
CreateNavigator (inherited from XmlDocument) | Overloaded. Creates an XPathNavigator object for navigating this document.

See Also

MibXmlDoc Class | SnmpSource.Mib Namespace


MibXmlDoc.FindChildNodeByAttibute Method

This function will check whether a child xml node is availale by specified name in a target parent node.

public bool FindChildNodeByAttibute(
string strName,
XmlNode ParentNode,
ref XmlNode ChildNode
);

Parameters

strName
Object name
ParentNode
Parent Node
ChildNode
Pass target child node by output parameter if it exits.

Return Value

If target child node found, return true; else, return false.

See Also

MibXmlDoc Class | SnmpSource.Mib Namespace


MibXmlDoc.FindNodeByOID Method

To check whether a specified object ID exist in MibXMLDoc. If it exists, return true and return the XMLNode object by output parameter.

public bool FindNodeByOID(
string strOID,
ref XmlNode fNode
);

Parameters

strOID
Object ID.
fNode
If Object ID exists, pass target XMLNode by output parameter.

Return Value

If Object ID exists, return true; else, return false.

See Also

MibXmlDoc Class | SnmpSource.Mib Namespace


MibXmlDoc.GetNodeIDByName Method

To check whether a specified Object ID is available. If yes, return true and pass the OID by output parameter.

public bool GetNodeIDByName(
string strName,
ref string oid
);

Parameters

strName
Object Name
oid
Object ID. If a specified object exists, pass the OID value by this output parameter.

Return Value

If the specified Object Name exists, return true; else, return false.

See Also

MibXmlDoc Class | SnmpSource.Mib Namespace


MibXmlDoc.NodeNameExist Method

To check if a node name exists or not.

public bool NodeNameExist(
string strName
);

Parameters

strName
Target node name

Return Value

If this node name exists, return true; else, return false.

See Also

MibXmlDoc Class | SnmpSource.Mib Namespace


MibXmlDoc.OIDExist Method

To check if a specified OID exists.

public bool OIDExist(
string strOID
);

Parameters

strOID
Target Object ID such as "1.0" or "1.0.3"

Return Value

If this OID exists, return true; else, return false.

See Also

MibXmlDoc Class | SnmpSource.Mib Namespace


SnmpSource.MibHierarchy

SnmpSource Help

SnmpSource.Mib Hierarchy

System.Object
SnmpSource.Mib.MibReader
System.Xml.XmlNode ---- System.Collections.IEnumerable, System.ICloneable, System.Xml.XPath.IXPathNavigable
System.Xml.XmlDocument
SnmpSource.Mib.MibXmlDoc

See Also

SnmpSource.Mib Namespace


SnmpSourceHierarchy

SnmpSource Help

SnmpSource Hierarchy

System.Object
SnmpSource.SnmpPdu
SnmpSource.SnmpSession
SnmpSource.SnmpVariable
SnmpSource.Trap
System.Delegate ---- System.ICloneable, System.Runtime.Serialization.ISerializable
System.MulticastDelegate
SnmpSource.AsyncProcesses
System.ValueType
System.Enum ---- System.IComparable, System.IConvertible, System.IFormattable
SnmpSource.EnumPduType
SnmpSource.SnmpErrorStatus
SnmpSource.SnmpV1TrapType
SnmpSource.SnmpVarType
SnmpSource.SnmpVersion
SnmpSource.SnmpV3EncryptionMethods
SnmpSource.SnmpV3AuthenticationMethods
SnmpSource.SnmpV3AuthenticationEncryptionFlags

See Also

SnmpSource Namespace