ASNMP Overview

The Another SNMP class library is an Object Oriented programming toolkit for using IETF standard network management protocols in the Internet. The SNMP protocol is perhaps the most ubiquitous management protocol running on most very device or application deployed in the modern network today.

ASNMP is targeted to programmers that want to write command and control (C&C) applications. C&C Applications communicate with a variety of objects:

  • network devices such as ATM switches, Internet routers, LAN bridges and LAN printers
  • Routing protocols such as OSPF
  • database servers such as ORACLE or Informix.

    ASNMP Version 1 implements a blocking SNMP Version 1 with some Version 2c additions (Counter32, Counter64 SMI values). See SNMP Version 1 as defined in the IETF Request for Comments (RFC)

  • 1155
  • 1157
  • 1213
  • 1215

    Also see the RFC 1902 spec for new SMI datatypes such as Counter64.

    ASNMP is built using the CMU SNMP and HP SNMP++ as the base classes then modified for use in the ACE framework. About 10% of the API changed during code rework. See ASNMP/asnmp/ChangeLog for details.

    ASNMP can be used for either manager applications or agent applications. The Snmp class contains the interface for manager applications. The sagent class contains the interface for agent applications. A trivial agent that implements the mib II system group per rfc1213 is in the agents/ directory.

    Class Heirarchy

    UdpTarget - Defines a collection of attributes needed to define a 
                 communications session with an SNMP agent 
                This includes  network address, response timeout, etc.
      
    Snmp - A logical session between NM app and agent. Provides the
           commands get, get_next, trap. Manages transactions between app and 
           server.
    
    Pdu  - A container object that represents an SNMP Protocol Data Unit.
           A Pdu contains a command (get,getnext,trap) Varbind List list, 
           a community string.
    
    Vb   - Aka Varbind or Variable Binding.  A pdu can have zero, 
           one or more of these. A Vb consists of an Oid to identify 
           the variable and a value corresponding to  one of the SMI values. 
           The oid/value binding is defined in a MIB file (RFC 1155)
           Agents hava a MIB file that defines what each variable means.
           Most agents implement MIB II as defined in RFC 1156.        
    
    

    The Structure of Managment Information (SMI) datatypes and related types are:

    • Address->IpAddress->UdpAddress as well as MAC, IPX, IPXSOCK, Netbios
    • Unsigned Integer
    • Gauge32
    • Integer32
    • Counter32
    • Counter64
    • TimeTicks
    • OctetStr
    • Oid

    Sample program

    A sample Object to get obtain an Agent's Systems' Description given an network address and a community string. class system_id { public: system_id(UdpAddress addr, OctetStr read_community_string) { UdpTarget tgt; Snmp snmp; Pdu pdu; Oid oid("1.3.6.1.2.1.1.1.0"); Vb vb(oid); tgt.set_address(addr); tgt.set_read_community(read_community_string); pdu += vb; if (snmp.get(pdu, tgt) == 0) { pdu.get_vb(vb, 0); vb.get_value(desc_); } else desc_ = "" } int get_description(OctetStr& description) { description = desc_; return 0; } private: OctetStr desc_; };

    Future Directions

    Here are some areas for further work

  • Add OO mib parser and mib code generator
  • Collapse the CMU/HP code into one set of classes.
  • Add full V2c support.
  • Size/Speed improvements

    References