snmp.h File Reference
Definitions for Simple Network Management Protocol.
More...
Go to the source code of this file.
|
Defines |
#define | SNMP_PORT 161 |
| Standard UDP port for SNMP agents to receive requests messages.
|
#define | SNMP_TRAP_PORT 162 |
| Standard UDP port for SNMP managers to receive notificaion messages.
|
#define | SNMP_MAX_LEN 500 |
| Default maximum message size.
|
#define | SNMP_VERSION_1 0 |
| SNMPv1.
|
#define | SNMP_VERSION_2C 1 |
| SNMPv2c.
|
#define | SNMP_VERSION_3 3 |
| SNMPv3.
|
#define | SNMP_MSG_GET (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) |
#define | SNMP_MSG_GETNEXT (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) |
#define | SNMP_MSG_RESPONSE (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) |
#define | SNMP_MSG_SET (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) |
#define | SNMP_MSG_TRAP (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) |
#define | SNMP_MSG_GETBULK (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) |
#define | SNMP_MSG_INFORM (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) |
#define | SNMP_MSG_TRAP2 (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) |
#define | SNMP_MSG_REPORT (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) |
#define | SNMP_NOSUCHOBJECT (ASN_CONTEXT | ASN_PRIMITIVE | 0x0) |
#define | SNMP_NOSUCHINSTANCE (ASN_CONTEXT | ASN_PRIMITIVE | 0x1) |
#define | SNMP_ENDOFMIBVIEW (ASN_CONTEXT | ASN_PRIMITIVE | 0x2) |
#define | SNMP_ERR_NOERROR 0 |
#define | SNMP_ERR_TOOBIG 1 |
#define | SNMP_ERR_NOSUCHNAME 2 |
#define | SNMP_ERR_BADVALUE 3 |
#define | SNMP_ERR_READONLY 4 |
#define | SNMP_ERR_GENERR 5 |
#define | SNMP_ERR_NOACCESS 6 |
#define | SNMP_ERR_WRONGTYPE 7 |
#define | SNMP_ERR_WRONGLENGTH 8 |
#define | SNMP_ERR_WRONGENCODING 9 |
#define | SNMP_ERR_WRONGVALUE 10 |
#define | SNMP_ERR_NOCREATION 11 |
#define | SNMP_ERR_INCONSISTENTVALUE 12 |
#define | SNMP_ERR_RESOURCEUNAVAILABLE 13 |
#define | SNMP_ERR_COMMITFAILED 14 |
#define | SNMP_ERR_UNDOFAILED 15 |
#define | SNMP_ERR_AUTHORIZATIONERROR 16 |
#define | SNMP_ERR_NOTWRITABLE 17 |
#define | SNMP_ERR_INCONSISTENTNAME 18 |
#define | SNMP_TRAP_COLDSTART 0 |
#define | SNMP_TRAP_WARMSTART 1 |
#define | SNMP_TRAP_LINKDOWN 2 |
#define | SNMP_TRAP_LINKUP 3 |
#define | SNMP_TRAP_AUTHFAIL 4 |
#define | SNMP_TRAP_EGPNEIGHBORLOSS 5 |
#define | SNMP_TRAP_ENTERPRISESPECIFIC 6 |
#define | SNMP_OID_INTERNET 1, 3, 6, 1 |
#define | SNMP_OID_ENTERPRISES SNMP_OID_INTERNET, 4, 1 |
#define | SNMP_OID_MIB2 SNMP_OID_INTERNET, 2, 1 |
#define | SNMP_OID_SNMPV2 SNMP_OID_INTERNET, 6 |
#define | SNMP_OID_SNMPMODULES SNMP_OID_SNMPV2, 3 |
#define | SNMP_PARSE_ERROR -1 |
#define | SNMP_BUILD_ERROR -2 |
#define | MAX_SID_LEN 32 |
| Maximum length of a community name.
|
#define | MAX_NAME_LEN 128 |
| Maximum number of sub IDs in an OID.
|
#define | SNMP_ACT_RESERVE1 0 |
#define | SNMP_ACT_RESERVE2 1 |
#define | SNMP_ACT_COMMIT 2 |
#define | SNMP_ACT_ACTION 3 |
#define | SNMP_ACT_FREE 4 |
Functions |
CONST uint8_t * | SnmpVarParse (CONST uint8_t *, size_t *, OID *, size_t *, uint8_t *, uint8_t **, size_t *) |
| Parse an SNMP variable.
|
uint8_t * | SnmpVarBuild (uint8_t *, size_t *, CONST OID *, size_t, uint8_t, CONST uint8_t *, size_t) |
| Build an SNMP variable.
|
Detailed Description
Definitions for Simple Network Management Protocol.
* $Id: snmp.h 2235 2008-08-11 07:00:36Z haraldkipp $
*
Definition in file snmp.h.
Define Documentation
Standard UDP port for SNMP agents to receive requests messages.
- Examples:
-
snmpd/snmpd.c.
Definition at line 51 of file snmp.h.
Referenced by main().
#define SNMP_TRAP_PORT 162 |
Standard UDP port for SNMP managers to receive notificaion messages.
Definition at line 57 of file snmp.h.
#define SNMP_VERSION_2C 1 |
SNMPv2c.
Community string-based SNMPv2, which was an attempt to combine the protocol operations of SNMPv2 with the security of SNMPv1, defined by RFCs 1901, 1905, and 1906.
Partly supplied by this code, work is in progress.
Definition at line 80 of file snmp.h.
Referenced by SnmpAgentProcessRequest().
SNMPv3.
An attempt by the IETF working group to merge the SNMPv2u and SNMPv2* proposals into a more widely accepted SNMPv3. The original version, defined by RFC 1157.
Not yet supported by this code.
Definition at line 90 of file snmp.h.
#define SNMP_MSG_GET (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) |
#define SNMP_MSG_GETNEXT (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) |
#define SNMP_MSG_RESPONSE (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) |
#define SNMP_MSG_SET (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) |
#define SNMP_MSG_TRAP (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) |
#define SNMP_MSG_GETBULK (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) |
#define SNMP_MSG_INFORM (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) |
#define SNMP_MSG_TRAP2 (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) |
#define SNMP_MSG_REPORT (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) |
#define SNMP_NOSUCHOBJECT (ASN_CONTEXT | ASN_PRIMITIVE | 0x0) |
#define SNMP_NOSUCHINSTANCE (ASN_CONTEXT | ASN_PRIMITIVE | 0x1) |
#define SNMP_ENDOFMIBVIEW (ASN_CONTEXT | ASN_PRIMITIVE | 0x2) |
#define SNMP_ERR_NOERROR 0 |
#define SNMP_ERR_TOOBIG 1 |
#define SNMP_ERR_NOSUCHNAME 2 |
#define SNMP_ERR_BADVALUE 3 |
#define SNMP_ERR_READONLY 4 |
#define SNMP_ERR_GENERR 5 |
#define SNMP_ERR_NOACCESS 6 |
#define SNMP_ERR_WRONGTYPE 7 |
#define SNMP_ERR_WRONGLENGTH 8 |
#define SNMP_ERR_WRONGENCODING 9 |
#define SNMP_ERR_WRONGVALUE 10 |
#define SNMP_ERR_NOCREATION 11 |
#define SNMP_ERR_INCONSISTENTVALUE 12 |
#define SNMP_ERR_RESOURCEUNAVAILABLE 13 |
#define SNMP_ERR_COMMITFAILED 14 |
#define SNMP_ERR_UNDOFAILED 15 |
#define SNMP_ERR_AUTHORIZATIONERROR 16 |
#define SNMP_ERR_NOTWRITABLE 17 |
#define SNMP_ERR_INCONSISTENTNAME 18 |
#define SNMP_TRAP_COLDSTART 0 |
#define SNMP_TRAP_WARMSTART 1 |
#define SNMP_TRAP_LINKDOWN 2 |
#define SNMP_TRAP_LINKUP 3 |
#define SNMP_TRAP_AUTHFAIL 4 |
#define SNMP_TRAP_EGPNEIGHBORLOSS 5 |
#define SNMP_TRAP_ENTERPRISESPECIFIC 6 |
#define SNMP_OID_INTERNET 1, 3, 6, 1 |
#define SNMP_OID_ENTERPRISES SNMP_OID_INTERNET, 4, 1 |
#define SNMP_OID_MIB2 SNMP_OID_INTERNET, 2, 1 |
#define SNMP_OID_SNMPV2 SNMP_OID_INTERNET, 6 |
#define SNMP_OID_SNMPMODULES SNMP_OID_SNMPV2, 3 |
#define SNMP_PARSE_ERROR -1 |
#define SNMP_BUILD_ERROR -2 |
Maximum length of a community name.
Definition at line 177 of file snmp.h.
Maximum number of sub IDs in an OID.
Definition at line 179 of file snmp.h.
#define SNMP_ACT_RESERVE1 0 |
#define SNMP_ACT_RESERVE2 1 |
#define SNMP_ACT_COMMIT 2 |
#define SNMP_ACT_ACTION 3 |
Function Documentation
Parse an SNMP variable.
- Parameters:
-
| data | Pointer to start of the name/value pair. |
| dlen | Contains the number of valid bytes following the start of the variable. On exit, it is returned as the number of valid bytes following the end of this variable. |
| name | Pointer to a buffer that receives the name (OID). |
| nlen | On entry, this contains the maximum number of sub IDs accepted for the name. On exit, it is returned as the actual number sub IDs found in the name. |
| type | Pointer to the variable that receives the ASN type of the value. |
| value | Pointer to variable that receives a pointer to the ASN1 encoded value of variable. |
| vlen | Pointer to the variable that receives the length of the value. |
- Returns:
- Pointer to the first byte past the end of this name/value pair. Returns NULL on any error.
Definition at line 60 of file snmp.c.
References ASN_CONSTRUCTOR, ASN_OBJECT_ID, ASN_PRIMITIVE, ASN_SEQUENCE, ASN_UNIVERSAL, AsnHeaderParse(), AsnOidParse(), AsnSequenceParse(), and CONST.
Build an SNMP variable.
- Parameters:
-
| data | Pointer to start of the output buffer. |
| dlen | Contains the number of valid bytes following the start of the variable. On exit, it is returned as the number of valid bytes following the end of this variable. |
| name | Name (OID). |
| nlen | Number of sub IDs of the name. |
| type | ASN type of the value. |
| value | Pointer to the value. |
| vlen | Length of the value. |
- Returns:
- Pointer to the first byte past the end of this name/value pair. Returns NULL on any error.
Definition at line 109 of file snmp.c.
References ASN_BIT_STR, ASN_CONSTRUCTOR, ASN_COUNTER, ASN_COUNTER64, ASN_GAUGE, ASN_INTEGER, ASN_IPADDRESS, ASN_NSAP, ASN_NULL, ASN_OBJECT_ID, ASN_OCTET_STR, ASN_OPAQUE, ASN_PRIMITIVE, ASN_SEQUENCE, ASN_TIMETICKS, ASN_UINTEGER, ASN_UNIVERSAL, AsnBitStringBuild(), AsnIntegerBuild(), AsnNullBuild(), AsnOctetStringBuild(), AsnOidBuild(), AsnSequenceBuild(), AsnUnsigned64Build(), AsnUnsignedBuild(), SNMP_ENDOFMIBVIEW, SNMP_NOSUCHINSTANCE, SNMP_NOSUCHOBJECT, SNMP_STAT_OUTBADVALUES, SNMP_STAT_OUTTOOBIGS, and SnmpStatsInc().