RFC1592 - Simple Network Management Protocol Distributed Pro(2)

时间:2005-02-14 来源: 作者: 点击:
dotted notation. +-----------------------------------------------------------------+ | Table 10. Layout SNMP DPI GETNEXT packet | +------------+----------------------------------------------------+ |
  
dotted notation.

+-----------------------------------------------------------------+
| Table 10. Layout SNMP DPI GETNEXT packet |
+------------+----------------------------------------------------+
| OFFSET | FIELD |
+------------+----------------------------------------------------+
| 0 | packet length to follow (MSB to LSB) |
+------------+----------------------------------------------------+
| 2 | protocol major version |
+------------+----------------------------------------------------+
| 3 | protocol minor version |
+------------+----------------------------------------------------+
| 4 | protocol release |
+------------+----------------------------------------------------+
| 5 | packet id (MSB to LSB) |
+------------+----------------------------------------------------+
| 7 | packet type = SNMP_DPI_GETNEXT |
+------------+----------------------------------------------------+
| 8 | community name length (MSB to LSB) |
+------------+----------------------------------------------------+
| 10 | community name |
+------------+----------------------------------------------------+
| 10+L1 | null terminated group ID (with trailing dot) |
+------------+----------------------------------------------------+
| 10+L2 | null terminated instance ID (no trailing dot) |
+------------+----------------------------------------------------+
| 10+L3 | optionally more varBinds (group/instance ID pairs) |
+------------+----------------------------------------------------+
| NOTE: |
| |
| o L1 = length of community name |
| o L2 = L1 + strlen(group ID) + 1 |
| o L3 = L2 + strlen(instance ID) + 1 |
| o group and instance ID strings use selected character set |
+-----------------------------------------------------------------+

3.2.9 GETBULK

When the SNMP agent receives a PDU containing an SNMP GETBULK request
that includes variables for which a sub-agent may be authoritative,
it checks if the sub-agent wants to handle the GETBULK itself (as
specified at registration time). If so, it sends an SNMP DPI GETBULK
packet to the sub-agent.

Such a packet contains the standard SNMP DPI header plus GETBULK
specific data:

o non-repeaters
o max repetitions
o per varBind two null terminated strings (in the selected
character set) representing the group and instance ID in ASN.1
dotted notation.

+-----------------------------------------------------------------+
| Table 11. Layout SNMP DPI GETBULK packet |
+------------+----------------------------------------------------+
| OFFSET | FIELD |
+------------+----------------------------------------------------+
| 0 | packet length to follow (MSB to LSB) |
+------------+----------------------------------------------------+
| 2 | protocol major version |
+------------+----------------------------------------------------+
| 3 | protocol minor version |
+------------+----------------------------------------------------+
| 4 | protocol release |
+------------+----------------------------------------------------+
| 5 | packet id (MSB to LSB) |
+------------+----------------------------------------------------+
| 7 | packet type = SNMP_DPI_GETBULK |
+------------+----------------------------------------------------+
| 8 | non-repeaters (4 octets, MSB to LSB) |
+------------+----------------------------------------------------+
| 12 | max-repetitions (4 octets, MSB to LSB) |
+------------+----------------------------------------------------+
| 16 | null terminated group ID (with trailing dot) |
+------------+----------------------------------------------------+
| 16+L1 | null terminated instance ID (no trailing dot) |
+------------+----------------------------------------------------+
| 16+L2 | optionally more varBinds (group/instance ID pairs) |
+------------+----------------------------------------------------+
| NOTE: |
| |
| o L1 = strlen(group ID) + 1 |
| o L2 = L1 + strlen(instance ID) + 1 |
| o group and instance ID strings use selected character set |
+-----------------------------------------------------------------+

3.2.10 SET, COMMIT AND UNDO

When the SNMP agent receives a PDU containing an SNMP SET request for
a variable that is in a sub-tree registered by a sub-agent, it passes
one of 3 sequences of SNMP DPI packets to the sub-agent:

o SET, COMMIT
This is the normal sequence. The SET request is the first
phase. The sub-agent must verify that the SET request is valid
and that the resources needed are available. The COMMIT
request comes next. The sub-agent must now effectuate the SET
request.
o SET, UNDO
If an SNMP packet has a SET request for multiple varBinds that
reside in different sub-trees, then the agent first sends a SET
to all sub-agents. If any sub-agent returns an error on the
SET, then the agent sends UNDO to those sub-agents that
returned no error on the SET, meaning the SET is being
canceled.
o SET, COMMIT, UNDO
In the very rare circumstance where all sub-agents have
responded error-free to a SET and where one of them fails to
perform the COMMIT, then the agent sends an UNDO to all
involved sub-agents (also those who completed COMMIT).
Sub-agents should try, to the best of their ability, to never
let a commit fail and to undo an already committed set if asked
to do so.

Such packets contain the standard SNMP DPI header plus SET specific
data:

o the community name used in the SNMP PDU. The length is zero
unless view handling was selected by the sub-agent. The length
is also zero if the SNMP PDU was not in SNMPv1 format.
o per varBind:

- two null terminated strings (in the selected character set)
representing the group and instance ID in ASN.1 dotted
notation.
- the type, value length and value to be set.

The permitted types for the type field are defined in Table 17.

See 3.3.4, "Value Representation" for information on how the
value data is represented in the packet value field.

