1 /* 2 * Copyright (c) 2002, 2012, 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 26 package com.sun.jmx.snmp; 27 28 // java import 29 // 30 import java.net.InetAddress; 31 import java.util.Enumeration; 32 33 /** 34 * Defines the IP address based ACL used by the SNMP protocol adaptor. 35 * <p> 36 * <p><b>This API is a Sun Microsystems internal API and is subject 37 * to change without notice.</b></p> 38 * @since 1.5 39 */ 40 41 public interface InetAddressAcl { 42 43 /** 44 * Returns the name of the ACL. 45 * 46 * @return The name of the ACL. 47 */ 48 public String getName(); 49 50 /** 51 * Checks whether or not the specified host has <CODE>READ</CODE> access. 52 * 53 * @param address The host address to check. 54 * 55 * @return <CODE>true</CODE> if the host has read permission, <CODE>false</CODE> otherwise. 56 */ 57 public boolean checkReadPermission(InetAddress address); 58 59 /** 60 * Checks whether or not the specified host and community have <CODE>READ</CODE> access. 61 * 62 * @param address The host address to check. 63 * @param community The community associated with the host. 64 * 65 * @return <CODE>true</CODE> if the pair (host, community) has read permission, <CODE>false</CODE> otherwise. 66 */ 67 public boolean checkReadPermission(InetAddress address, String community); 68 69 /** 70 * Checks whether or not a community string is defined. 71 * 72 * @param community The community to check. 73 * 74 * @return <CODE>true</CODE> if the community is known, <CODE>false</CODE> otherwise. 75 */ 76 public boolean checkCommunity(String community); 77 78 /** 79 * Checks whether or not the specified host has <CODE>WRITE</CODE> access. 80 * 81 * @param address The host address to check. 82 * 83 * @return <CODE>true</CODE> if the host has write permission, <CODE>false</CODE> otherwise. 84 */ 85 public boolean checkWritePermission(InetAddress address); 86 87 /** 88 * Checks whether or not the specified host and community have <CODE>WRITE</CODE> access. 89 * 90 * @param address The host address to check. 91 * @param community The community associated with the host. 92 * 93 * @return <CODE>true</CODE> if the pair (host, community) has write permission, <CODE>false</CODE> otherwise. 94 */ 95 public boolean checkWritePermission(InetAddress address, String community); 96 97 /** 98 * Returns an enumeration of trap destinations. 99 * 100 * @return An enumeration of the trap destinations (enumeration of <CODE>InetAddress</CODE>). 101 */ 102 public Enumeration<InetAddress> getTrapDestinations(); 103 104 /** 105 * Returns an enumeration of trap communities for a given host. 106 * 107 * @param address The address of the host. 108 * 109 * @return An enumeration of trap communities for a given host (enumeration of <CODE>String</CODE>). 110 */ 111 public Enumeration<String> getTrapCommunities(InetAddress address); 112 113 /** 114 * Returns an enumeration of inform destinations. 115 * 116 * @return An enumeration of the inform destinations (enumeration of <CODE>InetAddress</CODE>). 117 */ 118 public Enumeration<InetAddress> getInformDestinations(); 119 120 /** 121 * Returns an enumeration of inform communities for a given host. 122 * 123 * @param address The address of the host. 124 * 125 * @return An enumeration of inform communities for a given host (enumeration of <CODE>String</CODE>). 126 */ 127 public Enumeration<String> getInformCommunities(InetAddress address); 128 }