![]() |
![]() |
![]() |
![]() |
![]() |
Appendix A
Example 7 : The RFC1157-SNMP ASN.1 Module
RFC1157-SNMP DEFINITIONS ::= BEGINIMPORTSObjectName, ObjectSyntax, NetworkAddress, IpAddress, TimeTicksFROM RFC1155-SMI;-- top-level messageMessage ::=SEQUENCE {version INTEGER { version-1(0) }, -- version-1 for this RFCcommunity OCTET STRING, -- community name, for example, "private" or "public"data PDUs --ANY-- -- e.g., PDUs if trivial authentication is being used}comPublic OCTET STRING ::= '7075626C6963'HcomPrivate OCTET STRING ::= '70726976617465'H-- protocol data unitsPDUs ::=CHOICE {get-request GetRequest-PDU,get-next-request GetNextRequest-PDU,get-response GetResponse-PDU,set-request SetRequest-PDU,trap Trap-PDU}-- the individual PDUs and commonly used data types will be defined laterGetRequest-PDU ::= -- Used to retrieve a piece of management information[0] IMPLICITSEQUENCE {request-id RequestID,error-status ErrorStatus, -- always 0error-index ErrorIndex, -- always 0variable-bindings VarBindList}GetNextRequest-PDU ::= -- Used iteratively to retrieve sequences of management information[1] IMPLICITSEQUENCE {request-id RequestID,error-status ErrorStatus, -- always 0error-index ErrorIndex, -- always 0variable-bindings VarBindList}GetResponse-PDU ::= -- Used by the agent to respond with data to requests from the manager[2] IMPLICITSEQUENCE {request-id RequestID,error-status ErrorStatus,error-index ErrorIndex,variable-bindings VarBindList}SetRequest-PDU ::= -- Used to initialize and make a change to a value of the network element[3] IMPLICITSEQUENCE {request-id RequestID,error-status ErrorStatus, -- always 0error-index ErrorIndex, -- always 0variable-bindings VarBindList}Trap-PDU ::= -- Trap == Asynchronous event report from the agent running on the managed system (sent without being asked)-- Used to report an alert or other asynchronous event about a managed system.-- Asynchronous event reports are called notifications in later versions of SNMP[4] IMPLICITSEQUENCE {enterprise OBJECT IDENTIFIER, -- type of object generating trap, see sysObjectID in [5]agent-addr NetworkAddress, -- address of object generating trapgeneric-trap INTEGER { -- generic trap typecoldStart(0),warmStart(1),linkDown(2),linkUp(3),authenticationFailure(4),egpNeighborLoss(5),enterpriseSpecific(6)},specific-trap INTEGER, -- specific code, present even if generic-trap is not enterpriseSpecifictime-stamp TimeTicks, -- time elapsed between the last (re)initialization of the network entity and the generation of the trapvariable-bindings VarBindList -- "interesting" information}-- request/response informationRequestID ::=INTEGERErrorStatus ::=INTEGER {noError(0),tooBig(1),noSuchName(2),badValue(3),readOnly(4),genErr(5)}ErrorIndex ::=INTEGER-- variable bindingsVarBind ::=SEQUENCE {name ObjectName,value ObjectSyntax}VarBindList ::=SEQUENCE OFVarBindENDExample 8 : The RFC1155-SMI ASN.1 Module
RFC1155-SMI DEFINITIONS ::= BEGINEXPORTS -- EVERYTHINGinternet, directory, mgmt, experimental, private, enterprises,ObjectName, ObjectSyntax, SimpleSyntax,ApplicationSyntax, NetworkAddress, IpAddress,Counter, Gauge, TimeTicks, Opaque;-- the path to the rootinternet OBJECT IDENTIFIER ::= { iso(1) org(3) dod(6) 1 }directory OBJECT IDENTIFIER ::= { internet 1 }mgmt OBJECT IDENTIFIER ::= { internet 2 }experimental OBJECT IDENTIFIER ::= { internet 3 }private OBJECT IDENTIFIER ::= { internet 4 }enterprises OBJECT IDENTIFIER ::= { private 1 }-- names of objects in the MIBObjectName ::= OBJECT IDENTIFIER-- syntax of objects in the MIBObjectSyntax ::= CHOICE {simple SimpleSyntax,application-wide ApplicationSyntax}SimpleSyntax ::= CHOICE {number INTEGER,string OCTET STRING,object OBJECT IDENTIFIER,empty NULL}simple-value SimpleSyntax ::= empty : NULLApplicationSyntax ::= CHOICE {address NetworkAddress,counter Counter,gauge Gauge,ticks TimeTicks,arbitrary Opaque-- other application-wide types, as they are-- defined, will be added here}-- application-wide typesNetworkAddress ::=CHOICE {internetIpAddress}IpAddress ::=[APPLICATION 0] -- in network-byte orderIMPLICIT OCTET STRING (SIZE (4))Counter ::=[APPLICATION 1]IMPLICIT INTEGER (0..4294967295)Gauge ::=[APPLICATION 2]IMPLICIT INTEGER (0..4294967295)TimeTicks ::=[APPLICATION 3]IMPLICIT INTEGER (0..4294967295)Opaque ::=[APPLICATION 4] -- arbitrary ASN.1 value,IMPLICIT OCTET STRING -- "double-wrapped"ENDExample 9 : The RFCxxxx-MIBs ASN.1 Module
RFCxxxx-MIBs DEFINITIONS ::= BEGINIMPORTSmgmt, enterprises, NetworkAddress, IpAddress, Counter, Gauge, TimeTicksFROM RFC1155-SMI;mib OBJECT IDENTIFIER ::= { mgmt 1 } -- 1.3.6.1.2.1system OBJECT IDENTIFIER ::= { mib 1 } -- 1.3.6.1.2.1.1interfaces OBJECT IDENTIFIER ::= { mib 2 }at OBJECT IDENTIFIER ::= { mib 3 }ip OBJECT IDENTIFIER ::= { mib 4 }icmp OBJECT IDENTIFIER ::= { mib 5 }tcp OBJECT IDENTIFIER ::= { mib 6 }udp OBJECT IDENTIFIER ::= { mib 7 }egp OBJECT IDENTIFIER ::= { mib 8 }printmib OBJECT IDENTIFIER ::= { mib 43 } -- 1.3.6.1.2.1.43-- sysDescr OBJECT-TYPE-- SYNTAX DisplayString (SIZE (0..255))-- ACCESS read-only-- STATUS mandatory-- DESCRIPTION "A textual description of the entity. This value should include the full name and version-- identification of the system's hardware type, software operating-system, and networking-- software. It is mandatory that this only contain printable ASCII characters."sysDescr OBJECT IDENTIFIER ::= { system 1 }DisplayString ::= OCTET STRINGEND
http://www.ibm.com/rational |
![]() |
![]() |
![]() |
![]() |