+-----------------------------------------------------------------+
| Table 12. Layout SNMP DPI SET, COMMIT, UNDO packet |
+------------+----------------------------------------------------+
| OFFSET | FIELD |
+------------+----------------------------------------------------+
| 0 | packet length to follow (MSB to LSB) |
+------------+----------------------------------------------------+
| 2 | protocol major version |
+------------+----------------------------------------------------+
| 3 | protocol minor version |
+------------+----------------------------------------------------+
| 4 | protocol release |
+------------+----------------------------------------------------+
| 5 | packet id (MSB to LSB) |
+------------+----------------------------------------------------+
| 7 | packet type = SNMP_DPI_SET/COMMIT/UNDO |
+------------+----------------------------------------------------+
| 8 | community name length (MSB to LSB) |
+------------+----------------------------------------------------+
| 10 | community name |
+------------+----------------------------------------------------+
| 10+L1 | null terminated group ID (with trailing dot) |
+------------+----------------------------------------------------+
| 10+L2 | null terminated instance ID (no trailing dot) |
+------------+----------------------------------------------------+
| 10+L3 | SNMP Variable Type Value |
+------------+----------------------------------------------------+
| 10+L3+1 | Length of value (2 octets, MSB to LSB) |
+------------+----------------------------------------------------+
| 10+L3+3 | Value |
+------------+----------------------------------------------------+
| 10+L4 | optionally more varBinds (sequences of group ID, |
| | instance ID, Type, Length and Value) |
+------------+----------------------------------------------------+
| NOTE: |
| |
| o L1 = length of community name |
| o L2 = L1 + strlen(group ID) + 1 |
| o L3 = L2 + strlen(instance ID) + 1 |
| o L4 = L3 + 3 + length of value |
| o group and instance ID strings use selected character set |
| o OID and DisplayString values use selected character set |
| o Integer values are in network byte order |
+-----------------------------------------------------------------+

3.2.11 RESPONSE

An SNMP sub-agent must respond to a GET, GETNEXT, GETBULK, SET,
COMMIT, UNDO or UNREGISTER request that it has received from the
agent (unless it fails or has a bug ;-)). To do so, it sends an SNMP
DPI RESPONSE packet to the agent.

Such a packet contains the standard SNMP DPI header plus RESPONSE
specific data:

o an error_code,
o an error_index,
o plus for a successful GET, GETNEXT, or GETBULK, the
name/type/length/value tuple(s) representing the returned
object(s). For each varBind this is described as:

- two null terminated strings (in the selected character set)
representing the group and instance ID in ASN.1 dotted
notation.
- the type, value length and value of the object that is
returned.

The permitted types for the type field are defined in Table 17.

See 3.3.4, "Value Representation" for information on how the
value data is represented in the packet value field.

For an unsuccessful GET, GETNEXT or GETBULK, the sub-agent does not
need to return any name/type/length/value tuple(s), because by
definition, the varBind information is the same as in the request to
which this is a response, and the agent still has that information.

The group ID and the packet ID must always be the same as the
corresponding fields in request PDU which has prompted the RESPONSE.

If the response is to a SET, COMMIT or UNDO request, there is no need
to return any varBind information, because by definition, the varBind
information is the same as in the request to which this is a
response, and the agent still has that information.

If the response is to a REGISTER or UNREGISTER, no variable
(instance) is being returned, so the instance ID is the NULL string
(one 0x00 byte). In the response to a REGISTER request indicating
success, the error index contains the priority assigned by the agent.

If the response is to an OPEN, ARE_YOU_THERE or CLOSE, no varBind
data will be passed, so no group ID, instance ID or value data. The
packet will only include the header, the error code and the error

index.

+-----------------------------------------------------------------+
| Table 13. Layout SNMP DPI RESPONSE packet |
+------------+----------------------------------------------------+
| OFFSET | FIELD |
+------------+----------------------------------------------------+
| 0 | packet length to follow (MSB to LSB) |
+------------+----------------------------------------------------+
| 2 | protocol major version |
+------------+----------------------------------------------------+
| 3 | protocol minor version |
+------------+----------------------------------------------------+
| 4 | protocol release |
+------------+----------------------------------------------------+
| 5 | packet id (MSB to LSB) |
+------------+----------------------------------------------------+
| 7 | packet type = SNMP_DPI_RESPONSE |
+------------+----------------------------------------------------+
| 8 | error code (1 octet) |
+------------+----------------------------------------------------+
| 9 | error index (4 octets, MSB to LSB) |
+------------+----------------------------------------------------+
| 15 | null terminated group ID (with trailing dot) |
+------------+----------------------------------------------------+
| 15+L1 | null terminated instance ID (no trailing dot) |
+------------+----------------------------------------------------+
| 15+L2 | SNMP Variable Type Value |
+------------+----------------------------------------------------+
| 15+L2+1 | Length of value (MSB to LSB) |
+------------+----------------------------------------------------+
| 15+L2+3 | Value |
+------------+----------------------------------------------------+
| 15+L3 | optionally more varBinds (sequences of group ID, |
| | instance ID, Type, Length and Value) |
+------------+----------------------------------------------------+
| NOTE: |
| |
| o L1 = strlen(group ID) + 1 |
| o L2 = L1 + strlen(instance ID) + 1 |
| o L3 = L2 + 3 + length of value |
| o group and instance ID strings use selected character set |
| o OID and DisplayString values use selected character set |
| o Integer values are in network byte order |
+-----------------------------------------------------------------+

3.2.12 TRAP

