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