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_tSnmpVarParse (CONST uint8_t *, size_t *, OID *, size_t *, uint8_t *, uint8_t **, size_t *)
 Parse an SNMP variable.
uint8_tSnmpVarBuild (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

#define SNMP_PORT   161

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_MAX_LEN   500

Default maximum message size.

Definition at line 63 of file snmp.h.

Referenced by SnmpAgent().

#define SNMP_VERSION_1   0

SNMPv1.

The original version, defined by RFC 1157.

Definition at line 70 of file snmp.h.

Referenced by SnmpAgentProcessRequest(), and SnmpAuthParse().

#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().

#define SNMP_VERSION_3   3

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)

Definition at line 95 of file snmp.h.

Referenced by SnmpAgentProcessRequest().

#define SNMP_MSG_GETNEXT   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1)

Definition at line 96 of file snmp.h.

Referenced by SnmpAgentProcessRequest().

#define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2)

Definition at line 97 of file snmp.h.

Referenced by SnmpAgentProcessRequest().

#define SNMP_MSG_SET   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3)

Definition at line 98 of file snmp.h.

Referenced by SnmpAgentProcessRequest().

#define SNMP_MSG_TRAP   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4)

Definition at line 103 of file snmp.h.

#define SNMP_MSG_GETBULK   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5)

Definition at line 108 of file snmp.h.

Referenced by SnmpAgentProcessRequest().

#define SNMP_MSG_INFORM   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6)

Definition at line 109 of file snmp.h.

#define SNMP_MSG_TRAP2   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7)

Definition at line 110 of file snmp.h.

#define SNMP_MSG_REPORT   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8)

Definition at line 115 of file snmp.h.

#define SNMP_NOSUCHOBJECT   (ASN_CONTEXT | ASN_PRIMITIVE | 0x0)

Definition at line 120 of file snmp.h.

Referenced by SnmpVarBuild().

#define SNMP_NOSUCHINSTANCE   (ASN_CONTEXT | ASN_PRIMITIVE | 0x1)

Definition at line 121 of file snmp.h.

Referenced by SnmpVarBuild().

#define SNMP_ENDOFMIBVIEW   (ASN_CONTEXT | ASN_PRIMITIVE | 0x2)

Definition at line 122 of file snmp.h.

Referenced by SnmpVarBuild().

#define SNMP_ERR_NOERROR   0

Definition at line 127 of file snmp.h.

#define SNMP_ERR_TOOBIG   1

Definition at line 128 of file snmp.h.

#define SNMP_ERR_NOSUCHNAME   2

Definition at line 129 of file snmp.h.

#define SNMP_ERR_BADVALUE   3

Definition at line 130 of file snmp.h.

#define SNMP_ERR_READONLY   4

Definition at line 131 of file snmp.h.

#define SNMP_ERR_GENERR   5

Definition at line 132 of file snmp.h.

#define SNMP_ERR_NOACCESS   6

Definition at line 137 of file snmp.h.

#define SNMP_ERR_WRONGTYPE   7

Definition at line 138 of file snmp.h.

#define SNMP_ERR_WRONGLENGTH   8

Definition at line 139 of file snmp.h.

#define SNMP_ERR_WRONGENCODING   9

Definition at line 140 of file snmp.h.

#define SNMP_ERR_WRONGVALUE   10

Definition at line 141 of file snmp.h.

#define SNMP_ERR_NOCREATION   11

Definition at line 142 of file snmp.h.

#define SNMP_ERR_INCONSISTENTVALUE   12

Definition at line 143 of file snmp.h.

#define SNMP_ERR_RESOURCEUNAVAILABLE   13

Definition at line 144 of file snmp.h.

#define SNMP_ERR_COMMITFAILED   14

Definition at line 145 of file snmp.h.

#define SNMP_ERR_UNDOFAILED   15

Definition at line 146 of file snmp.h.

#define SNMP_ERR_AUTHORIZATIONERROR   16

Definition at line 147 of file snmp.h.

#define SNMP_ERR_NOTWRITABLE   17

Definition at line 148 of file snmp.h.

#define SNMP_ERR_INCONSISTENTNAME   18

Definition at line 149 of file snmp.h.

#define SNMP_TRAP_COLDSTART   0

Definition at line 154 of file snmp.h.

#define SNMP_TRAP_WARMSTART   1

Definition at line 155 of file snmp.h.

#define SNMP_TRAP_LINKDOWN   2

Definition at line 156 of file snmp.h.

#define SNMP_TRAP_LINKUP   3

Definition at line 157 of file snmp.h.

#define SNMP_TRAP_AUTHFAIL   4

Definition at line 158 of file snmp.h.

#define SNMP_TRAP_EGPNEIGHBORLOSS   5

Definition at line 159 of file snmp.h.

#define SNMP_TRAP_ENTERPRISESPECIFIC   6

Definition at line 160 of file snmp.h.

#define SNMP_OID_INTERNET   1, 3, 6, 1

Examples:
snmpd/snmpd.c.

Definition at line 165 of file snmp.h.

Referenced by main().

#define SNMP_OID_ENTERPRISES   SNMP_OID_INTERNET, 4, 1

Definition at line 166 of file snmp.h.

#define SNMP_OID_MIB2   SNMP_OID_INTERNET, 2, 1

Definition at line 167 of file snmp.h.

#define SNMP_OID_SNMPV2   SNMP_OID_INTERNET, 6

Definition at line 168 of file snmp.h.

#define SNMP_OID_SNMPMODULES   SNMP_OID_SNMPV2, 3

Definition at line 169 of file snmp.h.

#define SNMP_PARSE_ERROR   -1

Definition at line 173 of file snmp.h.

#define SNMP_BUILD_ERROR   -2

Definition at line 174 of file snmp.h.

#define MAX_SID_LEN   32

Maximum length of a community name.

Definition at line 177 of file snmp.h.

#define MAX_NAME_LEN   128

Maximum number of sub IDs in an OID.

Definition at line 179 of file snmp.h.

#define SNMP_ACT_RESERVE1   0

Definition at line 181 of file snmp.h.

Referenced by SnmpAgentProcessRequest().

#define SNMP_ACT_RESERVE2   1

Definition at line 182 of file snmp.h.

Referenced by SnmpAgentProcessRequest().

#define SNMP_ACT_COMMIT   2

Definition at line 183 of file snmp.h.

Referenced by SnmpAgentProcessRequest().

#define SNMP_ACT_ACTION   3

Definition at line 184 of file snmp.h.

Referenced by SnmpAgentProcessRequest().

#define SNMP_ACT_FREE   4

Definition at line 185 of file snmp.h.

Referenced by SnmpAgentProcessRequest().


Function Documentation

CONST uint8_t* SnmpVarParse ( CONST uint8_t data,
size_t *  dlen,
OID name,
size_t *  nlen,
uint8_t type,
uint8_t **  value,
size_t *  vlen 
)

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.

uint8_t* SnmpVarBuild ( uint8_t data,
size_t *  dlen,
CONST OID name,
size_t  nlen,
uint8_t  type,
CONST uint8_t value,
size_t  vlen 
)

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.


© 2000-2007 by egnite Software GmbH - visit http://www.ethernut.de/