An SNMP sub-agent can request the agent to generate an SNMPv1 or
SNMPv2 TRAP (depending on the trap destinations defined at the agent)
by sending an SNMP DPI TRAP packet to the agent.

Such a packet contains the standard SNMP DPI header plus TRAP
specific data:

o the generic and specific trap codes
o optionally a null terminated string (in the selected character
set) representing the enterprise ID in ASN.1 dotted notation.
This enterprise ID will be sent with the TRAP. If the null
string is passed, then the agent uses the sub-agent Identifier
(OID as passed with the DPI OPEN packet) as the Enterprise ID.
o optionally a set of one or more name/type/length/value tuples.
representing varBinds to be sent with the trap. Each varBind
consists of:

- two null terminated strings (in the selected character set)
representing the group and instance ID in ASN.1 dotted
notation.
- the type, value length and value of the object that is
returned.

The permitted types for the type field are defined in Table 17.

See 3.3.4, "Value Representation" for information on how the
value data is represented in the packet value field.

+-----------------------------------------------------------------+
| Table 14. Layout SNMP DPI TRAP packet |
+------------+----------------------------------------------------+
| OFFSET | FIELD |
+------------+----------------------------------------------------+
| 0 | packet length to follow (MSB to LSB) |
+------------+----------------------------------------------------+
| 2 | protocol major version |
+------------+----------------------------------------------------+
| 3 | protocol minor version |
+------------+----------------------------------------------------+
| 4 | protocol release |
+------------+----------------------------------------------------+
| 5 | packet id (MSB to LSB) |
+------------+----------------------------------------------------+
| 7 | packet type - SNMP_DPI_TRAP |
+------------+----------------------------------------------------+
| 8 | SNMP generic trap code |
+------------+----------------------------------------------------+
| 12 | SNMP specific trap code |
+------------+----------------------------------------------------+
| 14 | null terminated enterprise ID (no trailing dot) |
+------------+----------------------------------------------------+
| 14+L1 | null terminated group ID (with trailing dot) |
+------------+----------------------------------------------------+
| 14+L2 | null terminated instance ID (no trailing dot) |
+------------+----------------------------------------------------+
| 14+L3 | SNMP Variable Type Value |
+------------+----------------------------------------------------+
| 14+L3+1 | Length of value (MSB to LSB) |
+------------+----------------------------------------------------+
| 14+L3+3 | Value |
+------------+----------------------------------------------------+
| 14+L4 | optionally more varBinds (sequences of group ID, |
| | instance ID, Type, Length and Value) |
+------------+----------------------------------------------------+
| NOTE: |
| |
| o L1 = strlen(enterprise ID) + 1 |
| o L2 = L1 + strlen(group ID) + 1 |
| o L3 = L1 + L2 + strlen(instance ID) + 1 |
| o L4 = L1 + L2 + L3 + 3 + length of Value |
| o enterprise, group and instance ID strings use selected |
| character set |
| o OID and DisplayString values use selected character set |
| o Integer values are in network byte order |
+-----------------------------------------------------------------+

3.3 CONSTANTS AND VALUES

This section describes the constants that have been defined for this
version of the SNMP DPI Protocol.

3.3.1 PROTOCOL VERSION AND RELEASE VALUES

+-----------------------------------------------------------------+
| Table 15. Protocol version and release values |
+--------------------------------+--------------------------------+
| FIELD | VALUE |
+--------------------------------+--------------------------------+
| protocol major version | 2 (SNMP DPI protocol) |
+--------------------------------+--------------------------------+
| protocol minor version | 2 (version 2) |
+--------------------------------+--------------------------------+
| protocol release | 0 (release 0) |
+--------------------------------+--------------------------------+

Previous versions of this protocol exist and should preferably be
supported by an agent:

o version 1, release 0, described in [7]

Previous internal versions of this protocol exist and may or may not
be supported by an agent:

o version 1, release 1, experimental within IBM.
o version 1, release 2, experimental within BNR.

3.3.2 PACKET TYPE VALUES

+-----------------------------------------------------------------+
| Table 16. Valid values for the packet type field |
+-------+---------------------------------------------------------+
| VALUE | PACKET TYPE |
+-------+---------------------------------------------------------+
| 1 | SNMP_DPI_GET |
+-------+---------------------------------------------------------+
| 2 | SNMP_DPI_GETNEXT |
+-------+---------------------------------------------------------+
| 3 | SNMP_DPI_SET |
+-------+---------------------------------------------------------+
| 4 | SNMP_DPI_TRAP |
+-------+---------------------------------------------------------+
| 5 | SNMP_DPI_RESPONSE |
+-------+---------------------------------------------------------+
| 6 | SNMP_DPI_REGISTER |
+-------+---------------------------------------------------------+
| 7 | SNMP_DPI_UNREGISTER |
+-------+---------------------------------------------------------+
| 8 | SNMP_DPI_OPEN |
+-------+---------------------------------------------------------+
| 9 | SNMP_DPI_CLOSE |
+-------+---------------------------------------------------------+
| 10 | SNMP_DPI_COMMIT |
+-------+---------------------------------------------------------+
| 11 | SNMP_DPI_UNDO |
+-------+---------------------------------------------------------+
| 12 | SNMP_DPI_GETBULK |
+-------+---------------------------------------------------------+
| 13 | SNMP_DPI_TRAPV2 (not yet used) |
+-------+---------------------------------------------------------+
| 14 | SNMP_DPI_INFORM (not yet used) |
+-------+---------------------------------------------------------+
| 15 | SNMP_DPI_ARE_YOU_THERE |
+-------+---------------------------------------------------------+

