There exist a number of different transport mappings for SNMP. Some of them are defined in RFC3417 with a corresponding MIB in RFC3419. SNMP over TCP is in RFC3430. Others also exist.

BSNMP has made some attempt in version 1 to support different transport mappings, but this turned out not so good and all the mappings are compiled into the daemon. This makes it harder to add new mappings and also makes the daemon's footprint larger with mappings that one doesn't need. Therefor for version 2 a new attempt is made to make these transport mappings loadable.

A second goal is to move much of the I/O stuff into the library, because it can be used by booth the server and clients.

snmpio (in libbsnmp)

There are two layers for I/O: buffers and an I/O struct that handles bidirectional communication. The buffer layer consists of a struct snmpio_buf:

struct snmpio_buf {
        u_char *buf;                    /* the buffer space */
        size_t size;                    /* allocated size */
        size_t data;                    /* current data */
        size_t want;                    /* wanted size */
};

The member want allows to defer resizing of the buffer to a convinient time. It is used when the buffer size is changed via SNMP.

Functions exist to initialize, reallocate, destroy a buffer and to remove some amount of data in the buffer (consume it) preserving the rest of data (if any). This is needed for streaming transports where the size in which data is delivered from the transport layer is different from the sizes of the SNMP messages (TCP for example).

The other part of the library stuff is:

struct snmpio {
        int             fd;             /* socket */
        void            *id;            /* select handle */

        int             stream : 1;     /* stream socket */
        int             cred : 1;       /* want credentials */
        int             priv : 1;       /* peer is privileged */

        struct snmpio_buf rcvbuf;       /* receive buffer */
        struct snmpio_buf sndbuf;       /* send buffer */

        size_t          consumed;       /* how many bytes used in rcvbuf */

        const struct snmpio_vtab *vtab;

        void            *data;          /* user data */

        struct sockaddr *peer;
        socklen_t       peerlen;        /* actual length of the peer */
        socklen_t       peersize;       /* space in peer */

        struct snmpio_stats *stats;     /* engine statistics */
};

This still needs some work, because it is socket-centered.

transport core (in snmpd)

TDomain

TPort

TPort dependencies

implemented transport mappings

SNMP over UDP/TCP IPv4/IPv6 ({{{snmp_trans_inet}}})

This module implements the UDP and TCP mappings for both IPv4 and IPv6. For IPv6 both the scoped and unscoped address formats are supported. Although there are definitions for IPv4 scoped addresses in the RFC, I have no idea what they are.

SNMP over ngATM

This is needed for the ILMI daemon and supports SNMP over AAL5 over PVCs. I hope that this removes the need for the bogus transport proxy mechanism we have in BSNMPv1. The implementation of this will serve as a proof that the transport core supports not only INET.

SNMP over local sockets

This just brings the functionality of the BSNMPv1 lsock transport into a module.

SNMP over files

Have not fully figured out this. The idea is to have files with the same format as the configuration file and have the daemon read them and write the results to new files. The daemon could automatically monitor directories for changed files or new files. This could be used as some kind of permanent storage.

SNMP over SCTP

I have no idea about SCTP, so somebody could take this. There are some applicable definitions in RFC3417 and RFC3419.

BsnmpLoadableTransports (last edited 2008-06-17T21:37:17+0000 by anonymous)