blob: 092ca0b31e90faac6b5489324e41dfe11b0c2fa9 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>lwIP: SNMPv2c/v3 agent</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">lwIP
&#160;<span id="projectnumber">2.1.2</span>
<div id="projectbrief">Lightweight IP stack</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
$(document).ready(function() { init_search(); });
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
<div id="splitbar" style="-moz-user-select:none;"
<script type="text/javascript">
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
<div class="header">
<div class="summary">
<a href="#groups">Modules</a> </div>
<div class="headertitle">
<div class="title">SNMPv2c/v3 agent<div class="ingroups"><a class="el" href="group__apps.html">Applications</a></div></div> </div>
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="groups"></a>
<tr class="memitem:group__snmp__core"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__snmp__core.html">Core</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__snmp__traps"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__snmp__traps.html">Traps</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__snmp__mib2"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__snmp__mib2.html">MIB2</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__snmp__opts"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__snmp__opts.html">Options</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>SNMPv2c and SNMPv3 compatible agent<br />
There is also a MIB compiler and a MIB viewer in lwIP contrib repository (lwip-contrib/apps/LwipMibCompiler).<br />
The agent implements the most important MIB2 MIBs including IPv6 support (interfaces, UDP, TCP, SNMP, ICMP, SYSTEM). IP MIB is an older version without IPv6 statistics (TODO).<br />
Rewritten by Martin Hentschel <a href="#" onclick="location.href='mai'+'lto:'+'inf'+'o@'+'cl-'+'so'+'ft.'+'de'; return false;">info@<span style="display: none;">.nosp@m.</span>cl-s<span style="display: none;">.nosp@m.</span>oft.d<span style="display: none;">.nosp@m.</span>e</a> and Dirk Ziegelmeier <a href="#" onclick="location.href='mai'+'lto:'+'dzi'+'eg'+'el@'+'gm'+'x.d'+'e'; return false;">dzieg<span style="display: none;">.nosp@m.</span>el@g<span style="display: none;">.nosp@m.</span></a><br />
</p><h1>0 Agent Capabilities </h1>
<h2>Features: </h2>
<li>SNMPv2c support.</li>
<li>SNMPv3 support (a port to ARM mbedtls is provided, LWIP_SNMP_V3_MBEDTLS option).</li>
<li>Low RAM usage - no memory pools, stack only.</li>
<li>MIB2 implementation is separated from SNMP stack.</li>
<li>Support for multiple MIBs (<a class="el" href="group__snmp__core.html#ga29c76474971f25d038fd486447c70e21">snmp_set_mibs()</a> call) - e.g. for private MIB.</li>
<li>Simple and generic API for MIB implementation.</li>
<li>Comfortable node types and helper functions for scalar arrays and tables.</li>
<li>Counter64, bit and truthvalue datatype support.</li>
<li>Callbacks for SNMP writes e.g. to implement persistency.</li>
<li>Runs on two APIs: RAW and netconn.</li>
<li>Async API is gone - the stack now supports netconn API instead, so blocking operations can be done in MIB calls. SNMP runs in a worker thread when netconn API is used.</li>
<li>Simplified thread sync support for MIBs - useful when MIBs need to access variables shared with other threads where no locking is possible. Used in MIB2 to access lwIP stats from lwIP thread.</li>
<h2>MIB compiler (code generator): </h2>
<li>Provided in lwIP contrib repository.</li>
<li>Written in C#. MIB viewer used Windows Forms.</li>
<li>Developed on Windows with Visual Studio 2010.</li>
<li>Can be compiled and used on all platforms with <a href=""></a>.</li>
<li>Based on a heavily modified version of of SharpSnmpLib (a4bd05c6afb4) (<a href=""></a>).</li>
<li>MIB parser, C file generation framework and LWIP code generation are cleanly separated, which means the code may be useful as a base for code generation of other SNMP agents.</li>
<h2>Notes: </h2>
<li>Stack and MIB compiler were used to implement a Profinet device. Compiled/implemented MIBs: LLDP-MIB, LLDP-EXT-DOT3-MIB, LLDP-EXT-PNO-MIB.</li>
<h2>SNMPv1 per RFC1157 and SNMPv2c per RFC 3416 </h2>
<p>Note the S in SNMP stands for "Simple". Note that "Simple" is relative. SNMP is simple compared to the complex ISO network management protocols CMIP (Common Management Information Protocol) and CMOT (CMip Over Tcp).</p>
<h2>SNMPv3 </h2>
<p>When SNMPv3 is used, several functions from <a class="el" href="snmpv3_8h.html">snmpv3.h</a> must be implemented by the user. This is mainly user management and persistence handling. The sample provided in lwip-contrib is insecure, don't use it in production systems, especially the missing persistence for engine boots variable simplifies replay attacks.</p>
<h2>MIB II </h2>
<p>The standard lwIP stack management information base. This is a required MIB, so this is always enabled. The groups EGP, CMOT and transmission are disabled by default.</p>
<p>Most mib-2 objects are not writable except: sysName, sysLocation, sysContact, snmpEnableAuthenTraps. Writing to or changing the ARP and IP address and route tables is not possible.</p>
<p>Note lwIP has a very limited notion of IP routing. It currently doen't have a route table and doesn't have a notion of the U,G,H flags. Instead lwIP uses the interface list with only one default interface acting as a single gateway interface (G) for the default route.</p>
<p>The agent returns a "virtual table" with the default route for the default interface and network routes (no H) for each network interface in the netif_list. All routes are considered to be up (U).</p>
<h2>Loading additional MIBs </h2>
<p>MIBs can only be added in compile-time, not in run-time.</p>
<h1>1 Building the Agent </h1>
<p>First of all you'll need to add the following define to your local lwipopts.h: #define LWIP_SNMP 1</p>
<p>and add the source files your makefile.</p>
<p>Note you'll might need to adapt you network driver to update the mib2 variables for your interface.</p>
<h1>2 Running the Agent </h1>
<p>The following function calls must be made in your program to actually get the SNMP agent running.</p>
<p>Before starting the agent you should supply pointers for sysContact, sysLocation, and snmpEnableAuthenTraps. You can do this by calling</p>
<li><a class="el" href="group__snmp__mib2.html#gaf96002d9d10bcae27a95b2367674249e">snmp_mib2_set_syscontact()</a></li>
<li><a class="el" href="group__snmp__mib2.html#ga4248e004a27344b7260574c3a51882f2">snmp_mib2_set_syslocation()</a></li>
<li><a class="el" href="group__snmp__traps.html#gacaf816ff917f7b7e5d00ed6c9f79b51c">snmp_set_auth_traps_enabled()</a></li>
<p>You can register a callback which is called on successful write access: <a class="el" href="group__snmp__core.html#gaff6a6b39322e92862ab55cfcddfe254b">snmp_set_write_callback()</a>.</p>
<p>Additionally you may want to set</p>
<li><a class="el" href="group__snmp__mib2.html#gacde87dc1d3bd669b19d834b028f490cc">snmp_mib2_set_sysdescr()</a></li>
<li><a class="el" href="group__snmp__core.html#gacc71ac857bf9215f06a624dda09abe3a">snmp_set_device_enterprise_oid()</a></li>
<li><a class="el" href="group__snmp__mib2.html#gae7ce98a6ecc0bb92aaa2b330599a2db7">snmp_mib2_set_sysname()</a></li>
<p>Also before starting the agent you need to setup one or more trap destinations using these calls:</p>
<li><a class="el" href="group__snmp__traps.html#gab101505be59778cf0f2f1ac40bcf3f32">snmp_trap_dst_enable()</a></li>
<li><a class="el" href="group__snmp__traps.html#ga15e4afbf80ed2260850842e6608c6d86">snmp_trap_dst_ip_set()</a></li>
<p>If you need more than MIB2, set the MIBs you want to use by <a class="el" href="group__snmp__core.html#ga29c76474971f25d038fd486447c70e21">snmp_set_mibs()</a>.</p>
<p>Finally, enable the agent by calling <a class="el" href="snmp__netconn_8c.html#ga4d88f2fc7655280384131d543e0d83e5">snmp_init()</a> </p>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<li class="footer">Generated by
<a href="">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li>