3.3.3 VARIABLE TYPE VALUES

+-----------------------------------------------------------------+
| Table 17. Valid values for the Value Type field |
+-------+---------------------------------------------------------+
| VALUE | VALUE TYPE |
+-------+---------------------------------------------------------+
| 129 | SNMP_TYPE_Integer32 |
+-------+---------------------------------------------------------+
| 2 | SNMP_TYPE_OCTET_STRING |
+-------+---------------------------------------------------------+
| 3 | SNMP_TYPE_OBJECT_IDENTIFIER |
+-------+---------------------------------------------------------+
| 4 | SNMP_TYPE_NULL (empty, no value) |
+-------+---------------------------------------------------------+
| 5 | SNMP_TYPE_IpAddress |
+-------+---------------------------------------------------------+
| 134 | SNMP_TYPE_Counter32 |
+-------+---------------------------------------------------------+
| 135 | SNMP_TYPE_Gauge32 |
+-------+---------------------------------------------------------+
| 136 | SNMP_TYPE_TimeTicks (1/100ths seconds) |
+-------+---------------------------------------------------------+
| 9 | SNMP_TYPE_DisplayString |
+-------+---------------------------------------------------------+
| 10 | SNMP_TYPE_BIT_STRING |
+-------+---------------------------------------------------------+
| 11 | SNMP_TYPE_NsapAddress |
+-------+---------------------------------------------------------+
| 140 | SNMP_TYPE_UInteger32 |
+-------+---------------------------------------------------------+
| 13 | SNMP_TYPE_Counter64 |
+-------+---------------------------------------------------------+
| 14 | SNMP_TYPE_Opaque |
+-------+---------------------------------------------------------+
| 15 | SNMP_TYPE_noSuchObject |
+-------+---------------------------------------------------------+
| 16 | SNMP_TYPE_noSuchInstance |
+-------+---------------------------------------------------------+
| 17 | SNMP_TYPE_endOfMibView |
+-------+---------------------------------------------------------+

Notes:

1. A 32-bit integer value has its base base type ORed with 128.
2. DisplayString is a textual convention. An SNMP PDU shows a
type of OCTET_STRING for the value. An agent can handle such
an object as DisplayString if the object is included in some

form of a compiled MIB for the agent. If not, the agent passes
the value as an OCTET_STRING.

3.3.4 VALUE REPRESENTATION

Values in the DPI packets are represented as follows:

o 32-bit integers are 4-byte elements in network byte order, MSB
(most significant byte) first, LSB (least significant byte)
last. Example: '00000001'h represents 1.
o 64-bit integers are 8-byte elements in network byte order, MSB
first, LSB last.
Example: '0000000100000001'h represents 4,294,967,297.
o Object Identifiers are NULL terminated strings in the selected
character set, representing the OID in ASN.1 dotted notation.
The length includes the terminating NULL.
Example ASCII: '312e332e362e312e322e312e312e312e3000'h
represents "1.3.6.1.2.1.1.1.0" which is sysDescr.0.
Example EBCDIC: 'f14bf34bf64bf14bf24bf14bf14bf14bf000'h
represents "1.3.6.1.2.1.1.1.0" which is sysDescr.0.
o DisplayStrings are in the selected character set. The length
specifies the length of the string.
Example ASCII: '6162630d0a'h represents "abc\r\n", no NULL.
Example EBCDIC: '8182830d25'h represents "abc\r\n", no NULL.
o IpAddress, NsapAddress and Opaque are implicit OCTET_STRING, so
they are octets (e.g. IpAddress in network byte order).
o NULL has a zero length for the value, no value data.
o noSuchObject, noSuchInstance and endOfMibView are implicit NULL
and represented as such.
o BIT_STRING is an OCTET_STRING of the form uubbbb...bb, where
the first octet (uu) is 0x00-0x07 and indicates the number of
unused bits in the last octet (bb). The bb octets represent the
bit string itself, where bit zero (0) comes first and so on.

3.3.5 CHARACTER SET SELECTION

In the DPI OPEN packet, the sub-agent can specify the character set
to be used for the representation of:

o group and instance ID in the DPI REGISTER, UNREGISTER, GET,
GETNEXT, GETBULK, SET, UNDO, COMMIT, RESPONSE and TRAP packets.
o sub-agent ID and sub-agent Description in DPI OPEN packet.
o Object Identifiers in the value field for a value of type
SNMP_TYPE_OBJECT_IDENTIFIER.
o DisplayString in the value field for a value of type
SNMP_TYPE_DPI_DisplayString.

The choice is the native character set or the ASCII character set.

The native set is the set native to the platform where the agent
runs. If the native set is ASCII, then character set selection is a
moot point. On non-ASCII based platforms, the agent must convert
between native and ASCII if the native character set is chosen.

3.3.6 ERROR CODE VALUES FOR SNMP DPI RESPONSE PACKETS

When the RESPONSE packet is a response to a GET, GETNEXT, GETBULK,
SET, COMMIT, or UNDO, then the error code can have one of the
following values:

