From 258d70ba52d3e5c2ba092b22a4c733d29d6cdb24 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Fri, 6 May 2011 18:34:24 +0200 Subject: Udated documentation (and version). --- lib/snmp/doc/src/notes.xml | 67 +++++++++++- lib/snmp/doc/src/snmpm.xml | 253 +++++++++++++++++++++++++++------------------ lib/snmp/vsn.mk | 25 ++++- 3 files changed, 239 insertions(+), 106 deletions(-) diff --git a/lib/snmp/doc/src/notes.xml b/lib/snmp/doc/src/notes.xml index d5d6605b64..1e31d72a2c 100644 --- a/lib/snmp/doc/src/notes.xml +++ b/lib/snmp/doc/src/notes.xml @@ -1,10 +1,10 @@ - +
- 19962010 + 19962011 Ericsson AB. All Rights Reserved. @@ -32,6 +32,69 @@ notes.xml
+
+ SNMP Development Toolkit 4.17.2 + +

Version 4.17.2 supports code replacement in runtime from/to + version 4.17.1, 4.17, 4.16.2, 4.16.1 and 4.16.

+ +
+ Improvements and new features + + + + +

[manager] It is now possible to provide an "override" value + for community when issuing SNMP requests (see the + sync_get, + async_get, + sync_get_next, + async_get_next, + sync_set, + async_set, + sync_get_bulk and + async_get_bulk + for more info). By "override" means that any community value + configured when the agent was registered, is overridden by + this value for this request.

+

Own Id: OTP-9236

+
+ +
+ +
+ +
+ Reported Fixed Bugs and Malfunctions +

-

+ + + +
+ +
+ Incompatibilities +

-

+
+ +
+ +
SNMP Development Toolkit 4.17.1

Version 4.17.1 supports code replacement in runtime from/to diff --git a/lib/snmp/doc/src/snmpm.xml b/lib/snmp/doc/src/snmpm.xml index 1ee391d9ba..8f631363dc 100644 --- a/lib/snmp/doc/src/snmpm.xml +++ b/lib/snmp/doc/src/snmpm.xml @@ -1,10 +1,10 @@ - +

