<< Back to man.ChinaUnix.net

3.        Introduction

Various Simple Network Management Protocol (SNMP) Application Programmers Interfaces (APIs) exist which allow for the creation of network management applications. The majority of these APIs provide a large library of functions which require the programmer to be familiar with the inner workings of SNMP and SNMP resource management. Most of these APIs are platform specific, resulting in SNMP code specific to an operating system or network operating system platform and thus not portable. Application development using C++ has entered the main stream and with it a rich set of reusable class libraries are now readily available. What is missing is a standard set of  C++ classes for network management.   An object oriented approach to SNMP network programming provides many benefits including ease of use, safety, portability and extensibility. SNMP++ offers power and flexibility which would otherwise be difficult to implement and manage.

3.1.     What Is SNMP++?

SNMP++ is a set of C++ classes which provide SNMP services to a network management application developer.  SNMP++ is not an additional layer or wrapper over existing SNMP engines. SNMP++   utilizes existing SNMP libraries in a few minimized areas and in doing so is efficient and portable.  SNMP++ is not meant to replace other existing SNMP APIs such as WinSNMP, rather it offers power and flexibility which would otherwise be difficult to manage and implement. SNMP++ brings the Object Advantage to network management programming.

3.2.     Objectives of SNMP++

3.2.1.     Ease of Use and SNMP++

An Object Oriented (OO) approach to SNMP programming should be easy to use. After all, this is supposed to be a simple network management protocol. SNMP++ puts the simple back into SNMP! The application programmer does not need be concerned with low level SNMP mechanisms. An OO approach  to SNMP encapsulates and hides the internal mechanisms of SNMP. In regard to ease of use, SNMP++ addresses the following areas.  Provides an easy-to-use interface into SNMP

A user does not have to be an expert in SNMP to use SNMP++. Furthermore, a user does not have to be an expert in C++! For the most part C pointers do not exist in SNMP++. The result is an easy to use straight forward API.  Provides easy migration to SNMP version 2

A major goal of SNMP++ has been to develop an API which scales to SNMP version 2 with minimal impact on code.  The SnmpTarget class makes this possible.  Preserves the flexibility of lower level SNMP programming

A  user may want to bypass the OO approach and code directly to low level SNMP calls.   SNMP++ is fast and efficient. However, there may be instances where the programmer requires coding directly to a lower level SNMP API.  Encourages programmers to use the full power of C++ without chastising them for not learning fast enough

A user does not have to be an expert in C++ to use SNMP++.  Basic knowledge of SNMP is required, but as will be shown, a minimal understanding of C++ is needed.

3.2.2.     Programming Safety and SNMP++

Most SNMP APIs require the programmer to manage a variety of resources. Improper allocation or de-allocation of these resources can result in corrupted or lost memory.  SNMP++ provides safety by managing these resources automatically.  The user of SNMP++ realizes the benefits of automatic resource and session management. In regard to programming safety, SNMP++ addresses the following areas.  Provides safe management of SNMP resources

This includes SNMP structures, sessions,  and transport layer management. SNMP classes are designed as Abstract Data Types ( ADTs) providing data hiding and the provision of public member functions  to inspect or modify hidden instance variables.  Provides built in error checking, automatic time-out and retry

A user of SNMP++ does not have to be concerned with providing reliability for an unreliable transport mechanism. A variety of communications errors can occur including: lost datagrams,  duplicated datagrams, and  reordered datagrams.  SNMP++ addresses each of these possible error conditions and provides the user with transparent reliability.

3.2.3.     Portability and SNMP++


A major goal of SNMP++ is to provide a portable API across a variety of operating systems (OSs), network operating systems (NOSs), and network management platforms. Since the internal mechanisms of SNMP++ are hidden, the public interface remains the same across any platform.  A programmer who codes to SNMP++ does not have to make changes to move it to another platform. Another issue in the area of portability is the ability to run across a variety of protocols. SNMP++ currently operates over the Internet Protocol (IP) or Internet Packet Exchange (IPX) protocols, or both using a dual stack. 

3.2.4.     Extensibility and SNMP++

Extensibility is not a binary function but rather one of degree. SNMP++ not only can be extended, but can and has been extended easily. Extensions to SNMP++ include supporting new OS’s, NOS’s , network management platforms, protocols,  supporting SNMP version 2, and adding new features. Through C++ class derivation, users of SNMP++ can inherit what they like and overload what they wish to redefine.    Overloading SNMP++ Base Classes

The application programmer may subclass the base SNMP++ classes  to provide specialized behavior and attributes. This theme is central to object orientation. The base classes of SNMP++ are meant to be generic and do not contain any vendor specific data structures or behavior. New attributes can be easily added through C++ sub-classing and virtual member function redefinition.