Skip to main content

3. Protocol

The SMUX protocol is simple: the SNMP agent listens for incoming connections. Upon establishing a connection, the SMUX peer issues an OpenPDU to initialize the SMUX association. If the SNMP agent declines the association, it issues a closePDU and closes the connection. If the SNMP agent accepts the association, no response is issued by the SNMP agent.

For each subtree defined in a MIB module that the SMUX peer wishes to register (or unregister), the SMUX peer issues a RReqPDU. When the SNMP agent receives such a PDU, it issues a corresponding RRspPDU. The SNMP agent returns RRspPDUs in the same order as the RReqPDUs were received.

When the SMUX peer wishes to issue a trap, it issues an SNMP Trap-PDU. When the SNMP agent receives such a PDU, it propagates this to the network management stations that it is configured to send traps to.

When the SNMP agent receives an SNMP GetRequest-PDU, GetNextRequest-PDU, or SetRequest-PDU which includes one or more variable-bindings within a subtree registered by a SMUX peer, the SNMP agent sends an equivalent SNMP PDU containing only those variables within the subtree registered by that SMUX peer. When the SMUX peer receives such a PDU, it applies the indicated operation and issues a corresponding SNMP GetResponse-PDU. The SNMP agent then correlates this result and propagates the resulting GetResponse-PDU to the network management station.

When either the SNMP agent or the SMUX peer wishes to release the SMUX association, the ClosePDU is issued, the connection is closed, and all subtree registrations for that association are released.

3.1. Tricky Things​

Although straight-forward, there are a few nuances.

3.1.1. Registration​

Associated with each registration is an integer priority, from 0 to (2^31)-1. The lower the value, the higher the priority.

Multiple SMUX peers may register the same subtree. However, they must do so at different priorities (i.e., a subtree and a priority uniquely identifies a SMUX peer). As such, if a SMUX peer wishes to register a subtree at a priority which is already taken, the SNMP agent repeatedly increments the integer value until an unused priority is found.

When registering a subtree, the special priority -1 may be used, which selects the highest available priority.

Of course, the SNMP agent may select an arbitrarily worse priority for a SMUX peer, based on local (configuration) information.

Note that when a subtree is registered, the SMUX peer with the highest registration priority is exclusively consulted for all operations on that subtree. Further note that SNMP agents must enforce the "subtree mounting effect", which hides the registrations by other SMUX peers of objects within the subtree. For example, if a SMUX peer registered "sysDescr", and later another SMUX peer registered "system" (which scopes "sysDescr"), then all requests for "sysDescr" would be given to the latter SMUX peer.

An SNMP agent should disallow any attempt to register above, at, or below, the SNMP and SMUX subtrees of the MIB. Other subtrees may be disallowed as an implementation-specific option.

3.1.2. Removing Registration​

A SMUX peer may remove registrations for only those subtrees which it has registered. If the priority given in the RReqPDU is -1, then the registration of highest priority is selected for deletion. Otherwise, only that registration with the precise priority is selected.

3.1.3. Atomic Sets​

A simple two-phase commit protocol is used between the SNMP agent and the SMUX peers. When an SNMP SetRequest-PDU is received, the SNMP agent determines which SMUX peers will participate in the transaction. For each of these peers, at least one SNMP SetRequest-PDU is sent, with only those variables of interest to that peer.

Each SMUX peer must either accept or refuse the set operation, without actually performing the operation. If the peer opts to accept, it sends back an SNMP GetResponse-PDU with an error-status of noError(0); otherwise, if the peer refuses to perform the operation, then an SNMP GetResponse-PDU is returned with a non-zero error-status.

The SNMP agent examines all of the responses. If at least one SMUX peer refused the operation, then a SMUX SOutPDU is sent to each SMUX peer, with value rollback, telling the SMUX peer to discard any knowledge of the requested operation.

Otherwise if all SMUX peers accepted the operation, then a SMUX SOutPDU is sent to each SMUX peer, with value commit, telling the SMUX peer to perform the operation.

In either case, the SMUX peer does not generate a response to the SMUX SOutPDU.

3.1.4. Variables in Requests​

When constructing an SNMP GetRequest-PDU or GetNextRequest-PDU for a SMUX peer, the SNMP agent may send one, or more than one variable in a single request. In all cases, the SNMP agent should process each variable sequentially, and block accordingly when a SMUX peer is contacted.

