-SNMPv1 agent for lwIP [preliminairy]
+SNMPv1 agent for lwIP
Author: Christiaan Simons
This is a brief introduction how to use and configure the SNMP agent.
Note the agent uses the raw-API UDP interface so you may also want to
-read rawapi.txt to gain a better understanding of the SNMP messages handling.
+read rawapi.txt to gain a better understanding of the SNMP message handling.
-0 Agent capabilities
+0 Agent Capabilities
====================
SNMPv1 per RFC1157
This is an old(er) standard but is still widely supported.
For SNMPv2c and v3 have a greater complexity and need many
more lines of code. IMHO this breaks the idea of "lightweight IP".
- Note the S in SNMP stands for "Simple" and is actually a bad joke.
+
+ 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).
MIB II per RFC1213
The standard lwIP stack management information base.
PBUF_POOL_SIZE and IP_REASS_BUFSIZE are set to match your
local requirement.
-1 Building the agent
+1 Building the Agent
====================
First of all you'll need to add the following define
Note you'll might need to adapt you network driver to update
the mib2 variables for your interface.
-2 Running the agent
+2 Running the Agent
===================
The following function calls must be made in your program to
tree must be kept in sorted ascending (lexicographical) order.
This to ensure correct getnext operation.
+An example for a private MIB is part of the "minimal Unix" project:
+contrib/ports/unix/proj/minimal/lwip_prvmib.c
+
The next chapter gives a more detailed description of the
MIB-2 tree and the optional private MIB.
-4 Agent internals
-=================
+4 The Gory Details
+==================
4.0 Object identifiers and the MIB tree.
turn use dynamically allocated index trees from RAM.
These trees are updated by e.g. the etharp code
when new entries are made or removed form the ARP cache.
+
+/** @todo more gory details */
/**
* @file
- * [EXPERIMENTAL] Abstract Syntax Notation One (ISO 8824, 8825) encoding
+ * Abstract Syntax Notation One (ISO 8824, 8825) encoding
*
* @todo not optimised (yet), favor correctness over speed, favor speed over size
*/
* @param ofs points to the offset within the pbuf chain
* @param length is the host order length to be encoded
* @return ERR_OK if successfull, ERR_ARG if we can't (or won't) encode
- *
- * @todo also add octets_used instead of compares??
- * @todo encode "type" in this function as well??
*/
err_t
snmp_asn1_enc_length(struct pbuf *p, u16_t ofs, u16_t length)
/**
* @file
- * [EXPERIMENTAL] Management Information Base II (RFC1213) objects and functions.
+ * Management Information Base II (RFC1213) objects and functions.
*
* @note the object identifiers for this MIB-2 and private MIB tree
* must be kept in sorted ascending order. This to ensure correct getnext operation.
}
}
-/**
- * @todo the etharp_find_addr could be a lot smarter
- * if our arp index tree provided pointers or index to the requested item
- */
static void
atentry_get_value(struct obj_def *od, u16_t len, void *value)
{
/**
* @file
- * [EXPERIMENTAL] MIB tree access/construction functions.
+ * MIB tree access/construction functions.
*/
/*
/**
* @file
- * [EXPERIMENTAL] SNMP input message processing (RFC1157).
- *
- * EXPERIMENTAL code, this is not how the agent should respond.
- * This is for test purposes only, DO NOT USE THIS CODE IN REAL WORLD!!
+ * SNMP input message processing (RFC1157).
*/
/*
/**
* @file
- * [EXPERIMENTAL] SNMP output message processing (RFC1157).
+ * SNMP output message processing (RFC1157).
*
* Output responses and traps are build in two passes:
*
/**
* @file
- * [EXPERIMENTAL] Abstract Syntax Notation One (ISO 8824, 8825) codec.
+ * Abstract Syntax Notation One (ISO 8824, 8825) codec.
*/
/*
/**
* @file
- * [EXPERIMENTAL] SNMP Agent message handling structures.
+ * SNMP Agent message handling structures.
*/
/*
#define SNMP_COMMUNITY_STR_LEN 64
struct snmp_msg_pstat
{
-#if 0
- struct snmp_msg_pstat *next;
-#endif
/* lwIP local port (161) binding */
struct udp_pcb *pcb;
/* source IP address */
struct snmp_varbind_root outvb;
/* output response lengths used in ASN encoding */
struct snmp_resp_header_lengths rhl;
-#if SNMP_PRIVATE_MIB
- /* private MIB event info */
- struct private_msg pm;
-#endif
};
struct snmp_msg_trap
{
-#if 0
- struct snmp_msg_trap *next;
-#endif
/* lwIP local port (161) binding */
struct udp_pcb *pcb;
/* destination IP address in network order */
/**
* @file
- * [EXPERIMENTAL] Generic MIB tree structures.
+ * Generic MIB tree structures.
*
* @todo namespace prefixes
*/