aboutsummaryrefslogtreecommitdiffstats
path: root/lib/snmp/src
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2013-05-21 11:44:16 +0200
committerMicael Karlberg <[email protected]>2013-05-21 11:44:16 +0200
commitaea7190a8eec464aecd8dbcbf0e7ebcf23583f5b (patch)
tree528cb4f8b2c801c87439665d0aee652d8ca50981 /lib/snmp/src
parent2d71b25ef2f0edf15012a5f81210ce7f9fe507e8 (diff)
downloadotp-aea7190a8eec464aecd8dbcbf0e7ebcf23583f5b.tar.gz
otp-aea7190a8eec464aecd8dbcbf0e7ebcf23583f5b.tar.bz2
otp-aea7190a8eec464aecd8dbcbf0e7ebcf23583f5b.zip
[snmp/agent] Fixed basic type issues
Defines some basic snmp types in the main snmp api module. Also define some basic snmp agent types in the main snmp agent api module.
Diffstat (limited to 'lib/snmp/src')
-rw-r--r--lib/snmp/src/agent/snmpa.erl16
-rw-r--r--lib/snmp/src/agent/snmpa_mib_data.erl32
-rw-r--r--lib/snmp/src/app/snmp.erl18
3 files changed, 46 insertions, 20 deletions
diff --git a/lib/snmp/src/agent/snmpa.erl b/lib/snmp/src/agent/snmpa.erl
index b45a47ec6b..785276c73d 100644
--- a/lib/snmp/src/agent/snmpa.erl
+++ b/lib/snmp/src/agent/snmpa.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2004-2012. All Rights Reserved.
+%% Copyright Ericsson AB 2004-2013. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -111,13 +111,27 @@
-export([print_mib_info/0, print_mib_tables/0, print_mib_variables/0]).
+-export_type([
+ me/0
+ ]).
+
+
+
-include("snmpa_atl.hrl").
-include("snmpa_internal.hrl").
+-include_lib("snmp/include/snmp_types.hrl"). % type of me needed.
-define(DISCO_EXTRA_INFO, undefined).
%%-----------------------------------------------------------------
+%% Types
+%%-----------------------------------------------------------------
+
+-type me() :: #me{}.
+
+
+%%-----------------------------------------------------------------
%% This utility function is used to convert an old SNMP application
%% config (prior to snmp-4.0) to a SNMP agent config (as of
%% snmp-4.0).
diff --git a/lib/snmp/src/agent/snmpa_mib_data.erl b/lib/snmp/src/agent/snmpa_mib_data.erl
index 30078db3cf..ffacdd5b3a 100644
--- a/lib/snmp/src/agent/snmpa_mib_data.erl
+++ b/lib/snmp/src/agent/snmpa_mib_data.erl
@@ -27,8 +27,6 @@
%% These types should really be defined elsewhere...
-export_type([
- oid/0,
-
mib_storage/0,
mib_storage_dir/0,
mib_storage_action/0,
@@ -39,8 +37,6 @@
mib_view_inclusion/0
]).
--type oid() :: [non_neg_integer()].
-
-type mib_storage() :: ets |
{ets, Dir :: mib_storage_dir()} |
{ets, Dir :: mib_storage_dir(), Action :: mib_storage_action()} |
@@ -56,14 +52,12 @@
-type mib_storage_action() :: clear | keep.
-type mib_view() :: [mib_view_elem()].
--type mib_view_elem() :: {SubTree :: oid(),
+-type mib_view_elem() :: {SubTree :: snmp:oid(),
Mask :: [non_neg_integer()],
Inclusion :: mib_view_inclusion()}.
-type mib_view_mask() :: [non_neg_integer()].
-type mib_view_inclusion() :: 1 | 2. % 1 = included, 2 = excluded
--type me() :: #me{}.
-
-type filename() :: file:filename().
@@ -83,23 +77,25 @@
TeOverride :: boolean()) ->
{ok, NewState :: term()} | {error, Reason :: not_loaded | term()}.
--callback lookup(State :: term(), Oid :: oid()) ->
+-callback lookup(State :: term(), Oid :: snmp:oid()) ->
{false, Reason :: term()} |
- {variable, MibEntry :: me()} |
- {table_column, MibEntry :: me(), TableEntryOid :: oid()} |
- {subagent, SubAgentPid :: pid(), SAOid :: oid()}.
+ {variable, MibEntry :: snmpa:me()} |
+ {table_column, MibEntry :: snmpa:me(), TableEntryOid :: snmp:oid()} |
+ {subagent, SubAgentPid :: pid(), SAOid :: snmp:oid()}.
--callback next(State :: term(), Oid :: oid(), MibView :: mib_view()) ->
+-callback next(State :: term(), Oid :: snmp:oid(), MibView :: mib_view()) ->
endOfView | false |
- {subagent, SubAgentPid :: pid(), SAOid :: oid()} |
- {variable, MibEntry :: me(), VarOid :: oid()} |
- {table, TableOid :: oid(), TableRestOid :: oid(), MibEntry :: me()}.
+ {subagent, SubAgentPid :: pid(), SAOid :: snmp:oid()} |
+ {variable, MibEntry :: snmpa:me(), VarOid :: snmp:oid()} |
+ {table, TableOid :: snmp:oid(), TableRestOid :: snmp:oid(), MibEntry :: snmpa:me()}.
--callback register_subagent(State :: term(), Oid :: oid(), Pid :: pid()) ->
+-callback register_subagent(State :: term(),
+ Oid :: snmp:oid(),
+ Pid :: pid()) ->
{ok, NewState :: term()} | {error, Reason :: term()}.
-callback unregister_subagent(State :: term(),
- PidOrOid :: pid() | oid()) ->
+ PidOrOid :: pid() | snmp:oid()) ->
{ok, NewState :: term()} | % When second arg was a pid()
{ok, NewState :: term(), Pid :: pid()} | % When second arg was a oid()
{error, Reason :: term()}.
@@ -107,7 +103,7 @@
-callback dump(State :: term(), Destination :: io | filename()) ->
ok | {error, Reason :: term()}.
--callback which_mib(State :: term(), Oid :: oid()) ->
+-callback which_mib(State :: term(), Oid :: snmp:oid()) ->
{ok, Mib :: string()} | {error, Reason :: term()}.
-callback which_mibs(State :: term()) ->
diff --git a/lib/snmp/src/app/snmp.erl b/lib/snmp/src/app/snmp.erl
index cd3e3a0055..1bb562654a 100644
--- a/lib/snmp/src/app/snmp.erl
+++ b/lib/snmp/src/app/snmp.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2012. All Rights Reserved.
+%% Copyright Ericsson AB 1996-2013. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -90,6 +90,13 @@
]).
+-export_type([
+ oid/0,
+
+ void/0
+ ]).
+
+
%% This is for XREF
-deprecated([{c, 1, eventually},
{c, 2, eventually},
@@ -143,6 +150,15 @@
-define(APPLICATION, snmp).
+
+%%-----------------------------------------------------------------
+%% Types
+%%-----------------------------------------------------------------
+
+-type oid() :: [non_neg_integer()].
+-type void() :: term().
+
+
%%-----------------------------------------------------------------
%% Application
%%-----------------------------------------------------------------