diff options
author | Micael Karlberg <[email protected]> | 2019-06-14 11:13:34 +0200 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2019-06-27 17:50:57 +0200 |
commit | 04b795f59e678e550fb8c7650952c5ded1096cef (patch) | |
tree | 27544878eff0b1063babbe3c2c8b3c61bc216852 /lib/snmp/src/agent/snmpa_network_interface.erl | |
parent | 331a5f531326da2d0ac23a1fa40c8a51a749c464 (diff) | |
download | otp-04b795f59e678e550fb8c7650952c5ded1096cef.tar.gz otp-04b795f59e678e550fb8c7650952c5ded1096cef.tar.bz2 otp-04b795f59e678e550fb8c7650952c5ded1096cef.zip |
[snmp|agent] Dialyzer related changes
Changes to satisfy dialyzer. Including changing the definition
of some of the behaviours (use the '-callback' attribute instead
of an explicit behaviour_info/1 function).
Also found and corrected some (apparently minor) bugs.
OTP-15932
Diffstat (limited to 'lib/snmp/src/agent/snmpa_network_interface.erl')
-rw-r--r-- | lib/snmp/src/agent/snmpa_network_interface.erl | 78 |
1 files changed, 53 insertions, 25 deletions
diff --git a/lib/snmp/src/agent/snmpa_network_interface.erl b/lib/snmp/src/agent/snmpa_network_interface.erl index 699fbde671..24985c113e 100644 --- a/lib/snmp/src/agent/snmpa_network_interface.erl +++ b/lib/snmp/src/agent/snmpa_network_interface.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2016. All Rights Reserved. +%% Copyright Ericsson AB 2004-2019. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -19,28 +19,56 @@ %% -module(snmpa_network_interface). --export([behaviour_info/1]). - -behaviour_info(callbacks) -> - [{start_link, 4}, - {get_log_type, 1}, - {set_log_type, 2}, - {get_request_limit, 1}, - {set_request_limit, 2}, - {info, 1}, - {verbosity, 2}]; -behaviour_info(_) -> - undefined. - - -%% behaviour_info(callbacks) -> -%% [{start_link, 4}, -%% {send_pdu, 5}, -%% {send_response_pdu, 6}, -%% {discard_pdu, 6}, -%% {send_pdu_req, 6}, -%% {verbosity, 2}, -%% {change_log_type, 2}]; -%% behaviour_info(_) -> -%% undefined. +%% Note that this behaviour is not enough! +%% There is also a set of mandatory messages which the +%% network interface entity must be able to receive and +%% be able to send. See the documentation for more info. + +-callback start_link(Prio, NoteStore, MasterAgent, Opts) -> + {ok, Pid} | {error, Reason} when + Prio :: low | normal | high, % priority_level(), + NoteStore :: pid(), + MasterAgent :: pid(), + Opts :: [Option], + Option :: {verbosity, snmp:verbosity()} | + {versions, [snmp:version()]} | + term(), + Pid :: pid(), + Reason :: term(). + +-callback info(Pid) -> + Info when + Pid :: pid(), + Info :: [{Key, Value}], + Key :: term(), + Value :: term(). + +-callback verbosity(Pid, Verbosity) -> + snmp:void() when + Pid :: pid(), + Verbosity :: snmp:verbosity(). + +-callback get_log_type(Pid) -> + {ok, LogType} | {error, Reason} when + Pid :: pid(), + LogType :: snmp:atl_type(), + Reason :: term(). + +-callback set_log_type(Pid, NewType) -> + {ok, OldType} | {error, Reason} when + Pid :: pid(), + NewType :: snmp:atl_type(), + OldType :: snmp:atl_type(), + Reason :: term(). + +-callback get_request_limit(Pid) -> + {ok, Limit} when + Pid :: pid(), + Limit :: non_neg_integer() | infinity. + +-callback set_request_limit(Pid, NewLimit) -> + {ok, OldLimit} when + Pid :: pid(), + NewLimit :: non_neg_integer() | infinity, + OldLimit :: non_neg_integer() | infinity. |