1 /*
   2  * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 package com.sun.jmx.snmp.internal;
  26 
  27 import com.sun.jmx.snmp.SnmpStatusException;
  28 import com.sun.jmx.snmp.SnmpOid;
  29 import com.sun.jmx.snmp.SnmpPdu;
  30 import com.sun.jmx.snmp.SnmpUnknownAccContrModelException;
  31 /**
  32  * Access Control sub system interface. To allow engine integration, an Access Control sub system must implement this interface.
  33  * <p><b>This API is a Sun Microsystems internal API  and is subject
  34  * to change without notice.</b></p>
  35  * @since 1.5
  36  */
  37 public interface SnmpAccessControlSubSystem extends SnmpSubSystem {
  38 
  39     /**
  40      * Method called by the dispatcher in order to control the access at an SNMP pdu Level.
  41      * <P> This call is routed by the sub system to the target model according to the SNMP protocol version number.</P>
  42      * @param version The SNMP protocol version number.
  43      * @param principal The request principal.
  44      * @param securityLevel The request security level as defined in <CODE>SnmpEngine</CODE>.
  45      * @param pduType The pdu type (get, set, ...).
  46      * @param securityModel The security model ID.
  47      * @param contextName The access control context name.
  48      * @param pdu The pdu to check.
  49      */
  50     public void checkPduAccess(int version,
  51                                String principal,
  52                                int securityLevel,
  53                                int pduType,
  54                                int securityModel,
  55                                byte[] contextName,
  56                                SnmpPdu pdu) throws SnmpStatusException, SnmpUnknownAccContrModelException;
  57     /**
  58      * Method called by the dispatcher in order to control the access at an <CODE>SnmpOid</CODE> Level.
  59      * This method is called after the <CODE>checkPduAccess</CODE> pdu based method.
  60      * <P> This call is routed by the sub system to the target model according to the SNMP protocol version number.</P>
  61      * @param version The SNMP protocol version number.
  62      * @param principal The request principal.
  63      * @param securityLevel The request security level as defined in <CODE>SnmpEngine</CODE>.
  64      * @param pduType The pdu type (get, set, ...).
  65      * @param securityModel The security model ID.
  66      * @param contextName The access control context name.
  67      * @param oid The OID to check.
  68      */
  69     public void checkAccess(int version,
  70                             String principal,
  71                             int securityLevel,
  72                             int pduType,
  73                             int securityModel,
  74                             byte[] contextName,
  75                             SnmpOid oid) throws SnmpStatusException, SnmpUnknownAccContrModelException;
  76 }