+-----------------------------------------------------------------+
| Table 18. Valid SNMP_ERROR values for RESPONSE error code |
+-------+---------------------------------------------------------+
| VALUE | ERROR CODE |
+-------+---------------------------------------------------------+
| 0 | SNMP_ERROR_noError |
+-------+---------------------------------------------------------+
| 1 | SNMP_ERROR_tooBig |
+-------+---------------------------------------------------------+
| 2 | SNMP_ERROR_noSuchName (SNMPv1, do not use) |
+-------+---------------------------------------------------------+
| 3 | SNMP_ERROR_badValue (SNMPv1, do not use) |
+-------+---------------------------------------------------------+
| 4 | SNMP_ERROR_readOnly (SNMPv1 do not use) |
+-------+---------------------------------------------------------+
| 5 | SNMP_ERROR_genErr |
+-------+---------------------------------------------------------+
| 6 | SNMP_ERROR_noAccess |
+-------+---------------------------------------------------------+
| 7 | SNMP_ERROR_wrongType |
+-------+---------------------------------------------------------+
| 8 | SNMP_ERROR_wrongLength |
+-------+---------------------------------------------------------+
| 9 | SNMP_ERROR_wrongEncoding |
+-------+---------------------------------------------------------+
| 10 | SNMP_ERROR_wrongValue |
+-------+---------------------------------------------------------+
| 11 | SNMP_ERROR_noCreation |
+-------+---------------------------------------------------------+
| 12 | SNMP_ERROR_inconsistentValue |
+-------+---------------------------------------------------------+
| 13 | SNMP_ERROR_resourceUnavailable |
+-------+---------------------------------------------------------+
| 14 | SNMP_ERROR_commitFailed |
+-------+---------------------------------------------------------+
| 15 | SNMP_ERROR_undoFailed |
+-------+---------------------------------------------------------+
| 16 | SNMP_ERROR_authorizationError |
+-------+---------------------------------------------------------+
| 17 | SNMP_ERROR_notWritable |
+-------+---------------------------------------------------------+
| 18 | SNMP_ERROR_inconsistentName |
+-------+---------------------------------------------------------+

When the RESPONSE packet is a response to an OPEN, REGISTER or
UNREGISTER, then the error code can have one of the following values:

+-----------------------------------------------------------------+
| Table 19. Valid SNMP_ERROR_DPI values for RESPONSE error code |
+-------+---------------------------------------------------------+
| VALUE | ERROR CODE |
+-------+---------------------------------------------------------+
| 0 | SNMP_ERROR_DPI_noError |
+-------+---------------------------------------------------------+
| 101 | SNMP_ERROR_DPI_otherError |
+-------+---------------------------------------------------------+
| 102 | SNMP_ERROR_DPI_notFound |
+-------+---------------------------------------------------------+
| 103 | SNMP_ERROR_DPI_alreadyRegistered |
+-------+---------------------------------------------------------+
| 104 | SNMP_ERROR_DPI_higherPriorityRegistered |
+-------+---------------------------------------------------------+
| 105 | SNMP_ERROR_DPI_mustOpenFirst |
+-------+---------------------------------------------------------+
| 106 | SNMP_ERROR_DPI_notAuthorized |
+-------+---------------------------------------------------------+
| 107 | SNMP_ERROR_DPI_viewSelectionNotSupported |
+-------+---------------------------------------------------------+
| 108 | SNMP_ERROR_DPI_getBulkSelectionNotSupported |
+-------+---------------------------------------------------------+
| 109 | SNMP_ERROR_DPI_duplicateSubAgentIdentifier |
+-------+---------------------------------------------------------+
| 110 | SNMP_ERROR_DPI_invalidDisplayString |
+-------+---------------------------------------------------------+
| 111 | SNMP_ERROR_DPI_characterSetSelectionNotSupported |
+-------+---------------------------------------------------------+

3.3.7 UNREGISTER REASON CODES

The following are valid reason codes in an UNREGISTER packet.

+-----------------------------------------------------------------+
| Table 20. Valid UNREGISTER reason codes |
+-------+---------------------------------------------------------+
| VALUE | REASON CODE |
+-------+---------------------------------------------------------+
| 1 | SNMP_UNREGISTER_otherReason |
+-------+---------------------------------------------------------+
| 2 | SNMP_UNREGISTER_goingDown |
+-------+---------------------------------------------------------+
| 3 | SNMP_UNREGISTER_justUnregister |
+-------+---------------------------------------------------------+
| 4 | SNMP_UNREGISTER_newRegistration |
+-------+---------------------------------------------------------+
| 5 | SNMP_UNREGISTER_higherPriorityRegistered |
+-------+---------------------------------------------------------+
| 6 | SNMP_UNREGISTER_byManager |
+-------+---------------------------------------------------------+
| 7 | SNMP_UNREGISTER_timeout |
+-------+---------------------------------------------------------+

3.3.8 CLOSE REASON CODES

The following are valid reason codes in a CLOSE packet.

+-----------------------------------------------------------------+
| Table 21. Valid CLOSE reason codes |
+-------+---------------------------------------------------------+
| VALUE | REASON CODE |
+-------+---------------------------------------------------------+
| 1 | SNMP_CLOSE_otherReason |
+-------+---------------------------------------------------------+
| 2 | SNMP_CLOSE_goingDown |
+-------+---------------------------------------------------------+
| 3 | SNMP_CLOSE_unsupportedVersion |
+-------+---------------------------------------------------------+
| 4 | SNMP_CLOSE_protocolError |
+-------+---------------------------------------------------------+
| 5 | SNMP_CLOSE_authenticationFailure |
+-------+---------------------------------------------------------+
| 6 | SNMP_CLOSE_byManager |
+-------+---------------------------------------------------------+
| 7 | SNMP_CLOSE_timeout |
+-------+---------------------------------------------------------+
| 8 | SNMP_CLOSE_openError |
+-------+---------------------------------------------------------+

