From c842e38a1be4a92f14a309a6ccb66f33b5585088 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Tue, 26 Mar 2019 11:25:50 +0100 Subject: [snmp|agent] Add the default get-mechanism module snmpa_get Added the snmpa_get module as the default get-mechanism for the agent. This has been done by simply moving the do_get, do_get_next and do_get_bulk functions from the snmpa_agent module. Some functions where also moved into the lib module (with the idea of beeing more generally useful). OTP-15691 --- lib/snmp/src/agent/snmpa_get_mechanism.erl | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'lib/snmp/src/agent/snmpa_get_mechanism.erl') diff --git a/lib/snmp/src/agent/snmpa_get_mechanism.erl b/lib/snmp/src/agent/snmpa_get_mechanism.erl index 1a2133778e..7be4ae79a2 100644 --- a/lib/snmp/src/agent/snmpa_get_mechanism.erl +++ b/lib/snmp/src/agent/snmpa_get_mechanism.erl @@ -24,28 +24,45 @@ %% This module defines the behaviour for the undocumented (hidden) %% get-mechanism feature. This allows for implementing your own %% handling of get, get-next and get-bulk requests. -%% Probably only useful for special cases (optimization). +%% Probably only useful for special cases (e.g. optimization). %% -%% ----------- do_get/3 ----------------------------------------------------- +%% ----------- do_get/2,3 ----------------------------------------------------- + +%% Purpose: Handles all VBs in a request that is inside the +%% mibview (local). + +-callback do_get(UnsortedVBs :: [snmp:varbind()], + IsNotification :: boolean()) -> + {noError, 0, ResVBs :: [snmp:varbind()]} | + {ErrStatus :: snmp:error_status(), ErrIndex :: snmp:error_index(), []}. + + +%% Purpose: Handles "get-requests". -callback do_get(MibView :: snmp_view_based_acm_mib:mibview(), - VBs :: [snmp:varbind()], + UnsortedVBs :: [snmp:varbind()], IsNotification :: boolean()) -> {noError, 0, ResVBs :: [snmp:varbind()]} | {ErrStatus :: snmp:error_status(), ErrIndex :: snmp:error_index(), []}. + + %% ----------- do_get_next/2 ------------------------------------------------ --callback do_get_next(MibView :: snmp_view_based_acm_mib:mibview(), - VBs :: [snmp:varbind()]) -> +%% Purpose: Handles "get-next-requests". + +-callback do_get_next(MibView :: snmp_view_based_acm_mib:mibview(), + UnsortedVBs :: [snmp:varbind()]) -> {noError, 0, ResVBs :: [snmp:varbind()]} | {ErrStatus :: snmp:error_status(), ErrIndex :: snmp:error_index(), []}. + + %% ----------- do_get_bulk/6 ------------------------------------------------ -callback do_get_bulk(MibView :: snmp_view_based_acm_mib:mibview(), -- cgit v1.2.3