1. /*
  2. * @(#)file SnmpParams.java
  3. * @(#)author Sun Microsystems, Inc.
  4. * @(#)version 1.14
  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. package com.sun.jmx.snmp;
  12. import com.sun.jmx.snmp.SnmpDefinitions;
  13. /**
  14. * This class is the base class of all parameters that are used when making SNMP requests to an <CODE>SnmpPeer</CODE>.
  15. * <p><b>This API is a Sun Microsystems internal API and is subject
  16. * to change without notice.</b></p>
  17. * @since 1.5
  18. */
  19. public abstract class SnmpParams implements SnmpDefinitions {
  20. private int protocolVersion = snmpVersionOne;
  21. SnmpParams(int version) {
  22. protocolVersion = version;
  23. }
  24. SnmpParams() {}
  25. /**
  26. * Checks whether parameters are in place for an SNMP <CODE>set</CODE> operation.
  27. * @return <CODE>true</CODE> if parameters are in place, <CODE>false</CODE> otherwise.
  28. */
  29. public abstract boolean allowSnmpSets();
  30. /**
  31. * Returns the version of the protocol to use.
  32. * The returned value is:
  33. * <UL>
  34. * <LI>{@link com.sun.jmx.snmp.SnmpDefinitions#snmpVersionOne snmpVersionOne} if the protocol is SNMPv1
  35. * <LI>{@link com.sun.jmx.snmp.SnmpDefinitions#snmpVersionTwo snmpVersionTwo} if the protocol is SNMPv2
  36. * <LI>{@link com.sun.jmx.snmp.SnmpDefinitions#snmpVersionThree snmpVersionThree} if the protocol is SNMPv3
  37. * </UL>
  38. * @return The version of the protocol to use.
  39. */
  40. public int getProtocolVersion() {
  41. return protocolVersion ;
  42. }
  43. /**
  44. * Sets the version of the protocol to be used.
  45. * The version should be identified using the definitions
  46. * contained in
  47. * {@link com.sun.jmx.snmp.SnmpDefinitions SnmpDefinitions}.
  48. * <BR>For instance if you wish to use SNMPv2, you can call the method as follows:
  49. * <BLOCKQUOTE><PRE>
  50. * setProtocolVersion(SnmpDefinitions.snmpVersionTwo);
  51. * </PRE></BLOCKQUOTE>
  52. * @param protocolversion The version of the protocol to be used.
  53. */
  54. public void setProtocolVersion(int protocolversion) {
  55. this.protocolVersion = protocolversion ;
  56. }
  57. }