From 8f929fad475601ee3cb164a26db3a9065fa7f909 Mon Sep 17 00:00:00 2001
From: Micael Karlberg <bmk@erlang.org>
Date: Sun, 28 Apr 2013 20:23:44 +0200
Subject: [snmp/agent] Preliminary doc update regarding mib_data behaviour

---
 lib/snmp/doc/src/files.mk           |   1 +
 lib/snmp/doc/src/notes.xml          | 129 -----------------------
 lib/snmp/doc/src/snmp_config.xml    |  18 +++-
 lib/snmp/doc/src/snmpa_mib_data.xml | 201 ++++++++++++++++++++++++++++++++++++
 4 files changed, 218 insertions(+), 131 deletions(-)
 create mode 100644 lib/snmp/doc/src/snmpa_mib_data.xml

diff --git a/lib/snmp/doc/src/files.mk b/lib/snmp/doc/src/files.mk
index 61c91c9729..e215143b03 100644
--- a/lib/snmp/doc/src/files.mk
+++ b/lib/snmp/doc/src/files.mk
@@ -41,6 +41,7 @@ XML_AGENT_REF3_FILES = \
 	snmpa_error_io.xml \
 	snmpa_error_logger.xml \
 	snmpa_local_db.xml \
+	snmpa_mib_data.xml \
 	snmpa_mpd.xml \
 	snmpa_network_interface.xml \
 	snmpa_network_interface_filter.xml \
diff --git a/lib/snmp/doc/src/notes.xml b/lib/snmp/doc/src/notes.xml
index 5222922848..b47d4237f5 100644
--- a/lib/snmp/doc/src/notes.xml
+++ b/lib/snmp/doc/src/notes.xml
@@ -1017,135 +1017,6 @@
   </section> <!-- 4.20 -->
 
 
-  <section>
-    <title>SNMP Development Toolkit 4.19</title>
-    <p>Version 4.19 supports code replacement in runtime from/to
-      version 4.18.</p>
-
-    <section>
-      <title>Improvements and new features</title>
-<!--
-      <p>-</p>
--->
-      <list type="bulleted">
-        <item>
-          <p>[compiler] Added support for textual convention 
-	  <c>AGENT-CAPABILITIES</c> and "full" support for textual 
-          convention MODULE-COMPLIANCE, both defined by the SNMPv2-CONF 
-          mib.</p>
-          <p>The <c>reference</c> and <c>modules</c> part(s) are
-	  stored in the <c>assocList</c> of the mib-entry (<c>me</c>) 
-	  record. 
-	  Only handled <em>if</em> the option(s) <c>agent_capabilities</c>
-	  and <c>module_compliance</c> (respectively) are provided to the 
-	  compiler. </p>
-	  <p>See <seealso marker="snmpc#compile">compile/2</seealso> 
-	  for more info. </p>
-	  <p>For backward compatibillity, the MIBs provided with 
-	  this application are <em>not</em> compiled with these 
-	  options. </p>
-          <p>Own Id: OTP-8966</p>
-        </item>
-
-        <item>
-          <p>[agent] Added a "complete" set of (snmp) table and variable
-          print functions, for each mib handled by the SNMP (agent)
-          application. This will be usefull when debugging a running agent.</p>
-          <p>See
-          <seealso marker="snmpa#print_mib_info">print_mib_info/0</seealso>,
-          <seealso marker="snmpa#print_mib_tables">print_mib_tables/0</seealso>
-          and
-          <seealso marker="snmpa#print_mib_variables">print_mib_variables/0</seealso>
-          for more info. </p>
-          <p>Own Id: OTP-8977</p>
-        </item>
-
-        <item>
-          <p>[compiler] Added a MIB compiler (frontend) escript, 
-          <c>snmpc</c>. </p>
-          <p>Own Id: OTP-9004</p>
-        </item>
-
-      </list>
-    </section>
-
-    <section>
-      <title>Fixed Bugs and Malfunctions</title>
-<!--
-      <p>-</p> 
--->
-      <list type="bulleted">
-        <item>
-          <p>[agent] For the table vacmAccessTable,
-          when performing the is_set_ok and set operation(s),
-          all values of the vacmAccessSecurityModel column was
-          incorrectly translated to <c>any</c>. </p>
-<!--
-that is when calling:
-snmp_view_basec_acm_mib:vacmAccessTable(set, RowIndex, Cols).
--->
-          <p>Own Id: OTP-8980</p>
-        </item>
-
-        <item>
-          <p>[agent] When calling
-          <seealso marker="snmp_view_based_acm_mib#reconfigure">snmp_view_based_acm_mib:reconfigure/1</seealso>
-          on a running node, the table <c>vacmAccessTable</c> was not properly
-          cleaned.
-          This meant that if some entries in the vacm.conf file was removed
-          (compared to the <c>current</c> config),
-          while others where modified and/or added, the removed entrie(s)
-          would still exist in the <c>vacmAccessTable</c> table. </p>
-          <p>Own Id: OTP-8981</p>
-          <p>Aux Id: Seq 11750</p>
-        </item>
-
-      </list>
-    </section>
-
-
-    <section>
-      <title>Incompatibilities</title>
-      <p>-</p>
-    </section>
-
-  </section> <!-- 4.19 -->
-
-
-  <section>
-    <title>SNMP Development Toolkit 4.18</title>
-    <p>Version 4.18 supports code replacement in runtime from/to
-      version 4.17.1 and 4.17.</p>
-
-    <section>
-      <title>Improvements and new features</title>
-      <list type="bulleted">
-        <item>
-          <p>Prepared for R14B release.</p>
-        </item>
-      </list>
-    </section>
-
-    <section><title>Fixed Bugs and Malfunctions</title>
-      <p>-</p>
-<!--
-      <list type="bulleted">
-        <item>
-          <p>[agent] When the function FilterMod:accept_recv/2 returned false
-          the SNMP agent stopped collecting messages from UDP.</p>
-          <p>Own Id: OTP-8761</p>
-        </item>
-      </list>
--->
-    </section>
-
-    <section>
-      <title>Incompatibilities</title>
-      <p>-</p>
-    </section>
-  </section> <!-- 4.18 -->
-
-
   <!-- section>
     <title>Release notes history</title>
     <p>For information about older versions see
