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