4. DPI 2.0 MIB DEFINITION

DPI20-MIB DEFINITIONS ::= BEGIN

-- Objects in this MIB are implemented in the local SNMP agent.

IMPORTS
MODULE-IDENTITY, OBJECT-TYPE, snmpModules, enterprises
FROM SNMPv2-SMI

ibm OBJECT IDENTIFIER ::= { enterprises 2 }
ibmDPI OBJECT IDENTIFIER ::= { ibm 2 }
dpi20MIB OBJECT IDENTIFIER ::= { ibmDPI 1 }

-- dpi20MIB MODULE-IDENTITY
-- LAST-UPDATED "9401210000Z"
-- ORGANIZATION "IBM Research - T.J. Watson Research Center"
-- CONTACT-INFO " Bert Wijnen
-- Postal: IBM International Operations
-- Watsonweg 2
-- 1423 ND Uithoorn
-- The Netherlands

-- Tel: +31 2975 53316
-- Fax: +31 2975 62468
-- E-mail: wijnen@vnet.ibm.com"
-- DESCRIPTION "MIB module describing DPI objects."
-- ::= { snmpModules x }

dpiPort OBJECT IDENTIFIER ::= { dpi20MIB 1 }

dpiPortForTCP OBJECT-TYPE
SYNTAX INTEGER (0..65535)
ACCESS read-only
STATUS mandatory
DESCRIPTION "The TCP port number on which the agent
listens for DPI connections. A zero value
means the agent has no DPI TCP port."
::= { dpiPort 1 }

dpiPortForUDP OBJECT-TYPE
SYNTAX INTEGER (0..65535)
ACCESS read-only
STATUS mandatory
DESCRIPTION "The UDP port number on which the agent
listens for DPI packets. A zero value
means the agent has no DPI UDP port."
::= { dpiPort 2 }
END

5. SUBAGENT CONSIDERATIONS

When implementing a sub-agent, it is strongly recommended to use the
DPI version 2 approach (SNMPv2 based). This means:

o Use SNMPv2 error codes only (even though we have definitions
for the old SNMPv1 error codes).
o Do implement SET, COMMIT, UNDO processing properly.
o For GET requests, use the SNMPv2 approach and pass back
noSuchInstance or noSuchObject value if such is the case.
Continue to process all remaining varBinds in this case.
o For GETNEXT, use the SNMPv2 approach and pass back endOfMibView
value if such is the case. Continue to process all remaining
varBinds in this case.
o When you are processing a request from the agent (GET, GETNEXT,
GETBULK, SET, COMMIT, UNDO) you are supposed to respond within
the timeout period (which you can specify in the OPEN and
REGISTER packets). If you fail to respond within that timeout
period, the agent will most probably close your DPI connection
and then discard your RESPONSE packet if it comes in later. If
you can detect that the response is not going to make it in

time, then you might decide to abort the request and return an
SNMP_ERROR_genErr in the RESPONSE.
o If you have a UDP "connected" sub-agent, or one that uses
another unreliable protocol, you may want to issue an SNMP DPI
ARE_YOU_THERE request once in a while to ensure that the agent
is still alive and still knows about you.
o When you are running on an EBCDIC based machine, and you use
the (default) native character set, then all OID strings (as
used for things like group ID, instance ID, Enterprise ID,
sub-agent ID) and also all variable values of type
OBJECT_IDENTIFIER or DisplayString will be passed to you in
EBCDIC format. When you return a response, you should then
also use EBCDIC FORMAT.
o When you are running on an EBCDIC based machine, and you use
the ASCII character set (specified in DPI OPEN), then all OID
strings (as used for things like group ID, instance ID,
Enterprise ID, sub-agent ID) and also all variable values of
type OBJECT_IDENTIFIER or DisplayString will be passed to you
in ASCII format. When you return a response, you should then
also use ASCII FORMAT.
o When you are running on an ASCII machine, then the character
set selection for you basically is moot. Except maybe when you
connect to an EBCDIC based agent, in which case you may want to
specify in the DPI OPEN packet that you want to use ASCII
character set. After that, all this is transparent to you and
the burden of conversion is on the EBCDIC based agent.
o Please realize that DisplayString is only a textual convention.
In the SNMP PDU (SNMP packet), the type is just an
OCTET_STRING, and from that it is not clear if this is a
DisplayString or any arbitrary data. This means that the agent
can only know about an object being a DisplayString if the
object is included in some sort of a compiled MIB. If it is,
then the agent will use SNMP_TYPE_DisplayString in the type
field of the varBind in a DPI SET packet. When you send a
DisplayString in a RESPONSE packet, the agent will handle it as
such (e.g. translate EBCDIC to ASCII if needed).

5.1 DPI API

The primary goal of this document is to specify the SNMP DPI, a
protocol by which sub-agents can exchange SNMP related information
with an agent. On top of this protocol, one can imagine one or
possibly many Application Programming Interfaces, but those are not
addressed in this document.

However, in order to provide an environment that is more or less
platform independent, we strongly suggest to also define a DPI API.
We have a sample DPI API available, see 9, "Sample Sources for
Anonymous FTP" for a place to obtain that sample DPI API.

5.2 OVERVIEW OF REQUEST PROCESSING

