4 //=============================================================================
8 * Definition of error macros and error strings
10 //=============================================================================
12 /*===================================================================
14 Hewlett-Packard Company
16 ATTENTION: USE OF THIS SOFTWARE IS SUBJECT TO THE FOLLOWING TERMS.
17 Permission to use, copy, modify, distribute and/or sell this software
18 and/or its documentation is hereby granted without fee. User agrees
19 to display the above copyright notice and this license notice in all
20 copies of the software and any documentation of the software. User
21 agrees to assume all liability for the use of the software; Hewlett-Packard
22 makes no representations about the suitability of this software for any
23 purpose. It is provided "AS-IS without warranty of any kind,either express
24 or implied. User hereby grants a royalty-free license to any and all
25 derivatives based upon this software code base.
26 ============================================================================*/
29 //-------[ Positive ASNMP Error Return Codes ]------------------------------
30 // These values are error status values from RFC 1905
32 // The values can be returned via Pdu::get_error_status()
34 #define SNMP_ERROR_SUCCESS 0 // Success Status
35 #define SNMP_ERROR_TOO_BIG 1 // Pdu encoding too big
36 #define SNMP_ERROR_NO_SUCH_NAME 2 // No such VB name, see error index
37 #define SNMP_ERROR_BAD_VALUE 3 // Bad Vb
38 #define SNMP_ERROR_READ_ONLY 4 // VB is read only, see error index
39 #define SNMP_ERROR_GENERAL_VB_ERR 5 // General VB error, see error index
40 #define SNMP_ERROR_NO_ACCESS 6 // No access to MIBs data
41 #define SNMP_ERROR_WRONG_TYPE 7 // Requested type was incorrect
42 #define SNMP_ERROR_WRONG_LENGTH 8 // Request Pdu has inccorect length
43 #define SNMP_ERROR_WRONG_ENCODING 9 // Request Pdu has wrong encoding
44 #define SNMP_ERROR_WRONG_VALUE 10 // Request Pdu has wrong value
45 #define SNMP_ERROR_NO_CREATION 11 // Unable to create object specified
46 #define SNMP_ERROR_INCONSIST_VAL 12 // Inconsistent value in request
47 #define SNMP_ERROR_RESOURCE_UNAVAIL 13 // Resources unavailable
48 #define SNMP_ERROR_COMITFAIL 14 // Unable to comit
49 #define SNMP_ERROR_UNDO_FAIL 15 // Unable to undo
50 #define SNMP_ERROR_AUTH_ERR 16 // Authentication failure
51 #define SNMP_ERROR_NOT_WRITEABLE 17 // Mib Object not writeable
52 #define SNMP_ERROR_INCONSIS_NAME 18 // Inconsistent naming used
55 //-------[ Negative ASNMP Result/Error Return Codes ]-------------------
58 #define SNMP_CLASS_SUCCESS 0 // success
59 #define SNMP_CLASS_ERROR -1 // general error
60 #define SNMP_CLASS_RESOURCE_UNAVAIL -2 // e.g., malloc failed
61 #define SNMP_CLASS_INTERNAL_ERROR -3 // unexpected / internal error
62 #define SNMP_CLASS_UNSUPPORTED -4 // unsupported function
65 #define SNMP_CLASS_TIMEOUT -5 // outstanding request timed out
66 #define SNMP_CLASS_ASYNC_RESPONSE -6 // received response for outstd request
67 #define SNMP_CLASS_NOTIFICATION -7 // received notification (trap/inform)
68 #define SNMP_CLASS_SESSION_DESTROYED -8 // snmp::destroyed with oustanding reqs pending
71 #define SNMP_CLASS_INVALID -10 // snmp::mf called on invalid instance
72 #define SNMP_CLASS_INVALID_PDU -11 // invalid pdu passed to mf
73 #define SNMP_CLASS_INVALID_TARGET -12 // invalid target passed to mf
74 #define SNMP_CLASS_INVALID_CALLBACK -13 // invalid callback to mf
75 #define SNMP_CLASS_INVALID_REQID -14 // invalid request id to cancel
76 #define SNMP_CLASS_INVALID_NOTIFYID -15 // missing trap/inform oid
77 #define SNMP_CLASS_INVALID_OPERATION -16 // snmp operation not allowed for specified target
78 #define SNMP_CLASS_INVALID_OID -17 // invalid oid passed to mf
79 #define SNMP_CLASS_INVALID_ADDRESS -18 // invalid address passed to mf
80 #define SNMP_CLASS_ERR_STATUS_SET -19 // agent returned response pdu with error_status set
83 #define SNMP_CLASS_TL_UNSUPPORTED -20 // transport unsupported
84 #define SNMP_CLASS_TL_IN_USE -21 // transport in use
85 #define SNMP_CLASS_TL_FAILED -22 // transport operation failed
88 #define SNMP_CLASS_SHUTDOWN -23 // used for back door shutdown
89 #define SNMP_INVALID_ARGS -24 // invalid args passed
91 #ifdef INCLUDE_SNMP_ERR_STRINGS_
93 // ASCII strings returned through Snmp::error() function. NOTE: altering
94 // the strings in this header file will not affect the return values of
95 // Snmp::error(), unless you rebuild the ASNMP library from source.
97 #define MAX_POS_ERROR SNMP_ERROR_INCONSIS_NAME
98 #define MAX_NEG_ERROR SNMP_CLASS_SHUTDOWN
100 static const char * pErrs
[] = {
102 "SNMP: Response PDU Too Big", // 1
103 "SNMP: Variable does not exist", // 2
104 "SNMP: Cannot modify variable: Bad Value", // 3
105 "SNMP: Cannot modify object, Read Only", // 4
106 "SNMP: Cannot perform operation, General Error", // 5
107 "SNMP: Cannot access variable, No Access", // 6
108 "SNMP: Cannot create/modify variable, Wrong Type", // 7
109 "SNMP: Cannot create/set variable, Wrong Length", // 8
110 "SNMP: Cannot create/set variable, Wrong Encoding", // 9
111 "SNMP: Cannot create/set variable, Wrong Value", // 10
112 "SNMP: Cannot create variable, Creation Not Allowed", // 11
113 "SNMP: Cannot create/set variable, Inconsistent Value", // 12
114 "SNMP: Cannot create/set variable, Resource Unavailable", // 13
115 "SNMP: Cannot create/set variable, Commit Failed", // 14
116 "SNMP: Cannot create/set variable, Undo Failed", // 15
117 "SNMP: Cannot perform operation, Authorization Error", // 16
118 "SNMP: Cannot create/set variable, Not Writable", // 17
119 "SNMP: Cannot create variable, Inconsistent Name", // 18
120 "SNMP: Unknown error code", // Always last
124 static const char * nErrs
[] = {
126 // 0 SNMP_CLASS_SUCCESS
129 // 1 SNMP_CLASS_ERROR
130 "ASNMP: Operation failed",
132 // 2 SNMP_CLASS_RESOURCE_UNAVAIL
133 "ASNMP: Resource unavailable",
135 // 3 SNMP_CLASS_INTERNAL_ERROR
136 "ASNMP: Internal error",
138 // 4 SNMP_CLASS_UNSUPPORTED
139 "ASNMP: Unsupported function",
142 // 5 SNMP_CLASS_TIMEOUT
143 "ASNMP: SNMP request timed out",
145 // 6 SNMP_CLASS_ASYNC_RESPONSE
146 "ASNMP: Received SNMP Response",
148 // 7 SNMP_CLASS_NOTIFICATION
149 "ASNMP: Received SNMP Notification (trap or inform)",
151 // 8 SNMP_CLASS_SESSION_DESTROYED
152 "ASNMP: Closing session with outstanding requests",
154 // 9 reserved for future
155 "Unknown error code",
157 // Snmp Class errors:
158 // 10 SNMP_CLASS_INVALID
159 "ASNMP: Class not valid",
161 // 11 SNMP_CLASS_INVALID_PDU
162 "ASNMP: Invalid Pdu",
164 // 12 SNMP_CLASS_INVALID_TARGET
165 "ASNMP: Invalid Target",
167 // 13 SNMP_CLASS_INVALID_CALLBACK
168 "ASNMP: Invalid (null) Callback Function",
170 // 14 SNMP_CLASS_INVALID_REQID
171 "ASNMP: Invalid Request Id",
173 // 15 SNMP_CLASS_INVALID_NOTIFYID
174 "ASNMP: Invalid Notification Id",
176 // 16 SNMP_CLASS_INVALID_OPERATION
177 "ASNMP: SNMP Operation not supported on specified Target",
179 // 17 SNMP_CLASS_INVALID_OID
180 "ASNMP: Invalid Object Identifier",
182 // 18 SNMP_CLASS_INVALID_ADDRESS
183 "ASNMP: Invalid Address",
185 // 19 SNMP_CLASS_ERR_STATUS_SET
186 "ASNMP: Agent indicates error in SNMP request",
189 // 20 SNMP_CLASS_TL_UNSUPPORTED
190 "ASNMP: Transport is not supported",
192 // 21 SNMP_CLASS_TL_IN_USE
193 "ASNMP: Transport is in use",
195 // 22 SNMP_CLASS_TL_FAILED
196 "ASNMP: Transport operation failed",
198 // 23 SNMP_CLASS_SHUTDOWN
199 "ASNMP: Blocked Mode Shutdown",
201 // unknown error code
202 "ASNMP: Unknown error code",
205 #endif //INCLUDE_SNMP_ERR_STRINGS_