diff options
Diffstat (limited to 'lib/snmp/src/manager')
-rw-r--r-- | lib/snmp/src/manager/snmpm.erl | 622 | ||||
-rw-r--r-- | lib/snmp/src/manager/snmpm_conf.erl | 5 | ||||
-rw-r--r-- | lib/snmp/src/manager/snmpm_mpd.erl | 4 |
3 files changed, 11 insertions, 620 deletions
diff --git a/lib/snmp/src/manager/snmpm.erl b/lib/snmp/src/manager/snmpm.erl index f590892c66..6ac0115dad 100644 --- a/lib/snmp/src/manager/snmpm.erl +++ b/lib/snmp/src/manager/snmpm.erl @@ -107,63 +107,9 @@ async_get_bulk/5, async_get_bulk/6, async_get_bulk/7, async_get_bulk/8 ]). -%% Backward compatibility exports (API version "1") --deprecated({agent_info, 3}). --deprecated({update_agent_info, 5}). --deprecated({g, 3}). --deprecated({g, 4}). --deprecated({g, 5}). --deprecated({g, 6}). --deprecated({g, 7}). --deprecated({ag, 3}). --deprecated({ag, 4}). --deprecated({ag, 5}). --deprecated({ag, 6}). --deprecated({ag, 7}). --deprecated({gn, 3}). --deprecated({gn, 4}). --deprecated({gn, 5}). --deprecated({gn, 6}). --deprecated({gn, 7}). --deprecated({agn, 3}). --deprecated({agn, 4}). --deprecated({agn, 5}). --deprecated({agn, 6}). --deprecated({agn, 7}). --deprecated({gb, 5}). --deprecated({gb, 6}). --deprecated({gb, 7}). --deprecated({gb, 8}). --deprecated({gb, 9}). --deprecated({agb, 5}). --deprecated({agb, 6}). --deprecated({agb, 7}). --deprecated({agb, 8}). --deprecated({agb, 9}). --deprecated({s, 3}). --deprecated({s, 4}). --deprecated({s, 5}). --deprecated({s, 6}). --deprecated({s, 7}). --deprecated({as, 3}). --deprecated({as, 4}). --deprecated({as, 5}). --deprecated({as, 6}). --deprecated({as, 7}). --export([ - agent_info/3, update_agent_info/5, - g/3, g/4, g/5, g/6, g/7, - ag/3, ag/4, ag/5, ag/6, ag/7, - gn/3, gn/4, gn/5, gn/6, gn/7, - agn/3, agn/4, agn/5, agn/6, agn/7, - gb/5, gb/6, gb/7, gb/8, gb/9, - agb/5, agb/6, agb/7, agb/8, agb/9, - s/3, s/4, s/5, s/6, s/7, - as/3, as/4, as/5, as/6, as/7 - ]). - %% Application internal export -export([start_link/3, snmpm_start_verify/2, snmpm_start_verify/3]). +-export([target_name/1, target_name/2]). -include_lib("snmp/src/misc/snmp_debug.hrl"). @@ -439,32 +385,16 @@ unregister_agent(UserId, Addr, Port) -> Error end. + agent_info(TargetName, Item) -> snmpm_config:agent_info(TargetName, Item). -%% Backward compatibility -agent_info(Addr, Port, Item) -> - case target_name(Addr, Port) of - {ok, TargetName} -> - agent_info(TargetName, Item); - Error -> - Error - end. - update_agent_info(UserId, TargetName, Info) when is_list(Info) -> snmpm_config:update_agent_info(UserId, TargetName, Info). update_agent_info(UserId, TargetName, Item, Val) -> update_agent_info(UserId, TargetName, [{Item, Val}]). -%% Backward compatibility functions -update_agent_info(UserId, Addr, Port, Item, Val) -> - case target_name(Addr, Port) of - {ok, TargetName} -> - update_agent_info(UserId, TargetName, Item, Val); - Error -> - Error - end. which_agents() -> snmpm_config:which_agents(). @@ -552,55 +482,6 @@ sync_get(UserId, TargetName, Context, Oids, Timeout, ExtraInfo) -> %% </BACKWARD-COMPAT> -%% <DEPRECATED> -g(UserId, Addr, Oids) -> - g(UserId, Addr, ?DEFAULT_AGENT_PORT, Oids). - -g(UserId, Addr, CtxName, Oids) when is_list(CtxName) andalso is_list(Oids) -> - g(UserId, Addr, ?DEFAULT_AGENT_PORT, CtxName, Oids); - -g(UserId, Addr, Port, Oids) when is_integer(Port) andalso is_list(Oids) -> - g(UserId, Addr, Port, ?DEFAULT_CONTEXT, Oids); - -g(UserId, Addr, Oids, Timeout) - when is_list(Oids) andalso is_integer(Timeout) -> - g(UserId, Addr, ?DEFAULT_AGENT_PORT, Oids, Timeout). - -g(UserId, Addr, Port, CtxName, Oids) - when is_integer(Port) andalso is_list(CtxName) andalso is_list(Oids) -> - case target_name(Addr, Port) of - {ok, TargetName} -> - sync_get(UserId, TargetName, CtxName, Oids); - Error -> - Error - end; - -g(UserId, Addr, Port, Oids, Timeout) - when is_integer(Port) andalso is_list(Oids) andalso is_integer(Timeout) -> - g(UserId, Addr, Port, ?DEFAULT_CONTEXT, Oids, Timeout); - -g(UserId, Addr, CtxName, Oids, Timeout) - when is_list(CtxName) andalso is_list(Oids) andalso is_integer(Timeout) -> - g(UserId, Addr, ?DEFAULT_AGENT_PORT, CtxName, Oids, Timeout). - -g(UserId, Addr, Port, CtxName, Oids, Timeout) -> - case target_name(Addr, Port) of - {ok, TargetName} -> - sync_get(UserId, TargetName, CtxName, Oids, Timeout); - Error -> - Error - end. - -g(UserId, Addr, Port, CtxName, Oids, Timeout, ExtraInfo) -> - case target_name(Addr, Port) of - {ok, TargetName} -> - sync_get(UserId, TargetName, CtxName, Oids, Timeout, ExtraInfo); - Error -> - Error - end. -%% </DEPRECATED> - - %% --- asynchroneous get-request --- %% @@ -637,55 +518,6 @@ async_get(UserId, TargetName, Context, Oids, Expire, ExtraInfo) -> %% </BACKWARD-COMPAT> -%% <DEPRECATED> -ag(UserId, Addr, Oids) -> - ag(UserId, Addr, ?DEFAULT_AGENT_PORT, Oids). - -ag(UserId, Addr, Port, Oids) when is_integer(Port) andalso is_list(Oids) -> - ag(UserId, Addr, Port, ?DEFAULT_CONTEXT, Oids); - -ag(UserId, Addr, CtxName, Oids) when is_list(CtxName) andalso is_list(Oids) -> - ag(UserId, Addr, ?DEFAULT_AGENT_PORT, CtxName, Oids); - -ag(UserId, Addr, Oids, Expire) when is_list(Oids) andalso is_integer(Expire) -> - ag(UserId, Addr, ?DEFAULT_AGENT_PORT, ?DEFAULT_CONTEXT, Oids, Expire). - -ag(UserId, Addr, Port, CtxName, Oids) - when is_integer(Port) andalso is_list(CtxName) andalso is_list(Oids) -> - case target_name(Addr, Port) of - {ok, TargetName} -> - async_get(UserId, TargetName, CtxName, Oids); - Error -> - Error - end; - -ag(UserId, Addr, Port, Oids, Expire) - when is_integer(Port) andalso is_list(Oids) andalso is_integer(Expire) -> - ag(UserId, Addr, Port, ?DEFAULT_CONTEXT, Oids, Expire); - -ag(UserId, Addr, CtxName, Oids, Expire) - when is_list(CtxName) andalso is_list(Oids) andalso is_integer(Expire) -> - ag(UserId, Addr, ?DEFAULT_AGENT_PORT, CtxName, Oids, Expire). - -ag(UserId, Addr, Port, CtxName, Oids, Expire) -> - case target_name(Addr, Port) of - {ok, TargetName} -> - async_get(UserId, TargetName, CtxName, Oids, Expire); - Error -> - Error - end. - -ag(UserId, Addr, Port, CtxName, Oids, Expire, ExtraInfo) -> - case target_name(Addr, Port) of - {ok, TargetName} -> - async_get(UserId, TargetName, CtxName, Oids, Expire, ExtraInfo); - Error -> - Error - end. -%% </DEPRECATED> - - - %% --- synchroneous get_next-request --- %% @@ -719,55 +551,6 @@ sync_get_next(UserId, TargetName, Context, Oids, Timeout, ExtraInfo) -> %% </BACKWARD-COMPAT> -%% <DEPRECATED> -gn(UserId, Addr, Oids) -> - gn(UserId, Addr, ?DEFAULT_AGENT_PORT, Oids). - -gn(UserId, Addr, CtxName, Oids) when is_list(CtxName) andalso is_list(Oids) -> - gn(UserId, Addr, ?DEFAULT_AGENT_PORT, CtxName, Oids); - -gn(UserId, Addr, Port, Oids) when is_integer(Port) andalso is_list(Oids) -> - gn(UserId, Addr, Port, ?DEFAULT_CONTEXT, Oids); - -gn(UserId, Addr, Oids, Timeout) - when is_list(Oids) andalso is_integer(Timeout) -> - gn(UserId, Addr, ?DEFAULT_AGENT_PORT, Oids, Timeout). - -gn(UserId, Addr, Port, CtxName, Oids) - when is_integer(Port) andalso is_list(CtxName) andalso is_list(Oids) -> - case target_name(Addr, Port) of - {ok, TargetName} -> - sync_get_next(UserId, TargetName, CtxName, Oids); - Error -> - Error - end; - -gn(UserId, Addr, Port, Oids, Timeout) - when is_integer(Port) andalso is_list(Oids) andalso is_integer(Timeout) -> - gn(UserId, Addr, Port, ?DEFAULT_CONTEXT, Oids, Timeout); -gn(UserId, Addr, CtxName, Oids, Timeout) - when is_list(CtxName) andalso is_list(Oids) andalso is_integer(Timeout) -> - gn(UserId, Addr, ?DEFAULT_AGENT_PORT, CtxName, Oids, Timeout). - -gn(UserId, Addr, Port, CtxName, Oids, Timeout) -> - case target_name(Addr, Port) of - {ok, TargetName} -> - sync_get_next(UserId, TargetName, CtxName, Oids, Timeout); - Error -> - Error - end. - -gn(UserId, Addr, Port, CtxName, Oids, Timeout, ExtraInfo) -> - case target_name(Addr, Port) of - {ok, TargetName} -> - sync_get_next(UserId, TargetName, CtxName, Oids, Timeout, ExtraInfo); - Error -> - Error - end. -%% </DEPRECATED> - - - %% --- asynchroneous get_next-request --- %% @@ -801,56 +584,6 @@ async_get_next(UserId, TargetName, Context, Oids, Expire, ExtraInfo) -> %% </BACKWARD-COMPAT> -%% <DEPRECATED> -agn(UserId, Addr, Oids) -> - agn(UserId, Addr, ?DEFAULT_AGENT_PORT, Oids). - -agn(UserId, Addr, CtxName, Oids) when is_list(CtxName) andalso is_list(Oids) -> - agn(UserId, Addr, ?DEFAULT_AGENT_PORT, CtxName, Oids); - -agn(UserId, Addr, Port, Oids) when is_integer(Port) andalso is_list(Oids) -> - agn(UserId, Addr, Port, ?DEFAULT_CONTEXT, Oids); - -agn(UserId, Addr, Oids, Expire) - when is_list(Oids) andalso is_integer(Expire) -> - agn(UserId, Addr, ?DEFAULT_AGENT_PORT, Oids, Expire). - -agn(UserId, Addr, Port, CtxName, Oids) - when is_integer(Port) andalso is_list(CtxName) andalso is_list(Oids) -> - case target_name(Addr, Port) of - {ok, TargetName} -> - async_get_next(UserId, TargetName, CtxName, Oids); - Error -> - Error - end; - -agn(UserId, Addr, Port, Oids, Expire) - when is_integer(Port) andalso is_list(Oids) andalso is_integer(Expire) -> - agn(UserId, Addr, Port, ?DEFAULT_CONTEXT, Oids, Expire); -agn(UserId, Addr, CtxName, Oids, Expire) - when is_list(CtxName) andalso is_list(CtxName) andalso is_integer(Expire) -> - agn(UserId, Addr, ?DEFAULT_AGENT_PORT, CtxName, Oids, Expire). - -agn(UserId, Addr, Port, CtxName, Oids, Expire) -> - case target_name(Addr, Port) of - {ok, TargetName} -> - async_get_next(UserId, TargetName, CtxName, Oids, Expire); - Error -> - Error - end. - -agn(UserId, Addr, Port, CtxName, Oids, Expire, ExtraInfo) -> - case target_name(Addr, Port) of - {ok, TargetName} -> - async_get_next(UserId, TargetName, CtxName, Oids, Expire, - ExtraInfo); - Error -> - Error - end. -%% </DEPRECATED> - - - %% --- synchroneous set-request --- %% @@ -884,64 +617,6 @@ sync_set(UserId, TargetName, Context, VarsAndVals, Timeout, ExtraInfo) -> %% </BACKWARD-COMPAT> -%% <DEPRECATED> -s(UserId, Addr, VarsAndVals) -> - s(UserId, Addr, ?DEFAULT_AGENT_PORT, VarsAndVals). - -s(UserId, Addr, Port, VarsAndVals) - when is_integer(Port) andalso is_list(VarsAndVals) -> - s(UserId, Addr, Port, ?DEFAULT_CONTEXT, VarsAndVals); - -s(UserId, Addr, CtxName, VarsAndVals) - when is_list(CtxName) andalso is_list(VarsAndVals) -> - s(UserId, Addr, ?DEFAULT_AGENT_PORT, CtxName, VarsAndVals); - -s(UserId, Addr, VarsAndVals, Timeout) - when is_list(VarsAndVals) andalso is_integer(Timeout) -> - s(UserId, Addr, ?DEFAULT_AGENT_PORT, VarsAndVals, Timeout). - -s(UserId, Addr, Port, CtxName, VarsAndVals) - when is_integer(Port) andalso - is_list(CtxName) andalso - is_list(VarsAndVals) -> - case target_name(Addr, Port) of - {ok, TargetName} -> - sync_set(UserId, TargetName, CtxName, VarsAndVals); - Error -> - Error - end; - -s(UserId, Addr, Port, VarsAndVals, Timeout) - when is_integer(Port) andalso - is_list(VarsAndVals) andalso - is_integer(Timeout) -> - s(UserId, Addr, Port, ?DEFAULT_CONTEXT, VarsAndVals, Timeout); - -s(UserId, Addr, CtxName, VarsAndVals, Timeout) - when is_list(CtxName) andalso - is_list(VarsAndVals) andalso - is_integer(Timeout) -> - s(UserId, Addr, ?DEFAULT_AGENT_PORT, CtxName, VarsAndVals, Timeout). - -s(UserId, Addr, Port, CtxName, VarsAndVals, Timeout) -> - case target_name(Addr, Port) of - {ok, TargetName} -> - sync_set(UserId, TargetName, CtxName, VarsAndVals, Timeout); - Error -> - Error - end. - -s(UserId, Addr, Port, CtxName, VarsAndVals, Timeout, ExtraInfo) -> - case target_name(Addr, Port) of - {ok, TargetName} -> - sync_set(UserId, TargetName, CtxName, VarsAndVals, Timeout, ExtraInfo); - Error -> - Error - end. -%% </DEPRECATED> - - - %% --- asynchroneous set-request --- %% @@ -975,63 +650,6 @@ async_set(UserId, TargetName, Context, VarsAndVals, Expire, ExtraInfo) -> %% </BACKWARD-COMPAT> -%% <DEPRECATED> -as(UserId, Addr, VarsAndVals) -> - as(UserId, Addr, ?DEFAULT_AGENT_PORT, VarsAndVals). - -as(UserId, Addr, Port, VarsAndVals) - when is_integer(Port) andalso is_list(VarsAndVals) -> - as(UserId, Addr, Port, ?DEFAULT_CONTEXT, VarsAndVals); - -as(UserId, Addr, CtxName, VarsAndVals) - when is_list(CtxName) andalso is_list(VarsAndVals) -> - as(UserId, Addr, ?DEFAULT_AGENT_PORT, CtxName, VarsAndVals); - -as(UserId, Addr, VarsAndVals, Expire) - when is_list(VarsAndVals) andalso is_integer(Expire) -> - as(UserId, Addr, ?DEFAULT_AGENT_PORT, VarsAndVals, Expire). - -as(UserId, Addr, Port, CtxName, VarsAndVals) - when is_integer(Port) andalso - is_list(CtxName) andalso - is_list(VarsAndVals) -> - case target_name(Addr, Port) of - {ok, TargetName} -> - async_set(UserId, TargetName, CtxName, VarsAndVals); - Error -> - Error - end; - -as(UserId, Addr, Port, VarsAndVals, Expire) - when is_integer(Port) andalso - is_list(VarsAndVals) andalso - is_integer(Expire) -> - as(UserId, Addr, Port, ?DEFAULT_CONTEXT, VarsAndVals, Expire); - -as(UserId, Addr, CtxName, VarsAndVals, Expire) - when is_list(CtxName) andalso - is_list(VarsAndVals) andalso - is_integer(Expire) -> - as(UserId, Addr, ?DEFAULT_AGENT_PORT, CtxName, VarsAndVals, Expire). - -as(UserId, Addr, Port, CtxName, VarsAndVals, Expire) -> - case target_name(Addr, Port) of - {ok, TargetName} -> - async_set(UserId, TargetName, CtxName, VarsAndVals, Expire); - Error -> - Error - end. - -as(UserId, Addr, Port, CtxName, VarsAndVals, Expire, ExtraInfo) -> - case target_name(Addr, Port) of - {ok, TargetName} -> - async_set(UserId, TargetName, CtxName, VarsAndVals, Expire, ExtraInfo); - Error -> - Error - end. -%% </DEPRECATED> - - %% --- synchroneous get-bulk --- %% @@ -1091,162 +709,6 @@ sync_get_bulk(UserId, TargetName, NonRep, MaxRep, Context, Oids, Timeout, %% </BACKWARD-COMPAT> -%% <DEPRECATED> -gb(UserId, Addr, NonRep, MaxRep, Oids) -> - %% p("gb -> entry with" - %% "~n UserId: ~p" - %% "~n Addr: ~p" - %% "~n NonRep: ~p" - %% "~n MaxRep: ~p" - %% "~n Oids: ~p", - %% [UserId, Addr, NonRep, MaxRep, Oids]), - gb(UserId, Addr, ?DEFAULT_AGENT_PORT, NonRep, MaxRep, Oids). - -gb(UserId, Addr, Port, NonRep, MaxRep, Oids) - when is_integer(Port) andalso - is_integer(NonRep) andalso - is_integer(MaxRep) andalso - is_list(Oids) -> - %% p("gb -> entry with" - %% "~n UserId: ~p" - %% "~n Addr: ~p" - %% "~n Port: ~p" - %% "~n NonRep: ~p" - %% "~n MaxRep: ~p" - %% "~n Oids: ~p", - %% [UserId, Addr, Port, NonRep, MaxRep, Oids]), - gb(UserId, Addr, Port, NonRep, MaxRep, ?DEFAULT_CONTEXT, Oids); - -gb(UserId, Addr, NonRep, MaxRep, CtxName, Oids) - when is_integer(NonRep) andalso - is_integer(MaxRep) andalso - is_list(CtxName) andalso - is_list(Oids) -> - %% p("gb -> entry with" - %% "~n UserId: ~p" - %% "~n Addr: ~p" - %% "~n NonRep: ~p" - %% "~n MaxRep: ~p" - %% "~n CtxName: ~p" - %% "~n Oids: ~p", - %% [UserId, Addr, NonRep, MaxRep, CtxName, Oids]), - gb(UserId, Addr, ?DEFAULT_AGENT_PORT, NonRep, MaxRep, CtxName, Oids); - -gb(UserId, Addr, NonRep, MaxRep, Oids, Timeout) - when is_integer(NonRep) andalso - is_integer(MaxRep) andalso - is_list(Oids) andalso - is_integer(Timeout) -> - %% p("gb -> entry with" - %% "~n UserId: ~p" - %% "~n Addr: ~p" - %% "~n NonRep: ~p" - %% "~n MaxRep: ~p" - %% "~n Oids: ~p" - %% "~n Timeout: ~p", - %% [UserId, Addr, NonRep, MaxRep, Oids, Timeout]), - gb(UserId, Addr, ?DEFAULT_AGENT_PORT, NonRep, MaxRep, Oids, Timeout). - -gb(UserId, Addr, Port, NonRep, MaxRep, CtxName, Oids) - when is_integer(Port) andalso - is_integer(NonRep) andalso - is_integer(MaxRep) andalso - is_list(CtxName) andalso - is_list(Oids) -> - %% p("gb -> entry with" - %% "~n UserId: ~p" - %% "~n Addr: ~p" - %% "~n Port: ~p" - %% "~n NonRep: ~p" - %% "~n MaxRep: ~p" - %% "~n CtxName: ~p" - %% "~n Oids: ~p", - %% [UserId, Addr, Port, NonRep, MaxRep, CtxName, Oids]), - case target_name(Addr, Port) of - {ok, TargetName} -> - %% p("gb -> TargetName: ~p", [TargetName]), - sync_get_bulk(UserId, TargetName, NonRep, MaxRep, CtxName, Oids); - Error -> - Error - end; - -gb(UserId, Addr, Port, NonRep, MaxRep, Oids, Timeout) - when is_integer(Port) andalso - is_integer(NonRep) andalso - is_integer(MaxRep) andalso - is_list(Oids) andalso - is_integer(Timeout) -> - %% p("gb -> entry with" - %% "~n UserId: ~p" - %% "~n Addr: ~p" - %% "~n Port: ~p" - %% "~n NonRep: ~p" - %% "~n MaxRep: ~p" - %% "~n Oids: ~p" - %% "~n Timeout: ~p", - %% [UserId, Addr, Port, NonRep, MaxRep, Oids, Timeout]), - gb(UserId, Addr, Port, NonRep, MaxRep, ?DEFAULT_CONTEXT, Oids, Timeout); - -gb(UserId, Addr, NonRep, MaxRep, CtxName, Oids, Timeout) - when is_integer(NonRep) andalso - is_integer(MaxRep) andalso - is_list(CtxName) andalso - is_list(Oids) andalso - is_integer(Timeout) -> - %% p("gb -> entry with" - %% "~n UserId: ~p" - %% "~n Addr: ~p" - %% "~n NonRep: ~p" - %% "~n MaxRep: ~p" - %% "~n CtxName: ~p" - %% "~n Oids: ~p" - %% "~n Timeout: ~p", - %% [UserId, Addr, NonRep, MaxRep, CtxName, Oids, Timeout]), - gb(UserId, Addr, ?DEFAULT_AGENT_PORT, NonRep, MaxRep, CtxName, Oids, - Timeout). - -gb(UserId, Addr, Port, NonRep, MaxRep, CtxName, Oids, Timeout) -> - %% p("gb -> entry with" - %% "~n UserId: ~p" - %% "~n Addr: ~p" - %% "~n Port: ~p" - %% "~n NonRep: ~p" - %% "~n MaxRep: ~p" - %% "~n CtxName: ~p" - %% "~n Oids: ~p" - %% "~n Timeout: ~p", - %% [UserId, Addr, Port, NonRep, MaxRep, CtxName, Oids, Timeout]), - case target_name(Addr, Port) of - {ok, TargetName} -> - sync_get_bulk(UserId, TargetName, - NonRep, MaxRep, CtxName, Oids, Timeout); - Error -> - Error - end. - -gb(UserId, Addr, Port, NonRep, MaxRep, CtxName, Oids, Timeout, ExtraInfo) -> - %% p("gb -> entry with" - %% "~n UserId: ~p" - %% "~n Addr: ~p" - %% "~n Port: ~p" - %% "~n NonRep: ~p" - %% "~n MaxRep: ~p" - %% "~n CtxName: ~p" - %% "~n Oids: ~p" - %% "~n Timeout: ~p" - %% "~n ExtraInfo: ~p", - %% [UserId, Addr, Port, NonRep, MaxRep, CtxName, Oids, Timeout, ExtraInfo]), - case target_name(Addr, Port) of - {ok, TargetName} -> - sync_get_bulk(UserId, TargetName, - NonRep, MaxRep, CtxName, Oids, Timeout, ExtraInfo); - Error -> - Error - end. -%% </DEPRECATED> - - - %% --- asynchroneous get-bulk --- %% @@ -1291,81 +753,6 @@ async_get_bulk(UserId, TargetName, NonRep, MaxRep, Context, Oids, Expire, %% </BACKWARD-COMPAT> -%% <DEPRECATED> -agb(UserId, Addr, NonRep, MaxRep, Oids) -> - agb(UserId, Addr, ?DEFAULT_AGENT_PORT, NonRep, MaxRep, Oids). - -agb(UserId, Addr, Port, NonRep, MaxRep, Oids) - when is_integer(Port) andalso - is_integer(NonRep) andalso - is_integer(MaxRep) andalso - is_list(Oids) -> - agb(UserId, Addr, Port, NonRep, MaxRep, ?DEFAULT_CONTEXT, Oids); - -agb(UserId, Addr, NonRep, MaxRep, CtxName, Oids) - when is_integer(NonRep) andalso - is_integer(MaxRep) andalso - is_list(CtxName) andalso - is_list(Oids) -> - agb(UserId, Addr, ?DEFAULT_AGENT_PORT, NonRep, MaxRep, CtxName, Oids); - -agb(UserId, Addr, NonRep, MaxRep, Oids, Expire) - when is_integer(NonRep) andalso - is_integer(MaxRep) andalso - is_list(Oids) andalso - is_integer(Expire) -> - agb(UserId, Addr, ?DEFAULT_AGENT_PORT, NonRep, MaxRep, Oids, Expire). - -agb(UserId, Addr, Port, NonRep, MaxRep, CtxName, Oids) - when is_integer(Port) andalso - is_integer(NonRep) andalso - is_integer(MaxRep), - is_list(CtxName) andalso - is_list(Oids) -> - case target_name(Addr, Port) of - {ok, TargetName} -> - async_get_bulk(UserId, TargetName, - NonRep, MaxRep, CtxName, Oids); - Error -> - Error - end; - -agb(UserId, Addr, Port, NonRep, MaxRep, Oids, Expire) - when is_integer(Port) andalso - is_integer(NonRep) andalso - is_integer(MaxRep) andalso - is_list(Oids) andalso - is_integer(Expire) -> - agb(UserId, Addr, Port, NonRep, MaxRep, ?DEFAULT_CONTEXT, Oids, Expire); - -agb(UserId, Addr, NonRep, MaxRep, CtxName, Oids, Expire) - when is_integer(NonRep) andalso - is_integer(MaxRep) andalso - is_list(CtxName) andalso - is_list(Oids) andalso - is_integer(Expire) -> - agb(UserId, Addr, ?DEFAULT_AGENT_PORT, NonRep, MaxRep, CtxName, Oids). - -agb(UserId, Addr, Port, NonRep, MaxRep, CtxName, Oids, Expire) -> - case target_name(Addr, Port) of - {ok, TargetName} -> - async_get_bulk(UserId, TargetName, - NonRep, MaxRep, CtxName, Oids, Expire); - Error -> - Error - end. - -agb(UserId, Addr, Port, NonRep, MaxRep, CtxName, Oids, Expire, ExtraInfo) -> - case target_name(Addr, Port) of - {ok, TargetName} -> - async_get_bulk(UserId, TargetName, - NonRep, MaxRep, CtxName, Oids, Expire, - ExtraInfo); - Error -> - Error - end. -%% </DEPRECATED> - cancel_async_request(UserId, ReqId) -> snmpm_server:cancel_async_request(UserId, ReqId). @@ -1457,7 +844,7 @@ sys_up_time() -> format_reason(Reason) -> format_reason("", Reason). -format_reason(Prefix, Reason) when is_integer(Prefix) and (Prefix >= 0) -> +format_reason(Prefix, Reason) when is_integer(Prefix) andalso (Prefix >= 0) -> format_reason(lists:duplicate(Prefix, $ ), Reason); format_reason(Prefix, Reason) when is_list(Prefix) -> case (catch do_format_reason(Prefix, Reason)) of @@ -1691,6 +1078,9 @@ format_vb_value(Prefix, _Type, Val) -> %% --- Internal utility functions --- %% +target_name(Addr) -> + target_name(Addr, ?DEFAULT_AGENT_PORT). + target_name(Addr, Port) -> snmpm_config:agent_info(Addr, Port, target_name). diff --git a/lib/snmp/src/manager/snmpm_conf.erl b/lib/snmp/src/manager/snmpm_conf.erl index e50508c489..03dbd028f7 100644 --- a/lib/snmp/src/manager/snmpm_conf.erl +++ b/lib/snmp/src/manager/snmpm_conf.erl @@ -1,7 +1,8 @@ +%% -*- coding: utf-8 -*- %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2006-2010. All Rights Reserved. +%% Copyright Ericsson AB 2006-2012. 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 @@ -365,7 +366,7 @@ do_write_usm_conf(Fd, do_write_usm_conf(Fd, {EngineID, UserName, SecName, AuthP, AuthKey, PrivP, PrivKey}) -> - io:format(Fd, "{\"~s\", \"~s\", \"~s\", �~w, ~w, ~w, ~w}.~n", + io:format(Fd, "{\"~s\", \"~s\", \"~s\", í~w, ~w, ~w, ~w}.~n", [EngineID, UserName, SecName, AuthP, AuthKey, PrivP, PrivKey]); do_write_usm_conf(_Fd, Crap) -> error({bad_usm_conf, Crap}). diff --git a/lib/snmp/src/manager/snmpm_mpd.erl b/lib/snmp/src/manager/snmpm_mpd.erl index d7148bb4a4..953c94ab54 100644 --- a/lib/snmp/src/manager/snmpm_mpd.erl +++ b/lib/snmp/src/manager/snmpm_mpd.erl @@ -591,8 +591,8 @@ sec_engine_id(TargetName) -> %% BMK BMK BMK -%% Denna verkar v�ldigt lik generate_v1_v2c_response_msg! -%% Gemensam? Borde det finnas olikheter? +%% This one looks very similar to lik generate_v1_v2c_response_msg! +%% Common/shared? Should there be differences? %% generate_v1_v2c_msg(Vsn, Pdu, Community, Log) -> ?vdebug("generate_v1_v2c_msg -> encode pdu", []), |