<?xml version="1.0" encoding="latin1" ?>
<!DOCTYPE erlref SYSTEM "erlref.dtd">

<erlref>
  <header>
    <copyright>
      <year>2007</year><year>2009</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>snmpm_network_interface_filter</title>
    <prepared></prepared>
    <responsible></responsible>
    <docno></docno>
    <approved></approved>
    <checked></checked>
    <date></date>
    <rev></rev>
    <file>snmpm_network_interface_filter.xml</file>
  </header>
  <module>snmpm_network_interface_filter</module>
  <modulesummary>Behaviour module for the SNMP manager network-interface filter.</modulesummary>
  <description>
    <p>This module defines the behaviour of the manager network interface
      filter. A <c>snmpm_network_interface_filter</c> compliant module 
      must export the following functions: </p>
    <list type="bulleted">
      <item>
        <p><seealso marker="#accept_recv">accept_recv/2</seealso></p>
      </item>
      <item>
        <p><seealso marker="#accept_send">accept_send/2</seealso></p>
      </item>
      <item>
        <p><seealso marker="#accept_recv_pdu">accept_recv_pdu/3</seealso></p>
      </item>
      <item>
        <p><seealso marker="#accept_send_pdu">accept_send_pdu/2</seealso></p>
      </item>
    </list>
    <p>The semantics of them and their exact signatures are explained
      below. </p>
    <p>The purpose of the network interface filter is to allow for filtering
      of messages (accept or reject) receive and send. This is done 
      on two levels: </p>
    <list type="bulleted">
      <item>
        <p>The first level is at the UDP entry / exit point, i.e. 
          immediately after the receipt of the message, before any message 
          processing is done (accept_recv) and 
          immediately before sending the message, after all message 
          processing is done (accept_send).</p>
      </item>
      <item>
        <p>The second level is at the MPD entry / exit point, i.e.
          immediately after the basic message processing (accept_recv_pdu) / 
          immediately before the basic message processing (accept_send_pdu).</p>
      </item>
    </list>
    <p>Note that the network interface filter is something which is used 
      by the network interface implementation provided by the application 
      (<c>snmpm_net_if</c>). The default filter accepts all messages.</p>
    <p>A network interface filter can e.g. be used during testing or for load 
      regulation. </p>
  </description>

  <section>
    <title>DATA TYPES</title>
    <code type="none">
port() = integer() > 0
pdu_type() = 'get-request' | 'get-next-request' | 'get-response' | 'set-request' | trap | 'get-bulk-request' | 'inform-request' | report | trappdu
    </code>
    <marker id="accept_recv"></marker>
  </section>

  <funcs>
    <func>
      <name>accept_recv(Addr, Port) -> boolean()</name>
      <fsummary>Shall the received message be accepted</fsummary>
      <type>
        <v>Addr = ip_address()</v>
        <v>Port = port()</v>
      </type>
      <desc>
        <p>Called at the reception of a message (before <em>any</em> processing 
          has been done).</p>
        <p>For the message to be rejected, the function <em>must</em> return
          <em>false</em>. </p>
        <marker id="accept_send"></marker>
      </desc>
    </func>

    <func>
      <name>accept_send(Addr, Port) -> boolean()</name>
      <fsummary>Shall the message be sent</fsummary>
      <type>
        <v>Addr = ip_address()</v>
        <v>Port = port()</v>
      </type>
      <desc>
        <p>Called before the sending of a message (after <em>all</em> processing 
          has been done).</p>
        <p>For the message to be rejected, the function <em>must</em> return
          <em>false</em>. </p>
        <marker id="accept_recv_pdu"></marker>
      </desc>
    </func>

    <func>
      <name>accept_recv_pdu(Addr, Port, PduType) -> boolean()</name>
      <fsummary>Shall the received pdu be accepted</fsummary>
      <type>
        <v>Addr = ip_address()</v>
        <v>Port = port()</v>
        <v>PduType = pdu_type()</v>
      </type>
      <desc>
        <p>Called after the basic message processing (MPD) has been done, 
          but before the pdu is handed over to the server for primary 
          processing.</p>
        <p>For the pdu to be rejected, the function <em>must</em> return
          <em>false</em>. </p>
        <marker id="accept_send_pdu"></marker>
      </desc>
    </func>

    <func>
      <name>accept_send_pdu(Addr, Port, PduType) -> boolean()</name>
      <fsummary>Shall the pdu be sent</fsummary>
      <type>
        <v>Addr = ip_address()</v>
        <v>Port = port()</v>
        <v>PduType = pdu_type() > 0</v>
      </type>
      <desc>
        <p>Called before the basic message processing (MPD) is done, 
          when a pdu has been received from the master-agent.</p>
        <p>For the message to be rejected, the function <em>must</em> return 
          <em>false</em>. </p>
      </desc>
    </func>
  </funcs>
  
</erlref>

