aboutsummaryrefslogtreecommitdiffstats
path: root/lib/snmp/src
diff options
context:
space:
mode:
Diffstat (limited to 'lib/snmp/src')
-rw-r--r--lib/snmp/src/manager/snmpm.erl7
-rw-r--r--lib/snmp/src/manager/snmpm_internal.hrl2
-rw-r--r--lib/snmp/src/manager/snmpm_server.erl51
3 files changed, 36 insertions, 24 deletions
diff --git a/lib/snmp/src/manager/snmpm.erl b/lib/snmp/src/manager/snmpm.erl
index 36b4901e9a..7657f6df6e 100644
--- a/lib/snmp/src/manager/snmpm.erl
+++ b/lib/snmp/src/manager/snmpm.erl
@@ -145,12 +145,13 @@
-export([start_link/3, snmpm_start_verify/2, snmpm_start_verify/3]).
--include("snmp_debug.hrl").
+-include_lib("snmp/src/misc/snmp_debug.hrl").
+-include_lib("snmp/include/snmp_types.hrl").
-include("snmpm_atl.hrl").
--include("snmp_types.hrl").
+-include("snmpm_internal.hrl").
-define(DEFAULT_AGENT_PORT, 161).
--define(DEFAULT_CONTEXT, "").
+%% -define(DEFAULT_CONTEXT, "").
%% This function is called when the snmp application
diff --git a/lib/snmp/src/manager/snmpm_internal.hrl b/lib/snmp/src/manager/snmpm_internal.hrl
index 5d9b32e3f6..389aeaf197 100644
--- a/lib/snmp/src/manager/snmpm_internal.hrl
+++ b/lib/snmp/src/manager/snmpm_internal.hrl
@@ -20,6 +20,8 @@
-ifndef(snmpm_internal).
-define(snmpm_internal, true).
+-define(DEFAULT_CONTEXT, "").
+
-include_lib("snmp/src/app/snmp_internal.hrl").
-define(snmpm_info(F, A), ?snmp_info("manager", F, A)).
diff --git a/lib/snmp/src/manager/snmpm_server.erl b/lib/snmp/src/manager/snmpm_server.erl
index cf29770244..3b49267994 100644
--- a/lib/snmp/src/manager/snmpm_server.erl
+++ b/lib/snmp/src/manager/snmpm_server.erl
@@ -237,8 +237,8 @@ unregister_user(UserId) ->
%% The reason why we have a sync_get2 is to simplify backward
%% compatibillity.
-sync_get2(UserId, TargetName, Oids) ->
- sync_get2(UserId, TargetName, Oids, []).
+%% sync_get2(UserId, TargetName, Oids) ->
+%% sync_get2(UserId, TargetName, Oids, []).
sync_get2(UserId, TargetName, Oids, Opts) ->
call({sync_get, self(), UserId, TargetName, Oids, Opts}).
@@ -264,8 +264,8 @@ sync_get(UserId, TargetName, CtxName, Oids, Timeout, ExtraInfo)
%% -- [async] get --
-async_get2(UserId, TargetName, Oids) ->
- async_get2(UserId, TargetName, Oids, []).
+%% async_get2(UserId, TargetName, Oids) ->
+%% async_get2(UserId, TargetName, Oids, []).
async_get2(UserId, TargetName, Oids, SendOpts) ->
call({async_get, self(), UserId, TargetName, Oids, SendOpts}).
@@ -291,8 +291,8 @@ async_get(UserId, TargetName, CtxName, Oids, Expire, ExtraInfo)
%% -- [sync] get-next --
-sync_get_next2(UserId, TargetName, Oids) ->
- sync_get_next2(UserId, TargetName, Oids, []).
+%% sync_get_next2(UserId, TargetName, Oids) ->
+%% sync_get_next2(UserId, TargetName, Oids, []).
sync_get_next2(UserId, TargetName, Oids, SendOpts) ->
call({sync_get_next, self(), UserId, TargetName, Oids, SendOpts}).
@@ -319,8 +319,8 @@ sync_get_next(UserId, TargetName, CtxName, Oids, Timeout, ExtraInfo)
%% -- [async] get-next --
-async_get_next2(UserId, TargetName, Oids) ->
- async_get_next2(UserId, TargetName, Oids, []).
+%% async_get_next2(UserId, TargetName, Oids) ->
+%% async_get_next2(UserId, TargetName, Oids, []).
async_get_next2(UserId, TargetName, Oids, SendOpts) ->
call({async_get_next, self(), UserId, TargetName, Oids, SendOpts}).
@@ -345,8 +345,8 @@ async_get_next(UserId, TargetName, CtxName, Oids, Expire, ExtraInfo)
%% -- [sync] get-bulk --
-sync_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids) ->
- sync_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids, []).
+%% sync_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids) ->
+%% sync_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids, []).
sync_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids, SendOpts) ->
call({sync_get_bulk, self(), UserId, TargetName,
NonRep, MaxRep, Oids, SendOpts}).
@@ -375,8 +375,8 @@ sync_get_bulk(UserId, TargetName, NonRep, MaxRep, CtxName, Oids, Timeout,
%% -- [async] get-bulk --
-async_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids) ->
- async_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids, []).
+%% async_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids) ->
+%% async_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids, []).
async_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids, SendOpts) ->
call({async_get_bulk, self(), UserId, TargetName, NonRep, MaxRep,
Oids, SendOpts}).
@@ -408,8 +408,8 @@ async_get_bulk(UserId, TargetName, NonRep, MaxRep, CtxName, Oids, Expire,
%% -- [sync] set --
%% VarsAndValues is: {PlainOid, o|s|i, Value} (unknown mibs) | {Oid, Value}
-sync_set2(UserId, TargetName, VarsAndVals) ->
- sync_set2(UserId, TargetName, VarsAndVals, []).
+%% sync_set2(UserId, TargetName, VarsAndVals) ->
+%% sync_set2(UserId, TargetName, VarsAndVals, []).
sync_set2(UserId, TargetName, VarsAndVals, SendOpts) ->
call({sync_set, self(), UserId, TargetName, VarsAndVals, SendOpts}).
@@ -434,8 +434,8 @@ sync_set(UserId, TargetName, CtxName, VarsAndVals, Timeout, ExtraInfo)
%% -- [async] set --
-async_set2(UserId, TargetName, VarsAndVals) ->
- async_set2(UserId, TargetName, VarsAndVals, []).
+%% async_set2(UserId, TargetName, VarsAndVals) ->
+%% async_set2(UserId, TargetName, VarsAndVals, []).
async_set2(UserId, TargetName, VarsAndVals, SendOpts) ->
call({async_set, self(), UserId, TargetName, VarsAndVals, SendOpts}).
@@ -1430,8 +1430,8 @@ handle_async_get_next(Pid, UserId, TargetName, Oids, SendOpts, State) ->
"~n UserId: ~p"
"~n TargetName: ~p"
"~n Oids: ~p"
- "~n Expire: ~p",
- [Pid, UserId, TargetName, Oids, Expire]),
+ "~n SendOpts: ~p",
+ [Pid, UserId, TargetName, Oids, SendOpts]),
case agent_data(TargetName, SendOpts) of
{ok, RegType, Addr, Port, Vsn, MsgData} ->
?vtrace("handle_async_get_next -> send a ~p message", [Vsn]),
@@ -1487,7 +1487,7 @@ handle_async_get_bulk(Pid,
"~n Oids: ~p"
"~n SendOpts: ~p",
[Pid, UserId, TargetName, NonRep, MaxRep, Oids, SendOpts]),
- case agent_data(TargetName, CtxName) of
+ case agent_data(TargetName, SendOpts) of
{ok, RegType, Addr, Port, Vsn, MsgData} ->
?vtrace("handle_async_get_bulk -> send a ~p message", [Vsn]),
Extra = ?GET_EXTRA(SendOpts),
@@ -3146,6 +3146,9 @@ agent_data(TargetName, SendOpts) ->
DefSecLevel = agent_data_item(sec_level, Info),
EngineId = agent_data_item(engine_id, Info),
+ CtxName = agent_data_item(context,
+ SendOpts,
+ ?DEFAULT_CONTEXT),
SecModel = agent_data_item(sec_model,
SendOpts,
@@ -3164,10 +3167,10 @@ agent_data(TargetName, SendOpts) ->
DefSecModel = agent_data_item(sec_model, Info),
Comm = agent_data_item(community,
- SendOPts,
+ SendOpts,
DefComm),
SecModel = agent_data_item(sec_model,
- SendOPts,
+ SendOpts,
DefSecModel),
{Comm, SecModel}
@@ -3336,6 +3339,12 @@ default_agent_config() ->
%%----------------------------------------------------------------------
+get_opt(Key, Default, Opts) ->
+ proplists:get_value(Key, Opts, Default).
+
+
+%%----------------------------------------------------------------------
+
is_started(#state{net_if = _Pid, net_if_mod = _Mod}) ->
%% Mod:is_started(Pid) and snmpm_config:is_started().
case snmpm_config:is_started() of