Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:26
erlang
2857-snmp-Types-and-specs-for-snmp_generic-get_...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 2857-snmp-Types-and-specs-for-snmp_generic-get_status_col.patch of Package erlang
From 2281e3cda748d1ffeca4b52b8bd3418f549f57c9 Mon Sep 17 00:00:00 2001 From: Micael Karlberg <bmk@erlang.org> Date: Fri, 12 Jan 2024 13:18:51 +0100 Subject: [PATCH 37/67] [snmp] Types and specs for snmp_generic:get_status_col/2 --- lib/snmp/doc/src/snmp_generic.xml | 45 ++++++++++++++++++++--------- lib/snmp/src/agent/snmp_generic.erl | 15 ++++++++++ 2 files changed, 47 insertions(+), 13 deletions(-) diff --git a/lib/snmp/doc/src/snmp_generic.xml b/lib/snmp/doc/src/snmp_generic.xml index ec1d1460eb..22d198636f 100644 --- a/lib/snmp/doc/src/snmp_generic.xml +++ b/lib/snmp/doc/src/snmp_generic.xml @@ -94,6 +94,32 @@ </pre> </description> + + <datatypes> + <datatype> + <name name="column"/> + <!-- + <desc> + <p> + TBD + </p> + </desc> + --> + </datatype> + + <datatype> + <name name="columns"/> + <desc> + <p> + Is a list of column numbers in the case of a get operation, + and a list of column numbers and values in the case of a + set operation. + </p> + </desc> + </datatype> + + </datatypes> + <section> <marker id="data_types"></marker> <title>DATA TYPES</title> @@ -127,21 +153,14 @@ value() = term() <funcs> <func> - <name since="">get_status_col(Name, Cols)</name> - <name since="">get_status_col(NameDb, Cols) -> {ok, StatusVal} | false</name> + <name name="get_status_col" arity="2" clause_i="1" since=""/> <fsummary>Get the value of the status column from <c>Cols</c></fsummary> - <type> - <v>Name = name()</v> - <v>NameDb = name_db()</v> - <v>Cols = columns()</v> - <v>StatusVal = term()</v> - </type> <desc> - <p>Gets the value of the status column from <c>Cols</c>. - </p> - <p>This function can be used in instrumentation functions for - <c>is_set_ok</c>, <c>undo</c> or <c>set</c> to check if the - status column of a table is modified.</p> + <p>Gets the value of the status column from <c>Cols</c>. </p> + + <p>This function can be used in instrumentation functions for + <c>is_set_ok</c>, <c>undo</c> or <c>set</c> to check if the + status column of a table is modified. </p> <marker id="get_index_types"></marker> </desc> diff --git a/lib/snmp/src/agent/snmp_generic.erl b/lib/snmp/src/agent/snmp_generic.erl index 9c25a70519..1c070388e8 100644 --- a/lib/snmp/src/agent/snmp_generic.erl +++ b/lib/snmp/src/agent/snmp_generic.erl @@ -37,6 +37,11 @@ handle_table_get/4, variable_inc/2, get_status_col/2, get_table_info/2, get_index_types/1]). +-export_type([ + column/0, + columns/0 + ]). + -include("STANDARD-MIB.hrl"). -include("snmp_types.hrl"). @@ -48,6 +53,10 @@ -endif. +-type column() :: integer(). +-type columns() :: [column()] | [{column(), Value :: term()}]. + + %%%----------------------------------------------------------------- %%% Generic functions for implementing software tables %%% and variables. @@ -837,6 +846,12 @@ table_get_row(NameDb, RowIndex, _FOI) -> %% Used by user's instrum func to check if mstatus column is %% modified. %%----------------------------------------------------------------- + +-spec get_status_col(Name, Cols) -> false | {value, StatusCol} when + Name :: snmpa:name() | snmpa:name_db(), + Cols :: columns(), + StatusCol :: term(). + get_status_col(Name, Cols) -> #table_info{status_col = StatusCol} = table_info(Name), case lists:keysearch(StatusCol, 1, Cols) of -- 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