diff --git a/lib/snmp/doc/src/snmp_config.xml b/lib/snmp/doc/src/snmp_config.xml
index eec53162a1..42831ecb34 100644
--- a/lib/snmp/doc/src/snmp_config.xml
+++ b/lib/snmp/doc/src/snmp_config.xml
@@ -4,7 +4,7 @@
 <chapter>
   <header>
     <copyright>
-      <year>1997</year><year>2012</year>
+      <year>1997</year><year>2013</year>
       <holder>Ericsson AB. All Rights Reserved.</holder>
     </copyright>
     <legalnotice>
@@ -337,7 +337,7 @@
       <marker id="agent_mib_server"></marker>
       <tag><c><![CDATA[mib_server() = [mib_server_opt()] <optional>]]></c></tag>
       <item>
-        <p><c>mib_server_opt() = {mibentry_override, mibentry_override()} |  {trapentry_override, trapentry_override()} |  {verbosity, verbosity()} | {cache, mibs_cache()}</c></p>
+        <p><c>mib_server_opt() = {mibentry_override, mibentry_override()} |  {trapentry_override, trapentry_override()} |  {verbosity, verbosity()} | {cache, mibs_cache()} | {mob_data_mod, mib_data_mod()}</c></p>
         <p>Defines options specific for the SNMP agent mib server. </p>
         <p>For defaults see the options in <c>mib_server_opt()</c>.</p>
       </item>
@@ -370,6 +370,20 @@
           default values apply).</p>
       </item>
 
+      <marker id="agent_ms_mib_data_mod"></marker>
+      <tag><c><![CDATA[mib_data_mod() = snmpa_mib_data_tttn | snmpa_mib_data_ttln | module() <optional>]]></c></tag>
+      <item>
+        <p>Defines the backend mib_data storage module of the 
+	SNMP agent mib-server as defined by the 
+	<seealso marker="snmpa_mib_data">snmpa_mib_data</seealso> 
+	behaviour. </p>
+	<p>Two modules is provided with the agent 
+	<c>snmpa_mib_data_tttn</c> (this is the old implementation) and 
+	<c>snmpa_mib_data_ttln</c> (for a mib tree with many holes, 
+	this algorithm can be more price efficient). 
+        <p>Default module is <c>snmpa_mib_data_tttn</c>. </p>
+      </item>
+
       <marker id="agent_ms_cache_opts"></marker>
       <tag><c><![CDATA[mibs_cache_opts() = [mibs_cache_opt()] <optional>]]></c></tag>
       <item>
