mikroSDK Reference Manual
snmp_common.h
Go to the documentation of this file.
1
31#ifndef _SNMP_COMMON_H
32#define _SNMP_COMMON_H
33
34//Dependencies
35#include "core/net.h"
36
37//SNMPv1 support
38#ifndef SNMP_V1_SUPPORT
39 #define SNMP_V1_SUPPORT ENABLED
40#elif (SNMP_V1_SUPPORT != ENABLED && SNMP_V1_SUPPORT != DISABLED)
41 #error SNMP_V1_SUPPORT parameter is not valid
42#endif
43
44//SNMPv2c support
45#ifndef SNMP_V2C_SUPPORT
46 #define SNMP_V2C_SUPPORT ENABLED
47#elif (SNMP_V2C_SUPPORT != ENABLED && SNMP_V2C_SUPPORT != DISABLED)
48 #error SNMP_V2C_SUPPORT parameter is not valid
49#endif
50
51//SNMPv3 support
52#ifndef SNMP_V3_SUPPORT
53 #define SNMP_V3_SUPPORT DISABLED
54#elif (SNMP_V3_SUPPORT != ENABLED && SNMP_V3_SUPPORT != DISABLED)
55 #error SNMP_V3_SUPPORT parameter is not valid
56#endif
57
58//Maximum size of SNMP messages
59#ifndef SNMP_MAX_MSG_SIZE
60 #define SNMP_MAX_MSG_SIZE 1452
61#elif (SNMP_MAX_MSG_SIZE < 484 || SNMP_MAX_MSG_SIZE > 65535)
62 #error SNMP_MAX_MSG_SIZE parameter is not valid
63#endif
64
65//Maximum size for context engine identifier
66#ifndef SNMP_MAX_CONTEXT_ENGINE_SIZE
67 #define SNMP_MAX_CONTEXT_ENGINE_SIZE 32
68#elif (SNMP_MAX_CONTEXT_ENGINE_SIZE < 1)
69 #error SNMP_MAX_CONTEXT_ENGINE_SIZE parameter is not valid
70#endif
71
72//Maximum length for context name
73#ifndef SNMP_MAX_CONTEXT_NAME_LEN
74 #define SNMP_MAX_CONTEXT_NAME_LEN 32
75#elif (SNMP_MAX_CONTEXT_NAME_LEN < 1)
76 #error SNMP_MAX_CONTEXT_NAME_LEN parameter is not valid
77#endif
78
79//Maximum length for user names and community names
80#ifndef SNMP_MAX_USER_NAME_LEN
81 #define SNMP_MAX_USER_NAME_LEN 32
82#elif (SNMP_MAX_USER_NAME_LEN < 1)
83 #error SNMP_MAX_USER_NAME_LEN parameter is not valid
84#endif
85
86//Maximum size for user public values
87#ifndef SNMP_MAX_PUBLIC_VALUE_SIZE
88 #define SNMP_MAX_PUBLIC_VALUE_SIZE 32
89#elif (SNMP_MAX_PUBLIC_VALUE_SIZE < 1)
90 #error SNMP_MAX_PUBLIC_VALUE_SIZE parameter is not valid
91#endif
92
93//Maximum length for group names
94#ifndef SNMP_MAX_GROUP_NAME_LEN
95 #define SNMP_MAX_GROUP_NAME_LEN 32
96#elif (SNMP_MAX_GROUP_NAME_LEN < 1)
97 #error SNMP_MAX_GROUP_NAME_LEN parameter is not valid
98#endif
99
100//Maximum length for view names
101#ifndef SNMP_MAX_VIEW_NAME_LEN
102 #define SNMP_MAX_VIEW_NAME_LEN 32
103#elif (SNMP_MAX_VIEW_NAME_LEN < 1)
104 #error SNMP_MAX_VIEW_NAME_LEN parameter is not valid
105#endif
106
107//Maximum length for bit masks
108#ifndef SNMP_MAX_BIT_MASK_SIZE
109 #define SNMP_MAX_BIT_MASK_SIZE 16
110#elif (SNMP_MAX_BIT_MASK_SIZE < 1)
111 #error SNMP_MAX_MASK_SIZE parameter is not valid
112#endif
113
114//Maximum size for object identifiers
115#ifndef SNMP_MAX_OID_SIZE
116 #define SNMP_MAX_OID_SIZE 16
117#elif (SNMP_MAX_OID_SIZE < 1)
118 #error SNMP_MAX_OID_SIZE parameter is not valid
119#endif
120
121//SNMP port number
122#define SNMP_PORT 161
123//SNMP trap port number
124#define SNMP_TRAP_PORT 162
125
126//C++ guard
127#ifdef __cplusplus
128extern "C" {
129#endif
130
131
136typedef enum
137{
138 SNMP_VERSION_1 = 0,
139 SNMP_VERSION_2C = 1,
140 SNMP_VERSION_3 = 3
142
143
148typedef enum
149{
150 SNMP_PDU_GET_REQUEST = 0,
151 SNMP_PDU_GET_NEXT_REQUEST = 1,
152 SNMP_PDU_GET_RESPONSE = 2,
153 SNMP_PDU_SET_REQUEST = 3,
154 SNMP_PDU_TRAP = 4,
155 SNMP_PDU_GET_BULK_REQUEST = 5,
156 SNMP_PDU_INFORM_REQUEST = 6,
157 SNMP_PDU_TRAP_V2 = 7,
158 SNMP_PDU_REPORT = 8
160
161
166typedef enum
167{
168 SNMP_TRAP_COLD_START = 0,
169 SNMP_TRAP_WARM_START = 1,
170 SNMP_TRAP_LINK_DOWN = 2,
171 SNMP_TRAP_LINK_UP = 3,
172 SNMP_TRAP_AUTH_FAILURE = 4,
173 SNMP_TRAP_EGP_NEIGHBOR_LOSS = 5,
174 SNMP_TRAP_ENTERPRISE_SPECIFIC = 6
176
177
182typedef enum
183{
184 SNMP_ERROR_NONE = 0,
185 SNMP_ERROR_TOO_BIG = 1,
186 SNMP_ERROR_NO_SUCH_NAME = 2,
187 SNMP_ERROR_BAD_VALUE = 3,
188 SNMP_ERROR_READ_ONLY = 4,
189 SNMP_ERROR_GENERIC = 5,
190 SNMP_ERROR_NO_ACCESS = 6,
191 SNMP_ERROR_WRONG_TYPE = 7,
192 SNMP_ERROR_WRONG_LENGTH = 8,
193 SNMP_ERROR_WRONG_ENCODING = 9,
194 SNMP_ERROR_WRONG_VALUE = 10,
195 SNMP_ERROR_NO_CREATION = 11,
196 SNMP_ERROR_INCONSISTENT_VALUE = 12,
197 SNMP_ERROR_RESOURCE_UNAVAILABLE = 13,
198 SNMP_ERROR_COMMIT_FAILED = 14,
199 SNMP_ERROR_UNDO_FAILED = 15,
200 SNMP_ERROR_AUTHORIZATION = 16,
201 SNMP_ERROR_NOT_WRITABLE = 17,
202 SNMP_ERROR_INCONSISTENT_NAME = 18
204
205
210typedef enum
211{
212 SNMP_EXCEPTION_NO_SUCH_OBJECT = 0,
213 SNMP_EXCEPTION_NO_SUCH_INSTANCE = 1,
214 SNMP_EXCEPTION_END_OF_MIB_VIEW = 2
216
217
222typedef enum
223{
224 SNMP_ENGINE_ID_FORMAT_IPV4 = 1,
225 SNMP_ENGINE_ID_FORMAT_IPV6 = 2,
226 SNMP_ENGINE_ID_FORMAT_MAC = 3,
227 SNMP_ENGINE_ID_FORMAT_TEXT = 4,
228 SNMP_ENGINE_ID_FORMAT_OCTETS = 5,
230
231
232//C++ guard
233#ifdef __cplusplus
234}
235#endif
236
237#endif
TCP/IP stack core.
SnmpEngineIdFormat
SNMP engine ID format.
Definition snmp_common.h:223
SnmpPduType
SNMP PDU types.
Definition snmp_common.h:149
SnmpException
SNMP exceptions.
Definition snmp_common.h:211
SnmpVersion
SNMP version identifiers.
Definition snmp_common.h:137
SnmpErrorStatus
SNMP error status.
Definition snmp_common.h:183
SnmpGenericTrapType
SNMP generic trap types.
Definition snmp_common.h:167