- 20042010 + 20042011 Ericsson AB. All Rights Reserved. @@ -488,15 +488,17 @@ priv_key = [integer()] (length is 16 if priv = usmDESPrivProtocol | usmAesCfb1 sync_get(UserId, TargetName, Oids) -> {ok, SnmpReply, Remaining} | {error, Reason} - sync_get(UserId, TargetName, ContextName, Oids) -> {ok, SnmpReply, Remaining} | {error, Reason} + sync_get(UserId, TargetName, CC, Oids) -> {ok, SnmpReply, Remaining} | {error, Reason} sync_get(UserId, TargetName, Oids, Timeout) -> {ok, SnmpReply, Remaining} | {error, Reason} - sync_get(UserId, TargetName, ContextName, Oids, Timeout) -> {ok, SnmpReply, Remaining} | {error, Reason} - sync_get(UserId, TargetName, ContextName, Oids, Timeout, ExtraInfo) -> {ok, SnmpReply, Remaining} | {error, Reason} + sync_get(UserId, TargetName, CC, Oids, Timeout) -> {ok, SnmpReply, Remaining} | {error, Reason} + sync_get(UserId, TargetName, CC, Oids, Timeout, ExtraInfo) -> {ok, SnmpReply, Remaining} | {error, Reason} Synchronous get-request UserId = term() TargetName = target_name() - ContextName = string() + CC = context_name() | {community, community()} | {context_name(), community()} + context_name() = string() + community() = string() Oids = [oid()] Timeout = integer() ExtraInfo = term() @@ -512,19 +514,23 @@ priv_key = [integer()] (length is 16 if priv = usmDESPrivProtocol | usmAesCfb1

Synchronous get-request.

+

When the CC argument is the tuple + {_, Community}, the Community part will + override the previously configured community for this agent + (represented by TargetName).

Remaining is the remaining time of the given or - default timeout time.

+ default timeout time.

When Reason is {send_failed, ...} it means that - the net_if process failed to send the message. This could happen - because of any number of reasons, i.e. encoding error. R - is the actual reason in this case.

-

ExtraInfo is an opaque data structure passed on to - the net-if process. The net-if process included in this - application makes no use of this info, so the only use for it - in such a configuration (when using the built in net-if) would - be tracing.

-

For SnmpInfo, see the user callback function - handle_report.

+ the net_if process failed to send the message. This could happen + because of any number of reasons, i.e. encoding error. R + is the actual reason in this case.

+

ExtraInfo is an opaque data structure passed on to + the net-if process. The net-if process included in this + application makes no use of this info, so the only use for it + in such a configuration (when using the built in net-if) would + be tracing.

+

For SnmpInfo, see the user callback function + handle_report.

@@ -532,15 +538,17 @@ priv_key = [integer()] (length is 16 if priv = usmDESPrivProtocol | usmAesCfb1 async_get(UserId, TargetName, Oids) -> {ok, ReqId} | {error, Reason} - async_get(UserId, TargetName, ContextName, Oids) -> {ok, ReqId} | {error, Reason} + async_get(UserId, TargetName, CC, Oids) -> {ok, ReqId} | {error, Reason} async_get(UserId, TargetName, Oids, Expire) -> {ok, ReqId} | {error, Reason} - async_get(UserId, TargetName, ContextName, Oids, Expire) -> {ok, ReqId} | {error, Reason} - async_get(UserId, TargetName, ContextName, Oids, Expire, ExtraInfo) -> {ok, ReqId} | {error, Reason} + async_get(UserId, TargetName, CC, Oids, Expire) -> {ok, ReqId} | {error, Reason} + async_get(UserId, TargetName, CC, Oids, Expire, ExtraInfo) -> {ok, ReqId} | {error, Reason} Asynchronous get-request UserId = term() TargetName = target_name() - ContextName = string() + CC = context_name() | {community, community()} | {context_name(), community()} + context_name() = string() + community() = string() Oids = [oid()] Expire = integer() ExtraInfo = term() @@ -550,31 +558,37 @@ priv_key = [integer()] (length is 16 if priv = usmDESPrivProtocol | usmAesCfb1

Asynchronous get-request.

The reply, if it arrives, will be delivered to the user - through a call to the snmpm_user callback function - handle_pdu.

-

The Expire time indicates for how long the request is - valid (after which the manager is free to delete it).

-

ExtraInfo is an opaque data structure passed on to - the net-if process. The net-if process included in this - application makes no use of this info, so the only use for it - in such a configuration (when using the built in net-if) would - be tracing.

- + through a call to the snmpm_user callback function + handle_pdu.

+

When the CC argument is the tuple + {_, Community}, the Community part will + override the previously configured community for this agent + (represented by TargetName).

+

The Expire time indicates for how long the request is + valid (after which the manager is free to delete it).

+

ExtraInfo is an opaque data structure passed on to + the net-if process. The net-if process included in this + application makes no use of this info, so the only use for it + in such a configuration (when using the built in net-if) would + be tracing.

+
sync_get_next(UserId, TargetName, Oids) -> {ok, SnmpReply, Remaining} | {error, Reason} - sync_get_next(UserId, TargetName, ContextName, Oids) -> {ok, SnmpReply, Remaining} | {error, Reason} + sync_get_next(UserId, TargetName, CC, Oids) -> {ok, SnmpReply, Remaining} | {error, Reason} sync_get_next(UserId, TargetName, Oids, Timeout) -> {ok, SnmpReply, Remaining} | {error, Reason} - sync_get_next(UserId, TargetName, ContextName, Oids, Timeout) -> {ok, SnmpReply, Remaining} | {error, Reason} - sync_get_next(UserId, TargetName, ContextName, Oids, Timeout, ExtraInfo) -> {ok, SnmpReply, Remaining} | {error, Reason} + sync_get_next(UserId, TargetName, CC, Oids, Timeout) -> {ok, SnmpReply, Remaining} | {error, Reason} + sync_get_next(UserId, TargetName, CC, Oids, Timeout, ExtraInfo) -> {ok, SnmpReply, Remaining} | {error, Reason} Synchronous get-next-request UserId = term() TargetName = target_name() - ContextName = string() + CC = context_name() | {community, community()} | {context_name(), community()} + context_name() = string() + community() = string() Oids = [oid()] Timeout = integer() ExtraInfo = term() @@ -585,16 +599,20 @@ priv_key = [integer()] (length is 16 if priv = usmDESPrivProtocol | usmAesCfb1

Synchronous get-next-request.

-

Remaining time of the given or default timeout time.

-

When Reason is {send_failed, ...} it means that - the net_if process failed to send the message. This could happen - because of any number of reasons, i.e. encoding error. R - is the actual reason in this case.

-

ExtraInfo is an opaque data structure passed on to - the net-if process. The net-if process included in this - application makes no use of this info, so the only use for it - in such a configuration (when using the built in net-if) would - be tracing.

+

When the CC argument is the tuple + {_, Community}, the Community part will + override the previously configured community for this agent + (represented by TargetName).

+

Remaining time of the given or default timeout time.

+

When Reason is {send_failed, ...} it means that + the net_if process failed to send the message. This could happen + because of any number of reasons, i.e. encoding error. R + is the actual reason in this case.

+

ExtraInfo is an opaque data structure passed on to + the net-if process. The net-if process included in this + application makes no use of this info, so the only use for it + in such a configuration (when using the built in net-if) would + be tracing.

@@ -602,15 +620,17 @@ priv_key = [integer()] (length is 16 if priv = usmDESPrivProtocol | usmAesCfb1 async_get_next(UserId, TargetName, Oids) -> {ok, ReqId} | {error, Reason} - async_get_next(UserId, TargetName, ContextName, Oids) -> {ok, ReqId} | {error, Reason} + async_get_next(UserId, TargetName, CC, Oids) -> {ok, ReqId} | {error, Reason} async_get_next(UserId, TargetName, Oids, Expire) -> {ok, ReqId} | {error, Reason} - async_get_next(UserId, TargetName, ContextName, Oids, Expire) -> {ok, ReqId} | {error, Reason} - async_get_next(UserId, TargetName, ContextName, Oids, Expire, ExtraInfo) -> {ok, ReqId} | {error, Reason} + async_get_next(UserId, TargetName, CC, Oids, Expire) -> {ok, ReqId} | {error, Reason} + async_get_next(UserId, TargetName, CC, Oids, Expire, ExtraInfo) -> {ok, ReqId} | {error, Reason} Asynchronous get-next-request UserId = term() TargetName = target_name() - ContextName = string() + CC = context_name() | {community, community()} | {context_name(), community()} + context_name() = string() + community() = string() Oids = [oid()] Expire = integer() ExtraInfo = term() @@ -620,9 +640,13 @@ priv_key = [integer()] (length is 16 if priv = usmDESPrivProtocol | usmAesCfb1

Asynchronous get-next-request.

The reply will be delivered to the user through a call - to the snmpm_user callback function handle_pdu.

-

The Expire time indicates for how long the request is - valid (after which the manager is free to delete it).

+ to the snmpm_user callback function handle_pdu.

+

When the CC argument is the tuple + {_, Community}, the Community part will + override the previously configured community for this agent + (represented by TargetName).

+

The Expire time indicates for how long the request is + valid (after which the manager is free to delete it).

@@ -630,15 +654,17 @@ priv_key = [integer()] (length is 16 if priv = usmDESPrivProtocol | usmAesCfb1 sync_set(UserId, TargetName, VarsAndVals) -> {ok, SnmpReply, Remaining} | {error, Reason} - sync_set(UserId, TargetName, ContextName, VarsAndVals) -> {ok, SnmpReply, Remaining} | {error, Reason} + sync_set(UserId, TargetName, CC, VarsAndVals) -> {ok, SnmpReply, Remaining} | {error, Reason} sync_set(UserId, TargetName, VarsAndVals, Timeout) -> {ok, SnmpReply, Remaining} | {error, Reason} - sync_set(UserId, TargetName, ContextName, VarsAndVals, Timeout) -> {ok, SnmpReply, Remaining} | {error, Reason} - sync_set(UserId, TargetName, ContextName, VarsAndVals, Timeout, ExtraInfo) -> {ok, SnmpReply, Remaining} | {error, Reason} + sync_set(UserId, TargetName, CC, VarsAndVals, Timeout) -> {ok, SnmpReply, Remaining} | {error, Reason} + sync_set(UserId, TargetName, CC, VarsAndVals, Timeout, ExtraInfo) -> {ok, SnmpReply, Remaining} | {error, Reason} Synchronous set-request UserId = term() TargetName = target_name() - ContextName = string() + CC = context_name() | {community, community()} | {context_name(), community()} + context_name() = string() + community() = string() VarsAndVals = vars_and_vals() Timeout = integer() ExtraInfo = term() @@ -649,18 +675,22 @@ priv_key = [integer()] (length is 16 if priv = usmDESPrivProtocol | usmAesCfb1

Synchronous set-request.

-

Remaining time of the given or default timeout time.

-

When Reason is {send_failed, ...} it means that - the net_if process failed to send the message. This could happen - because of any number of reasons, i.e. encoding error. R - is the actual reason in this case.

-

When var_and_val() is {oid(), value()}, the - manager makes an educated guess based on the loaded mibs.

-

ExtraInfo is an opaque data structure passed on to - the net-if process. The net-if process included in this - application makes no use of this info, so the only use for it - in such a configuration (when using the built in net-if) would - be tracing.

+

When the CC argument is the tuple + {_, Community}, the Community part will + override the previously configured community for this agent + (represented by TargetName).

+

Remaining time of the given or default timeout time.

+

When Reason is {send_failed, ...} it means that + the net_if process failed to send the message. This could happen + because of any number of reasons, i.e. encoding error. R + is the actual reason in this case.

+

When var_and_val() is {oid(), value()}, the + manager makes an educated guess based on the loaded mibs.

+

ExtraInfo is an opaque data structure passed on to + the net-if process. The net-if process included in this + application makes no use of this info, so the only use for it + in such a configuration (when using the built in net-if) would + be tracing.

@@ -668,16 +698,19 @@ priv_key = [integer()] (length is 16 if priv = usmDESPrivProtocol | usmAesCfb1 async_set(UserId, TargetName, VarsAndVals) -> {ok, ReqId} | {error, Reason} - async_set(UserId, TargetName, ContextName, VarsAndVals) -> {ok, ReqId} | {error, Reason} + async_set(UserId, TargetName, CC, VarsAndVals) -> {ok, ReqId} | {error, Reason} async_set(UserId, TargetName, VarsAndVals, Expire) -> {ok, ReqId} | {error, Reason} - async_set(UserId, TargetName, ContextName, VarsAndVals, Expire) -> {ok, ReqId} | {error, Reason} - async_set(UserId, TargetName, ContextName, VarsAndVals, Expire, ExtraInfo) -> {ok, ReqId} | {error, Reason} + async_set(UserId, TargetName, CC, VarsAndVals, Expire) -> {ok, ReqId} | {error, Reason} + async_set(UserId, TargetName, CC, VarsAndVals, Expire, ExtraInfo) -> {ok, ReqId} | {error, Reason} Asynchronous set-request UserId = term() TargetName = target_name() VarsAndVals = vars_and_vals() - Expire = integer() + CC = context_name() | {community, community()} | {context_name(), community()} + context_name() = string() + community() = string() + Expire = integer() ExtraInfo = term() ReqId = term() Reason = term() @@ -685,16 +718,20 @@ priv_key = [integer()] (length is 16 if priv = usmDESPrivProtocol | usmAesCfb1

Asynchronous set-request.

The reply will be delivered to the user through a call - to the snmpm_user callback function handle_pdu.

-

The Expire time indicates for how long the request is - valid (after which the manager is free to delete it).

-

When var_and_val() is {oid(), value()}, the - manager makes an educated guess based on the loaded mibs.

-

ExtraInfo is an opaque data structure passed on to - the net-if process. The net-if process included in this - application makes no use of this info, so the only use for it - in such a configuration (when using the built in net-if) would - be tracing.

+ to the snmpm_user callback function handle_pdu.

+

When the CC argument is the tuple + {_, Community}, the Community part will + override the previously configured community for this agent + (represented by TargetName).

+

The Expire time indicates for how long the request is + valid (after which the manager is free to delete it).

+

When var_and_val() is {oid(), value()}, the + manager makes an educated guess based on the loaded mibs.

+

ExtraInfo is an opaque data structure passed on to + the net-if process. The net-if process included in this + application makes no use of this info, so the only use for it + in such a configuration (when using the built in net-if) would + be tracing.

@@ -702,17 +739,19 @@ priv_key = [integer()] (length is 16 if priv = usmDESPrivProtocol | usmAesCfb1 sync_get_bulk(UserId, TragetName, NonRep, MaxRep, Oids) -> {ok, SnmpReply, Remaining} | {error, Reason} - sync_get_bulk(UserId, TragetName, NonRep, MaxRep, ContextName, Oids) -> {ok, SnmpReply, Remaining} | {error, Reason} + sync_get_bulk(UserId, TragetName, NonRep, MaxRep, CC, Oids) -> {ok, SnmpReply, Remaining} | {error, Reason} sync_get_bulk(UserId, TragetName, NonRep, MaxRep, Oids, Timeout) -> {ok, SnmpReply, Remaining} | {error, Reason} - sync_get_bulk(UserId, TragetName, NonRep, MaxRep, ContextName, Oids, Timeout) -> {ok, SnmpReply, Remaining} | {error, Reason} - sync_get_bulk(UserId, TragetName, NonRep, MaxRep, ContextName, Oids, Timeout, ExtraInfo) -> {ok, SnmpReply, Remaining} | {error, Reason} + sync_get_bulk(UserId, TragetName, NonRep, MaxRep, CC, Oids, Timeout) -> {ok, SnmpReply, Remaining} | {error, Reason} + sync_get_bulk(UserId, TragetName, NonRep, MaxRep, CC, Oids, Timeout, ExtraInfo) -> {ok, SnmpReply, Remaining} | {error, Reason} Synchronous get-bulk-request UserId = term() TargetName = target_name() NonRep = integer() MaxRep = integer() - ContextName = string() + CC = context_name() | {community, community()} | {context_name(), community()} + context_name() = string() + community() = string() Oids = [oid()] Timeout = integer() ExtraInfo = term() @@ -722,34 +761,40 @@ priv_key = [integer()] (length is 16 if priv = usmDESPrivProtocol | usmAesCfb1

Synchronous get-bulk-request (See RFC1905).

+

When the CC argument is the tuple + {_, Community}, the Community part will + override the previously configured community for this agent + (represented by TargetName).

Remaining time of the given or default timeout time.

-

When Reason is {send_failed, ...} it means that - the net_if process failed to send the message. This could happen - because of any number of reasons, i.e. encoding error. R - is the actual reason in this case.

-

ExtraInfo is an opaque data structure passed on to - the net-if process. The net-if process included in this - application makes no use of this info, so the only use for it - in such a configuration (when using the built in net-if) would - be tracing.

- +

When Reason is {send_failed, ...} it means that + the net_if process failed to send the message. This could happen + because of any number of reasons, i.e. encoding error. R + is the actual reason in this case.

+

ExtraInfo is an opaque data structure passed on to + the net-if process. The net-if process included in this + application makes no use of this info, so the only use for it + in such a configuration (when using the built in net-if) would + be tracing.

+
async_get_bulk(UserId, TargetName, NonRep, MaxRep, Oids) -> {ok, ReqId} | {error, Reason} - async_get_bulk(UserId, TargetName, NonRep, MaxRep, ContextName, Oids) -> {ok, ReqId} | {error, Reason} + async_get_bulk(UserId, TargetName, NonRep, MaxRep, CC, Oids) -> {ok, ReqId} | {error, Reason} async_get_bulk(UserId, TargetName, NonRep, MaxRep, Oids, Expire) -> {ok, ReqId} | {error, Reason} - async_get_bulk(UserId, TargetName, NonRep, MaxRep, ContextName, Oids, Expire) -> {ok, ReqId} | {error, Reason} - async_get_bulk(UserId, TargetName, NonRep, MaxRep, ContextName, Oids, Expire, ExtraInfo) -> {ok, ReqId} | {error, Reason} + async_get_bulk(UserId, TargetName, NonRep, MaxRep, CC, Oids, Expire) -> {ok, ReqId} | {error, Reason} + async_get_bulk(UserId, TargetName, NonRep, MaxRep, CC, Oids, Expire, ExtraInfo) -> {ok, ReqId} | {error, Reason} Asynchronous get-bulk-request UserId = term() TargetName = target_name() NonRep = integer() MaxRep = integer() - ContextName = string() + CC = context_name() | {community, community()} | {context_name(), community()} + context_name() = string() + community() = string() Oids = [oid()] Expire = integer() ExtraInfo = term() @@ -759,9 +804,13 @@ priv_key = [integer()] (length is 16 if priv = usmDESPrivProtocol | usmAesCfb1

Asynchronous get-bulk-request (See RFC1905).

The reply will be delivered to the user through a call - to the snmpm_user callback function handle_pdu.

+ to the snmpm_user callback function handle_pdu.

+

When the CC argument is the tuple + {_, Community}, the Community part will + override the previously configured community for this agent + (represented by TargetName).

The Expire time indicates for how long the request is - valid (after which the manager is free to delete it).

+ valid (after which the manager is free to delete it).

diff --git a/lib/snmp/vsn.mk b/lib/snmp/vsn.mk index 60eee87974..39ec3dc7d4 100644 --- a/lib/snmp/vsn.mk +++ b/lib/snmp/vsn.mk @@ -1,8 +1,29 @@ -SNMP_VSN = 4.17.1 +#-*-makefile-*- ; force emacs to enter makefile-mode + +# %CopyrightBegin% +# +# Copyright Ericsson AB 1997-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 +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# %CopyrightEnd% + +SNMP_VSN = 4.17.2 PRE_VSN = APP_VSN = "snmp-$(SNMP_VSN)$(PRE_VSN)" -TICKETS = OTP-8761 +TICKETS = OTP-9236 + +TICKETS_4_17_1 = OTP-8761 TICKETS_4_17 = OTP-8478 -- cgit v1.2.3 From 5b331f970ce227cdc8b39c38be2fb4f78238c5d7 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Tue, 10 May 2011 14:47:43 +0200 Subject: Added (intial) override community stuff. --- lib/snmp/src/app/snmp.appup.src | 189 ++------- lib/snmp/src/manager/snmpm.erl | 707 ++++++++++++++++------------------ 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, []). -- cgit v1.2.3