5.2.1 GET PROCESSING

A GET request is the easiest to process. The DPI GET packet holds
one or more varBinds that the sub-agent has taken responsibility for.

If the sub-agent encounters an error while processing the request, it
creates a DPI RESPONSE packet with an appropriate error indication in
the error_code field and sets the error_index to the position of the
varBind at which the error occurs (first varBind is index 1, second
varBind is index 2, and so on). No name/type/length/value
information needs to be provided in the packet, because by
definition, the varBind information is the same as in the request to
which this is a response, and the agent still has that information.

If there are no errors, then the sub-agent creates a DPI RESPONSE
packet in which the error_code is set to SNMP_ERROR_noError (zero)
and error_index is set to zero. The packet must also include the
name/type/length/value of each varBind requested. When you get a
request for a non-existing object or a non-existing instance of an
object, then you must return a NULL value with a type of
SNMP_TYPE_noSuchObject or SNMP_TYPE_noSuchInstance respectively.

These two values are not considered errors, so the error_code and
error_index should be zero.

The DPI RESPONSE packet is then sent back to the agent.

5.2.2 SET PROCESSING

Processing a DPI SET request is more difficult than a DPI GET
request. In the case of a DPI SET packet, additional information is
available in the packet, namely the value type, value length and
value to be set.

If the sub-agent encounters an error while processing the request, it
creates a DPI RESPONSE packet with an appropriate error indication in
the error_code field and an error_index listing the position of the
varBind at which the error occurs (first varBind is index 1, second
varBind is index 2, and so on). No name/type/length/value
information needs to provided in the packet, because by definition,
the varBind information is the same as in the request to which this

is a response, and the agent still has that information.

If there are no errors, then the sub-agent creates a DPI RESPONSE
packet in which the error_code is set to SNMP_ERROR_noError (zero)
and error_index is set to zero. No name/type/length/value
information is needed; by definition the RESPONSE to a SET should
contain exactly the same varBind data as the data present in the
request, so the agent can use the values it already has. (This
suggests that the agent must keep state information, and that is
indeed the case. It needs to do that anyway in order to be able to
later pass the data with a DPI COMMIT or DPI UNDO packet). The sub-
agent must have allocated the required resources and prepared itself
for the SET. It does not yet effectuate the set, that will be done
at COMMIT time.

The sub-agent sends a DPI RESPONSE packet (indicating success or
failure for the preparation phase) back to the agent.

The agent will then issue a SET request for all other varBinds in the
same original SNMP request it received. This may be to the same or
to one or more different sub-agents. Once all SET requests have
returned a "no error" condition, the agent starts sending DPI COMMIT
packets to the sub-agent(s). If any SET request returns an error,
then the agent sends DPI UNDO packets to those sub-agents that
indicated successful processing of the SET preparation phase.

When the sub-agent receives the DPI COMMIT packet, again all the
varBind information will be available in the packet. The sub-agent
can now effectuate the SET request.

If the sub-agent encounters an error while processing the COMMIT
request, it creates a DPI RESPONSE packet with value
SNMP_ERROR_commitFailed in the error_code field and an error_index
that lists at which varBind the error occurs (first varBind is index
1 and so on). No name/type/length/value information is needed. The
fact that a commitFailed error exists does not mean that this error
should be returned easily. A sub-agent should do all that is
possible to make a COMMIT succeed.

If there are no errors, and the SET/COMMIT has been effectuated with
success, then the sub-agent creates a DPI RESPONSE packet in which
the error_code is set to SNMP_ERROR_noError (zero) and error_index is
set to zero. No name/type/length/value information is needed.

So far we have discussed a SET, COMMIT sequence. That happens if all
goes well. However, after a successful SET, the sub-agent may
receive a DPI UNDO packet. The sub-agent must now undo any
preparations it made during the SET processing (like free allocated

memory and such). Even after a COMMIT, a sub-agent may still receive
a DPI UNDO packet. This is the case if some other sub-agent could
not complete a COMMIT request. Because of the SNMP-requirement that
all varBinds in a single SNMP SET request must be changed "as if
simultaneous", all committed changes must be undone if any of the
COMMIT requests fail. In this case the sub-agent must try and undo
the committed SET operation.

If the sub-agent encounters an error while processing the UNDO
request, it creates a DPI RESPONSE packet with value
SNMP_ERROR_undoFailed in the error_code field and an error_index that
lists at which varBind the error occurs (first varBind is index 1 and
so on). No name/type/length/value information is needed. The fact
that an undoFailed error exists does not mean that this error should
be returned easily. A sub-agent should do all that is possible to
make an UNDO succeed.

If there are no errors, and the UNDO has been effectuated with
success, then the sub-agent creates a DPI RESPONSE packet in which
the error_code is set to SNMP_ERROR_noError (zero) and error_index is
set to zero. No name/type/length/value information is needed.

5.2.3 GETNEXT PROCESSING

GETNEXT requests are a bit more complicated to process than a GET.
The DPI GETNEXT packet contains the object(s) on which the GETNEXT
operation must be performed. The semantics of the operation are that
the sub-agent is to return the name/type/length/value of the next
variable it supports whose (ASN.1) name lexicographically follows the
one passed in the group ID (sub-tree) and instance ID.

In this case, the instance ID may not be present (NULL) implying that
the NEXT object must be the first instance of the first object in the
sub-tree that was registered.

