From 12e0e58dafd2b891df90118ba55333914e4d0f5d Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Thu, 23 Feb 2012 12:05:07 +0100 Subject: [snmp/agent] Documenting previously existing but undocumented function Documenting previously existing but undocumented function, snmp_generic:get_table_info/2. OTP-9942 --- lib/snmp/doc/src/notes.xml | 52 +++++++++++++++++++++++++ lib/snmp/doc/src/snmp_generic.xml | 81 +++++++++++++++++++++++++++++++++------ 2 files changed, 121 insertions(+), 12 deletions(-) (limited to 'lib/snmp/doc') diff --git a/lib/snmp/doc/src/notes.xml b/lib/snmp/doc/src/notes.xml index 704ff0a20f..a40e325ea2 100644 --- a/lib/snmp/doc/src/notes.xml +++ b/lib/snmp/doc/src/notes.xml @@ -33,6 +33,58 @@ +
+ SNMP Development Toolkit 4.22 +

Version 4.22 supports code replacement in runtime from/to + version 4.21.7, 4.21.6, 4.21.5, 4.21.4, 4.21.3, 4.21.2, 4.21.1 and + 4.21.

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

[agent] Documenting previously existing but undocumented function, + snmp_generic:get_table_info/2.

+

Own Id: OTP-9942

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

-

+ + + +
+ +
+ Incompatibilities +

-

+
+ +
+ +
SNMP Development Toolkit 4.21.7

Version 4.21.7 supports code replacement in runtime from/to diff --git a/lib/snmp/doc/src/snmp_generic.xml b/lib/snmp/doc/src/snmp_generic.xml index 77f3cefaa2..79a22323d9 100644 --- a/lib/snmp/doc/src/snmp_generic.xml +++ b/lib/snmp/doc/src/snmp_generic.xml @@ -1,10 +1,10 @@ - +

- 19962009 + 19962012 Ericsson AB. All Rights Reserved. @@ -34,15 +34,16 @@ snmp_generic Generic Functions for Implementing SNMP Objects in a Database -

The module snmp_generic contains generic functions for implementing tables - (and variables) using the SNMP built-in database or Mnesia. These - default functions are used if no instrumentation function is - provided for a managed object in a MIB. Sometimes, it might be - necessary to customize the behaviour of the default functions. For - example, in some situations a trap should be sent if a row is - deleted or modified, or some hardware is to be informed, when - information is changed. -

+ +

The module snmp_generic contains generic functions for + implementing tables (and variables) using the SNMP built-in database + or Mnesia. These default functions are used if no instrumentation + function is provided for a managed object in a MIB. Sometimes, + it might be necessary to customize the behaviour of the default + functions. For example, in some situations a trap should be sent + if a row is deleted or modified, or some hardware is to be informed, + when information is changed.

+

The overall structure is shown in the following figure:

          +---------------+
@@ -93,6 +94,7 @@
   
 
   
+ DATA TYPES

In the functions defined below, the following types are used:

@@ -118,7 +120,10 @@ value() = term() case of a set operation.

+ +
+ get_status_col(Name, Cols) @@ -136,8 +141,11 @@ value() = term()

This function can be used in instrumentation functions for is_set_ok, undo or set to check if the status column of a table is modified.

+ +
+ get_index_types(Name) Get the index types of Name @@ -147,9 +155,36 @@ value() = term()

Gets the index types of Name

This function can be used in instrumentation functions to - retrieve the index types part of the table info.

+ retrieve the index types part of the table info.

+ +
+ + + get_table_info(Name, Item) -> table_info_result() + Get table info item of MIB table Name + + Name = name() + Item = table_item() | all + table_item() = nbr_of_cols | defvals | status_col | not_accessible | + index_types | first_accessible | first_own_index + table_info_result() = Value | [{table_item(), Value}] + Value = term() + + +

Get a specific table info item or, if Item has the + value all, a two tuple list (property list) is instead + returned with all the items and their respctive values of the + given table.

+ +

This function can be used in instrumentation functions to + retrieve a given part of the table info.

+ + +
+
+ table_func(Op1, NameDb) table_func(Op2, RowIndex, Cols, NameDb) -> Ret @@ -190,8 +225,11 @@ value() = term()

The function returns according to the specification of an instrumentation function.

+ +
+ table_get_elements(NameDb, RowIndex, Cols) -> Values Get elements in a table row @@ -204,8 +242,11 @@ value() = term()

Returns a list with values for all columns in Cols. If a column is undefined, its value is noinit.

+ +
+ table_next(NameDb, RestOid) -> RowIndex | endOfTable Find the next row in the table @@ -217,8 +258,11 @@ value() = term()

Finds the indices of the next row in the table. RestOid does not have to specify an existing row.

+ +
+ table_row_exists(NameDb, RowIndex) -> bool() Check if a row in a table exists @@ -228,8 +272,11 @@ value() = term()

Checks if a row in a table exists.

+ +
+ table_set_elements(NameDb, RowIndex, Cols) -> bool() Set elements in a table row @@ -246,8 +293,11 @@ value() = term() mnesia:write to store the values. This means that this function must be called from within a transaction (mnesia:transaction/1 or mnesia:dirty/1).

+ +
+ variable_func(Op1, NameDb) variable_func(Op2, Val, NameDb) -> Ret @@ -268,8 +318,11 @@ value() = term() the database.

The function returns according to the specification of an instrumentation function.

+ +
+ variable_get(NameDb) -> {value, Value} | undefined Get the value of a variable @@ -279,8 +332,11 @@ value() = term()

Gets the value of a variable.

+ +
+ variable_set(NameDb, NewVal) -> true | false Set a value for a variable @@ -299,6 +355,7 @@ value() = term()
+ Example

The following example shows an implementation of a table which is stored in Mnesia, but with some checks performed at set-request -- cgit v1.2.1