Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang
erlang
1558-snmp-Types-and-specs-for-snmp_generic-get_...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 1558-snmp-Types-and-specs-for-snmp_generic-get_table_info.patch of Package erlang
From a5d614753e67a1521029723161350c504d84f9f1 Mon Sep 17 00:00:00 2001 From: Micael Karlberg <bmk@erlang.org> Date: Fri, 12 Jan 2024 16:44:43 +0100 Subject: [PATCH 38/67] [snmp] Types and specs for snmp_generic:get_table_info/2 --- lib/snmp/doc/src/snmp_generic.xml | 197 ++++++++++++++++++++++++++-- lib/snmp/src/agent/snmp_generic.erl | 48 ++++++- 2 files changed, 232 insertions(+), 13 deletions(-) diff --git a/lib/snmp/doc/src/snmp_generic.xml b/lib/snmp/doc/src/snmp_generic.xml index 22d198636f..8d93521f9e 100644 --- a/lib/snmp/doc/src/snmp_generic.xml +++ b/lib/snmp/doc/src/snmp_generic.xml @@ -118,6 +118,98 @@ </desc> </datatype> + <datatype> + <name name="table_info_item"/> + <desc> + <p>For an ordinary table, the types will be the following: </p> + <taglist> + <tag><c><![CDATA[nbr_of_cols]]></c></tag> + <item> + <p>Number of columns.</p> + <p>Value type: + <seetype marker="erlang#pos_integer">pos_integer()</seetype></p> + </item> + + <tag><c><![CDATA[defvals]]></c></tag> + <item> + <p>A list of default values, ordered by column.</p> + <p>Value type: + [{Col :: <seetype marker="erlang#pos_integer">pos_integer()</seetype>, + DefVal :: <seetype marker="erlang#term">term()</seetype>}]</p> + </item> + + <tag><c><![CDATA[status_col]]></c></tag> + <item> + <p>Column number of the status column.</p> + <p>Value type: + <seetype marker="erlang#pos_integer">pos_integer()</seetype></p> + </item> + + <tag><c><![CDATA[not_accessible]]></c></tag> + <item> + <p>A sorted list of columns (> first_accessible) that are + 'not-accessible'.</p> + <p>Value type: + [<seetype marker="erlang#pos_integer">pos_integer()</seetype>]</p> + </item> + + <tag><c><![CDATA[index_types]]></c></tag> + <item> + <p>A list of + <seetype marker="snmp#asn1_type">asn1_type()</seetype> + for the index columns, ordered by column number + or an "augment"-tuple (see below). </p> + <p>Value type: + [<seetype marker="snmp#asn1_type">asn1_type()</seetype>]</p> + </item> + + <tag><c><![CDATA[first_accessible]]></c></tag> + <item> + <p>The first accessible column. </p> + <p>Value type: + <seetype marker="erlang#pos_integer">pos_integer()</seetype></p> + </item> + + <tag><c><![CDATA[first_own_index]]></c></tag> + <item> + <p>Column number of the first own index. + Will be <c><![CDATA[0]]></c> if there is no such index + for this table. </p> + <p>Value type: + <seetype marker="erlang#non_neg_integer">non_neg_integer()</seetype></p> + </item> + + </taglist> + + <p>For a augmented table, it will instead look like this: </p> + <taglist> + <tag><c><![CDATA[index_types]]></c></tag> + <item> + <p>Value type: {augments, {<seetype marker="erlang#atom">atom()</seetype>, <seetype marker="snmp#asn1_type">asn1_type()</seetype>}}</p> + </item> + + <tag><c><![CDATA[nbr_of_cols]]></c></tag> + <item> + <p>Value type: + <seetype marker="erlang#pos_integer">pos_integer()</seetype></p> + </item> + + <tag><c><![CDATA[not_accessible]]></c></tag> + <item> + <p>Value type: + [<seetype marker="erlang#pos_integer">pos_integer()</seetype>]</p> + </item> + + <tag><c><![CDATA[first_accessible]]></c></tag> + <item> + <p>Value type: + <seetype marker="erlang#pos_integer">pos_integer()</seetype></p> + </item> + + </taglist> + </desc> + </datatype> + </datatypes> <section> @@ -175,23 +267,106 @@ value() = term() retrieve the index types part of the table info.</p> <marker id="get_table_info"></marker> + <marker id="get_table_info_1"></marker> </desc> </func> <func> - <name since="OTP R15B01">get_table_info(Name, Item) -> table_info_result()</name> + <name name="get_table_info" arity="2" clause_i="1" since="OTP R15B01"/> + <fsummary>Get table info item of MIB table <c>Name</c></fsummary> + <desc> + <p>Get the specific table info item (nbr_of_cols). </p> + + <p>This function can be used in instrumentation functions to + retrieve a given part of the table info.</p> + + <marker id="get_table_info_2"></marker> + </desc> + </func> + + <func> + <name name="get_table_info" arity="2" clause_i="2" since="OTP R15B01"/> + <fsummary>Get table info item of MIB table <c>Name</c></fsummary> + <desc> + <p>Get a specific table info item (defvals). </p> + + <p>This function can be used in instrumentation functions to + retrieve a given part of the table info.</p> + + <marker id="get_table_info_3"></marker> + </desc> + </func> + + <func> + <name name="get_table_info" arity="2" clause_i="3" since="OTP R15B01"/> + <fsummary>Get table info item of MIB table <c>Name</c></fsummary> + <desc> + <p>Get a specific table info item (status_col). </p> + + <p>This function can be used in instrumentation functions to + retrieve a given part of the table info.</p> + + <marker id="get_table_info_4"></marker> + </desc> + </func> + + <func> + <name name="get_table_info" arity="2" clause_i="4" since="OTP R15B01"/> + <fsummary>Get table info item of MIB table <c>Name</c></fsummary> + <desc> + <p>Get a specific table info item (not_accessible). </p> + + <p>This function can be used in instrumentation functions to + retrieve a given part of the table info.</p> + + <marker id="get_table_info_5"></marker> + </desc> + </func> + + <func> + <name name="get_table_info" arity="2" clause_i="5" since="OTP R15B01"/> + <fsummary>Get table info item of MIB table <c>Name</c></fsummary> + <desc> + <p>Get a specific table info item (index_types). </p> + + <p>This function can be used in instrumentation functions to + retrieve a given part of the table info.</p> + + <marker id="get_table_info_6"></marker> + </desc> + </func> + + <func> + <name name="get_table_info" arity="2" clause_i="6" since="OTP R15B01"/> + <fsummary>Get table info item of MIB table <c>Name</c></fsummary> + <desc> + <p>Get a specific table info item (first_accessible). </p> + + <p>This function can be used in instrumentation functions to + retrieve a given part of the table info.</p> + + <marker id="get_table_info_7"></marker> + </desc> + </func> + + <func> + <name name="get_table_info" arity="2" clause_i="7" since="OTP R15B01"/> + <fsummary>Get table info item of MIB table <c>Name</c></fsummary> + <desc> + <p>Get a specific table info item (first_own_index). </p> + + <p>This function can be used in instrumentation functions to + retrieve a given part of the table info.</p> + + <marker id="get_table_info_8"></marker> + </desc> + </func> + + <func> + <name name="get_table_info" arity="2" clause_i="8" since="OTP R15B01"/> <fsummary>Get table info item of MIB table <c>Name</c></fsummary> - <type> - <v>Name = name()</v> - <v>Item = table_item() | all</v> - <v>table_item() = nbr_of_cols | defvals | status_col | not_accessible | - index_types | first_accessible | first_own_index</v> - <v>table_info_result() = Value | [{table_item(), Value}]</v> - <v>Value = term()</v> - </type> <desc> - <p>Get a specific table info item or, if <c>Item</c> has the - value <c>all</c>, a two tuple list (property list) is instead + <p>Get all table info item(s), a two tuple list (property list) is returned with all the items and their respctive values of the given table. </p> diff --git a/lib/snmp/src/agent/snmp_generic.erl b/lib/snmp/src/agent/snmp_generic.erl index 1c070388e8..ed2c3db5e9 100644 --- a/lib/snmp/src/agent/snmp_generic.erl +++ b/lib/snmp/src/agent/snmp_generic.erl @@ -53,8 +53,16 @@ -endif. --type column() :: integer(). --type columns() :: [column()] | [{column(), Value :: term()}]. +-type column() :: integer(). +-type columns() :: [column()] | [{column(), Value :: term()}]. +-type table_info_item() :: nbr_of_cols | + defvals | + status_col | + not_accessible | + index_types | + first_accessible | + first_own_index. + %%%----------------------------------------------------------------- @@ -866,6 +874,42 @@ get_status_col(Name, Cols) -> %% or all of it. If all is selected then the result will be a tagged %% list of values. %%----------------------------------------------------------------- + +-spec get_table_info(Name, Item :: nbr_of_cols) -> Result when + Name :: snmpa:name() | snmpa:name_db(), + %% Item :: nbr_of_cols, + Result :: pos_integer(); + (Name, Item :: defvals) -> Result when + Name :: snmpa:name() | snmpa:name_db(), + %% Item :: defvals, + Result :: [{Col, DefVal}], + Col :: pos_integer(), + DefVal :: term(); + (Name, Item :: status_col) -> Result when + Name :: snmpa:name() | snmpa:name_db(), + %% Item :: status_col, + Result :: pos_integer(); + (Name, Item :: not_accessible) -> Result when + Name :: snmpa:name() | snmpa:name_db(), + %% Item :: not_accessible, + Result :: [pos_integer()]; + (Name, Item :: index_types) -> Result when + Name :: snmpa:name() | snmpa:name_db(), + %% Item :: index_types, + Result :: [snmp:asn1_type()]; + (Name, Item :: first_accessible) -> Result when + Name :: snmpa:name() | snmpa:name_db(), + %% Item :: first_accessible, + Result :: pos_integer(); + (Name, Item :: first_own_index) -> Result when + Name :: snmpa:name() | snmpa:name_db(), + %% Item :: first_own_index, + Result :: non_neg_integer(); + (Name, Item :: all) -> Result when + Name :: snmpa:name() | snmpa:name_db(), + %% Item :: all, + Result :: [{table_info_item(), term()}]. + get_table_info(Name, nbr_of_cols) -> get_nbr_of_cols(Name); get_table_info(Name, defvals) -> -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor