1. /*
  2. * @(#)file SnmpAccessControlModel.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.internal;
  12. import com.sun.jmx.snmp.SnmpStatusException;
  13. import com.sun.jmx.snmp.SnmpOid;
  14. import com.sun.jmx.snmp.SnmpPdu;
  15. /**
  16. * Access Control Model interface. Every access control model must implement this interface in order to be integrated in the engine based framework.
  17. * <p><b>This API is a Sun Microsystems internal API and is subject
  18. * to change without notice.</b></p>
  19. * @since 1.5
  20. */
  21. public interface SnmpAccessControlModel extends SnmpModel {
  22. /**
  23. * Method called by the dispatcher in order to control the access at an <CODE>SnmpOid</CODE> Level. If access is not allowed, an <CODE>SnmpStatusException</CODE> is thrown.
  24. * This method is called after the <CODE>checkPduAccess</CODE> pdu based method.
  25. * @param version The SNMP protocol version number.
  26. * @param principal The request principal.
  27. * @param securityLevel The request security level as defined in <CODE>SnmpEngine</CODE>.
  28. * @param pduType The pdu type (get, set, ...).
  29. * @param securityModel The security model ID.
  30. * @param contextName The access control context name.
  31. * @param oid The OID to check.
  32. */
  33. public void checkAccess(int version,
  34. String principal,
  35. int securityLevel,
  36. int pduType,
  37. int securityModel,
  38. byte[] contextName,
  39. SnmpOid oid)
  40. throws SnmpStatusException;
  41. /**
  42. * Method called by the dispatcher in order to control the access at an SNMP pdu Level. If access is not allowed, an <CODE>SnmpStatusException</CODE> is thrown. In case of exception, the access control is aborted. OIDs are not checked.
  43. * This method should be called prior to the <CODE>checkAccess</CODE> OID based method.
  44. * @param version The SNMP protocol version number.
  45. * @param principal The request principal.
  46. * @param securityLevel The request security level as defined in <CODE>SnmpEngine</CODE>.
  47. * @param pduType The pdu type (get, set, ...).
  48. * @param securityModel The security model ID.
  49. * @param contextName The access control context name.
  50. * @param pdu The pdu to check.
  51. */
  52. public void checkPduAccess(int version,
  53. String principal,
  54. int securityLevel,
  55. int pduType,
  56. int securityModel,
  57. byte[] contextName,
  58. SnmpPdu pdu)
  59. throws SnmpStatusException;
  60. /**
  61. * Enable SNMP V1 and V2 set requests. Be aware that can lead to a security hole in a context of SNMP V3 management. By default SNMP V1 and V2 set requests are not authorized.
  62. * @return boolean True the activation suceeded.
  63. */
  64. public boolean enableSnmpV1V2SetRequest();
  65. /**
  66. * Disable SNMP V1 and V2 set requests. By default SNMP V1 and V2 set requests are not authorized.
  67. * @return boolean True the deactivation suceeded.
  68. */
  69. public boolean disableSnmpV1V2SetRequest();
  70. /**
  71. * The SNMP V1 and V2 set requests authorization status. By default SNMP V1 and V2 set requests are not authorized.
  72. * @return boolean True SNMP V1 and V2 requests are authorized.
  73. */
  74. public boolean isSnmpV1V2SetRequestAuthorized();
  75. }