snmperrs.h
上传用户:uncom666
上传日期:2020-03-30
资源大小:1426k
文件大小:12k
源码类别:

SNMP编程

开发平台:

Visual C++

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