Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang
erlang
1561-snmp-Types-and-specs-for-snmp_generic-vari...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 1561-snmp-Types-and-specs-for-snmp_generic-variable_func-.patch of Package erlang
From de8976e1c21a5f62df17ed256a7bb81bdcfbb7f6 Mon Sep 17 00:00:00 2001 From: Micael Karlberg <bmk@erlang.org> Date: Fri, 12 Jan 2024 20:30:20 +0100 Subject: [PATCH 41/67] [snmp] Types and specs for snmp_generic:variable_func/2,3 --- lib/snmp/doc/src/snmp_generic.xml | 93 ++++++++++++++++++++++++----- lib/snmp/src/agent/snmp_generic.erl | 27 ++++++++- 2 files changed, 103 insertions(+), 17 deletions(-) diff --git a/lib/snmp/doc/src/snmp_generic.xml b/lib/snmp/doc/src/snmp_generic.xml index 8ee5eea9a9..a5440a4521 100644 --- a/lib/snmp/doc/src/snmp_generic.xml +++ b/lib/snmp/doc/src/snmp_generic.xml @@ -488,29 +488,90 @@ value() = term() (<c>mnesia:transaction/1</c> or <c>mnesia:dirty/1</c>).</p> <marker id="variable_func"></marker> + <marker id="variable_func2"></marker> </desc> </func> <func> - <name since="">variable_func(Op1, NameDb)</name> - <name since="">variable_func(Op2, Val, NameDb) -> Ret</name> + <name name="variable_func" arity="2" clause_i="1" since=""/> + <fsummary>Default instrumentation function for tables</fsummary> + <desc> + <p>This is the default instrumentation function for variables.</p> + + <p>The <c>new</c> function creates a new variable in the + database with a default value as defined in the MIB, or a zero + value (depending on the type). </p> + + <p>The function returns according to the specification of an + instrumentation function. </p> + + <marker id="variable_func3"></marker> + </desc> + </func> + + <func> + <name name="variable_func" arity="2" clause_i="2" since=""/> + <fsummary>Default instrumentation function for tables</fsummary> + <desc> + <p>This is the default instrumentation function for variables.</p> + + <p>The <c>delete</c> function does not delete the variable from + the database. </p> + + <p>The function returns according to the specification of an + instrumentation function. </p> + + <marker id="variable_func3"></marker> + </desc> + </func> + + <func> + <name name="variable_func" arity="2" clause_i="3" since=""/> <fsummary>Default instrumentation function for tables</fsummary> - <type> - <v>Op1 = new | delete | get</v> - <v>Op2 = is_set_ok | set | undo</v> - <v>NameDb = name_db()</v> - <v>Val = value()</v> - <v>Ret = term()</v> - </type> <desc> <p>This is the default instrumentation function for variables.</p> - <p>The <c>new</c> function creates a new variable in the - database with a default value as defined in the MIB, or a zero - value (depending on the type). </p> - <p>The <c>delete</c> function does not delete the variable from - the database. </p> - <p>The function returns according to the specification of an - instrumentation function. </p> + + <p>The function returns according to the specification of an + instrumentation function. </p> + + <marker id="variable_func3"></marker> + </desc> + </func> + + <func> + <name name="variable_func" arity="3" clause_i="1" since=""/> + <fsummary>Default instrumentation function for tables</fsummary> + <desc> + <p>This is the default instrumentation function for variables.</p> + + <p>The function returns according to the specification of an + instrumentation function. </p> + + <marker id="variable_get"></marker> + </desc> + </func> + + <func> + <name name="variable_func" arity="3" clause_i="2" since=""/> + <fsummary>Default instrumentation function for tables</fsummary> + <desc> + <p>This is the default instrumentation function for variables.</p> + + <p>The function returns according to the specification of an + instrumentation function. </p> + + <marker id="variable_get"></marker> + </desc> + </func> + + <func> + <name name="variable_func" arity="3" clause_i="3" since=""/> + <fsummary>Default instrumentation function for tables</fsummary> + <desc> + <p>This is the default instrumentation function for variables.</p> + + <p>The function returns according to the specification of an + instrumentation function. </p> <marker id="variable_get"></marker> </desc> diff --git a/lib/snmp/src/agent/snmp_generic.erl b/lib/snmp/src/agent/snmp_generic.erl index 2c3f485159..bb85cd5094 100644 --- a/lib/snmp/src/agent/snmp_generic.erl +++ b/lib/snmp/src/agent/snmp_generic.erl @@ -177,7 +177,18 @@ table_max_col(NameDb, Col) -> % ret largest element in Col %%------------------------------------------------------------------ %% This is the default function for variables. %%------------------------------------------------------------------ - + +-spec variable_func(Op :: new, NameDb) -> Result when + NameDb :: snmpa:name_db(), + Result :: ok | boolean(); + (Op :: delete, NameDb) -> Result when + NameDb :: snmpa:name_db(), + Result :: ok; + (Op :: get, NameDb) -> Result when + NameDb :: snmpa:name_db(), + Result :: {value, Value} | genErr, + Value :: term(). + variable_func(new, NameDb) -> case variable_get(NameDb) of {value, _} -> ok; @@ -195,6 +206,20 @@ variable_func(get, NameDb) -> _ -> genErr end. + +-spec variable_func(Op :: is_set_ok, Value, NameDb) -> Result when + Value :: term(), + NameDb :: snmpa:name_db(), + Result :: noError; + (Op :: set, Value, NameDb) -> Result when + Value :: term(), + NameDb :: snmpa:name_db(), + Result :: noError | commitFailed; + (Op :: undo, Value, NameDb) -> Result when + Value :: term(), + NameDb :: snmpa:name_db(), + Result :: noError. + variable_func(is_set_ok, _Val, _NameDb) -> noError; variable_func(set, Val, NameDb) -> -- 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