Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:25
erlang
1556-snmp-Types-and-specs-for-snmp_generic-get_...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 1556-snmp-Types-and-specs-for-snmp_generic-get_index_type.patch of Package erlang
From d1104df41e96008e5270cf7cc928634260e9496c Mon Sep 17 00:00:00 2001 From: Micael Karlberg <bmk@erlang.org> Date: Fri, 12 Jan 2024 12:31:12 +0100 Subject: [PATCH 36/67] [snmp] Types and specs for snmp_generic:get_index_types/1 --- lib/snmp/doc/src/Makefile | 4 +- lib/snmp/doc/src/snmp.xml | 11 ++++++ lib/snmp/doc/src/snmp_generic.xml | 5 +-- lib/snmp/doc/src/snmpa.xml | 61 +++++++++++++++++++++++++++++ lib/snmp/doc/src/specs.xml | 2 + lib/snmp/src/agent/snmp_generic.erl | 5 +++ lib/snmp/src/agent/snmpa.erl | 25 +++++++++++- 7 files changed, 106 insertions(+), 7 deletions(-) diff --git a/lib/snmp/doc/src/Makefile b/lib/snmp/doc/src/Makefile index b8bf3f4500..564b751c82 100644 --- a/lib/snmp/doc/src/Makefile +++ b/lib/snmp/doc/src/Makefile @@ -60,7 +60,9 @@ SPECS_FILES = \ $(SPECDIR)/specs_snmp.xml \ $(SPECDIR)/specs_snmp_community_mib.xml \ $(SPECDIR)/specs_snmp_framework_mib.xml \ - $(SPECDIR)/specs_snmp_target_mib.xml + $(SPECDIR)/specs_snmp_target_mib.xml \ + $(SPECDIR)/specs_snmp_generic.xml \ + $(SPECDIR)/specs_snmpa.xml TOP_SPECS_FILE = specs.xml diff --git a/lib/snmp/doc/src/snmp.xml b/lib/snmp/doc/src/snmp.xml index c1e40cce7d..041951d22e 100644 --- a/lib/snmp/doc/src/snmp.xml +++ b/lib/snmp/doc/src/snmp.xml @@ -165,6 +165,17 @@ --> </datatype> + <datatype> + <name name="asn1_type"/> + <!-- + <desc> + <p> + TBD + </p> + </desc> + --> + </datatype> + <datatype> <name name="void"/> <desc> diff --git a/lib/snmp/doc/src/snmp_generic.xml b/lib/snmp/doc/src/snmp_generic.xml index 29255e264b..ec1d1460eb 100644 --- a/lib/snmp/doc/src/snmp_generic.xml +++ b/lib/snmp/doc/src/snmp_generic.xml @@ -148,11 +148,8 @@ value() = term() </func> <func> - <name since="">get_index_types(Name)</name> + <name name="get_index_types" arity="1" clause_i="1" since=""/> <fsummary>Get the index types of <c>Name</c></fsummary> - <type> - <v>Name = name()</v> - </type> <desc> <p>Gets the index types of <c>Name</c></p> <p>This function can be used in instrumentation functions to diff --git a/lib/snmp/doc/src/snmpa.xml b/lib/snmp/doc/src/snmpa.xml index c7ddd10d67..ab5e22bfb7 100644 --- a/lib/snmp/doc/src/snmpa.xml +++ b/lib/snmp/doc/src/snmpa.xml @@ -41,6 +41,67 @@ <marker id="data_types"></marker> </description> + + <datatypes> + <datatype> + <name name="table_name"/> + <!-- + <desc> + <p> + TBD + </p> + </desc> + --> + </datatype> + + <datatype> + <name name="variable_name"/> + <!-- + <desc> + <p> + TBD + </p> + </desc> + --> + </datatype> + + <datatype> + <name name="name"/> + <!-- + <desc> + <p> + TBD + </p> + </desc> + --> + </datatype> + + <datatype> + <name name="db"/> + <!-- + <desc> + <p> + TBD + </p> + </desc> + --> + </datatype> + + <datatype> + <name name="name_db"/> + <!-- + <desc> + <p> + TBD + </p> + </desc> + --> + </datatype> + + </datatypes> + + + <section> <title>DATA TYPES</title> <code type="none"><![CDATA[ diff --git a/lib/snmp/doc/src/specs.xml b/lib/snmp/doc/src/specs.xml index 37006d7fed..a8716af906 100644 --- a/lib/snmp/doc/src/specs.xml +++ b/lib/snmp/doc/src/specs.xml @@ -4,4 +4,6 @@ <xi:include href="../specs/specs_snmp_community_mib.xml"/> <xi:include href="../specs/specs_snmp_framework_mib.xml"/> <xi:include href="../specs/specs_snmp_target_mib.xml"/> + <xi:include href="../specs/specs_snmp_generic.xml"/> + <xi:include href="../specs/specs_snmpa.xml"/> </specs> diff --git a/lib/snmp/src/agent/snmp_generic.erl b/lib/snmp/src/agent/snmp_generic.erl index 6419503322..9c25a70519 100644 --- a/lib/snmp/src/agent/snmp_generic.erl +++ b/lib/snmp/src/agent/snmp_generic.erl @@ -880,6 +880,11 @@ get_table_info(Name, all) -> %% Description: %% Used by user's instrum func to get the index types. %%----------------------------------------------------------------- + +-spec get_index_types(Name) -> IndexTypes when + Name :: snmpa:name() | snmpa:name_db(), + IndexTypes :: [snmp:asn1_type()]. + get_index_types(Name) -> #table_info{index_types = IndexTypes} = table_info(Name), IndexTypes. diff --git a/lib/snmp/src/agent/snmpa.erl b/lib/snmp/src/agent/snmpa.erl index c0193438fb..afb8225d0c 100644 --- a/lib/snmp/src/agent/snmpa.erl +++ b/lib/snmp/src/agent/snmpa.erl @@ -39,6 +39,7 @@ int_to_enum/2, int_to_enum/3, enum_to_int/2, enum_to_int/3, + name_db/1, info/0, info/1, load_mib/1, load_mib/2, load_mibs/1, load_mibs/2, load_mibs/3, @@ -118,6 +119,12 @@ -export_type([ me/0, + table_name/0, + variable_name/0, + name/0, + db/0, + name_db/0, + pdu_type/0, %% Agent config types @@ -139,7 +146,7 @@ %% Types %%----------------------------------------------------------------- --type me() :: #me{}. +-type me() :: snmp:me(). %% Agent config types -type mib_storage() :: [mib_storage_opt()]. @@ -151,12 +158,26 @@ %% Options specific to the above module -type mib_storage_options() :: list(). --type mib_module() :: atom(). -type table_name() :: atom(). -type variable_name() :: atom(). +-type name() :: table_name() | variable_name(). +-type db() :: volatile | persistent | mnesia. +-type name_db() :: {name(), db()}. +-type mib_module() :: atom(). -type mib_info() :: {mib_module(), [table_name()], [variable_name()]}. -type pdu_type() :: snmp:pdu_type(). + +%%----------------------------------------------------------------- + +-spec name_db(Name) -> NameDb when + Name :: name(), + NameDb :: name_db(). + +name_db(Name) -> + snmpa_agent:db(Name). + + %%----------------------------------------------------------------- %% This utility function is used to convert an old SNMP application %% config (prior to snmp-4.0) to a SNMP agent config (as 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