Contents
0 Agent++ 总体说明:
(1)Snmp++
Snmp++是为网络管理应用程序开发者提供的具有SNMP服务的一套C++类的集合。它具有基于面向对象模型建立的SNMP应用程序接口,在最小化的范围内使用已经存在的SNMP库,保证了程序的高效和可移植性。对于使用TCP/IP协议的Internet来说,Snmp++封装了底层的Socket操作,提供了简单的API供开发者使用。
(2)Agent++
Agent++是在Snmp++的基础上,扩展了Snmp++中的概念,它是用来开发SNMP代理的一套C++类的集合。它继承了Snmp++的优点,封装了绝大部分的SNMP的标准操作,并且利用面向对象的特性,使开发者能够通过派生的子类,重载其中的虚函数,根据应用程序的需要灵活控制程序。
在Agent++类库,定义和实现了在SMI和MIB中的文本语法规定,如:Group,Table,TableEntry,Index等。主要的类与文本语法规定的对应关系如表1所示。
SNMP 协议与 Agent ++类 的表示的对应关系
SNMP 协议 | Agent ++类 |
网关代理 | Mib |
用龙虾沙拉
户MIB | MibGroup |
Table | MibTable |
TableEntry | MibTableEntry |
Instance | Mibleaf |
Snmp 会话 | Snmpx |
PDU | Pdux |
变量绑定 VB | Vbx |
对象标志符(OID) | Oidx |
| |
按照功能划分,Agent++软件开发包由4个模块组成,如图3所示。
图3 Agent ++ 功能模块图
通信模块负责接收和发送SNMP消息,它在指定端口(通常是161)接收到来的请求消息,并发送响应消息;在指定端口(通常是162)接收和发送陷阱、信息通知消息。同时,它还要给消息处理模块提供接收到消息、发送消息的工具函数。在Agent++中,属于通信模块的类主要有Snmpx、Requ红楼梦的真实历史
estList、Request等。
消息处理模块负责解析输入的请求消息,进行安全验证。它对通信模块传来的SNMP消息进行解析,判断解析结果是否合法,同时,也要把解析出来的社团名(community)与规定的社团名进行比较验证。如果解析结果合法且社团名验证通过,才能进行下一步操作。在Agent++中,属于消息处理模块的类主要有Request等。
操作定位模块负责根据消息处理模块解析的结果,在MIB库中查找管理对象。它按照消息中包含的管理对象的对象标志符(OID),查找需要访问的管理对象。在Agent++中,属于操作定位模块的类有Request、Mib、MibGroup、MibTable等。
MIB管理模块负责SNMP操作的具体实现。它按照操作类型(读或写),首先判断能否对管理对象进行操作,然后访问MIB库,按照要求读取数据或更新数据。在Agent++中,属于MIB管理模块的类有Request、MibTable、MibTableRow、Mibleaf等。
通信模块消息处理模块和操作定位模块对所有的MIB(包括私有的MIB)都是相同的,开发具体设备的代理时可以直接利用这些模块。MIB管理模块只提供了基本的操作,还需要根据具体的MIB文件,重新定制MIB管理模块。
1.Introduction 介绍
Various Simple Network Management Protocol (SNMP) Application Programmers Interfaces (APIs) exist which allow the creation of network management applications. SNMP++ is such an API but in contrast to many others it offers the advantages of object oriented programming. An object oriented approach to SNMP network programming provides many benefits including ea of u, safety, portability and extensibility. The SNNP++ source code (C++) is freely available from the Hewlett Packard Company WWW rver[+] as long as their copyright notice is prerved. SNMP++ is designed to support the development of SNMP manager entities in the first place. AGENT++ extends the basic concepts of SNMP++ to support the development of SNMP agents and SNMP entities playing a dual role.
Agent++ 扩展了 SNMP++ 的基本概念,支持 SNMP AGENT++ 和 SNMP 的双面角色。
If you are looking for an introduction to SNMP and SNMP MIBs, I recommend [Perkins97].
1.Objectives of AGENT++
Ea of U
AGENT++ has been designed to make the development of simple network management protocol agents simple. Using the AGENT++ API the programmer does not need to be concerned with details about SNMP protocol engine and dispatch table. The programmer can focus on implementing method routines and management instrumentation. The OO approach encapsulates and hides many internals like management of incoming SNMP requests, looking up mappings in the dispatch table, calling the appropriate method routines, nding respons and traps. Details concerning the simple network protocol itlf are encapsulated by SNMP++ (e the SNMP++ specification for details).
Rapidity of Implementation
The AGENT++ API undertakes nearly any task of a SNMP agent implementation that can be generalid. Therefore the implementation of SNMP agents with AGENT++ saves a lot of time and money. The OO approach of AGENT++ supports the generalisation of the key tasks of a SNMP agent efficiently without making the API difficult to u.
Extensibility
Extensions to the AGENT++ API can be done in many ways. This includes supporting new versions of SNMP (e.g. version 3) and their administrative framework, ba class for additional types of managed objects, and adding new features. Through C++ class derivation, urs of AGENT++ can inherit what they like and override what they wish to overload:
∙ A key concept of AGENT++ is the sub-classing of managed object ba class by the ur. The ur overrides virtual member functions of the ba class when she or he needs a specialisation to the default behaviour of the respective class member function.
Portability//方便性
AGENT++ offers a maximum of portability due to the u of pure C++ without any operating system specific calls. So its only portability limitation is SNMP++ which is available for many 毛笔草书
Unix derivates and Microsoft Windows. Nevertheless if you want to im
plement a multi-threaded SNMP agent AGENT++ is limited to POSIX threads compatible UNIX operating systems, e.g. Solaris, Digital Unix, and Linux. The public interface of the AGENT++ API remains the same across any platform. A programmer who codes to AGENT++ does not have to make changes to move it to another platform.
Extensibility 扩展性
Extensions to the AGENT++ API can be done in many ways. This includes supporting new versions of SNMP (e.g. version 3) and their administrative framework, ba class for additional types of managed objects, and adding new features. Through C++ class derivation, urs of AGENT++ can inherit what they like and override what they wish to overload: