1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
<html>
<!-- $Id$ -->
<! by Michael R. MacFaden mrm@cisco.com >
<title>ASNMP Overview</title>
<h1>ASNMP Overview</h1>
<p>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.
<p>ASNMP is targeted to programmers that want to write command and
control (C&C) applications. C&C Applications communicate with
a variety of objects:
<sl>
<li>network devices such as ATM switches, Internet routers,
LAN bridges and LAN printers
<li>Routing protocols such as OSPF
<li>database servers such as ORACLE or Informix.
<p>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)
<sl>
<li>1155
<li>1157
<li>1213
<li>1215
<sl>
<p>Also see the RFC 1902 spec for new SMI datatypes such as Counter64.
<p>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.
<p>ASNMP can be used for either manager applications or agent applications.
The <i>Snmp</i> class contains the interface for manager applications. The
<i>sagent</i> class contains the interface for agent applications. A
trivial agent that implements the mib II system group per rfc1213 is
in the agents/ directory.
<h2>Class Heirarchy</h2>
<pre>
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.
<p>The Structure of Managment Information (SMI) datatypes
and related types are:
<ul>
<li>Address->IpAddress->UdpAddress as well as MAC, IPX, IPXSOCK, Netbios
<li>Unsigned Integer
<li>Gauge32
<li>Integer32
<li>Counter32
<li>Counter64
<li>TimeTicks
<li>OctetStr
<li>Oid
</ul>
<hr>
<h2>Sample program</h2>
<p>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_ = "<error - no value set>"
}
int get_description(OctetStr& description) {
description = desc_;
return 0;
}
private:
OctetStr desc_;
};
<h1>Future Directions</h1>
<p>Here are some areas for further work
<sl>
<li>Add OO mib parser and mib code generator
<li>Collapse the CMU/HP code into one set of classes.
<li>Add full V2c support.
<li>Size/Speed improvements
</sl>
<h1>References</h1>
<ul>
<li><a href="http://www.ece.ucdavis.edu/ucd-snmp/">UCD SNMP</a>
<li><a href="news://comp.protocols.snmp">comp.protocols.snmp</a>
<li><a href="http://snmp.cs.utwente.nl">University of Twente</a>
<li><a href="http://www.cis.ohio-state.edu/hypertext/faq/bngusenet/comp/protocols/snmp/top.html">SNMP FAQ</a>
<li><a href="http://www.adventnet.com/">Java based SNMP tools from Ardent</a>
<li><a href="http://misa.zurich.ibm.com/Webbin/">IBM SNMP/CMIP research</a>
</ul>
</html>
|