diff options
author | Micael Karlberg <[email protected]> | 2013-04-28 20:25:09 +0200 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2013-04-28 20:25:09 +0200 |
commit | 39096a9e9183df34299914d0983b17815fdf2730 (patch) | |
tree | bc4f56cd187427715bed173a377a76be0c20bea1 /lib | |
parent | 8f929fad475601ee3cb164a26db3a9065fa7f909 (diff) | |
download | otp-39096a9e9183df34299914d0983b17815fdf2730.tar.gz otp-39096a9e9183df34299914d0983b17815fdf2730.tar.bz2 otp-39096a9e9183df34299914d0983b17815fdf2730.zip |
[snmp/agent] Some minor mib_data behaviour changes
Diffstat (limited to 'lib')
-rw-r--r-- | lib/snmp/src/agent/snmpa_mib_data.erl | 4 | ||||
-rw-r--r-- | lib/snmp/src/agent/snmpa_mib_data_tttn.erl | 20 |
2 files changed, 13 insertions, 11 deletions
diff --git a/lib/snmp/src/agent/snmpa_mib_data.erl b/lib/snmp/src/agent/snmpa_mib_data.erl index 2872ee2127..599cba4b5b 100644 --- a/lib/snmp/src/agent/snmpa_mib_data.erl +++ b/lib/snmp/src/agent/snmpa_mib_data.erl @@ -61,11 +61,9 @@ {ok, NewState :: term(), Pid :: pid()} | % When second arg was a oid() {error, Reason :: term()}. --callback dump(State :: term(), Filename :: string()) -> +-callback dump(State :: term(), Destination :: io | filename()) -> ok | {error, Reason :: term()}. --callback print(State :: term()) -> ok. - -callback which_mib(State :: term(), Oid :: oid()) -> {ok, Mib :: string()} | {error, Reason :: term()}. diff --git a/lib/snmp/src/agent/snmpa_mib_data_tttn.erl b/lib/snmp/src/agent/snmpa_mib_data_tttn.erl index b80d85d2ee..043dbaef6c 100644 --- a/lib/snmp/src/agent/snmpa_mib_data_tttn.erl +++ b/lib/snmp/src/agent/snmpa_mib_data_tttn.erl @@ -16,7 +16,7 @@ %% %% %CopyrightEnd% %% --module(snmpa_mib_data). +-module(snmpa_mib_data_tttn). %%%----------------------------------------------------------------- %%% This module implements the MIB internal data structures. @@ -479,16 +479,20 @@ old_format(LoadedMibs) -> %%---------------------------------------------------------------------- %% A total dump for debugging. %%---------------------------------------------------------------------- -dump(#mib_data{mib_db = MibDb, node_db = NodeDb, tree = Tree}) -> +dump(#mib_data{mib_db = MibDb, + node_db = NodeDb, + tree = Tree}, io) -> (catch io:format("MIB-tables:~n~p~n~n", [snmpa_general_db:tab2list(MibDb)])), (catch io:format("MIB-entries:~n~p~n~n", [snmpa_general_db:tab2list(NodeDb)])), (catch io:format("Tree:~n~p~n", [Tree])), % good luck reading it! - ok. + ok; -dump(#mib_data{mib_db = MibDb, node_db = NodeDb, tree = Tree}, File) -> - case file:open(File,[write]) of +dump(#mib_data{mib_db = MibDb, + node_db = NodeDb, + tree = Tree}, File) -> + case file:open(File, [write]) of {ok, Fd} -> io:format(Fd,"~s~n", [snmp:date_and_time_to_string(snmp:date_and_time())]), @@ -499,10 +503,10 @@ dump(#mib_data{mib_db = MibDb, node_db = NodeDb, tree = Tree}, File) -> io:format(Fd,"Tree:~n~p~n", [Tree]), % good luck reading it! file:close(Fd), ok; - {error,Reason} -> + {error, Reason} -> ?vinfo("~n Failed opening file '~s' for reason ~p", - [File,Reason]), - {error,Reason} + [File, Reason]), + {error, Reason} end. |