1. /*
  2. * @(#)file SnmpDefinitions.java
  3. * @(#)author Sun Microsystems, Inc.
  4. * @(#)version 4.28
  5. * @(#)date 04/09/15
  6. *
  7. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  8. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  9. *
  10. */
  11. // Copyright (c) 1995-96 by Cisco Systems, Inc.
  12. package com.sun.jmx.snmp;
  13. /**
  14. * Contains SNMP constants related to command and response codes.
  15. * All members are static and can be used by any application.
  16. *
  17. *
  18. * <p><b>This API is a Sun Microsystems internal API and is subject
  19. * to change without notice.</b></p>
  20. * @version 4.28 12/19/03
  21. * @author Sun Microsystems, Inc
  22. * @author Cisco Systems, Inc.
  23. */
  24. public interface SnmpDefinitions {
  25. /**
  26. * Security level. No authentication, no privacy. Value is 0, as
  27. * defined in RFC 2572.
  28. *
  29. * @since 1.5
  30. */
  31. public static final int noAuthNoPriv = 0;
  32. /**
  33. * Security level. Authentication, no privacy. Value is 1, as
  34. * defined in RFC 2572.
  35. *
  36. * @since 1.5
  37. */
  38. public static final int authNoPriv = 1;
  39. /**
  40. * Security level. Authentication, privacy. Value is 3, as defined
  41. * in RFC 2572.
  42. *
  43. * @since 1.5
  44. */
  45. public static final int authPriv = 3;
  46. /**
  47. * Flag that indicates that a report is to be sent. Value is 4, as
  48. * defined in RFC 2572.
  49. *
  50. * @since 1.5
  51. */
  52. public static final int reportableFlag = 4;
  53. /**
  54. * Mask used to isolate authentication information within a message flag.
  55. *
  56. * @since 1.5
  57. */
  58. public static final int authMask = 1;
  59. /**
  60. * Mask used to isolate privacy information within a message flag.
  61. */
  62. public static final int privMask = 2;
  63. /**
  64. * Mask used to isolate authentication and privacy information within a message flag.
  65. *
  66. * @since 1.5
  67. */
  68. public static final int authPrivMask = 3;
  69. /**
  70. * ASN.1 prefix for encoding PDU types.
  71. */
  72. public final static int CtxtConsFlag = 128|32 ;
  73. /**
  74. * Represents the SNMP protocol version: <CODE>SnmpV1</CODE>.
  75. */
  76. final public static byte snmpVersionOne = 0 ;
  77. /**
  78. * Represents the SNMP protocol version: <CODE>SnmpV2</CODE>.
  79. */
  80. final public static byte snmpVersionTwo = 1 ;
  81. /**
  82. * Represents the SNMP protocol version: <CODE>SnmpV3</CODE>.
  83. *
  84. * @since 1.5
  85. */
  86. final public static byte snmpVersionThree = 3 ;
  87. /**
  88. * Represents a <CODE>GetRequest</CODE> PDU type (V1 or V2).
  89. */
  90. public final static int pduGetRequestPdu = CtxtConsFlag|0 ;
  91. /**
  92. * Represents a <CODE>GetNextRequest</CODE> PDU type (V1 or V2).
  93. */
  94. public final static int pduGetNextRequestPdu = CtxtConsFlag|1 ;
  95. /**
  96. * Represents a <CODE>GetResponse</CODE> PDU type (V1 or V2).
  97. */
  98. public final static int pduGetResponsePdu = CtxtConsFlag|2 ;
  99. /**
  100. * Represents a <CODE>SetRequest</CODE> PDU type (V1 or V2).
  101. */
  102. public final static int pduSetRequestPdu = CtxtConsFlag|3 ;
  103. /**
  104. * Represents a <CODE>GetBulkRequest</CODE> PDU type (V2 only).
  105. */
  106. public final static int pduGetBulkRequestPdu = CtxtConsFlag|5 ;
  107. /**
  108. * Represents a <CODE>Walk</CODE> request.
  109. * A walk uses the <CODE>getNext</CODE> request to "walk" through a given MIB.
  110. */
  111. public final static int pduWalkRequest = 0xFD ;
  112. /**
  113. * Represents a <CODE>V1Trap</CODE> PDU type (V1 only).
  114. */
  115. public final static int pduV1TrapPdu = CtxtConsFlag|4 ;
  116. /**
  117. * Represents a <CODE>V2Trap</CODE> PDU type (V2 only).
  118. */
  119. public final static int pduV2TrapPdu = CtxtConsFlag|7 ;
  120. /**
  121. * Represents an <CODE>InformRequest</CODE> PDU type (V2 only).
  122. */
  123. public final static int pduInformRequestPdu = CtxtConsFlag|6 ;
  124. /**
  125. * Represents a <CODE>Report</CODE> PDU type (V2 only).
  126. */
  127. public final static int pduReportPdu = CtxtConsFlag|8 ;
  128. // SNMPv1 values for generic trap info in Trap-PDU.
  129. //-------------------------------------------------
  130. /**
  131. * Code as defined in RFC 1157 for generic trap info in Trap-PDU: <CODE>coldStart</CODE>.
  132. */
  133. public static final int trapColdStart = 0 ;
  134. /**
  135. * Code as defined in RFC 1157 for generic trap info in Trap-PDU: <CODE>warmStart</CODE>.
  136. */
  137. public static final int trapWarmStart = 1 ;
  138. /**
  139. * Code as defined in RFC 1157 for generic trap info in Trap-PDU: <CODE>linkDown</CODE>.
  140. */
  141. public static final int trapLinkDown = 2 ;
  142. /**
  143. * Code as defined in RFC 1157 for generic trap info in Trap-PDU: <CODE>linkUp</CODE>.
  144. */
  145. public static final int trapLinkUp = 3 ;
  146. /**
  147. * Code as defined in RFC 1157 for generic trap info in Trap-PDU: <CODE>authenticationFailure</CODE>.
  148. */
  149. public static final int trapAuthenticationFailure = 4 ;
  150. /**
  151. * Code as defined in RFC 1157 for generic trap info in Trap-PDU: <CODE>egpNeighborLoss</CODE>.
  152. */
  153. public static final int trapEgpNeighborLoss = 5 ;
  154. /**
  155. * Code as defined in RFC 1157 for generic trap info in Trap-PDU: <CODE>enterpriseSpecific</CODE>.
  156. */
  157. public static final int trapEnterpriseSpecific = 6 ;
  158. // PDU error status enumeration.
  159. //------------------------------
  160. /**
  161. * Error code as defined in RFC 1448 for: <CODE>noError</CODE>.
  162. */
  163. final public static int snmpRspNoError = 0;
  164. /**
  165. * Error code as defined in RFC 1448 for: <CODE>tooBig</CODE>.
  166. */
  167. final public static int snmpRspTooBig = 1;
  168. /**
  169. * Error code as defined in RFC 1448 for: <CODE>noSuchName</CODE>.
  170. */
  171. final public static int snmpRspNoSuchName = 2;
  172. /**
  173. * Error code as defined in RFC 1448 for: <CODE>badValue</CODE>.
  174. */
  175. final public static int snmpRspBadValue = 3;
  176. /**
  177. * Error code as defined in RFC 1448 for: <CODE>readOnly</CODE>.
  178. */
  179. final public static int snmpRspReadOnly = 4;
  180. /**
  181. * Error code as defined in RFC 1448 for: <CODE>genErr</CODE>.
  182. */
  183. final public static int snmpRspGenErr = 5;
  184. /**
  185. * Error code as defined in RFC 1448 for: <CODE>noAccess</CODE>.
  186. */
  187. final public static int snmpRspNoAccess = 6;
  188. /**
  189. * Error code as defined in RFC 1448 for: <CODE>wrongType</CODE>.
  190. */
  191. final public static int snmpRspWrongType = 7;
  192. /**
  193. * Error code as defined in RFC 1448 for: <CODE>wrongLength</CODE>.
  194. */
  195. final public static int snmpRspWrongLength = 8;
  196. /**
  197. * Error code as defined in RFC 1448 for: <CODE>wrongEncoding</CODE>.
  198. */
  199. final public static int snmpRspWrongEncoding = 9;
  200. /**
  201. * Error code as defined in RFC 1448 for: <CODE>wrongValue</CODE>.
  202. */
  203. final public static int snmpRspWrongValue = 10;
  204. /**
  205. * Error code as defined in RFC 1448 for: <CODE>noCreation</CODE>.
  206. */
  207. final public static int snmpRspNoCreation = 11;
  208. /**
  209. * Error code as defined in RFC 1448 for: <CODE>inconsistentValue</CODE>.
  210. */
  211. final public static int snmpRspInconsistentValue = 12;
  212. /**
  213. * Error code as defined in RFC 1448 for: <CODE>resourceUnavailable</CODE>.
  214. */
  215. final public static int snmpRspResourceUnavailable = 13;
  216. /**
  217. * Error code as defined in RFC 1448 for: <CODE>commitFailed</CODE>.
  218. */
  219. final public static int snmpRspCommitFailed = 14;
  220. /**
  221. * Error code as defined in RFC 1448 for: <CODE>undoFailed</CODE>.
  222. */
  223. final public static int snmpRspUndoFailed = 15;
  224. /**
  225. * Error code as defined in RFC 1448 for: <CODE>authorizationError</CODE>.
  226. */
  227. final public static int snmpRspAuthorizationError = 16;
  228. /**
  229. * Error code as defined in RFC 1448 for: <CODE>notWritable</CODE>.
  230. */
  231. final public static int snmpRspNotWritable = 17;
  232. /**
  233. * Error code as defined in RFC 1448 for: <CODE>inconsistentName</CODE>.
  234. */
  235. final public static int snmpRspInconsistentName = 18;
  236. /**
  237. * Error that is returned by VACM.
  238. *
  239. * @since 1.5
  240. */
  241. final public static int noSuchView = 19;
  242. /**
  243. * Error that is returned by VACM.
  244. *
  245. * @since 1.5
  246. */
  247. final public static int noSuchContext = 20;
  248. /**
  249. * Error that is returned by VACM.
  250. *
  251. * @since 1.5
  252. */
  253. final public static int noGroupName = 21;
  254. /**
  255. * Error that is returned by VACM.
  256. *
  257. * @since 1.5
  258. */
  259. final public static int notInView = 22;
  260. // API error status enumeration.
  261. //------------------------------
  262. /**
  263. * Error code specific to the API.
  264. * <P>Used if the request PDU exceeds the <CODE>maxTries</CODE> limit
  265. * defined in the {@link com.sun.jmx.snmp.SnmpPeer SnmpPeer} object.
  266. */
  267. final public static int snmpReqTimeout = (0xE0) ;
  268. /**
  269. * Error code specific to the API.
  270. * <P>Used if the pending request PDU is cancelled.
  271. */
  272. final public static int snmpReqAborted = (0xE1) ;
  273. /**
  274. * Error code specific to the API.
  275. * <P>Used if the response to the request PDU fails at decoding time.
  276. */
  277. final public static int snmpRspDecodingError = (0xE2) ;
  278. /**
  279. * Error code specific to the API.
  280. * <P>Used if the request PDU does not retreive the community string at
  281. * authentication encoding time.
  282. */
  283. final public static int snmpReqEncodingError = (0xE3) ;
  284. /**
  285. * Error code specific to the API.
  286. * <P>Used if the request PDU does not fit in the <CODE>maxSnmpPktSize</CODE> limit
  287. * defined in the {@link com.sun.jmx.snmp.SnmpPeer SnmpPeer} object.
  288. */
  289. final public static int snmpReqPacketOverflow = (0xE4) ;
  290. /**
  291. * Error code specific to the API.
  292. * <P>Used for the last variable returned by a <CODE>Walk</CODE> request PDU.
  293. */
  294. final public static int snmpRspEndOfTable = (0xE5) ;
  295. /**
  296. * Error code specific to the API.
  297. * <P>Used if the request PDU is retried after a <CODE>noSuchName</CODE> error fixed.
  298. * This is an internal temporary status.
  299. */
  300. final public static int snmpReqRefireAfterVbFix = (0xE6) ;
  301. /**
  302. * Error code specific to the API.
  303. * <P>Used if the size of the request PDU <CODE>varBindList</CODE> exceeds
  304. * the <CODE>maxVarBindLimit</CODE> limit defined in the
  305. * {@link com.sun.jmx.snmp.SnmpPeer SnmpPeer} object.
  306. */
  307. final public static int snmpReqHandleTooBig = (0xE7) ;
  308. /**
  309. * Error code specific to the API.
  310. * <P>Used if the request PDU fails with a <CODE>tooBig</CODE> error status
  311. * but its <CODE>varBindList</CODE> contains just one element.
  312. */
  313. final public static int snmpReqTooBigImpossible = (0xE8) ;
  314. /**
  315. * Error code specific to the API.
  316. * <P>Used if an internal error occurs when processing the request PDU.
  317. */
  318. final public static int snmpReqInternalError = (0xF0) ;
  319. /**
  320. * Error code specific to the API.
  321. * <P>Used if an I/O error occurs when sending the request PDU.
  322. */
  323. final public static int snmpReqSocketIOError = (0xF1) ;
  324. /**
  325. * Error code specific to the API.
  326. * <P>Used if the request PDU fails at encoding time or sending time for a reason
  327. * not covered by the previous error codes.
  328. */
  329. final public static int snmpReqUnknownError = (0xF2) ;
  330. /**
  331. * Error code specific to the API.
  332. * <P>
  333. */
  334. final public static int snmpWrongSnmpVersion = (0xF3) ;
  335. /**
  336. * SNMP V3 Error code specific to the API.
  337. * <P>Used if the used principal is unknown.
  338. *
  339. * @since 1.5
  340. */
  341. final public static int snmpUnknownPrincipal = (0xF4);
  342. /**
  343. * SNMP V3 Error code specific to the API.
  344. * <P>Used if authentication is not supported for the current user.
  345. *
  346. * @since 1.5
  347. */
  348. final public static int snmpAuthNotSupported = (0xF5);
  349. /**
  350. * SNMP V3 Error code specific to the API.
  351. * <P>Used if privacy is not supported for the current user.
  352. *
  353. * @since 1.5
  354. */
  355. final public static int snmpPrivNotSupported = (0xF6);
  356. /**
  357. * SNMP V3 Error code specific to the API.
  358. * <P>Used if privacy is not supported for the current user.
  359. *
  360. * @since 1.5
  361. */
  362. final public static int snmpBadSecurityLevel = (0xF9);
  363. /**
  364. * SNMP Usm V3 Error code specific to the API.
  365. * <P>Used if the authoritative engine Id is not associated to the current user.
  366. *
  367. * @since 1.5
  368. */
  369. final public static int snmpUsmBadEngineId = (0xF7);
  370. /**
  371. * SNMP Usm V3 Error code specific to the API.
  372. * <P>Used if the timeliness params are invalid.
  373. *
  374. * @since 1.5
  375. */
  376. final public static int snmpUsmInvalidTimeliness = (0xF8);
  377. /**
  378. * Snmp V1 security model id (1).
  379. *
  380. * @since 1.5
  381. */
  382. final public static int snmpV1SecurityModel = 1;
  383. /**
  384. * Snmp V2 security model id (2).
  385. *
  386. * @since 1.5
  387. */
  388. final public static int snmpV2SecurityModel = 2;
  389. /**
  390. * Snmp V3 security model id (3).
  391. *
  392. * @since 1.5
  393. */
  394. final public static int snmpUsmSecurityModel = 3;
  395. /**
  396. * Snmp V1 msg processing model id (0).
  397. *
  398. * @since 1.5
  399. */
  400. final public static int snmpV1MsgProcessingModel = snmpVersionOne;
  401. /**
  402. * Snmp V2 msg processing model id (1).
  403. *
  404. * @since 1.5
  405. */
  406. final public static int snmpV2MsgProcessingModel = snmpVersionTwo;
  407. /**
  408. * Snmp V3 msg processing model id (3).
  409. *
  410. * @since 1.5
  411. */
  412. final public static int snmpV3MsgProcessingModel = snmpVersionThree;
  413. /**
  414. * Snmp V1 access control model id (0).
  415. *
  416. * @since 1.5
  417. */
  418. final public static int snmpV1AccessControlModel = snmpVersionOne;
  419. /**
  420. * Snmp V2 access control model id (1).
  421. *
  422. * @since 1.5
  423. */
  424. final public static int snmpV2AccessControlModel = snmpVersionTwo;
  425. /**
  426. * Snmp V3 access control model id (3).
  427. *
  428. * @since 1.5
  429. */
  430. final public static int snmpV3AccessControlModel = snmpVersionThree;
  431. }