1 /*_############################################################################
6 _## -----------------------------------------------
7 _## Copyright (c) 2001-2010 Jochen Katz, Frank Fock
9 _## This software is based on SNMP++2.6 from Hewlett Packard:
11 _## Copyright (c) 1996
12 _## Hewlett-Packard Company
14 _## ATTENTION: USE OF THIS SOFTWARE IS SUBJECT TO THE FOLLOWING TERMS.
15 _## Permission to use, copy, modify, distribute and/or sell this software
16 _## and/or its documentation is hereby granted without fee. User agrees
17 _## to display the above copyright notice and this license notice in all
18 _## copies of the software and any documentation of the software. User
19 _## agrees to assume all liability for the use of the software;
20 _## Hewlett-Packard and Jochen Katz make no representations about the
21 _## suitability of this software for any purpose. It is provided
22 _## "AS-IS" without warranty of any kind, either express or implied. User
23 _## hereby grants a royalty-free license to any and all derivatives based
24 _## upon this software code base.
26 _## Stuttgart, Germany, Thu Sep 2 00:07:47 CEST 2010
28 _##########################################################################*/
29 /*===================================================================
32 Hewlett-Packard Company
34 ATTENTION: USE OF THIS SOFTWARE IS SUBJECT TO THE FOLLOWING TERMS.
35 Permission to use, copy, modify, distribute and/or sell this software
36 and/or its documentation is hereby granted without fee. User agrees
37 to display the above copyright notice and this license notice in all
38 copies of the software and any documentation of the software. User
39 agrees to assume all liability for the use of the software; Hewlett-Packard
40 makes no representations about the suitability of this software for any
41 purpose. It is provided "AS-IS without warranty of any kind,either express
42 or implied. User hereby grants a royalty-free license to any and all
43 derivatives based upon this software code base.
46 SNMP++ S N M P E R R S. H
48 SNMP++ ERROR CODE AND STRING DEFINITIONS
51 Definition of error macros and error strings
53 DESIGN + AUTHOR: Jeff Meyer
54 ============================================================================*/
55 // $Id: snmperrs.h 1541 2009-05-29 11:29:22Z katz $
60 #include "snmp_pp/config_snmp_pp.h"
62 #ifdef SNMP_PP_NAMESPACE
66 //-------[ Positive SNMP ++ Error Return Codes ]------------------------------
67 /** @name Pdu error codes
68 * These values are error status values from RFC 1905
70 * The values can be returned via Pdu::get_error_status()
73 #define SNMP_ERROR_SUCCESS 0 //!< Success Status
74 #define SNMP_ERROR_TOO_BIG 1 //!< Pdu encoding too big
75 #define SNMP_ERROR_NO_SUCH_NAME 2 //!< No such VB name, see error index
76 #define SNMP_ERROR_BAD_VALUE 3 //!< Bad Vb
77 #define SNMP_ERROR_READ_ONLY 4 //!< VB is read only, see error index
78 #define SNMP_ERROR_GENERAL_VB_ERR 5 //!< General VB error, see error index
79 #define SNMP_ERROR_NO_ACCESS 6 //!< No access to MIBs data
80 #define SNMP_ERROR_WRONG_TYPE 7 //!< Requested type was incorrect
81 #define SNMP_ERROR_WRONG_LENGTH 8 //!< Request Pdu has inccorect length
82 #define SNMP_ERROR_WRONG_ENCODING 9 //!< Request Pdu has wrong encoding
83 #define SNMP_ERROR_WRONG_VALUE 10 //!< Request Pdu has wrong value
84 #define SNMP_ERROR_NO_CREATION 11 //!< Unable to create object specified
85 #define SNMP_ERROR_INCONSIST_VAL 12 //!< Inconsistent value in request
86 #define SNMP_ERROR_RESOURCE_UNAVAIL 13 //!< Resources unavailable
87 #define SNMP_ERROR_COMITFAIL 14 //!< Unable to comit
88 #define SNMP_ERROR_UNDO_FAIL 15 //!< Unable to undo
89 #define SNMP_ERROR_AUTH_ERR 16 //!< Authorization error
90 #define SNMP_ERROR_NOT_WRITEABLE 17 //!< Mib Object not writeable
91 #define SNMP_ERROR_INCONSIS_NAME 18 //!< Inconsistent naming used
94 //-------[ Negative SNMP ++ Result/Error Return Codes ]-------------------
96 /** @name Snmp class return codes
101 #define SNMP_CLASS_SUCCESS 0 //!< success
102 #define SNMP_CLASS_ERROR -1 //!< general error
103 #define SNMP_CLASS_RESOURCE_UNAVAIL -2 //!< e.g., malloc failed
104 #define SNMP_CLASS_INTERNAL_ERROR -3 //!< unexpected / internal error
105 #define SNMP_CLASS_UNSUPPORTED -4 //!< unsupported function
108 #define SNMP_CLASS_TIMEOUT -5 //!< outstanding request timed out
109 #define SNMP_CLASS_ASYNC_RESPONSE -6 //!< received response for outstd request
110 #define SNMP_CLASS_NOTIFICATION -7 //!< received notification (trap/inform)
111 #define SNMP_CLASS_SESSION_DESTROYED -8 //!< snmp::destroyed with oustanding reqs pending
114 #define SNMP_CLASS_INVALID -10 //!< snmp::mf called on invalid instance
115 #define SNMP_CLASS_INVALID_PDU -11 //!< invalid pdu passed to mf
116 #define SNMP_CLASS_INVALID_TARGET -12 //!< invalid target passed to mf
117 #define SNMP_CLASS_INVALID_CALLBACK -13 //!< invalid callback to mf
118 #define SNMP_CLASS_INVALID_REQID -14 //!< invalid request id to cancel
119 #define SNMP_CLASS_INVALID_NOTIFYID -15 //!< missing trap/inform oid
120 #define SNMP_CLASS_INVALID_OPERATION -16 //!< snmp operation not allowed for specified target
121 #define SNMP_CLASS_INVALID_OID -17 //!< invalid oid passed to mf
122 #define SNMP_CLASS_INVALID_ADDRESS -18 //!< invalid address passed to mf
123 #define SNMP_CLASS_ERR_STATUS_SET -19 //!< agent returned response pdu with error_status set
126 #define SNMP_CLASS_TL_UNSUPPORTED -20 //!< transport unsupported
127 #define SNMP_CLASS_TL_IN_USE -21 //!< transport in use
128 #define SNMP_CLASS_TL_FAILED -22 //!< transport operation failed
129 #define SNMP_CLASS_TL_ACCESS_DENIED -23 //!< transport missing rights
132 #define SNMP_CLASS_SHUTDOWN -24 //!< used for back door shutdown
134 // ASN.1 parse errors
135 #define SNMP_CLASS_BADVERSION -50 //!< unsupported version
136 #define SNMP_CLASS_ASN1ERROR -51 //!< used for ASN.1 parse errors
139 #define MAX_POS_ERROR SNMP_ERROR_INCONSIS_NAME
140 #define MAX_NEG_ERROR SNMP_CLASS_SHUTDOWN
143 #ifdef _INCLUDE_SNMP_ERR_STRINGS
146 * ASCII strings returned through Snmp::error() function.
148 * @note altering the strings in this header file will not affect the
149 * return values of Snmp::error(), unless you rebuild the SNMP++
150 * library from source.
153 static const char * pErrs[] = {
155 "SNMP: Response PDU Too Big", // 1
156 "SNMP: Variable does not exist", // 2
157 "SNMP: Cannot modify variable: Bad Value", // 3
158 "SNMP: Cannot modify object, Read Only", // 4
159 "SNMP: Cannot perform operation, General Error", // 5
160 "SNMP: Cannot access variable, No Access", // 6
161 "SNMP: Cannot create/modify variable, Wrong Type", // 7
162 "SNMP: Cannot create/set variable, Wrong Length", // 8
163 "SNMP: Cannot create/set variable, Wrong Encoding", // 9
164 "SNMP: Cannot create/set variable, Wrong Value", // 10
165 "SNMP: Cannot create variable, Creation Not Allowed", // 11
166 "SNMP: Cannot create/set variable, Inconsistent Value", // 12
167 "SNMP: Cannot create/set variable, Resource Unavailable", // 13
168 "SNMP: Cannot create/set variable, Commit Failed", // 14
169 "SNMP: Cannot create/set variable, Undo Failed", // 15
170 "SNMP: Cannot perform operation, Authorization Error", // 16
171 "SNMP: Cannot create/set variable, Not Writable", // 17
172 "SNMP: Cannot create variable, Inconsistent Name", // 18
173 "SNMP: Unknown Error Status" // 19
177 static const char * nv3Errs[] = {
178 "SNMPv3: v3MP error", // -1400
179 "SNMPv3: v3MP ok", // -1401
180 "SNMPv3: Unsupported Security Model", // -1402
181 "SNMPv3: Message not in Time Window", // -1403
182 "SNMPv3: received same Message twice",// -1404
183 "SNMPv3: Invalid Message", // -1405
184 "SNMPv3: Invalid EngineID", // -1406
185 "SNMPv3: v3MP not initialized", // -1407
186 "SNMPv3: Parse Error", // -1408
187 "SNMPv3: Received Message with unknown MsgID", // -1409
188 "SNMPv3: Message does not match known message", // -1410
189 "SNMPv3: Community format error", // -1411
190 "SNMPv3: Unknown UserName", //-1412
191 "SNMPv3: Build error", //-1413
192 "SNMPv3: USM: error", //-1414
193 "SNMPv3: Unknown pdu handlers", //-1415
194 "SNMPv3: Unavailable Context", //-1416
195 "SNMPv3: Unknown Context", //-1417
196 "SNMPv3: Report sent", //-1418
197 "SNMPv3: Unknown errorcode"
200 static const char * pv3Errs[] = {
201 "SNMPv3: USM: ok", // 1400
202 "SNMPv3: USM: error", // 1401
203 "SNMPv3: USM: Configfile write error", // 1402
204 "SNMPv3: USM: Unsupported SecurityLevel", // 1403
205 "SNMPv3: USM: Unknown SecurityName", // 1404
206 "SNMPv3: USM: Encryption error", // 1405
207 "SNMPv3: USM: Decryption error", // 1406
208 "SNMPv3: USM: Authentication error", // 1407
209 "SNMPv3: USM: Authentication failure", // 1408
210 "SNMPv3: USM: Parse error", // 1409
211 "SNMPv3: USM: Unknown EngineID", // 1410
212 "SNMPv3: USM: Message not in TimeWindow", // 1411
213 "SNMPv3: USM: Unsupported AuthProtocol", // 1412
214 "SNMPv3: USM: Unsupported PrivProtocol", // 1413
215 "SNMPv3: USM: Address error", // 1414
216 "SNMPv3: USM: Could not create file", // 1415
217 "SNMPv3: USM: Could not open file", // 1416
218 "SNMPv3: USM: Could not rename file", // 1417
219 "SNMPv3: USM: Could not delete file", // 1418
220 "SNMPv3: USM: Could not write into file", // 1419
221 "SNMPv3: USM: Could not read from file", // 1420
222 "SNMPv3: USM: unknown errorcode"
226 static const char * nErrs[] =
229 "SNMP++: Success", // 0 SNMP_CLASS_SUCCESS
230 "SNMP++: Operation failed", // 1 SNMP_CLASS_ERROR
231 "SNMP++: Resource unavailable", // 2 SNMP_CLASS_RESOURCE_UNAVAIL
232 "SNMP++: Internal error", // 3 SNMP_CLASS_INTERNAL_ERROR
233 "SNMP++: Unsupported function", // 4 SNMP_CLASS_UNSUPPORTED
236 "SNMP++: SNMP request timed out", // 5 SNMP_CLASS_TIMEOUT
237 "SNMP++: Received SNMP Response", // 6 SNMP_CLASS_ASYNC_RESPONSE
238 // 7 SNMP_CLASS_NOTIFICATION
239 "SNMP++: Received SNMP Notification (trap or inform)",
240 // 8 SNMP_CLASS_SESSION_DESTROYED
241 "SNMP++: Closing session with outstanding requests",
242 "Unknown error code", // 9 reserved for future
244 // Snmp Class errors:
245 "SNMP++: Class not valid", // 10 SNMP_CLASS_INVALID
246 "SNMP++: Invalid Pdu", // 11 SNMP_CLASS_INVALID_PDU
247 "SNMP++: Invalid Target", // 12 SNMP_CLASS_INVALID_TARGET
248 "SNMP++: Invalid (null) Callback Function", // 13 SNMP_CLASS_INVALID_CALLBACK
249 "SNMP++: Invalid Request Id", // 14 SNMP_CLASS_INVALID_REQID
250 "SNMP++: Invalid Notification Id", // 15 SNMP_CLASS_INVALID_NOTIFYID
251 // 16 SNMP_CLASS_INVALID_OPERATION
252 "SNMP++: SNMP Operation not supported on specified Target",
253 "SNMP++: Invalid Object Identifier", // 17 SNMP_CLASS_INVALID_OID
254 "SNMP++: Invalid Address", // 18 SNMP_CLASS_INVALID_ADDRESS
255 // 19 SNMP_CLASS_ERR_STATUS_SET
256 "SNMP++: Agent indicates error in SNMP request",
259 "SNMP++: Transport is not supported", // 20 SNMP_CLASS_TL_UNSUPPORTED
260 "SNMP++: Transport is in use", // 21 SNMP_CLASS_TL_IN_USE
261 "SNMP++: Transport operation failed", // 22 SNMP_CLASS_TL_FAILED
262 "SNMP++: Transport access denied", // 23 SNMP_CLASS_TL_ACCESS_DENIED
263 "SNMP++: Blocked Mode Shutdown", // 24 SNMP_CLASS_SHUTDOWN
265 "Unknown error code", // unknown error code
268 #endif //_INCLUDE_SNMP_ERR_STRINGS
270 #ifdef SNMP_PP_NAMESPACE
271 } // end of namespace Snmp_pp