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

<erlref>
  <header>
    <copyright>
      <year>2004</year><year>2016</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>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><seealso marker="#start_link">start_link/2</seealso></p>
      </item>
      <item>
        <p><seealso marker="#stop">stop/1</seealso></p>
      </item>
      <item>
        <p><seealso marker="#send_pdu">send_pdu/7</seealso></p>
      </item>
      <item>
        <p><seealso marker="#inform_response">inform_response/4</seealso></p>
      </item>
      <item>
        <p><seealso marker="#note_store">note_store/2</seealso></p>
      </item>
      <item>
        <p><seealso marker="#info">info/1</seealso></p>
      </item>
      <item>
        <p><seealso marker="#get_log_type">get_log_type/1</seealso></p>
      </item>
      <item>
        <p><seealso marker="#set_log_type">set_log_type/2</seealso></p>
      </item>
      <item>
        <p><seealso marker="#verbosity">verbosity/2</seealso></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>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>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>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 = {<seealso marker="kernel:inet#type-ip_address">inet:ip_address(), inet:port_number()</seealso>} </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 
          <seealso marker="snmpm#sync_get">synchronous get-request</seealso>, 
          <seealso marker="snmpm#async_get">asynchronous get-request</seealso>,
          <seealso marker="snmpm#sync_get_next">synchronous get-next-request</seealso>, 
          <seealso marker="snmpm#async_get_next">asynchronous get-next-request</seealso>,
          <seealso marker="snmpm#sync_set">synchronous set-request</seealso>
          and 
          <seealso marker="snmpm#async_set">asynchronous set-request</seealso>
          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>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>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>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
          <seealso marker="snmpm#info">info</seealso> function is called 
          (tagged with the key <c>net_if</c>).</p>

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

    <func>
      <name>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>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
          <seealso marker="snmpm#get_log_type">get_log_type</seealso>
          for more info. </p>
-->

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

    <func>
      <name>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
          <seealso marker="snmpm#set_log_type">set_log_type</seealso>
          for more info. </p>
      </desc>
    </func>

  </funcs>

  
</erlref>

