When implementing a subagent, it is recommended that you use the DPI Version
2 approach. This includes:
- 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.
- For GET requests, use the SNMP Version 2 approach
and pass back noSuchInstance value or noSuchObject value if appropriate.
Continue to process all remaining varBinds.
- For GETNEXT, use the SNMP Version 2 approach and pass
back endOfMibView value if appropriate. Continue to process all remaining
varBinds.
- When you are processing a request from the agent (GET,
GETNEXT, GETBULK, SET, COMMIT, or UNDO), you are supposed to respond within
the timeout period. You can specify the timeout period in the OPEN and
REGISTER packets.
If you fail to respond within the timeout period, the agent will 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 be received
in the time period, then you might decide to stop the request and return
an SNMP_ERROR_genErr in the RESPONSE.
- You may want to issue an SNMP DPI ARE_YOU_THERE request
periodically to ensure that the agent is still "connected" and still knows
about you.
- For OS/2, you use an ASCII based machine. However,
when you are running on an EBCDIC based machine and you use the (default)
native character set, then all OID strings and all variable values of type
OBJECT_IDENTIFIER or DisplayString will be passed to you in EBCDIC format.
OID strings include the group ID, instance ID, Enterprise ID, and subagent
ID.
When you return a response, you should then also use EBCDIC FORMAT.
- For OS/2, you use an ASCII based machine. However,
when you are running on an EBCDIC based machine and you use the ASCII character
set (specified in DPI OPEN), then all OID strings and all variable values
of type OBJECT_IDENTIFIER or DisplayString will be passed to you in ASCII
format. OID strings include the group ID, instance ID, Enterprise ID, and
subagent ID.
When you return a response, you should then also use ASCII 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".
For OS/2, you use an ASCII based machine. However, when you connect to
an EBCDIC based agent, you may want to specify in the DPI OPEN packet that
you want to use ASCII character set on the agent. This is transparent to
you and the burden of conversion is on the EBCDIC based agent.
- The DisplayString is only a textual convention. In
the SNMP PDU (SNMP packet), the type is just 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.