Migrating Your SNMP DPI Subagent to Version 2.0
The information presented in this section must be taken as guidelines and
not exact procedures. Your specific implementation will vary from the guidelines
presented.
When you want to change your DPI 1.x based subagent code to the DPI Version
2.0 level use these guidelines for the required actions and the recommended
actions.
Required Actions
- Add a mkDPIopen() call and send the created packet
to the agent. This opens your "DPI connection" with the agent. Wait for
the response and ensure that the open is accepted. You need to pass a subagent
ID (Object Identifier) which must be a unique ASN.1 OID.
See The mkDPIopen() Function
for more information.
- Change your mkDPIregister() calls and pass the parameters
according to the new function prototype. You must also expect a RESPONSE
to the REGISTER request.
See The mkDPIregister() Function
for more information.
- Change mkDPIset() and/or mkDPIlist() calls to the
new mkDPIset() call. Basically all mkDPIset() calls are now of the DPI
1.1 mkDPIlist() form.
See The mkDPIset() Function for
more information.
- Change mkDPItrap() and mkDPItrape() calls to the new
mkDPItrap() call. Basically all mkDPItrap() calls are now of the DPI 1.1
mkDPItrape() form.
See The mkDPItrap() Function
for more information.
- Add code to recognize DPI RESPONSE packets, which
should be expected as a result of OPEN, REGISTER, UNREGISTER requests.
- Add code to expect and handle the DPI UNREGISTER packet
from the agent. It may send such packets if an error occurs or if a higher
priority subagent registers the same sub-tree as you have registered.
- Add code to unregister your sub-tree(s) and close
the "DPI connection" when you want to terminate the subagent.
See The mkDPIunregister() Function
and The mkDPIclose() Function
for more information.
- Change your code to use the new SNMP Version 2 error
codes as defined in the snmp_dpi.h include file.
- Change your code that handles a GET request. It should
return a varBind with SNMP_TYPE_noSuchObject value or SNMP_TYPE_noSuchInstance
value instead of an error SNMP_ERROR_noSuchName if the object or the instance
do not exist. This is not considered an error any more. Therefore, you
should return an SNMP_ERROR_noError with an error index of zero.
- Change your code that handles a GETNEXT request. It
should return a varBind with SNMP_TYPE_endOfMibView value instead of an
error SNMP_ERROR_noSuchName if you reach the end of your MIB or sub-tree.
This is not considered an error any more. Therefore, you should return
an SNMP_ERROR_noError with an error index of zero.
- Change your code that handles SET requests to follow
the two phase SET/COMMIT scheme as described in SET
Processing.
See the sample handling of SET/COMMIT/UNDO in Processing
a SET/COMMIT/UNDO Request.
Recommended Actions
[Back: SNMP DPI API Version 1.1 Considerations]
[Next: A DPI Subagent Example]