When implementing a subagent, use the DPI Version 2 approach and keep
the following information in mind:
- Use the SNMP Version 2 error codes only, even though there are
definitions for the SNMP Version 1 error codes.
- Implement the SET, COMMIT, UNDO processing properly.
- Use the SNMP Version 2 approach for GET requests, and pass back
noSuchInstance value or noSuchObject value if appropriate. Continue
to process all remaining varBinds.
More than one varBind can be
specified in the SNMP PDU for the requested operation. For example,
using the SNMP network manager, a user can request the retrieval of
multiple objects in the same request (GET or GETNEXT). The varBind
portion of the PDU sent would include multiple object identifiers
(OIDs). The subagent limitations are passed to the agent through the
max_varBinds parameter on the mkDPIopen call. When the subagent receives
a request from the agent, it needs to handle multiple OIDs per request
if it specified a max_varBinds value other than 1.
- Use the SNMP Version 2 approach for GETNEXT, and pass back endOfMibView
value if appropriate. Continue to process all remaining varBinds.
- Specify the timeout period in the OPEN and REGISTER packets, when
you are processing a request from the agent (GET, GETNEXT, SET, COMMIT,
or UNDO).
If you fail to respond within the timeout period, the
agent will probably close your DPI connection and discard your RESPONSE packet
if it comes in later. If you can detect that the response is not
going to be received in the time period, then you might decide to
stop the request and return an SNMP_ERROR_genErr in the RESPONSE.
- Issue an SNMP DPI ARE_YOU_THERE request periodically to ensure
that the agent is still connected and still knows about you.
- OS/2 runs
on an ASCII based machine. However, when you are running a subagent
on an EBCDIC based machine and you use the (default) native character
set, all OID strings and all variable values of type OBJECT_IDENTIFIER
or DisplayString objects that are known by the agent (in its compiled
MIB) will be passed to you in EBCDIC format. OID strings include
the group ID, instance ID, enterprise ID, and subagent ID. You should
structure your response with the EBCDIC format.
- If you receive an error RESPONSE on the OPEN packet, you will
also receive a DPI CLOSE packet with an SNMP_CLOSE_openError code.
In this situation, the agent closes the connection.
- The DisplayString is only a textual convention. In the SNMP PDU
(SNMP packet), the type is an OCTET_STRING.
When the type is OCTET_STRING,
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,
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.
See the following related information.