3.1.5. Request-ID​

When the SNMP agent constructs an SNMP GetRequest-PDU, GetNextRequest-PDU, or SetRequest-PDU, for a SMUX peer, the request_id field of the SNMP takes a special meaning: if an SNMP agent generates multiple PDUs for a SMUX peer, upon receipt of a single PDU from the network management station, then the request_id field of the PDUs sent to the SMUX peer must take the same value (which need bear no relationship to the value of the request_id field of the PDU originally received by the SNMP agent.)

3.1.6. The powerful get-next operator​

Each SMUX peer acts as though it contains the entire MIB when processing a SNMP GetNext-PDU from the SNMP agent. This means that the SNMP agent must check each variable returned in the SNMP GetResponse-PDU generated by the SMUX peer to ensure that each variable is still within the same registered subtree as caused the SNMP GetNext-PDU to be sent to that peer. For each variable which is not, the SNMP agent must include it in a SNMP GetNext-PDU to the peer for the succeeding registered subtree, until responses are available for all variables within their expected registered subtree.

3.2. Protocol Data Units​

The SMUX protocol data units are defined using Abstract Syntax Notation One (ASN.1) [3]:

   SMUX DEFINITIONS ::= BEGIN

   IMPORTS
           DisplayString, ObjectName
                   FROM RFC1155-SMI

           PDUs
                   FROM RFC1157-SNMP;

   -- tags for SMUX-specific PDUs are application-wide to
   -- avoid conflict with tags for current (and future)
   -- SNMP-generic PDUs

   SMUX-PDUs ::=
       CHOICE {
           open            -- SMUX peer uses
               OpenPDU,    -- immediately after TCP open

           close           -- either uses immediately before TCP close
               ClosePDU,

           registerRequest -- SMUX peer uses
               RReqPDU,

           registerResponse -- SNMP agent uses
               RRspPDU,

               PDUs,       -- note that roles are reversed:
                           --   SNMP agent does get/get-next/set
                           --   SMUX peer does get-response/trap

           commitOrRollback -- SNMP agent uses
               SOutPDU
      }

   -- open PDU
   -- currently only simple authentication

   OpenPDU ::=
       CHOICE {
          simple
              SimpleOpen
       }

   SimpleOpen ::=
       [APPLICATION 0] IMPLICIT
           SEQUENCE {
               version     -- of SMUX protocol
                   INTEGER {
                       version-1(0)
                   },

               identity    -- of SMUX peer, authoritative
                   OBJECT IDENTIFIER,

               description -- of SMUX peer, implementation-specific
                   DisplayString,

               password    -- zero length indicates no authentication
                   OCTET STRING
           }

   -- close PDU

   ClosePDU ::=
       [APPLICATION 1] IMPLICIT
           INTEGER {
               goingDown(0),
               unsupportedVersion(1),
               packetFormat(2),
               protocolError(3),
               internalError(4),
               authenticationFailure(5)
           }

   -- insert PDU

   RReqPDU ::=
       [APPLICATION 2] IMPLICIT
           SEQUENCE {
               subtree
                   ObjectName,

               priority    -- the lower the better, "-1" means default
                   INTEGER (-1..2147483647),

               operation
                   INTEGER {
                       delete(0),    -- remove registration
                       readOnly(1),  -- add registration, objects are RO
                       readWrite(2)  --   .., objects are RW
                   }
           }

   RRspPDU ::=
       [APPLICATION 3] IMPLICIT
           INTEGER {
               failure(-1)

              -- on success the non-negative priority is returned
           }

   SOutPDU ::=
       [APPLICATION 4] IMPLICIT
           INTEGER {
               commit(0),
               rollback(1)
           }

   END

3.3. Mappings on Transport Service​

The SMUX protocol may be mapped onto any CO-mode transport service. At present, only one such mapping is defined.

3.3.1. Mapping onto the TCP​

When using the TCP to provide the transport-backing for the SMUX protocol, the SNMP agent listens on TCP port 199.

Each SMUX PDU is serialized using the Basic Encoding Rules [4] and sent on the TCP. As ASN.1 objects are self-delimiting when encoding using the BER, no packetization protocol is required.