This project has moved and is read-only. For the latest updates, please go here.

Chapter One: Suite Overview

Time after time, new pieces were added to this suite. Now five major pieces on the road map are the Library, the Browser, the Compiler, the Agent and a few command line utilities.

The Library, is the core component of this suite, which provides an open source implementation of SNMP protocol. It enables other components in the suite to send and receive SNMP messages.

The Browser, is a useful component that displays managed objects extracted from MIB documents. It also offers a simple way to do SNMP operations with configured devices.

The Compiler, is an individual components that manipulates MIB documents. It helps detect errors in MIB documents and parses managed objects into a format that the Browser understands.

The Agent, is a reference design for SNMP agents. It supports SNMP v1, v2c, and v3 operations and can be extended easily.

Picture 1. Suite Components

Chapter Two: The Library

1 Overview

The Library is designed to be used in all kinds of applications such as WinForms (including .NET Compact Framework), ASP.NET, and WPF* running on Microsoft .NET and Novell Mono platforms.

*not including Silverlight as it lacks a lot of socket support that #SNMP relies on

It can be separated first into two parts, Messaging and MIB. The Messaging part focuses on SNMP messages while the MIB part focuses on SNMP MIB documents.

Picture 2. Library Parts

2 Messaging Part

The Messaging part can be further divided into three layers each of which contains a group of related classes and interfaces. The three layers are, Data, Message, and Component.

Picture 3. Three Layers in Messaging

2.1 Data Layer

SNMP protocol defines a lot of basic data types to construct messages. These types are,

OCTET STRING (OctetString.cs)
INTEGER (Integer32.cs)
TimeTicks (TimeTicks.cs)
COUNTER (Counter32.cs)
GAUGE (Gauge32.cs)
IP Address (IP.cs)
NULL (Null.cs)
Object Identifier (ObjectIdentifier.cs)
Opaque (Opaque.cs)
Counter64 (Counter64.cs)

All types are defined since SNMP v1 except Counter64 (Counter64 is added in SNMP v2c). NULL is a special type and mainly used in request messages.

There are other special types named exceptions defined in SNMP v2c. They are,

End of MIB view (EndOfMibView.cs)
No such instance (NoSuchInstance.cs)
No such object (NoSuchObject.cs)

All these types implement a useful interface, ISnmpData (ISnmpData.cs).

2.2 Message Layer

In this layer we provide a few useful data containers are,

SEQUENCE (Sequence.cs)
SNMP PDU (*Pdu.cs)
SNMP messages (*Message.cs)

Sequence container is used to group up basic data types to variable bindings. PDU containers are used to form SNMP PDU. Message containers are used to construct complete SNMP messages.

PDU classes implement the ISnmpPdu interface (ISnmpPdu.cs) while message classes implement ISnmpMessage interface (ISnmpMessage.cs). ISnmpPdu is derived from ISnmpData.

Note that using classes provided in 2.1 and 2.2 you can already do all SNMP operations, because they already cover all message elements. (Also titled Level 1 API)

2.3 Component Layer

In this layer, several classes are provided to simplify SNMP operations. So they can be treated as higher level API.

Discoverer class provides an easy way to query SNMP agents in the same IP v4 network via UDP broadcast.

Discovery class simplifies SNMP v3 discovery process. It can be used to query agent parameters before sending out SNMP v3 request messages.

Listener class helps monitor incoming SNMP messages (can be used in both SNMP managers and agents). It even supports bindings similar to HTTP web servers.

Messenger class provides a few static methods to encapsulate underlying message classes. (Also titled Level 2 API)

Manager class was designed for SNMP manager applications, which provides even simpler methods compared to Messenger. But now it is rarely used in #SNMP samples because it does not support SNMP v3 well. (Also titled Level 3 API)

2.4 Connectors

OK, the layers can be connected in a few cases. For example, when there is an incoming message, some classes must be responsible to decompose it into smaller elements. The decomposition process involves all elements in the three layers. So the message factory (MessageFactory.cs) and data factory (DataFactory.cs) stand out.

2.5 Exceptions

There are only several exceptions defined.

SnmpException is the base class for all #SNMP exceptions.

OperationException is thrown when an SNMP operation fails. Its property Agent and Details are useful.

ErrorException is thrown when an SNMP error message is received. Its property Body contains the message.

TimeoutException is thrown when no SNMP response message is received in a period of time. Its Timeout property shows which timeout setting is hit.

MessageFactoryException is thrown when an incoming SNMP message cannot be parsed.

DecryptionException is thrown when an incoming SNMP v3 message cannot be decrypted.

3 MIB Part

This part can also be roughly divided into three groups. They are, MIB Constructs, Parser Related and Tree Related.

3.1 MIB Constructs

These classes all implement IContruct interface (IConstruct.cs). Most of them are place holders because of current parser/compiler design. The key classes all implement IEntity interface (IEntity.cs) and can be used to construct the object tree. Of course, IEntity is derived from IConstruct.

3.2 Parser Related

Classes in this group are so useful that they consume MIB documents and produce data structures that represent those managed objects. Some classes represent MIB documents and modules defined in the documents, such as MibDocument (MibDocument.cs) and MibModule (MibModule.cs). Lexer (Lexer.cs) is a class that decomposes a MIB document into small Symbol instances (Symbol.cs). The Parser class (Parser.cs) combines all above classes together.

3.3 Assembler/Tree Related

The ObjectTree class (ObjectTree.cs) holds all managed objects known. These objects are instances of Definition class (Definition.cs). Surely the Definition objects are generated from IEntity instances. The Assembler class is used to assemble all objects into the tree.

3.4 Others

ObjectRegistry is another important class in other #SNMP components. It behaviours as a Façade for all other MIB classes.

3.5 Exceptions

MibException is thrown when a MIB document compilation fails.

Chapter Three: The Browser

The #SNMP MIB Browser is used to load compiled MIB modules into an object repository. Then you can use the GUI to manage those objects on your SNMP agent.

The Panels

The Internals

Chapter Four: The Compiler

Well, this is not a single compiler such as csc.exe but a complete IDE for MIB document authoring.

The Panels

The Internals

Chapter Five: The Agent

This is a reference design who tells how to do SNMP agent development in C#/.NET.

The Pipeline

The Internals

Last edited Jun 20, 2010 at 10:49 AM by lextm, version 1