|
NAMEmibII , mibif_notify_f ,
mib_netsock , mib_if_set_dyn ,
mib_refresh_iflist ,
mib_find_if , mib_find_if_sys ,
mib_find_if_name ,
mib_first_if , mib_next_if ,
mib_register_newif ,
mib_unregister_newif ,
mib_fetch_ifmib , mib_if_admin ,
mib_find_ifa , mib_first_ififa ,
mib_next_ififa ,
mib_ifstack_create ,
mib_ifstack_delete ,
mib_find_rcvaddr ,
mib_rcvaddr_create ,
mib_rcvaddr_delete ,
mibif_notify , mibif_unnotify
—
mib-2 module for bsnmpd.
LIBRARY(begemotSnmpdModulePath."mibII" = /usr/lib/snmp_mibII.so)SYNOPSIS#include <net/if.h>
#include <net/if_mib.h>
#include <bsnmp/snmpmod.h>
#include <bsnmp/snmp_mibII.h>
typedef void
extern int mib_netsock; void
void
struct mibif *
struct mibif *
struct mibif *
struct mibif *
struct mibif *
int
void
int
int
struct mibifa *
struct mibifa *
struct mibifa *
int
void
struct mibrcvaddr *
struct mibrcvaddr *
void
void *
void
DESCRIPTIONThesnmp_mibII module implements parts of the internet
standard MIB-2. Most of the relevant MIBs are implemented. Some of the tables
are restricted to be read-only instead of read-write. The exact current
implementation can be found in
/usr/share/snmp/defs/mibII_tree.def. The module also
exports a number of functions and global variables for use by other modules,
that need to handle network interfaces. This man page describes these
functions.
DIRECT NETWORK ACCESSThemibII module opens a socket that is used to execute
all network related
ioctl(2)
functions. This socket is globally available under the name
mib_netsock.
NETWORK INTERFACESThemibII module handles a list of all currently
existing network interfaces. It allows other modules to handle their own
interface lists with special information by providing a mechanism to register
to events that change the interface list (see below). The basic data structure
is the interface structure:
struct mibif { TAILQ_ENTRY(mibif) link; u_int flags; u_int index; /* logical ifindex */ u_int sysindex; char name[IFNAMSIZ]; char descr[256]; struct ifmibdata mib; uint64_t mibtick; void *specmib; size_t specmiblen; u_char *physaddr; u_int physaddrlen; int has_connector; int trap_enable; uint64_t counter_disc; mibif_notify_f xnotify; void *xnotify_data; const struct lmodule *xnotify_mod; struct asn_oid spec_oid; }; The A call to The interface list can be traversed with the functions
There are three functions to find an interface by name or index.
The function The function INTERFACE EVENTSA module can register itself to receive a notification when a new entry is created in the interface list. This is done by callingmib_register_newif (). A module can register only one
function, a second call to mib_register_newif () causes
the registration to be overwritten. The registration can be removed with a
call to mib_unregister_newif (). It is unregistered
automatically, when the registering module is unloaded.
A module can also register to events on a specific interface. This
is done by calling
This mechanism can be used to implement interface type specific
MIB parts in other modules. The registration can be removed with
INTERFACE ADDRESSESThemibII module handles a table of interface
IP-addresses. These addresses are held in a
struct mibifa { TAILQ_ENTRY(mibifa) link; struct in_addr inaddr; struct in_addr inmask; struct in_addr inbcast; struct asn_oid index; u_int ifindex; u_int flags; }; The (ordered) list of IP-addresses on a given interface can be
traversed by calling INTERFACE RECEIVE ADDRESSESThe internet MIB-2 contains a table of interface receive addresses. These addresses are handled in:struct mibrcvaddr { TAILQ_ENTRY(mibrcvaddr) link; struct asn_oid index; u_int ifindex; u_char addr[ASN_MAXOIDLEN]; size_t addrlen; u_int flags; }; enum { MIBRCVADDR_VOLATILE = 0x00000001, MIBRCVADDR_BCAST = 0x00000002, MIBRCVADDR_HW = 0x00000004, }; Note, that the assignment of
A receive address can be created with
A receive address can be found with
INTERFACE STACK TABLEThemibII module maintains also the interface stack
table. Because for complex stacks, there is no system supported generic way of
getting this information, interface type specific modules need to help setting
up stack entries. The mibII module handles only the
top and bottom entries.
A table entry is created with
FILES
SEE ALSOgensnmptree(1), snmpmod(3)STANDARDSThis implementation conforms to the applicable IETF RFCs.AUTHORSHartmut Brandt ⟨harti@FreeBSD.org⟩
Visit the GSP FreeBSD Man Page Interface. |