1%%
2%% %CopyrightBegin%
3%%
4%% Copyright Ericsson AB 2019-2019. All Rights Reserved.
5%%
6%% Licensed under the Apache License, Version 2.0 (the "License");
7%% you may not use this file except in compliance with the License.
8%% You may obtain a copy of the License at
9%%
10%%     http://www.apache.org/licenses/LICENSE-2.0
11%%
12%% Unless required by applicable law or agreed to in writing, software
13%% distributed under the License is distributed on an "AS IS" BASIS,
14%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15%% See the License for the specific language governing permissions and
16%% limitations under the License.
17%%
18%% %CopyrightEnd%
19%%
20
21-module(snmpa_get_mechanism).
22
23%%
24%% This module defines the behaviour for the undocumented (hidden)
25%% get-mechanism feature. This allows for implementing your own
26%% handling of get, get-next and get-bulk requests.
27%% Probably only useful for special cases (e.g. optimization).
28%%
29
30
31
32%% ----------- do_get/2,3 -----------------------------------------------------
33
34%% Purpose: Handles all VBs in a request that is inside the
35%%          mibview (local).
36
37-callback do_get(UnsortedVBs    :: [snmp:varbind()],
38                 IsNotification :: boolean(),
39                 Extra          :: term()) ->
40    {noError, 0, ResVBs :: [snmp:varbind()]} |
41    {ErrStatus :: snmp:error_status(), ErrIndex :: snmp:error_index(), []}.
42
43
44%% Purpose: Handles "get-requests".
45
46-callback do_get(MibView        :: snmp_view_based_acm_mib:mibview(),
47                 UnsortedVBs    :: [snmp:varbind()],
48                 IsNotification :: boolean(),
49                 Extra          :: term()) ->
50    {noError, 0, ResVBs :: [snmp:varbind()]} |
51    {ErrStatus :: snmp:error_status(), ErrIndex :: snmp:error_index(), []}.
52
53
54
55
56%% ----------- do_get_next/2 ------------------------------------------------
57
58%% Purpose: Handles "get-next-requests".
59
60-callback do_get_next(MibView     :: snmp_view_based_acm_mib:mibview(),
61                      UnsortedVBs :: [snmp:varbind()],
62                      Extra       :: term()) ->
63    {noError, 0, ResVBs :: [snmp:varbind()]} |
64    {ErrStatus :: snmp:error_status(), ErrIndex :: snmp:error_index(), []}.
65
66
67
68
69%% ----------- do_get_bulk/6 ------------------------------------------------
70
71-callback do_get_bulk(MibView        :: snmp_view_based_acm_mib:mibview(),
72                      NonRepeaters   :: non_neg_integer(),
73                      MaxRepetitions :: non_neg_integer(),
74                      PduMS          :: pos_integer(),
75                      VBs            :: [snmp:varbind()],
76                      MaxVBs         :: pos_integer(),
77                      Extra          :: term()) ->
78    {noError, 0, ResVBs :: [snmp:varbind()]} |
79    {ErrStatus :: snmp:error_status(), ErrIndex :: snmp:error_index(), []}.
80