It is important to realize that a given sub-agent may support several
discontiguous sections of the MIB tree. In such a situation it would
be incorrect to jump from one section to another. This problem is
correctly handled by examining the group ID in the DPI packet. This
group ID represents the "reason" why the sub-agent is being called.
It holds the prefix of the tree that the sub-agent had indicated it
supported (registered).

If the next variable supported by the sub-agent does not begin with
that prefix, the sub-agent must return the same object instance as in
the request (e.g. group ID and instance ID) with a value of
SNMP_TYPE_endOfMibView (implied NULL value). This endOfMibView is
not considered an error, so the error_code and error_index should be

zero. If required, the SNMP agent will call upon the sub-agent
again, but pass it a different group ID (prefix). This is
illustrated in the discussion below.

Assume there are two sub-agents. The first sub-agent registers two
distinct sections of the tree, A and C. In reality, the sub-agent
supports variables A.1 and A.2, but it correctly registers the
minimal prefix required to uniquely identify the variable class it
supports.

The second sub-agent registers a different section, B, which appears
between the two sections registered by the first agent.

If a management station begins dumping the MIB, starting from A, the
following sequence of queries of the form get-next(group ID, instance
ID) would be performed:

Sub-agent 1 gets called:
get-next(A,none) = A.1
get-next(A,1) = A.2
get-next(A,2) = endOfMibView

Sub-agent 2 is then called:
get-next(B,none) = B.1
get-next(B,1) = endOfMibView

Sub-agent 1 gets called again:
get-next(C,none) = C.1

5.2.4 GETBULK PROCESSING

You can ask the agent to translate GETBULK requests into multiple
GETNEXT requests. This is basically the default and it is specified
in the DPI REGISTER packet. In principle, we expect the majority of
DPI sub-agents to run on the same machine as the agent (or otherwise,
on the same physical network), so repetitive GETNEXT requests stay
local and in general should not be a problem.

If experience tells us different, the sub-agent can tell the agent to
pass on a DPI GETBULK packet.

When a GETBULK request is received, the sub-agent must process the
request and send a RESPONSE that sends back as many varBinds as
requested by the request, as long as they fit with in the buffers.

The GETBULK requires similar processing as a GETNEXT with regard to
endOfMibView handling.

5.2.5 OPEN REQUEST

As the very first step, a DPI sub-agent must open a "connection" with
the agent. To do so, it must send a DPI OPEN packet in which these
things must be specified:

o The max timeout value in seconds. The agent is requested to
wait this long for a response to any request for an object
being handled by this sub-agent. The agent may have an
absolute maximum timeout value which will be used if the
sub-agent asks for too big a timeout value. A value of zero
can be used to indicate that the agent's own default timeout
value should be used. A sub-agent is advised to use a
reasonably short interval of a few seconds or so. If a
specific sub-tree needs a (much) longer time, then a specific
REGISTER can be done for that sub-tree with a longer timeout
value.
o The maximum number of varBinds that the sub-agent is prepared
to handle per DPI packet. Specifying 1 would result in DPI
version 1 behavior of one varBind per DPI packet that the agent
sends to the sub-agent.
o The character set you want to use. By default (value 0) this is
the native character set of the machine (platform) where the
agent runs.
Since the sub-agent and agent normally run on the same system
or platform, you want to use the native character set (which on
many platforms is ASCII anyway).
If your platform is EBCDIC based, then using the native
character set of EBCDIC makes it easy to recognize the string
representations of the fields like group ID, instance ID, etc.

At the same time, the agent will translate the value from ASCII
NVT to EBCDIC (and vice versa) for objects that it knows (from
a compiled MIB) to have a textual convention of DisplayString.
Be aware that this fact cannot be determined from the SNMP PDU
encoding because in the PDU the object is only known to be an
OCTET_STRING.
If your sub-agent runs on an ASCII based platform and the agent
runs on an EBCDIC based platform (or the other way around),
then you can specify that you want to use the ASCII character
set, and so you both know how to handle the string-based data.
Beware that not all agents need to support other than native
character set selection. See 5, "Subagent Considerations"
and 3.3.5, "Character set selection" for more information on
character set usage.
o The sub-agent ID. This an ASN.1 Object Identifier that
uniquely identifies the sub-agent. This OID is represented as
a null terminated string using the selected character set.

Example: "1.3.5.1.2.3.4.5".
o The sub-agent Description. This is a DisplayString describing
the sub-agent. This is a character string using the selected
character set. Example: "DPI sample sub-agent version 2.0"

Once a sub-agent has sent a DPI OPEN packet to an agent, it should
expect a DPI RESPONSE packet that informs the sub-agent about the
result of the request. The packet ID of the RESPONSE packet should
be the same as that of the OPEN request to which the RESPONSE packet
is the response. See Table 19 for a list of valid DPI RESPONSE error
codes that may be expected. If you receive an error RESPONSE on the
OPEN packet, then you will also receive a DPI CLOSE packet with an
SNMP_CLOSE_openError code, and then the agent closes the
"connection".

If the OPEN is accepted, then the next step is to REGISTER one or
more MIB sub-trees.

5.2.6 CLOSE REQUEST

When a sub-agent is finished and wants to terminate it should first
UNREGISTER its sub-trees and then close the "connection" with the
agent. To do so, it must send a DPI CLOSE packet in which it
specifies a reason for the closing. See Table 21 for a list of valid
------分隔线----------------------------
顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------
最新评论 查看所有评论
发表评论 查看所有评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 密码: 验证码:
推荐内容