<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE erlref SYSTEM "erlref.dtd">

<erlref>
  <header>
    <copyright>
      <year>2004</year><year>2020</year>
      <holder>Ericsson AB. All Rights Reserved.</holder>
    </copyright>
    <legalnotice>
      Licensed under the Apache License, Version 2.0 (the "License");
      you may not use this file except in compliance with the License.
      You may obtain a copy of the License at
 
          http://www.apache.org/licenses/LICENSE-2.0

      Unless required by applicable law or agreed to in writing, software
      distributed under the License is distributed on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      See the License for the specific language governing permissions and
      limitations under the License.
    
    </legalnotice>

    <title>snmpm_network_interface</title>
    <prepared></prepared>
    <responsible></responsible>
    <docno></docno>
    <approved></approved>
    <checked></checked>
    <date></date>
    <rev></rev>
    <file>snmpm_network_interface.xml</file>
  </header>
  <module since="">snmpm_network_interface</module>
  <modulesummary>Behaviour module for the SNMP manager network interface.</modulesummary>
  <description>
    <p>This module defines the behaviour of the manager network
      interface. A <c>snmpm_network_interface</c> compliant module 
      must export the following functions: </p>
    <list type="bulleted">
      <item>
        <p><seeerl marker="#start_link">start_link/2</seeerl></p>
      </item>
      <item>
        <p><seeerl marker="#stop">stop/1</seeerl></p>
      </item>
      <item>
        <p><seeerl marker="#send_pdu">send_pdu/7</seeerl></p>
      </item>
      <item>
        <p><seeerl marker="#inform_response">inform_response/4</seeerl></p>
      </item>
      <item>
        <p><seeerl marker="#note_store">note_store/2</seeerl></p>
      </item>
      <item>
        <p><seeerl marker="#info">info/1</seeerl></p>
      </item>
      <item>
        <p><seeerl marker="#get_log_type">get_log_type/1</seeerl></p>
      </item>
      <item>
        <p><seeerl marker="#set_log_type">set_log_type/2</seeerl></p>
      </item>
      <item>
        <p><seeerl marker="#verbosity">verbosity/2</seeerl></p>
      </item>
    </list>
    <p>The semantics of them and their exact signatures are explained
      below. </p>

    <p>Legacy API function <c>send_pdu/7</c> that has got separate
      <c>IpAddr</c> and <c>PortNumber</c> arguments still works as before
      for backwards compatibility reasons.</p>

    <marker id="start_link"></marker>
  </description>

  <funcs>
    <func>
      <name since="">start_link(Server, NoteStore) -> {ok, Pid} | {error, Reason}</name>
      <fsummary>Start-link the network interface process</fsummary>
      <type>
        <v>Server    = pid()</v>
        <v>NoteStore = pid()</v>
      </type>
      <desc>
        <p>Start-link the network interface process.</p>
        <p><c>Server</c> is the pid of the managing process.</p>
        <p><c>NoteStore</c> is the pid of the note-store process.</p>

        <marker id="stop"></marker>
      </desc>
    </func>

    <func>
      <name since="">stop(Pid) -> void()</name>
      <fsummary>Stop the network interface process</fsummary>
      <type>
        <v>Pid = pid()</v>
      </type>
      <desc>
        <p>Stop the network interface process.</p>

        <marker id="send_pdu"></marker>
      </desc>
    </func>

    <func>
      <name since="">send_pdu(Pid, Pdu, Vsn, MsgData, Domain, Addr, ExtraInfo) -> void()</name>
      <fsummary>Request the network interface process to send this pdu</fsummary>
      <type>
        <v>Pid = pid()</v>
        <v>Pdu = pdu()</v>
        <v>Vsn = 'version-1' | 'version-2' | 'version-3'</v>
        <v>MsgData = term()</v>
        <v>Domain = transportDomainUdpIpv4 | transportDomainUdpIpv6</v>
	<v>Addr = {<seetype marker="kernel:inet#ip_address">inet:ip_address(), inet:port_number()</seetype>} </v>
        <v>ExtraInfo = term()</v>
      </type>
      <desc>
        <p>Request the network interface process (<c>Pid</c>) to send
          this pdu (<c>Pdu</c>).</p>
        <p><c>ExtraInfo</c> is some opaque data that is passed to the
          net-if process. It originates from the <c>ExtraInfo</c>
          parameter in the calls to the 
          <seeerl marker="snmpm#sync_get2">synchronous get-request</seeerl>, 
          <seeerl marker="snmpm#async_get2">asynchronous get-request</seeerl>,
          <seeerl marker="snmpm#sync_get_next2">synchronous get-next-request</seeerl>, 
          <seeerl marker="snmpm#async_get_next2">asynchronous get-next-request</seeerl>,
          <seeerl marker="snmpm#sync_set2">synchronous set-request</seeerl>
          and 
          <seeerl marker="snmpm#async_set2">asynchronous set-request</seeerl>
          functions. 
          Whether the net-if process chooses
          to use this is implementation dependent. The net-if process
          included in this application ignores it. </p>

        <marker id="inform_response"></marker>
      </desc>
    </func>

    <func>
      <name since="">inform_response(Pid, Ref, Addr, Port) -> void()</name>
      <fsummary>Send the inform-request ack</fsummary>
      <type>
        <v>Pid = pid()</v>
        <v>Ref = term()</v>
        <v>Addr = address()</v>
        <v>Port = integer()</v>
      </type>
      <desc>
        <p>Instruct the network interface process to send the response
          (acknowledgment) to an inform-request.</p>
        <p><c>Ref</c> is something that can be used to identify the 
          inform-request, e.g. request-id of the inform-request.</p>
        <p><c>Addr</c> and <c>Port</c> identifies the agent, from 
          which the inform-request originated.</p>

        <marker id="note_store"></marker>
      </desc>
    </func>

    <func>
      <name since="">note_store(Pid, NoteStore) -> void()</name>
      <fsummary>Change the verbosity of the network interface process</fsummary>
      <type>
        <v>Pid       = pid()</v>
        <v>NoteStore = pid()</v>
      </type>
      <desc>
        <p>Change the pid of the note-store process.
          This is used when the server re-starts the note_store 
          (e.g. after a crach).</p>

        <marker id="info"></marker>
      </desc>
    </func>

    <func>
      <name since="">info(Pid) -> [{Key, Value}]</name>
      <fsummary>Return information about the running network interface process</fsummary>
      <type>
        <v>Pid = pid()</v>
      </type>
      <desc>
        <p>The info returned is basically up to the implementer to decide. 
          The implementation provided by this application provides info about 
          memory allocation and various socket information.</p>
        <p>The info returned by this function is returned together with other
          info collected by the manager when the
          <seeerl marker="snmpm#info">info</seeerl> function is called 
          (tagged with the key <c>net_if</c>).</p>

        <marker id="verbosity"></marker>
      </desc>
    </func>

    <func>
      <name since="">verbosity(Pid, Verbosity) -> void()</name>
      <fsummary>Change the verbosity of the network interface process</fsummary>
      <type>
        <v>Pid       = pid()</v>
        <v>Verbosity = verbosity()</v>
      </type>
      <desc>
        <p>Change the verbosity of the network interface process.</p>

        <marker id="get_log_type"></marker>
      </desc>
    </func>

    <func>
      <name since="">get_log_type(Pid) -> {ok, LogType} | {error, Reason}</name>
      <fsummary>Get the Audit Trail Log type</fsummary>
      <type>
        <v>Pid     = pid()</v>
        <v>LogType = atl_type()</v>
        <v>Reason  = term()</v>
      </type>
      <desc>
        <p>The Audit Trail Log is managed by the network interface process.
          So, it is this process that has to return the actual log-type. </p>
<!--
        <p>See
          <seeerl marker="snmpm#get_log_type">get_log_type</seeerl>
          for more info. </p>
-->

        <marker id="set_log_type"></marker>
      </desc>
    </func>

    <func>
      <name since="">set_log_type(Pid, NewType) -> {ok, OldType} | {error, Reason}</name>
      <fsummary>Change the Audit Trail Log type</fsummary>
      <type>
        <v>Pid     = pid()</v>
        <v>NewType = OldType = atl_type()</v>
        <v>Reason  = term()</v>
      </type>
      <desc>
        <p>The Audit Trail Log is managed by the network interface process.
          So, it is this process that has to do the actual changing of the
          type. </p>
        <p>See
          <seeerl marker="snmpm#set_log_type">set_log_type</seeerl>
          for more info. </p>
      </desc>
    </func>

  </funcs>

  
</erlref>

