diff options
author | Micael Karlberg <[email protected]> | 2011-05-10 14:47:43 +0200 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2011-05-10 14:47:43 +0200 |
commit | 5b331f970ce227cdc8b39c38be2fb4f78238c5d7 (patch) | |
tree | 47db24a71e0336859eea63d24501b5192fdeddfc /lib/snmp/src | |
parent | 258d70ba52d3e5c2ba092b22a4c733d29d6cdb24 (diff) | |
download | otp-5b331f970ce227cdc8b39c38be2fb4f78238c5d7.tar.gz otp-5b331f970ce227cdc8b39c38be2fb4f78238c5d7.tar.bz2 otp-5b331f970ce227cdc8b39c38be2fb4f78238c5d7.zip |
Added (intial) override community stuff.
Diffstat (limited to 'lib/snmp/src')
-rw-r--r-- | lib/snmp/src/app/snmp.appup.src | 189 | ||||
-rw-r--r-- | lib/snmp/src/manager/snmpm.erl | 707 | ||||
-rw-r--r-- | lib/snmp/src/manager/snmpm_server.erl | 223 |
3 files changed, 476 insertions, 643 deletions
diff --git a/lib/snmp/src/app/snmp.appup.src b/lib/snmp/src/app/snmp.appup.src index 2bd26e11db..6353fc979e 100644 --- a/lib/snmp/src/app/snmp.appup.src +++ b/lib/snmp/src/app/snmp.appup.src @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2010. All Rights Reserved. +%% Copyright Ericsson AB 1999-2011. 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 @@ -22,9 +22,17 @@ %% ----- U p g r a d e ------------------------------------------------------- [ + {"4.17.1", + [ + {load_module, snmpm, soft_purge, soft_purge, [snmpm_server]}, + {update, snmpm_server, soft, soft_purge, soft_purge, []} + ] + }, {"4.17", [ - {load_module, snmpa_net_if, soft_purge, soft_purge, []} + {load_module, snmpa_net_if, soft_purge, soft_purge, []}, + {load_module, snmpm, soft_purge, soft_purge, [snmpm_server]}, + {update, snmpm_server, soft, soft_purge, soft_purge, []} ] }, {"4.16.2", @@ -36,7 +44,9 @@ {update, snmpa_agent, soft, soft_purge, soft_purge, []}, {load_module, snmpa_net_if, soft_purge, soft_purge, []}, - {load_module, snmpm_mpd, soft_purge, soft_purge, []} + {load_module, snmpm, soft_purge, soft_purge, [snmpm_server]}, + {load_module, snmpm_mpd, soft_purge, soft_purge, []}, + {update, snmpm_server, soft, soft_purge, soft_purge, []} ] }, {"4.16.1", @@ -52,6 +62,7 @@ {update, snmpa_agent, soft, soft_purge, soft_purge, [snmpa_mib]}, {load_module, snmpa_net_if, soft_purge, soft_purge, []}, + {load_module, snmpm, soft_purge, soft_purge, [snmpm_server]}, {load_module, snmpm_mpd, soft_purge, soft_purge, []}, {update, snmpm_server, soft, soft_purge, soft_purge, []} ] @@ -70,96 +81,28 @@ {update, snmpa_agent, soft, soft_purge, soft_purge, [snmpa_mib]}, {load_module, snmpa_net_if, soft_purge, soft_purge, []}, + {load_module, snmpm, soft_purge, soft_purge, [snmpm_server]}, {load_module, snmpm_mpd, soft_purge, soft_purge, []}, {update, snmpm_net_if, soft, soft_purge, soft_purge, []}, {update, snmpm_server, soft, soft_purge, soft_purge, []} ] - }, - {"4.15", - [ - {load_module, snmp_config, soft_purge, soft_purge, []}, - {load_module, snmp_log, soft_purge, soft_purge, []}, - {load_module, snmp_pdus, soft_purge, soft_purge, []}, - {load_module, snmp_usm, soft_purge, soft_purge, []}, - - {load_module, snmpa, soft_purge, soft_purge, [snmp_log, snmpa_agent]}, - {load_module, snmpa_general_db, soft_purge, soft_purge, []}, - {load_module, snmpa_mpd, soft_purge, soft_purge, [snmpa_usm]}, - {load_module, snmpa_usm, soft_purge, soft_purge, [snmp_usm]}, - {update, snmpa_net_if, {advanced, upgrade_from_pre_4_16}, - soft_purge, soft_purge, [snmpa_agent, snmp_log]}, - {update, snmpa_mib, soft, soft_purge, soft_purge, []}, - {update, snmpa_agent, soft, soft_purge, soft_purge, [snmpa_mib]}, - - {load_module, snmpm_mpd, soft_purge, soft_purge, []}, - {update, snmpm_net_if, {advanced, upgrade_from_pre_4_16}, - soft_purge, soft_purge, [snmpm_config, snmp_log]}, - {update, snmpm_config, soft, soft_purge, soft_purge, []}, - {update, snmpm_server, soft, soft_purge, soft_purge, []} - ] - }, - {"4.14", - [ - {load_module, snmp_config, soft_purge, soft_purge, []}, - {load_module, snmp_log, soft_purge, soft_purge, []}, - {load_module, snmp_pdus, soft_purge, soft_purge, []}, - {load_module, snmp_usm, soft_purge, soft_purge, []}, - - {load_module, snmpa, soft_purge, soft_purge, [snmp_log, snmpa_agent]}, - {load_module, snmpa_general_db, soft_purge, soft_purge, []}, - {load_module, snmpa_mpd, soft_purge, soft_purge, [snmpa_usm]}, - {load_module, snmpa_usm, soft_purge, soft_purge, [snmp_usm]}, - {update, snmpa_net_if, {advanced, upgrade_from_pre_4_16}, - soft_purge, soft_purge, [snmp_log, snmpa_agent]}, - {update, snmpa_mib, soft, soft_purge, soft_purge, []}, - {update, snmpa_agent, soft, soft_purge, soft_purge, [snmpa_mib]}, - - {load_module, snmpm_mpd, soft_purge, soft_purge, []}, - {load_module, snmpm_user, soft_purge, soft_purge, []}, - {load_module, snmpm_user_default, soft_purge, soft_purge, [snmpm_user]}, - {update, snmpm_net_if, {advanced, upgrade_from_pre_4_16}, - soft_purge, soft_purge, [snmpm_config, snmp_log]}, - {update, snmpm_config, soft, soft_purge, soft_purge, []}, - {update, snmpm_server, soft, soft_purge, soft_purge, - [snmpm_user_default]} - ] - }, - {"4.13.5", - [ - {load_module, snmp_config, soft_purge, soft_purge, []}, - {load_module, snmp_log, soft_purge, soft_purge, []}, - {load_module, snmp_pdus, soft_purge, soft_purge, []}, - {load_module, snmp_usm, soft_purge, soft_purge, []}, - - {load_module, snmpa, soft_purge, soft_purge, [snmp_log, snmpa_agent]}, - {load_module, snmpa_general_db, soft_purge, soft_purge, []}, - {load_module, snmpa_mib_data, soft_purge, soft_purge, []}, - {load_module, snmpa_mpd, soft_purge, soft_purge, [snmpa_usm]}, - {load_module, snmpa_usm, soft_purge, soft_purge, [snmp_usm]}, - {update, snmpa_net_if, {advanced, upgrade_from_pre_4_16}, - soft_purge, soft_purge, [snmpa_agent, snmp_log]}, - {update, snmpa_mib, soft, soft_purge, soft_purge, [snmpa_mib_data]}, - {update, snmpa_agent, soft, soft_purge, soft_purge, [snmpa_mib]}, - - {load_module, snmpm_mpd, soft_purge, soft_purge, []}, - {load_module, snmpm_user, soft_purge, soft_purge, []}, - {load_module, snmpm_user_default, soft_purge, soft_purge, [snmpm_user]}, - {update, snmpm_net_if, {advanced, upgrade_from_pre_4_14}, - soft_purge, soft_purge, [snmpm_config, snmp_log]}, - {update, snmpm_config, soft, soft_purge, soft_purge, []}, - {update, snmpm_server, soft, soft_purge, soft_purge, [snmpm_user_default]}, - {add_module, snmpm_net_if_filter}, - {add_module, snmpm_network_interface_filter} - ] } ], %% ------D o w n g r a d e --------------------------------------------------- [ + {"4.17.1", + [ + {load_module, snmpm, soft_purge, soft_purge, [snmpm_server]}, + {update, snmpm_server, soft, soft_purge, soft_purge, []} + ] + }, {"4.17", [ - {load_module, snmpa_net_if, soft_purge, soft_purge, []} + {load_module, snmpa_net_if, soft_purge, soft_purge, []}, + {load_module, snmpm, soft_purge, soft_purge, [snmpm_server]}, + {update, snmpm_server, soft, soft_purge, soft_purge, []} ] }, {"4.16.2", @@ -172,7 +115,9 @@ {update, snmpa_agent, soft, soft_purge, soft_purge, []}, {load_module, snmpa_net_if, soft_purge, soft_purge, []}, - {load_module, snmpm_mpd, soft_purge, soft_purge, []} + {load_module, snmpm, soft_purge, soft_purge, [snmpm_server]}, + {load_module, snmpm_mpd, soft_purge, soft_purge, []}, + {update, snmpm_server, soft, soft_purge, soft_purge, []} ] }, {"4.16.1", @@ -188,6 +133,7 @@ {update, snmpa_agent, soft, soft_purge, soft_purge, [snmpa_mib]}, {load_module, snmpa_net_if, soft_purge, soft_purge, []}, + {load_module, snmpm, soft_purge, soft_purge, [snmpm_server]}, {load_module, snmpm_mpd, soft_purge, soft_purge, []}, {update, snmpm_server, soft, soft_purge, soft_purge, []} ] @@ -206,88 +152,11 @@ {update, snmpa_agent, soft, soft_purge, soft_purge, [snmpa_mib]}, {load_module, snmpa_net_if, soft_purge, soft_purge, []}, + {load_module, snmpm, soft_purge, soft_purge, [snmpm_server]}, {load_module, snmpm_mpd, soft_purge, soft_purge, []}, {update, snmpm_net_if, soft, soft_purge, soft_purge, []}, {update, snmpm_server, soft, soft_purge, soft_purge, []} ] - }, - {"4.15", - [ - {load_module, snmp_config, soft_purge, soft_purge, []}, - {load_module, snmp_log, soft_purge, soft_purge, []}, - {load_module, snmp_pdus, soft_purge, soft_purge, []}, - {load_module, snmp_usm, soft_purge, soft_purge, []}, - - {load_module, snmpa, soft_purge, soft_purge, [snmpa_agent, snmp_log]}, - {load_module, snmpa_general_db, soft_purge, soft_purge, []}, - {load_module, snmpa_mpd, soft_purge, soft_purge, [snmpa_usm]}, - {load_module, snmpa_usm, soft_purge, soft_purge, [snmp_usm]}, - {update, snmpa_net_if, {advanced, downgrade_to_pre_4_16}, - soft_purge, soft_purge, [snmpa_agent, snmp_log]}, - {update, snmpa_mib, soft, soft_purge, soft_purge, []}, - {update, snmpa_agent, soft, soft_purge, soft_purge, [snmpa_mib]}, - - {load_module, snmpm_mpd, soft_purge, soft_purge, []}, - {update, snmpm_net_if, {advanced, downgrade_to_pre_4_16}, - soft_purge, soft_purge, [snmpm_config, snmp_log]}, - {update, snmpm_config, soft, soft_purge, soft_purge, []}, - {update, snmpm_server, soft, soft_purge, soft_purge, []} - ] - }, - {"4.14", - [ - {load_module, snmp_config, soft_purge, soft_purge, []}, - {load_module, snmp_log, soft_purge, soft_purge, []}, - {load_module, snmp_pdus, soft_purge, soft_purge, []}, - {load_module, snmp_usm, soft_purge, soft_purge, []}, - - {load_module, snmpa, soft_purge, soft_purge, [snmpa_agent, snmp_log]}, - {load_module, snmpa_general_db, soft_purge, soft_purge, []}, - {load_module, snmpa_mpd, soft_purge, soft_purge, [snmpa_usm]}, - {load_module, snmpa_usm, soft_purge, soft_purge, [snmp_usm]}, - {update, snmpa_net_if, {advanced, downgrade_to_pre_4_16}, - soft_purge, soft_purge, [snmpa_agent, snmp_log]}, - {update, snmpa_mib, soft, soft_purge, soft_purge, []}, - {update, snmpa_agent, soft, soft_purge, soft_purge, [snmpa_mib]}, - - {load_module, snmpm_mpd, soft_purge, soft_purge, []}, - {load_module, snmpm_user, soft_purge, soft_purge, []}, - {load_module, snmpm_user_default, soft_purge, soft_purge, [snmpm_user]}, - {update, snmpm_net_if, {advanced, downgrade_to_pre_4_16}, - soft_purge, soft_purge, [snmpm_config, snmp_log]}, - {update, snmpm_config, soft, soft_purge, soft_purge, []}, - {update, snmpm_server, soft, soft_purge, soft_purge, - [snmpm_user_default]} - ] - }, - {"4.13.5", - [ - {load_module, snmp_config, soft_purge, soft_purge, []}, - {load_module, snmp_log, soft_purge, soft_purge, []}, - {load_module, snmp_pdus, soft_purge, soft_purge, []}, - {load_module, snmp_usm, soft_purge, soft_purge, []}, - - {load_module, snmpa, soft_purge, soft_purge, [snmp_log, snmpa_agent]}, - {load_module, snmpa_general_db, soft_purge, soft_purge, []}, - {load_module, snmpa_mib_data, soft_purge, soft_purge, []}, - {load_module, snmpa_mpd, soft_purge, soft_purge, [snmpa_usm]}, - {load_module, snmpa_usm, soft_purge, soft_purge, [snmp_usm]}, - {update, snmpa_net_if, {advanced, downgrade_to_pre_4_16}, - soft_purge, soft_purge, [snmpa_agent, snmp_log]}, - {update, snmpa_mib, soft, soft_purge, soft_purge, [snmpa_mib_data]}, - {update, snmpa_agent, soft, soft_purge, soft_purge, [snmpa_mib]}, - - {load_module, snmpm_mpd, soft_purge, soft_purge, []}, - {load_module, snmpm_user, soft_purge, soft_purge, []}, - {load_module, snmpm_user_default, soft_purge, soft_purge, [snmpm_user]}, - {update, snmpm_net_if, {advanced, downgrade_to_pre_4_14}, - soft_purge, soft_purge, [snmpm_config, snmp_log]}, - {update, snmpm_config, soft, soft_purge, soft_purge, []}, - {update, snmpm_server, soft, soft_purge, soft_purge, [snmpm_user_default]}, - - {remove, {snmpm_net_if_filter, soft_purge, brutal_purge}}, - {remove, {snmpm_network_interface_filter, soft_purge, brutal_purge}} - ] } ] }. diff --git a/lib/snmp/src/manager/snmpm.erl b/lib/snmp/src/manager/snmpm.erl index 141addf440..7e801ebc40 100644 --- a/lib/snmp/src/manager/snmpm.erl +++ b/lib/snmp/src/manager/snmpm.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2009. All Rights Reserved. +%% Copyright Ericsson AB 2004-2011. 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 @@ -471,150 +471,70 @@ which_usm_users(EngineID) when is_list(EngineID) -> %% sync_get(UserId, TargetName, Oids) -> -%% p("sync_get -> entry with" -%% "~n UserId: ~p" -%% "~n TargetName: ~p" -%% "~n Oids: ~p", [UserId, TargetName, Oids]), sync_get(UserId, TargetName, ?DEFAULT_CONTEXT, Oids). -sync_get(UserId, TargetName, Context, Oids) when is_list(Oids) -> -%% p("sync_get -> entry with" -%% "~n UserId: ~p" -%% "~n TargetName: ~p" -%% "~n Context: ~p" -%% "~n Oids: ~p", [UserId, TargetName, Context, Oids]), - snmpm_server:sync_get(UserId, TargetName, Context, Oids); - +sync_get(UserId, TargetName, {community, Community}, Oids) + when is_list(Oids) -> + CC = {?DEFAULT_CONTEXT, Community}, + snmpm_server:sync_get(UserId, TargetName, CC, Oids); +sync_get(UserId, TargetName, CC, Oids) when is_list(Oids) -> + snmpm_server:sync_get(UserId, TargetName, CC, Oids); sync_get(UserId, TargetName, Oids, Timeout) when is_integer(Timeout) -> -%% p("sync_get -> entry with" -%% "~n UserId: ~p" -%% "~n TargetName: ~p" -%% "~n Oids: ~p" -%% "~n Timeout: ~p", [UserId, TargetName, Oids, Timeout]), sync_get(UserId, TargetName, ?DEFAULT_CONTEXT, Oids, Timeout). -sync_get(UserId, TargetName, Context, Oids, Timeout) -> -%% p("sync_get -> entry with" -%% "~n UserId: ~p" -%% "~n TargetName: ~p" -%% "~n Context: ~p" -%% "~n Oids: ~p" -%% "~n Timeout: ~p", [UserId, TargetName, Context, Oids, Timeout]), - snmpm_server:sync_get(UserId, TargetName, Context, Oids, Timeout). +sync_get(UserId, TargetName, {community, Community}, Oids, Timeout) -> + CC = {?DEFAULT_CONTEXT, Community}, + snmpm_server:sync_get(UserId, TargetName, CC, Oids, Timeout); +sync_get(UserId, TargetName, CC, Oids, Timeout) -> + snmpm_server:sync_get(UserId, TargetName, CC, Oids, Timeout). -sync_get(UserId, TargetName, Context, Oids, Timeout, ExtraInfo) -> -%% p("sync_get -> entry with" -%% "~n UserId: ~p" -%% "~n TargetName: ~p" -%% "~n Context: ~p" -%% "~n Oids: ~p" -%% "~n Timeout: ~p" -%% "~n ExtraInfo: ~p", -%% [UserId, TargetName, Context, Oids, Timeout, ExtraInfo]), - snmpm_server:sync_get(UserId, TargetName, Context, Oids, Timeout, - ExtraInfo). +sync_get(UserId, TargetName, {community, Community}, + Oids, Timeout, ExtraInfo) -> + CC = {?DEFAULT_CONTEXT, Community}, + snmpm_server:sync_get(UserId, TargetName, CC, Oids, Timeout, ExtraInfo); +sync_get(UserId, TargetName, CC, Oids, Timeout, ExtraInfo) -> + snmpm_server:sync_get(UserId, TargetName, CC, Oids, Timeout, ExtraInfo). g(UserId, Addr, Oids) -> -%% p("g -> entry with" -%% "~n UserId: ~p" -%% "~n Addr: ~p" -%% "~n Oids: ~p", [UserId, Addr, Oids]), g(UserId, Addr, ?DEFAULT_AGENT_PORT, Oids). -g(UserId, Addr, CtxName, Oids) when is_list(CtxName) andalso is_list(Oids) -> -%% p("g -> entry with" -%% "~n UserId: ~p" -%% "~n Addr: ~p" -%% "~n CtxName: ~p" -%% "~n Oids: ~p", [UserId, Addr, CtxName, Oids]), - g(UserId, Addr, ?DEFAULT_AGENT_PORT, CtxName, Oids); - g(UserId, Addr, Port, Oids) when is_integer(Port) andalso is_list(Oids) -> -%% p("g -> entry with" -%% "~n UserId: ~p" -%% "~n Addr: ~p" -%% "~n Port: ~p" -%% "~n Oids: ~p", [UserId, Addr, Port, Oids]), g(UserId, Addr, Port, ?DEFAULT_CONTEXT, Oids); - -g(UserId, Addr, Oids, Timeout) - when is_list(Oids) andalso is_integer(Timeout) -> -%% p("g -> entry with" -%% "~n UserId: ~p" -%% "~n Addr: ~p" -%% "~n Oids: ~p" -%% "~n Timeout: ~p", [UserId, Addr, Oids, Timeout]), +g(UserId, Addr, CC, Oids) when is_list(Oids) -> + g(UserId, Addr, ?DEFAULT_AGENT_PORT, CC, Oids); +g(UserId, Addr, Oids, Timeout) when 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) -> -%% p("g -> entry with" -%% "~n UserId: ~p" -%% "~n Addr: ~p" -%% "~n Port: ~p" -%% "~n Context: ~p" -%% "~n Oids: ~p", [UserId, Addr, Port, CtxName, Oids]), +g(UserId, Addr, Port, CC, Oids) + when is_integer(Port) andalso is_list(Oids) -> case target_name(Addr, Port) of {ok, TargetName} -> -%% p("g -> TargetName: ~p", [TargetName]), - sync_get(UserId, TargetName, CtxName, Oids); + sync_get(UserId, TargetName, CC, Oids); Error -> Error end; g(UserId, Addr, Port, Oids, Timeout) when is_integer(Port) andalso is_list(Oids) andalso is_integer(Timeout) -> -%% p("g -> entry with" -%% "~n UserId: ~p" -%% "~n Addr: ~p" -%% "~n Oids: ~p" -%% "~n Timeout: ~p", -%% [UserId, Addr, Oids, 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) -> -%% p("g -> entry with" -%% "~n UserId: ~p" -%% "~n Addr: ~p" -%% "~n CtxName: ~p" -%% "~n Oids: ~p" -%% "~n Timeout: ~p", -%% [UserId, Addr, CtxName, Oids, Timeout]), - g(UserId, Addr, ?DEFAULT_AGENT_PORT, CtxName, Oids, Timeout). - -g(UserId, Addr, Port, CtxName, Oids, Timeout) -> -%% p("g -> entry with" -%% "~n UserId: ~p" -%% "~n Addr: ~p" -%% "~n Port: ~p" -%% "~n CtxName: ~p" -%% "~n Oids: ~p" -%% "~n Timeout: ~p", -%% [UserId, Addr, Port, CtxName, Oids, Timeout]), +g(UserId, Addr, CC, Oids, Timeout) + when is_list(Oids) andalso is_integer(Timeout) -> + g(UserId, Addr, ?DEFAULT_AGENT_PORT, CC, Oids, Timeout). + +g(UserId, Addr, Port, CC, Oids, Timeout) -> case target_name(Addr, Port) of {ok, TargetName} -> -%% p("g -> TargetName: ~p", [TargetName]), - sync_get(UserId, TargetName, CtxName, Oids, Timeout); + sync_get(UserId, TargetName, CC, Oids, Timeout); Error -> Error end. -g(UserId, Addr, Port, CtxName, Oids, Timeout, ExtraInfo) -> -%% p("g -> entry with" -%% "~n UserId: ~p" -%% "~n Addr: ~p" -%% "~n Port: ~p" -%% "~n CtxName: ~p" -%% "~n Oids: ~p" -%% "~n Timeout: ~p" -%% "~n ExtraInfo: ~p", -%% [UserId, Addr, Port, CtxName, Oids, Timeout, ExtraInfo]), +g(UserId, Addr, Port, CC, Oids, Timeout, ExtraInfo) -> case target_name(Addr, Port) of {ok, TargetName} -> -%% p("g -> TargetName: ~p", [TargetName]), - sync_get(UserId, TargetName, CtxName, Oids, Timeout, ExtraInfo); + sync_get(UserId, TargetName, CC, Oids, Timeout, ExtraInfo); Error -> Error end. @@ -630,18 +550,27 @@ g(UserId, Addr, Port, CtxName, Oids, Timeout, ExtraInfo) -> async_get(UserId, TargetName, Oids) -> async_get(UserId, TargetName, ?DEFAULT_CONTEXT, Oids). -async_get(UserId, TargetName, Context, Oids) when is_list(Oids) -> - snmpm_server:async_get(UserId, TargetName, Context, Oids); - +async_get(UserId, TargetName, {community, Community}, Oids) + when is_list(Oids) -> + CC = {?DEFAULT_CONTEXT, Community}, + snmpm_server:async_get(UserId, TargetName, CC, Oids); +async_get(UserId, TargetName, CC, Oids) when is_list(Oids) -> + snmpm_server:async_get(UserId, TargetName, CC, Oids); async_get(UserId, TargetName, Oids, Expire) when is_integer(Expire) -> async_get(UserId, TargetName, ?DEFAULT_CONTEXT, Oids, Expire). -async_get(UserId, TargetName, Context, Oids, Expire) -> - snmpm_server:async_get(UserId, TargetName, Context, Oids, Expire). +async_get(UserId, TargetName, {community, Community}, Oids, Expire) -> + CC = {?DEFAULT_CONTEXT, Community}, + snmpm_server:async_get(UserId, TargetName, CC, Oids, Expire); +async_get(UserId, TargetName, CC, Oids, Expire) -> + snmpm_server:async_get(UserId, TargetName, CC, Oids, Expire). -async_get(UserId, TargetName, Context, Oids, Expire, ExtraInfo) -> - snmpm_server:async_get(UserId, TargetName, Context, Oids, Expire, - ExtraInfo). +async_get(UserId, TargetName, {community, Community}, + Oids, Expire, ExtraInfo) -> + CC = {?DEFAULT_CONTEXT, Community}, + snmpm_server:async_get(UserId, TargetName, CC, Oids, Expire, ExtraInfo); +async_get(UserId, TargetName, CC, Oids, Expire, ExtraInfo) -> + snmpm_server:async_get(UserId, TargetName, CC, Oids, Expire, ExtraInfo). ag(UserId, Addr, Oids) -> @@ -649,18 +578,17 @@ ag(UserId, Addr, 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, ?DEFAULT_AGENT_PORT, ?DEFAULT_CONTEXT, Oids, Expire); +ag(UserId, Addr, CC, Oids) when is_list(Oids) -> + ag(UserId, Addr, ?DEFAULT_AGENT_PORT, CC, Oids). + -ag(UserId, Addr, Port, CtxName, Oids) - when is_integer(Port) andalso is_list(CtxName) andalso is_list(Oids) -> +ag(UserId, Addr, Port, CC, Oids) + when is_integer(Port) andalso is_list(Oids) -> case target_name(Addr, Port) of {ok, TargetName} -> - async_get(UserId, TargetName, CtxName, Oids); + async_get(UserId, TargetName, CC, Oids); Error -> Error end; @@ -668,23 +596,22 @@ ag(UserId, Addr, Port, CtxName, Oids) 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, CC, Oids, Expire) + when is_list(Oids) andalso is_integer(Expire) -> + ag(UserId, Addr, ?DEFAULT_AGENT_PORT, CC, 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) -> +ag(UserId, Addr, Port, CC, Oids, Expire) -> case target_name(Addr, Port) of {ok, TargetName} -> - async_get(UserId, TargetName, CtxName, Oids, Expire); + async_get(UserId, TargetName, CC, Oids, Expire); Error -> Error end. -ag(UserId, Addr, Port, CtxName, Oids, Expire, ExtraInfo) -> +ag(UserId, Addr, Port, CC, Oids, Expire, ExtraInfo) -> case target_name(Addr, Port) of {ok, TargetName} -> - async_get(UserId, TargetName, CtxName, Oids, Expire, ExtraInfo); + async_get(UserId, TargetName, CC, Oids, Expire, ExtraInfo); Error -> Error end. @@ -697,63 +624,74 @@ ag(UserId, Addr, Port, CtxName, Oids, Expire, ExtraInfo) -> sync_get_next(UserId, TargetName, Oids) -> sync_get_next(UserId, TargetName, ?DEFAULT_CONTEXT, Oids). -sync_get_next(UserId, TargetName, Context, Oids) - when is_list(Context) andalso is_list(Oids) -> - snmpm_server:sync_get_next(UserId, TargetName, Context, Oids); - +sync_get_next(UserId, TargetName, {community, Community}, Oids) + when is_list(Oids) -> + CC = {?DEFAULT_CONTEXT, Community}, + snmpm_server:sync_get_next(UserId, TargetName, CC, Oids); +sync_get_next(UserId, TargetName, CC, Oids) + when is_list(Oids) -> + snmpm_server:sync_get_next(UserId, TargetName, CC, Oids); sync_get_next(UserId, TargetName, Oids, Timeout) - when is_list(Oids) andalso is_integer(Timeout) -> + when is_integer(Timeout) -> sync_get_next(UserId, TargetName, ?DEFAULT_CONTEXT, Oids, Timeout). -sync_get_next(UserId, TargetName, Context, Oids, Timeout) -> - snmpm_server:sync_get_next(UserId, TargetName, Context, Oids, Timeout). -sync_get_next(UserId, TargetName, Context, Oids, Timeout, ExtraInfo) -> - snmpm_server:sync_get_next(UserId, TargetName, Context, Oids, Timeout, +sync_get_next(UserId, TargetName, {community, Community}, Oids, Timeout) -> + CC = {?DEFAULT_CONTEXT, Community}, + snmpm_server:sync_get_next(UserId, TargetName, CC, Oids, Timeout); +sync_get_next(UserId, TargetName, CC, Oids, Timeout) -> + snmpm_server:sync_get_next(UserId, TargetName, CC, Oids, Timeout). + +sync_get_next(UserId, TargetName, {community, Community}, + Oids, Timeout, ExtraInfo) -> + CC = {?DEFAULT_CONTEXT, Community}, + snmpm_server:sync_get_next(UserId, TargetName, CC, Oids, Timeout, + ExtraInfo); +sync_get_next(UserId, TargetName, CC, Oids, Timeout, ExtraInfo) -> + snmpm_server:sync_get_next(UserId, TargetName, CC, Oids, Timeout, ExtraInfo). 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, ?DEFAULT_AGENT_PORT, Oids, Timeout); +gn(UserId, Addr, Port, Oids) + when is_integer(Port) andalso is_list(Oids) -> + gn(UserId, Addr, Port, ?DEFAULT_CONTEXT, Oids); +gn(UserId, Addr, CC, Oids) + when is_list(Oids) -> + gn(UserId, Addr, ?DEFAULT_AGENT_PORT, CC, Oids). -gn(UserId, Addr, Port, CtxName, Oids) - when is_integer(Port) andalso is_list(CtxName) andalso is_list(Oids) -> +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, Port, CC, Oids) + when is_integer(Port) andalso is_list(Oids) -> case target_name(Addr, Port) of {ok, TargetName} -> - sync_get_next(UserId, TargetName, CtxName, Oids); + sync_get_next(UserId, TargetName, CC, 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, CC, Oids, Timeout) + when is_list(Oids) andalso is_integer(Timeout) -> + gn(UserId, Addr, ?DEFAULT_AGENT_PORT, CC, Oids, Timeout). -gn(UserId, Addr, Port, CtxName, Oids, Timeout) -> +gn(UserId, Addr, Port, CC, Oids, Timeout) -> case target_name(Addr, Port) of {ok, TargetName} -> - sync_get_next(UserId, TargetName, CtxName, Oids, Timeout); + sync_get_next(UserId, TargetName, CC, Oids, Timeout); Error -> Error end. -gn(UserId, Addr, Port, CtxName, Oids, Timeout, ExtraInfo) -> +gn(UserId, Addr, Port, CC, Oids, Timeout, ExtraInfo) -> case target_name(Addr, Port) of {ok, TargetName} -> - sync_get_next(UserId, TargetName, CtxName, Oids, Timeout, ExtraInfo); + sync_get_next(UserId, TargetName, CC, Oids, Timeout, ExtraInfo); Error -> Error end. @@ -766,63 +704,72 @@ gn(UserId, Addr, Port, CtxName, Oids, Timeout, ExtraInfo) -> async_get_next(UserId, TargetName, Oids) -> async_get_next(UserId, TargetName, ?DEFAULT_CONTEXT, Oids). -async_get_next(UserId, TargetName, Context, Oids) - when is_list(Context) andalso is_list(Oids) -> - snmpm_server:async_get_next(UserId, TargetName, Context, Oids); - +async_get_next(UserId, TargetName, {community, Community}, Oids) + when is_list(Oids) -> + CC = {?DEFAULT_CONTEXT, Community}, + snmpm_server:async_get_next(UserId, TargetName, CC, Oids); +async_get_next(UserId, TargetName, CC, Oids) + when is_list(Oids) -> + snmpm_server:async_get_next(UserId, TargetName, CC, Oids); async_get_next(UserId, TargetName, Oids, Timeout) - when is_list(Oids) andalso is_integer(Timeout) -> + when is_integer(Timeout) -> async_get_next(UserId, TargetName, ?DEFAULT_CONTEXT, Oids, Timeout). -async_get_next(UserId, TargetName, Context, Oids, Timeout) -> - snmpm_server:async_get_next(UserId, TargetName, Context, Oids, Timeout). - -async_get_next(UserId, TargetName, Context, Oids, Timeout, ExtraInfo) -> - snmpm_server:async_get_next(UserId, TargetName, Context, Oids, Timeout, +async_get_next(UserId, TargetName, {community, Community}, Oids, Timeout) -> + CC = {?DEFAULT_CONTEXT, Community}, + snmpm_server:async_get_next(UserId, TargetName, CC, Oids, Timeout); +async_get_next(UserId, TargetName, CC, Oids, Timeout) -> + snmpm_server:async_get_next(UserId, TargetName, CC, Oids, Timeout). + +async_get_next(UserId, TargetName, {community, Community}, + Oids, Timeout, ExtraInfo) -> + CC = {?DEFAULT_CONTEXT, Community}, + snmpm_server:async_get_next(UserId, TargetName, CC, Oids, Timeout, + ExtraInfo); +async_get_next(UserId, TargetName, CC, Oids, Timeout, ExtraInfo) -> + snmpm_server:async_get_next(UserId, TargetName, CC, Oids, Timeout, ExtraInfo). 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, ?DEFAULT_AGENT_PORT, Oids, Expire); +agn(UserId, Addr, Port, Oids) + when is_integer(Port) andalso is_list(Oids) -> + agn(UserId, Addr, Port, ?DEFAULT_CONTEXT, Oids); +agn(UserId, Addr, CC, Oids) + when is_list(Oids) -> + agn(UserId, Addr, ?DEFAULT_AGENT_PORT, CC, Oids). -agn(UserId, Addr, Port, CtxName, Oids) - when is_integer(Port) andalso is_list(CtxName) andalso is_list(Oids) -> +agn(UserId, Addr, Port, Oids, Expire) + when is_integer(Port) andalso is_integer(Expire) -> + agn(UserId, Addr, Port, ?DEFAULT_CONTEXT, Oids, Expire); +agn(UserId, Addr, CC, Oids, Expire) + when is_integer(Expire) -> + agn(UserId, Addr, ?DEFAULT_AGENT_PORT, CC, Oids, Expire); +agn(UserId, Addr, Port, CC, Oids) + when is_integer(Port) andalso is_list(Oids) -> case target_name(Addr, Port) of {ok, TargetName} -> - async_get_next(UserId, TargetName, CtxName, Oids); + async_get_next(UserId, TargetName, CC, 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). + end. -agn(UserId, Addr, Port, CtxName, Oids, Expire) -> +agn(UserId, Addr, Port, CC, Oids, Expire) -> case target_name(Addr, Port) of {ok, TargetName} -> - async_get_next(UserId, TargetName, CtxName, Oids, Expire); + async_get_next(UserId, TargetName, CC, Oids, Expire); Error -> Error end. -agn(UserId, Addr, Port, CtxName, Oids, Expire, ExtraInfo) -> +agn(UserId, Addr, Port, CC, Oids, Expire, ExtraInfo) -> case target_name(Addr, Port) of {ok, TargetName} -> - async_get_next(UserId, TargetName, CtxName, Oids, Expire, - ExtraInfo); + async_get_next(UserId, TargetName, CC, Oids, Expire, ExtraInfo); Error -> Error end. @@ -835,19 +782,30 @@ agn(UserId, Addr, Port, CtxName, Oids, Expire, ExtraInfo) -> sync_set(UserId, TargetName, VarsAndVals) -> sync_set(UserId, TargetName, ?DEFAULT_CONTEXT, VarsAndVals). -sync_set(UserId, TargetName, Context, VarsAndVals) - when is_list(Context) andalso is_list(VarsAndVals) -> - snmpm_server:sync_set(UserId, TargetName, Context, VarsAndVals); - sync_set(UserId, TargetName, VarsAndVals, Timeout) when is_list(VarsAndVals) andalso is_integer(Timeout) -> - sync_set(UserId, TargetName, ?DEFAULT_CONTEXT, VarsAndVals, Timeout). - -sync_set(UserId, TargetName, Context, VarsAndVals, Timeout) -> - snmpm_server:sync_set(UserId, TargetName, Context, VarsAndVals, Timeout). - -sync_set(UserId, TargetName, Context, VarsAndVals, Timeout, ExtraInfo) -> - snmpm_server:sync_set(UserId, TargetName, Context, VarsAndVals, Timeout, + sync_set(UserId, TargetName, ?DEFAULT_CONTEXT, VarsAndVals, Timeout); +sync_set(UserId, TargetName, {community, Community}, VarsAndVals) + when is_list(VarsAndVals) -> + CC = {?DEFAULT_CONTEXT, Community}, + snmpm_server:sync_set(UserId, TargetName, CC, VarsAndVals); +sync_set(UserId, TargetName, CC, VarsAndVals) + when is_list(VarsAndVals) -> + snmpm_server:sync_set(UserId, TargetName, CC, VarsAndVals). + +sync_set(UserId, TargetName, {community, Community}, VarsAndVals, Timeout) -> + CC = {?DEFAULT_CONTEXT, Community}, + snmpm_server:sync_set(UserId, TargetName, CC, VarsAndVals, Timeout); +sync_set(UserId, TargetName, CC, VarsAndVals, Timeout) -> + snmpm_server:sync_set(UserId, TargetName, CC, VarsAndVals, Timeout). + +sync_set(UserId, TargetName, {community, Community}, + VarsAndVals, Timeout, ExtraInfo) -> + CC = {?DEFAULT_CONTEXT, Community}, + snmpm_server:sync_set(UserId, TargetName, CC, VarsAndVals, Timeout, + ExtraInfo); +sync_set(UserId, TargetName, CC, VarsAndVals, Timeout, ExtraInfo) -> + snmpm_server:sync_set(UserId, TargetName, CC, VarsAndVals, Timeout, ExtraInfo). @@ -857,50 +815,43 @@ s(UserId, Addr, 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, ?DEFAULT_AGENT_PORT, VarsAndVals, Timeout); +s(UserId, Addr, CC, VarsAndVals) + when is_list(VarsAndVals) -> + s(UserId, Addr, ?DEFAULT_AGENT_PORT, CC, VarsAndVals). -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, Port, CC, VarsAndVals) + when is_integer(Port) andalso is_list(VarsAndVals) -> + case target_name(Addr, Port) of + {ok, TargetName} -> + sync_set(UserId, TargetName, CC, VarsAndVals); + Error -> + Error + end; +s(UserId, Addr, CC, VarsAndVals, Timeout) + when is_list(VarsAndVals) andalso is_integer(Timeout) -> + s(UserId, Addr, ?DEFAULT_AGENT_PORT, CC, 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) -> +s(UserId, Addr, Port, CC, VarsAndVals, Timeout) -> case target_name(Addr, Port) of {ok, TargetName} -> - sync_set(UserId, TargetName, CtxName, VarsAndVals, Timeout); + sync_set(UserId, TargetName, CC, VarsAndVals, Timeout); Error -> Error end. -s(UserId, Addr, Port, CtxName, VarsAndVals, Timeout, ExtraInfo) -> +s(UserId, Addr, Port, CC, VarsAndVals, Timeout, ExtraInfo) -> case target_name(Addr, Port) of {ok, TargetName} -> - sync_set(UserId, TargetName, CtxName, VarsAndVals, Timeout, ExtraInfo); + sync_set(UserId, TargetName, CC, VarsAndVals, Timeout, ExtraInfo); Error -> Error end. @@ -913,72 +864,76 @@ s(UserId, Addr, Port, CtxName, VarsAndVals, Timeout, ExtraInfo) -> async_set(UserId, TargetName, VarsAndVals) -> async_set(UserId, TargetName, ?DEFAULT_CONTEXT, VarsAndVals). -async_set(UserId, TargetName, Context, VarsAndVals) - when is_list(Context) andalso is_list(VarsAndVals) -> - snmpm_server:async_set(UserId, TargetName, Context, VarsAndVals); - async_set(UserId, TargetName, VarsAndVals, Expire) when is_list(VarsAndVals) andalso is_integer(Expire) -> - async_set(UserId, TargetName, ?DEFAULT_CONTEXT, VarsAndVals, Expire). - -async_set(UserId, TargetName, Context, VarsAndVals, Expire) -> - snmpm_server:async_set(UserId, TargetName, Context, VarsAndVals, Expire). - -async_set(UserId, TargetName, Context, VarsAndVals, Expire, ExtraInfo) -> - snmpm_server:async_set(UserId, TargetName, Context, VarsAndVals, Expire, + async_set(UserId, TargetName, ?DEFAULT_CONTEXT, VarsAndVals, Expire); +async_set(UserId, TargetName, {community, Community}, VarsAndVals) + when is_list(VarsAndVals) -> + CC = {?DEFAULT_CONTEXT, Community}, + snmpm_server:async_set(UserId, TargetName, CC, VarsAndVals); +async_set(UserId, TargetName, CC, VarsAndVals) + when is_list(VarsAndVals) -> + snmpm_server:async_set(UserId, TargetName, CC, VarsAndVals). + +async_set(UserId, TargetName, {community, Community}, VarsAndVals, Expire) -> + CC = {?DEFAULT_CONTEXT, Community}, + snmpm_server:async_set(UserId, TargetName, CC, VarsAndVals, Expire); +async_set(UserId, TargetName, CC, VarsAndVals, Expire) -> + snmpm_server:async_set(UserId, TargetName, CC, VarsAndVals, Expire). + +async_set(UserId, TargetName, {community, Community}, + VarsAndVals, Expire, ExtraInfo) -> + CC = {?DEFAULT_CONTEXT, Community}, + snmpm_server:async_set(UserId, TargetName, CC, VarsAndVals, Expire, + ExtraInfo); +async_set(UserId, TargetName, CC, VarsAndVals, Expire, ExtraInfo) -> + snmpm_server:async_set(UserId, TargetName, CC, VarsAndVals, Expire, ExtraInfo). as(UserId, Addr, VarsAndVals) -> as(UserId, Addr, ?DEFAULT_AGENT_PORT, 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, VarsAndVals) when is_integer(Port) andalso is_list(VarsAndVals) -> as(UserId, Addr, Port, ?DEFAULT_CONTEXT, VarsAndVals); +as(UserId, Addr, CC, VarsAndVals) + when is_list(VarsAndVals) -> + as(UserId, Addr, ?DEFAULT_AGENT_PORT, CC, 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) +as(UserId, Addr, Port, VarsAndVals, Expire) when is_integer(Port) andalso - is_list(CtxName) andalso - is_list(VarsAndVals) -> + is_list(VarsAndVals) andalso + is_integer(Expire) -> + as(UserId, Addr, Port, ?DEFAULT_CONTEXT, VarsAndVals, Expire); +as(UserId, Addr, Port, CC, VarsAndVals) + when is_integer(Port) andalso is_list(VarsAndVals) -> case target_name(Addr, Port) of {ok, TargetName} -> - async_set(UserId, TargetName, CtxName, VarsAndVals); + async_set(UserId, TargetName, CC, 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, CC, VarsAndVals, Expire) + when is_list(VarsAndVals) andalso is_integer(Expire) -> + as(UserId, Addr, ?DEFAULT_AGENT_PORT, CC, VarsAndVals, Expire). -as(UserId, Addr, Port, CtxName, VarsAndVals, Expire) -> +as(UserId, Addr, Port, CC, VarsAndVals, Expire) -> case target_name(Addr, Port) of {ok, TargetName} -> - async_set(UserId, TargetName, CtxName, VarsAndVals, Expire); + async_set(UserId, TargetName, CC, VarsAndVals, Expire); Error -> Error end. -as(UserId, Addr, Port, CtxName, VarsAndVals, Expire, ExtraInfo) -> +as(UserId, Addr, Port, CC, VarsAndVals, Expire, ExtraInfo) -> case target_name(Addr, Port) of {ok, TargetName} -> - async_set(UserId, TargetName, CtxName, VarsAndVals, Expire, ExtraInfo); + async_set(UserId, TargetName, CC, VarsAndVals, Expire, ExtraInfo); Error -> Error end. @@ -992,101 +947,111 @@ as(UserId, Addr, Port, CtxName, VarsAndVals, Expire, ExtraInfo) -> sync_get_bulk(UserId, TargetName, NonRep, MaxRep, Oids) -> sync_get_bulk(UserId, TargetName, NonRep, MaxRep, ?DEFAULT_CONTEXT, Oids). -sync_get_bulk(UserId, TargetName, NonRep, MaxRep, Context, Oids) +sync_get_bulk(UserId, TargetName, NonRep, MaxRep, Oids, Timeout) + when is_integer(NonRep) andalso + is_integer(MaxRep) andalso + is_list(Oids) andalso + is_integer(Timeout) -> + sync_get_bulk(UserId, TargetName, NonRep, MaxRep, + ?DEFAULT_CONTEXT, Oids, Timeout); +sync_get_bulk(UserId, TargetName, + NonRep, MaxRep, {community, Community}, Oids) when is_integer(NonRep) andalso is_integer(MaxRep) andalso - is_list(Context) andalso is_list(Oids) -> + CC = {?DEFAULT_CONTEXT, Community}, snmpm_server:sync_get_bulk(UserId, TargetName, NonRep, MaxRep, - Context, Oids); - -sync_get_bulk(UserId, TargetName, NonRep, MaxRep, Oids, Timeout) + CC, Oids); +sync_get_bulk(UserId, TargetName, NonRep, MaxRep, CC, Oids) when is_integer(NonRep) andalso is_integer(MaxRep) andalso - is_list(Oids) andalso - is_integer(Timeout) -> - sync_get_bulk(UserId, TargetName, NonRep, MaxRep, - ?DEFAULT_CONTEXT, Oids, Timeout). + is_list(Oids) -> + snmpm_server:sync_get_bulk(UserId, TargetName, + NonRep, MaxRep, + CC, Oids). -sync_get_bulk(UserId, TargetName, NonRep, MaxRep, Context, Oids, Timeout) -> - snmpm_server:sync_get_bulk(UserId, TargetName, NonRep, MaxRep, - Context, Oids, Timeout). +sync_get_bulk(UserId, TargetName, + NonRep, MaxRep, {community, Community}, Oids, Timeout) -> + CC = {?DEFAULT_CONTEXT, Community}, + snmpm_server:sync_get_bulk(UserId, TargetName, + NonRep, MaxRep, CC, Oids, Timeout); +sync_get_bulk(UserId, TargetName, NonRep, MaxRep, CC, Oids, Timeout) -> + snmpm_server:sync_get_bulk(UserId, TargetName, + NonRep, MaxRep, CC, Oids, Timeout). -sync_get_bulk(UserId, TargetName, NonRep, MaxRep, Context, Oids, Timeout, +sync_get_bulk(UserId, TargetName, + NonRep, MaxRep, {community, Community}, + Oids, Timeout, ExtraInfo) -> + CC = {?DEFAULT_CONTEXT, Community}, + snmpm_server:sync_get_bulk(UserId, TargetName, + NonRep, MaxRep, CC, Oids, Timeout, ExtraInfo); +sync_get_bulk(UserId, TargetName, NonRep, MaxRep, CC, Oids, Timeout, ExtraInfo) -> - snmpm_server:sync_get_bulk(UserId, TargetName, NonRep, MaxRep, - Context, Oids, Timeout, ExtraInfo). + snmpm_server:sync_get_bulk(UserId, TargetName, + NonRep, MaxRep, CC, Oids, Timeout, ExtraInfo). gb(UserId, Addr, NonRep, MaxRep, Oids) -> gb(UserId, Addr, ?DEFAULT_AGENT_PORT, NonRep, MaxRep, Oids). +gb(UserId, Addr, NonRep, MaxRep, Oids, Timeout) + when is_integer(NonRep) andalso + is_integer(MaxRep) andalso + is_list(Oids) andalso + is_integer(Timeout) -> + gb(UserId, Addr, ?DEFAULT_AGENT_PORT, NonRep, MaxRep, Oids, Timeout); gb(UserId, Addr, Port, NonRep, MaxRep, Oids) when is_integer(Port) andalso is_integer(NonRep) andalso is_integer(MaxRep) andalso is_list(Oids) -> gb(UserId, Addr, Port, NonRep, MaxRep, ?DEFAULT_CONTEXT, Oids); - -gb(UserId, Addr, NonRep, MaxRep, CtxName, Oids) +gb(UserId, Addr, NonRep, MaxRep, CC, Oids) when is_integer(NonRep) andalso is_integer(MaxRep) andalso - is_list(CtxName) andalso is_list(Oids) -> - gb(UserId, Addr, ?DEFAULT_AGENT_PORT, NonRep, MaxRep, CtxName, Oids); + gb(UserId, Addr, ?DEFAULT_AGENT_PORT, NonRep, MaxRep, CC, Oids). -gb(UserId, Addr, NonRep, MaxRep, Oids, Timeout) +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) -> + gb(UserId, Addr, Port, NonRep, MaxRep, ?DEFAULT_CONTEXT, Oids, Timeout); +gb(UserId, Addr, NonRep, MaxRep, CC, Oids, Timeout) when is_integer(NonRep) andalso is_integer(MaxRep) andalso is_list(Oids) andalso is_integer(Timeout) -> - gb(UserId, Addr, ?DEFAULT_AGENT_PORT, NonRep, MaxRep, Oids, Timeout). - -gb(UserId, Addr, Port, NonRep, MaxRep, CtxName, Oids) + gb(UserId, Addr, ?DEFAULT_AGENT_PORT, NonRep, MaxRep, CC, Oids, Timeout); +gb(UserId, Addr, Port, NonRep, MaxRep, CC, Oids) when is_integer(Port) andalso is_integer(NonRep) andalso is_integer(MaxRep) andalso - is_list(CtxName) andalso is_list(Oids) -> case target_name(Addr, Port) of {ok, TargetName} -> - sync_get_bulk(UserId, TargetName, NonRep, MaxRep, CtxName, Oids); + sync_get_bulk(UserId, TargetName, NonRep, MaxRep, CC, 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) -> - 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) -> - gb(UserId, Addr, ?DEFAULT_AGENT_PORT, NonRep, MaxRep, CtxName, Oids, - Timeout). + end. -gb(UserId, Addr, Port, NonRep, MaxRep, CtxName, Oids, Timeout) -> +gb(UserId, Addr, Port, NonRep, MaxRep, CC, Oids, Timeout) -> case target_name(Addr, Port) of {ok, TargetName} -> sync_get_bulk(UserId, TargetName, - NonRep, MaxRep, CtxName, Oids, Timeout); + NonRep, MaxRep, CC, Oids, Timeout); Error -> Error end. -gb(UserId, Addr, Port, NonRep, MaxRep, CtxName, Oids, Timeout, ExtraInfo) -> +gb(UserId, Addr, Port, NonRep, MaxRep, CC, Oids, Timeout, ExtraInfo) -> case target_name(Addr, Port) of {ok, TargetName} -> sync_get_bulk(UserId, TargetName, - NonRep, MaxRep, CtxName, Oids, Timeout, ExtraInfo); + NonRep, MaxRep, CC, Oids, Timeout, ExtraInfo); Error -> Error end. @@ -1099,102 +1064,110 @@ gb(UserId, Addr, Port, NonRep, MaxRep, CtxName, Oids, Timeout, ExtraInfo) -> async_get_bulk(UserId, TargetName, NonRep, MaxRep, Oids) -> async_get_bulk(UserId, TargetName, NonRep, MaxRep, ?DEFAULT_CONTEXT, Oids). -async_get_bulk(UserId, TargetName, NonRep, MaxRep, Context, Oids) - when is_integer(NonRep) andalso - is_integer(MaxRep) andalso - is_list(Context) andalso - is_list(Oids) -> - snmpm_server:async_get_bulk(UserId, TargetName, - NonRep, MaxRep, Context, Oids); - async_get_bulk(UserId, TargetName, NonRep, MaxRep, Oids, Expire) when is_integer(NonRep) andalso is_integer(MaxRep) andalso is_list(Oids) andalso is_integer(Expire) -> async_get_bulk(UserId, TargetName, - NonRep, MaxRep, ?DEFAULT_CONTEXT, Oids, Expire). + NonRep, MaxRep, ?DEFAULT_CONTEXT, Oids, Expire); +async_get_bulk(UserId, TargetName, + NonRep, MaxRep, {community, Community}, Oids) + when is_integer(NonRep) andalso + is_integer(MaxRep) andalso + is_list(Oids) -> + CC = {?DEFAULT_CONTEXT, Community}, + snmpm_server:async_get_bulk(UserId, TargetName, + NonRep, MaxRep, CC, Oids); +async_get_bulk(UserId, TargetName, NonRep, MaxRep, CC, Oids) + when is_integer(NonRep) andalso + is_integer(MaxRep) andalso + is_list(Oids) -> + snmpm_server:async_get_bulk(UserId, TargetName, + NonRep, MaxRep, CC, Oids). -async_get_bulk(UserId, TargetName, NonRep, MaxRep, Context, Oids, Expire) -> +async_get_bulk(UserId, TargetName, NonRep, MaxRep, {community, Community}, + Oids, Expire) -> + CC = {?DEFAULT_CONTEXT, Community}, snmpm_server:async_get_bulk(UserId, TargetName, - NonRep, MaxRep, Context, Oids, Expire). + NonRep, MaxRep, CC, Oids, Expire); +async_get_bulk(UserId, TargetName, NonRep, MaxRep, CC, Oids, Expire) -> + snmpm_server:async_get_bulk(UserId, TargetName, + NonRep, MaxRep, CC, Oids, Expire). -async_get_bulk(UserId, TargetName, NonRep, MaxRep, Context, Oids, Expire, +async_get_bulk(UserId, TargetName, + NonRep, MaxRep, {community, Community}, + Oids, Expire, ExtraInfo) -> + CC = {?DEFAULT_CONTEXT, Community}, + snmpm_server:async_get_bulk(UserId, TargetName, + NonRep, MaxRep, CC, Oids, Expire, ExtraInfo); +async_get_bulk(UserId, TargetName, NonRep, MaxRep, CC, Oids, Expire, ExtraInfo) -> snmpm_server:async_get_bulk(UserId, TargetName, - NonRep, MaxRep, - Context, Oids, Expire, ExtraInfo). + NonRep, MaxRep, CC, Oids, Expire, ExtraInfo). agb(UserId, Addr, NonRep, MaxRep, Oids) -> agb(UserId, Addr, ?DEFAULT_AGENT_PORT, NonRep, MaxRep, 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, 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) +agb(UserId, Addr, NonRep, MaxRep, CC, 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, ?DEFAULT_AGENT_PORT, NonRep, MaxRep, CC, Oids). -agb(UserId, Addr, NonRep, MaxRep, Oids, Expire) +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, CC, 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) + agb(UserId, Addr, ?DEFAULT_AGENT_PORT, NonRep, MaxRep, CC, Oids); +agb(UserId, Addr, Port, NonRep, MaxRep, CC, 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); + NonRep, MaxRep, CC, 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). + end. -agb(UserId, Addr, Port, NonRep, MaxRep, CtxName, Oids, Expire) -> +agb(UserId, Addr, Port, NonRep, MaxRep, CC, Oids, Expire) -> case target_name(Addr, Port) of {ok, TargetName} -> async_get_bulk(UserId, TargetName, - NonRep, MaxRep, CtxName, Oids, Expire); + NonRep, MaxRep, CC, Oids, Expire); Error -> Error end. -agb(UserId, Addr, Port, NonRep, MaxRep, CtxName, Oids, Expire, ExtraInfo) -> +agb(UserId, Addr, Port, NonRep, MaxRep, CC, Oids, Expire, ExtraInfo) -> case target_name(Addr, Port) of {ok, TargetName} -> async_get_bulk(UserId, TargetName, - NonRep, MaxRep, CtxName, Oids, Expire, - ExtraInfo); + NonRep, MaxRep, CC, Oids, Expire, ExtraInfo); Error -> Error end. diff --git a/lib/snmp/src/manager/snmpm_server.erl b/lib/snmp/src/manager/snmpm_server.erl index d64b5b1d53..1349a64172 100644 --- a/lib/snmp/src/manager/snmpm_server.erl +++ b/lib/snmp/src/manager/snmpm_server.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2010. All Rights Reserved. +%% Copyright Ericsson AB 2004-2011. 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 @@ -192,153 +192,142 @@ unregister_user(UserId) -> %% -- [sync] get -- -sync_get(UserId, TargetName, CtxName, Oids) -> - sync_get(UserId, TargetName, CtxName, Oids, - ?SYNC_GET_TIMEOUT). +sync_get(UserId, TargetName, CC, Oids) -> + sync_get(UserId, TargetName, CC, Oids, ?SYNC_GET_TIMEOUT). -sync_get(UserId, TargetName, CtxName, Oids, Timeout) -> - sync_get(UserId, TargetName, CtxName, Oids, Timeout, ?EXTRA_INFO). +sync_get(UserId, TargetName, CC, Oids, Timeout) -> + sync_get(UserId, TargetName, CC, Oids, Timeout, ?EXTRA_INFO). -sync_get(UserId, TargetName, CtxName, Oids, Timeout, ExtraInfo) +sync_get(UserId, TargetName, CC, Oids, Timeout, ExtraInfo) when is_list(TargetName) andalso - is_list(CtxName) andalso is_list(Oids) andalso is_integer(Timeout) -> - call({sync_get, self(), UserId, TargetName, CtxName, Oids, Timeout, ExtraInfo}). + call({sync_get, self(), UserId, TargetName, CC, Oids, Timeout, ExtraInfo}). %% -- [async] get -- -async_get(UserId, TargetName, CtxName, Oids) -> - async_get(UserId, TargetName, CtxName, Oids, - ?DEFAULT_ASYNC_EXPIRE, ?EXTRA_INFO). +async_get(UserId, TargetName, CC, Oids) -> + async_get(UserId, TargetName, CC, Oids, ?DEFAULT_ASYNC_EXPIRE, ?EXTRA_INFO). -async_get(UserId, TargetName, CtxName, Oids, Expire) -> - async_get(UserId, TargetName, CtxName, Oids, Expire, ?EXTRA_INFO). +async_get(UserId, TargetName, CC, Oids, Expire) -> + async_get(UserId, TargetName, CC, Oids, Expire, ?EXTRA_INFO). -async_get(UserId, TargetName, CtxName, Oids, Expire, ExtraInfo) +async_get(UserId, TargetName, CC, Oids, Expire, ExtraInfo) when (is_list(TargetName) andalso - is_list(CtxName) andalso is_list(Oids) andalso is_integer(Expire) andalso (Expire >= 0)) -> - call({async_get, self(), UserId, TargetName, CtxName, Oids, Expire, - ExtraInfo}). + call({async_get, self(), UserId, TargetName, CC, Oids, Expire, ExtraInfo}). %% -- [sync] get-next -- -sync_get_next(UserId, TargetName, CtxName, Oids) -> - sync_get_next(UserId, TargetName, CtxName, Oids, ?SYNC_GET_TIMEOUT, +sync_get_next(UserId, TargetName, CC, Oids) -> + sync_get_next(UserId, TargetName, CC, Oids, ?SYNC_GET_TIMEOUT, ?EXTRA_INFO). -sync_get_next(UserId, TargetName, CtxName, Oids, Timeout) -> - sync_get_next(UserId, TargetName, CtxName, Oids, Timeout, ?EXTRA_INFO). +sync_get_next(UserId, TargetName, CC, Oids, Timeout) -> + sync_get_next(UserId, TargetName, CC, Oids, Timeout, ?EXTRA_INFO). -sync_get_next(UserId, TargetName, CtxName, Oids, Timeout, ExtraInfo) +sync_get_next(UserId, TargetName, CC, Oids, Timeout, ExtraInfo) when is_list(TargetName) andalso - is_list(CtxName) andalso is_list(Oids) andalso is_integer(Timeout) -> - call({sync_get_next, self(), UserId, TargetName, CtxName, Oids, Timeout, + call({sync_get_next, self(), UserId, TargetName, CC, Oids, Timeout, ExtraInfo}). %% -- [async] get-next -- -async_get_next(UserId, TargetName, CtxName, Oids) -> - async_get_next(UserId, TargetName, CtxName, Oids, +async_get_next(UserId, TargetName, CC, Oids) -> + async_get_next(UserId, TargetName, CC, Oids, ?DEFAULT_ASYNC_EXPIRE, ?EXTRA_INFO). -async_get_next(UserId, TargetName, CtxName, Oids, Expire) -> - async_get_next(UserId, TargetName, CtxName, Oids, Expire, ?EXTRA_INFO). +async_get_next(UserId, TargetName, CC, Oids, Expire) -> + async_get_next(UserId, TargetName, CC, Oids, Expire, ?EXTRA_INFO). -async_get_next(UserId, TargetName, CtxName, Oids, Expire, ExtraInfo) +async_get_next(UserId, TargetName, CC, Oids, Expire, ExtraInfo) when (is_list(TargetName) andalso - is_list(CtxName) andalso is_list(Oids) andalso is_integer(Expire) andalso (Expire >= 0)) -> - call({async_get_next, self(), UserId, TargetName, CtxName, Oids, + call({async_get_next, self(), UserId, TargetName, CC, Oids, Expire, ExtraInfo}). %% -- [sync] get-bulk -- -sync_get_bulk(UserId, TargetName, NonRep, MaxRep, CtxName, Oids) -> +sync_get_bulk(UserId, TargetName, NonRep, MaxRep, CC, Oids) -> sync_get_bulk(UserId, TargetName, - NonRep, MaxRep, CtxName, Oids, + NonRep, MaxRep, CC, Oids, ?SYNC_GET_TIMEOUT, ?EXTRA_INFO). -sync_get_bulk(UserId, TargetName, NonRep, MaxRep, CtxName, Oids, Timeout) -> +sync_get_bulk(UserId, TargetName, NonRep, MaxRep, CC, Oids, Timeout) -> sync_get_bulk(UserId, TargetName, - NonRep, MaxRep, CtxName, Oids, + NonRep, MaxRep, CC, Oids, Timeout, ?EXTRA_INFO). -sync_get_bulk(UserId, TargetName, NonRep, MaxRep, CtxName, Oids, Timeout, +sync_get_bulk(UserId, TargetName, NonRep, MaxRep, CC, Oids, Timeout, ExtraInfo) when is_list(TargetName) andalso is_integer(NonRep) andalso is_integer(MaxRep) andalso - is_list(CtxName) andalso is_list(Oids) andalso is_integer(Timeout) -> call({sync_get_bulk, self(), UserId, TargetName, - NonRep, MaxRep, CtxName, Oids, Timeout, ExtraInfo}). + NonRep, MaxRep, CC, Oids, Timeout, ExtraInfo}). %% -- [async] get-bulk -- -async_get_bulk(UserId, TargetName, NonRep, MaxRep, CtxName, Oids) -> +async_get_bulk(UserId, TargetName, NonRep, MaxRep, CC, Oids) -> async_get_bulk(UserId, TargetName, - NonRep, MaxRep, CtxName, Oids, + NonRep, MaxRep, CC, Oids, ?DEFAULT_ASYNC_EXPIRE, ?EXTRA_INFO). -async_get_bulk(UserId, TargetName, NonRep, MaxRep, CtxName, Oids, Expire) -> +async_get_bulk(UserId, TargetName, NonRep, MaxRep, CC, Oids, Expire) -> async_get_bulk(UserId, TargetName, - NonRep, MaxRep, CtxName, Oids, + NonRep, MaxRep, CC, Oids, Expire, ?EXTRA_INFO). -async_get_bulk(UserId, TargetName, NonRep, MaxRep, CtxName, Oids, Expire, +async_get_bulk(UserId, TargetName, NonRep, MaxRep, CC, Oids, Expire, ExtraInfo) when is_list(TargetName) andalso is_integer(NonRep) andalso is_integer(MaxRep) andalso - is_list(CtxName) andalso is_list(Oids) andalso is_integer(Expire) -> call({async_get_bulk, self(), UserId, TargetName, - NonRep, MaxRep, CtxName, Oids, Expire, ExtraInfo}). + NonRep, MaxRep, CC, Oids, Expire, ExtraInfo}). %% -- [sync] set -- %% VarsAndValues is: {PlainOid, o|s|i, Value} (unknown mibs) | {Oid, Value} -sync_set(UserId, TargetName, CtxName, VarsAndVals) -> - sync_set(UserId, TargetName, CtxName, VarsAndVals, +sync_set(UserId, TargetName, CC, VarsAndVals) -> + sync_set(UserId, TargetName, CC, VarsAndVals, ?SYNC_SET_TIMEOUT, ?EXTRA_INFO). -sync_set(UserId, TargetName, CtxName, VarsAndVals, Timeout) -> - sync_set(UserId, TargetName, CtxName, VarsAndVals, +sync_set(UserId, TargetName, CC, VarsAndVals, Timeout) -> + sync_set(UserId, TargetName, CC, VarsAndVals, Timeout, ?EXTRA_INFO). -sync_set(UserId, TargetName, CtxName, VarsAndVals, Timeout, ExtraInfo) +sync_set(UserId, TargetName, CC, VarsAndVals, Timeout, ExtraInfo) when is_list(TargetName) andalso - is_list(CtxName) andalso is_list(VarsAndVals) andalso is_integer(Timeout) -> call({sync_set, self(), UserId, TargetName, - CtxName, VarsAndVals, Timeout, ExtraInfo}). + CC, VarsAndVals, Timeout, ExtraInfo}). %% -- [async] set -- -async_set(UserId, TargetName, CtxName, VarsAndVals) -> - async_set(UserId, TargetName, CtxName, VarsAndVals, +async_set(UserId, TargetName, CC, VarsAndVals) -> + async_set(UserId, TargetName, CC, VarsAndVals, ?DEFAULT_ASYNC_EXPIRE, ?EXTRA_INFO). -async_set(UserId, TargetName, CtxName, VarsAndVals, Expire) -> - async_set(UserId, TargetName, CtxName, VarsAndVals, +async_set(UserId, TargetName, CC, VarsAndVals, Expire) -> + async_set(UserId, TargetName, CC, VarsAndVals, Expire, ?EXTRA_INFO). -async_set(UserId, TargetName, CtxName, VarsAndVals, Expire, ExtraInfo) +async_set(UserId, TargetName, CC, VarsAndVals, Expire, ExtraInfo) when (is_list(TargetName) andalso - is_list(CtxName) andalso is_list(VarsAndVals) andalso is_integer(Expire) andalso (Expire >= 0)) -> call({async_set, self(), UserId, TargetName, - CtxName, VarsAndVals, Expire, ExtraInfo}). + CC, VarsAndVals, Expire, ExtraInfo}). cancel_async_request(UserId, ReqId) -> @@ -571,11 +560,11 @@ handle_call({unregister_user, UserId}, _From, State) -> %% We will reply to this request later, when the reply comes in from the %% agent, or when the timeout hits (unless we get an error now). -handle_call({sync_get, Pid, UserId, TargetName, CtxName, Oids, Timeout, ExtraInfo}, +handle_call({sync_get, Pid, UserId, TargetName, CC, Oids, Timeout, ExtraInfo}, From, State) -> - ?vlog("received sync_get [~p] request", [CtxName]), + ?vlog("received sync_get [~p] request", [CC]), case (catch handle_sync_get(Pid, - UserId, TargetName, CtxName, Oids, + UserId, TargetName, CC, Oids, Timeout, ExtraInfo, From, State)) of ok -> {noreply, State}; @@ -584,10 +573,10 @@ handle_call({sync_get, Pid, UserId, TargetName, CtxName, Oids, Timeout, ExtraInf end; -handle_call({sync_get_next, Pid, UserId, TargetName, CtxName, Oids, Timeout, ExtraInfo}, From, State) -> - ?vlog("received sync_get_next [~p] request", [CtxName]), +handle_call({sync_get_next, Pid, UserId, TargetName, CC, Oids, Timeout, ExtraInfo}, From, State) -> + ?vlog("received sync_get_next [~p] request", [CC]), case (catch handle_sync_get_next(Pid, - UserId, TargetName, CtxName, Oids, + UserId, TargetName, CC, Oids, Timeout, ExtraInfo, From, State)) of ok -> {noreply, State}; @@ -598,11 +587,11 @@ handle_call({sync_get_next, Pid, UserId, TargetName, CtxName, Oids, Timeout, Ext %% Check agent version? This op not in v1 handle_call({sync_get_bulk, Pid, UserId, TargetName, - NonRep, MaxRep, CtxName, Oids, Timeout, ExtraInfo}, + NonRep, MaxRep, CC, Oids, Timeout, ExtraInfo}, From, State) -> - ?vlog("received sync_get_bulk [~p] request", [CtxName]), + ?vlog("received sync_get_bulk [~p] request", [CC]), case (catch handle_sync_get_bulk(Pid, - UserId, TargetName, CtxName, + UserId, TargetName, CC, NonRep, MaxRep, Oids, Timeout, ExtraInfo, From, State)) of ok -> @@ -613,11 +602,11 @@ handle_call({sync_get_bulk, Pid, UserId, TargetName, handle_call({sync_set, Pid, UserId, TargetName, - CtxName, VarsAndVals, Timeout, ExtraInfo}, + CC, VarsAndVals, Timeout, ExtraInfo}, From, State) -> - ?vlog("received sync_set [~p] request", [CtxName]), + ?vlog("received sync_set [~p] request", [CC]), case (catch handle_sync_set(Pid, - UserId, TargetName, CtxName, VarsAndVals, + UserId, TargetName, CC, VarsAndVals, Timeout, ExtraInfo, From, State)) of ok -> {noreply, State}; @@ -627,40 +616,40 @@ handle_call({sync_set, Pid, UserId, TargetName, handle_call({async_get, Pid, UserId, TargetName, - CtxName, Oids, Expire, ExtraInfo}, + CC, Oids, Expire, ExtraInfo}, _From, State) -> - ?vlog("received async_get [~p] request", [CtxName]), - Reply = (catch handle_async_get(Pid, UserId, TargetName, CtxName, Oids, + ?vlog("received async_get [~p] request", [CC]), + Reply = (catch handle_async_get(Pid, UserId, TargetName, CC, Oids, Expire, ExtraInfo, State)), {reply, Reply, State}; handle_call({async_get_next, Pid, UserId, TargetName, - CtxName, Oids, Expire, ExtraInfo}, + CC, Oids, Expire, ExtraInfo}, _From, State) -> - ?vlog("received async_get_next [~p] request", [CtxName]), - Reply = (catch handle_async_get_next(Pid, UserId, TargetName, CtxName, + ?vlog("received async_get_next [~p] request", [CC]), + Reply = (catch handle_async_get_next(Pid, UserId, TargetName, CC, Oids, Expire, ExtraInfo, State)), {reply, Reply, State}; %% Check agent version? This op not in v1 handle_call({async_get_bulk, Pid, UserId, TargetName, - NonRep, MaxRep, CtxName, Oids, Expire, ExtraInfo}, + NonRep, MaxRep, CC, Oids, Expire, ExtraInfo}, _From, State) -> - ?vlog("received async_get_bulk [~p] request", [CtxName]), + ?vlog("received async_get_bulk [~p] request", [CC]), Reply = (catch handle_async_get_bulk(Pid, - UserId, TargetName, CtxName, + UserId, TargetName, CC, NonRep, MaxRep, Oids, Expire, ExtraInfo, State)), {reply, Reply, State}; handle_call({async_set, Pid, UserId, TargetName, - CtxName, VarsAndVals, Expire, ExtraInfo}, + CC, VarsAndVals, Expire, ExtraInfo}, _From, State) -> - ?vlog("received async_set [~p] request", [CtxName]), - Reply = (catch handle_async_set(Pid, UserId, TargetName, CtxName, + ?vlog("received async_set [~p] request", [CC]), + Reply = (catch handle_async_set(Pid, UserId, TargetName, CC, VarsAndVals, Expire, ExtraInfo, State)), {reply, Reply, State}; @@ -899,18 +888,18 @@ terminate(Reason, #state{gct = GCT}) -> %% %%---------------------------------------------------------------------- -handle_sync_get(Pid, UserId, TargetName, CtxName, Oids, Timeout, ExtraInfo, +handle_sync_get(Pid, UserId, TargetName, CC, Oids, Timeout, ExtraInfo, From, State) -> ?vtrace("handle_sync_get -> entry with" "~n Pid: ~p" "~n UserId: ~p" "~n TargetName: ~p" - "~n CtxName: ~p" + "~n CC: ~p" "~n Oids: ~p" "~n Timeout: ~p" "~n From: ~p", - [Pid, UserId, TargetName, CtxName, Oids, Timeout, From]), - case agent_data(TargetName, CtxName) of + [Pid, UserId, TargetName, CC, Oids, Timeout, From]), + case agent_data(TargetName, CC) of {ok, RegType, Addr, Port, Vsn, MsgData} -> ?vtrace("handle_sync_get -> send a ~p message", [Vsn]), ReqId = send_get_request(Oids, Vsn, MsgData, Addr, Port, @@ -941,18 +930,18 @@ handle_sync_get(Pid, UserId, TargetName, CtxName, Oids, Timeout, ExtraInfo, end. -handle_sync_get_next(Pid, UserId, TargetName, CtxName, Oids, Timeout, +handle_sync_get_next(Pid, UserId, TargetName, CC, Oids, Timeout, ExtraInfo, From, State) -> ?vtrace("handle_sync_get_next -> entry with" "~n Pid: ~p" "~n UserId: ~p" "~n TargetName: ~p" - "~n CtxName: ~p" + "~n CC: ~p" "~n Oids: ~p" "~n Timeout: ~p" "~n From: ~p", - [Pid, UserId, TargetName, CtxName, Oids, Timeout, From]), - case agent_data(TargetName, CtxName) of + [Pid, UserId, TargetName, CC, Oids, Timeout, From]), + case agent_data(TargetName, CC) of {ok, RegType, Addr, Port, Vsn, MsgData} -> ?vtrace("handle_sync_get_next -> send a ~p message", [Vsn]), ReqId = send_get_next_request(Oids, Vsn, MsgData, @@ -984,22 +973,22 @@ handle_sync_get_next(Pid, UserId, TargetName, CtxName, Oids, Timeout, end. -handle_sync_get_bulk(Pid, UserId, TargetName, CtxName, +handle_sync_get_bulk(Pid, UserId, TargetName, CC, NonRep, MaxRep, Oids, Timeout, ExtraInfo, From, State) -> ?vtrace("handle_sync_get_bulk -> entry with" "~n Pid: ~p" "~n UserId: ~p" "~n TargetName: ~p" - "~n CtxName: ~p" + "~n CC: ~p" "~n NonRep: ~p" "~n MaxRep: ~p" "~n Oids: ~p" "~n Timeout: ~p" "~n From: ~p", - [Pid, UserId, TargetName, CtxName, NonRep, MaxRep, Oids, + [Pid, UserId, TargetName, CC, NonRep, MaxRep, Oids, Timeout, From]), - case agent_data(TargetName, CtxName) of + case agent_data(TargetName, CC) of {ok, RegType, Addr, Port, Vsn, MsgData} -> ?vtrace("handle_sync_get_bulk -> send a ~p message", [Vsn]), ReqId = send_get_bulk_request(Oids, Vsn, MsgData, Addr, Port, @@ -1031,18 +1020,18 @@ handle_sync_get_bulk(Pid, UserId, TargetName, CtxName, end. -handle_sync_set(Pid, UserId, TargetName, CtxName, VarsAndVals, Timeout, +handle_sync_set(Pid, UserId, TargetName, CC, VarsAndVals, Timeout, ExtraInfo, From, State) -> ?vtrace("handle_sync_set -> entry with" "~n Pid: ~p" "~n UserId: ~p" "~n TargetName: ~p" - "~n CtxName: ~p" + "~n CC: ~p" "~n VarsAndVals: ~p" "~n Timeout: ~p" "~n From: ~p", - [Pid, UserId, TargetName, CtxName, VarsAndVals, Timeout, From]), - case agent_data(TargetName, CtxName) of + [Pid, UserId, TargetName, CC, VarsAndVals, Timeout, From]), + case agent_data(TargetName, CC) of {ok, RegType, Addr, Port, Vsn, MsgData} -> ?vtrace("handle_sync_set -> send a ~p message", [Vsn]), ReqId = send_set_request(VarsAndVals, Vsn, MsgData, @@ -1074,17 +1063,17 @@ handle_sync_set(Pid, UserId, TargetName, CtxName, VarsAndVals, Timeout, end. -handle_async_get(Pid, UserId, TargetName, CtxName, Oids, Expire, ExtraInfo, +handle_async_get(Pid, UserId, TargetName, CC, Oids, Expire, ExtraInfo, State) -> ?vtrace("handle_async_get -> entry with" "~n Pid: ~p" "~n UserId: ~p" "~n TargetName: ~p" - "~n CtxName: ~p" + "~n CC: ~p" "~n Oids: ~p" "~n Expire: ~p", - [Pid, UserId, TargetName, CtxName, Oids, Expire]), - case agent_data(TargetName, CtxName) of + [Pid, UserId, TargetName, CC, Oids, Expire]), + case agent_data(TargetName, CC) of {ok, RegType, Addr, Port, Vsn, MsgData} -> ?vtrace("handle_async_get -> send a ~p message", [Vsn]), ReqId = send_get_request(Oids, Vsn, MsgData, Addr, Port, @@ -1112,17 +1101,17 @@ handle_async_get(Pid, UserId, TargetName, CtxName, Oids, Expire, ExtraInfo, end. -handle_async_get_next(Pid, UserId, TargetName, CtxName, Oids, Expire, +handle_async_get_next(Pid, UserId, TargetName, CC, Oids, Expire, ExtraInfo, State) -> ?vtrace("handle_async_get_next -> entry with" "~n Pid: ~p" "~n UserId: ~p" "~n TargetName: ~p" - "~n CtxName: ~p" + "~n CC: ~p" "~n Oids: ~p" "~n Expire: ~p", - [Pid, UserId, TargetName, CtxName, Oids, Expire]), - case agent_data(TargetName, CtxName) of + [Pid, UserId, TargetName, CC, Oids, Expire]), + case agent_data(TargetName, CC) of {ok, RegType, Addr, Port, Vsn, MsgData} -> ?vtrace("handle_async_get_next -> send a ~p message", [Vsn]), ReqId = send_get_next_request(Oids, Vsn, MsgData, @@ -1150,20 +1139,20 @@ handle_async_get_next(Pid, UserId, TargetName, CtxName, Oids, Expire, end. -handle_async_get_bulk(Pid, UserId, TargetName, CtxName, +handle_async_get_bulk(Pid, UserId, TargetName, CC, NonRep, MaxRep, Oids, Expire, ExtraInfo, State) -> ?vtrace("handle_async_get_bulk -> entry with" "~n Pid: ~p" "~n UserId: ~p" "~n TargetName: ~p" - "~n CtxName: ~p" + "~n CC: ~p" "~n NonRep: ~p" "~n MaxRep: ~p" "~n Oids: ~p" "~n Expire: ~p", - [Pid, UserId, TargetName, CtxName, NonRep, MaxRep, Oids, Expire]), - case agent_data(TargetName, CtxName) of + [Pid, UserId, TargetName, CC, NonRep, MaxRep, Oids, Expire]), + case agent_data(TargetName, CC) of {ok, RegType, Addr, Port, Vsn, MsgData} -> ?vtrace("handle_async_get_bulk -> send a ~p message", [Vsn]), ReqId = send_get_bulk_request(Oids, Vsn, MsgData, Addr, Port, @@ -1190,17 +1179,17 @@ handle_async_get_bulk(Pid, UserId, TargetName, CtxName, end. -handle_async_set(Pid, UserId, TargetName, CtxName, VarsAndVals, Expire, +handle_async_set(Pid, UserId, TargetName, CC, VarsAndVals, Expire, ExtraInfo, State) -> ?vtrace("handle_async_set -> entry with" "~n Pid: ~p" "~n UserId: ~p" "~n TargetName: ~p" - "~n CtxName: ~p" + "~n CC: ~p" "~n VarsAndVals: ~p" "~n Expire: ~p", - [Pid, UserId, TargetName, CtxName, VarsAndVals, Expire]), - case agent_data(TargetName, CtxName) of + [Pid, UserId, TargetName, CC, VarsAndVals, Expire]), + case agent_data(TargetName, CC) of {ok, RegType, Addr, Port, Vsn, MsgData} -> ?vtrace("handle_async_set -> send a ~p message", [Vsn]), ReqId = send_set_request(VarsAndVals, Vsn, MsgData, @@ -2798,6 +2787,8 @@ request_id() -> %%---------------------------------------------------------------------- +agent_data(TargetName, {CtxName, Community}) -> + agent_data(TargetName, CtxName, [{community, Community}]); agent_data(TargetName, CtxName) -> agent_data(TargetName, CtxName, []). |