Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:25
erlang
1521-snmp-Types-and-specs-for-snmp-bits_to_octe...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 1521-snmp-Types-and-specs-for-snmp-bits_to_octet_string-1.patch of Package erlang
From b5b46056aac8438691099bf5aa20447a4e470223 Mon Sep 17 00:00:00 2001 From: Micael Karlberg <bmk@erlang.org> Date: Tue, 9 Jan 2024 11:31:40 +0100 Subject: [PATCH 01/67] [snmp] Types and specs for snmp:bits_to_octet_string/1 Once 'specs' was introduced (in the snmp doc builds) it required a couple of things from the snmp doc build, which in turn required us to add some, hopefully, temporary stuff in a couple of source files. --- lib/snmp/doc/specs/.gitignore | 1 + lib/snmp/doc/src/Makefile | 42 +++++++++++++++--- lib/snmp/doc/src/snmp.xml | 54 ++++++++++++++++++++++- lib/snmp/doc/src/specs.xml | 4 ++ lib/snmp/src/agent/snmp_framework_mib.erl | 13 +++++- lib/snmp/src/agent/snmpa_conf.erl | 10 +++++ lib/snmp/src/agent/snmpa_local_db.erl | 9 ++++ lib/snmp/src/app/snmp.erl | 14 +++++- lib/snmp/src/manager/snmpm_conf.erl | 10 +++++ 9 files changed, 147 insertions(+), 10 deletions(-) create mode 100644 lib/snmp/doc/specs/.gitignore create mode 100644 lib/snmp/doc/src/specs.xml diff --git a/lib/snmp/doc/specs/.gitignore b/lib/snmp/doc/specs/.gitignore new file mode 100644 index 0000000000..322eebcb06 --- /dev/null +++ b/lib/snmp/doc/specs/.gitignore @@ -0,0 +1 @@ +specs_*.xml diff --git a/lib/snmp/doc/src/Makefile b/lib/snmp/doc/src/Makefile index 79880fcbd7..6d7be422e7 100644 --- a/lib/snmp/doc/src/Makefile +++ b/lib/snmp/doc/src/Makefile @@ -2,7 +2,7 @@ # %CopyrightBegin% # -# Copyright Ericsson AB 1997-2021. All Rights Reserved. +# Copyright Ericsson AB 1997-2024. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -47,11 +47,18 @@ HTML_FILES = \ $(HTML_APP_FILES) \ $(HTML_PART_FILES) -XML_ERRS = $(XML_FILES:%.xml=%.latex.xmls_errs) \ - $(XML_FILES:%.xml=%.html.xmls_errs) +XML_ERRS = \ + $(XML_FILES:%.xml=%.latex.xmls_errs) \ + $(XML_FILES:%.xml=%.html.xmls_errs) -XML_OUTPUT = $(XML_FILES:%.xml=%.latex.xmls_output) \ - $(XML_FILES:%.xml=%.html.xmls_output) +XML_OUTPUT = \ + $(XML_FILES:%.xml=%.latex.xmls_output) \ + $(XML_FILES:%.xml=%.html.xmls_output) + +# SPECS_FILES = $(XML_REF3_FILES:%.xml=$(SPECDIR)/specs_%.xml) +SPECS_FILES = \ + $(SPECDIR)/specs_snmp.xml +TOP_SPECS_FILE = specs.xml NO_CHUNKS = @@ -65,6 +72,7 @@ NO_CHUNKS = snmpa_discovery_handler.xml \ NO_CHUNKS = + # ---------------------------------------------------- # Targets # ---------------------------------------------------- @@ -84,8 +92,30 @@ $(MAN1DIR)/snmpc.1: snmpc_cmd.xml # ---------------------------------------------------- include $(ERL_TOP)/make/doc.mk +SPECS_FLAGS += \ + -I../../src/app \ + -I../../src/misc \ + -I../../include \ + -I../../../kernel/include + +$(SPECDIR)/specs_%.xml: $(SPECS_ESRC)/app/%.erl $(TOP_SPECS_FILE) + $(gen_verbose)escript $(SPECS_EXTRACTOR) $(SPECS_FLAGS) -o$(dir $@) $< +$(SPECDIR)/specs_%.xml: $(SPECS_ESRC)/compile/%.erl $(TOP_SPECS_FILE) + $(gen_verbose)escript $(SPECS_EXTRACTOR) $(SPECS_FLAGS) -o$(dir $@) $< +$(SPECDIR)/specs_%.xml: $(SPECS_ESRC)/misc/%.erl $(TOP_SPECS_FILE) + $(gen_verbose)escript $(SPECS_EXTRACTOR) $(SPECS_FLAGS) -o$(dir $@) $< +$(SPECDIR)/specs_%.xml: $(SPECS_ESRC)/agent/%.erl $(TOP_SPECS_FILE) + $(gen_verbose)escript $(SPECS_EXTRACTOR) $(SPECS_FLAGS) -o$(dir $@) $< +$(SPECDIR)/specs_%.xml: $(SPECS_ESRC)/manager/%.erl $(TOP_SPECS_FILE) + $(gen_verbose)escript $(SPECS_EXTRACTOR) $(SPECS_FLAGS) -o$(dir $@) $< + + +$(HTMLDIR)/snmp.html: snmp.xml + +# ---------------------------------------------------- -info: info_xml info_man info_html +linfo: info_xml info_man info_html + @echo "SPECS_FILES = $(SPECS_FILES)" info_man: @echo "man files:" diff --git a/lib/snmp/doc/src/snmp.xml b/lib/snmp/doc/src/snmp.xml index cc866b9f99..2ed6e5997c 100644 --- a/lib/snmp/doc/src/snmp.xml +++ b/lib/snmp/doc/src/snmp.xml @@ -4,7 +4,7 @@ <erlref> <header> <copyright> - <year>1996</year><year>2021</year> + <year>1996</year><year>2024</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -39,6 +39,51 @@ SNMP toolkit.</p> </description> + <datatypes> + <datatype> + <name name="bits"/> + <desc> + <p> + The Erlang representation of the SNMP BITS (pseudo) data type. + </p> + </desc> + </datatype> + + <datatype> + <name name="octet"/> + <!-- + <desc> + <p> + TBD. + </p> + </desc> + --> + </datatype> + + <datatype> + <name name="octet_string"/> + <!-- + <desc> + <p> + TBD. + </p> + </desc> + --> + </datatype> + + <!-- + <datatype> + <name name="void"/> + <desc> + <p> + The type is used when a functions return is to be ignored. + </p> + </desc> + </datatype> + --> + + </datatypes> + <section> <title>Common Data Types</title> <p>The following data-types are used in the functions below: </p> @@ -312,14 +357,19 @@ </func> <func> + <name name="bits_to_octet_string" arity="1" clause_i="1" since=""/> + <!-- <name since="">bits_to_octet_string(B) -> Val</name> + --> <fsummary>Convert an OCTET-STRING to BITS</fsummary> + <!-- <type> <v>Val = octet_string()</v> </type> + --> <desc> <p>Utility function for converting a value of type <c>BITS</c> - to <c>OCTET-STRING</c>. </p> + to <c>OCTET-STRING</c>, according to RFC1906, section 8. </p> <marker id="read_mib"></marker> </desc> diff --git a/lib/snmp/doc/src/specs.xml b/lib/snmp/doc/src/specs.xml new file mode 100644 index 0000000000..bc617cea24 --- /dev/null +++ b/lib/snmp/doc/src/specs.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8" ?> +<specs xmlns:xi="http://www.w3.org/2001/XInclude"> + <xi:include href="../specs/specs_snmp.xml"/> +</specs> diff --git a/lib/snmp/src/agent/snmp_framework_mib.erl b/lib/snmp/src/agent/snmp_framework_mib.erl index 3f2179c11e..8d6e655a9d 100644 --- a/lib/snmp/src/agent/snmp_framework_mib.erl +++ b/lib/snmp/src/agent/snmp_framework_mib.erl @@ -25,8 +25,19 @@ -define(VMODULE,"FRAMEWORK-MIB"). -include("snmp_verbosity.hrl"). + -ifndef(default_verbosity). --define(default_verbosity,silence). +-define(default_verbosity, silence). +-endif. + + +-ifndef(version). +%% This crap is hopefully temporary! +%% It is because our current doc build +%% script (specs file generation) has +%% no way to pass this value in as the +%% normal compilation (erlc) does. +-define(version, "99.99"). -endif. diff --git a/lib/snmp/src/agent/snmpa_conf.erl b/lib/snmp/src/agent/snmpa_conf.erl index 4b0bc2e7f3..b1f1ecd25f 100644 --- a/lib/snmp/src/agent/snmpa_conf.erl +++ b/lib/snmp/src/agent/snmpa_conf.erl @@ -176,6 +176,16 @@ }. +-ifndef(version). +%% This crap is hopefully temporary! +%% It is because our current doc build +%% script (specs file generation) has +%% no way to pass this value in as the +%% normal compilation (erlc) does. +-define(version, "99.99"). +-endif. + + %% %% ------ agent.conf ------ %% diff --git a/lib/snmp/src/agent/snmpa_local_db.erl b/lib/snmp/src/agent/snmpa_local_db.erl index 2b6588b412..5b8e9da2b5 100644 --- a/lib/snmp/src/agent/snmpa_local_db.erl +++ b/lib/snmp/src/agent/snmpa_local_db.erl @@ -61,6 +61,15 @@ -define(ETS_TAB, snmpa_local_db2). -define(SERVER, ?MODULE). +-ifndef(default_verbosity). +%% This crap is hopefully temporary! +%% It is because our current doc build +%% script (specs file generation) has +%% no way to pass this value in as the +%% normal compilation (erlc) does. +-define(default_verbosity, silence). +-endif. + -record(state, {dets, ets, notify_clients = [], backup}). -record(dets, {tab, shadow}). diff --git a/lib/snmp/src/app/snmp.erl b/lib/snmp/src/app/snmp.erl index 3392a8c2ac..6eb596ce02 100644 --- a/lib/snmp/src/app/snmp.erl +++ b/lib/snmp/src/app/snmp.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2022. All Rights Reserved. +%% Copyright Ericsson AB 1996-2024. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -61,6 +61,10 @@ set_trace/2, set_trace/3]). -export_type([ + bits/0, + octet/0, + octet_string/0, + dir/0, snmp_timer/0, @@ -114,6 +118,10 @@ %% Types %%----------------------------------------------------------------- +-type bits() :: integer(). +-type octet() :: 0..255. +-type octet_string() :: [octet()]. + -type dir() :: string(). -type snmp_timer() :: #snmp_incr_timer{}. @@ -851,6 +859,10 @@ sys_up_time(manager) -> octet_string_to_bits(S) -> snmp_pdus:octet_str_to_bits(S). + +-spec bits_to_octet_string(B) -> octet_string() when + B :: bits(). + bits_to_octet_string(B) -> snmp_pdus:bits_to_str(B). diff --git a/lib/snmp/src/manager/snmpm_conf.erl b/lib/snmp/src/manager/snmpm_conf.erl index 41b8c62e89..c636d2a9a5 100644 --- a/lib/snmp/src/manager/snmpm_conf.erl +++ b/lib/snmp/src/manager/snmpm_conf.erl @@ -57,6 +57,16 @@ -define(AGENTS_CONF_FILE, "agents.conf"). -define(USM_USERS_CONF_FILE, "usm.conf"). +-ifndef(version). +%% This crap is hopefully temporary! +%% It is because our current doc build +%% script (specs file generation) has +%% no way to pass this value in as the +%% normal compilation (erlc) does. +-define(version, "99.99"). +-endif. + + %% %% ------ manager.conf ------ %% -- 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