Agent中英文对照译文.docx
- 文档编号:13495148
- 上传时间:2023-06-14
- 格式:DOCX
- 页数:41
- 大小:117.94KB
Agent中英文对照译文.docx
《Agent中英文对照译文.docx》由会员分享,可在线阅读,更多相关《Agent中英文对照译文.docx(41页珍藏版)》请在冰点文库上搜索。
Agent中英文对照译文
Contents
0Agent++总体说明:
(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所示。
图3Agent++功能模块图
通信模块负责接收和发送SNMP消息,它在指定端口(通常是161)接收到来的请求消息,并发送响应消息;在指定端口(通常是162)接收和发送陷阱、信息通知消息。
同时,它还要给消息处理模块提供接收到消息、发送消息的工具函数。
在Agent++中,属于通信模块的类主要有Snmpx、RequestList、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介绍
VariousSimpleNetworkManagementProtocol(SNMP)ApplicationProgrammersInterfaces(APIs)existwhichallowthecreationofnetworkmanagementapplications.SNMP++issuchanAPIbutincontrasttomanyothersitofferstheadvantagesofobjectorientedprogramming.AnobjectorientedapproachtoSNMPnetworkprogrammingprovidesmanybenefitsincludingeaseofuse,safety,portabilityandextensibility.TheSNNP++sourcecode(C++)isfreelyavailablefromtheHewlettPackardCompanyWWWserver[+]aslongastheircopyrightnoticeispreserved.SNMP++isdesignedtosupportthedevelopmentofSNMPmanagerentitiesinthefirstplace.AGENT++extendsthebasicconceptsofSNMP++tosupportthedevelopmentofSNMPagentsandSNMPentitiesplayingadualrole.
Agent++扩展了SNMP++的基本概念,支持SNMPAGENT++和SNMP的双面角色。
IfyouarelookingforanintroductiontoSNMPandSNMPMIBs,Irecommend[Perkins97].
1.ObjectivesofAGENT++
EaseofUse
AGENT++hasbeendesignedtomakethedevelopmentofsimplenetworkmanagementprotocolagentssimple.UsingtheAGENT++APItheprogrammerdoesnotneedtobeconcernedwithdetailsaboutSNMPprotocolengineanddispatchtable.Theprogrammercanfocusonimplementingmethodroutinesandmanagementinstrumentation.TheOOapproachencapsulatesandhidesmanyinternalslikemanagementofincomingSNMPrequests,lookingupmappingsinthedispatchtable,callingtheappropriatemethodroutines,sendingresponsesandtraps.DetailsconcerningthesimplenetworkprotocolitselfareencapsulatedbySNMP++(seetheSNMP++specificationfordetails).
RapidityofImplementation
TheAGENT++APIundertakesnearlyanytaskofaSNMPagentimplementationthatcanbegeneralised.ThereforetheimplementationofSNMPagentswithAGENT++savesalotoftimeandmoney.TheOOapproachofAGENT++supportsthegeneralisationofthekeytasksofaSNMPagentefficientlywithoutmakingtheAPIdifficulttouse.
Extensibility
ExtensionstotheAGENT++APIcanbedoneinmanyways.ThisincludessupportingnewversionsofSNMP(e.g.version3)andtheiradministrativeframework,baseclassesforadditionaltypesofmanagedobjects,andaddingnewfeatures.ThroughC++classderivation,usersofAGENT++caninheritwhattheylikeandoverridewhattheywishtooverload:
∙AkeyconceptofAGENT++isthesub-classingofmanagedobjectbaseclassesbytheuser.Theuseroverridesvirtualmemberfunctionsofthesebaseclasseswhensheorheneedsaspecialisationtothedefaultbehaviouroftherespectiveclassmemberfunction.
Portability//方便性
AGENT++offersamaximumofportabilityduetotheuseofpureC++withoutanyoperatingsystemspecificcalls.SoitsonlyportabilitylimitationisSNMP++whichisavailableformanyUnixderivatesandMicrosoftWindows.Neverthelessifyouwanttoimplementamulti-threadedSNMPagentAGENT++islimitedtoPOSIXthreadscompatibleUNIXoperatingsystems,e.g.Solaris,DigitalUnix,andLinux.ThepublicinterfaceoftheAGENT++APIremainsthesameacrossanyplatform.AprogrammerwhocodestoAGENT++doesnothavetomakechangestomoveittoanotherplatform.
Extensibility扩展性
ExtensionstotheAGENT++APIcanbedoneinmanyways.ThisincludessupportingnewversionsofSNMP(e.g.version3)andtheiradministrativeframework,baseclassesforadditionaltypesofmanagedobjects,andaddingnewfeatures.ThroughC++classderivation,usersofAGENT++caninheritwhattheylikeandoverridewhattheywishtooverload:
∙AkeyconceptofAGENT++isthesub-classingofmanagedobjectbaseclassesbytheuser.Theuseroverridesvirtualmemberfunctionsofthesebaseclasseswhensheorheneedsaspecialisationtothedefaultbehaviouroftherespectiveclassmemberfunction.
∙Agent++一个重要的概念就是由用户管理的子类积累。
AnIntroductoryExample
TogetanideaofwhatbenefitsAGENT++offerstoaSNMPagentprogrammer,hereisanexamplethatshowstheimplementationofanagentforacoffee-percolator.Fornow,asinglescalarmanagedobjectwhichrepresentsthetemperatureofthecoffeeinthecoffee-potwilldo.Additionalmanagedobjectse.g.thosethatdemonstratehowSNMPtablescanbeimplementedwithAGENT++willfollowlateron.
简单标量管理对象。
2.ExplanationofIntroductoryExample
一个介绍性的例子。
ThemainprocedureofanAGENT++SNMPagent(showninfigure1)canbedividedintothreesections:
1.SettinguptheSNMPprotocolengine
设置SNMP协议驱动
FirstofallanextendedversionoftheSNMP++Snmpclass(Snmpx)isusedtocreateaSNMPsessionthatwillbeusedforincomingSNMPrequests.TheexampleusesthestandardSNMPport161tolistenon,althoughany(available)UDPportcanbechosen.IfthesessionhasbeencreatedsuccessfullythesessionobjectsnmphastoberegisteredtothestaticclassRequestListwhichqueuesandmanagesSNMPrequests.
SNMPX类用来产生一个SNMP线程,使用标准的SNMP口161监听,snmp线程注册到RequestList类中,RequestList能够管理SNMP的请求。
2.CreateandregistertheMIBobjects
产生和注册MIB对象。
Themibobjectiscreatedwhichrepresentstheconceptualdatabasecontainingthemanagementinformationoftheagent(ManagementInformationBase).
MIB对象代表了Agent的管理信息。
ThenallobjectsthatshouldbesupportedbytheagentMIBareadded.Eachsuchobjectcontainsoneormoreinstancesofmanagedobjectsrelatedtoasubtreeofthemanagementinformationtree.TheclassessystemGroup,snmpGroup,andtrapDestGroupareprovidedbyAGENT++,whichincludethemanagedobjectsoftheMIBIIsystemandsnmpgroup,aswellasmanagedobjectsneededfortrapdestinationregistration.
systemGroup,snmpGroup,andtrapDestGroup类包含了MIBII系统和snmp组的管理信息。
也包含了trap目的的注册信息。
3.LoopforeverforincomingSNMPrequests
循环等待到来的snmp请求。
ThereceivemethodoftheRequestListobjectisusedtowaitforincomingSNMPrequest.Themethodtakesasargumentthemaximumtimetowaitforarequestinseconds.Note:
Iftheagentusesmulti-threadingtheRequestListcancontainmorethanonerequest.ASNMPrequestisprocessedthroughtheprocess_requestmethodwhichpropagateseachsub-requesttotheappropriateMIBobject.
RequestList对象用来等待到来的snmp请求。
使用process_request方法来处理子需求。
HowasimplemanagedobjectlikecoffeeTemperaturecanbeimplementedusingtheAGENT++APIisshownbyfigures2and3.TheclasscoffeeTemperatureisderivedfromMibLeafwhichisitselfderivedfromMibEntry.MibLeafisthebaseclassforallinstancesofmanagedobjectsthatareleafsofthemanagementinformationtree,alsocalledscalarmanagedobjects.TheconstructorofcoffeeTemperaturecallstheconstructorofitsbaseclassMibLeafwiththreearguments:
coffeeTemperature是一个简单的管理类,源于MibLeaf类,而MibLeaf类又源自MibEntry。
MibLeaf是所有管理控制类的基类,是管理信息树的叶子,也称作标量控制对象。
coffeeTemperature的构造调用了MibLeaf的构造,在以下3点需要说明:
∙theobjectidentifierofthemanagedobjectinstancetheMIBobjectisrepresenting.
∙实例化MIB对象,表示
∙theaccessrightstobeused(coffeeTemperatureisreadonly)
∙使用的入口权限(coffeeTemperature是只读)
thesyntaxinformofafromSnmpSyntaxderivedobjectthatrepresentsanobjectorientedviewofStructureofManagementInformation(SMI)AbstractSyntaxNotation(ASN.1)datatypeswhichareusedbySNMP(seefigure4ortheSNMP++specificationforsub-classesofSnmpSyntax).
源自SnmpSyntax类的对象的语法组成,代表了面向对象的ASN.1规范的SMI管理信息,由SNMP使用。
BecausecoffeeTemperaturehasnotaconstantvalue,weneedtoredefinethevirtualmemberfunctionget_requestinheritedfromMibLeaftogettheactualtemperatureofthecoffeefromthemanagementinstrumentation.Totranslatebetweenthedifferentmanagementinformationrepresentationsusedbythemanagementinstrumentation(temperaturemeasuredinFahrenheit)andtheSNMPMIBdefinition(Celsius)themethodget_coffee_temperatureisused.
因为coffeeTemperature没有常量,我们需要重新定义从MibLeaf继承而来的get_request函数,以便从管理机制中得到实际的coffee的温度。
ThecoffeeTemperature:
:
get_requestmethodfirstgetstheactualtemperatureandstoresitinvaluewhichisapointertotheSnmpSyntaxobjectthathasbeengivenasthirdparametertotheMibLeafconstructor.ThenMibLeaf:
:
get_requestiscalledtoactuallyanswertheSNMPrequestusingthevalueofvalue.That’Sall!
EverythingelseisdonebyAGENT++.
coffeeTemperature:
:
get_request方法第一次得到实际的温度把它存到了value,这是一个指向SnmpSyntax对象的指针,构造的时候采用了MibLeaf的第三个参数。
然后MibLeaf:
:
get_request被调用,使用value值来应答SNMP的请求,其它事情都由AGENT++处理了。
∙Figure1:
AnexampleforamainroutineofaSNMPagent
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- Agent 中英文 对照 译文