This module defines the behaviour of the agent network interface filter. A snmpa_network_interface_filter compliant module must export the following functions:
The semantics of them and their exact signatures are explained below.
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:
The first level is at the transport 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).
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).
Note that the network interface filter is something which is used by the network interface implementation provided by the application (snmpa_net_if). The default filter accepts all messages.
Legacy network interface filter modules used arguments on the form (IpAddr, PortNumber,...) instead of (Domain, Addr, ...), and if the SNMP agent is run without changing the configuration to use transport domains the network interface filter will still get the old arguments and work as before.
port() = integer() > 0 pdu_type() = 'get-request' | 'get-next-request' | 'get-response' | 'set-request' | trap | 'get-bulk-request' | 'inform-request' | report
See also the data types in snmpa_conf.
accept_send(Domain, Addr) -> boolean()
accept_recv_pdu(Domain, Addr, PduType) -> boolean()
accept_send_pdu(Targets, PduType) -> Reply
Called before the basic message processing (MPD) is done, when a pdu has been received from the master-agent.
For the message to be discarded all together, the function must return false.
Note that it is possible for this function to filter out targets (but not to add its own) by returning an updated Targets list (NewTargets).