diff --git a/lib/snmp/doc/src/snmpa_mib_data.xml b/lib/snmp/doc/src/snmpa_mib_data.xml
new file mode 100644
index 0000000000..462112ac71
--- /dev/null
+++ b/lib/snmp/doc/src/snmpa_mib_data.xml
@@ -0,0 +1,201 @@
+<?xml version="1.0" encoding="iso-8859-1" ?>
+<!DOCTYPE erlref SYSTEM "erlref.dtd">
+
+<erlref>
+  <header>
+    <copyright>
+      <year>2013</year><year>2013</year>
+      <holder>Ericsson AB. All Rights Reserved.</holder>
+    </copyright>
+    <legalnotice>
+      The contents of this file are subject to the Erlang Public License,
+      Version 1.1, (the "License"); you may not use this file except in
+      compliance with the License. You should have received a copy of the
+      Erlang Public License along with this software. If not, it can be
+      retrieved online at http://www.erlang.org/.
+    
+      Software distributed under the License is distributed on an "AS IS"
+      basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+      the License for the specific language governing rights and limitations
+      under the License.
+    
+    </legalnotice>
+
+    <title>snmpa_mib_data</title>
+    <prepared></prepared>
+    <responsible></responsible>
+    <docno></docno>
+    <approved></approved>
+    <checked></checked>
+    <date></date>
+    <rev></rev>
+    <file>snmpa_mib_data.xml</file>
+  </header>
+
+  <module>snmpa_mib_data</module>
+  <modulesummary>Behaviour module for the SNMP agent mib-server 
+  data module.</modulesummary>
+  <description>
+    <p>This module defines the behaviour of the SNMP agent mib-server 
+    data module. A <c>snmpa_mib_data</c> compliant module 
+    must export the following functions: </p>
+    <list type="bulleted">
+      <item>
+        <p>new/1</p>
+      </item>
+      <item>
+        <p>close/1</p>
+      </item>
+      <item>
+        <p>sync/1</p>
+      </item>
+      <item>
+        <p>load_mib/4</p>
+      </item>
+      <item>
+        <p>unload_mib/4</p>
+      </item>
+      <item>
+        <p>lookup/2</p>
+      </item>
+      <item>
+        <p>next/3</p>
+      </item>
+      <item>
+        <p>register_subagent/3</p>
+      </item>
+      <item>
+        <p>unregister_subagent/2</p>
+      </item>
+      <item>
+        <p>which_mib/2</p>
+      </item>
+      <item>
+        <p>which_mibs/1</p>
+      </item>
+      <item>
+        <p>whereis_mib/2</p>
+      </item>
+      <item>
+        <p>backup/2</p>
+      </item>
+      <item>
+        <p>dump/2</p>
+      </item>
+      <item>
+        <p>info/1,2</p>
+      </item>
+      <item>
+        <p>code_change/2</p>
+      </item>
+    </list>
+    <p>The semantics of them and their exact signatures are explained
+    below. </p>
+
+    <marker id="handle_error"></marker>
+  </description>
+  <funcs>
+    <func>
+      <name>new(Storage) -> State</name>
+      <fsummary>Create new (mib-storage) instance</fsummary>
+      <type>
+        <v>Storage = mib_storage()</v>
+        <v>State = term()</v>
+      </type>
+      <desc>
+        <p>Create a new mib-storage instance. </p>
+
+        <marker id="close"></marker>
+      </desc>
+    </func>
+
+    <func>
+      <name>close(State) -> void()</name>
+      <fsummary>Close the mib-storage</fsummary>
+      <type>
+        <v>State = term()</v>
+      </type>
+      <desc>
+        <p>Close the mib-storage.</p>
+
+        <marker id="sync"></marker>
+      </desc>
+    </func>
+
+    <func>
+      <name>sync(State) -> void()</name>
+      <fsummary>Synchronize to disc</fsummary>
+      <type>
+        <v>State = term()</v>
+      </type>
+      <desc>
+        <p>Synchronize (write to disc, if possible) the data to disc. 
+	This depends on the <c>mib_storage</c> option, and will only have 
+	an effect if the mib-storage option has an actual disc component 
+	(such as dets, or ets with a file). </p>
+
+        <marker id="load_mib"></marker>
+      </desc>
+    </func>
+
+    <func>
+      <name>load_mib(State, Filename, MeOverride, TeOverride) -> {ok, NewState} | {error, Reason}</name>
+      <fsummary>Load a mib into the mib-server</fsummary>
+      <type>
+        <v>State = NewState = term()</v>
+        <v>Filename = filename()</v>
+        <v>MeOverride = boolean()</v>
+        <v>TeOverride = boolean()</v>
+        <v>Reason = already_loaded | term()</v>
+      </type>
+      <desc>
+        <p>Load the mib specified by the <c>Filename</c> argument 
+	into the mib-server. 
+	The <c>MeOverride</c> and <c>TeOverride</c> arguments 
+	specifies how the mib-server shall handle duplicate mib- and trap-
+	entries. </p>
+
+        <marker id="unload_mib"></marker>
+      </desc>
+    </func>
+
+    <func>
+      <name>unload_mib(State, Filename) -> {ok, NewState} | {error, Reason}</name>
+      <fsummary>Unload mib from the mib-server</fsummary>
+      <type>
+        <v>State = NewState = term()</v>
+        <v>Filename = filename()</v>
+        <v>Reason = not_loaded | term()</v>
+      </type>
+      <desc>
+        <p>Unload the mib specified by the <c>Filename</c> argument 
+	from the mib-server. </p>
+
+        <marker id="lookup"></marker>
+      </desc>
+    </func>
+
+    <func>
+      <name>lookup(State, Oid) -> Reply</name>
+      <fsummary>Find the mib-entry corresponding to the Oid</fsummary>
+      <type>
+        <v>State = term()</v>
+        <v>Reply = {variable, ME} | {table_column, ME, TEOid} | {subagent, SAPid, SAOid} | [false, Reason}</v>
+        <v>Oid = TEOid = SAOid = oid()</v>
+        <v>SAPid = pid()</v>
+        <v>ME = me()</v>
+        <v>Reason = term()</v>
+      </type>
+      <desc>
+        <p>Find the mib-entry corresponding to the Oid. 
+	If it is a variable, the Oid must be 
+	<Oid for var>.0 
+	and if it is a table, Oid must be 
+	<table>.<entry>.<col>.<any>.</p>
+	<!-- FIX -->
+      </desc>
+    </func>
+  </funcs>
+  
+</erlref>
+
-- 
cgit v1.2.3