diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/BerDecoder.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/BerDecoder.java
deleted file mode 100644
index 40b4c603e82..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/BerDecoder.java
+++ /dev/null
@@ -1,757 +0,0 @@
-/*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package com.sun.jmx.snmp;
-
-
-
-
-/**
- * The BerDecoder class is used for decoding
- * BER-encoded data.
- *
- * A BerDecoder needs to be set up with the byte string containing
- * the encoding. It maintains a current position in the byte string.
- *
- * Methods allows to fetch integer, string, OID, etc., from the current
- * position. After a fetch the current position is moved forward.
- *
- * A fetch throws a BerException if the encoding is not of the
- * expected type.
- *
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- *
- * @since 1.5
- */
-
-public class BerDecoder {
-
- /**
- * Constructs a new decoder and attaches it to the specified byte string.
- *
- * @param b The byte string containing the encoded data.
- */
-
- public BerDecoder(byte b[]) {
- bytes = b ;
- reset() ;
- }
-
- public void reset() {
- next = 0 ;
- stackTop = 0 ;
- }
-
- /**
- * Fetch an integer.
- *
- * @return The decoded integer.
- *
- * @exception BerException Current position does not point to an integer.
- */
-
- public int fetchInteger() throws BerException {
- return fetchInteger(IntegerTag) ;
- }
-
-
- /**
- * Fetch an integer with the specified tag.
- *
- * @param tag The expected tag.
- *
- * @return The decoded integer.
- *
- * @exception BerException Current position does not point to an integer
- * or the tag is not the expected one.
- */
-
- public int fetchInteger(int tag) throws BerException {
- int result = 0 ;
- final int backup = next ;
- try {
- if (fetchTag() != tag) {
- throw new BerException() ;
- }
- result = fetchIntegerValue() ;
- }
- catch(BerException e) {
- next = backup ;
- throw e ;
- }
-
- return result ;
- }
-
-
-
- /**
- * Fetch an integer and return a long value.
- *
- * @return The decoded integer.
- *
- * @exception BerException Current position does not point to an integer.
- */
-
- public long fetchIntegerAsLong() throws BerException {
- return fetchIntegerAsLong(IntegerTag) ;
- }
-
-
- /**
- * Fetch an integer with the specified tag and return a long value.
- *
- * @param tag The expected tag.
- *
- * @return The decoded integer.
- *
- * @exception BerException Current position does not point to an integer
- * or the tag is not the expected one.
- */
-
- public long fetchIntegerAsLong(int tag) throws BerException {
- long result = 0 ;
- final int backup = next ;
- try {
- if (fetchTag() != tag) {
- throw new BerException() ;
- }
- result = fetchIntegerValueAsLong() ;
- }
- catch(BerException e) {
- next = backup ;
- throw e ;
- }
-
- return result ;
- }
-
-
-
- /**
- * Fetch an octet string.
- *
- * @return The decoded string.
- *
- * @exception BerException Current position does not point to an octet string.
- */
-
- public byte[] fetchOctetString() throws BerException {
- return fetchOctetString(OctetStringTag) ;
- }
-
-
- /**
- * Fetch an octet string with a specified tag.
- *
- * @param tag The expected tag.
- *
- * @return The decoded string.
- *
- * @exception BerException Current position does not point to an octet string
- * or the tag is not the expected one.
- */
-
- public byte[] fetchOctetString(int tag) throws BerException {
- byte[] result = null ;
- final int backup = next ;
- try {
- if (fetchTag() != tag) {
- throw new BerException() ;
- }
- result = fetchStringValue() ;
- }
- catch(BerException e) {
- next = backup ;
- throw e ;
- }
-
- return result ;
- }
-
-
- /**
- * Fetch an object identifier.
- *
- * @return The decoded object identifier as an array of long.
- */
-
- public long[] fetchOid() throws BerException {
- return fetchOid(OidTag) ;
- }
-
-
- /**
- * Fetch an object identifier with a specified tag.
- *
- * @param tag The expected tag.
- *
- * @return The decoded object identifier as an array of long.
- *
- * @exception BerException Current position does not point to an oid
- * or the tag is not the expected one.
- */
-
- public long[] fetchOid(int tag) throws BerException {
- long[] result = null ;
- final int backup = next ;
- try {
- if (fetchTag() != tag) {
- throw new BerException() ;
- }
- result = fetchOidValue() ;
- }
- catch(BerException e) {
- next = backup ;
- throw e ;
- }
-
- return result ;
- }
-
-
- /**
- * Fetch a NULL value.
- *
- * @exception BerException Current position does not point to NULL value.
- */
-
- public void fetchNull() throws BerException {
- fetchNull(NullTag) ;
- }
-
-
- /**
- * Fetch a NULL value with a specified tag.
- *
- * @param tag The expected tag.
- *
- * @exception BerException Current position does not point to
- * NULL value or the tag is not the expected one.
- */
-
- public void fetchNull(int tag) throws BerException {
- final int backup = next ;
- try {
- if (fetchTag() != tag) {
- throw new BerException() ;
- }
- final int length = fetchLength();
- if (length != 0) throw new BerException();
- }
- catch(BerException e) {
- next = backup ;
- throw e ;
- }
- }
-
-
-
- /**
- * Fetch an ANY value. In fact, this method does not decode anything
- * it simply returns the next TLV as an array of bytes.
- *
- * @return The TLV as a byte array.
- *
- * @exception BerException The next TLV is really badly encoded...
- */
-
- public byte[] fetchAny() throws BerException {
- byte[] result = null ;
- final int backup = next ;
- try {
- final int tag = fetchTag() ;
- final int contentLength = fetchLength() ;
- if (contentLength < 0) throw new BerException() ;
- final int tlvLength = next + contentLength - backup ;
- if (contentLength > (bytes.length - next))
- throw new IndexOutOfBoundsException("Decoded length exceeds buffer");
- final byte[] data = new byte[tlvLength] ;
- java.lang.System.arraycopy(bytes,backup,data,0,tlvLength);
- // for (int i = 0 ; i < tlvLength ; i++) {
- // data[i] = bytes[backup + i] ;
- // }
- next = next + contentLength ;
- result = data;
- }
- catch(IndexOutOfBoundsException e) {
- next = backup ;
- throw new BerException() ;
- }
- // catch(Error e) {
- // debug("fetchAny: Error decoding BER: " + e);
- // throw e;
- // }
-
- return result ;
- }
-
-
- /**
- * Fetch an ANY value with a specific tag.
- *
- * @param tag The expected tag.
- *
- * @return The TLV as a byte array.
- *
- * @exception BerException The next TLV is really badly encoded...
- */
-
- public byte[] fetchAny(int tag) throws BerException {
- if (getTag() != tag) {
- throw new BerException() ;
- }
- return fetchAny() ;
- }
-
-
-
- /**
- * Fetch a sequence header.
- * The decoder computes the end position of the sequence and push it
- * on its stack.
- *
- * @exception BerException Current position does not point to a sequence header.
- */
-
- public void openSequence() throws BerException {
- openSequence(SequenceTag) ;
- }
-
-
- /**
- * Fetch a sequence header with a specific tag.
- *
- * @param tag The expected tag.
- *
- * @exception BerException Current position does not point to a sequence header
- * or the tag is not the expected one.
- */
-
- public void openSequence(int tag) throws BerException {
- final int backup = next ;
- try {
- if (fetchTag() != tag) {
- throw new BerException() ;
- }
- final int l = fetchLength() ;
- if (l < 0) throw new BerException();
- if (l > (bytes.length - next)) throw new BerException();
- stackBuf[stackTop++] = next + l ;
- }
- catch(BerException e) {
- next = backup ;
- throw e ;
- }
- }
-
-
- /**
- * Close a sequence.
- * The decode pull the stack and verifies that the current position
- * matches with the calculated end of the sequence. If not it throws
- * an exception.
- *
- * @exception BerException The sequence is not expected to finish here.
- */
-
- public void closeSequence() throws BerException {
- if (stackBuf[stackTop - 1] == next) {
- stackTop-- ;
- }
- else {
- throw new BerException() ;
- }
- }
-
-
- /**
- * Return true if the end of the current sequence is not reached.
- * When this method returns false, closeSequence can (and must) be
- * invoked.
- *
- * @return true if there is still some data in the sequence.
- */
-
- public boolean cannotCloseSequence() {
- return (next < stackBuf[stackTop - 1]) ;
- }
-
-
- /**
- * Get the tag of the data at the current position.
- * Current position is unchanged.
- *
- * @return The next tag.
- */
-
- public int getTag() throws BerException {
- int result = 0 ;
- final int backup = next ;
- try {
- result = fetchTag() ;
- }
- finally {
- next = backup ;
- }
-
- return result ;
- }
-
-
-
- public String toString() {
- final StringBuffer result = new StringBuffer(bytes.length * 2) ;
- for (int i = 0 ; i < bytes.length ; i++) {
- final int b = (bytes[i] > 0) ? bytes[i] : bytes[i] + 256 ;
- if (i == next) {
- result.append("(") ;
- }
- result.append(Character.forDigit(b / 16, 16)) ;
- result.append(Character.forDigit(b % 16, 16)) ;
- if (i == next) {
- result.append(")") ;
- }
- }
- if (bytes.length == next) {
- result.append("()") ;
- }
-
- return new String(result) ;
- }
-
-
- //
- // Some standard tags
- //
- public final static int BooleanTag = 1 ;
- public final static int IntegerTag = 2 ;
- public final static int OctetStringTag = 4 ;
- public final static int NullTag = 5 ;
- public final static int OidTag = 6 ;
- public final static int SequenceTag = 0x30 ;
-
-
-
-
- ////////////////////////// PRIVATE ///////////////////////////////
-
-
-
- /**
- * Fetch a tag and move the current position forward.
- *
- * @return The tag
- */
-
- private final int fetchTag() throws BerException {
- int result = 0 ;
- final int backup = next ;
-
- try {
- final byte b0 = bytes[next++] ;
- result = (b0 >= 0) ? b0 : b0 + 256 ;
- if ((result & 31) == 31) {
- while ((bytes[next] & 128) != 0) {
- result = result << 7 ;
- result = result | (bytes[next++] & 127);
- }
- }
- }
- catch(IndexOutOfBoundsException e) {
- next = backup ;
- throw new BerException() ;
- }
-
- return result ;
- }
-
-
- /**
- * Fetch a length and move the current position forward.
- *
- * @return The length
- */
-
- private final int fetchLength() throws BerException {
- int result = 0 ;
- final int backup = next ;
-
- try {
- final byte b0 = bytes[next++] ;
- if (b0 >= 0) {
- result = b0 ;
- }
- else {
- for (int c = 128 + b0 ; c > 0 ; c--) {
- final byte bX = bytes[next++] ;
- result = result << 8 ;
- result = result | ((bX >= 0) ? bX : bX+256) ;
- }
- }
- }
- catch(IndexOutOfBoundsException e) {
- next = backup ;
- throw new BerException() ;
- }
-
- return result ;
- }
-
-
- /**
- * Fetch an integer value and move the current position forward.
- *
- * @return The integer
- */
-
- private int fetchIntegerValue() throws BerException {
- int result = 0 ;
- final int backup = next ;
-
- try {
- final int length = fetchLength() ;
- if (length <= 0) throw new BerException() ;
- if (length > (bytes.length - next)) throw
- new IndexOutOfBoundsException("Decoded length exceeds buffer");
- final int end = next + length ;
- result = bytes[next++] ;
- while (next < end) {
- final byte b = bytes[next++] ;
- if (b < 0) {
- result = (result << 8) | (256 + b) ;
- }
- else {
- result = (result << 8) | b ;
- }
- }
- }
- catch(BerException e) {
- next = backup ;
- throw e ;
- }
- catch(IndexOutOfBoundsException e) {
- next = backup ;
- throw new BerException() ;
- }
- catch(ArithmeticException e) {
- next = backup ;
- throw new BerException() ;
- }
- return result ;
- }
-
-
- /**
- * Fetch an integer value and return a long value.
- * FIX ME: someday we could have only on fetchIntegerValue() which always
- * returns a long value.
- *
- * @return The integer
- */
-
- private final long fetchIntegerValueAsLong() throws BerException {
- long result = 0 ;
- final int backup = next ;
-
- try {
- final int length = fetchLength() ;
- if (length <= 0) throw new BerException() ;
- if (length > (bytes.length - next)) throw
- new IndexOutOfBoundsException("Decoded length exceeds buffer");
-
- final int end = next + length ;
- result = bytes[next++] ;
- while (next < end) {
- final byte b = bytes[next++] ;
- if (b < 0) {
- result = (result << 8) | (256 + b) ;
- }
- else {
- result = (result << 8) | b ;
- }
- }
- }
- catch(BerException e) {
- next = backup ;
- throw e ;
- }
- catch(IndexOutOfBoundsException e) {
- next = backup ;
- throw new BerException() ;
- }
- catch(ArithmeticException e) {
- next = backup ;
- throw new BerException() ;
- }
- return result ;
- }
-
-
- /**
- * Fetch a byte string and move the current position forward.
- *
- * @return The byte string
- */
-
- private byte[] fetchStringValue() throws BerException {
- byte[] result = null ;
- final int backup = next ;
-
- try {
- final int length = fetchLength() ;
- if (length < 0) throw new BerException() ;
- if (length > (bytes.length - next))
- throw new IndexOutOfBoundsException("Decoded length exceeds buffer");
- final byte data[] = new byte[length] ;
- java.lang.System.arraycopy(bytes,next,data,0,length);
- next += length;
- // int i = 0 ;
- // while (i < length) {
- // result[i++] = bytes[next++] ;
- // }
- result = data;
- }
- catch(BerException e) {
- next = backup ;
- throw e ;
- }
- catch(IndexOutOfBoundsException e) {
- next = backup ;
- throw new BerException() ;
- }
- catch(ArithmeticException e) {
- next = backup ;
- throw new BerException() ;
- }
- // catch(Error e) {
- // debug("fetchStringValue: Error decoding BER: " + e);
- // throw e;
- // }
-
- return result ;
- }
-
-
-
- /**
- * Fetch an oid and move the current position forward.
- *
- * @return The oid
- */
-
- private final long[] fetchOidValue() throws BerException {
- long[] result = null ;
- final int backup = next ;
-
- try {
- final int length = fetchLength() ;
- if (length <= 0) throw new BerException() ;
- if (length > (bytes.length - next))
- throw new IndexOutOfBoundsException("Decoded length exceeds buffer");
- // Count how many bytes have their 8th bit to 0
- // -> this gives the number of components in the oid
- int subidCount = 2 ;
- for (int i = 1 ; i < length ; i++) {
- if ((bytes[next + i] & 0x80) == 0) {
- subidCount++ ;
- }
- }
- final int datalen = subidCount;
- final long[] data = new long[datalen];
- final byte b0 = bytes[next++] ;
-
- // bugId 4641746
- // The 8th bit of the first byte should always be set to 0
- if (b0 < 0) throw new BerException();
-
- // bugId 4641746
- // The first sub Id cannot be greater than 2
- final long lb0 = b0 / 40 ;
- if (lb0 > 2) throw new BerException();
-
- final long lb1 = b0 % 40;
- data[0] = lb0 ;
- data[1] = lb1 ;
- int i = 2 ;
- while (i < datalen) {
- long subid = 0 ;
- byte b = bytes[next++] ;
- while ((b & 0x80) != 0) {
- subid = (subid << 7) | (b & 0x7f) ;
- // bugId 4654674
- if (subid < 0) throw new BerException();
- b = bytes[next++] ;
- }
- subid = (subid << 7) | b ;
- // bugId 4654674
- if (subid < 0) throw new BerException();
- data[i++] = subid ;
- }
- result = data;
- }
- catch(BerException e) {
- next = backup ;
- throw e ;
- }
- catch(IndexOutOfBoundsException e) {
- next = backup ;
- throw new BerException() ;
- }
- // catch(Error e) {
- // debug("fetchOidValue: Error decoding BER: " + e);
- // throw e;
- // }
-
- return result ;
- }
-
- // private static final void debug(String str) {
- // System.out.println(str);
- // }
-
- //
- // This is the byte array containing the encoding.
- //
- private final byte bytes[];
-
- //
- // This is the current location. It is the next byte
- // to be decoded. It's an index in bytes[].
- //
- private int next = 0 ;
-
- //
- // This is the stack where end of sequences are kept.
- // A value is computed and pushed in it each time openSequence()
- // is invoked.
- // A value is pulled and checked each time closeSequence() is called.
- //
- private final int stackBuf[] = new int[200] ;
- private int stackTop = 0 ;
-
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/BerEncoder.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/BerEncoder.java
deleted file mode 100644
index 0866f15a5f6..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/BerEncoder.java
+++ /dev/null
@@ -1,477 +0,0 @@
-/*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package com.sun.jmx.snmp;
-
-
-/**
- * The BerEncoder class is used for encoding data using BER.
- *
- * A BerEncoder needs to be set up with a byte buffer. The encoded
- * data are stored in this byte buffer.
- *
- * NOTE : the buffer is filled from end to start. This means the caller
- * needs to encode its data in the reverse order.
- *
- *
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- *
- * @since 1.5
- */
-
-public class BerEncoder {
-
- /**
- * Constructs a new encoder and attaches it to the specified byte string.
- *
- * @param b The byte string containing the encoded data.
- */
-
- public BerEncoder(byte b[]) {
- bytes = b ;
- start = b.length ;
- stackTop = 0 ;
- }
-
-
- /**
- * Trim the encoding data and returns the length of the encoding.
- *
- * The encoder does backward encoding : so the bytes buffer is
- * filled from end to start. The encoded data must be shift before
- * the buffer can be used. This is the purpose of the trim method.
- *
- * After a call to the trim method, the encoder is reinitialized and putXXX
- * overwrite any existing encoded data.
- *
- * @return The length of the encoded data.
- */
-
- public int trim() {
- final int result = bytes.length - start ;
-
- // for (int i = start ; i < bytes.length ; i++) {
- // bytes[i-start] = bytes[i] ;
- // }
- if (result > 0)
- java.lang.System.arraycopy(bytes,start,bytes,0,result);
-
- start = bytes.length ;
- stackTop = 0 ;
-
- return result ;
- }
-
- /**
- * Put an integer.
- *
- * @param v The integer to encode.
- */
-
- public void putInteger(int v) {
- putInteger(v, IntegerTag) ;
- }
-
-
- /**
- * Put an integer with the specified tag.
- *
- * @param v The integer to encode.
- * @param tag The tag to encode.
- */
-
- public void putInteger(int v, int tag) {
- putIntegerValue(v) ;
- putTag(tag) ;
- }
-
-
-
- /**
- * Put an integer expressed as a long.
- *
- * @param v The long to encode.
- */
-
- public void putInteger(long v) {
- putInteger(v, IntegerTag) ;
- }
-
-
- /**
- * Put an integer expressed as a long with the specified tag.
- *
- * @param v The long to encode
- * @param tag The tag to encode.
- */
-
- public void putInteger(long v, int tag) {
- putIntegerValue(v) ;
- putTag(tag) ;
- }
-
-
-
- /**
- * Put an octet string.
- *
- * @param s The bytes to encode
- */
-
- public void putOctetString(byte[] s) {
- putOctetString(s, OctetStringTag) ;
- }
-
-
- /**
- * Put an octet string with a specified tag.
- *
- * @param s The bytes to encode
- * @param tag The tag to encode.
- */
-
- public void putOctetString(byte[] s, int tag) {
- putStringValue(s) ;
- putTag(tag) ;
- }
-
-
- /**
- * Put an object identifier.
- *
- * @param s The oid to encode.
- */
-
- public void putOid(long[] s) {
- putOid(s, OidTag) ;
- }
-
-
- /**
- * Put an object identifier with a specified tag.
- *
- * @param s The integer to encode.
- * @param tag The tag to encode.
- */
-
- public void putOid(long[] s, int tag) {
- putOidValue(s) ;
- putTag(tag) ;
- }
-
-
- /**
- * Put a NULL value.
- */
-
- public void putNull() {
- putNull(NullTag) ;
- }
-
-
- /**
- * Put a NULL value with a specified tag.
- *
- * @param tag The tag to encode.
- */
-
- public void putNull(int tag) {
- putLength(0) ;
- putTag(tag) ;
- }
-
-
-
- /**
- * Put an ANY value. In fact, this method does not encode anything.
- * It simply copies the specified bytes into the encoding.
- *
- * @param s The encoding of the ANY value.
- */
-
- public void putAny(byte[] s) {
- putAny(s, s.length) ;
- }
-
-
- /**
- * Put an ANY value. Only the first byteCount are considered.
- *
- * @param s The encoding of the ANY value.
- * @param byteCount The number of bytes of the encoding.
- */
-
- public void putAny(byte[] s, int byteCount) {
- java.lang.System.arraycopy(s,0,bytes,start-byteCount,byteCount);
- start -= byteCount;
- // for (int i = byteCount - 1 ; i >= 0 ; i--) {
- // bytes[--start] = s[i] ;
- // }
- }
-
-
- /**
- * Open a sequence.
- * The encoder push the current position on its stack.
- */
-
- public void openSequence() {
- stackBuf[stackTop++] = start ;
- }
-
-
- /**
- * Close a sequence.
- * The decode pull the stack to know the end of the current sequence.
- */
-
- public void closeSequence() {
- closeSequence(SequenceTag) ;
- }
-
-
- /**
- * Close a sequence with the specified tag.
- */
-
- public void closeSequence(int tag) {
- final int end = stackBuf[--stackTop] ;
- putLength(end - start) ;
- putTag(tag) ;
- }
-
-
- //
- // Some standard tags
- //
- public final static int BooleanTag = 1 ;
- public final static int IntegerTag = 2 ;
- public final static int OctetStringTag = 4 ;
- public final static int NullTag = 5 ;
- public final static int OidTag = 6 ;
- public final static int SequenceTag = 0x30 ;
-
-
-
-
- ////////////////////////// PROTECTED ///////////////////////////////
-
-
-
- /**
- * Put a tag and move the current position backward.
- *
- * @param tag The tag to encode.
- */
-
- protected final void putTag(int tag) {
- if (tag < 256) {
- bytes[--start] = (byte)tag ;
- }
- else {
- while (tag != 0) {
- bytes[--start] = (byte)(tag & 127) ;
- tag = tag << 7 ;
- }
- }
- }
-
-
- /**
- * Put a length and move the current position backward.
- *
- * @param length The length to encode.
- */
-
- protected final void putLength(final int length) {
- if (length < 0) {
- throw new IllegalArgumentException() ;
- }
- else if (length < 128) {
- bytes[--start] = (byte)length ;
- }
- else if (length < 256) {
- bytes[--start] = (byte)length ;
- bytes[--start] = (byte)0x81 ;
- }
- else if (length < 65536) {
- bytes[--start] = (byte)(length) ;
- bytes[--start] = (byte)(length >> 8) ;
- bytes[--start] = (byte)0x82 ;
- }
- else if (length < 16777126) {
- bytes[--start] = (byte)(length) ;
- bytes[--start] = (byte)(length >> 8) ;
- bytes[--start] = (byte)(length >> 16) ;
- bytes[--start] = (byte)0x83 ;
- }
- else {
- bytes[--start] = (byte)(length) ;
- bytes[--start] = (byte)(length >> 8) ;
- bytes[--start] = (byte)(length >> 16) ;
- bytes[--start] = (byte)(length >> 24) ;
- bytes[--start] = (byte)0x84 ;
- }
- }
-
-
- /**
- * Put an integer value and move the current position backward.
- *
- * @param v The integer to encode.
- */
-
- protected final void putIntegerValue(int v) {
- final int end = start ;
- int mask = 0x7f800000 ;
- int byteNeeded = 4 ;
- if (v < 0) {
- while (((mask & v) == mask) && (byteNeeded > 1)) {
- mask = mask >> 8 ;
- byteNeeded-- ;
- }
- }
- else {
- while (((mask & v) == 0) && (byteNeeded > 1)) {
- mask = mask >> 8 ;
- byteNeeded-- ;
- }
- }
- for (int i = 0 ; i < byteNeeded ; i++) {
- bytes[--start] = (byte)v ;
- v = v >> 8 ;
- }
- putLength(end - start) ;
- }
-
-
- /**
- * Put an integer value expressed as a long.
- *
- * @param v The integer to encode.
- */
-
- protected final void putIntegerValue(long v) {
- final int end = start ;
- long mask = 0x7f80000000000000L ;
- int byteNeeded = 8 ;
- if (v < 0) {
- while (((mask & v) == mask) && (byteNeeded > 1)) {
- mask = mask >> 8 ;
- byteNeeded-- ;
- }
- }
- else {
- while (((mask & v) == 0) && (byteNeeded > 1)) {
- mask = mask >> 8 ;
- byteNeeded-- ;
- }
- }
- for (int i = 0 ; i < byteNeeded ; i++) {
- bytes[--start] = (byte)v ;
- v = v >> 8 ;
- }
- putLength(end - start) ;
- }
-
-
- /**
- * Put a byte string and move the current position backward.
- *
- * @param s The byte string to encode.
- */
-
- protected final void putStringValue(byte[] s) {
- final int datalen = s.length;
- java.lang.System.arraycopy(s,0,bytes,start-datalen,datalen);
- start -= datalen;
- // for (int i = s.length - 1 ; i >= 0 ; i--) {
- // bytes[--start] = s[i] ;
- // }
- putLength(datalen) ;
- }
-
-
-
- /**
- * Put an oid and move the current position backward.
- *
- * @param s The oid to encode.
- */
-
- protected final void putOidValue(final long[] s) {
- final int end = start ;
- final int slength = s.length;
-
- // bugId 4641746: 0, 1, and 2 are legal values.
- if ((slength < 2) || (s[0] > 2) || (s[1] >= 40)) {
- throw new IllegalArgumentException() ;
- }
- for (int i = slength - 1 ; i >= 2 ; i--) {
- long c = s[i] ;
- if (c < 0) {
- throw new IllegalArgumentException() ;
- }
- else if (c < 128) {
- bytes[--start] = (byte)c ;
- }
- else {
- bytes[--start] = (byte)(c & 127) ;
- c = c >> 7 ;
- while (c != 0) {
- bytes[--start] = (byte)(c | 128) ;
- c = c >> 7 ;
- }
- }
- }
- bytes[--start] = (byte)(s[0] * 40 + s[1]) ;
- putLength(end - start) ;
- }
-
-
- //
- // This is the byte array containing the encoding.
- //
- protected final byte bytes[];
-
- //
- // This is the index of the first byte of the encoding.
- // It is initialized to bytes.length and decrease each time
- // an value is put in the encoder.
- //
- protected int start = -1 ;
-
- //
- // This is the stack where end of sequences are kept.
- // A value is computed and pushed in it each time the openSequence method
- // is invoked.
- // A value is pulled and checked each time the closeSequence method is called.
- //
- protected final int stackBuf[] = new int[200] ;
- protected int stackTop = 0 ;
-
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/BerException.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/BerException.java
deleted file mode 100644
index 8560f383c6b..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/BerException.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package com.sun.jmx.snmp;
-
-
-
-
-
-/**
- * Exception thrown when a BER encoding/decoding error occurs.
- *
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- *
- * @since 1.5
- */
-
-public class BerException extends Exception {
- private static final long serialVersionUID = 494709767137042951L;
-
- public static final int BAD_VERSION=1;
-
- private int errorType= 0;
-
- public BerException() {
- errorType= 0;
- }
-
- public BerException(int x) {
- errorType= x;
- }
-
- public boolean isInvalidSnmpVersion() {
- if (errorType == BAD_VERSION)
- return true;
- else
- return false;
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/EnumRowStatus.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/EnumRowStatus.java
deleted file mode 100644
index 303b8235272..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/EnumRowStatus.java
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.jmx.snmp;
-
-import java.io.Serializable;
-import java.util.Hashtable;
-
-
-/**
- * This class is an internal class which is used to represent RowStatus
- * codes as defined in RFC 2579.
- *
- * It defines an additional code, unspecified, which is
- * implementation specific, and is used to identify
- * unspecified actions (when for instance the RowStatus variable
- * is not present in the varbind list) or uninitialized values.
- *
- * mibgen does not generate objects of this class but any variable
- * using the RowStatus textual convention can be converted into an
- * object of this class thanks to the
- * EnumRowStatus(Enumerated valueIndex) constructor.
- *
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- **/
-
-public class EnumRowStatus extends Enumerated implements Serializable {
- private static final long serialVersionUID = 8966519271130162420L;
-
- /**
- * This value is SNMP Runtime implementation specific, and is used to identify
- * unspecified actions (when for instance the RowStatus variable
- * is not present in the varbind list) or uninitialized values.
- */
- public final static int unspecified = 0;
-
- /**
- * This value corresponds to the active RowStatus, as defined in
- * RFC 2579 from SMIv2:
- *
- * active indicates that the conceptual row is available for
- * use by the managed device;
- *
- */
- public final static int active = 1;
-
- /**
- * This value corresponds to the notInService RowStatus, as
- * defined in RFC 2579 from SMIv2:
- *
- * notInService indicates that the conceptual
- * row exists in the agent, but is unavailable for use by
- * the managed device; notInService has
- * no implication regarding the internal consistency of
- * the row, availability of resources, or consistency with
- * the current state of the managed device;
- *
- **/
- public final static int notInService = 2;
-
- /**
- * This value corresponds to the notReady RowStatus, as defined
- * in RFC 2579 from SMIv2:
- *
- * notReady indicates that the conceptual row
- * exists in the agent, but is missing information
- * necessary in order to be available for use by the
- * managed device (i.e., one or more required columns in
- * the conceptual row have not been instantiated);
- *
- */
- public final static int notReady = 3;
-
- /**
- * This value corresponds to the createAndGo RowStatus,
- * as defined in RFC 2579 from SMIv2:
- *
- * createAndGo is supplied by a management
- * station wishing to create a new instance of a
- * conceptual row and to have its status automatically set
- * to active, making it available for use by the managed
- * device;
- *
- */
- public final static int createAndGo = 4;
-
- /**
- * This value corresponds to the createAndWait RowStatus,
- * as defined in RFC 2579 from SMIv2:
- *
- * createAndWait is supplied by a management
- * station wishing to create a new instance of a
- * conceptual row (but not make it available for use by
- * the managed device);
- *
- */
- public final static int createAndWait = 5;
-
- /**
- * This value corresponds to the destroy RowStatus, as defined in
- * RFC 2579 from SMIv2:
- *
- * destroy is supplied by a management station
- * wishing to delete all of the instances associated with
- * an existing conceptual row.
- *
- */
- public final static int destroy = 6;
-
- /**
- * Build an EnumRowStatus from an int.
- * @param valueIndex should be either 0 (unspecified), or one of
- * the values defined in RFC 2579.
- * @exception IllegalArgumentException if the given
- * valueIndex is not valid.
- **/
- public EnumRowStatus(int valueIndex)
- throws IllegalArgumentException {
- super(valueIndex);
- }
-
- /**
- * Build an EnumRowStatus from an Enumerated.
- * @param valueIndex should be either 0 (unspecified), or one of
- * the values defined in RFC 2579.
- * @exception IllegalArgumentException if the given
- * valueIndex is not valid.
- **/
- public EnumRowStatus(Enumerated valueIndex)
- throws IllegalArgumentException {
- this(valueIndex.intValue());
- }
-
- /**
- * Build an EnumRowStatus from a long.
- * @param valueIndex should be either 0 (unspecified), or one of
- * the values defined in RFC 2579.
- * @exception IllegalArgumentException if the given
- * valueIndex is not valid.
- **/
- public EnumRowStatus(long valueIndex)
- throws IllegalArgumentException {
- this((int)valueIndex);
- }
-
- /**
- * Build an EnumRowStatus from an Integer.
- * @param valueIndex should be either 0 (unspecified), or one of
- * the values defined in RFC 2579.
- * @exception IllegalArgumentException if the given
- * valueIndex is not valid.
- **/
- public EnumRowStatus(Integer valueIndex)
- throws IllegalArgumentException {
- super(valueIndex);
- }
-
- /**
- * Build an EnumRowStatus from a Long.
- * @param valueIndex should be either 0 (unspecified), or one of
- * the values defined in RFC 2579.
- * @exception IllegalArgumentException if the given
- * valueIndex is not valid.
- **/
- public EnumRowStatus(Long valueIndex)
- throws IllegalArgumentException {
- this(valueIndex.longValue());
- }
-
- /**
- * Build an EnumRowStatus with unspecified value.
- **/
- public EnumRowStatus()
- throws IllegalArgumentException {
- this(unspecified);
- }
-
- /**
- * Build an EnumRowStatus from a String.
- * @param x should be either "unspecified", or one of
- * the values defined in RFC 2579 ("active", "notReady", etc...)
- * @exception IllegalArgumentException if the given String
- * x is not valid.
- **/
- public EnumRowStatus(String x)
- throws IllegalArgumentException {
- super(x);
- }
-
- /**
- * Build an EnumRowStatus from an SnmpInt.
- * @param valueIndex should be either 0 (unspecified), or one of
- * the values defined in RFC 2579.
- * @exception IllegalArgumentException if the given
- * valueIndex is not valid.
- **/
- public EnumRowStatus(SnmpInt valueIndex)
- throws IllegalArgumentException {
- this(valueIndex.intValue());
- }
-
- /**
- * Build an SnmpValue from this object.
- *
- * @exception IllegalArgumentException if this object holds an
- * unspecified value.
- * @return an SnmpInt containing this object value.
- **/
- public SnmpInt toSnmpValue()
- throws IllegalArgumentException {
- if (value == unspecified)
- throw new
- IllegalArgumentException("`unspecified' is not a valid SNMP value.");
- return new SnmpInt(value);
- }
-
- /**
- * Check that the given value is valid.
- *
- * Valid values are:
- *
unspecified(0)
- *
active(1)
- *
notInService(2)
- *
notReady(3)
- *
createAndGo(4)
- *
createAndWait(5)
- *
destroy(6)
- *
- *
- **/
- static public boolean isValidValue(int value) {
- if (value < 0) return false;
- if (value > 6) return false;
- return true;
- }
-
- // Documented in Enumerated
- //
- @Override
- protected Hashtable getIntTable() {
- return EnumRowStatus.getRSIntTable();
- }
-
- // Documented in Enumerated
- //
- @Override
- protected Hashtable getStringTable() {
- return EnumRowStatus.getRSStringTable();
- }
-
- static Hashtable getRSIntTable() {
- return intTable ;
- }
-
- static Hashtable getRSStringTable() {
- return stringTable ;
- }
-
- // Initialize the mapping tables.
- //
- final static Hashtable intTable = new Hashtable<>();
- final static Hashtable stringTable = new Hashtable<>();
- static {
- intTable.put(0, "unspecified");
- intTable.put(3, "notReady");
- intTable.put(6, "destroy");
- intTable.put(2, "notInService");
- intTable.put(5, "createAndWait");
- intTable.put(1, "active");
- intTable.put(4, "createAndGo");
- stringTable.put("unspecified", 0);
- stringTable.put("notReady", 3);
- stringTable.put("destroy", 6);
- stringTable.put("notInService", 2);
- stringTable.put("createAndWait", 5);
- stringTable.put("active", 1);
- stringTable.put("createAndGo", 4);
- }
-
-
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/Enumerated.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/Enumerated.java
deleted file mode 100644
index e2760cdfe58..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/Enumerated.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.jmx.snmp;
-
-
-import java.io.*;
-import java.util.Hashtable;
-import java.util.*;
-
-
-
-/** This class is used for implementing enumerated values.
- *
- * An enumeration is represented by a class derived from Enumerated.
- * The derived class defines what are the permitted values in the enumeration.
- *
- * An enumerated value is represented by an instance of the derived class.
- * It can be represented :
- * - as an integer
- * - as a string
- *
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- */
-@SuppressWarnings("serial") // JDK implementation class
-abstract public class Enumerated implements Serializable {
-
- /**
- * Construct an enumerated with a default value.
- * The default value is the first available in getIntTable().
- * @exception IllegalArgumentException One of the arguments passed to the method is illegal or inappropriate.
- */
- public Enumerated() throws IllegalArgumentException {
- Enumeration e =getIntTable().keys();
- if (e.hasMoreElements()) {
- value = e.nextElement().intValue() ;
- }
- else {
- throw new IllegalArgumentException() ;
- }
- }
-
- /**
- * Construct an enumerated from its integer form.
- *
- * @param valueIndex The integer form.
- * @exception IllegalArgumentException One of the arguments passed to
- * the method is illegal or inappropriate.
- */
- public Enumerated(int valueIndex) throws IllegalArgumentException {
- if (getIntTable().get(valueIndex) == null) {
- throw new IllegalArgumentException() ;
- }
- value = valueIndex ;
- }
-
- /**
- * Construct an enumerated from its Integer form.
- *
- * @param valueIndex The Integer form.
- * @exception IllegalArgumentException One of the arguments passed to
- * the method is illegal or inappropriate.
- */
- public Enumerated(Integer valueIndex) throws IllegalArgumentException {
- if (getIntTable().get(valueIndex) == null) {
- throw new IllegalArgumentException() ;
- }
- value = valueIndex.intValue() ;
- }
-
-
- /**
- * Construct an enumerated from its string form.
- *
- * @param valueString The string form.
- * @exception IllegalArgumentException One of the arguments passed
- * to the method is illegal or inappropriate.
- */
- public Enumerated(String valueString) throws IllegalArgumentException {
- Integer index = getStringTable().get(valueString) ;
- if (index == null) {
- throw new IllegalArgumentException() ;
- }
- else {
- value = index.intValue() ;
- }
- }
-
-
- /**
- * Return the integer form of the enumerated.
- *
- * @return The integer form
- */
-
- public int intValue() {
- return value ;
- }
-
-
- /**
- * Returns an Java enumeration of the permitted integers.
- *
- * @return An enumeration of Integer instances
- */
-
- public Enumeration valueIndexes() {
- return getIntTable().keys() ;
- }
-
-
- /**
- * Returns an Java enumeration of the permitted strings.
- *
- * @return An enumeration of String instances
- */
-
- public Enumeration valueStrings() {
- return getStringTable().keys() ;
- }
-
-
- /**
- * Compares this enumerated to the specified enumerated.
- *
- * The result is true if and only if the argument is not null
- * and is of the same class.
- *
- * @param obj The object to compare with.
- *
- * @return True if this and obj are the same; false otherwise
- */
- @Override
- public boolean equals(Object obj) {
-
- return ((obj != null) &&
- (getClass() == obj.getClass()) &&
- (value == ((Enumerated)obj).value)) ;
- }
-
-
- /**
- * Returns the hash code for this enumerated.
- *
- * @return A hash code value for this object.
- */
- @Override
- public int hashCode() {
- String hashString = getClass().getName() + String.valueOf(value) ;
- return hashString.hashCode() ;
- }
-
-
- /**
- * Returns the string form of this enumerated.
- *
- * @return The string for for this object.
- */
- @Override
- public String toString() {
- return getIntTable().get(value);
- }
-
-
- /**
- * Returns the hashtable of the integer forms.
- * getIntTable().get(x) returns the string form associated
- * to the integer x.
- *
- * This method must be implemented by the derived class.
- *
- * @return An hashtable for read-only purpose
- */
-
- protected abstract Hashtable getIntTable() ;
-
-
-
- /**
- * Returns the hashtable of the string forms.
- * getStringTable().get(s) returns the integer form associated
- * to the string s.
- *
- * This method must be implemented by the derived class.
- *
- * @return An hashtable for read-only purpose
- */
-
- protected abstract Hashtable getStringTable() ;
-
-
- /**
- * This variable keeps the integer form of the enumerated.
- * The string form is retrieved using getIntTable().
- */
- protected int value ;
-
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/ASCII_CharStream.README b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/ASCII_CharStream.README
deleted file mode 100644
index 6e6fd813e52..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/ASCII_CharStream.README
+++ /dev/null
@@ -1,23 +0,0 @@
-WARNING : ASCII_CharStream.java must be PATCHED.
-
-The following methods should be removed after javacc generation.
-The goal is to simplify 100%-pure testing (see bug 4127719).
-
-
- /**
- * @deprecated
- * @see #getEndColumn
- */
-
- public final int getColumn() {
- return bufcolumn[bufpos];
- }
-
- /**
- * @deprecated
- * @see #getEndLine
- */
-
- public final int getLine() {
- return bufline[bufpos];
- }
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/ASCII_CharStream.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/ASCII_CharStream.java
deleted file mode 100644
index d6fa3088de2..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/ASCII_CharStream.java
+++ /dev/null
@@ -1,402 +0,0 @@
-/*
- * Copyright (c) 1997, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* Generated By:JavaCC: Do not edit this line. ASCII_CharStream.java Version 0.7pre6 */
-package com.sun.jmx.snmp.IPAcl;
-
-/**
- * An implementation of interface CharStream, where the stream is assumed to
- * contain only ASCII characters (without unicode processing).
- */
-
-final class ASCII_CharStream
-{
- public static final boolean staticFlag = false;
- int bufsize;
- int available;
- int tokenBegin;
- public int bufpos = -1;
- private int bufline[];
- private int bufcolumn[];
-
- private int column = 0;
- private int line = 1;
-
- private boolean prevCharIsCR = false;
- private boolean prevCharIsLF = false;
-
- private java.io.Reader inputStream;
-
- private char[] buffer;
- private int maxNextCharInd = 0;
- private int inBuf = 0;
-
- private final void ExpandBuff(boolean wrapAround)
- {
- char[] newbuffer = new char[bufsize + 2048];
- int newbufline[] = new int[bufsize + 2048];
- int newbufcolumn[] = new int[bufsize + 2048];
-
- try
- {
- if (wrapAround)
- {
- System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
- System.arraycopy(buffer, 0, newbuffer,
- bufsize - tokenBegin, bufpos);
- buffer = newbuffer;
-
- System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
- System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos);
- bufline = newbufline;
-
- System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
- System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos);
- bufcolumn = newbufcolumn;
-
- maxNextCharInd = (bufpos += (bufsize - tokenBegin));
- }
- else
- {
- System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
- buffer = newbuffer;
-
- System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
- bufline = newbufline;
-
- System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
- bufcolumn = newbufcolumn;
-
- maxNextCharInd = (bufpos -= tokenBegin);
- }
- }
- catch (Throwable t)
- {
- throw new Error(t.getMessage());
- }
-
-
- bufsize += 2048;
- available = bufsize;
- tokenBegin = 0;
- }
-
- private final void FillBuff() throws java.io.IOException
- {
- if (maxNextCharInd == available)
- {
- if (available == bufsize)
- {
- if (tokenBegin > 2048)
- {
- bufpos = maxNextCharInd = 0;
- available = tokenBegin;
- }
- else if (tokenBegin < 0)
- bufpos = maxNextCharInd = 0;
- else
- ExpandBuff(false);
- }
- else if (available > tokenBegin)
- available = bufsize;
- else if ((tokenBegin - available) < 2048)
- ExpandBuff(true);
- else
- available = tokenBegin;
- }
-
- int i;
- try {
- if ((i = inputStream.read(buffer, maxNextCharInd,
- available - maxNextCharInd)) == -1)
- {
- inputStream.close();
- throw new java.io.IOException();
- }
- else
- maxNextCharInd += i;
- return;
- }
- catch(java.io.IOException e) {
- --bufpos;
- backup(0);
- if (tokenBegin == -1)
- tokenBegin = bufpos;
- throw e;
- }
- }
-
- public final char BeginToken() throws java.io.IOException
- {
- tokenBegin = -1;
- char c = readChar();
- tokenBegin = bufpos;
-
- return c;
- }
-
- private final void UpdateLineColumn(char c)
- {
- column++;
-
- if (prevCharIsLF)
- {
- prevCharIsLF = false;
- line += (column = 1);
- }
- else if (prevCharIsCR)
- {
- prevCharIsCR = false;
- if (c == '\n')
- {
- prevCharIsLF = true;
- }
- else
- line += (column = 1);
- }
-
- switch (c)
- {
- case '\r' :
- prevCharIsCR = true;
- break;
- case '\n' :
- prevCharIsLF = true;
- break;
- case '\t' :
- column--;
- column += (8 - (column & 07));
- break;
- default :
- break;
- }
-
- bufline[bufpos] = line;
- bufcolumn[bufpos] = column;
- }
-
- public final char readChar() throws java.io.IOException
- {
- if (inBuf > 0)
- {
- --inBuf;
- return (char)((char)0xff & buffer[(bufpos == bufsize - 1) ? (bufpos = 0) : ++bufpos]);
- }
-
- if (++bufpos >= maxNextCharInd)
- FillBuff();
-
- char c = (char)((char)0xff & buffer[bufpos]);
-
- UpdateLineColumn(c);
- return (c);
- }
-
- /**
- * @deprecated
- * @see #getEndColumn
- */
- @Deprecated
- public final int getColumn() {
- return bufcolumn[bufpos];
- }
-
- /**
- * @deprecated
- * @see #getEndLine
- */
- @Deprecated
- public final int getLine() {
- return bufline[bufpos];
- }
-
- public final int getEndColumn() {
- return bufcolumn[bufpos];
- }
-
- public final int getEndLine() {
- return bufline[bufpos];
- }
-
- public final int getBeginColumn() {
- return bufcolumn[tokenBegin];
- }
-
- public final int getBeginLine() {
- return bufline[tokenBegin];
- }
-
- public final void backup(int amount) {
-
- inBuf += amount;
- if ((bufpos -= amount) < 0)
- bufpos += bufsize;
- }
-
- public ASCII_CharStream(java.io.Reader dstream, int startline,
- int startcolumn, int buffersize)
- {
- inputStream = dstream;
- line = startline;
- column = startcolumn - 1;
-
- available = bufsize = buffersize;
- buffer = new char[buffersize];
- bufline = new int[buffersize];
- bufcolumn = new int[buffersize];
- }
-
- public ASCII_CharStream(java.io.Reader dstream, int startline,
- int startcolumn)
- {
- this(dstream, startline, startcolumn, 4096);
- }
- public void ReInit(java.io.Reader dstream, int startline,
- int startcolumn, int buffersize)
- {
- inputStream = dstream;
- line = startline;
- column = startcolumn - 1;
-
- if (buffer == null || buffersize != buffer.length)
- {
- available = bufsize = buffersize;
- buffer = new char[buffersize];
- bufline = new int[buffersize];
- bufcolumn = new int[buffersize];
- }
- prevCharIsLF = prevCharIsCR = false;
- tokenBegin = inBuf = maxNextCharInd = 0;
- bufpos = -1;
- }
-
- public void ReInit(java.io.Reader dstream, int startline,
- int startcolumn)
- {
- ReInit(dstream, startline, startcolumn, 4096);
- }
- public ASCII_CharStream(java.io.InputStream dstream, int startline,
- int startcolumn, int buffersize)
- {
- this(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096);
- }
-
- public ASCII_CharStream(java.io.InputStream dstream, int startline,
- int startcolumn)
- {
- this(dstream, startline, startcolumn, 4096);
- }
-
- public void ReInit(java.io.InputStream dstream, int startline,
- int startcolumn, int buffersize)
- {
- ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096);
- }
- public void ReInit(java.io.InputStream dstream, int startline,
- int startcolumn)
- {
- ReInit(dstream, startline, startcolumn, 4096);
- }
- public final String GetImage()
- {
- if (bufpos >= tokenBegin)
- return new String(buffer, tokenBegin, bufpos - tokenBegin + 1);
- else
- return new String(buffer, tokenBegin, bufsize - tokenBegin) +
- new String(buffer, 0, bufpos + 1);
- }
-
- public final char[] GetSuffix(int len)
- {
- char[] ret = new char[len];
-
- if ((bufpos + 1) >= len)
- System.arraycopy(buffer, bufpos - len + 1, ret, 0, len);
- else
- {
- System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0,
- len - bufpos - 1);
- System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1);
- }
-
- return ret;
- }
-
- public void Done()
- {
- buffer = null;
- bufline = null;
- bufcolumn = null;
- }
-
- /**
- * Method to adjust line and column numbers for the start of a token.
- */
- public void adjustBeginLineColumn(int newLine, int newCol)
- {
- int start = tokenBegin;
- int len;
-
- if (bufpos >= tokenBegin)
- {
- len = bufpos - tokenBegin + inBuf + 1;
- }
- else
- {
- len = bufsize - tokenBegin + bufpos + 1 + inBuf;
- }
-
- int i = 0, j = 0, k = 0;
- int nextColDiff = 0, columnDiff = 0;
-
- while (i < len &&
- bufline[j = start % bufsize] == bufline[k = ++start % bufsize])
- {
- bufline[j] = newLine;
- nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j];
- bufcolumn[j] = newCol + columnDiff;
- columnDiff = nextColDiff;
- i++;
- }
-
- if (i < len)
- {
- bufline[j] = newLine++;
- bufcolumn[j] = newCol + columnDiff;
-
- while (i++ < len)
- {
- if (bufline[j = start % bufsize] != bufline[++start % bufsize])
- bufline[j] = newLine++;
- else
- bufline[j] = newLine;
- }
- }
-
- line = bufline[j];
- column = bufcolumn[j];
- }
-
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/AclEntryImpl.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/AclEntryImpl.java
deleted file mode 100644
index 30da053026c..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/AclEntryImpl.java
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package com.sun.jmx.snmp.IPAcl;
-
-
-
-import java.security.acl.Permission;
-import java.util.Vector;
-import java.util.Enumeration;
-import java.io.Serializable;
-import java.net.UnknownHostException;
-
-import java.security.Principal;
-import java.security.acl.AclEntry;
-
-
-/**
- * Represent one entry in the Access Control List (ACL).
- * This ACL entry object contains a permission associated with a particular principal.
- * (A principal represents an entity such as an individual machine or a group).
- *
- * @see java.security.acl.AclEntry
- */
-
-class AclEntryImpl implements AclEntry, Serializable {
- private static final long serialVersionUID = -5047185131260073216L;
-
- private AclEntryImpl (AclEntryImpl i) throws UnknownHostException {
- setPrincipal(i.getPrincipal());
- permList = new Vector();
- commList = new Vector();
-
- for (Enumeration en = i.communities(); en.hasMoreElements();){
- addCommunity(en.nextElement());
- }
-
- for (Enumeration en = i.permissions(); en.hasMoreElements();){
- addPermission(en.nextElement());
- }
- if (i.isNegative()) setNegativePermissions();
- }
-
- /**
- * Contructs an empty ACL entry.
- */
- public AclEntryImpl (){
- princ = null;
- permList = new Vector();
- commList = new Vector();
- }
-
- /**
- * Constructs an ACL entry with a specified principal.
- *
- * @param p the principal to be set for this entry.
- */
- public AclEntryImpl (Principal p) throws UnknownHostException {
- princ = p;
- permList = new Vector();
- commList = new Vector();
- }
-
- /**
- * Clones this ACL entry.
- *
- * @return a clone of this ACL entry.
- */
- public Object clone() {
- AclEntryImpl i;
- try {
- i = new AclEntryImpl(this);
- }catch (UnknownHostException e) {
- i = null;
- }
- return (Object) i;
- }
-
- /**
- * Returns true if this is a negative ACL entry (one denying the associated principal
- * the set of permissions in the entry), false otherwise.
- *
- * @return true if this is a negative ACL entry, false if it's not.
- */
- public boolean isNegative(){
- return neg;
- }
-
- /**
- * Adds the specified permission to this ACL entry. Note: An entry can
- * have multiple permissions.
- *
- * @param perm the permission to be associated with the principal in this
- * entry
- * @return true if the permission is removed, false if the permission was
- * not part of this entry's permission set.
- *
- */
- public boolean addPermission(java.security.acl.Permission perm){
- if (permList.contains(perm)) return false;
- permList.addElement(perm);
- return true;
- }
-
- /**
- * Removes the specified permission from this ACL entry.
- *
- * @param perm the permission to be removed from this entry.
- * @return true if the permission is removed, false if the permission
- * was not part of this entry's permission set.
- */
- public boolean removePermission(java.security.acl.Permission perm){
- if (!permList.contains(perm)) return false;
- permList.removeElement(perm);
- return true;
- }
-
- /**
- * Checks if the specified permission is part of the permission set in
- * this entry.
- *
- * @param perm the permission to be checked for.
- * @return true if the permission is part of the permission set in this
- * entry, false otherwise.
- */
-
- public boolean checkPermission(java.security.acl.Permission perm){
- return (permList.contains(perm));
- }
-
- /**
- * Returns an enumeration of the permissions in this ACL entry.
- *
- * @return an enumeration of the permissions in this ACL entry.
- */
- public Enumeration permissions(){
- return permList.elements();
- }
-
- /**
- * Sets this ACL entry to be a negative one. That is, the associated principal
- * (e.g., a user or a group) will be denied the permission set specified in the
- * entry. Note: ACL entries are by default positive. An entry becomes a negative
- * entry only if this setNegativePermissions method is called on it.
- *
- * Not Implemented.
- */
- public void setNegativePermissions(){
- neg = true;
- }
-
- /**
- * Returns the principal for which permissions are granted or denied by this ACL
- * entry. Returns null if there is no principal set for this entry yet.
- *
- * @return the principal associated with this entry.
- */
- public Principal getPrincipal(){
- return princ;
- }
-
- /**
- * Specifies the principal for which permissions are granted or denied by
- * this ACL entry. If a principal was already set for this ACL entry,
- * false is returned, otherwise true is returned.
- *
- * @param p the principal to be set for this entry.
- * @return true if the principal is set, false if there was already a
- * principal set for this entry.
- */
- public boolean setPrincipal(Principal p) {
- if (princ != null )
- return false;
- princ = p;
- return true;
- }
-
- /**
- * Returns a string representation of the contents of this ACL entry.
- *
- * @return a string representation of the contents.
- */
- public String toString(){
- return "AclEntry:"+princ.toString();
- }
-
- /**
- * Returns an enumeration of the communities in this ACL entry.
- *
- * @return an enumeration of the communities in this ACL entry.
- */
- public Enumeration communities(){
- return commList.elements();
- }
-
- /**
- * Adds the specified community to this ACL entry. Note: An entry can
- * have multiple communities.
- *
- * @param comm the community to be associated with the principal
- * in this entry.
- * @return true if the community was added, false if the community was
- * already part of this entry's community set.
- */
- public boolean addCommunity(String comm){
- if (commList.contains(comm)) return false;
- commList.addElement(comm);
- return true;
- }
-
- /**
- * Removes the specified community from this ACL entry.
- *
- * @param comm the community to be removed from this entry.
- * @return true if the community is removed, false if the community was
- * not part of this entry's community set.
- */
- public boolean removeCommunity(String comm){
- if (!commList.contains(comm)) return false;
- commList.removeElement(comm);
- return true;
- }
-
- /**
- * Checks if the specified community is part of the community set in this
- * entry.
- *
- * @param comm the community to be checked for.
- * @return true if the community is part of the community set in this
- * entry, false otherwise.
- */
- public boolean checkCommunity(String comm){
- return (commList.contains(comm));
- }
-
- private Principal princ = null;
- private boolean neg = false;
- private Vector permList = null;
- private Vector commList = null;
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/AclImpl.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/AclImpl.java
deleted file mode 100644
index d29c4e06a5e..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/AclImpl.java
+++ /dev/null
@@ -1,295 +0,0 @@
-/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package com.sun.jmx.snmp.IPAcl;
-
-
-
-import java.security.Principal;
-import java.security.acl.Acl;
-import java.security.acl.AclEntry;
-import java.security.acl.NotOwnerException;
-
-import java.io.Serializable;
-import java.security.acl.Permission;
-import java.util.Vector;
-import java.util.Enumeration;
-
-
-/**
- * Represent an Access Control List (ACL) which is used to guard access to http adaptor.
- *
- * It is a data structure with multiple ACL entries. Each ACL entry, of interface type
- * AclEntry, contains a set of permissions and a set of communities associated with a
- * particular principal. (A principal represents an entity such as a host or a group of host).
- * Additionally, each ACL entry is specified as being either positive or negative.
- * If positive, the permissions are to be granted to the associated principal.
- * If negative, the permissions are to be denied.
- *
- * @see java.security.acl.Acl
- */
-
-class AclImpl extends OwnerImpl implements Acl, Serializable {
- private static final long serialVersionUID = -2250957591085270029L;
-
- private Vector entryList = null;
- private String aclName = null;
-
- /**
- * Constructs the ACL with a specified owner
- *
- * @param owner owner of the ACL.
- * @param name name of this ACL.
- */
- public AclImpl (PrincipalImpl owner, String name) {
- super(owner);
- entryList = new Vector<>();
- aclName = name;
- }
-
- /**
- * Sets the name of this ACL.
- *
- * @param caller the principal invoking this method. It must be an owner
- * of this ACL.
- * @param name the name to be given to this ACL.
- *
- * @exception NotOwnerException if the caller principal is not an owner
- * of this ACL.
- * @see java.security.Principal
- */
- @Override
- public void setName(Principal caller, String name)
- throws NotOwnerException {
- if (!isOwner(caller))
- throw new NotOwnerException();
- aclName = name;
- }
-
- /**
- * Returns the name of this ACL.
- *
- * @return the name of this ACL.
- */
- @Override
- public String getName(){
- return aclName;
- }
-
- /**
- * Adds an ACL entry to this ACL. An entry associates a principal (e.g., an individual or a group)
- * with a set of permissions. Each principal can have at most one positive ACL entry
- * (specifying permissions to be granted to the principal) and one negative ACL entry
- * (specifying permissions to be denied). If there is already an ACL entry
- * of the same type (negative or positive) already in the ACL, false is returned.
- *
- * @param caller the principal invoking this method. It must be an owner
- * of this ACL.
- * @param entry the ACL entry to be added to this ACL.
- * @return true on success, false if an entry of the same type (positive
- * or negative) for the same principal is already present in this ACL.
- * @exception NotOwnerException if the caller principal is not an owner of
- * this ACL.
- * @see java.security.Principal
- */
- @Override
- public boolean addEntry(Principal caller, AclEntry entry)
- throws NotOwnerException {
- if (!isOwner(caller))
- throw new NotOwnerException();
-
- if (entryList.contains(entry))
- return false;
- /*
- for (Enumeration e = entryList.elements();e.hasMoreElements();){
- AclEntry ent = (AclEntry) e.nextElement();
- if (ent.getPrincipal().equals(entry.getPrincipal()))
- return false;
- }
- */
-
- entryList.addElement(entry);
- return true;
- }
-
- /**
- * Removes an ACL entry from this ACL.
- *
- * @param caller the principal invoking this method. It must be an owner
- * of this ACL.
- * @param entry the ACL entry to be removed from this ACL.
- * @return true on success, false if the entry is not part of this ACL.
- * @exception NotOwnerException if the caller principal is not an owner
- * of this Acl.
- * @see java.security.Principal
- * @see java.security.acl.AclEntry
- */
- @Override
- public boolean removeEntry(Principal caller, AclEntry entry)
- throws NotOwnerException {
- if (!isOwner(caller))
- throw new NotOwnerException();
-
- return (entryList.removeElement(entry));
- }
-
- /**
- * Removes all ACL entries from this ACL.
- *
- * @param caller the principal invoking this method. It must be an owner
- * of this ACL.
- * @exception NotOwnerException if the caller principal is not an owner of
- * this Acl.
- * @see java.security.Principal
- */
- public void removeAll(Principal caller)
- throws NotOwnerException {
- if (!isOwner(caller))
- throw new NotOwnerException();
- entryList.removeAllElements();
- }
-
- /**
- * Returns an enumeration for the set of allowed permissions for
- * the specified principal
- * (representing an entity such as an individual or a group).
- * This set of allowed permissions is calculated as follows:
- *
- *
If there is no entry in this Access Control List for the specified
- * principal, an empty permission set is returned.
- *
Otherwise, the principal's group permission sets are determined.
- * (A principal can belong to one or more groups, where a group is a group
- * of principals, represented by the Group interface.)
- *
- * @param user the principal whose permission set is to be returned.
- * @return the permission set specifying the permissions the principal
- * is allowed.
- * @see java.security.Principal
- */
- @Override
- public Enumeration getPermissions(Principal user){
- Vector empty = new Vector<>();
- for (Enumeration e = entryList.elements();e.hasMoreElements();){
- AclEntry ent = e.nextElement();
- if (ent.getPrincipal().equals(user))
- return ent.permissions();
- }
- return empty.elements();
- }
-
- /**
- * Returns an enumeration of the entries in this ACL. Each element in the
- * enumeration is of type AclEntry.
- *
- * @return an enumeration of the entries in this ACL.
- */
- @Override
- public Enumeration entries(){
- return entryList.elements();
- }
-
- /**
- * Checks whether or not the specified principal has the specified
- * permission.
- * If it does, true is returned, otherwise false is returned.
- * More specifically, this method checks whether the passed permission
- * is a member of the allowed permission set of the specified principal.
- * The allowed permission set is determined by the same algorithm as is
- * used by the getPermissions method.
- *
- * @param user the principal, assumed to be a valid authenticated Principal.
- * @param perm the permission to be checked for.
- * @return true if the principal has the specified permission,
- * false otherwise.
- * @see java.security.Principal
- * @see java.security.Permission
- */
- @Override
- public boolean checkPermission(Principal user,
- java.security.acl.Permission perm) {
- for (Enumeration e = entryList.elements();e.hasMoreElements();){
- AclEntry ent = e.nextElement();
- if (ent.getPrincipal().equals(user))
- if (ent.checkPermission(perm)) return true;
- }
- return false;
- }
-
- /**
- * Checks whether or not the specified principal has the specified
- * permission.
- * If it does, true is returned, otherwise false is returned.
- * More specifically, this method checks whether the passed permission
- * is a member of the allowed permission set of the specified principal.
- * The allowed permission set is determined by the same algorithm as is
- * used by the getPermissions method.
- *
- * @param user the principal, assumed to be a valid authenticated Principal.
- * @param community the community name associated with the principal.
- * @param perm the permission to be checked for.
- * @return true if the principal has the specified permission, false
- * otherwise.
- * @see java.security.Principal
- * @see java.security.Permission
- */
- public boolean checkPermission(Principal user, String community,
- java.security.acl.Permission perm) {
- for (Enumeration e = entryList.elements();e.hasMoreElements();){
- AclEntryImpl ent = (AclEntryImpl) e.nextElement();
- if (ent.getPrincipal().equals(user))
- if (ent.checkPermission(perm) && ent.checkCommunity(community)) return true;
- }
- return false;
- }
-
- /**
- * Checks whether or not the specified community string is defined.
- *
- * @param community the community name associated with the principal.
- *
- * @return true if the specified community string is defined, false
- * otherwise.
- * @see java.security.Principal
- * @see java.security.Permission
- */
- public boolean checkCommunity(String community) {
- for (Enumeration e = entryList.elements();e.hasMoreElements();){
- AclEntryImpl ent = (AclEntryImpl) e.nextElement();
- if (ent.checkCommunity(community)) return true;
- }
- return false;
- }
-
- /**
- * Returns a string representation of the ACL contents.
- *
- * @return a string representation of the ACL contents.
- */
- @Override
- public String toString(){
- return ("AclImpl: "+ getName());
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/GroupImpl.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/GroupImpl.java
deleted file mode 100644
index 82856781232..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/GroupImpl.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package com.sun.jmx.snmp.IPAcl;
-
-
-
-import java.util.Vector;
-import java.util.Enumeration;
-import java.io.Serializable;
-import java.net.UnknownHostException;
-
-
-import java.security.Principal;
-import java.security.acl.Group;
-
-
-/**
- * This class is used to represent a subnet mask (a group of hosts
- * matching the same
- * IP mask).
- *
- */
-
-class GroupImpl extends PrincipalImpl implements Group, Serializable {
- private static final long serialVersionUID = -7777387035032541168L;
-
- /**
- * Constructs an empty group.
- * @exception UnknownHostException Not implemented
- */
- public GroupImpl () throws UnknownHostException {
- }
-
- /**
- * Constructs a group using the specified subnet mask.
- *
- * @param mask The subnet mask to use to build the group.
- * @exception UnknownHostException if the subnet mask cann't be built.
- */
- public GroupImpl (String mask) throws UnknownHostException {
- super(mask);
- }
-
- /**
- * Adds the specified member to the group.
- *
- * @param p the principal to add to this group.
- * @return true if the member was successfully added, false if the
- * principal was already a member.
- */
- public boolean addMember(Principal p) {
- // we don't need to add members because the ip address is a
- // subnet mask
- return true;
- }
-
- public int hashCode() {
- return super.hashCode();
- }
-
- /**
- * Compares this group to the specified object. Returns true if the object
- * passed in matches the group represented.
- *
- * @param p the object to compare with.
- * @return true if the object passed in matches the subnet mask,
- * false otherwise.
- */
- public boolean equals (Object p) {
- if (p instanceof PrincipalImpl || p instanceof GroupImpl){
- if ((super.hashCode() & p.hashCode()) == p.hashCode()) return true;
- else return false;
- } else {
- return false;
- }
- }
-
- /**
- * Returns true if the passed principal is a member of the group.
- *
- * @param p the principal whose membership is to be checked.
- * @return true if the principal is a member of this group, false otherwise.
- */
- public boolean isMember(Principal p) {
- if ((p.hashCode() & super.hashCode()) == p.hashCode()) return true;
- else return false;
- }
-
- /**
- * Returns an enumeration which contains the subnet mask.
- *
- * @return an enumeration which contains the subnet mask.
- */
- public Enumeration extends Principal> members(){
- Vector v = new Vector(1);
- v.addElement(this);
- return v.elements();
- }
-
- /**
- * Removes the specified member from the group. (Not implemented)
- *
- * @param p the principal to remove from this group.
- * @return allways return true.
- */
- public boolean removeMember(Principal p) {
- return true;
- }
-
- /**
- * Prints a string representation of this group.
- *
- * @return a string representation of this group.
- */
- public String toString() {
- return ("GroupImpl :"+super.getAddress().toString());
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/Host.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/Host.java
deleted file mode 100644
index b502f79509a..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/Host.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package com.sun.jmx.snmp.IPAcl;
-
-
-
-// java import
-//
-import java.io.Serializable;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.Hashtable;
-import java.util.logging.Level;
-import java.util.Vector;
-import java.security.acl.NotOwnerException;
-
-import static com.sun.jmx.defaults.JmxProperties.SNMP_LOGGER;
-
-/**
- * The class defines an abstract representation of a host.
- *
- */
-@SuppressWarnings("serial") // JDK implementation class
-abstract class Host extends SimpleNode implements Serializable {
-
- public Host(int id) {
- super(id);
- }
-
- public Host(Parser p, int id) {
- super(p, id);
- }
-
- protected abstract PrincipalImpl createAssociatedPrincipal()
- throws UnknownHostException;
-
- protected abstract String getHname();
-
- public void buildAclEntries(PrincipalImpl owner, AclImpl acl) {
- // Create a principal
- //
- PrincipalImpl p=null;
- try {
- p = createAssociatedPrincipal();
- } catch(UnknownHostException e) {
- if (SNMP_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_LOGGER.logp(Level.FINEST, Host.class.getName(),
- "buildAclEntries",
- "Cannot create ACL entry; got exception", e);
- }
- throw new IllegalArgumentException("Cannot create ACL entry for " + e.getMessage());
- }
-
- // Create an AclEntry
- //
- AclEntryImpl entry= null;
- try {
- entry = new AclEntryImpl(p);
- // Add permission
- //
- registerPermission(entry);
- acl.addEntry(owner, entry);
- } catch(UnknownHostException e) {
- if (SNMP_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_LOGGER.logp(Level.FINEST, Host.class.getName(),
- "buildAclEntries",
- "Cannot create ACL entry; got exception", e);
- }
- return;
- } catch(NotOwnerException a) {
- if (SNMP_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_LOGGER.logp(Level.FINEST, Host.class.getName(),
- "buildAclEntries",
- "Cannot create ACL entry; got exception", a);
- }
- return;
- }
- }
-
- private void registerPermission(AclEntryImpl entry) {
- JDMHost host= (JDMHost) jjtGetParent();
- JDMManagers manager= (JDMManagers) host.jjtGetParent();
- JDMAclItem acl= (JDMAclItem) manager.jjtGetParent();
- JDMAccess access= acl.getAccess();
- access.putPermission(entry);
- JDMCommunities comm= acl.getCommunities();
- comm.buildCommunities(entry);
- }
-
- public void buildTrapEntries(Hashtable> dest) {
-
- JDMHostTrap host= (JDMHostTrap) jjtGetParent();
- JDMTrapInterestedHost hosts= (JDMTrapInterestedHost) host.jjtGetParent();
- JDMTrapItem trap = (JDMTrapItem) hosts.jjtGetParent();
- JDMTrapCommunity community = trap.getCommunity();
- String comm = community.getCommunity();
-
- InetAddress add = null;
- try {
- add = java.net.InetAddress.getByName(getHname());
- } catch(UnknownHostException e) {
- if (SNMP_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_LOGGER.logp(Level.FINEST, Host.class.getName(),
- "buildTrapEntries",
- "Cannot create TRAP entry; got exception", e);
- }
- return;
- }
-
- Vector list = null;
- if (dest.containsKey(add)){
- list = dest.get(add);
- if (!list.contains(comm)){
- list.addElement(comm);
- }
- } else {
- list = new Vector();
- list.addElement(comm);
- dest.put(add,list);
- }
- }
-
- public void buildInformEntries(Hashtable> dest) {
-
- JDMHostInform host= (JDMHostInform) jjtGetParent();
- JDMInformInterestedHost hosts= (JDMInformInterestedHost) host.jjtGetParent();
- JDMInformItem inform = (JDMInformItem) hosts.jjtGetParent();
- JDMInformCommunity community = inform.getCommunity();
- String comm = community.getCommunity();
-
- InetAddress add = null;
- try {
- add = java.net.InetAddress.getByName(getHname());
- } catch(UnknownHostException e) {
- if (SNMP_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_LOGGER.logp(Level.FINEST, Host.class.getName(),
- "buildTrapEntries",
- "Cannot create INFORM entry; got exception", e);
- }
- return;
- }
-
- Vector list = null;
- if (dest.containsKey(add)){
- list = dest.get(add);
- if (!list.contains(comm)){
- list.addElement(comm);
- }
- } else {
- list = new Vector();
- list.addElement(comm);
- dest.put(add,list);
- }
- }
-
-
-
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMAccess.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMAccess.java
deleted file mode 100644
index b598aab5b76..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMAccess.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/* Generated By:JJTree: Do not edit this line. JDMAccess.java */
-
-package com.sun.jmx.snmp.IPAcl;
-
-
-class JDMAccess extends SimpleNode {
- protected int access= -1;
-
- JDMAccess(int id) {
- super(id);
- }
-
- JDMAccess(Parser p, int id) {
- super(p, id);
- }
-
- public static Node jjtCreate(int id) {
- return new JDMAccess(id);
- }
-
- public static Node jjtCreate(Parser p, int id) {
- return new JDMAccess(p, id);
- }
-
- protected void putPermission(AclEntryImpl entry) {
- if (access == ParserConstants.RO) {
- // We have a read-only access.
- //
- entry.addPermission(com.sun.jmx.snmp.IPAcl.SnmpAcl.getREAD());
- }
- if (access == ParserConstants.RW) {
- // We have a read-write access.
- //
- entry.addPermission(com.sun.jmx.snmp.IPAcl.SnmpAcl.getREAD());
- entry.addPermission(com.sun.jmx.snmp.IPAcl.SnmpAcl.getWRITE());
- }
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMAclBlock.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMAclBlock.java
deleted file mode 100644
index 1062575c859..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMAclBlock.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/* Generated By:JJTree: Do not edit this line. JDMAclBlock.java */
-
-package com.sun.jmx.snmp.IPAcl;
-
-import java.net.InetAddress;
-import java.util.Hashtable;
-import java.util.Vector;
-
-class JDMAclBlock extends SimpleNode {
- JDMAclBlock(int id) {
- super(id);
- }
-
- JDMAclBlock(Parser p, int id) {
- super(p, id);
- }
-
- public static Node jjtCreate(int id) {
- return new JDMAclBlock(id);
- }
-
- public static Node jjtCreate(Parser p, int id) {
- return new JDMAclBlock(p, id);
- }
-
- /**
- * Do no need to go through this part of the tree for
- * building TrapEntry.
- */
- @Override
- public void buildTrapEntries(Hashtable> dest) {}
-
- /**
- * Do no need to go through this part of the tree for
- * building InformEntry.
- */
- @Override
- public void buildInformEntries(Hashtable> dest) {}
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMAclItem.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMAclItem.java
deleted file mode 100644
index e2756f956bc..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMAclItem.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/* Generated By:JJTree: Do not edit this line. JDMAclItem.java */
-
-package com.sun.jmx.snmp.IPAcl;
-
-class JDMAclItem extends SimpleNode {
- protected JDMAccess access= null;
- protected JDMCommunities com= null;
-
- JDMAclItem(int id) {
- super(id);
- }
-
- JDMAclItem(Parser p, int id) {
- super(p, id);
- }
-
- public static Node jjtCreate(int id) {
- return new JDMAclItem(id);
- }
-
- public static Node jjtCreate(Parser p, int id) {
- return new JDMAclItem(p, id);
- }
-
- public JDMAccess getAccess() {
- return access;
- }
-
- public JDMCommunities getCommunities() {
- return com;
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMCommunities.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMCommunities.java
deleted file mode 100644
index cc88a96e81d..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMCommunities.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/* Generated By:JJTree: Do not edit this line. JDMCommunities.java */
-
-package com.sun.jmx.snmp.IPAcl;
-
-
-class JDMCommunities extends SimpleNode {
- JDMCommunities(int id) {
- super(id);
- }
-
- JDMCommunities(Parser p, int id) {
- super(p, id);
- }
-
- public static Node jjtCreate(int id) {
- return new JDMCommunities(id);
- }
-
- public static Node jjtCreate(Parser p, int id) {
- return new JDMCommunities(p, id);
- }
-
- public void buildCommunities(AclEntryImpl entry){
- for (int i =0 ; i < children.length ; i++)
- entry.addCommunity(((JDMCommunity)children[i]).getCommunity());
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMCommunity.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMCommunity.java
deleted file mode 100644
index 883b266d0aa..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMCommunity.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/* Generated By:JJTree: Do not edit this line. JDMCommunity.java */
-
-package com.sun.jmx.snmp.IPAcl;
-
-class JDMCommunity extends SimpleNode {
- protected String communityString= "";
-
- JDMCommunity(int id) {
- super(id);
- }
-
- JDMCommunity(Parser p, int id) {
- super(p, id);
- }
-
- public static Node jjtCreate(int id) {
- return new JDMCommunity(id);
- }
-
- public static Node jjtCreate(Parser p, int id) {
- return new JDMCommunity(p, id);
- }
-
- public String getCommunity(){
- return communityString;
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMEnterprise.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMEnterprise.java
deleted file mode 100644
index 37f6d82ec43..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMEnterprise.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/* Generated By:JJTree: Do not edit this line. JDMEnterprise.java */
-
-package com.sun.jmx.snmp.IPAcl;
-
-class JDMEnterprise extends SimpleNode {
- protected String enterprise= "";
-
- JDMEnterprise(int id) {
- super(id);
- }
-
- JDMEnterprise(Parser p, int id) {
- super(p, id);
- }
-
- public static Node jjtCreate(int id) {
- return new JDMEnterprise(id);
- }
-
- public static Node jjtCreate(Parser p, int id) {
- return new JDMEnterprise(p, id);
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMHost.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMHost.java
deleted file mode 100644
index d1ffcf50c6d..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMHost.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/* Generated By:JJTree: Do not edit this line. JDMHost.java */
-
-package com.sun.jmx.snmp.IPAcl;
-
-
-class JDMHost extends SimpleNode {
-
- JDMHost(int id) {
- super(id);
- }
-
- JDMHost(Parser p, int id) {
- super(p, id);
- }
-
- public static Node jjtCreate(int id) {
- return new JDMHost(id);
- }
-
- public static Node jjtCreate(Parser p, int id) {
- return new JDMHost(p, id);
- }
-
-
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMHostInform.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMHostInform.java
deleted file mode 100644
index 7c7a7e6c082..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMHostInform.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* Generated By:JJTree: Do not edit this line. JDMHostInform.java */
-
-package com.sun.jmx.snmp.IPAcl;
-
-class JDMHostInform extends SimpleNode {
- protected String name= "";
-
- JDMHostInform(int id) {
- super(id);
- }
-
- JDMHostInform(Parser p, int id) {
- super(p, id);
- }
-
- public static Node jjtCreate(int id) {
- return new JDMHostInform(id);
- }
-
- public static Node jjtCreate(Parser p, int id) {
- return new JDMHostInform(p, id);
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMHostName.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMHostName.java
deleted file mode 100644
index e51ab02d7fb..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMHostName.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/* Generated By:JJTree: Do not edit this line. JDMHostName.java */
-
-package com.sun.jmx.snmp.IPAcl;
-
-import java.net.UnknownHostException;
-
-class JDMHostName extends Host {
- private static final long serialVersionUID = -9120082068923591122L;
-
- protected StringBuffer name = new StringBuffer();
-
- JDMHostName(int id) {
- super(id);
- }
-
- JDMHostName(Parser p, int id) {
- super(p, id);
- }
-
- public static Node jjtCreate(int id) {
- return new JDMHostName(id);
- }
-
- public static Node jjtCreate(Parser p, int id) {
- return new JDMHostName(p, id);
- }
-
- protected String getHname() {
- return name.toString();
- }
-
- protected PrincipalImpl createAssociatedPrincipal()
- throws UnknownHostException {
- return new PrincipalImpl(name.toString());
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMHostTrap.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMHostTrap.java
deleted file mode 100644
index f5163922101..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMHostTrap.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/* Generated By:JJTree: Do not edit this line. JDMHostTrap.java */
-
-package com.sun.jmx.snmp.IPAcl;
-
-class JDMHostTrap extends SimpleNode {
- protected String name= "";
-
- JDMHostTrap(int id) {
- super(id);
- }
-
- JDMHostTrap(Parser p, int id) {
- super(p, id);
- }
-
- public static Node jjtCreate(int id) {
- return new JDMHostTrap(id);
- }
-
- public static Node jjtCreate(Parser p, int id) {
- return new JDMHostTrap(p, id);
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMInformBlock.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMInformBlock.java
deleted file mode 100644
index 10390f05ef4..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMInformBlock.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* Generated By:JJTree: Do not edit this line. JDMInformBlock.java */
-
-package com.sun.jmx.snmp.IPAcl;
-
-import java.net.InetAddress;
-import java.util.Hashtable;
-import java.util.Vector;
-
-class JDMInformBlock extends SimpleNode {
- JDMInformBlock(int id) {
- super(id);
- }
-
- JDMInformBlock(Parser p, int id) {
- super(p, id);
- }
-
- public static Node jjtCreate(int id) {
- return new JDMInformBlock(id);
- }
-
- public static Node jjtCreate(Parser p, int id) {
- return new JDMInformBlock(p, id);
- }
-
- /**
- * Do no need to go through this part of the tree for
- * building AclEntry.
- */
- @Override
- public void buildAclEntries(PrincipalImpl owner, AclImpl acl) {}
-
- /**
- * Do no need to go through this part of the tree for
- * building TrapEntry.
- */
- @Override
- public void buildTrapEntries(Hashtable> dest) {}
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMInformCommunity.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMInformCommunity.java
deleted file mode 100644
index a8058468685..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMInformCommunity.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* Generated By:JJTree: Do not edit this line. JDMInformCommunity.java */
-
-package com.sun.jmx.snmp.IPAcl;
-
-class JDMInformCommunity extends SimpleNode {
- protected String community= "";
- JDMInformCommunity(int id) {
- super(id);
- }
-
- JDMInformCommunity(Parser p, int id) {
- super(p, id);
- }
-
- public static Node jjtCreate(int id) {
- return new JDMInformCommunity(id);
- }
-
- public static Node jjtCreate(Parser p, int id) {
- return new JDMInformCommunity(p, id);
- }
-
- public String getCommunity() {
- return community;
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMInformInterestedHost.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMInformInterestedHost.java
deleted file mode 100644
index 9ad2a849ad3..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMInformInterestedHost.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* Generated By:JJTree: Do not edit this line. JDMInformInterestedHost.java */
-
-package com.sun.jmx.snmp.IPAcl;
-
-class JDMInformInterestedHost extends SimpleNode {
- JDMInformInterestedHost(int id) {
- super(id);
- }
-
- JDMInformInterestedHost(Parser p, int id) {
- super(p, id);
- }
-
- public static Node jjtCreate(int id) {
- return new JDMInformInterestedHost(id);
- }
-
- public static Node jjtCreate(Parser p, int id) {
- return new JDMInformInterestedHost(p, id);
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMInformItem.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMInformItem.java
deleted file mode 100644
index 03d068f40b9..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMInformItem.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* Generated By:JJTree: Do not edit this line. JDMInformItem.java */
-
-package com.sun.jmx.snmp.IPAcl;
-
-class JDMInformItem extends SimpleNode {
- protected JDMInformCommunity comm = null;
- JDMInformItem(int id) {
- super(id);
- }
-
- JDMInformItem(Parser p, int id) {
- super(p, id);
- }
-
- public static Node jjtCreate(int id) {
- return new JDMInformItem(id);
- }
-
- public static Node jjtCreate(Parser p, int id) {
- return new JDMInformItem(p, id);
- }
-
- public JDMInformCommunity getCommunity(){
- return comm;
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMIpAddress.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMIpAddress.java
deleted file mode 100644
index c0caa7cf496..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMIpAddress.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/* Generated By:JJTree: Do not edit this line. JDMIpAddress.java */
-
-package com.sun.jmx.snmp.IPAcl;
-
-import java.lang.StringBuffer;
-import java.net.UnknownHostException;
-
-class JDMIpAddress extends Host {
- private static final long serialVersionUID = 849729919486384484L;
-
- protected StringBuffer address= new StringBuffer();
-
- JDMIpAddress(int id) {
- super(id);
- }
-
- JDMIpAddress(Parser p, int id) {
- super(p, id);
- }
-
- public static Node jjtCreate(int id) {
- return new JDMIpAddress(id);
- }
-
- public static Node jjtCreate(Parser p, int id) {
- return new JDMIpAddress(p, id);
- }
-
- protected String getHname() {
- return address.toString();
- }
-
- protected PrincipalImpl createAssociatedPrincipal()
- throws UnknownHostException {
- return new PrincipalImpl(address.toString());
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMIpMask.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMIpMask.java
deleted file mode 100644
index fb6197e95a7..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMIpMask.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/* Generated By:JJTree: Do not edit this line. JDMIpMask.java */
-
-package com.sun.jmx.snmp.IPAcl;
-
-import java.lang.StringBuffer;
-import java.net.UnknownHostException;
-
-class JDMIpMask extends Host {
- private static final long serialVersionUID = -8211312690652331386L;
-
- protected StringBuffer address= new StringBuffer();
-
- JDMIpMask(int id) {
- super(id);
- }
-
- JDMIpMask(Parser p, int id) {
- super(p, id);
- }
-
- public static Node jjtCreate(int id) {
- return new JDMIpMask(id);
- }
-
- public static Node jjtCreate(Parser p, int id) {
- return new JDMIpMask(p, id);
- }
-
- protected String getHname() {
- return address.toString();
- }
-
- protected PrincipalImpl createAssociatedPrincipal()
- throws UnknownHostException {
- return new GroupImpl(address.toString());
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMIpV6Address.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMIpV6Address.java
deleted file mode 100644
index d072a5473f9..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMIpV6Address.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* Generated By:JJTree: Do not edit this line. JDMIpV6Address.java */
-
-package com.sun.jmx.snmp.IPAcl;
-
-class JDMIpV6Address extends JDMIpAddress {
- private static final long serialVersionUID = -5929917334606674243L;
-
- public JDMIpV6Address(int id) {
- super(id);
- }
-
- public JDMIpV6Address(Parser p, int id) {
- super(p, id);
- }
-
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMManagers.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMManagers.java
deleted file mode 100644
index 5b07c0895f3..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMManagers.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/* Generated By:JJTree: Do not edit this line. JDMManagers.java */
-
-package com.sun.jmx.snmp.IPAcl;
-
-class JDMManagers extends SimpleNode {
- JDMManagers(int id) {
- super(id);
- }
-
- JDMManagers(Parser p, int id) {
- super(p, id);
- }
-
- public static Node jjtCreate(int id) {
- return new JDMManagers(id);
- }
-
- public static Node jjtCreate(Parser p, int id) {
- return new JDMManagers(p, id);
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMNetMask.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMNetMask.java
deleted file mode 100644
index fa790b7540c..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMNetMask.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/* Generated By:JJTree: Do not edit this line. JDMNetMask.java */
-
-package com.sun.jmx.snmp.IPAcl;
-import java.net.UnknownHostException;
-
-class JDMNetMask extends Host {
- private static final long serialVersionUID = -1979318280250821787L;
-
- protected StringBuffer address= new StringBuffer();
- protected String mask = null;
- public JDMNetMask(int id) {
- super(id);
- }
-
- public JDMNetMask(Parser p, int id) {
- super(p, id);
- }
-public static Node jjtCreate(int id) {
- return new JDMNetMask(id);
- }
-
- public static Node jjtCreate(Parser p, int id) {
- return new JDMNetMask(p, id);
- }
-
- protected String getHname() {
- return address.toString();
- }
-
- protected PrincipalImpl createAssociatedPrincipal()
- throws UnknownHostException {
- return new NetMaskImpl(address.toString(), Integer.parseInt(mask));
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMNetMaskV6.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMNetMaskV6.java
deleted file mode 100644
index e0857b1fad2..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMNetMaskV6.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* Generated By:JJTree: Do not edit this line. JDMNetMaskV6.java */
-
-package com.sun.jmx.snmp.IPAcl;
-
-import java.net.UnknownHostException;
-
-class JDMNetMaskV6 extends JDMNetMask {
- private static final long serialVersionUID = 4505256777680576645L;
-
- public JDMNetMaskV6(int id) {
- super(id);
- }
-
- public JDMNetMaskV6(Parser p, int id) {
- super(p, id);
- }
- protected PrincipalImpl createAssociatedPrincipal()
- throws UnknownHostException {
- return new NetMaskImpl(address.toString(), Integer.parseInt(mask));
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMSecurityDefs.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMSecurityDefs.java
deleted file mode 100644
index 727b29b47be..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMSecurityDefs.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/* Generated By:JJTree: Do not edit this line. JDMSecurityDefs.java */
-
-package com.sun.jmx.snmp.IPAcl;
-
-class JDMSecurityDefs extends SimpleNode {
- JDMSecurityDefs(int id) {
- super(id);
- }
-
- JDMSecurityDefs(Parser p, int id) {
- super(p, id);
- }
-
- public static Node jjtCreate(int id) {
- return new JDMSecurityDefs(id);
- }
-
- public static Node jjtCreate(Parser p, int id) {
- return new JDMSecurityDefs(p, id);
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMTrapBlock.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMTrapBlock.java
deleted file mode 100644
index 5801d390984..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMTrapBlock.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/* Generated By:JJTree: Do not edit this line. JDMTrapBlock.java */
-
-package com.sun.jmx.snmp.IPAcl;
-
-import java.net.InetAddress;
-import java.util.Hashtable;
-import java.util.Vector;
-
-class JDMTrapBlock extends SimpleNode {
- JDMTrapBlock(int id) {
- super(id);
- }
-
- JDMTrapBlock(Parser p, int id) {
- super(p, id);
- }
-
- public static Node jjtCreate(int id) {
- return new JDMTrapBlock(id);
- }
-
- public static Node jjtCreate(Parser p, int id) {
- return new JDMTrapBlock(p, id);
- }
-
- /**
- * Do no need to go through this part of the tree for
- * building AclEntry.
- */
- @Override
- public void buildAclEntries(PrincipalImpl owner, AclImpl acl) {}
-
- /**
- * Do no need to go through this part of the tree for
- * building InformEntry.
- */
- @Override
- public void buildInformEntries(Hashtable> dest) {}
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMTrapCommunity.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMTrapCommunity.java
deleted file mode 100644
index 82cc8e14625..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMTrapCommunity.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/* Generated By:JJTree: Do not edit this line. JDMTrapCommunity.java */
-
-package com.sun.jmx.snmp.IPAcl;
-
-class JDMTrapCommunity extends SimpleNode {
- protected String community= "";
- JDMTrapCommunity(int id) {
- super(id);
- }
-
- JDMTrapCommunity(Parser p, int id) {
- super(p, id);
- }
-
- public static Node jjtCreate(int id) {
- return new JDMTrapCommunity(id);
- }
-
- public static Node jjtCreate(Parser p, int id) {
- return new JDMTrapCommunity(p, id);
- }
-
- public String getCommunity() {
- return community;
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMTrapInterestedHost.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMTrapInterestedHost.java
deleted file mode 100644
index 1ca4eebd644..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMTrapInterestedHost.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/* Generated By:JJTree: Do not edit this line. JDMTrapInterestedHost.java */
-
-package com.sun.jmx.snmp.IPAcl;
-
-class JDMTrapInterestedHost extends SimpleNode {
- JDMTrapInterestedHost(int id) {
- super(id);
- }
-
- JDMTrapInterestedHost(Parser p, int id) {
- super(p, id);
- }
-
- public static Node jjtCreate(int id) {
- return new JDMTrapInterestedHost(id);
- }
-
- public static Node jjtCreate(Parser p, int id) {
- return new JDMTrapInterestedHost(p, id);
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMTrapItem.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMTrapItem.java
deleted file mode 100644
index f7379fe9ddd..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMTrapItem.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/* Generated By:JJTree: Do not edit this line. JDMTrapItem.java */
-
-package com.sun.jmx.snmp.IPAcl;
-
-class JDMTrapItem extends SimpleNode {
- protected JDMTrapCommunity comm = null;
-
- JDMTrapItem(int id) {
- super(id);
- }
-
- JDMTrapItem(Parser p, int id) {
- super(p, id);
- }
-
- public static Node jjtCreate(int id) {
- return new JDMTrapItem(id);
- }
-
- public static Node jjtCreate(Parser p, int id) {
- return new JDMTrapItem(p, id);
- }
-
- public JDMTrapCommunity getCommunity(){
- return comm;
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMTrapNum.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMTrapNum.java
deleted file mode 100644
index 1b38ecdc893..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JDMTrapNum.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/* Generated By:JJTree: Do not edit this line. JDMTrapNum.java */
-
-package com.sun.jmx.snmp.IPAcl;
-
-class JDMTrapNum extends SimpleNode {
- protected int low=0;
- protected int high=0;
-
- JDMTrapNum(int id) {
- super(id);
- }
-
- JDMTrapNum(Parser p, int id) {
- super(p, id);
- }
-
- public static Node jjtCreate(int id) {
- return new JDMTrapNum(id);
- }
-
- public static Node jjtCreate(Parser p, int id) {
- return new JDMTrapNum(p, id);
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JJTParserState.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JJTParserState.java
deleted file mode 100644
index ea457515d05..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/JJTParserState.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* Generated By:JJTree: Do not edit this line. JJTParserState.java */
-
-package com.sun.jmx.snmp.IPAcl;
-
-class JJTParserState {
- private java.util.Stack nodes;
- private java.util.Stack marks;
-
- private int sp; // number of nodes on stack
- private int mk; // current mark
- private boolean node_created;
-
- JJTParserState() {
- nodes = new java.util.Stack<>();
- marks = new java.util.Stack<>();
- sp = 0;
- mk = 0;
- }
-
- /* Determines whether the current node was actually closed and
- pushed. This should only be called in the final user action of a
- node scope. */
- boolean nodeCreated() {
- return node_created;
- }
-
- /* Call this to reinitialize the node stack. It is called
- automatically by the parser's ReInit() method. */
- void reset() {
- nodes.removeAllElements();
- marks.removeAllElements();
- sp = 0;
- mk = 0;
- }
-
- /* Returns the root node of the AST. It only makes sense to call
- this after a successful parse. */
- Node rootNode() {
- return nodes.elementAt(0);
- }
-
- /* Pushes a node on to the stack. */
- void pushNode(Node n) {
- nodes.push(n);
- ++sp;
- }
-
- /* Returns the node on the top of the stack, and remove it from the
- stack. */
- Node popNode() {
- if (--sp < mk) {
- mk = marks.pop().intValue();
- }
- return nodes.pop();
- }
-
- /* Returns the node currently on the top of the stack. */
- Node peekNode() {
- return nodes.peek();
- }
-
- /* Returns the number of children on the stack in the current node
- scope. */
- int nodeArity() {
- return sp - mk;
- }
-
-
- void clearNodeScope(Node n) {
- while (sp > mk) {
- popNode();
- }
- mk = marks.pop().intValue();
- }
-
-
- void openNodeScope(Node n) {
- marks.push(mk);
- mk = sp;
- n.jjtOpen();
- }
-
-
- /* A definite node is constructed from a specified number of
- children. That number of nodes are popped from the stack and
- made the children of the definite node. Then the definite node
- is pushed on to the stack. */
- void closeNodeScope(Node n, int num) {
- mk = marks.pop().intValue();
- while (num-- > 0) {
- Node c = popNode();
- c.jjtSetParent(n);
- n.jjtAddChild(c, num);
- }
- n.jjtClose();
- pushNode(n);
- node_created = true;
- }
-
-
- /* A conditional node is constructed if its condition is true. All
- the nodes that have been pushed since the node was opened are
- made children of the the conditional node, which is then pushed
- on to the stack. If the condition is false the node is not
- constructed and they are left on the stack. */
- void closeNodeScope(Node n, boolean condition) {
- if (condition) {
- int a = nodeArity();
- mk = marks.pop().intValue();
- while (a-- > 0) {
- Node c = popNode();
- c.jjtSetParent(n);
- n.jjtAddChild(c, a);
- }
- n.jjtClose();
- pushNode(n);
- node_created = true;
- } else {
- mk = marks.pop().intValue();
- node_created = false;
- }
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/NetMaskImpl.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/NetMaskImpl.java
deleted file mode 100644
index 9606c020266..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/NetMaskImpl.java
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
- * Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.jmx.snmp.IPAcl;
-
-import static com.sun.jmx.defaults.JmxProperties.SNMP_LOGGER;
-
-import java.util.logging.Level;
-import java.util.Vector;
-import java.util.Enumeration;
-import java.io.Serializable;
-import java.net.UnknownHostException;
-import java.net.InetAddress;
-
-import java.security.Principal;
-import java.security.acl.Group;
-
-
-/**
- * This class is used to represent a subnet mask (a group of hosts matching the same
- * IP mask).
- *
- * @see java.security.acl.Group
- */
-
-class NetMaskImpl extends PrincipalImpl implements Group, Serializable {
- private static final long serialVersionUID = -7332541893877932896L;
-
- protected byte[] subnet = null;
- protected int prefix = -1;
- /**
- * Constructs an empty group.
- * @exception UnknownHostException Not implemented
- */
- public NetMaskImpl () throws UnknownHostException {
- }
-
- private byte[] extractSubNet(byte[] b) {
- int addrLength = b.length;
- byte[] subnet = null;
- if (SNMP_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_LOGGER.logp(Level.FINEST, NetMaskImpl.class.getName(),
- "extractSubNet", "BINARY ARRAY :");
- StringBuilder sb = new StringBuilder();
- for(int i =0; i < addrLength; i++) {
- sb.append((b[i] & 0xFF) + ":");
- }
- SNMP_LOGGER.logp(Level.FINEST, NetMaskImpl.class.getName(),
- "extractSubNet", sb.toString());
- }
-
- // 8 is a byte size. Common to any InetAddress (V4 or V6).
- int fullyCoveredByte = prefix / 8;
- if(fullyCoveredByte == addrLength) {
- if (SNMP_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_LOGGER.logp(Level.FINEST, NetMaskImpl.class.getName(), "extractSubNet",
- "The mask is the complete address, strange..." + addrLength);
- }
- subnet = b;
- return subnet;
- }
- if(fullyCoveredByte > addrLength) {
- if (SNMP_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_LOGGER.logp(Level.FINEST, NetMaskImpl.class.getName(), "extractSubNet",
- "The number of covered byte is longer than the address. BUG");
- }
- throw new IllegalArgumentException("The number of covered byte is longer than the address.");
- }
- int partialyCoveredIndex = fullyCoveredByte;
- if (SNMP_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_LOGGER.logp(Level.FINEST, NetMaskImpl.class.getName(), "extractSubNet",
- "Partially covered index : " + partialyCoveredIndex);
- }
- byte toDeal = b[partialyCoveredIndex];
- if (SNMP_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_LOGGER.logp(Level.FINEST, NetMaskImpl.class.getName(), "extractSubNet",
- "Partially covered byte : " + toDeal);
- }
-
- // 8 is a byte size. Common to any InetAddress (V4 or V6).
- int nbbits = prefix % 8;
- int subnetSize = 0;
-
- if(nbbits == 0)
- subnetSize = partialyCoveredIndex;
- else
- subnetSize = partialyCoveredIndex + 1;
-
- if (SNMP_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_LOGGER.logp(Level.FINEST, NetMaskImpl.class.getName(), "extractSubNet",
- "Remains : " + nbbits);
- }
-
- byte mask = 0;
- for(int i = 0; i < nbbits; i++) {
- mask |= (1 << (7 - i));
- }
- if (SNMP_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_LOGGER.logp(Level.FINEST, NetMaskImpl.class.getName(), "extractSubNet",
- "Mask value : " + (mask & 0xFF));
- }
-
- byte maskedValue = (byte) ((int)toDeal & (int)mask);
-
- if (SNMP_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_LOGGER.logp(Level.FINEST, NetMaskImpl.class.getName(), "extractSubNet",
- "Masked byte : " + (maskedValue &0xFF));
- }
- subnet = new byte[subnetSize];
- if (SNMP_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_LOGGER.logp(Level.FINEST, NetMaskImpl.class.getName(), "extractSubNet",
- "Resulting subnet : ");
- }
- for(int i = 0; i < partialyCoveredIndex; i++) {
- subnet[i] = b[i];
-
- if (SNMP_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_LOGGER.logp(Level.FINEST, NetMaskImpl.class.getName(), "extractSubNet",
- (subnet[i] & 0xFF) +":");
- }
- }
-
- if(nbbits != 0) {
- subnet[partialyCoveredIndex] = maskedValue;
- if (SNMP_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_LOGGER.logp(Level.FINEST, NetMaskImpl.class.getName(), "extractSubNet",
- "Last subnet byte : " + (subnet[partialyCoveredIndex] &0xFF));
- }
- }
- return subnet;
- }
-
- /**
- * Constructs a group using the specified subnet mask.
- * THIS ALGORITHM IS V4 and V6 compatible.
- *
- * @exception UnknownHostException if the subnet mask cann't be built.
- */
- public NetMaskImpl (String a, int prefix) throws UnknownHostException {
- super(a);
- this.prefix = prefix;
- subnet = extractSubNet(getAddress().getAddress());
- }
-
- /**
- * Adds the specified member to the group.
- *
- * @param p the principal to add to this group.
- * @return true if the member was successfully added, false if the
- * principal was already a member.
- */
- public boolean addMember(Principal p) {
- // we don't need to add members because the ip address is a subnet mask
- return true;
- }
-
- public int hashCode() {
- return super.hashCode();
- }
-
- /**
- * Compares this group to the specified object. Returns true if the object
- * passed in matches the group represented.
- *
- * @param p the object to compare with.
- * @return true if the object passed in matches the subnet mask,
- * false otherwise.
- */
- public boolean equals (Object p) {
- if (p instanceof PrincipalImpl || p instanceof NetMaskImpl){
- PrincipalImpl received = (PrincipalImpl) p;
- InetAddress addr = received.getAddress();
- if (SNMP_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_LOGGER.logp(Level.FINEST, NetMaskImpl.class.getName(), "equals",
- "Received Address : " + addr);
- }
- byte[] recAddr = addr.getAddress();
- for(int i = 0; i < subnet.length; i++) {
- if (SNMP_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_LOGGER.logp(Level.FINEST, NetMaskImpl.class.getName(), "equals",
- "(recAddr[i]) : " + (recAddr[i] & 0xFF));
- SNMP_LOGGER.logp(Level.FINEST, NetMaskImpl.class.getName(), "equals",
- "(recAddr[i] & subnet[i]) : " +
- ((recAddr[i] & (int)subnet[i]) &0xFF) +
- " subnet[i] : " + (subnet[i] &0xFF));
- }
- if((recAddr[i] & subnet[i]) != subnet[i]) {
- if (SNMP_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_LOGGER.logp(Level.FINEST, NetMaskImpl.class.getName(), "equals",
- "FALSE");
- }
- return false;
- }
- }
- if (SNMP_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_LOGGER.logp(Level.FINEST, NetMaskImpl.class.getName(), "equals",
- "TRUE");
- }
- return true;
- } else
- return false;
- }
- /**
- * Returns true if the passed principal is a member of the group.
- *
- * @param p the principal whose membership is to be checked.
- * @return true if the principal is a member of this group, false otherwise.
- */
- public boolean isMember(Principal p) {
- if ((p.hashCode() & super.hashCode()) == p.hashCode()) return true;
- else return false;
- }
-
- /**
- * Returns an enumeration which contains the subnet mask.
- *
- * @return an enumeration which contains the subnet mask.
- */
- public Enumeration extends Principal> members(){
- Vector v = new Vector(1);
- v.addElement(this);
- return v.elements();
- }
-
- /**
- * Removes the specified member from the group. (Not implemented)
- *
- * @param p the principal to remove from this group.
- * @return allways return true.
- */
- public boolean removeMember(Principal p) {
- return true;
- }
-
- /**
- * Prints a string representation of this group.
- *
- * @return a string representation of this group.
- */
- public String toString() {
- return ("NetMaskImpl :"+ super.getAddress().toString() + "/" + prefix);
- }
-
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/Node.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/Node.java
deleted file mode 100644
index fa0d2159731..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/Node.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/* Generated By:JJTree: Do not edit this line. Node.java */
-
-package com.sun.jmx.snmp.IPAcl;
-
-/* All AST nodes must implement this interface. It provides basic
- machinery for constructing the parent and child relationships
- between nodes. */
-
-interface Node {
-
- /** This method is called after the node has been made the current
- node. It indicates that child nodes can now be added to it. */
- public void jjtOpen();
-
- /** This method is called after all the child nodes have been
- added. */
- public void jjtClose();
-
- /** This pair of methods are used to inform the node of its
- parent. */
- public void jjtSetParent(Node n);
- public Node jjtGetParent();
-
- /** This method tells the node to add its argument to the node's
- list of children. */
- public void jjtAddChild(Node n, int i);
-
- /** This method returns a child node. The children are numbered
- from zero, left to right. */
- public Node jjtGetChild(int i);
-
- /** Return the number of children the node has. */
- public int jjtGetNumChildren();
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/OwnerImpl.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/OwnerImpl.java
deleted file mode 100644
index d72b973390e..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/OwnerImpl.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package com.sun.jmx.snmp.IPAcl;
-
-
-
-import java.util.Vector;
-import java.io.Serializable;
-
-import java.security.Principal;
-import java.security.acl.Owner;
-import java.security.acl.LastOwnerException;
-import java.security.acl.NotOwnerException;
-
-
-/**
- * Owner of Access Control Lists (ACLs).
- * The initial owner Principal should be specified as an
- * argument to the constructor of the class AclImpl.
- *
- * @see java.security.acl.Owner
- */
-
-class OwnerImpl implements Owner, Serializable {
- private static final long serialVersionUID = -576066072046319874L;
-
- private Vector ownerList = null;
-
- /**
- * Constructs an empty list of owner.
- */
- public OwnerImpl (){
- ownerList = new Vector();
- }
-
- /**
- * Constructs a list of owner with the specified principal as first element.
- *
- * @param owner the principal added to the owner list.
- */
- public OwnerImpl (PrincipalImpl owner){
- ownerList = new Vector();
- ownerList.addElement(owner);
- }
-
- /**
- * Adds an owner. Only owners can modify ACL contents. The caller principal
- * must be an owner of the ACL in order to invoke this method. That is, only
- * an owner can add another owner. The initial owner is configured at
- * ACL construction time.
- *
- * @param caller the principal invoking this method.
- * It must be an owner of the ACL.
- * @param owner the owner that should be added to the list of owners.
- * @return true if successful, false if owner is already an owner.
- * @exception NotOwnerException if the caller principal is not an owner
- * of the ACL.
- */
- public boolean addOwner(Principal caller, Principal owner)
- throws NotOwnerException {
- if (!ownerList.contains(caller))
- throw new NotOwnerException();
-
- if (ownerList.contains(owner)) {
- return false;
- } else {
- ownerList.addElement(owner);
- return true;
- }
- }
-
- /**
- * Deletes an owner. If this is the last owner in the ACL, an exception is raised.
- *
- * The caller principal must be an owner of the ACL in order to invoke this method.
- *
- * @param caller the principal invoking this method. It must be an owner
- * of the ACL.
- * @param owner the owner to be removed from the list of owners.
- * @return true if successful, false if owner is already an owner.
- * @exception NotOwnerException if the caller principal is not an owner
- * of the ACL.
- * @exception LastOwnerException if there is only one owner left, so that
- * deleteOwner would leave the ACL owner-less.
- */
- public boolean deleteOwner(Principal caller, Principal owner)
- throws NotOwnerException,LastOwnerException {
-
- if (!ownerList.contains(caller))
- throw new NotOwnerException();
-
- if (!ownerList.contains(owner)){
- return false;
- } else {
- if (ownerList.size() == 1)
- throw new LastOwnerException();
-
- ownerList.removeElement(owner);
- return true;
- }
- }
-
- /**
- * Returns true if the given principal is an owner of the ACL.
- *
- * @param owner the principal to be checked to determine whether or
- * not it is an owner.
- * @return true if the given principal is an owner of the ACL.
- */
- public boolean isOwner(Principal owner){
- return ownerList.contains(owner);
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/ParseError.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/ParseError.java
deleted file mode 100644
index 230d4d3d238..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/ParseError.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/* Generated By:JavaCC: Do not edit this line. ParseError.java Version 0.7pre1 */
-package com.sun.jmx.snmp.IPAcl;
-
-class ParseError extends Exception {
- private static final long serialVersionUID = 4907307342076722310L;
-
- public ParseError() {
- }
- public ParseError(String message) {
- super(message);
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/ParseException.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/ParseException.java
deleted file mode 100644
index 78be1da103b..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/ParseException.java
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 0.7pre6 */
-package com.sun.jmx.snmp.IPAcl;
-
-/**
- * This exception is thrown when parse errors are encountered.
- * You can explicitly create objects of this exception type by
- * calling the method generateParseException in the generated
- * parser.
- *
- * You can modify this class to customize your error reporting
- * mechanisms so long as you retain the public fields.
- */
-class ParseException extends Exception {
- private static final long serialVersionUID = -3695190720704845876L;
-
- /**
- * This constructor is used by the method "generateParseException"
- * in the generated parser. Calling this constructor generates
- * a new object of this type with the fields "currentToken",
- * "expectedTokenSequences", and "tokenImage" set. The boolean
- * flag "specialConstructor" is also set to true to indicate that
- * this constructor was used to create this object.
- * This constructor calls its super class with the empty string
- * to force the "toString" method of parent class "Throwable" to
- * print the error message in the form:
- * ParseException:
- */
- public ParseException(Token currentTokenVal,
- int[][] expectedTokenSequencesVal,
- String[] tokenImageVal
- )
- {
- super("");
- specialConstructor = true;
- currentToken = currentTokenVal;
- expectedTokenSequences = expectedTokenSequencesVal;
- tokenImage = tokenImageVal;
- }
-
- /**
- * The following constructors are for use by you for whatever
- * purpose you can think of. Constructing the exception in this
- * manner makes the exception behave in the normal way - i.e., as
- * documented in the class "Throwable". The fields "errorToken",
- * "expectedTokenSequences", and "tokenImage" do not contain
- * relevant information. The JavaCC generated code does not use
- * these constructors.
- */
-
- public ParseException() {
- super();
- specialConstructor = false;
- }
-
- public ParseException(String message) {
- super(message);
- specialConstructor = false;
- }
-
- /**
- * This variable determines which constructor was used to create
- * this object and thereby affects the semantics of the
- * "getMessage" method (see below).
- */
- protected boolean specialConstructor;
-
- /**
- * This is the last token that has been consumed successfully. If
- * this object has been created due to a parse error, the token
- * followng this token will (therefore) be the first error token.
- */
- public Token currentToken;
-
- /**
- * Each entry in this array is an array of integers. Each array
- * of integers represents a sequence of tokens (by their ordinal
- * values) that is expected at this point of the parse.
- */
- public int[][] expectedTokenSequences;
-
- /**
- * This is a reference to the "tokenImage" array of the generated
- * parser within which the parse error occurred. This array is
- * defined in the generated ...Constants interface.
- */
- public String[] tokenImage;
-
- /**
- * This method has the standard behavior when this object has been
- * created using the standard constructors. Otherwise, it uses
- * "currentToken" and "expectedTokenSequences" to generate a parse
- * error message and returns it. If this object has been created
- * due to a parse error, and you do not catch it (it gets thrown
- * from the parser), then this method is called during the printing
- * of the final stack trace, and hence the correct error message
- * gets displayed.
- */
- public String getMessage() {
- if (!specialConstructor) {
- return super.getMessage();
- }
- String expected = "";
- int maxSize = 0;
- for (int i = 0; i < expectedTokenSequences.length; i++) {
- if (maxSize < expectedTokenSequences[i].length) {
- maxSize = expectedTokenSequences[i].length;
- }
- for (int j = 0; j < expectedTokenSequences[i].length; j++) {
- expected += tokenImage[expectedTokenSequences[i][j]] + " ";
- }
- if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) {
- expected += "...";
- }
- expected += eol + " ";
- }
- String retval = "Encountered \"";
- Token tok = currentToken.next;
- for (int i = 0; i < maxSize; i++) {
- if (i != 0) retval += " ";
- if (tok.kind == 0) {
- retval += tokenImage[0];
- break;
- }
- retval += add_escapes(tok.image);
- tok = tok.next;
- }
- retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn + "." + eol;
- if (expectedTokenSequences.length == 1) {
- retval += "Was expecting:" + eol + " ";
- } else {
- retval += "Was expecting one of:" + eol + " ";
- }
- retval += expected;
- return retval;
- }
-
- /**
- * The end of line string for this machine.
- */
- protected String eol = System.getProperty("line.separator", "\n");
-
- /**
- * Used to convert raw characters to their escaped version
- * when these raw version cannot be used as part of an ASCII
- * string literal.
- */
- protected String add_escapes(String str) {
- StringBuilder retval = new StringBuilder();
- char ch;
- for (int i = 0; i < str.length(); i++) {
- switch (str.charAt(i))
- {
- case 0 :
- continue;
- case '\b':
- retval.append("\\b");
- continue;
- case '\t':
- retval.append("\\t");
- continue;
- case '\n':
- retval.append("\\n");
- continue;
- case '\f':
- retval.append("\\f");
- continue;
- case '\r':
- retval.append("\\r");
- continue;
- case '\"':
- retval.append("\\\"");
- continue;
- case '\'':
- retval.append("\\\'");
- continue;
- case '\\':
- retval.append("\\\\");
- continue;
- default:
- if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
- String s = "0000" + Integer.toString(ch, 16);
- retval.append("\\u" + s.substring(s.length() - 4, s.length()));
- } else {
- retval.append(ch);
- }
- continue;
- }
- }
- return retval.toString();
- }
-
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/Parser.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/Parser.java
deleted file mode 100644
index bf1041b3bd1..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/Parser.java
+++ /dev/null
@@ -1,1285 +0,0 @@
-/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* Generated By:JJTree&JavaCC: Do not edit this line. Parser.java */
-package com.sun.jmx.snmp.IPAcl;
-
-import java.io.*;
-
-@SuppressWarnings("unchecked") // generated code, not worth fixing
-class Parser/*@bgen(jjtree)*/implements ParserTreeConstants, ParserConstants {/*@bgen(jjtree)*/
- protected JJTParserState jjtree = new JJTParserState();
-
-// A file can contain several acl definitions
-//
- final public JDMSecurityDefs SecurityDefs() throws ParseException {
- /*@bgen(jjtree) SecurityDefs */
- JDMSecurityDefs jjtn000 = new JDMSecurityDefs(JJTSECURITYDEFS);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
- try {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case ACL:
- AclBlock();
- break;
- default:
- jj_la1[0] = jj_gen;
- ;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case TRAP:
- TrapBlock();
- break;
- default:
- jj_la1[1] = jj_gen;
- ;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case INFORM:
- InformBlock();
- break;
- default:
- jj_la1[2] = jj_gen;
- ;
- }
- jj_consume_token(0);
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- {if (true) return jjtn000;}
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- {if (true) throw (RuntimeException)jjte000;}
- }
- if (jjte000 instanceof ParseException) {
- {if (true) throw (ParseException)jjte000;}
- }
- {if (true) throw (Error)jjte000;}
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
- }
- throw new Error("Missing return statement in function");
- }
-
- final public void AclBlock() throws ParseException {
- /*@bgen(jjtree) AclBlock */
- JDMAclBlock jjtn000 = new JDMAclBlock(JJTACLBLOCK);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
- try {
- jj_consume_token(ACL);
- jj_consume_token(ASSIGN);
- jj_consume_token(LBRACE);
- label_1:
- while (true) {
- AclItem();
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case LBRACE:
- ;
- break;
- default:
- jj_la1[3] = jj_gen;
- break label_1;
- }
- }
- jj_consume_token(RBRACE);
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- {if (true) throw (RuntimeException)jjte000;}
- }
- if (jjte000 instanceof ParseException) {
- {if (true) throw (ParseException)jjte000;}
- }
- {if (true) throw (Error)jjte000;}
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
- }
- }
-
- final public void AclItem() throws ParseException {
- /*@bgen(jjtree) AclItem */
- JDMAclItem jjtn000 = new JDMAclItem(JJTACLITEM);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
- try {
- jj_consume_token(LBRACE);
- jjtn000.com = Communities();
- jjtn000.access = Access();
- Managers();
- jj_consume_token(RBRACE);
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- {if (true) throw (RuntimeException)jjte000;}
- }
- if (jjte000 instanceof ParseException) {
- {if (true) throw (ParseException)jjte000;}
- }
- {if (true) throw (Error)jjte000;}
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
- }
- }
-
- final public JDMCommunities Communities() throws ParseException {
- /*@bgen(jjtree) Communities */
- JDMCommunities jjtn000 = new JDMCommunities(JJTCOMMUNITIES);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
- try {
- jj_consume_token(COMMUNITIES);
- jj_consume_token(ASSIGN);
- Community();
- label_2:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case COMMA:
- ;
- break;
- default:
- jj_la1[4] = jj_gen;
- break label_2;
- }
- jj_consume_token(COMMA);
- Community();
- }
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- {if (true) return jjtn000;}
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- {if (true) throw (RuntimeException)jjte000;}
- }
- if (jjte000 instanceof ParseException) {
- {if (true) throw (ParseException)jjte000;}
- }
- {if (true) throw (Error)jjte000;}
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
- }
- throw new Error("Missing return statement in function");
- }
-
- final public void Community() throws ParseException {
- /*@bgen(jjtree) Community */
- JDMCommunity jjtn000 = new JDMCommunity(JJTCOMMUNITY);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);Token t;
- try {
- t = jj_consume_token(IDENTIFIER);
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- jjtn000.communityString= t.image;
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
- }
- }
-
- final public JDMAccess Access() throws ParseException {
- /*@bgen(jjtree) Access */
- JDMAccess jjtn000 = new JDMAccess(JJTACCESS);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
- try {
- jj_consume_token(ACCESS);
- jj_consume_token(ASSIGN);
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case RO:
- jj_consume_token(RO);
- jjtn000.access= RO;
- break;
- case RW:
- jj_consume_token(RW);
- jjtn000.access= RW;
- break;
- default:
- jj_la1[5] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- {if (true) return jjtn000;}
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
- }
- throw new Error("Missing return statement in function");
- }
-
- final public void Managers() throws ParseException {
- /*@bgen(jjtree) Managers */
- JDMManagers jjtn000 = new JDMManagers(JJTMANAGERS);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
- try {
- jj_consume_token(MANAGERS);
- jj_consume_token(ASSIGN);
- Host();
- label_3:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case COMMA:
- ;
- break;
- default:
- jj_la1[6] = jj_gen;
- break label_3;
- }
- jj_consume_token(COMMA);
- Host();
- }
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- {if (true) throw (RuntimeException)jjte000;}
- }
- if (jjte000 instanceof ParseException) {
- {if (true) throw (ParseException)jjte000;}
- }
- {if (true) throw (Error)jjte000;}
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
- }
- }
-
- final public void Host() throws ParseException {
- /*@bgen(jjtree) Host */
- JDMHost jjtn000 = new JDMHost(JJTHOST);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);Token t;
- try {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IDENTIFIER:
- HostName();
- break;
- default:
- jj_la1[7] = jj_gen;
- if (jj_2_1(2147483647)) {
- NetMask();
- } else if (jj_2_2(2147483647)) {
- NetMaskV6();
- } else if (jj_2_3(2147483647)) {
- IpAddress();
- } else {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case V6_ADDRESS:
- IpV6Address();
- break;
- case INTEGER_LITERAL:
- IpMask();
- break;
- default:
- jj_la1[8] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- }
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- {if (true) throw (RuntimeException)jjte000;}
- }
- if (jjte000 instanceof ParseException) {
- {if (true) throw (ParseException)jjte000;}
- }
- {if (true) throw (Error)jjte000;}
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
- }
- }
-
- final public void HostName() throws ParseException {
- /*@bgen(jjtree) HostName */
- JDMHostName jjtn000 = new JDMHostName(JJTHOSTNAME);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);Token t;
- try {
- t = jj_consume_token(IDENTIFIER);
- jjtn000.name.append(t.image);
- label_4:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case DOT:
- ;
- break;
- default:
- jj_la1[9] = jj_gen;
- break label_4;
- }
- jj_consume_token(DOT);
- t = jj_consume_token(IDENTIFIER);
- jjtn000.name.append( "." + t.image);
- }
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
- }
- }
-
- final public void IpAddress() throws ParseException {
- /*@bgen(jjtree) IpAddress */
-JDMIpAddress jjtn000 = new JDMIpAddress(JJTIPADDRESS);
-boolean jjtc000 = true;
-jjtree.openNodeScope(jjtn000);Token t;
- try {
- t = jj_consume_token(INTEGER_LITERAL);
- jjtn000.address.append(t.image);
- label_5:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case DOT:
- ;
- break;
- default:
- jj_la1[10] = jj_gen;
- break label_5;
- }
- jj_consume_token(DOT);
- t = jj_consume_token(INTEGER_LITERAL);
- jjtn000.address.append( "." + t.image);
- }
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
- }
- }
-
- final public void IpV6Address() throws ParseException {
- /*@bgen(jjtree) IpV6Address */
-JDMIpV6Address jjtn000 = new JDMIpV6Address(JJTIPV6ADDRESS);
-boolean jjtc000 = true;
-jjtree.openNodeScope(jjtn000);Token t;
- try {
- t = jj_consume_token(V6_ADDRESS);
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- jjtn000.address.append(t.image);
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
- }
- }
-
- final public void IpMask() throws ParseException {
- /*@bgen(jjtree) IpMask */
-JDMIpMask jjtn000 = new JDMIpMask(JJTIPMASK);
-boolean jjtc000 = true;
-jjtree.openNodeScope(jjtn000);Token t;
- try {
- t = jj_consume_token(INTEGER_LITERAL);
- jjtn000.address.append(t.image);
- label_6:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case MARK:
- ;
- break;
- default:
- jj_la1[11] = jj_gen;
- break label_6;
- }
- jj_consume_token(MARK);
- t = jj_consume_token(INTEGER_LITERAL);
- jjtn000.address.append( "." + t.image);
- }
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
- }
- }
-
- final public void NetMask() throws ParseException {
- /*@bgen(jjtree) NetMask */
-JDMNetMask jjtn000 = new JDMNetMask(JJTNETMASK);
-boolean jjtc000 = true;
-jjtree.openNodeScope(jjtn000);Token t;
- try {
- t = jj_consume_token(INTEGER_LITERAL);
- jjtn000.address.append(t.image);
- label_7:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case DOT:
- ;
- break;
- default:
- jj_la1[12] = jj_gen;
- break label_7;
- }
- jj_consume_token(DOT);
- t = jj_consume_token(INTEGER_LITERAL);
- jjtn000.address.append( "." + t.image);
- }
- jj_consume_token(MASK);
- t = jj_consume_token(INTEGER_LITERAL);
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- jjtn000.mask = t.image;
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
- }
- }
-
- final public void NetMaskV6() throws ParseException {
- /*@bgen(jjtree) NetMaskV6 */
-JDMNetMaskV6 jjtn000 = new JDMNetMaskV6(JJTNETMASKV6);
-boolean jjtc000 = true;
-jjtree.openNodeScope(jjtn000);Token t;
- try {
- t = jj_consume_token(V6_ADDRESS);
- jjtn000.address.append(t.image);
- jj_consume_token(MASK);
- t = jj_consume_token(INTEGER_LITERAL);
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- jjtn000.mask = t.image;
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
- }
- }
-
- final public void TrapBlock() throws ParseException {
- /*@bgen(jjtree) TrapBlock */
- JDMTrapBlock jjtn000 = new JDMTrapBlock(JJTTRAPBLOCK);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
- try {
- jj_consume_token(TRAP);
- jj_consume_token(ASSIGN);
- jj_consume_token(LBRACE);
- label_8:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case LBRACE:
- ;
- break;
- default:
- jj_la1[13] = jj_gen;
- break label_8;
- }
- TrapItem();
- }
- jj_consume_token(RBRACE);
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- {if (true) throw (RuntimeException)jjte000;}
- }
- if (jjte000 instanceof ParseException) {
- {if (true) throw (ParseException)jjte000;}
- }
- {if (true) throw (Error)jjte000;}
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
- }
- }
-
- final public void TrapItem() throws ParseException {
- /*@bgen(jjtree) TrapItem */
- JDMTrapItem jjtn000 = new JDMTrapItem(JJTTRAPITEM);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
- try {
- jj_consume_token(LBRACE);
- jjtn000.comm = TrapCommunity();
- TrapInterestedHost();
- label_9:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case LBRACE:
- ;
- break;
- default:
- jj_la1[14] = jj_gen;
- break label_9;
- }
- Enterprise();
- }
- jj_consume_token(RBRACE);
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- {if (true) throw (RuntimeException)jjte000;}
- }
- if (jjte000 instanceof ParseException) {
- {if (true) throw (ParseException)jjte000;}
- }
- {if (true) throw (Error)jjte000;}
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
- }
- }
-
- final public JDMTrapCommunity TrapCommunity() throws ParseException {
- /*@bgen(jjtree) TrapCommunity */
- JDMTrapCommunity jjtn000 = new JDMTrapCommunity(JJTTRAPCOMMUNITY);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);Token t;
- try {
- jj_consume_token(TRAPCOMMUNITY);
- jj_consume_token(ASSIGN);
- t = jj_consume_token(IDENTIFIER);
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- jjtn000.community= t.image; {if (true) return jjtn000;}
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
- }
- throw new Error("Missing return statement in function");
- }
-
- final public void TrapInterestedHost() throws ParseException {
- /*@bgen(jjtree) TrapInterestedHost */
- JDMTrapInterestedHost jjtn000 = new JDMTrapInterestedHost(JJTTRAPINTERESTEDHOST);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
- try {
- jj_consume_token(HOSTS);
- jj_consume_token(ASSIGN);
- HostTrap();
- label_10:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case COMMA:
- ;
- break;
- default:
- jj_la1[15] = jj_gen;
- break label_10;
- }
- jj_consume_token(COMMA);
- HostTrap();
- }
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- {if (true) throw (RuntimeException)jjte000;}
- }
- if (jjte000 instanceof ParseException) {
- {if (true) throw (ParseException)jjte000;}
- }
- {if (true) throw (Error)jjte000;}
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
- }
- }
-
- final public void HostTrap() throws ParseException {
- /*@bgen(jjtree) HostTrap */
- JDMHostTrap jjtn000 = new JDMHostTrap(JJTHOSTTRAP);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);Token t;
- try {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IDENTIFIER:
- HostName();
- break;
- case INTEGER_LITERAL:
- IpAddress();
- break;
- case V6_ADDRESS:
- IpV6Address();
- break;
- default:
- jj_la1[16] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- {if (true) throw (RuntimeException)jjte000;}
- }
- if (jjte000 instanceof ParseException) {
- {if (true) throw (ParseException)jjte000;}
- }
- {if (true) throw (Error)jjte000;}
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
- }
- }
-
- final public void Enterprise() throws ParseException {
- /*@bgen(jjtree) Enterprise */
- JDMEnterprise jjtn000 = new JDMEnterprise(JJTENTERPRISE);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);Token t;
- try {
- jj_consume_token(LBRACE);
- jj_consume_token(ENTERPRISE);
- jj_consume_token(ASSIGN);
- t = jj_consume_token(CSTRING);
- jjtn000.enterprise= t.image;
- jj_consume_token(TRAPNUM);
- jj_consume_token(ASSIGN);
- TrapNum();
- label_11:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case COMMA:
- ;
- break;
- default:
- jj_la1[17] = jj_gen;
- break label_11;
- }
- jj_consume_token(COMMA);
- TrapNum();
- }
- jj_consume_token(RBRACE);
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- {if (true) throw (RuntimeException)jjte000;}
- }
- if (jjte000 instanceof ParseException) {
- {if (true) throw (ParseException)jjte000;}
- }
- {if (true) throw (Error)jjte000;}
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
- }
- }
-
- final public void TrapNum() throws ParseException {
- /*@bgen(jjtree) TrapNum */
- JDMTrapNum jjtn000 = new JDMTrapNum(JJTTRAPNUM);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);Token t;
- try {
- t = jj_consume_token(INTEGER_LITERAL);
- jjtn000.low= Integer.parseInt(t.image);
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case RANGE:
- jj_consume_token(RANGE);
- t = jj_consume_token(INTEGER_LITERAL);
- jjtn000.high= Integer.parseInt(t.image);
- break;
- default:
- jj_la1[18] = jj_gen;
- ;
- }
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
- }
- }
-
- final public void InformBlock() throws ParseException {
- /*@bgen(jjtree) InformBlock */
- JDMInformBlock jjtn000 = new JDMInformBlock(JJTINFORMBLOCK);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
- try {
- jj_consume_token(INFORM);
- jj_consume_token(ASSIGN);
- jj_consume_token(LBRACE);
- label_12:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case LBRACE:
- ;
- break;
- default:
- jj_la1[19] = jj_gen;
- break label_12;
- }
- InformItem();
- }
- jj_consume_token(RBRACE);
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- {if (true) throw (RuntimeException)jjte000;}
- }
- if (jjte000 instanceof ParseException) {
- {if (true) throw (ParseException)jjte000;}
- }
- {if (true) throw (Error)jjte000;}
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
- }
- }
-
- final public void InformItem() throws ParseException {
- /*@bgen(jjtree) InformItem */
- JDMInformItem jjtn000 = new JDMInformItem(JJTINFORMITEM);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
- try {
- jj_consume_token(LBRACE);
- jjtn000.comm = InformCommunity();
- InformInterestedHost();
- jj_consume_token(RBRACE);
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- {if (true) throw (RuntimeException)jjte000;}
- }
- if (jjte000 instanceof ParseException) {
- {if (true) throw (ParseException)jjte000;}
- }
- {if (true) throw (Error)jjte000;}
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
- }
- }
-
- final public JDMInformCommunity InformCommunity() throws ParseException {
- /*@bgen(jjtree) InformCommunity */
- JDMInformCommunity jjtn000 = new JDMInformCommunity(JJTINFORMCOMMUNITY);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);Token t;
- try {
- jj_consume_token(INFORMCOMMUNITY);
- jj_consume_token(ASSIGN);
- t = jj_consume_token(IDENTIFIER);
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- jjtn000.community= t.image; {if (true) return jjtn000;}
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
- }
- throw new Error("Missing return statement in function");
- }
-
- final public void InformInterestedHost() throws ParseException {
- /*@bgen(jjtree) InformInterestedHost */
- JDMInformInterestedHost jjtn000 = new JDMInformInterestedHost(JJTINFORMINTERESTEDHOST);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
- try {
- jj_consume_token(HOSTS);
- jj_consume_token(ASSIGN);
- HostInform();
- label_13:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case COMMA:
- ;
- break;
- default:
- jj_la1[20] = jj_gen;
- break label_13;
- }
- jj_consume_token(COMMA);
- HostInform();
- }
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- {if (true) throw (RuntimeException)jjte000;}
- }
- if (jjte000 instanceof ParseException) {
- {if (true) throw (ParseException)jjte000;}
- }
- {if (true) throw (Error)jjte000;}
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
- }
- }
-
- final public void HostInform() throws ParseException {
- /*@bgen(jjtree) HostInform */
- JDMHostInform jjtn000 = new JDMHostInform(JJTHOSTINFORM);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);Token t;
- try {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IDENTIFIER:
- HostName();
- break;
- case INTEGER_LITERAL:
- IpAddress();
- break;
- case V6_ADDRESS:
- IpV6Address();
- break;
- default:
- jj_la1[21] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- {if (true) throw (RuntimeException)jjte000;}
- }
- if (jjte000 instanceof ParseException) {
- {if (true) throw (ParseException)jjte000;}
- }
- {if (true) throw (Error)jjte000;}
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
- }
- }
-
- final private boolean jj_2_1(int xla) {
- jj_la = xla; jj_lastpos = jj_scanpos = token;
- boolean retval = !jj_3_1();
- jj_save(0, xla);
- return retval;
- }
-
- final private boolean jj_2_2(int xla) {
- jj_la = xla; jj_lastpos = jj_scanpos = token;
- boolean retval = !jj_3_2();
- jj_save(1, xla);
- return retval;
- }
-
- final private boolean jj_2_3(int xla) {
- jj_la = xla; jj_lastpos = jj_scanpos = token;
- boolean retval = !jj_3_3();
- jj_save(2, xla);
- return retval;
- }
-
- final private boolean jj_3_3() {
- if (jj_scan_token(INTEGER_LITERAL)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_scan_token(DOT)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3_2() {
- if (jj_scan_token(V6_ADDRESS)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_scan_token(MASK)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_scan_token(INTEGER_LITERAL)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3_1() {
- if (jj_scan_token(INTEGER_LITERAL)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_3R_14()) { jj_scanpos = xsp; break; }
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- }
- if (jj_scan_token(MASK)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_scan_token(INTEGER_LITERAL)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_14() {
- if (jj_scan_token(DOT)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_scan_token(INTEGER_LITERAL)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- public ParserTokenManager token_source;
- ASCII_CharStream jj_input_stream;
- public Token token, jj_nt;
- private int jj_ntk;
- private Token jj_scanpos, jj_lastpos;
- private int jj_la;
- public boolean lookingAhead = false;
- private boolean jj_semLA;
- private int jj_gen;
- final private int[] jj_la1 = new int[22];
- final private int[] jj_la1_0 = {0x100,0x80000,0x100000,0x2000,0x0,0x60000,0x0,0x80000000,0x11000000,0x0,0x0,0x0,0x0,0x2000,0x2000,0x0,0x91000000,0x0,0x8000,0x2000,0x0,0x91000000,};
- final private int[] jj_la1_1 = {0x0,0x0,0x0,0x0,0x10,0x0,0x10,0x0,0x0,0x20,0x20,0x40,0x20,0x0,0x0,0x10,0x0,0x10,0x0,0x0,0x10,0x0,};
- final private JJCalls[] jj_2_rtns = new JJCalls[3];
- private boolean jj_rescan = false;
- private int jj_gc = 0;
-
- public Parser(java.io.InputStream stream) {
- jj_input_stream = new ASCII_CharStream(stream, 1, 1);
- token_source = new ParserTokenManager(jj_input_stream);
- token = new Token();
- jj_ntk = -1;
- jj_gen = 0;
- for (int i = 0; i < 22; i++) jj_la1[i] = -1;
- for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
- }
-
- public void ReInit(java.io.InputStream stream) {
- jj_input_stream.ReInit(stream, 1, 1);
- token_source.ReInit(jj_input_stream);
- token = new Token();
- jj_ntk = -1;
- jjtree.reset();
- jj_gen = 0;
- for (int i = 0; i < 22; i++) jj_la1[i] = -1;
- for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
- }
-
- public Parser(java.io.Reader stream) {
- jj_input_stream = new ASCII_CharStream(stream, 1, 1);
- token_source = new ParserTokenManager(jj_input_stream);
- token = new Token();
- jj_ntk = -1;
- jj_gen = 0;
- for (int i = 0; i < 22; i++) jj_la1[i] = -1;
- for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
- }
-
- public void ReInit(java.io.Reader stream) {
- jj_input_stream.ReInit(stream, 1, 1);
- token_source.ReInit(jj_input_stream);
- token = new Token();
- jj_ntk = -1;
- jjtree.reset();
- jj_gen = 0;
- for (int i = 0; i < 22; i++) jj_la1[i] = -1;
- for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
- }
-
- public Parser(ParserTokenManager tm) {
- token_source = tm;
- token = new Token();
- jj_ntk = -1;
- jj_gen = 0;
- for (int i = 0; i < 22; i++) jj_la1[i] = -1;
- for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
- }
-
- public void ReInit(ParserTokenManager tm) {
- token_source = tm;
- token = new Token();
- jj_ntk = -1;
- jjtree.reset();
- jj_gen = 0;
- for (int i = 0; i < 22; i++) jj_la1[i] = -1;
- for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
- }
-
- final private Token jj_consume_token(int kind) throws ParseException {
- Token oldToken;
- if ((oldToken = token).next != null) token = token.next;
- else token = token.next = token_source.getNextToken();
- jj_ntk = -1;
- if (token.kind == kind) {
- jj_gen++;
- if (++jj_gc > 100) {
- jj_gc = 0;
- for (int i = 0; i < jj_2_rtns.length; i++) {
- JJCalls c = jj_2_rtns[i];
- while (c != null) {
- if (c.gen < jj_gen) c.first = null;
- c = c.next;
- }
- }
- }
- return token;
- }
- token = oldToken;
- jj_kind = kind;
- throw generateParseException();
- }
-
- final private boolean jj_scan_token(int kind) {
- if (jj_scanpos == jj_lastpos) {
- jj_la--;
- if (jj_scanpos.next == null) {
- jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
- } else {
- jj_lastpos = jj_scanpos = jj_scanpos.next;
- }
- } else {
- jj_scanpos = jj_scanpos.next;
- }
- if (jj_rescan) {
- int i = 0; Token tok = token;
- while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; }
- if (tok != null) jj_add_error_token(kind, i);
- }
- return (jj_scanpos.kind != kind);
- }
-
- final public Token getNextToken() {
- if (token.next != null) token = token.next;
- else token = token.next = token_source.getNextToken();
- jj_ntk = -1;
- jj_gen++;
- return token;
- }
-
- final public Token getToken(int index) {
- Token t = lookingAhead ? jj_scanpos : token;
- for (int i = 0; i < index; i++) {
- if (t.next != null) t = t.next;
- else t = t.next = token_source.getNextToken();
- }
- return t;
- }
-
- final private int jj_ntk() {
- if ((jj_nt=token.next) == null)
- return (jj_ntk = (token.next=token_source.getNextToken()).kind);
- else
- return (jj_ntk = jj_nt.kind);
- }
-
- private java.util.Vector jj_expentries = new java.util.Vector<>();
- private int[] jj_expentry;
- private int jj_kind = -1;
- private int[] jj_lasttokens = new int[100];
- private int jj_endpos;
-
- private void jj_add_error_token(int kind, int pos) {
- if (pos >= 100) return;
- if (pos == jj_endpos + 1) {
- jj_lasttokens[jj_endpos++] = kind;
- } else if (jj_endpos != 0) {
- jj_expentry = new int[jj_endpos];
- for (int i = 0; i < jj_endpos; i++) {
- jj_expentry[i] = jj_lasttokens[i];
- }
- boolean exists = false;
- for (java.util.Enumeration enumv = jj_expentries.elements(); enumv.hasMoreElements();) {
- int[] oldentry = enumv.nextElement();
- if (oldentry.length == jj_expentry.length) {
- exists = true;
- for (int i = 0; i < jj_expentry.length; i++) {
- if (oldentry[i] != jj_expentry[i]) {
- exists = false;
- break;
- }
- }
- if (exists) break;
- }
- }
- if (!exists) jj_expentries.addElement(jj_expentry);
- if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind;
- }
- }
-
- final public ParseException generateParseException() {
- jj_expentries.removeAllElements();
- boolean[] la1tokens = new boolean[40];
- for (int i = 0; i < 40; i++) {
- la1tokens[i] = false;
- }
- if (jj_kind >= 0) {
- la1tokens[jj_kind] = true;
- jj_kind = -1;
- }
- for (int i = 0; i < 22; i++) {
- if (jj_la1[i] == jj_gen) {
- for (int j = 0; j < 32; j++) {
- if ((jj_la1_0[i] & (1< jj_gen) {
- jj_la = p.arg; jj_lastpos = jj_scanpos = p.first;
- switch (i) {
- case 0: jj_3_1(); break;
- case 1: jj_3_2(); break;
- case 2: jj_3_3(); break;
- }
- }
- p = p.next;
- } while (p != null);
- }
- jj_rescan = false;
- }
-
- final private void jj_save(int index, int xla) {
- JJCalls p = jj_2_rtns[index];
- while (p.gen > jj_gen) {
- if (p.next == null) { p = p.next = new JJCalls(); break; }
- p = p.next;
- }
- p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla;
- }
-
- static final class JJCalls {
- int gen;
- Token first;
- int arg;
- JJCalls next;
- }
-
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/Parser.jj b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/Parser.jj
deleted file mode 100644
index 002e5481538..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/Parser.jj
+++ /dev/null
@@ -1,948 +0,0 @@
-/*@bgen(jjtree) Generated By:JJTree: Do not edit this line. Parser.jj */
-/*@egen*//*
- * @(#)file Parser.jjt
- * @(#)author Sun Microsystems, Inc.
- *
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-options {
- STATIC=false;
-}
-
-
-PARSER_BEGIN(Parser)
-
-package com.sun.jmx.snmp.IPAcl;
-
-import java.io.*;
-
-public class Parser/*@bgen(jjtree)*/implements ParserTreeConstants/*@egen*/ {/*@bgen(jjtree)*/
- protected JJTParserState jjtree = new JJTParserState();
-
-/*@egen*/
-}
-
-PARSER_END(Parser)
-
-
-SKIP :
-{
- " "
-| "\t"
-| "\n"
-| "\r"
-| <"--" (~["\n","\r"])* ("\n"|"\r"|"\r\n")>
-| <"#" (~["\n","\r"])* ("\n"|"\r"|"\r\n")>
-
-}
-
-
-
-/* RESERVED WORDS AND LITERALS */
-
-TOKEN :
-{
-
-|
-|
-|
-|
-|
-|
-|
-|
-|
-|
-|
-|
-|
-|
-|
-|
-}
-
-
-
-TOKEN : /* LITERALS */
-{
- < INTEGER_LITERAL:
- (["l","L"])?
- | (["l","L"])?
- | (["l","L"])?
- >
-|
- < #DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* >
-|
- < #HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ >
-|
- < #OCTAL_LITERAL: "0" (["0"-"7"])* >
-}
-
-TOKEN : /* V6 LITERALS */
-{
- < V6_ADDRESS: ((( ( ( ":")+ (":")?) | "::" ) ( ":")* ( | ( "." "." "." ))) | ("::")) | ( ( ":")+ ":") >
-|
- <#H: (["0"-"9","a"-"f","A"-"F"])+ >
-|
- <#D: (["0"-"9"])+ >
-}
-
-TOKEN : /* IDENTIFIERS */
-{
- < IDENTIFIER: ( (|)+ (||)* (|)+ ) | (|)+ >
-|
- < #LETTER: ["a"-"z","A"-"Z"] >
-|
- < #SEPARATOR: ["-", "_"] >
-|
- < #DIGIT: ["0"-"9"] >
-|
-
-}
-
-
-
-TOKEN: /* SEPARATOR */
-{
- < COMMA: "," >
-| < DOT: "." >
-| < MARK: "!" >
-| < MASK: "/">
-}
-
-// A file can contain several acl definitions
-//
-JDMSecurityDefs SecurityDefs() : {/*@bgen(jjtree) SecurityDefs */
- JDMSecurityDefs jjtn000 = new JDMSecurityDefs(JJTSECURITYDEFS);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
-/*@egen*/}
-{/*@bgen(jjtree) SecurityDefs */
- try {
-/*@egen*/
- [AclBlock()]
- [TrapBlock()]
- [InformBlock()]
- /*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- }
-/*@egen*/
- { return jjtn000;}/*@bgen(jjtree)*/
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- throw (RuntimeException)jjte000;
- }
- if (jjte000 instanceof ParseException) {
- throw (ParseException)jjte000;
- }
- throw (Error)jjte000;
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
- }
-/*@egen*/
-}
-
-void AclBlock(): {/*@bgen(jjtree) AclBlock */
- JDMAclBlock jjtn000 = new JDMAclBlock(JJTACLBLOCK);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
-/*@egen*/}
-{/*@bgen(jjtree) AclBlock */
-try {
-/*@egen*/
-"acl" "=" "{" (AclItem())+ "}"/*@bgen(jjtree)*/
-} catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- throw (RuntimeException)jjte000;
- }
- if (jjte000 instanceof ParseException) {
- throw (ParseException)jjte000;
- }
- throw (Error)jjte000;
-} finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
-}
-/*@egen*/
-}
-
-void AclItem(): {/*@bgen(jjtree) AclItem */
- JDMAclItem jjtn000 = new JDMAclItem(JJTACLITEM);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
-/*@egen*/}
-{/*@bgen(jjtree) AclItem */
-try {
-/*@egen*/
-"{" jjtn000.com= Communities() jjtn000.access= Access() Managers() "}"/*@bgen(jjtree)*/
-} catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- throw (RuntimeException)jjte000;
- }
- if (jjte000 instanceof ParseException) {
- throw (ParseException)jjte000;
- }
- throw (Error)jjte000;
-} finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
-}
-/*@egen*/
-}
-
-JDMCommunities Communities(): {/*@bgen(jjtree) Communities */
- JDMCommunities jjtn000 = new JDMCommunities(JJTCOMMUNITIES);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
-/*@egen*/}
-{/*@bgen(jjtree) Communities */
-try {
-/*@egen*/
-"communities" "=" Community() ( "," Community())*/*@bgen(jjtree)*/
-{
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
-}
-/*@egen*/
-
-{return jjtn000;}/*@bgen(jjtree)*/
-} catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- throw (RuntimeException)jjte000;
- }
- if (jjte000 instanceof ParseException) {
- throw (ParseException)jjte000;
- }
- throw (Error)jjte000;
-} finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
-}
-/*@egen*/
-
-}
-
-void Community():
-{/*@bgen(jjtree) Community */
- JDMCommunity jjtn000 = new JDMCommunity(JJTCOMMUNITY);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
-/*@egen*/
- Token t;
-}
-{/*@bgen(jjtree) Community */
-try {
-/*@egen*/
-t=/*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- }
-/*@egen*/ {jjtn000.communityString= t.image;}/*@bgen(jjtree)*/
-} finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
-}
-/*@egen*/
-}
-
-JDMAccess Access(): {/*@bgen(jjtree) Access */
- JDMAccess jjtn000 = new JDMAccess(JJTACCESS);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
-/*@egen*/}
-{/*@bgen(jjtree) Access */
-try {
-/*@egen*/
-"access" "=" ( {jjtn000.access= RO;}
- |
- {jjtn000.access= RW;}
- )/*@bgen(jjtree)*/
-{
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
-}
-/*@egen*/
-{return jjtn000;}/*@bgen(jjtree)*/
-} finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
-}
-/*@egen*/
-}
-
-
-void Managers() : {/*@bgen(jjtree) Managers */
- JDMManagers jjtn000 = new JDMManagers(JJTMANAGERS);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
-/*@egen*/ }
-{/*@bgen(jjtree) Managers */
-try {
-/*@egen*/
-"managers" "=" Host() ( "," Host())*/*@bgen(jjtree)*/
-} catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- throw (RuntimeException)jjte000;
- }
- if (jjte000 instanceof ParseException) {
- throw (ParseException)jjte000;
- }
- throw (Error)jjte000;
-} finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
-}
-/*@egen*/
-}
-
-void Host() :
-{/*@bgen(jjtree) Host */
- JDMHost jjtn000 = new JDMHost(JJTHOST);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
-/*@egen*/
- Token t;
-}
-{/*@bgen(jjtree) Host */
-try {
-/*@egen*/
-HostName()
-|
-LOOKAHEAD( ( "." )* "/" )
-NetMask()
-|
-LOOKAHEAD( "/" )
-NetMaskV6()
-|
-LOOKAHEAD( ".")
-IpAddress()
-|
-IpV6Address()
-|
-IpMask()/*@bgen(jjtree)*/
-} catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- throw (RuntimeException)jjte000;
- }
- if (jjte000 instanceof ParseException) {
- throw (ParseException)jjte000;
- }
- throw (Error)jjte000;
-} finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
-}
-/*@egen*/
-}
-
-void HostName():
-{/*@bgen(jjtree) HostName */
- JDMHostName jjtn000 = new JDMHostName(JJTHOSTNAME);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
-/*@egen*/
- Token t;
-}
-{/*@bgen(jjtree) HostName */
- try {
-/*@egen*/
- t= { jjtn000.name.append(t.image); }
-(
-"." t=
- {jjtn000.name.append( "." + t.image); }
-)*/*@bgen(jjtree)*/
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
- }
-/*@egen*/
-
-}
-
-void IpAddress():
-{/*@bgen(jjtree) IpAddress */
-JDMIpAddress jjtn000 = new JDMIpAddress(JJTIPADDRESS);
-boolean jjtc000 = true;
-jjtree.openNodeScope(jjtn000);
-/*@egen*/
-Token t;
-}
-{/*@bgen(jjtree) IpAddress */
-try {
-/*@egen*/
-
-t=
- {jjtn000.address.append(t.image); }
-(
-"." t=
- {jjtn000.address.append( "." + t.image); }
-)*/*@bgen(jjtree)*/
-} finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
-}
-/*@egen*/
-
-}
-
-void IpV6Address():
-{/*@bgen(jjtree) IpV6Address */
-JDMIpV6Address jjtn000 = new JDMIpV6Address(JJTIPV6ADDRESS);
-boolean jjtc000 = true;
-jjtree.openNodeScope(jjtn000);
-/*@egen*/
-Token t;
-}
-{/*@bgen(jjtree) IpV6Address */
-try {
-/*@egen*/
-
-t= /*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- }
-/*@egen*/
- {jjtn000.address.append(t.image); }/*@bgen(jjtree)*/
-} finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
-}
-/*@egen*/
-}
-
-void IpMask():
-{/*@bgen(jjtree) IpMask */
-JDMIpMask jjtn000 = new JDMIpMask(JJTIPMASK);
-boolean jjtc000 = true;
-jjtree.openNodeScope(jjtn000);
-/*@egen*/
-Token t;
-}
-{/*@bgen(jjtree) IpMask */
-try {
-/*@egen*/
-
-t=
- {jjtn000.address.append(t.image); }
-(
-"!" t=
- {jjtn000.address.append( "." + t.image); }
-)*/*@bgen(jjtree)*/
-} finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
-}
-/*@egen*/
-}
-
-void NetMask():
-{/*@bgen(jjtree) NetMask */
-JDMNetMask jjtn000 = new JDMNetMask(JJTNETMASK);
-boolean jjtc000 = true;
-jjtree.openNodeScope(jjtn000);
-/*@egen*/
-Token t;
-}
-{/*@bgen(jjtree) NetMask */
-try {
-/*@egen*/
-
-t=
- {jjtn000.address.append(t.image); }
-(
-"." t=
- {jjtn000.address.append( "." + t.image); }
-)* "/" t= /*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- }
-/*@egen*/ {jjtn000.mask = t.image; }/*@bgen(jjtree)*/
-} finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
-}
-/*@egen*/
-}
-
-void NetMaskV6():
-{/*@bgen(jjtree) NetMaskV6 */
-JDMNetMaskV6 jjtn000 = new JDMNetMaskV6(JJTNETMASKV6);
-boolean jjtc000 = true;
-jjtree.openNodeScope(jjtn000);
-/*@egen*/
-Token t;
-}
-{/*@bgen(jjtree) NetMaskV6 */
-try {
-/*@egen*/
-
-t=
- {jjtn000.address.append(t.image); }
-
-"/" t= /*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- }
-/*@egen*/ {jjtn000.mask = t.image; }/*@bgen(jjtree)*/
-} finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
-}
-/*@egen*/
-}
-
-void TrapBlock(): {/*@bgen(jjtree) TrapBlock */
- JDMTrapBlock jjtn000 = new JDMTrapBlock(JJTTRAPBLOCK);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
-/*@egen*/ }
-{/*@bgen(jjtree) TrapBlock */
-try {
-/*@egen*/
-"trap" "=" "{" (TrapItem())* "}"/*@bgen(jjtree)*/
-} catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- throw (RuntimeException)jjte000;
- }
- if (jjte000 instanceof ParseException) {
- throw (ParseException)jjte000;
- }
- throw (Error)jjte000;
-} finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
-}
-/*@egen*/
-}
-
-void TrapItem(): {/*@bgen(jjtree) TrapItem */
- JDMTrapItem jjtn000 = new JDMTrapItem(JJTTRAPITEM);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
-/*@egen*/ }
-{/*@bgen(jjtree) TrapItem */
-try {
-/*@egen*/
-"{" jjtn000.comm= TrapCommunity() TrapInterestedHost() (Enterprise())* "}"/*@bgen(jjtree)*/
-} catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- throw (RuntimeException)jjte000;
- }
- if (jjte000 instanceof ParseException) {
- throw (ParseException)jjte000;
- }
- throw (Error)jjte000;
-} finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
-}
-/*@egen*/
-}
-
-JDMTrapCommunity TrapCommunity():
-{/*@bgen(jjtree) TrapCommunity */
- JDMTrapCommunity jjtn000 = new JDMTrapCommunity(JJTTRAPCOMMUNITY);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
-/*@egen*/
- Token t;
-}
-{/*@bgen(jjtree) TrapCommunity */
-try {
-/*@egen*/
-"trap-community" "=" t=/*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- }
-/*@egen*/ { jjtn000.community= t.image; return jjtn000; }/*@bgen(jjtree)*/
-} finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
-}
-/*@egen*/
-}
-
-void TrapInterestedHost(): {/*@bgen(jjtree) TrapInterestedHost */
- JDMTrapInterestedHost jjtn000 = new JDMTrapInterestedHost(JJTTRAPINTERESTEDHOST);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
-/*@egen*/ }
-{/*@bgen(jjtree) TrapInterestedHost */
-try {
-/*@egen*/
-"hosts" "=" HostTrap() ("," HostTrap())*/*@bgen(jjtree)*/
-} catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- throw (RuntimeException)jjte000;
- }
- if (jjte000 instanceof ParseException) {
- throw (ParseException)jjte000;
- }
- throw (Error)jjte000;
-} finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
-}
-/*@egen*/
-}
-
-void HostTrap() :
-{/*@bgen(jjtree) HostTrap */
- JDMHostTrap jjtn000 = new JDMHostTrap(JJTHOSTTRAP);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
-/*@egen*/
- Token t;
-}
-{/*@bgen(jjtree) HostTrap */
-try {
-/*@egen*/
-HostName()
-|
-IpAddress()
-|
-IpV6Address()/*@bgen(jjtree)*/
-} catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- throw (RuntimeException)jjte000;
- }
- if (jjte000 instanceof ParseException) {
- throw (ParseException)jjte000;
- }
- throw (Error)jjte000;
-} finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
-}
-/*@egen*/
-}
-
-void Enterprise():
-{/*@bgen(jjtree) Enterprise */
- JDMEnterprise jjtn000 = new JDMEnterprise(JJTENTERPRISE);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
-/*@egen*/
- Token t;
-}
-{/*@bgen(jjtree) Enterprise */
-try {
-/*@egen*/
-"{"
-"enterprise" "=" t= {jjtn000.enterprise= t.image;}
-
-"trap-num" "=" TrapNum() ("," TrapNum())*
-
-"}"/*@bgen(jjtree)*/
-} catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- throw (RuntimeException)jjte000;
- }
- if (jjte000 instanceof ParseException) {
- throw (ParseException)jjte000;
- }
- throw (Error)jjte000;
-} finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
-}
-/*@egen*/
-}
-
-void TrapNum():
-{/*@bgen(jjtree) TrapNum */
- JDMTrapNum jjtn000 = new JDMTrapNum(JJTTRAPNUM);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
-/*@egen*/
- Token t;
-}
-{/*@bgen(jjtree) TrapNum */
- try {
-/*@egen*/
- t= {jjtn000.low= Integer.parseInt(t.image);}
-[
- "-" t= {jjtn000.high= Integer.parseInt(t.image);}
-]/*@bgen(jjtree)*/
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
- }
-/*@egen*/
-}
-
-
-void InformBlock(): {/*@bgen(jjtree) InformBlock */
- JDMInformBlock jjtn000 = new JDMInformBlock(JJTINFORMBLOCK);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
-/*@egen*/ }
-{/*@bgen(jjtree) InformBlock */
-try {
-/*@egen*/
-"inform" "=" "{" (InformItem())* "}"/*@bgen(jjtree)*/
-} catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- throw (RuntimeException)jjte000;
- }
- if (jjte000 instanceof ParseException) {
- throw (ParseException)jjte000;
- }
- throw (Error)jjte000;
-} finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
-}
-/*@egen*/
-}
-
-void InformItem(): {/*@bgen(jjtree) InformItem */
- JDMInformItem jjtn000 = new JDMInformItem(JJTINFORMITEM);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
-/*@egen*/ }
-{/*@bgen(jjtree) InformItem */
-try {
-/*@egen*/
-"{" jjtn000.comm= InformCommunity() InformInterestedHost() "}"/*@bgen(jjtree)*/
-} catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- throw (RuntimeException)jjte000;
- }
- if (jjte000 instanceof ParseException) {
- throw (ParseException)jjte000;
- }
- throw (Error)jjte000;
-} finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
-}
-/*@egen*/
-}
-
-JDMInformCommunity InformCommunity():
-{/*@bgen(jjtree) InformCommunity */
- JDMInformCommunity jjtn000 = new JDMInformCommunity(JJTINFORMCOMMUNITY);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
-/*@egen*/
- Token t;
-}
-{/*@bgen(jjtree) InformCommunity */
-try {
-/*@egen*/
-"inform-community" "=" t=/*@bgen(jjtree)*/
- {
- jjtree.closeNodeScope(jjtn000, true);
- jjtc000 = false;
- }
-/*@egen*/ { jjtn000.community= t.image; return jjtn000; }/*@bgen(jjtree)*/
-} finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
-}
-/*@egen*/
-}
-
-void InformInterestedHost(): {/*@bgen(jjtree) InformInterestedHost */
- JDMInformInterestedHost jjtn000 = new JDMInformInterestedHost(JJTINFORMINTERESTEDHOST);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
-/*@egen*/ }
-{/*@bgen(jjtree) InformInterestedHost */
-try {
-/*@egen*/
-"hosts" "=" HostInform() ("," HostInform())*/*@bgen(jjtree)*/
-} catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- throw (RuntimeException)jjte000;
- }
- if (jjte000 instanceof ParseException) {
- throw (ParseException)jjte000;
- }
- throw (Error)jjte000;
-} finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
-}
-/*@egen*/
-}
-
-void HostInform() :
-{/*@bgen(jjtree) HostInform */
- JDMHostInform jjtn000 = new JDMHostInform(JJTHOSTINFORM);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
-/*@egen*/
- Token t;
-}
-{/*@bgen(jjtree) HostInform */
-try {
-/*@egen*/
-HostName()
-|
-IpAddress()
-|
-IpV6Address()/*@bgen(jjtree)*/
-} catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- throw (RuntimeException)jjte000;
- }
- if (jjte000 instanceof ParseException) {
- throw (ParseException)jjte000;
- }
- throw (Error)jjte000;
-} finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
-}
-/*@egen*/
-}
-
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/Parser.jjt b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/Parser.jjt
deleted file mode 100644
index 5043f9bcc97..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/Parser.jjt
+++ /dev/null
@@ -1,380 +0,0 @@
-/*
- * @(#)file Parser.jjt
- * @(#)author Sun Microsystems, Inc.
- *
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-options {
- MULTI=true;
- STATIC=false;
- NODE_PREFIX= "JDM";
- NODE_PACKAGE="com.sun.jmx.snmp.IPAcl";
-}
-
-
-PARSER_BEGIN(Parser)
-
-package com.sun.jmx.snmp.IPAcl;
-
-import java.io.*;
-
-public class Parser {
-}
-
-PARSER_END(Parser)
-
-
-SKIP :
-{
- " "
-| "\t"
-| "\n"
-| "\r"
-| <"--" (~["\n","\r"])* ("\n"|"\r"|"\r\n")>
-| <"#" (~["\n","\r"])* ("\n"|"\r"|"\r\n")>
-
-}
-
-
-
-/* RESERVED WORDS AND LITERALS */
-
-TOKEN :
-{
-
-|
-|
-|
-|
-|
-|
-|
-|
-|
-|
-|
-|
-|
-|
-|
-|
-}
-
-
-
-TOKEN : /* LITERALS */
-{
- < INTEGER_LITERAL:
- (["l","L"])?
- | (["l","L"])?
- | (["l","L"])?
- >
-|
- < #DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* >
-|
- < #HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ >
-|
- < #OCTAL_LITERAL: "0" (["0"-"7"])* >
-}
-
-TOKEN : /* V6 LITERALS */
-{
- < V6_ADDRESS: ((( ( ( ":")+ (":")?) | "::" ) ( ":")* ( | ( "." "." "." ))) | ("::")) | ( ( ":")+ ":") >
-|
- <#H: (["0"-"9","a"-"f","A"-"F"])+ >
-|
- <#D: (["0"-"9"])+ >
-}
-
-TOKEN : /* IDENTIFIERS */
-{
- < IDENTIFIER: ( (|)+ (||)* (|)+ ) | (|)+ >
-|
- < #LETTER: ["a"-"z","A"-"Z"] >
-|
- < #SEPARATOR: ["-", "_"] >
-|
- < #DIGIT: ["0"-"9"] >
-|
-
-}
-
-
-
-TOKEN: /* SEPARATOR */
-{
- < COMMA: "," >
-| < DOT: "." >
-| < MARK: "!" >
-| < MASK: "/">
-}
-
-// A file can contain several acl definitions
-//
-JDMSecurityDefs SecurityDefs() : {}
-{
- [AclBlock()]
- [TrapBlock()]
- [InformBlock()]
-
- { return jjtThis;}
-}
-
-void AclBlock(): {}
-{
-"acl" "=" "{" (AclItem())+ "}"
-}
-
-void AclItem(): {}
-{
-"{" jjtThis.com= Communities() jjtThis.access= Access() Managers() "}"
-}
-
-JDMCommunities Communities(): {}
-{
-"communities" "=" Community() ( "," Community())*
-
-{return jjtThis;}
-
-}
-
-void Community():
-{
- Token t;
-}
-{
-t= {jjtThis.communityString= t.image;}
-}
-
-JDMAccess Access(): {}
-{
-"access" "=" ( {jjtThis.access= RO;}
- |
- {jjtThis.access= RW;}
- )
-{return jjtThis;}
-}
-
-
-void Managers() : { }
-{
-"managers" "=" Host() ( "," Host())*
-}
-
-void Host() :
-{
- Token t;
-}
-{
-HostName()
-|
-LOOKAHEAD( ( "." )* "/" )
-NetMask()
-|
-LOOKAHEAD( "/" )
-NetMaskV6()
-|
-LOOKAHEAD( ".")
-IpAddress()
-|
-IpV6Address()
-|
-IpMask()
-}
-
-void HostName():
-{
- Token t;
-}
-{
- t= { jjtThis.name.append(t.image); }
-(
-"." t=
- {jjtThis.name.append( "." + t.image); }
-)*
-
-}
-
-void IpAddress():
-{
-Token t;
-}
-{
-
-t=
- {jjtThis.address.append(t.image); }
-(
-"." t=
- {jjtThis.address.append( "." + t.image); }
-)*
-
-}
-
-void IpV6Address():
-{
-Token t;
-}
-{
-
-t=
- {jjtThis.address.append(t.image); }
-}
-
-void IpMask():
-{
-Token t;
-}
-{
-
-t=
- {jjtThis.address.append(t.image); }
-(
-"!" t=
- {jjtThis.address.append( "." + t.image); }
-)*
-}
-
-void NetMask():
-{
-Token t;
-}
-{
-
-t=
- {jjtThis.address.append(t.image); }
-(
-"." t=
- {jjtThis.address.append( "." + t.image); }
-)* "/" t= {jjtThis.mask = t.image; }
-}
-
-void NetMaskV6():
-{
-Token t;
-}
-{
-
-t=
- {jjtThis.address.append(t.image); }
-
-"/" t= {jjtThis.mask = t.image; }
-}
-
-void TrapBlock(): { }
-{
-"trap" "=" "{" (TrapItem())* "}"
-}
-
-void TrapItem(): { }
-{
-"{" jjtThis.comm= TrapCommunity() TrapInterestedHost() (Enterprise())* "}"
-}
-
-JDMTrapCommunity TrapCommunity():
-{
- Token t;
-}
-{
-"trap-community" "=" t= { jjtThis.community= t.image; return jjtThis; }
-}
-
-void TrapInterestedHost(): { }
-{
-"hosts" "=" HostTrap() ("," HostTrap())*
-}
-
-void HostTrap() :
-{
- Token t;
-}
-{
-HostName()
-|
-IpAddress()
-|
-IpV6Address()
-}
-
-void Enterprise():
-{
- Token t;
-}
-{
-"{"
-"enterprise" "=" t= {jjtThis.enterprise= t.image;}
-
-"trap-num" "=" TrapNum() ("," TrapNum())*
-
-"}"
-}
-
-void TrapNum():
-{
- Token t;
-}
-{
- t= {jjtThis.low= Integer.parseInt(t.image);}
-[
- "-" t= {jjtThis.high= Integer.parseInt(t.image);}
-]
-}
-
-
-void InformBlock(): { }
-{
-"inform" "=" "{" (InformItem())* "}"
-}
-
-void InformItem(): { }
-{
-"{" jjtThis.comm= InformCommunity() InformInterestedHost() "}"
-}
-
-JDMInformCommunity InformCommunity():
-{
- Token t;
-}
-{
-"inform-community" "=" t= { jjtThis.community= t.image; return jjtThis; }
-}
-
-void InformInterestedHost(): { }
-{
-"hosts" "=" HostInform() ("," HostInform())*
-}
-
-void HostInform() :
-{
- Token t;
-}
-{
-HostName()
-|
-IpAddress()
-|
-IpV6Address()
-}
-
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/ParserConstants.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/ParserConstants.java
deleted file mode 100644
index c410aa730ae..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/ParserConstants.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* Generated By:JJTree&JavaCC: Do not edit this line. ParserConstants.java */
-package com.sun.jmx.snmp.IPAcl;
-
-interface ParserConstants {
-
- int EOF = 0;
- int ACCESS = 7;
- int ACL = 8;
- int ASSIGN = 9;
- int COMMUNITIES = 10;
- int ENTERPRISE = 11;
- int HOSTS = 12;
- int LBRACE = 13;
- int MANAGERS = 14;
- int RANGE = 15;
- int RBRACE = 16;
- int RO = 17;
- int RW = 18;
- int TRAP = 19;
- int INFORM = 20;
- int TRAPCOMMUNITY = 21;
- int INFORMCOMMUNITY = 22;
- int TRAPNUM = 23;
- int INTEGER_LITERAL = 24;
- int DECIMAL_LITERAL = 25;
- int HEX_LITERAL = 26;
- int OCTAL_LITERAL = 27;
- int V6_ADDRESS = 28;
- int H = 29;
- int D = 30;
- int IDENTIFIER = 31;
- int LETTER = 32;
- int SEPARATOR = 33;
- int DIGIT = 34;
- int CSTRING = 35;
- int COMMA = 36;
- int DOT = 37;
- int MARK = 38;
- int MASK = 39;
-
- int DEFAULT = 0;
-
- String[] tokenImage = {
- "",
- "\" \"",
- "\"\\t\"",
- "\"\\n\"",
- "\"\\r\"",
- "",
- "",
- "\"access\"",
- "\"acl\"",
- "\"=\"",
- "\"communities\"",
- "\"enterprise\"",
- "\"hosts\"",
- "\"{\"",
- "\"managers\"",
- "\"-\"",
- "\"}\"",
- "\"read-only\"",
- "\"read-write\"",
- "\"trap\"",
- "\"inform\"",
- "\"trap-community\"",
- "\"inform-community\"",
- "\"trap-num\"",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "\",\"",
- "\".\"",
- "\"!\"",
- "\"/\"",
- };
-
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/ParserTokenManager.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/ParserTokenManager.java
deleted file mode 100644
index 8ac5855db9c..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/ParserTokenManager.java
+++ /dev/null
@@ -1,1514 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* Generated By:JJTree&JavaCC: Do not edit this line. ParserTokenManager.java */
-package com.sun.jmx.snmp.IPAcl;
-import java.io.*;
-
-class ParserTokenManager implements ParserConstants
-{
-private final int jjStopStringLiteralDfa_0(int pos, long active0)
-{
- switch (pos)
- {
- case 0:
- if ((active0 & 0x8000L) != 0L)
- return 0;
- if ((active0 & 0xfe5000L) != 0L)
- {
- jjmatchedKind = 31;
- return 47;
- }
- if ((active0 & 0xd80L) != 0L)
- {
- jjmatchedKind = 31;
- return 48;
- }
- return -1;
- case 1:
- if ((active0 & 0xfe5c00L) != 0L)
- {
- jjmatchedKind = 31;
- jjmatchedPos = 1;
- return 49;
- }
- if ((active0 & 0x180L) != 0L)
- {
- jjmatchedKind = 31;
- jjmatchedPos = 1;
- return 50;
- }
- return -1;
- case 2:
- if ((active0 & 0xfe5c00L) != 0L)
- {
- jjmatchedKind = 31;
- jjmatchedPos = 2;
- return 49;
- }
- if ((active0 & 0x100L) != 0L)
- return 49;
- if ((active0 & 0x80L) != 0L)
- {
- jjmatchedKind = 31;
- jjmatchedPos = 2;
- return 50;
- }
- return -1;
- case 3:
- if ((active0 & 0x565c00L) != 0L)
- {
- if (jjmatchedPos != 3)
- {
- jjmatchedKind = 31;
- jjmatchedPos = 3;
- }
- return 49;
- }
- if ((active0 & 0xa80000L) != 0L)
- return 49;
- if ((active0 & 0x80L) != 0L)
- {
- if (jjmatchedPos != 3)
- {
- jjmatchedKind = 31;
- jjmatchedPos = 3;
- }
- return 50;
- }
- return -1;
- case 4:
- if ((active0 & 0xa00000L) != 0L)
- return 51;
- if ((active0 & 0x60000L) != 0L)
- {
- if (jjmatchedPos < 3)
- {
- jjmatchedKind = 31;
- jjmatchedPos = 3;
- }
- return 51;
- }
- if ((active0 & 0x1000L) != 0L)
- return 49;
- if ((active0 & 0x504c80L) != 0L)
- {
- jjmatchedKind = 31;
- jjmatchedPos = 4;
- return 49;
- }
- return -1;
- case 5:
- if ((active0 & 0x500080L) != 0L)
- return 49;
- if ((active0 & 0x4c00L) != 0L)
- {
- if (jjmatchedPos != 5)
- {
- jjmatchedKind = 31;
- jjmatchedPos = 5;
- }
- return 49;
- }
- if ((active0 & 0xa60000L) != 0L)
- {
- if (jjmatchedPos != 5)
- {
- jjmatchedKind = 31;
- jjmatchedPos = 5;
- }
- return 51;
- }
- return -1;
- case 6:
- if ((active0 & 0x400000L) != 0L)
- return 51;
- if ((active0 & 0x4c00L) != 0L)
- {
- jjmatchedKind = 31;
- jjmatchedPos = 6;
- return 49;
- }
- if ((active0 & 0xa60000L) != 0L)
- {
- jjmatchedKind = 31;
- jjmatchedPos = 6;
- return 51;
- }
- return -1;
- case 7:
- if ((active0 & 0x660000L) != 0L)
- {
- jjmatchedKind = 31;
- jjmatchedPos = 7;
- return 51;
- }
- if ((active0 & 0x800000L) != 0L)
- return 51;
- if ((active0 & 0x4000L) != 0L)
- return 49;
- if ((active0 & 0xc00L) != 0L)
- {
- jjmatchedKind = 31;
- jjmatchedPos = 7;
- return 49;
- }
- return -1;
- case 8:
- if ((active0 & 0x20000L) != 0L)
- return 51;
- if ((active0 & 0xc00L) != 0L)
- {
- jjmatchedKind = 31;
- jjmatchedPos = 8;
- return 49;
- }
- if ((active0 & 0x640000L) != 0L)
- {
- jjmatchedKind = 31;
- jjmatchedPos = 8;
- return 51;
- }
- return -1;
- case 9:
- if ((active0 & 0x40000L) != 0L)
- return 51;
- if ((active0 & 0x800L) != 0L)
- return 49;
- if ((active0 & 0x600000L) != 0L)
- {
- jjmatchedKind = 31;
- jjmatchedPos = 9;
- return 51;
- }
- if ((active0 & 0x400L) != 0L)
- {
- jjmatchedKind = 31;
- jjmatchedPos = 9;
- return 49;
- }
- return -1;
- case 10:
- if ((active0 & 0x600000L) != 0L)
- {
- jjmatchedKind = 31;
- jjmatchedPos = 10;
- return 51;
- }
- if ((active0 & 0x400L) != 0L)
- return 49;
- return -1;
- case 11:
- if ((active0 & 0x600000L) != 0L)
- {
- jjmatchedKind = 31;
- jjmatchedPos = 11;
- return 51;
- }
- return -1;
- case 12:
- if ((active0 & 0x600000L) != 0L)
- {
- jjmatchedKind = 31;
- jjmatchedPos = 12;
- return 51;
- }
- return -1;
- case 13:
- if ((active0 & 0x400000L) != 0L)
- {
- jjmatchedKind = 31;
- jjmatchedPos = 13;
- return 51;
- }
- if ((active0 & 0x200000L) != 0L)
- return 51;
- return -1;
- case 14:
- if ((active0 & 0x400000L) != 0L)
- {
- jjmatchedKind = 31;
- jjmatchedPos = 14;
- return 51;
- }
- return -1;
- default :
- return -1;
- }
-}
-private final int jjStartNfa_0(int pos, long active0)
-{
- return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1);
-}
-private final int jjStopAtPos(int pos, int kind)
-{
- jjmatchedKind = kind;
- jjmatchedPos = pos;
- return pos + 1;
-}
-private final int jjStartNfaWithStates_0(int pos, int kind, int state)
-{
- jjmatchedKind = kind;
- jjmatchedPos = pos;
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) { return pos + 1; }
- return jjMoveNfa_0(state, pos + 1);
-}
-private final int jjMoveStringLiteralDfa0_0()
-{
- switch(curChar)
- {
- case 33:
- return jjStopAtPos(0, 38);
- case 44:
- return jjStopAtPos(0, 36);
- case 45:
- return jjStartNfaWithStates_0(0, 15, 0);
- case 46:
- return jjStopAtPos(0, 37);
- case 47:
- return jjStopAtPos(0, 39);
- case 61:
- return jjStopAtPos(0, 9);
- case 97:
- return jjMoveStringLiteralDfa1_0(0x180L);
- case 99:
- return jjMoveStringLiteralDfa1_0(0x400L);
- case 101:
- return jjMoveStringLiteralDfa1_0(0x800L);
- case 104:
- return jjMoveStringLiteralDfa1_0(0x1000L);
- case 105:
- return jjMoveStringLiteralDfa1_0(0x500000L);
- case 109:
- return jjMoveStringLiteralDfa1_0(0x4000L);
- case 114:
- return jjMoveStringLiteralDfa1_0(0x60000L);
- case 116:
- return jjMoveStringLiteralDfa1_0(0xa80000L);
- case 123:
- return jjStopAtPos(0, 13);
- case 125:
- return jjStopAtPos(0, 16);
- default :
- return jjMoveNfa_0(5, 0);
- }
-}
-private final int jjMoveStringLiteralDfa1_0(long active0)
-{
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(0, active0);
- return 1;
- }
- switch(curChar)
- {
- case 97:
- return jjMoveStringLiteralDfa2_0(active0, 0x4000L);
- case 99:
- return jjMoveStringLiteralDfa2_0(active0, 0x180L);
- case 101:
- return jjMoveStringLiteralDfa2_0(active0, 0x60000L);
- case 110:
- return jjMoveStringLiteralDfa2_0(active0, 0x500800L);
- case 111:
- return jjMoveStringLiteralDfa2_0(active0, 0x1400L);
- case 114:
- return jjMoveStringLiteralDfa2_0(active0, 0xa80000L);
- default :
- break;
- }
- return jjStartNfa_0(0, active0);
-}
-private final int jjMoveStringLiteralDfa2_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L)
- return jjStartNfa_0(0, old0);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(1, active0);
- return 2;
- }
- switch(curChar)
- {
- case 97:
- return jjMoveStringLiteralDfa3_0(active0, 0xae0000L);
- case 99:
- return jjMoveStringLiteralDfa3_0(active0, 0x80L);
- case 102:
- return jjMoveStringLiteralDfa3_0(active0, 0x500000L);
- case 108:
- if ((active0 & 0x100L) != 0L)
- return jjStartNfaWithStates_0(2, 8, 49);
- break;
- case 109:
- return jjMoveStringLiteralDfa3_0(active0, 0x400L);
- case 110:
- return jjMoveStringLiteralDfa3_0(active0, 0x4000L);
- case 115:
- return jjMoveStringLiteralDfa3_0(active0, 0x1000L);
- case 116:
- return jjMoveStringLiteralDfa3_0(active0, 0x800L);
- default :
- break;
- }
- return jjStartNfa_0(1, active0);
-}
-private final int jjMoveStringLiteralDfa3_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L)
- return jjStartNfa_0(1, old0);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(2, active0);
- return 3;
- }
- switch(curChar)
- {
- case 97:
- return jjMoveStringLiteralDfa4_0(active0, 0x4000L);
- case 100:
- return jjMoveStringLiteralDfa4_0(active0, 0x60000L);
- case 101:
- return jjMoveStringLiteralDfa4_0(active0, 0x880L);
- case 109:
- return jjMoveStringLiteralDfa4_0(active0, 0x400L);
- case 111:
- return jjMoveStringLiteralDfa4_0(active0, 0x500000L);
- case 112:
- if ((active0 & 0x80000L) != 0L)
- {
- jjmatchedKind = 19;
- jjmatchedPos = 3;
- }
- return jjMoveStringLiteralDfa4_0(active0, 0xa00000L);
- case 116:
- return jjMoveStringLiteralDfa4_0(active0, 0x1000L);
- default :
- break;
- }
- return jjStartNfa_0(2, active0);
-}
-private final int jjMoveStringLiteralDfa4_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L)
- return jjStartNfa_0(2, old0);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(3, active0);
- return 4;
- }
- switch(curChar)
- {
- case 45:
- return jjMoveStringLiteralDfa5_0(active0, 0xa60000L);
- case 103:
- return jjMoveStringLiteralDfa5_0(active0, 0x4000L);
- case 114:
- return jjMoveStringLiteralDfa5_0(active0, 0x500800L);
- case 115:
- if ((active0 & 0x1000L) != 0L)
- return jjStartNfaWithStates_0(4, 12, 49);
- return jjMoveStringLiteralDfa5_0(active0, 0x80L);
- case 117:
- return jjMoveStringLiteralDfa5_0(active0, 0x400L);
- default :
- break;
- }
- return jjStartNfa_0(3, active0);
-}
-private final int jjMoveStringLiteralDfa5_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L)
- return jjStartNfa_0(3, old0);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(4, active0);
- return 5;
- }
- switch(curChar)
- {
- case 99:
- return jjMoveStringLiteralDfa6_0(active0, 0x200000L);
- case 101:
- return jjMoveStringLiteralDfa6_0(active0, 0x4000L);
- case 109:
- if ((active0 & 0x100000L) != 0L)
- {
- jjmatchedKind = 20;
- jjmatchedPos = 5;
- }
- return jjMoveStringLiteralDfa6_0(active0, 0x400000L);
- case 110:
- return jjMoveStringLiteralDfa6_0(active0, 0x800400L);
- case 111:
- return jjMoveStringLiteralDfa6_0(active0, 0x20000L);
- case 112:
- return jjMoveStringLiteralDfa6_0(active0, 0x800L);
- case 115:
- if ((active0 & 0x80L) != 0L)
- return jjStartNfaWithStates_0(5, 7, 49);
- break;
- case 119:
- return jjMoveStringLiteralDfa6_0(active0, 0x40000L);
- default :
- break;
- }
- return jjStartNfa_0(4, active0);
-}
-private final int jjMoveStringLiteralDfa6_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L)
- return jjStartNfa_0(4, old0);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(5, active0);
- return 6;
- }
- switch(curChar)
- {
- case 45:
- return jjMoveStringLiteralDfa7_0(active0, 0x400000L);
- case 105:
- return jjMoveStringLiteralDfa7_0(active0, 0x400L);
- case 110:
- return jjMoveStringLiteralDfa7_0(active0, 0x20000L);
- case 111:
- return jjMoveStringLiteralDfa7_0(active0, 0x200000L);
- case 114:
- return jjMoveStringLiteralDfa7_0(active0, 0x44800L);
- case 117:
- return jjMoveStringLiteralDfa7_0(active0, 0x800000L);
- default :
- break;
- }
- return jjStartNfa_0(5, active0);
-}
-private final int jjMoveStringLiteralDfa7_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L)
- return jjStartNfa_0(5, old0);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(6, active0);
- return 7;
- }
- switch(curChar)
- {
- case 99:
- return jjMoveStringLiteralDfa8_0(active0, 0x400000L);
- case 105:
- return jjMoveStringLiteralDfa8_0(active0, 0x40800L);
- case 108:
- return jjMoveStringLiteralDfa8_0(active0, 0x20000L);
- case 109:
- if ((active0 & 0x800000L) != 0L)
- return jjStartNfaWithStates_0(7, 23, 51);
- return jjMoveStringLiteralDfa8_0(active0, 0x200000L);
- case 115:
- if ((active0 & 0x4000L) != 0L)
- return jjStartNfaWithStates_0(7, 14, 49);
- break;
- case 116:
- return jjMoveStringLiteralDfa8_0(active0, 0x400L);
- default :
- break;
- }
- return jjStartNfa_0(6, active0);
-}
-private final int jjMoveStringLiteralDfa8_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L)
- return jjStartNfa_0(6, old0);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(7, active0);
- return 8;
- }
- switch(curChar)
- {
- case 105:
- return jjMoveStringLiteralDfa9_0(active0, 0x400L);
- case 109:
- return jjMoveStringLiteralDfa9_0(active0, 0x200000L);
- case 111:
- return jjMoveStringLiteralDfa9_0(active0, 0x400000L);
- case 115:
- return jjMoveStringLiteralDfa9_0(active0, 0x800L);
- case 116:
- return jjMoveStringLiteralDfa9_0(active0, 0x40000L);
- case 121:
- if ((active0 & 0x20000L) != 0L)
- return jjStartNfaWithStates_0(8, 17, 51);
- break;
- default :
- break;
- }
- return jjStartNfa_0(7, active0);
-}
-private final int jjMoveStringLiteralDfa9_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L)
- return jjStartNfa_0(7, old0);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(8, active0);
- return 9;
- }
- switch(curChar)
- {
- case 101:
- if ((active0 & 0x800L) != 0L)
- return jjStartNfaWithStates_0(9, 11, 49);
- else if ((active0 & 0x40000L) != 0L)
- return jjStartNfaWithStates_0(9, 18, 51);
- return jjMoveStringLiteralDfa10_0(active0, 0x400L);
- case 109:
- return jjMoveStringLiteralDfa10_0(active0, 0x400000L);
- case 117:
- return jjMoveStringLiteralDfa10_0(active0, 0x200000L);
- default :
- break;
- }
- return jjStartNfa_0(8, active0);
-}
-private final int jjMoveStringLiteralDfa10_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L)
- return jjStartNfa_0(8, old0);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(9, active0);
- return 10;
- }
- switch(curChar)
- {
- case 109:
- return jjMoveStringLiteralDfa11_0(active0, 0x400000L);
- case 110:
- return jjMoveStringLiteralDfa11_0(active0, 0x200000L);
- case 115:
- if ((active0 & 0x400L) != 0L)
- return jjStartNfaWithStates_0(10, 10, 49);
- break;
- default :
- break;
- }
- return jjStartNfa_0(9, active0);
-}
-private final int jjMoveStringLiteralDfa11_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L)
- return jjStartNfa_0(9, old0);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(10, active0);
- return 11;
- }
- switch(curChar)
- {
- case 105:
- return jjMoveStringLiteralDfa12_0(active0, 0x200000L);
- case 117:
- return jjMoveStringLiteralDfa12_0(active0, 0x400000L);
- default :
- break;
- }
- return jjStartNfa_0(10, active0);
-}
-private final int jjMoveStringLiteralDfa12_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L)
- return jjStartNfa_0(10, old0);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(11, active0);
- return 12;
- }
- switch(curChar)
- {
- case 110:
- return jjMoveStringLiteralDfa13_0(active0, 0x400000L);
- case 116:
- return jjMoveStringLiteralDfa13_0(active0, 0x200000L);
- default :
- break;
- }
- return jjStartNfa_0(11, active0);
-}
-private final int jjMoveStringLiteralDfa13_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L)
- return jjStartNfa_0(11, old0);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(12, active0);
- return 13;
- }
- switch(curChar)
- {
- case 105:
- return jjMoveStringLiteralDfa14_0(active0, 0x400000L);
- case 121:
- if ((active0 & 0x200000L) != 0L)
- return jjStartNfaWithStates_0(13, 21, 51);
- break;
- default :
- break;
- }
- return jjStartNfa_0(12, active0);
-}
-private final int jjMoveStringLiteralDfa14_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L)
- return jjStartNfa_0(12, old0);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(13, active0);
- return 14;
- }
- switch(curChar)
- {
- case 116:
- return jjMoveStringLiteralDfa15_0(active0, 0x400000L);
- default :
- break;
- }
- return jjStartNfa_0(13, active0);
-}
-private final int jjMoveStringLiteralDfa15_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L)
- return jjStartNfa_0(13, old0);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_0(14, active0);
- return 15;
- }
- switch(curChar)
- {
- case 121:
- if ((active0 & 0x400000L) != 0L)
- return jjStartNfaWithStates_0(15, 22, 51);
- break;
- default :
- break;
- }
- return jjStartNfa_0(14, active0);
-}
-private final void jjCheckNAdd(int state)
-{
- if (jjrounds[state] != jjround)
- {
- jjstateSet[jjnewStateCnt++] = state;
- jjrounds[state] = jjround;
- }
-}
-private final void jjAddStates(int start, int end)
-{
- do {
- jjstateSet[jjnewStateCnt++] = jjnextStates[start];
- } while (start++ != end);
-}
-private final void jjCheckNAddTwoStates(int state1, int state2)
-{
- jjCheckNAdd(state1);
- jjCheckNAdd(state2);
-}
-private final void jjCheckNAddStates(int start, int end)
-{
- do {
- jjCheckNAdd(jjnextStates[start]);
- } while (start++ != end);
-}
-private final void jjCheckNAddStates(int start)
-{
- jjCheckNAdd(jjnextStates[start]);
- jjCheckNAdd(jjnextStates[start + 1]);
-}
-static final long[] jjbitVec0 = {
- 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL
-};
-private final int jjMoveNfa_0(int startState, int curPos)
-{
- int[] nextStates;
- int startsAt = 0;
- jjnewStateCnt = 47;
- int i = 1;
- jjstateSet[0] = startState;
- int j, kind = 0x7fffffff;
- for (;;)
- {
- if (++jjround == 0x7fffffff)
- ReInitRounds();
- if (curChar < 64)
- {
- long l = 1L << curChar;
- MatchLoop: do
- {
- switch(jjstateSet[--i])
- {
- case 49:
- if ((0x3ff200000000000L & l) != 0L)
- jjCheckNAddTwoStates(18, 19);
- if ((0x3ff000000000000L & l) != 0L)
- {
- if (kind > 31)
- kind = 31;
- jjCheckNAddStates(0, 2);
- }
- if ((0x3ff000000000000L & l) != 0L)
- {
- if (kind > 31)
- kind = 31;
- jjCheckNAdd(20);
- }
- if ((0x3ff000000000000L & l) != 0L)
- {
- if (kind > 31)
- kind = 31;
- jjCheckNAdd(19);
- }
- break;
- case 48:
- if ((0x3ff200000000000L & l) != 0L)
- jjCheckNAddTwoStates(18, 19);
- else if (curChar == 58)
- jjCheckNAddStates(3, 5);
- if ((0x3ff000000000000L & l) != 0L)
- {
- if (kind > 31)
- kind = 31;
- jjCheckNAddStates(0, 2);
- }
- else if (curChar == 58)
- jjCheckNAddTwoStates(23, 25);
- if ((0x3ff000000000000L & l) != 0L)
- {
- if (kind > 31)
- kind = 31;
- jjCheckNAdd(20);
- }
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(26, 27);
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(23, 24);
- break;
- case 47:
- if ((0x3ff200000000000L & l) != 0L)
- jjCheckNAddTwoStates(18, 19);
- if ((0x3ff000000000000L & l) != 0L)
- {
- if (kind > 31)
- kind = 31;
- jjCheckNAddStates(0, 2);
- }
- if ((0x3ff000000000000L & l) != 0L)
- {
- if (kind > 31)
- kind = 31;
- jjCheckNAdd(20);
- }
- break;
- case 50:
- if ((0x3ff200000000000L & l) != 0L)
- jjCheckNAddTwoStates(18, 19);
- else if (curChar == 58)
- jjCheckNAddStates(3, 5);
- if ((0x3ff000000000000L & l) != 0L)
- {
- if (kind > 31)
- kind = 31;
- jjCheckNAddStates(0, 2);
- }
- else if (curChar == 58)
- jjCheckNAddTwoStates(23, 25);
- if ((0x3ff000000000000L & l) != 0L)
- {
- if (kind > 31)
- kind = 31;
- jjCheckNAdd(20);
- }
- if ((0x3ff000000000000L & l) != 0L)
- {
- if (kind > 31)
- kind = 31;
- jjCheckNAdd(19);
- }
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(26, 27);
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(23, 24);
- break;
- case 5:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(6, 9);
- else if (curChar == 58)
- jjAddStates(10, 11);
- else if (curChar == 34)
- jjCheckNAddTwoStates(15, 16);
- else if (curChar == 35)
- jjCheckNAddStates(12, 14);
- else if (curChar == 45)
- jjstateSet[jjnewStateCnt++] = 0;
- if ((0x3ff000000000000L & l) != 0L)
- {
- if (kind > 31)
- kind = 31;
- jjCheckNAddStates(15, 17);
- }
- if ((0x3fe000000000000L & l) != 0L)
- {
- if (kind > 24)
- kind = 24;
- jjCheckNAddTwoStates(12, 13);
- }
- else if (curChar == 48)
- {
- if (kind > 24)
- kind = 24;
- jjCheckNAddStates(18, 20);
- }
- break;
- case 51:
- if ((0x3ff200000000000L & l) != 0L)
- jjCheckNAddTwoStates(18, 19);
- if ((0x3ff000000000000L & l) != 0L)
- {
- if (kind > 31)
- kind = 31;
- jjCheckNAdd(19);
- }
- break;
- case 0:
- if (curChar == 45)
- jjCheckNAddStates(21, 23);
- break;
- case 1:
- if ((0xffffffffffffdbffL & l) != 0L)
- jjCheckNAddStates(21, 23);
- break;
- case 2:
- if ((0x2400L & l) != 0L && kind > 5)
- kind = 5;
- break;
- case 3:
- if (curChar == 10 && kind > 5)
- kind = 5;
- break;
- case 4:
- if (curChar == 13)
- jjstateSet[jjnewStateCnt++] = 3;
- break;
- case 6:
- if (curChar == 35)
- jjCheckNAddStates(12, 14);
- break;
- case 7:
- if ((0xffffffffffffdbffL & l) != 0L)
- jjCheckNAddStates(12, 14);
- break;
- case 8:
- if ((0x2400L & l) != 0L && kind > 6)
- kind = 6;
- break;
- case 9:
- if (curChar == 10 && kind > 6)
- kind = 6;
- break;
- case 10:
- if (curChar == 13)
- jjstateSet[jjnewStateCnt++] = 9;
- break;
- case 11:
- if ((0x3fe000000000000L & l) == 0L)
- break;
- if (kind > 24)
- kind = 24;
- jjCheckNAddTwoStates(12, 13);
- break;
- case 12:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 24)
- kind = 24;
- jjCheckNAddTwoStates(12, 13);
- break;
- case 14:
- if (curChar == 34)
- jjCheckNAddTwoStates(15, 16);
- break;
- case 15:
- if ((0xfffffffbffffffffL & l) != 0L)
- jjCheckNAddTwoStates(15, 16);
- break;
- case 16:
- if (curChar == 34 && kind > 35)
- kind = 35;
- break;
- case 17:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 31)
- kind = 31;
- jjCheckNAddStates(15, 17);
- break;
- case 18:
- if ((0x3ff200000000000L & l) != 0L)
- jjCheckNAddTwoStates(18, 19);
- break;
- case 19:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 31)
- kind = 31;
- jjCheckNAdd(19);
- break;
- case 20:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 31)
- kind = 31;
- jjCheckNAdd(20);
- break;
- case 21:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 31)
- kind = 31;
- jjCheckNAddStates(0, 2);
- break;
- case 22:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(6, 9);
- break;
- case 23:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(23, 24);
- break;
- case 24:
- if (curChar == 58)
- jjCheckNAddTwoStates(23, 25);
- break;
- case 25:
- case 41:
- if (curChar == 58 && kind > 28)
- kind = 28;
- break;
- case 26:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(26, 27);
- break;
- case 27:
- if (curChar == 58)
- jjCheckNAddStates(3, 5);
- break;
- case 28:
- case 42:
- if (curChar == 58)
- jjCheckNAddTwoStates(29, 36);
- break;
- case 29:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(29, 30);
- break;
- case 30:
- if (curChar == 46)
- jjCheckNAdd(31);
- break;
- case 31:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(31, 32);
- break;
- case 32:
- if (curChar == 46)
- jjCheckNAdd(33);
- break;
- case 33:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(33, 34);
- break;
- case 34:
- if (curChar == 46)
- jjCheckNAdd(35);
- break;
- case 35:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 28)
- kind = 28;
- jjCheckNAdd(35);
- break;
- case 36:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 28)
- kind = 28;
- jjCheckNAddStates(24, 26);
- break;
- case 37:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(37, 28);
- break;
- case 38:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 28)
- kind = 28;
- jjCheckNAdd(38);
- break;
- case 39:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 28)
- kind = 28;
- jjCheckNAddStates(27, 31);
- break;
- case 40:
- if (curChar == 58)
- jjAddStates(10, 11);
- break;
- case 43:
- if (curChar != 48)
- break;
- if (kind > 24)
- kind = 24;
- jjCheckNAddStates(18, 20);
- break;
- case 45:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 24)
- kind = 24;
- jjCheckNAddTwoStates(45, 13);
- break;
- case 46:
- if ((0xff000000000000L & l) == 0L)
- break;
- if (kind > 24)
- kind = 24;
- jjCheckNAddTwoStates(46, 13);
- break;
- default : break;
- }
- } while(i != startsAt);
- }
- else if (curChar < 128)
- {
- long l = 1L << (curChar & 077);
- MatchLoop: do
- {
- switch(jjstateSet[--i])
- {
- case 49:
- if ((0x7fffffe87fffffeL & l) != 0L)
- jjCheckNAddTwoStates(18, 19);
- if ((0x7fffffe07fffffeL & l) != 0L)
- {
- if (kind > 31)
- kind = 31;
- jjCheckNAddStates(0, 2);
- }
- if ((0x7fffffe07fffffeL & l) != 0L)
- {
- if (kind > 31)
- kind = 31;
- jjCheckNAdd(20);
- }
- if ((0x7fffffe07fffffeL & l) != 0L)
- {
- if (kind > 31)
- kind = 31;
- jjCheckNAdd(19);
- }
- break;
- case 48:
- if ((0x7fffffe87fffffeL & l) != 0L)
- jjCheckNAddTwoStates(18, 19);
- if ((0x7fffffe07fffffeL & l) != 0L)
- {
- if (kind > 31)
- kind = 31;
- jjCheckNAddStates(0, 2);
- }
- if ((0x7fffffe07fffffeL & l) != 0L)
- {
- if (kind > 31)
- kind = 31;
- jjCheckNAdd(20);
- }
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddTwoStates(26, 27);
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddTwoStates(23, 24);
- break;
- case 47:
- if ((0x7fffffe87fffffeL & l) != 0L)
- jjCheckNAddTwoStates(18, 19);
- if ((0x7fffffe07fffffeL & l) != 0L)
- {
- if (kind > 31)
- kind = 31;
- jjCheckNAddStates(0, 2);
- }
- if ((0x7fffffe07fffffeL & l) != 0L)
- {
- if (kind > 31)
- kind = 31;
- jjCheckNAdd(20);
- }
- break;
- case 50:
- if ((0x7fffffe87fffffeL & l) != 0L)
- jjCheckNAddTwoStates(18, 19);
- if ((0x7fffffe07fffffeL & l) != 0L)
- {
- if (kind > 31)
- kind = 31;
- jjCheckNAddStates(0, 2);
- }
- if ((0x7fffffe07fffffeL & l) != 0L)
- {
- if (kind > 31)
- kind = 31;
- jjCheckNAdd(20);
- }
- if ((0x7fffffe07fffffeL & l) != 0L)
- {
- if (kind > 31)
- kind = 31;
- jjCheckNAdd(19);
- }
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddTwoStates(26, 27);
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddTwoStates(23, 24);
- break;
- case 5:
- if ((0x7fffffe07fffffeL & l) != 0L)
- {
- if (kind > 31)
- kind = 31;
- jjCheckNAddStates(15, 17);
- }
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(6, 9);
- break;
- case 51:
- if ((0x7fffffe87fffffeL & l) != 0L)
- jjCheckNAddTwoStates(18, 19);
- if ((0x7fffffe07fffffeL & l) != 0L)
- {
- if (kind > 31)
- kind = 31;
- jjCheckNAdd(19);
- }
- break;
- case 1:
- jjAddStates(21, 23);
- break;
- case 7:
- jjAddStates(12, 14);
- break;
- case 13:
- if ((0x100000001000L & l) != 0L && kind > 24)
- kind = 24;
- break;
- case 15:
- jjAddStates(32, 33);
- break;
- case 17:
- if ((0x7fffffe07fffffeL & l) == 0L)
- break;
- if (kind > 31)
- kind = 31;
- jjCheckNAddStates(15, 17);
- break;
- case 18:
- if ((0x7fffffe87fffffeL & l) != 0L)
- jjCheckNAddTwoStates(18, 19);
- break;
- case 19:
- if ((0x7fffffe07fffffeL & l) == 0L)
- break;
- if (kind > 31)
- kind = 31;
- jjCheckNAdd(19);
- break;
- case 20:
- if ((0x7fffffe07fffffeL & l) == 0L)
- break;
- if (kind > 31)
- kind = 31;
- jjCheckNAdd(20);
- break;
- case 21:
- if ((0x7fffffe07fffffeL & l) == 0L)
- break;
- if (kind > 31)
- kind = 31;
- jjCheckNAddStates(0, 2);
- break;
- case 22:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddStates(6, 9);
- break;
- case 23:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddTwoStates(23, 24);
- break;
- case 26:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddTwoStates(26, 27);
- break;
- case 36:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 28)
- kind = 28;
- jjCheckNAddStates(24, 26);
- break;
- case 37:
- if ((0x7e0000007eL & l) != 0L)
- jjCheckNAddTwoStates(37, 28);
- break;
- case 38:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 28)
- kind = 28;
- jjCheckNAdd(38);
- break;
- case 39:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 28)
- kind = 28;
- jjCheckNAddStates(27, 31);
- break;
- case 44:
- if ((0x100000001000000L & l) != 0L)
- jjCheckNAdd(45);
- break;
- case 45:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 24)
- kind = 24;
- jjCheckNAddTwoStates(45, 13);
- break;
- default : break;
- }
- } while(i != startsAt);
- }
- else
- {
- int i2 = (curChar & 0xff) >> 6;
- long l2 = 1L << (curChar & 077);
- MatchLoop: do
- {
- switch(jjstateSet[--i])
- {
- case 1:
- if ((jjbitVec0[i2] & l2) != 0L)
- jjAddStates(21, 23);
- break;
- case 7:
- if ((jjbitVec0[i2] & l2) != 0L)
- jjAddStates(12, 14);
- break;
- case 15:
- if ((jjbitVec0[i2] & l2) != 0L)
- jjAddStates(32, 33);
- break;
- default : break;
- }
- } while(i != startsAt);
- }
- if (kind != 0x7fffffff)
- {
- jjmatchedKind = kind;
- jjmatchedPos = curPos;
- kind = 0x7fffffff;
- }
- ++curPos;
- if ((i = jjnewStateCnt) == (startsAt = 47 - (jjnewStateCnt = startsAt)))
- return curPos;
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) { return curPos; }
- }
-}
-static final int[] jjnextStates = {
- 18, 19, 21, 28, 29, 39, 23, 24, 26, 27, 41, 42, 7, 8, 10, 18,
- 20, 21, 44, 46, 13, 1, 2, 4, 37, 28, 38, 26, 27, 37, 28, 38,
- 15, 16,
-};
-public static final String[] jjstrLiteralImages = {
-"", null, null, null, null, null, null, "\141\143\143\145\163\163",
-"\141\143\154", "\75", "\143\157\155\155\165\156\151\164\151\145\163",
-"\145\156\164\145\162\160\162\151\163\145", "\150\157\163\164\163", "\173", "\155\141\156\141\147\145\162\163", "\55",
-"\175", "\162\145\141\144\55\157\156\154\171",
-"\162\145\141\144\55\167\162\151\164\145", "\164\162\141\160", "\151\156\146\157\162\155",
-"\164\162\141\160\55\143\157\155\155\165\156\151\164\171", "\151\156\146\157\162\155\55\143\157\155\155\165\156\151\164\171",
-"\164\162\141\160\55\156\165\155", null, null, null, null, null, null, null, null, null, null, null, null, "\54",
-"\56", "\41", "\57", };
-public static final String[] lexStateNames = {
- "DEFAULT",
-};
-static final long[] jjtoToken = {
- 0xf891ffff81L,
-};
-static final long[] jjtoSkip = {
- 0x7eL,
-};
-private ASCII_CharStream input_stream;
-private final int[] jjrounds = new int[47];
-private final int[] jjstateSet = new int[94];
-protected char curChar;
-public ParserTokenManager(ASCII_CharStream stream)
-{
- if (ASCII_CharStream.staticFlag)
- throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer.");
- input_stream = stream;
-}
-public ParserTokenManager(ASCII_CharStream stream, int lexState)
-{
- this(stream);
- SwitchTo(lexState);
-}
-public void ReInit(ASCII_CharStream stream)
-{
- jjmatchedPos = jjnewStateCnt = 0;
- curLexState = defaultLexState;
- input_stream = stream;
- ReInitRounds();
-}
-private final void ReInitRounds()
-{
- int i;
- jjround = 0x80000001;
- for (i = 47; i-- > 0;)
- jjrounds[i] = 0x80000000;
-}
-public void ReInit(ASCII_CharStream stream, int lexState)
-{
- ReInit(stream);
- SwitchTo(lexState);
-}
-public void SwitchTo(int lexState)
-{
- if (lexState >= 1 || lexState < 0)
- throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE);
- else
- curLexState = lexState;
-}
-
-private final Token jjFillToken()
-{
- Token t = Token.newToken(jjmatchedKind);
- t.kind = jjmatchedKind;
- String im = jjstrLiteralImages[jjmatchedKind];
- t.image = (im == null) ? input_stream.GetImage() : im;
- t.beginLine = input_stream.getBeginLine();
- t.beginColumn = input_stream.getBeginColumn();
- t.endLine = input_stream.getEndLine();
- t.endColumn = input_stream.getEndColumn();
- return t;
-}
-
-int curLexState = 0;
-int defaultLexState = 0;
-int jjnewStateCnt;
-int jjround;
-int jjmatchedPos;
-int jjmatchedKind;
-
-public final Token getNextToken()
-{
- int kind;
- Token specialToken = null;
- Token matchedToken;
- int curPos = 0;
-
- EOFLoop :
- for (;;)
- {
- try
- {
- curChar = input_stream.BeginToken();
- }
- catch(java.io.IOException e)
- {
- jjmatchedKind = 0;
- matchedToken = jjFillToken();
- return matchedToken;
- }
-
- try { input_stream.backup(0);
- while (curChar <= 32 && (0x100002600L & (1L << curChar)) != 0L)
- curChar = input_stream.BeginToken();
- }
- catch (java.io.IOException e1) { continue EOFLoop; }
- jjmatchedKind = 0x7fffffff;
- jjmatchedPos = 0;
- curPos = jjMoveStringLiteralDfa0_0();
- if (jjmatchedKind != 0x7fffffff)
- {
- if (jjmatchedPos + 1 < curPos)
- input_stream.backup(curPos - jjmatchedPos - 1);
- if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
- {
- matchedToken = jjFillToken();
- return matchedToken;
- }
- else
- {
- continue EOFLoop;
- }
- }
- int error_line = input_stream.getEndLine();
- int error_column = input_stream.getEndColumn();
- String error_after = null;
- boolean EOFSeen = false;
- try { input_stream.readChar(); input_stream.backup(1); }
- catch (java.io.IOException e1) {
- EOFSeen = true;
- error_after = curPos <= 1 ? "" : input_stream.GetImage();
- if (curChar == '\n' || curChar == '\r') {
- error_line++;
- error_column = 0;
- }
- else
- error_column++;
- }
- if (!EOFSeen) {
- input_stream.backup(1);
- error_after = curPos <= 1 ? "" : input_stream.GetImage();
- }
- throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR);
- }
-}
-
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/ParserTreeConstants.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/ParserTreeConstants.java
deleted file mode 100644
index f5890086f59..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/ParserTreeConstants.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* Generated By:JJTree: Do not edit this line. ParserTreeConstants.java */
-
-package com.sun.jmx.snmp.IPAcl;
-
-interface ParserTreeConstants
-{
- public int JJTSECURITYDEFS = 0;
- public int JJTACLBLOCK = 1;
- public int JJTACLITEM = 2;
- public int JJTCOMMUNITIES = 3;
- public int JJTCOMMUNITY = 4;
- public int JJTACCESS = 5;
- public int JJTMANAGERS = 6;
- public int JJTHOST = 7;
- public int JJTHOSTNAME = 8;
- public int JJTIPADDRESS = 9;
- public int JJTIPV6ADDRESS = 10;
- public int JJTIPMASK = 11;
- public int JJTNETMASK = 12;
- public int JJTNETMASKV6 = 13;
- public int JJTTRAPBLOCK = 14;
- public int JJTTRAPITEM = 15;
- public int JJTTRAPCOMMUNITY = 16;
- public int JJTTRAPINTERESTEDHOST = 17;
- public int JJTHOSTTRAP = 18;
- public int JJTENTERPRISE = 19;
- public int JJTTRAPNUM = 20;
- public int JJTINFORMBLOCK = 21;
- public int JJTINFORMITEM = 22;
- public int JJTINFORMCOMMUNITY = 23;
- public int JJTINFORMINTERESTEDHOST = 24;
- public int JJTHOSTINFORM = 25;
-
-
- public String[] jjtNodeName = {
- "SecurityDefs",
- "AclBlock",
- "AclItem",
- "Communities",
- "Community",
- "Access",
- "Managers",
- "Host",
- "HostName",
- "IpAddress",
- "IpV6Address",
- "IpMask",
- "NetMask",
- "NetMaskV6",
- "TrapBlock",
- "TrapItem",
- "TrapCommunity",
- "TrapInterestedHost",
- "HostTrap",
- "Enterprise",
- "TrapNum",
- "InformBlock",
- "InformItem",
- "InformCommunity",
- "InformInterestedHost",
- "HostInform",
- };
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/PermissionImpl.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/PermissionImpl.java
deleted file mode 100644
index 16d06555e11..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/PermissionImpl.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package com.sun.jmx.snmp.IPAcl;
-
-
-
-import java.io.Serializable;
-
-
-/**
- * Permission is represented as a String.
- *
- * @see java.security.acl.Permission
- */
-
-class PermissionImpl implements java.security.acl.Permission, Serializable {
- private static final long serialVersionUID = 4478110422746916589L;
-
- private String perm = null;
-
- /**
- * Constructs a permission.
- *
- * @param s the string representing the permission.
- */
- public PermissionImpl(String s) {
- perm = s;
- }
-
- public int hashCode() {
- return super.hashCode();
- }
-
- /**
- * Returns true if the object passed matches the permission represented in.
- *
- * @param p the Permission object to compare with.
- * @return true if the Permission objects are equal, false otherwise.
- */
- public boolean equals(Object p){
- if (p instanceof PermissionImpl){
- return perm.equals(((PermissionImpl)p).getString());
- } else {
- return false;
- }
- }
-
- /**
- * Prints a string representation of this permission.
- *
- * @return a string representation of this permission.
- */
- public String toString(){
- return perm;
- }
-
- /**
- * Prints the permission.
- *
- * @return a string representation of this permission.
- */
- public String getString(){
- return perm;
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/PrincipalImpl.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/PrincipalImpl.java
deleted file mode 100644
index 74513262610..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/PrincipalImpl.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package com.sun.jmx.snmp.IPAcl;
-
-
-
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.io.Serializable;
-
-
-/**
- * Principal represents a host.
- *
- */
-
-class PrincipalImpl implements java.security.Principal, Serializable {
- private static final long serialVersionUID = -7910027842878976761L;
-
- private InetAddress[] add = null;
-
- /**
- * Constructs a principal with the local host.
- */
- public PrincipalImpl () throws UnknownHostException {
- add = new InetAddress[1];
- add[0] = java.net.InetAddress.getLocalHost();
- }
-
- /**
- * Construct a principal using the specified host.
- *
- * The host can be either:
- *
- *
a host name
- *
an IP address
- *
- *
- * @param hostName the host used to make the principal.
- */
- public PrincipalImpl(String hostName) throws UnknownHostException {
- if ((hostName.equals("localhost")) || (hostName.equals("127.0.0.1"))) {
- add = new InetAddress[1];
- add[0] = java.net.InetAddress.getByName(hostName);
- }
- else
- add = java.net.InetAddress.getAllByName( hostName );
- }
-
- /**
- * Constructs a principal using an Internet Protocol (IP) address.
- *
- * @param address the Internet Protocol (IP) address.
- */
- public PrincipalImpl(InetAddress address) {
- add = new InetAddress[1];
- add[0] = address;
- }
-
- /**
- * Returns the name of this principal.
- *
- * @return the name of this principal.
- */
- public String getName() {
- return add[0].toString();
- }
-
- /**
- * Compares this principal to the specified object. Returns true if the
- * object passed in matches the principal
- * represented by the implementation of this interface.
- *
- * @param a the principal to compare with.
- * @return true if the principal passed in is the same as that encapsulated by this principal, false otherwise.
- */
- public boolean equals(Object a) {
- if (a instanceof PrincipalImpl){
- for(int i = 0; i < add.length; i++) {
- if(add[i].equals (((PrincipalImpl) a).getAddress()))
- return true;
- }
- return false;
- } else {
- return false;
- }
- }
-
- /**
- * Returns a hashcode for this principal.
- *
- * @return a hashcode for this principal.
- */
- public int hashCode(){
- return add[0].hashCode();
- }
-
- /**
- * Returns a string representation of this principal. In case of multiple address, the first one is returned.
- *
- * @return a string representation of this principal.
- */
- public String toString() {
- return ("PrincipalImpl :"+add[0].toString());
- }
-
- /**
- * Returns the Internet Protocol (IP) address for this principal. In case of multiple address, the first one is returned.
- *
- * @return the Internet Protocol (IP) address for this principal.
- */
- public InetAddress getAddress(){
- return add[0];
- }
-
- /**
- * Returns the Internet Protocol (IP) address for this principal. In case of multiple address, the first one is returned.
- *
- * @return the array of Internet Protocol (IP) addresses for this principal.
- */
- public InetAddress[] getAddresses(){
- return add;
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/README.update b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/README.update
deleted file mode 100644
index 86232e84391..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/README.update
+++ /dev/null
@@ -1,29 +0,0 @@
-1)Copy Parser.jjt in a dedicated directory.
-
-2) Grammar modificatiobns:
-Grammar located in file Parser.jjt :
-
-3) Command :
-/usr/lang/JAVA/JavaCC_2.0/bin/jjtree Parser.jjt
-/usr/lang/JAVA/JavaCC_2.0/bin/javacc Parser.jj
-
-4) Files to copy back in IPAcl directory:
-If you added new node (eg :IpV6Address()) copy the JDM file (eg:JDMIpV6Address.java)
-In any cases copy back (These files must be checkedout in IPAcl directory):
-ASCII_CharStream.java
-JJTParserState.java
-ParseException.java
-Parser.java
-ParserConstants.java
-ParserTokenManager.java
-ParserTreeConstants.java
-TokenMgrError.java
-
-5) You need to modify any JDM files you copied back. Lauch the compilation and you will see what is wrong.
-Have a look to similar nodes in order to see how to modify. Some protected methods have to be overloaded.
-
-6) Once your updates are running, copy back:
-Parser.jj
-Parser.jjt
-
-7) DONE.
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/SimpleNode.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/SimpleNode.java
deleted file mode 100644
index 65484a3c2b3..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/SimpleNode.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/* Generated By:JJTree: Do not edit this line. SimpleNode.java */
-
-package com.sun.jmx.snmp.IPAcl;
-
-import java.net.InetAddress;
-import java.util.Hashtable;
-import java.util.Vector;
-
-class SimpleNode implements Node {
- protected Node parent;
- protected Node[] children;
- protected int id;
- protected Parser parser;
-
- public SimpleNode(int i) {
- id = i;
- }
-
- public SimpleNode(Parser p, int i) {
- this(i);
- parser = p;
- }
-
- public static Node jjtCreate(int id) {
- return new SimpleNode(id);
- }
-
- public static Node jjtCreate(Parser p, int id) {
- return new SimpleNode(p, id);
- }
-
- public void jjtOpen() {
- }
-
- public void jjtClose() {
- }
-
- public void jjtSetParent(Node n) { parent = n; }
- public Node jjtGetParent() { return parent; }
-
- public void jjtAddChild(Node n, int i) {
- if (children == null) {
- children = new Node[i + 1];
- } else if (i >= children.length) {
- Node c[] = new Node[i + 1];
- System.arraycopy(children, 0, c, 0, children.length);
- children = c;
- }
- children[i] = n;
- }
-
- public Node jjtGetChild(int i) {
- return children[i];
- }
-
- public int jjtGetNumChildren() {
- return (children == null) ? 0 : children.length;
- }
-
- /*
- SR. Extend the SimpleNode definition
- */
-
- /**
- * Build the Trap entries from the syntactic tree.
- */
- public void buildTrapEntries(Hashtable> dest) {
- if (children != null) {
- for (int i = 0; i < children.length; ++i) {
- SimpleNode n = (SimpleNode)children[i];
- if (n != null) {
- n.buildTrapEntries(dest);
- }
- } /* end of loop */
- }
- }
- /**
- * Build the Inform entries from the syntactic tree.
- */
- public void buildInformEntries(Hashtable> dest) {
- if (children != null) {
- for (int i = 0; i < children.length; ++i) {
- SimpleNode n = (SimpleNode)children[i];
- if (n != null) {
- n.buildInformEntries(dest);
- }
- } /* end of loop */
- }
- }
-
- /**
- * Build the Acl entries from the syntactic tree.
- */
- public void buildAclEntries(PrincipalImpl owner, AclImpl acl) {
- if (children != null) {
- for (int i = 0; i < children.length; ++i) {
- SimpleNode n = (SimpleNode)children[i];
- if (n != null) {
- n.buildAclEntries(owner, acl);
- }
- } /* end of loop */
- }
- }
-
- /* END SR */
-
- /* You can override these two methods in subclasses of SimpleNode to
- customize the way the node appears when the tree is dumped. If
- your output uses more than one line you should override
- toString(String), otherwise overriding toString() is probably all
- you need to do. */
-
- public String toString() { return ParserTreeConstants.jjtNodeName[id]; }
- public String toString(String prefix) { return prefix + toString(); }
-
- /* Override this method if you want to customize how the node dumps
- out its children. */
-
- public void dump(String prefix) {
- if (children != null) {
- for (int i = 0; i < children.length; ++i) {
- SimpleNode n = (SimpleNode)children[i];
- if (n != null) {
- n.dump(prefix + " ");
- }
- }
- }
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/SnmpAcl.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/SnmpAcl.java
deleted file mode 100644
index 1a3fb7cc0cf..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/SnmpAcl.java
+++ /dev/null
@@ -1,486 +0,0 @@
-/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package com.sun.jmx.snmp.IPAcl;
-
-
-
-// java import
-//
-import java.io.Serializable;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.Hashtable;
-import java.util.logging.Level;
-import java.util.Vector;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.security.acl.AclEntry;
-import java.security.acl.NotOwnerException;
-
-// SNMP Runtime import
-//
-import static com.sun.jmx.defaults.JmxProperties.SNMP_LOGGER;
-import com.sun.jmx.snmp.InetAddressAcl;
-
-/**
- * Defines an implementation of the {@link com.sun.jmx.snmp.InetAddressAcl InetAddressAcl} interface.
- *
- * In this implementation the ACL information is stored on a flat file and
- * its default location is "$JRE/lib/snmp.acl" - See
- * {@link #getDefaultAclFileName()}
- *
- *
- *
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- */
-
-public class SnmpAcl implements InetAddressAcl, Serializable {
- private static final long serialVersionUID = -6702287103824397063L;
-
- static final PermissionImpl READ = new PermissionImpl("READ");
- static final PermissionImpl WRITE = new PermissionImpl("WRITE");
-
- /**
- * Constructs the Java Dynamic Management(TM) Access Control List
- * based on IP addresses. The ACL will take the given owner name.
- * The current IP address will be the owner of the ACL.
- *
- * @param Owner The name of the ACL Owner.
- *
- * @exception UnknownHostException If the local host is unknown.
- * @exception IllegalArgumentException If the ACL file doesn't exist.
- */
- public SnmpAcl(String Owner)
- throws UnknownHostException, IllegalArgumentException {
- this(Owner,null);
- }
-
- /**
- * Constructs the Java Dynamic Management(TM) Access Control List
- * based on IP addresses. The ACL will take the given owner name.
- * The current IP address will be the owner of the ACL.
- *
- * @param Owner The name of the ACL Owner.
- * @param aclFileName The name of the ACL File.
- *
- * @exception UnknownHostException If the local host is unknown.
- * @exception IllegalArgumentException If the ACL file doesn't exist.
- */
- public SnmpAcl(String Owner, String aclFileName)
- throws UnknownHostException, IllegalArgumentException {
- trapDestList= new Hashtable>();
- informDestList= new Hashtable>();
-
- // PrincipalImpl() take the current host as entry
- owner = new PrincipalImpl();
- try {
- acl = new AclImpl(owner,Owner);
- AclEntry ownEntry = new AclEntryImpl(owner);
- ownEntry.addPermission(READ);
- ownEntry.addPermission(WRITE);
- acl.addEntry(owner,ownEntry);
- } catch (NotOwnerException ex) {
- if (SNMP_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_LOGGER.logp(Level.FINEST, SnmpAcl.class.getName(),
- "SnmpAcl(String,String)",
- "Should never get NotOwnerException as the owner " +
- "is built in this constructor");
- }
- }
- if (aclFileName == null) setDefaultFileName();
- else setAuthorizedListFile(aclFileName);
- readAuthorizedListFile();
- }
-
- /**
- * Returns an enumeration of the entries in this ACL. Each element in the
- * enumeration is of type java.security.acl.AclEntry.
- *
- * @return An enumeration of the entries in this ACL.
- */
- public Enumeration entries() {
- return acl.entries();
- }
-
- /**
- * Returns ann enumeration of community strings. Community strings are returned as String.
- * @return The enumeration of community strings.
- */
- public Enumeration communities() {
- HashSet set = new HashSet();
- Vector res = new Vector();
- for (Enumeration e = acl.entries() ; e.hasMoreElements() ;) {
- AclEntryImpl entry = (AclEntryImpl) e.nextElement();
- for (Enumeration cs = entry.communities();
- cs.hasMoreElements() ;) {
- set.add(cs.nextElement());
- }
- }
- String[] objs = set.toArray(new String[0]);
- for(int i = 0; i < objs.length; i++)
- res.addElement(objs[i]);
-
- return res.elements();
- }
-
- /**
- * Returns the name of the ACL.
- *
- * @return The name of the ACL.
- */
- public String getName() {
- return acl.getName();
- }
-
- /**
- * Returns the read permission instance used.
- *
- * @return The read permission instance.
- */
- static public PermissionImpl getREAD() {
- return READ;
- }
-
- /**
- * Returns the write permission instance used.
- *
- * @return The write permission instance.
- */
- static public PermissionImpl getWRITE() {
- return WRITE;
- }
-
- /**
- * Get the default name for the ACL file.
- * In this implementation this is "$JRE/lib/snmp.acl"
- * @return The default name for the ACL file.
- **/
- public static String getDefaultAclFileName() {
- final String fileSeparator =
- System.getProperty("file.separator");
- final StringBuilder defaultAclName =
- new StringBuilder(System.getProperty("java.home")).
- append(fileSeparator).append("lib").append(fileSeparator).
- append("snmp.acl");
- return defaultAclName.toString();
- }
-
- /**
- * Sets the full path of the file containing the ACL information.
- *
- * @param filename The full path of the file containing the ACL information.
- * @throws IllegalArgumentException If the passed ACL file doesn't exist.
- */
- public void setAuthorizedListFile(String filename)
- throws IllegalArgumentException {
- File file = new File(filename);
- if (!file.isFile() ) {
- if (SNMP_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_LOGGER.logp(Level.FINEST, SnmpAcl.class.getName(),
- "setAuthorizedListFile", "ACL file not found: " + filename);
- }
- throw new
- IllegalArgumentException("The specified file ["+file+"] "+
- "doesn't exist or is not a file, "+
- "no configuration loaded");
- }
- if (SNMP_LOGGER.isLoggable(Level.FINER)) {
- SNMP_LOGGER.logp(Level.FINER, SnmpAcl.class.getName(),
- "setAuthorizedListFile", "Default file set to " + filename);
- }
- authorizedListFile = filename;
- }
-
- /**
- * Resets this ACL to the values contained in the configuration file.
- *
- * @exception NotOwnerException If the principal attempting the reset is not an owner of this ACL.
- * @exception UnknownHostException If IP addresses for hosts contained in the ACL file couldn't be found.
- */
- public void rereadTheFile() throws NotOwnerException, UnknownHostException {
- alwaysAuthorized = false;
- acl.removeAll(owner);
- trapDestList.clear();
- informDestList.clear();
- AclEntry ownEntry = new AclEntryImpl(owner);
- ownEntry.addPermission(READ);
- ownEntry.addPermission(WRITE);
- acl.addEntry(owner,ownEntry);
- readAuthorizedListFile();
- }
-
- /**
- * Returns the full path of the file used to get ACL information.
- *
- * @return The full path of the file used to get ACL information.
- */
- public String getAuthorizedListFile() {
- return authorizedListFile;
- }
-
- /**
- * Checks whether or not the specified host has READ access.
- *
- * @param address The host address to check.
- *
- * @return true if the host has read permission, false otherwise.
- */
- public boolean checkReadPermission(InetAddress address) {
- if (alwaysAuthorized) return ( true );
- PrincipalImpl p = new PrincipalImpl(address);
- return acl.checkPermission(p, READ);
- }
-
- /**
- * Checks whether or not the specified host and community have READ access.
- *
- * @param address The host address to check.
- * @param community The community associated with the host.
- *
- * @return true if the pair (host, community) has read permission, false otherwise.
- */
- public boolean checkReadPermission(InetAddress address, String community) {
- if (alwaysAuthorized) return ( true );
- PrincipalImpl p = new PrincipalImpl(address);
- return acl.checkPermission(p, community, READ);
- }
-
- /**
- * Checks whether or not a community string is defined.
- *
- * @param community The community to check.
- *
- * @return true if the community is known, false otherwise.
- */
- public boolean checkCommunity(String community) {
- return acl.checkCommunity(community);
- }
-
- /**
- * Checks whether or not the specified host has WRITE access.
- *
- * @param address The host address to check.
- *
- * @return true if the host has write permission, false otherwise.
- */
- public boolean checkWritePermission(InetAddress address) {
- if (alwaysAuthorized) return ( true );
- PrincipalImpl p = new PrincipalImpl(address);
- return acl.checkPermission(p, WRITE);
- }
-
- /**
- * Checks whether or not the specified host and community have WRITE access.
- *
- * @param address The host address to check.
- * @param community The community associated with the host.
- *
- * @return true if the pair (host, community) has write permission, false otherwise.
- */
- public boolean checkWritePermission(InetAddress address, String community) {
- if (alwaysAuthorized) return ( true );
- PrincipalImpl p = new PrincipalImpl(address);
- return acl.checkPermission(p, community, WRITE);
- }
-
- /**
- * Returns an enumeration of trap destinations.
- *
- * @return An enumeration of the trap destinations (enumeration of InetAddress).
- */
- public Enumeration getTrapDestinations() {
- return trapDestList.keys();
- }
-
- /**
- * Returns an enumeration of trap communities for a given host.
- *
- * @param i The address of the host.
- *
- * @return An enumeration of trap communities for a given host (enumeration of String).
- */
- public Enumeration getTrapCommunities(InetAddress i) {
- Vector list = null;
- if ((list = trapDestList.get(i)) != null ) {
- if (SNMP_LOGGER.isLoggable(Level.FINER)) {
- SNMP_LOGGER.logp(Level.FINER, SnmpAcl.class.getName(),
- "getTrapCommunities", "["+i.toString()+"] is in list");
- }
- return list.elements();
- } else {
- list = new Vector<>();
- if (SNMP_LOGGER.isLoggable(Level.FINER)) {
- SNMP_LOGGER.logp(Level.FINER, SnmpAcl.class.getName(),
- "getTrapCommunities", "["+i.toString()+"] is not in list");
- }
- return list.elements();
- }
- }
-
- /**
- * Returns an enumeration of inform destinations.
- *
- * @return An enumeration of the inform destinations (enumeration of InetAddress).
- */
- public Enumeration getInformDestinations() {
- return informDestList.keys();
- }
-
- /**
- * Returns an enumeration of inform communities for a given host.
- *
- * @param i The address of the host.
- *
- * @return An enumeration of inform communities for a given host (enumeration of String).
- */
- public Enumeration getInformCommunities(InetAddress i) {
- Vector list = null;
- if ((list = informDestList.get(i)) != null ) {
- if (SNMP_LOGGER.isLoggable(Level.FINER)) {
- SNMP_LOGGER.logp(Level.FINER, SnmpAcl.class.getName(),
- "getInformCommunities", "["+i.toString()+"] is in list");
- }
- return list.elements();
- } else {
- list = new Vector<>();
- if (SNMP_LOGGER.isLoggable(Level.FINER)) {
- SNMP_LOGGER.logp(Level.FINER, SnmpAcl.class.getName(),
- "getInformCommunities", "["+i.toString()+"] is not in list");
- }
- return list.elements();
- }
- }
-
- /**
- * Converts the input configuration file into ACL.
- */
- private void readAuthorizedListFile() {
-
- alwaysAuthorized = false;
-
- if (authorizedListFile == null) {
- if (SNMP_LOGGER.isLoggable(Level.FINER)) {
- SNMP_LOGGER.logp(Level.FINER, SnmpAcl.class.getName(),
- "readAuthorizedListFile", "alwaysAuthorized set to true");
- }
- alwaysAuthorized = true ;
- } else {
- // Read the file content
- Parser parser = null;
- try {
- parser= new Parser(new FileInputStream(getAuthorizedListFile()));
- } catch (FileNotFoundException e) {
- if (SNMP_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_LOGGER.logp(Level.FINEST, SnmpAcl.class.getName(),
- "readAuthorizedListFile",
- "The specified file was not found, authorize everybody");
- }
- alwaysAuthorized = true ;
- return;
- }
-
- try {
- JDMSecurityDefs n = parser.SecurityDefs();
- n.buildAclEntries(owner, acl);
- n.buildTrapEntries(trapDestList);
- n.buildInformEntries(informDestList);
- } catch (ParseException e) {
- if (SNMP_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_LOGGER.logp(Level.FINEST, SnmpAcl.class.getName(),
- "readAuthorizedListFile", "Got parsing exception", e);
- }
- throw new IllegalArgumentException(e.getMessage());
- } catch (Error err) {
- if (SNMP_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_LOGGER.logp(Level.FINEST, SnmpAcl.class.getName(),
- "readAuthorizedListFile", "Got unexpected error", err);
- }
- throw new IllegalArgumentException(err.getMessage());
- }
-
- for(Enumeration e = acl.entries(); e.hasMoreElements();) {
- AclEntryImpl aa = (AclEntryImpl) e.nextElement();
- if (SNMP_LOGGER.isLoggable(Level.FINER)) {
- SNMP_LOGGER.logp(Level.FINER, SnmpAcl.class.getName(),
- "readAuthorizedListFile",
- "===> " + aa.getPrincipal().toString());
- }
- for (Enumeration eee = aa.permissions();eee.hasMoreElements();) {
- java.security.acl.Permission perm = eee.nextElement();
- if (SNMP_LOGGER.isLoggable(Level.FINER)) {
- SNMP_LOGGER.logp(Level.FINER, SnmpAcl.class.getName(),
- "readAuthorizedListFile", "perm = " + perm);
- }
- }
- }
- }
- }
-
- /**
- * Set the default full path for "snmp.acl" input file.
- * Do not complain if the file does not exists.
- */
- private void setDefaultFileName() {
- try {
- setAuthorizedListFile(getDefaultAclFileName());
- } catch (IllegalArgumentException x) {
- // OK...
- }
- }
-
-
- // PRIVATE VARIABLES
- //------------------
-
- /**
- * Represents the Access Control List.
- */
- private AclImpl acl = null;
- /**
- * Flag indicating whether the access is always authorized.
- * This is the case if there is no flat file defined.
- */
- private boolean alwaysAuthorized = false;
- /**
- * Represents the Access Control List flat file.
- */
- private String authorizedListFile = null;
- /**
- * Contains the hosts list for trap destination.
- */
- private Hashtable> trapDestList = null;
- /**
- * Contains the hosts list for inform destination.
- */
- private Hashtable> informDestList = null;
-
- private PrincipalImpl owner = null;
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/Token.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/Token.java
deleted file mode 100644
index d89d7d27725..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/Token.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/* Generated By:JavaCC: Do not edit this line. Token.java Version 0.7pre3 */
-package com.sun.jmx.snmp.IPAcl;
-
-/**
- * Describes the input token stream.
- */
-
-class Token {
-
- /**
- * An integer that describes the kind of this token. This numbering
- * system is determined by JavaCCParser, and a table of these numbers is
- * stored in the file ...Constants.java.
- */
- public int kind;
-
- /**
- * beginLine and beginColumn describe the position of the first character
- * of this token; endLine and endColumn describe the position of the
- * last character of this token.
- */
- public int beginLine, beginColumn, endLine, endColumn;
-
- /**
- * The string image of the token.
- */
- public String image;
-
- /**
- * A reference to the next regular (non-special) token from the input
- * stream. If this is the last token from the input stream, or if the
- * token manager has not read tokens beyond this one, this field is
- * set to null. This is true only if this token is also a regular
- * token. Otherwise, see below for a description of the contents of
- * this field.
- */
- public Token next;
-
- /**
- * This field is used to access special tokens that occur prior to this
- * token, but after the immediately preceding regular (non-special) token.
- * If there are no such special tokens, this field is set to null.
- * When there are more than one such special token, this field refers
- * to the last of these special tokens, which in turn refers to the next
- * previous special token through its specialToken field, and so on
- * until the first special token (whose specialToken field is null).
- * The next fields of special tokens refer to other special tokens that
- * immediately follow it (without an intervening regular token). If there
- * is no such token, this field is null.
- */
- public Token specialToken;
-
- /**
- * Returns the image.
- */
- public final String toString()
- {
- return image;
- }
-
- /**
- * Returns a new Token object, by default. However, if you want, you
- * can create and return subclass objects based on the value of ofKind.
- * Simply add the cases to the switch for all those special cases.
- * For example, if you have a subclass of Token called IDToken that
- * you want to create if ofKind is ID, simlpy add something like :
- *
- * case MyParserConstants.ID : return new IDToken();
- *
- * to the following switch statement. Then you can cast matchedToken
- * variable to the appropriate type and use it in your lexical actions.
- */
- public static final Token newToken(int ofKind)
- {
- switch(ofKind)
- {
- default : return new Token();
- }
- }
-
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/TokenMgrError.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/TokenMgrError.java
deleted file mode 100644
index b09c4530d83..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/TokenMgrError.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 0.7pre2 */
-package com.sun.jmx.snmp.IPAcl;
-
-class TokenMgrError extends Error
-{
- private static final long serialVersionUID = -6373071623408870347L;
-
- /*
- * Ordinals for various reasons why an Error of this type can be thrown.
- */
-
- /**
- * Lexical error occurred.
- */
- static final int LEXICAL_ERROR = 0;
-
- /**
- * An attempt wass made to create a second instance of a static token manager.
- */
- static final int STATIC_LEXER_ERROR = 1;
-
- /**
- * Tried to change to an invalid lexical state.
- */
- static final int INVALID_LEXICAL_STATE = 2;
-
- /**
- * Detected (and bailed out of) an infinite loop in the token manager.
- */
- static final int LOOP_DETECTED = 3;
-
- /**
- * Indicates the reason why the exception is thrown. It will have
- * one of the above 4 values.
- */
- int errorCode;
-
- /**
- * Replaces unprintable characters by their espaced (or unicode escaped)
- * equivalents in the given string
- */
- protected static final String addEscapes(String str) {
- StringBuilder retval = new StringBuilder();
- char ch;
- for (int i = 0; i < str.length(); i++) {
- switch (str.charAt(i))
- {
- case 0 :
- continue;
- case '\b':
- retval.append("\\b");
- continue;
- case '\t':
- retval.append("\\t");
- continue;
- case '\n':
- retval.append("\\n");
- continue;
- case '\f':
- retval.append("\\f");
- continue;
- case '\r':
- retval.append("\\r");
- continue;
- case '\"':
- retval.append("\\\"");
- continue;
- case '\'':
- retval.append("\\\'");
- continue;
- case '\\':
- retval.append("\\\\");
- continue;
- default:
- if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
- String s = "0000" + Integer.toString(ch, 16);
- retval.append("\\u" + s.substring(s.length() - 4, s.length()));
- } else {
- retval.append(ch);
- }
- continue;
- }
- }
- return retval.toString();
- }
-
- /**
- * Returns a detailed message for the Error when it is thrown by the
- * token manager to indicate a lexical error.
- * Parameters :
- * EOFSeen : indicates if EOF caused the lexicl error
- * curLexState : lexical state in which this error occurred
- * errorLine : line number when the error occurred
- * errorColumn : column number when the error occurred
- * errorAfter : prefix that was seen before this error occurred
- * curchar : the offending character
- * Note: You can customize the lexical error message by modifying this method.
- */
- private static final String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {
- return("Lexical error at line " +
- errorLine + ", column " +
- errorColumn + ". Encountered: " +
- (EOFSeen ? " " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") +
- "after : \"" + addEscapes(errorAfter) + "\"");
- }
-
- /**
- * You can also modify the body of this method to customize your error messages.
- * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not
- * of end-users concern, so you can return something like :
- *
- * "Internal Error : Please file a bug report .... "
- *
- * from this method for such cases in the release version of your parser.
- */
- public String getMessage() {
- return super.getMessage();
- }
-
- /*
- * Constructors of various flavors follow.
- */
-
- public TokenMgrError() {
- }
-
- public TokenMgrError(String message, int reason) {
- super(message);
- errorCode = reason;
- }
-
- public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) {
- this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/package.html b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/package.html
deleted file mode 100644
index c3a9a1d14e1..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/IPAcl/package.html
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
-
-
-
-Provides the classes for storing ACL information in an ASCII file.
-
This API is a Sun Microsystems internal API and is subject
- to change without notice.
-
-
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/InetAddressAcl.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/InetAddressAcl.java
deleted file mode 100644
index 291671a71d0..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/InetAddressAcl.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.jmx.snmp;
-
-// java import
-//
-import java.net.InetAddress;
-import java.util.Enumeration;
-
-/**
- * Defines the IP address based ACL used by the SNMP protocol adaptor.
- *
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- * @since 1.5
- */
-
-public interface InetAddressAcl {
-
- /**
- * Returns the name of the ACL.
- *
- * @return The name of the ACL.
- */
- public String getName();
-
- /**
- * Checks whether or not the specified host has READ access.
- *
- * @param address The host address to check.
- *
- * @return true if the host has read permission, false otherwise.
- */
- public boolean checkReadPermission(InetAddress address);
-
- /**
- * Checks whether or not the specified host and community have READ access.
- *
- * @param address The host address to check.
- * @param community The community associated with the host.
- *
- * @return true if the pair (host, community) has read permission, false otherwise.
- */
- public boolean checkReadPermission(InetAddress address, String community);
-
- /**
- * Checks whether or not a community string is defined.
- *
- * @param community The community to check.
- *
- * @return true if the community is known, false otherwise.
- */
- public boolean checkCommunity(String community);
-
- /**
- * Checks whether or not the specified host has WRITE access.
- *
- * @param address The host address to check.
- *
- * @return true if the host has write permission, false otherwise.
- */
- public boolean checkWritePermission(InetAddress address);
-
- /**
- * Checks whether or not the specified host and community have WRITE access.
- *
- * @param address The host address to check.
- * @param community The community associated with the host.
- *
- * @return true if the pair (host, community) has write permission, false otherwise.
- */
- public boolean checkWritePermission(InetAddress address, String community);
-
- /**
- * Returns an enumeration of trap destinations.
- *
- * @return An enumeration of the trap destinations (enumeration of InetAddress).
- */
- public Enumeration getTrapDestinations();
-
- /**
- * Returns an enumeration of trap communities for a given host.
- *
- * @param address The address of the host.
- *
- * @return An enumeration of trap communities for a given host (enumeration of String).
- */
- public Enumeration getTrapCommunities(InetAddress address);
-
- /**
- * Returns an enumeration of inform destinations.
- *
- * @return An enumeration of the inform destinations (enumeration of InetAddress).
- */
- public Enumeration getInformDestinations();
-
- /**
- * Returns an enumeration of inform communities for a given host.
- *
- * @param address The address of the host.
- *
- * @return An enumeration of inform communities for a given host (enumeration of String).
- */
- public Enumeration getInformCommunities(InetAddress address);
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/ServiceName.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/ServiceName.java
deleted file mode 100644
index edf77073ee8..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/ServiceName.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.jmx.snmp;
-
-/**
- * Used for storing default values used by SNMP Runtime services.
- *
This API is an Oracle Corporation internal API and is subject
- * to change without notice.
- */
-public class ServiceName {
-
- // private constructor defined to "hide" the default public constructor
- private ServiceName() {
- }
-
- /**
- * The object name of the MBeanServer delegate object
- *
- * The value is JMImplementation:type=MBeanServerDelegate.
- */
- public static final String DELEGATE = "JMImplementation:type=MBeanServerDelegate" ;
-
- /**
- * The default key properties for registering the class loader of the MLet service.
- *
- * The value is type=MLet.
- */
- public static final String MLET = "type=MLet";
-
- /**
- * The default domain.
- *
- * The value is DefaultDomain.
- */
- public static final String DOMAIN = "DefaultDomain";
-
- /**
- * The default port for the RMI connector.
- *
- * The value is 1099.
- */
- public static final int RMI_CONNECTOR_PORT = 1099 ;
-
- /**
- * The default key properties for the RMI connector.
- *
- * The value is name=RmiConnectorServer.
- */
- public static final String RMI_CONNECTOR_SERVER = "name=RmiConnectorServer" ;
-
- /**
- * The default port for the SNMP adaptor.
- *
- * The value is 161.
- */
- public static final int SNMP_ADAPTOR_PORT = 161 ;
-
- /**
- * The default key properties for the SNMP protocol adaptor.
- *
- * The value is name=SnmpAdaptorServer.
- */
- public static final String SNMP_ADAPTOR_SERVER = "name=SnmpAdaptorServer" ;
-
- /**
- * The default port for the HTTP connector.
- *
- * The value is 8081.
- */
- public static final int HTTP_CONNECTOR_PORT = 8081 ;
-
- /**
- * The default key properties for the HTTP connector.
- *
- * The value is name=HttpConnectorServer.
- */
- public static final String HTTP_CONNECTOR_SERVER = "name=HttpConnectorServer" ;
-
- /**
- * The default port for the HTTPS connector.
- *
- * The value is 8084.
- */
- public static final int HTTPS_CONNECTOR_PORT = 8084 ;
-
- /**
- * The default key properties for the HTTPS connector.
- *
- * The value is name=HttpsConnectorServer.
- */
- public static final String HTTPS_CONNECTOR_SERVER = "name=HttpsConnectorServer" ;
-
- /**
- * The default port for the HTML adaptor.
- *
- * The value is 8082.
- */
- public static final int HTML_ADAPTOR_PORT = 8082 ;
-
- /**
- * The default key properties for the HTML protocol adaptor.
- *
- * The value is name=HtmlAdaptorServer.
- */
- public static final String HTML_ADAPTOR_SERVER = "name=HtmlAdaptorServer" ;
-
- /**
- * The name of the JMX specification implemented by this product.
- *
- * The value is Java Management Extensions.
- */
- public static final String JMX_SPEC_NAME = "Java Management Extensions";
-
- /**
- * The version of the JMX specification implemented by this product.
- *
- * The value is 1.0 Final Release.
- */
- public static final String JMX_SPEC_VERSION = "1.2 Maintenance Release";
-
- /**
- * The vendor of the JMX specification implemented by this product.
- *
- * The value is Oracle Corporation.
- */
- public static final String JMX_SPEC_VENDOR = "Oracle Corporation";
-
- /**
- * The name of the vendor of this product implementing the JMX specification.
- *
- * The value is Oracle Corporation.
- */
- public static final String JMX_IMPL_VENDOR = "Oracle Corporation";
-
- /**
- * The build number of the current product version, of the form rXX.
- */
- public static final String BUILD_NUMBER = "r01";
-
- /**
- * The version of this product implementing the JMX specification.
- *
- * The value is 5.1_rXX, where rXX is the BUILD_NUMBER .
- */
- public static final String JMX_IMPL_VERSION = "5.1_" + BUILD_NUMBER;
-
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpAckPdu.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpAckPdu.java
deleted file mode 100644
index 7ab0ce84e28..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpAckPdu.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.jmx.snmp;
-/**
- * Interface to be implemented by PDUs that are acknowledged (eg:
- * request, bulk).
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- * @since 1.5
- */
-public interface SnmpAckPdu {
- /**
- * Returns the PDU to use for the response.
- * @return The response PDU.
- */
- public SnmpPdu getResponsePdu();
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpBadSecurityLevelException.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpBadSecurityLevelException.java
deleted file mode 100644
index 2c3ed6570de..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpBadSecurityLevelException.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.jmx.snmp;
-/**
- * This exception is thrown when an incorrect security level is handled.
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- * @since 1.5
- */
-public class SnmpBadSecurityLevelException extends Exception {
- private static final long serialVersionUID = 8863728413063813053L;
-
- public SnmpBadSecurityLevelException(String msg) {
- super(msg);
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpCounter.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpCounter.java
deleted file mode 100644
index 236f0055edd..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpCounter.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package com.sun.jmx.snmp;
-
-
-
-/**
- * Represents an SNMP counter.
- *
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- */
-
-public class SnmpCounter extends SnmpUnsignedInt {
- private static final long serialVersionUID = 4655264728839396879L;
-
- // CONSTRUCTORS
- //-------------
- /**
- * Constructs a new SnmpCounter from the specified integer value.
- * @param v The initialization value.
- * @exception IllegalArgumentException The specified value is negative
- * or larger than {@link SnmpUnsignedInt#MAX_VALUE SnmpUnsignedInt.MAX_VALUE}.
- */
- public SnmpCounter(int v) throws IllegalArgumentException {
- super(v) ;
- }
-
- /**
- * Constructs a new SnmpCounter from the specified Integer value.
- * @param v The initialization value.
- * @exception IllegalArgumentException The specified value is negative
- * or larger than {@link SnmpUnsignedInt#MAX_VALUE SnmpUnsignedInt.MAX_VALUE}.
- */
- public SnmpCounter(Integer v) throws IllegalArgumentException {
- super(v) ;
- }
-
- /**
- * Constructs a new SnmpCounter from the specified long value.
- * @param v The initialization value.
- * @exception IllegalArgumentException The specified value is negative
- * or larger than {@link SnmpUnsignedInt#MAX_VALUE SnmpUnsignedInt.MAX_VALUE}.
- */
- public SnmpCounter(long v) throws IllegalArgumentException {
- super(v) ;
- }
-
- /**
- * Constructs a new SnmpCounter from the specified Long value.
- * @param v The initialization value.
- * @exception IllegalArgumentException The specified value is negative
- * or larger than {@link SnmpUnsignedInt#MAX_VALUE SnmpUnsignedInt.MAX_VALUE}.
- */
- public SnmpCounter(Long v) throws IllegalArgumentException {
- super(v) ;
- }
-
- // PUBLIC METHODS
- //---------------
- /**
- * Returns a textual description of the type object.
- * @return ASN.1 textual description.
- */
- final public String getTypeName() {
- return name ;
- }
-
- // VARIABLES
- //----------
- /**
- * Name of the type.
- */
- final static String name = "Counter32" ;
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpCounter64.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpCounter64.java
deleted file mode 100644
index 351351378f3..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpCounter64.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package com.sun.jmx.snmp;
-
-
-
-/**
- * Represents an SNMP 64bits counter.
- *
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- */
-
-public class SnmpCounter64 extends SnmpValue {
- private static final long serialVersionUID = 8784850650494679937L;
-
- // CONSTRUCTORS
- //-------------
- /**
- * Constructs a new SnmpCounter64 from the specified long value.
- * @param v The initialization value.
- * @exception IllegalArgumentException The specified value is negative
- * or larger than Long.MAX_VALUE.
- */
- public SnmpCounter64(long v) throws IllegalArgumentException {
-
- // NOTE:
- // The max value for a counter64 variable is 2^64 - 1.
- // The max value for a Long is 2^63 - 1.
- // All the allowed values for a conuter64 variable cannot be covered !!!
- //
- if ((v < 0) || (v > Long.MAX_VALUE)) {
- throw new IllegalArgumentException() ;
- }
- value = v ;
- }
-
- /**
- * Constructs a new SnmpCounter64 from the specified Long value.
- * @param v The initialization value.
- * @exception IllegalArgumentException The specified value is negative
- * or larger than Long.MAX_VALUE.
- */
- public SnmpCounter64(Long v) throws IllegalArgumentException {
- this(v.longValue()) ;
- }
-
- // PUBLIC METHODS
- //---------------
- /**
- * Returns the counter value of this SnmpCounter64.
- * @return The value.
- */
- public long longValue() {
- return value ;
- }
-
- /**
- * Converts the counter value to its Long form.
- * @return The Long representation of the value.
- */
- public Long toLong() {
- return value;
- }
-
- /**
- * Converts the counter value to its integer form.
- * @return The integer representation of the value.
- */
- public int intValue() {
- return (int)value ;
- }
-
- /**
- * Converts the counter value to its Integer form.
- * @return The Integer representation of the value.
- */
- public Integer toInteger() {
- return (int)value;
- }
-
- /**
- * Converts the counter value to its String form.
- * @return The String representation of the value.
- */
- public String toString() {
- return String.valueOf(value) ;
- }
-
- /**
- * Converts the counter value to its SnmpOid form.
- * @return The OID representation of the value.
- */
- public SnmpOid toOid() {
- return new SnmpOid(value) ;
- }
-
- /**
- * Extracts the counter from an index OID and returns its
- * value converted as an SnmpOid.
- * @param index The index array.
- * @param start The position in the index array.
- * @return The OID representing the counter value.
- * @exception SnmpStatusException There is no counter value
- * available at the start position.
- */
- public static SnmpOid toOid(long[] index, int start) throws SnmpStatusException {
- try {
- return new SnmpOid(index[start]) ;
- }
- catch(IndexOutOfBoundsException e) {
- throw new SnmpStatusException(SnmpStatusException.noSuchName) ;
- }
- }
-
- /**
- * Scans an index OID, skips the counter value and returns the position
- * of the next value.
- * @param index The index array.
- * @param start The position in the index array.
- * @return The position of the next value.
- * @exception SnmpStatusException There is no counter value
- * available at the start position.
- */
- public static int nextOid(long[] index, int start) throws SnmpStatusException {
- if (start >= index.length) {
- throw new SnmpStatusException(SnmpStatusException.noSuchName) ;
- }
- else {
- return start + 1 ;
- }
- }
-
- /**
- * Appends an SnmpOid representing an SnmpCounter64 to another OID.
- * @param source An OID representing an SnmpCounter64 value.
- * @param dest Where source should be appended.
- */
- public static void appendToOid(SnmpOid source, SnmpOid dest) {
- if (source.getLength() != 1) {
- throw new IllegalArgumentException() ;
- }
- dest.append(source) ;
- }
-
- /**
- * Performs a clone action. This provides a workaround for the
- * SnmpValue interface.
- * @return The SnmpValue clone.
- */
- final synchronized public SnmpValue duplicate() {
- return (SnmpValue)clone() ;
- }
-
- /**
- * Clones the SnmpCounter64 object, making a copy of its data.
- * @return The object clone.
- */
- final synchronized public Object clone() {
- SnmpCounter64 newclone = null ;
- try {
- newclone = (SnmpCounter64) super.clone() ;
- newclone.value = value ;
- } catch (CloneNotSupportedException e) {
- throw new InternalError(e) ; // vm bug.
- }
- return newclone ;
- }
-
- /**
- * Returns a textual description of the type object.
- * @return ASN.1 textual description.
- */
- final public String getTypeName() {
- return name ;
- }
-
- // VARIABLES
- //----------
- /**
- * Name of the type.
- */
- final static String name = "Counter64" ;
-
- /**
- * This is where the value is stored. This long is positive.
- * @serial
- */
- private long value = 0 ;
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpEngine.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpEngine.java
deleted file mode 100644
index 302569c51a8..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpEngine.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.jmx.snmp;
-
-/**
- * This engine is conformant with the RFC 2571. It is the main object within an SNMP entity (agent, manager...).
- * To an engine is associated an {@link SnmpEngineId}.
- * Engine instantiation is based on a factory {@link com.sun.jmx.snmp.SnmpEngineFactory SnmpEngineFactory}.
- * When an SnmpEngine is created, a User based Security Model (USM) is initialized. The security configuration is located in a text file.
- * The text file is read when the engine is created.
- *
Note that the engine is not used when the agent is SNMPv1/SNMPv2 only.
-
The USM configuration text file is remotely updatable using the USM Mib.
-
User that are configured in the Usm text file are nonVolatile.
-
Usm Mib userEntry supported storage type values are : volatile or nonVolatile only. Other values are rejected and a wrongValue is returned)
-
-
volatile means that user entry is not flushed in security file
-
nonVolatile means that user entry is flushed in security file
-
If a nonVolatile row is set to be volatile, it will be not flushed in the file
-
If a volatile row created from the UsmMib is set to nonVolatile, it will be flushed in the file (if the file exist and is writable otherwise an inconsistentValue is returned)
-
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- * @since 1.5
- */
-public interface SnmpEngine {
- /**
- * Gets the engine time in seconds. This is the time from the last reboot.
- * @return The time from the last reboot.
- */
- public int getEngineTime();
- /**
- * Gets the engine Id. This is unique for each engine.
- * @return The engine Id object.
- */
- public SnmpEngineId getEngineId();
-
- /**
- * Gets the engine boot number. This is the number of time this engine has rebooted. Each time an SnmpEngine is instantiated, it will read this value in its Lcd, and store back the value incremented by one.
- * @return The engine's number of reboot.
- */
- public int getEngineBoots();
-
- /**
- * Gets the Usm key handler.
- * @return The key handler.
- */
- public SnmpUsmKeyHandler getUsmKeyHandler();
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpEngineFactory.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpEngineFactory.java
deleted file mode 100644
index 60ecfde543c..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpEngineFactory.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.jmx.snmp;
-
-/**
- * This SnmpEngineFactory is instantiating an SnmpEngine containing :
- *
- *
Message Processing Sub System + V1, V2 et V3 Message Processing Models
- *
Security Sub System + User based Security Model (Id 3)
- *
Access Control Sub System + Ip Acl + User based Access Control Model. See IpAcl and UserAcl .
- *
- *
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- * @since 1.5
- */
-public interface SnmpEngineFactory {
- /**
- * The engine instantiation method.
- * @param p The parameters used to instantiate a new engine.
- * @throws IllegalArgumentException Throwed if one of the configuration file file doesn't exist (Acl files, security file).
- * @return The newly created SnmpEngine.
- */
- public SnmpEngine createEngine(SnmpEngineParameters p);
-
- /**
- * The engine instantiation method.
- * @param p The parameters used to instantiate a new engine.
- * @param ipacl The Ip ACL to pass to the Access Control Model.
- * @throws IllegalArgumentException Throwed if one of the configuration
- * file file doesn't exist (Acl files, security file).
- * @return The newly created SnmpEngine.
- */
- public SnmpEngine createEngine(SnmpEngineParameters p,
- InetAddressAcl ipacl);
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpEngineId.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpEngineId.java
deleted file mode 100644
index 537e4249839..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpEngineId.java
+++ /dev/null
@@ -1,489 +0,0 @@
-/*
- * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.jmx.snmp;
-
-import java.net.InetAddress;
-import java.io.Serializable;
-import java.net.UnknownHostException;
-import java.util.StringTokenizer;
-import java.util.Arrays;
-import java.util.NoSuchElementException;
-
-import com.sun.jmx.snmp.internal.SnmpTools;
-
-/**
- * This class is handling an SnmpEngineId data. It copes with binary as well as String representation of an engine Id. A string format engine is an hex string starting with 0x.
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- * @since 1.5
- */
-public class SnmpEngineId implements Serializable {
- private static final long serialVersionUID = 5434729655830763317L;
-
- byte[] engineId = null;
- String hexString = null;
- String humanString = null;
- /**
- * New SnmpEngineId with an hex string value. Can handle engine Id format <host>:<port>.
- * @param hexString Hexa string.
- */
- SnmpEngineId(String hexString) {
- engineId = SnmpTools.ascii2binary(hexString);
- this.hexString = hexString.toLowerCase();
- }
- /**
- * New SnmpEngineId with a binary value. You can use SnmpTools to convert from hex string to binary format.
- * @param bin Binary value
- */
- SnmpEngineId(byte[] bin) {
- engineId = bin;
- hexString = SnmpTools.binary2ascii(bin).toLowerCase();
- }
-
- /**
- * If a string of the format <address>:<port>:<IANA number> has been provided at creation time, this string is returned.
- * @return The Id as a readable string or null if not provided.
- */
- public String getReadableId() {
- return humanString;
- }
-
- /**
- * Returns a string format engine Id.
- * @return String format value.
- */
- public String toString() {
- return hexString;
- }
- /**
- * Returns a binary engine Id.
- * @return Binary value.
- */
- public byte[] getBytes() {
- return engineId;
- }
-
- /**
- * In order to store the string used to create the engineId.
- */
- void setStringValue(String val) {
- humanString = val;
- }
-
- static void validateId(String str) throws IllegalArgumentException {
- byte[] arr = SnmpTools.ascii2binary(str);
- validateId(arr);
- }
-
- static void validateId(byte[] arr) throws IllegalArgumentException {
-
- if(arr.length < 5) throw new IllegalArgumentException("Id size lower than 5 bytes.");
- if(arr.length > 32) throw new IllegalArgumentException("Id size greater than 32 bytes.");
-
- //octet strings with very first bit = 0 and length != 12 octets
- if( ((arr[0] & 0x80) == 0) && arr.length != 12)
- throw new IllegalArgumentException("Very first bit = 0 and length != 12 octets");
-
- byte[] zeroedArrays = new byte[arr.length];
- if(Arrays.equals(zeroedArrays, arr)) throw new IllegalArgumentException("Zeroed Id.");
- byte[] FFArrays = new byte[arr.length];
- Arrays.fill(FFArrays, (byte)0xFF);
- if(Arrays.equals(FFArrays, arr)) throw new IllegalArgumentException("0xFF Id.");
-
- }
-
- /**
- * Generates an engine Id based on the passed array.
- * @return The created engine Id or null if given arr is null or its length == 0;
- * @exception IllegalArgumentException when:
- *
- *
octet string lower than 5 bytes.
- *
octet string greater than 32 bytes.
- *
octet string = all zeros.
- *
octet string = all 'ff'H.
- *
octet strings with very first bit = 0 and length != 12 octets
- *
- */
- public static SnmpEngineId createEngineId(byte[] arr) throws IllegalArgumentException {
- if( (arr == null) || arr.length == 0) return null;
- validateId(arr);
- return new SnmpEngineId(arr);
- }
-
- /**
- * Generates an engine Id that is unique to the host the agent is running on. The engine Id unicity is system time based. The creation algorithm uses the SUN Microsystems IANA number (42).
- * @return The generated engine Id.
- */
- public static SnmpEngineId createEngineId() {
- byte[] address = null;
- byte[] engineid = new byte[13];
- int iana = 42;
- long mask = 0xFF;
- long time = System.currentTimeMillis();
-
- engineid[0] = (byte) ( (iana & 0xFF000000) >> 24 );
- engineid[0] |= 0x80;
- engineid[1] = (byte) ( (iana & 0x00FF0000) >> 16 );
- engineid[2] = (byte) ( (iana & 0x0000FF00) >> 8 );
- engineid[3] = (byte) (iana & 0x000000FF);
- engineid[4] = 0x05;
-
- engineid[5] = (byte) ( (time & (mask << 56)) >>> 56 );
- engineid[6] = (byte) ( (time & (mask << 48) ) >>> 48 );
- engineid[7] = (byte) ( (time & (mask << 40) ) >>> 40 );
- engineid[8] = (byte) ( (time & (mask << 32) ) >>> 32 );
- engineid[9] = (byte) ( (time & (mask << 24) ) >>> 24 );
- engineid[10] = (byte) ( (time & (mask << 16) ) >>> 16 );
- engineid[11] = (byte) ( (time & (mask << 8) ) >>> 8 );
- engineid[12] = (byte) (time & mask);
-
- return new SnmpEngineId(engineid);
- }
-
- /**
- * Translates an engine Id in an SnmpOid format. This is useful when dealing with USM MIB indexes.
- * The oid format is : ......
- * Eg: "0x8000002a05819dcb6e00001f96" ==> 13.128.0.0.42.5.129.157.203.110.0.0.31.150
- *
- * @return SnmpOid The oid.
- */
- public SnmpOid toOid() {
- long[] oid = new long[engineId.length + 1];
- oid[0] = engineId.length;
- for(int i = 1; i <= engineId.length; i++)
- oid[i] = (long) (engineId[i-1] & 0xFF);
- return new SnmpOid(oid);
- }
-
- /**
- *
Generates a unique engine Id. Hexadecimal strings as well as a textual description are supported. The textual format is as follow:
- * <address>:<port>:<IANA number>
- *
The allowed formats :
- *
- *
<address>:<port>:<IANA number>
- * All these parameters are used to generate the Id. WARNING, this method is not compliant with IPv6 address format. Use { @link com.sun.jmx.snmp.SnmpEngineId#createEngineId(java.lang.String,java.lang.String) } instead.
- *
<address>:<port>
- * The IANA number will be the SUN Microsystems one (42).
- *
address
- * The port 161 will be used to generate the Id. IANA number will be the SUN Microsystems one (42).
- *
:port
- * The host to use is localhost. IANA number will be the SUN Microsystems one (42).
- *
::<IANA number>
- * The port 161 and localhost will be used to generate the Id.
- *
:<port>:<IANA number>
- * The host to use is localhost.
- *
<address>::<IANA number>
- * The port 161 will be used to generate the Id.
- *
::
- * The port 161, localhost and the SUN Microsystems IANA number will be used to generate the Id.
- *
- * @exception UnknownHostException if the host name contained in the textual format is unknown.
- * @exception IllegalArgumentException when :
- *
- *
octet string lower than 5 bytes.
- *
octet string greater than 32 bytes.
- *
octet string = all zeros.
- *
octet string = all 'ff'H.
- *
octet strings with very first bit = 0 and length != 12 octets
- *
An IPv6 address format is used in conjonction with the ":" separator
- *
- * @param str The string to parse.
- * @return The generated engine Id or null if the passed string is null.
- *
- */
- public static SnmpEngineId createEngineId(String str)
- throws IllegalArgumentException, UnknownHostException {
- return createEngineId(str, null);
- }
-
- /**
- * Idem { @link
- * com.sun.jmx.snmp.SnmpEngineId#createEngineId(java.lang.String) }
- * with the ability to provide your own separator. This allows IPv6
- * address format handling (eg: providing @ as separator).
- * @param str The string to parse.
- * @param separator the separator to use. If null is provided, the default
- * separator ":" is used.
- * @return The generated engine Id or null if the passed string is null.
- * @exception UnknownHostException if the host name contained in the
- * textual format is unknown.
- * @exception IllegalArgumentException when :
- *
- *
octet string lower than 5 bytes.
- *
octet string greater than 32 bytes.
- *
octet string = all zeros.
- *
octet string = all 'ff'H.
- *
octet strings with very first bit = 0 and length != 12 octets
- *
An IPv6 address format is used in conjonction with the ":"
- * separator
- *
- * @since 1.5
- */
- public static SnmpEngineId createEngineId(String str, String separator)
- throws IllegalArgumentException, UnknownHostException {
- if(str == null) return null;
-
- if(str.startsWith("0x") || str.startsWith("0X")) {
- validateId(str);
- return new SnmpEngineId(str);
- }
- separator = separator == null ? ":" : separator;
- StringTokenizer token = new StringTokenizer(str,
- separator,
- true);
-
- String address = null;
- String port = null;
- String iana = null;
- int objPort = 161;
- int objIana = 42;
- InetAddress objAddress = null;
- SnmpEngineId eng = null;
- try {
- //Deal with address
- try {
- address = token.nextToken();
- }catch(NoSuchElementException e) {
- throw new IllegalArgumentException("Passed string is invalid : ["+str+"]");
- }
- if(!address.equals(separator)) {
- objAddress = InetAddress.getByName(address);
- try {
- token.nextToken();
- }catch(NoSuchElementException e) {
- //No need to go further, no port.
- eng = SnmpEngineId.createEngineId(objAddress,
- objPort,
- objIana);
- eng.setStringValue(str);
- return eng;
- }
- }
- else
- objAddress = InetAddress.getLocalHost();
-
- //Deal with port
- try {
- port = token.nextToken();
- }catch(NoSuchElementException e) {
- //No need to go further, no port.
- eng = SnmpEngineId.createEngineId(objAddress,
- objPort,
- objIana);
- eng.setStringValue(str);
- return eng;
- }
-
- if(!port.equals(separator)) {
- objPort = Integer.parseInt(port);
- try {
- token.nextToken();
- }catch(NoSuchElementException e) {
- //No need to go further, no iana.
- eng = SnmpEngineId.createEngineId(objAddress,
- objPort,
- objIana);
- eng.setStringValue(str);
- return eng;
- }
- }
-
- //Deal with iana
- try {
- iana = token.nextToken();
- }catch(NoSuchElementException e) {
- //No need to go further, no port.
- eng = SnmpEngineId.createEngineId(objAddress,
- objPort,
- objIana);
- eng.setStringValue(str);
- return eng;
- }
-
- if(!iana.equals(separator))
- objIana = Integer.parseInt(iana);
-
- eng = SnmpEngineId.createEngineId(objAddress,
- objPort,
- objIana);
- eng.setStringValue(str);
-
- return eng;
-
- } catch(Exception e) {
- throw new IllegalArgumentException("Passed string is invalid : ["+str+"]. Check that the used separator ["+ separator + "] is compatible with IPv6 address format.");
- }
-
- }
-
- /**
- * Generates a unique engine Id. The engine Id unicity is based on
- * the host IP address and port. The IP address used is the
- * localhost one. The creation algorithm uses the SUN Microsystems IANA
- * number (42).
- * @param port The TCP/IP port the SNMPv3 Adaptor Server is listening to.
- * @return The generated engine Id.
- * @exception UnknownHostException if the local host name
- * used to calculate the id is unknown.
- */
- public static SnmpEngineId createEngineId(int port)
- throws UnknownHostException {
- int suniana = 42;
- InetAddress address = null;
- address = InetAddress.getLocalHost();
- return createEngineId(address, port, suniana);
- }
- /**
- * Generates a unique engine Id. The engine Id unicity is based on
- * the host IP address and port. The IP address used is the passed
- * one. The creation algorithm uses the SUN Microsystems IANA
- * number (42).
- * @param address The IP address the SNMPv3 Adaptor Server is listening to.
- * @param port The TCP/IP port the SNMPv3 Adaptor Server is listening to.
- * @return The generated engine Id.
- * @exception UnknownHostException. if the provided address is null.
- */
- public static SnmpEngineId createEngineId(InetAddress address, int port)
- throws IllegalArgumentException {
- int suniana = 42;
- if(address == null)
- throw new IllegalArgumentException("InetAddress is null.");
- return createEngineId(address, port, suniana);
- }
-
- /**
- * Generates a unique engine Id. The engine Id unicity is based on
- * the host IP address and port. The IP address is the localhost one.
- * The creation algorithm uses the passed IANA number.
- * @param port The TCP/IP port the SNMPv3 Adaptor Server is listening to.
- * @param iana Your enterprise IANA number.
- * @exception UnknownHostException if the local host name used to calculate the id is unknown.
- * @return The generated engine Id.
- */
- public static SnmpEngineId createEngineId(int port, int iana) throws UnknownHostException {
- InetAddress address = null;
- address = InetAddress.getLocalHost();
- return createEngineId(address, port, iana);
- }
-
- /**
- * Generates a unique engine Id. The engine Id unicity is based on the host IP address and port. The IP address is the passed one, it handles IPv4 and IPv6 hosts. The creation algorithm uses the passed IANA number.
- * @param addr The IP address the SNMPv3 Adaptor Server is listening to.
- * @param port The TCP/IP port the SNMPv3 Adaptor Server is listening to.
- * @param iana Your enterprise IANA number.
- * @return The generated engine Id.
- * @exception UnknownHostException if the provided InetAddress is null.
- */
- public static SnmpEngineId createEngineId(InetAddress addr,
- int port,
- int iana) {
- if(addr == null) throw new IllegalArgumentException("InetAddress is null.");
- byte[] address = addr.getAddress();
- byte[] engineid = new byte[9 + address.length];
- engineid[0] = (byte) ( (iana & 0xFF000000) >> 24 );
- engineid[0] |= 0x80;
- engineid[1] = (byte) ( (iana & 0x00FF0000) >> 16 );
- engineid[2] = (byte) ( (iana & 0x0000FF00) >> 8 );
-
-engineid[3] = (byte) (iana & 0x000000FF);
- engineid[4] = 0x05;
-
- if(address.length == 4)
- engineid[4] = 0x01;
-
- if(address.length == 16)
- engineid[4] = 0x02;
-
- for(int i = 0; i < address.length; i++) {
- engineid[i + 5] = address[i];
- }
-
- engineid[5 + address.length] = (byte) ( (port & 0xFF000000) >> 24 );
- engineid[6 + address.length] = (byte) ( (port & 0x00FF0000) >> 16 );
- engineid[7 + address.length] = (byte) ( (port & 0x0000FF00) >> 8 );
- engineid[8 + address.length] = (byte) ( port & 0x000000FF );
-
- return new SnmpEngineId(engineid);
- }
-
- /**
- * Generates an engine Id based on an InetAddress. Handles IPv4 and IPv6 addresses. The creation algorithm uses the passed IANA number.
- * @param iana Your enterprise IANA number.
- * @param addr The IP address the SNMPv3 Adaptor Server is listening to.
- * @return The generated engine Id.
- * @since 1.5
- * @exception UnknownHostException if the provided InetAddress is null.
- */
- public static SnmpEngineId createEngineId(int iana, InetAddress addr)
- {
- if(addr == null) throw new IllegalArgumentException("InetAddress is null.");
- byte[] address = addr.getAddress();
- byte[] engineid = new byte[5 + address.length];
- engineid[0] = (byte) ( (iana & 0xFF000000) >> 24 );
- engineid[0] |= 0x80;
- engineid[1] = (byte) ( (iana & 0x00FF0000) >> 16 );
- engineid[2] = (byte) ( (iana & 0x0000FF00) >> 8 );
-
- engineid[3] = (byte) (iana & 0x000000FF);
- if(address.length == 4)
- engineid[4] = 0x01;
-
- if(address.length == 16)
- engineid[4] = 0x02;
-
- for(int i = 0; i < address.length; i++) {
- engineid[i + 5] = address[i];
- }
-
- return new SnmpEngineId(engineid);
- }
-
- /**
- * Generates an engine Id based on an InetAddress. Handles IPv4 and IPv6
- * addresses. The creation algorithm uses the sun IANA number (42).
- * @param addr The IP address the SNMPv3 Adaptor Server is listening to.
- * @return The generated engine Id.
- * @since 1.5
- * @exception UnknownHostException if the provided
- * InetAddress is null.
- */
- public static SnmpEngineId createEngineId(InetAddress addr) {
- return createEngineId(42, addr);
- }
-
-
- /**
- * Tests SnmpEngineId instance equality. Two SnmpEngineId are equal if they have the same value.
- * @return true if the two SnmpEngineId are equals, false otherwise.
- */
- public boolean equals(Object a) {
- if(!(a instanceof SnmpEngineId) ) return false;
- return hexString.equals(((SnmpEngineId) a).toString());
- }
-
- public int hashCode() {
- return hexString.hashCode();
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpEngineParameters.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpEngineParameters.java
deleted file mode 100644
index 4c2289be9df..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpEngineParameters.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.jmx.snmp;
-
-import java.io.Serializable;
-
-/**
- * This class is used to pass some specific parameters to an
- * SnmpEngineFactory .
- *
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- * @since 1.5
- */
-public class SnmpEngineParameters implements Serializable {
- private static final long serialVersionUID = 3720556613478400808L;
-
- private UserAcl uacl = null;
- private String securityFile = null;
- private boolean encrypt = false;
- private SnmpEngineId engineId = null;
-
- /**
- * Sets the file to use for SNMP Runtime Lcd. If no file is provided, the default location will be checked.
- */
- public void setSecurityFile(String securityFile) {
- this.securityFile = securityFile;
- }
-
- /**
- * Gets the file to use for SNMP Runtime Lcd.
- * @return The security file.
- */
- public String getSecurityFile() {
- return securityFile;
- }
- /**
- * Sets a customized user ACL. User Acl is used in order to check
- * access for SNMP V3 requests. If no ACL is provided,
- * com.sun.jmx.snmp.usm.UserAcl.UserAcl is instantiated.
- * @param uacl The user ACL to use.
- */
- public void setUserAcl(UserAcl uacl) {
- this.uacl = uacl;
- }
-
- /**
- * Gets the customized user ACL.
- * @return The customized user ACL.
- */
- public UserAcl getUserAcl() {
- return uacl;
- }
-
- /**
- * Activate SNMP V3 encryption. By default the encryption is not activated. Be sure that the security provider classes needed for DES are in your classpath (eg:JCE classes)
- *
- */
- public void activateEncryption() {
- this.encrypt = true;
- }
-
- /**
- * Deactivate SNMP V3 encryption. By default the encryption is not activated. Be sure that the security provider classes needed for DES are in your classpath (eg:JCE classes)
- *
- */
- public void deactivateEncryption() {
- this.encrypt = false;
- }
-
- /**
- * Check if encryption is activated. By default the encryption is not activated.
- * @return The encryption activation status.
- */
- public boolean isEncryptionEnabled() {
- return encrypt;
- }
-
- /**
- * Set the engine Id.
- * @param engineId The engine Id to use.
- */
- public void setEngineId(SnmpEngineId engineId) {
- this.engineId = engineId;
- }
-
- /**
- * Get the engine Id.
- * @return The engineId.
- */
- public SnmpEngineId getEngineId() {
- return engineId;
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpGauge.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpGauge.java
deleted file mode 100644
index 1f81cf36ce5..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpGauge.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package com.sun.jmx.snmp;
-
-
-
-/**
- * Represents an SNMP gauge.
- *
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- */
-
-public class SnmpGauge extends SnmpUnsignedInt {
- private static final long serialVersionUID = -8366622742122792945L;
-
- // CONSTRUCTORS
- //-------------
- /**
- * Constructs a new SnmpGauge from the specified integer value.
- * @param v The initialization value.
- * @exception IllegalArgumentException The specified value is negative
- * or larger than {@link SnmpUnsignedInt#MAX_VALUE SnmpUnsignedInt.MAX_VALUE}.
- */
- public SnmpGauge(int v) throws IllegalArgumentException {
- super(v) ;
- }
-
- /**
- * Constructs a new SnmpGauge from the specified Integer value.
- * @param v The initialization value.
- * @exception IllegalArgumentException The specified value is negative
- * or larger than {@link SnmpUnsignedInt#MAX_VALUE SnmpUnsignedInt.MAX_VALUE}.
- */
- public SnmpGauge(Integer v) throws IllegalArgumentException {
- super(v) ;
- }
-
- /**
- * Constructs a new SnmpGauge from the specified long value.
- * @param v The initialization value.
- * @exception IllegalArgumentException The specified value is negative
- * or larger than {@link SnmpUnsignedInt#MAX_VALUE SnmpUnsignedInt.MAX_VALUE}.
- */
- public SnmpGauge(long v) throws IllegalArgumentException {
- super(v) ;
- }
-
- /**
- * Constructs a new SnmpGauge from the specified Long value.
- * @param v The initialization value.
- * @exception IllegalArgumentException The specified value is negative
- * or larger than {@link SnmpUnsignedInt#MAX_VALUE SnmpUnsignedInt.MAX_VALUE}.
- */
- public SnmpGauge(Long v) throws IllegalArgumentException {
- super(v) ;
- }
-
- // PUBLIC METHODS
- //---------------
- /**
- * Returns a textual description of the type object.
- * @return ASN.1 textual description.
- */
- final public String getTypeName() {
- return name ;
- }
-
- // VARIABLES
- //----------
- /**
- * Name of the type.
- */
- final static String name = "Gauge32" ;
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpInt.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpInt.java
deleted file mode 100644
index f99f41fd4c6..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpInt.java
+++ /dev/null
@@ -1,282 +0,0 @@
-/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package com.sun.jmx.snmp;
-
-
-
-import com.sun.jmx.snmp.Enumerated;
-
-/**
- * Represents an SNMP integer.
- *
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- */
-
-public class SnmpInt extends SnmpValue {
- private static final long serialVersionUID = -7163624758070343373L;
-
- // CONSTRUCTORS
- //-------------
- /**
- * Constructs a new SnmpInt from the specified integer value.
- * @param v The initialization value.
- * @exception IllegalArgumentException The specified value is smaller than Integer.MIN_VALUE
- * or larger than Integer.MAX_VALUE.
- */
- public SnmpInt(int v) throws IllegalArgumentException {
- if ( isInitValueValid(v) == false ) {
- throw new IllegalArgumentException() ;
- }
- value = (long)v ;
- }
-
- /**
- * Constructs a new SnmpInt from the specified Integer value.
- * @param v The initialization value.
- * @exception IllegalArgumentException The specified value is smaller than Integer.MIN_VALUE
- * or larger than Integer.MAX_VALUE.
- */
- public SnmpInt(Integer v) throws IllegalArgumentException {
- this(v.intValue()) ;
- }
-
- /**
- * Constructs a new SnmpInt from the specified long value.
- * @param v The initialization value.
- * @exception IllegalArgumentException The specified value is smaller than Integer.MIN_VALUE
- * or larger than Integer.MAX_VALUE.
- */
- public SnmpInt(long v) throws IllegalArgumentException {
- if ( isInitValueValid(v) == false ) {
- throw new IllegalArgumentException() ;
- }
- value = v ;
- }
-
- /**
- * Constructs a new SnmpInt from the specified Long value.
- * @param v The initialization value.
- * @exception IllegalArgumentException The specified value is smaller than Integer.MIN_VALUE
- * or larger than Integer.MAX_VALUE.
- */
- public SnmpInt(Long v) throws IllegalArgumentException {
- this(v.longValue()) ;
- }
-
- /**
- * Constructs a new SnmpInt from the specified Enumerated value.
- * @param v The initialization value.
- * @exception IllegalArgumentException The specified value is smaller than Integer.MIN_VALUE
- * or larger than Integer.MAX_VALUE.
- * @see Enumerated
- */
- public SnmpInt(Enumerated v) throws IllegalArgumentException {
- this(v.intValue()) ;
- }
-
- /**
- * Constructs a new SnmpInt from the specified boolean value.
- * This constructor applies rfc1903 rule:
- *
- * TruthValue ::= TEXTUAL-CONVENTION
- * STATUS current
- * DESCRIPTION
- * "Represents a boolean value."
- * SYNTAX INTEGER { true(1), false(2) }
- *
- * @param v The initialization value.
- */
- public SnmpInt(boolean v) {
- value = v ? 1 : 2 ;
- }
-
- // PUBLIC METHODS
- //---------------
- /**
- * Returns the long value of this SnmpInt.
- * @return The value.
- */
- public long longValue() {
- return value ;
- }
-
- /**
- * Converts the integer value to its Long form.
- * @return The Long representation of the value.
- */
- public Long toLong() {
- return value;
- }
-
- /**
- * Converts the integer value to its integer form.
- * @return The integer representation of the value.
- */
- public int intValue() {
- return (int) value ;
- }
-
- /**
- * Converts the integer value to its Integer form.
- * @return The Integer representation of the value.
- */
- public Integer toInteger() {
- return (int)value;
- }
-
- /**
- * Converts the integer value to its String form.
- * @return The String representation of the value.
- */
- public String toString() {
- return String.valueOf(value) ;
- }
-
- /**
- * Converts the integer value to its SnmpOid form.
- * @return The OID representation of the value.
- */
- public SnmpOid toOid() {
- return new SnmpOid(value) ;
- }
-
- /**
- * Extracts the integer from an index OID and returns its
- * value converted as an SnmpOid.
- * @param index The index array.
- * @param start The position in the index array.
- * @return The OID representing the integer value.
- * @exception SnmpStatusException There is no integer value
- * available at the start position.
- */
- public static SnmpOid toOid(long[] index, int start) throws SnmpStatusException {
- try {
- return new SnmpOid(index[start]) ;
- }
- catch(IndexOutOfBoundsException e) {
- throw new SnmpStatusException(SnmpStatusException.noSuchName) ;
- }
- }
-
- /**
- * Scans an index OID, skips the integer value and returns the position
- * of the next value.
- * @param index The index array.
- * @param start The position in the index array.
- * @return The position of the next value.
- * @exception SnmpStatusException There is no integer value
- * available at the start position.
- */
- public static int nextOid(long[] index, int start) throws SnmpStatusException {
- if (start >= index.length) {
- throw new SnmpStatusException(SnmpStatusException.noSuchName) ;
- }
- else {
- return start + 1 ;
- }
- }
-
- /**
- * Appends an SnmpOid representing an SnmpInt to another OID.
- * @param source An OID representing an SnmpInt value.
- * @param dest Where source should be appended.
- */
- public static void appendToOid(SnmpOid source, SnmpOid dest) {
- if (source.getLength() != 1) {
- throw new IllegalArgumentException() ;
- }
- dest.append(source) ;
- }
-
- /**
- * Performs a clone action. This provides a workaround for the
- * SnmpValue interface.
- * @return The SnmpValue clone.
- */
- final synchronized public SnmpValue duplicate() {
- return (SnmpValue) clone() ;
- }
-
- /**
- * Clones the SnmpInt object, making a copy of its data.
- * @return The object clone.
- */
- final synchronized public Object clone() {
- SnmpInt newclone = null ;
- try {
- newclone = (SnmpInt) super.clone() ;
- newclone.value = value ;
- } catch (CloneNotSupportedException e) {
- throw new InternalError(e) ; // vm bug.
- }
- return newclone ;
- }
-
- /**
- * Returns a textual description of the type object.
- * @return ASN.1 textual description.
- */
- public String getTypeName() {
- return name ;
- }
-
- /**
- * This method has been defined to allow the sub-classes
- * of SnmpInt to perform their own control at intialization time.
- */
- boolean isInitValueValid(int v) {
- if ((v < Integer.MIN_VALUE) || (v > Integer.MAX_VALUE)) {
- return false;
- }
- return true;
- }
-
- /**
- * This method has been defined to allow the sub-classes
- * of SnmpInt to perform their own control at intialization time.
- */
- boolean isInitValueValid(long v) {
- if ((v < Integer.MIN_VALUE) || (v > Integer.MAX_VALUE)) {
- return false;
- }
- return true;
- }
-
- // VARIABLES
- //----------
- /**
- * Name of the type.
- */
- final static String name = "Integer32" ;
-
- /**
- * This is where the value is stored. This long is signed.
- * @serial
- */
- protected long value = 0 ;
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpIpAddress.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpIpAddress.java
deleted file mode 100644
index bd7ce4227aa..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpIpAddress.java
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package com.sun.jmx.snmp;
-
-
-
-
-/**
- * Represents an SNMP IpAddress.
- *
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- */
-
-public class SnmpIpAddress extends SnmpOid {
- private static final long serialVersionUID = 7204629998270874474L;
-
- // CONSTRUCTORS
- //-------------
- /**
- * Constructs a new SnmpIpAddress from the specified bytes array.
- * @param bytes The four bytes composing the address.
- * @exception IllegalArgumentException The length of the array is not equal to four.
- */
- public SnmpIpAddress(byte[] bytes) throws IllegalArgumentException {
- buildFromByteArray(bytes);
- }
-
- /**
- * Constructs a new SnmpIpAddress from the specified long value.
- * @param addr The initialization value.
- */
- public SnmpIpAddress(long addr) {
- int address = (int)addr ;
- byte[] ipaddr = new byte[4];
-
- ipaddr[0] = (byte) ((address >>> 24) & 0xFF);
- ipaddr[1] = (byte) ((address >>> 16) & 0xFF);
- ipaddr[2] = (byte) ((address >>> 8) & 0xFF);
- ipaddr[3] = (byte) (address & 0xFF);
-
- buildFromByteArray(ipaddr);
- }
-
- /**
- * Constructs a new SnmpIpAddress from a dot-formatted String.
- * The dot-formatted String is formulated x.x.x.x .
- * @param dotAddress The initialization value.
- * @exception IllegalArgumentException The string does not correspond to an ip address.
- */
- public SnmpIpAddress(String dotAddress) throws IllegalArgumentException {
- super(dotAddress) ;
- if ((componentCount > 4) ||
- (components[0] > 255) ||
- (components[1] > 255) ||
- (components[2] > 255) ||
- (components[3] > 255)) {
- throw new IllegalArgumentException(dotAddress) ;
- }
- }
-
- /**
- * Constructs a new SnmpIpAddress from four long values.
- * @param b1 Byte 1.
- * @param b2 Byte 2.
- * @param b3 Byte 3.
- * @param b4 Byte 4.
- * @exception IllegalArgumentException A value is outside of [0-255].
- */
- public SnmpIpAddress(long b1, long b2, long b3, long b4) {
- super(b1, b2, b3, b4) ;
- if ((components[0] > 255) ||
- (components[1] > 255) ||
- (components[2] > 255) ||
- (components[3] > 255)) {
- throw new IllegalArgumentException() ;
- }
- }
-
- // PUBLIC METHODS
- //---------------
- /**
- * Converts the address value to its byte array form.
- * @return The byte array representation of the value.
- */
- public byte[] byteValue() {
- byte[] result = new byte[4] ;
- result[0] = (byte)components[0] ;
- result[1] = (byte)components[1] ;
- result[2] = (byte)components[2] ;
- result[3] = (byte)components[3] ;
-
- return result ;
- }
-
- /**
- * Converts the address to its String form.
- * Same as toString(). Exists only to follow a naming scheme.
- * @return The String representation of the value.
- */
- public String stringValue() {
- return toString() ;
- }
-
- /**
- * Extracts the ip address from an index OID and returns its
- * value converted as an SnmpOid.
- * @param index The index array.
- * @param start The position in the index array.
- * @return The OID representing the ip address value.
- * @exception SnmpStatusException There is no ip address value
- * available at the start position.
- */
- public static SnmpOid toOid(long[] index, int start) throws SnmpStatusException {
- if (start + 4 <= index.length) {
- try {
- return new SnmpOid(
- index[start],
- index[start+1],
- index[start+2],
- index[start+3]) ;
- }
- catch(IllegalArgumentException e) {
- throw new SnmpStatusException(SnmpStatusException.noSuchName) ;
- }
- }
- else {
- throw new SnmpStatusException(SnmpStatusException.noSuchName) ;
- }
- }
-
- /**
- * Scans an index OID, skips the address value and returns the position
- * of the next value.
- * @param index The index array.
- * @param start The position in the index array.
- * @return The position of the next value.
- * @exception SnmpStatusException There is no address value
- * available at the start position.
- */
- public static int nextOid(long[] index, int start) throws SnmpStatusException {
- if (start + 4 <= index.length) {
- return start + 4 ;
- }
- else {
- throw new SnmpStatusException(SnmpStatusException.noSuchName) ;
- }
- }
-
- /**
- * Appends an SnmpOid representing an SnmpIpAddress to another OID.
- * @param source An OID representing an SnmpIpAddress value.
- * @param dest Where source should be appended.
- */
- public static void appendToOid(SnmpOid source, SnmpOid dest) {
- if (source.getLength() != 4) {
- throw new IllegalArgumentException() ;
- }
- dest.append(source) ;
- }
-
- /**
- * Returns a textual description of the type object.
- * @return ASN.1 textual description.
- */
- final public String getTypeName() {
- return name ;
- }
-
- // PRIVATE METHODS
- //----------------
- /**
- * Build Ip address from byte array.
- */
- private void buildFromByteArray(byte[] bytes) {
- if (bytes.length != 4) {
- throw new IllegalArgumentException() ;
- }
- components = new long[4] ;
- componentCount= 4;
- components[0] = (bytes[0] >= 0) ? bytes[0] : bytes[0] + 256 ;
- components[1] = (bytes[1] >= 0) ? bytes[1] : bytes[1] + 256 ;
- components[2] = (bytes[2] >= 0) ? bytes[2] : bytes[2] + 256 ;
- components[3] = (bytes[3] >= 0) ? bytes[3] : bytes[3] + 256 ;
- }
-
- // VARIABLES
- //----------
- /**
- * Name of the type.
- */
- final static String name = "IpAddress" ;
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpMessage.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpMessage.java
deleted file mode 100644
index ec4c87466c0..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpMessage.java
+++ /dev/null
@@ -1,362 +0,0 @@
-/*
- * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package com.sun.jmx.snmp;
-
-
-
-// java imports
-//
-import java.util.logging.Level;
-import java.util.Vector;
-import java.net.InetAddress;
-
-import static com.sun.jmx.defaults.JmxProperties.SNMP_LOGGER;
-
-/**
- * Is a partially decoded representation of an SNMP packet.
- *
- * You will not normally need to use this class unless you decide to
- * implement your own {@link com.sun.jmx.snmp.SnmpPduFactory SnmpPduFactory} object.
- *
- * The SnmpMessage class is directly mapped onto the
- * Message syntax defined in RFC1157 and RFC1902.
- *
- *
- * Message ::= SEQUENCE {
- * version INTEGER { version(1) }, -- for SNMPv2
- * community OCTET STRING, -- community name
- * data ANY -- an SNMPv2 PDU
- * }
- *
- *
- *
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- * @see SnmpPduFactory
- * @see SnmpPduPacket
- *
- */
-
-public class SnmpMessage extends SnmpMsg implements SnmpDefinitions {
- /**
- * Community name.
- */
- public byte[] community ;
-
- /**
- * Encodes this message and puts the result in the specified byte array.
- * For internal use only.
- *
- * @param outputBytes An array to receive the resulting encoding.
- *
- * @exception ArrayIndexOutOfBoundsException If the result does not fit
- * into the specified array.
- */
- public int encodeMessage(byte[] outputBytes) throws SnmpTooBigException {
- int encodingLength = 0 ;
- if (data == null)
- throw new IllegalArgumentException("Data field is null") ;
-
- //
- // Reminder: BerEncoder does backward encoding !
- //
- try {
- BerEncoder benc = new BerEncoder(outputBytes) ;
- benc.openSequence() ;
- benc.putAny(data, dataLength) ;
- benc.putOctetString((community != null) ? community : new byte[0]) ;
- benc.putInteger(version) ;
- benc.closeSequence() ;
- encodingLength = benc.trim() ;
- }
- catch(ArrayIndexOutOfBoundsException x) {
- throw new SnmpTooBigException() ;
- }
-
- return encodingLength ;
- }
- /**
- * Returns the associated request ID.
- * @param inputBytes The flat message.
- * @return The request ID.
- *
- * @since 1.5
- */
- public int getRequestId(byte[] inputBytes) throws SnmpStatusException {
- int requestId = 0;
- BerDecoder bdec = null;
- BerDecoder bdec2 = null;
- byte[] any = null;
- try {
- bdec = new BerDecoder(inputBytes);
- bdec.openSequence();
- bdec.fetchInteger();
- bdec.fetchOctetString();
- any = bdec.fetchAny();
- bdec2 = new BerDecoder(any);
- int type = bdec2.getTag();
- bdec2.openSequence(type);
- requestId = bdec2.fetchInteger();
- }
- catch(BerException x) {
- throw new SnmpStatusException("Invalid encoding") ;
- }
- try {
- bdec.closeSequence();
- }
- catch(BerException x) {
- }
- try {
- bdec2.closeSequence();
- }
- catch(BerException x) {
- }
- return requestId;
- }
- /**
- * Decodes the specified bytes and initializes this message.
- * For internal use only.
- *
- * @param inputBytes The bytes to be decoded.
- *
- * @exception SnmpStatusException If the specified bytes are not a valid encoding.
- */
- public void decodeMessage(byte[] inputBytes, int byteCount)
- throws SnmpStatusException {
- try {
- BerDecoder bdec = new BerDecoder(inputBytes/*, byteCount */) ; // FIXME
- bdec.openSequence() ;
- version = bdec.fetchInteger() ;
- community = bdec.fetchOctetString() ;
- data = bdec.fetchAny() ;
- dataLength = data.length ;
- bdec.closeSequence() ;
- }
- catch(BerException x) {
- throw new SnmpStatusException("Invalid encoding") ;
- }
- }
-
- /**
- * Initializes this message with the specified pdu.
- *
- * This method initializes the data field with an array of
- * maxDataLength bytes. It encodes the pdu.
- * The resulting encoding is stored in the data field
- * and the length of the encoding is stored in dataLength.
- *
- * If the encoding length exceeds maxDataLength,
- * the method throws an exception.
- *
- * @param pdu The PDU to be encoded.
- * @param maxDataLength The maximum length permitted for the data field.
- *
- * @exception SnmpStatusException If the specified pdu is not valid.
- * @exception SnmpTooBigException If the resulting encoding does not fit
- * into maxDataLength bytes.
- * @exception ArrayIndexOutOfBoundsException If the encoding exceeds maxDataLength.
- *
- * @since 1.5
- */
- public void encodeSnmpPdu(SnmpPdu pdu, int maxDataLength)
- throws SnmpStatusException, SnmpTooBigException {
- //
- // The easy work
- //
- SnmpPduPacket pdupacket = (SnmpPduPacket) pdu;
- version = pdupacket.version ;
- community = pdupacket.community ;
- address = pdupacket.address ;
- port = pdupacket.port ;
-
- //
- // Allocate the array to receive the encoding.
- //
- data = new byte[maxDataLength] ;
-
- //
- // Encode the pdupacket
- // Reminder: BerEncoder does backward encoding !
- //
-
- try {
- BerEncoder benc = new BerEncoder(data) ;
- benc.openSequence() ;
- encodeVarBindList(benc, pdupacket.varBindList) ;
-
- switch(pdupacket.type) {
-
- case pduGetRequestPdu :
- case pduGetNextRequestPdu :
- case pduInformRequestPdu :
- case pduGetResponsePdu :
- case pduSetRequestPdu :
- case pduV2TrapPdu :
- case pduReportPdu :
- SnmpPduRequest reqPdu = (SnmpPduRequest)pdupacket ;
- benc.putInteger(reqPdu.errorIndex) ;
- benc.putInteger(reqPdu.errorStatus) ;
- benc.putInteger(reqPdu.requestId) ;
- break ;
-
- case pduGetBulkRequestPdu :
- SnmpPduBulk bulkPdu = (SnmpPduBulk)pdupacket ;
- benc.putInteger(bulkPdu.maxRepetitions) ;
- benc.putInteger(bulkPdu.nonRepeaters) ;
- benc.putInteger(bulkPdu.requestId) ;
- break ;
-
- case pduV1TrapPdu :
- SnmpPduTrap trapPdu = (SnmpPduTrap)pdupacket ;
- benc.putInteger(trapPdu.timeStamp, SnmpValue.TimeticksTag) ;
- benc.putInteger(trapPdu.specificTrap) ;
- benc.putInteger(trapPdu.genericTrap) ;
- if(trapPdu.agentAddr != null)
- benc.putOctetString(trapPdu.agentAddr.byteValue(), SnmpValue.IpAddressTag) ;
- else
- benc.putOctetString(new byte[0], SnmpValue.IpAddressTag);
- benc.putOid(trapPdu.enterprise.longValue()) ;
- break ;
-
- default:
- throw new SnmpStatusException("Invalid pdu type " + String.valueOf(pdupacket.type)) ;
- }
- benc.closeSequence(pdupacket.type) ;
- dataLength = benc.trim() ;
- }
- catch(ArrayIndexOutOfBoundsException x) {
- throw new SnmpTooBigException() ;
- }
- }
- /**
- * Gets the PDU encoded in this message.
- *
- * This method decodes the data field and returns the resulting PDU.
- *
- * @return The resulting PDU.
- * @exception SnmpStatusException If the encoding is not valid.
- *
- * @since 1.5
- */
- public SnmpPdu decodeSnmpPdu()
- throws SnmpStatusException {
- //
- // Decode the pdu
- //
- SnmpPduPacket pdu = null ;
- BerDecoder bdec = new BerDecoder(data) ;
- try {
- int type = bdec.getTag() ;
- bdec.openSequence(type) ;
- switch(type) {
-
- case pduGetRequestPdu :
- case pduGetNextRequestPdu :
- case pduInformRequestPdu :
- case pduGetResponsePdu :
- case pduSetRequestPdu :
- case pduV2TrapPdu :
- case pduReportPdu :
- SnmpPduRequest reqPdu = new SnmpPduRequest() ;
- reqPdu.requestId = bdec.fetchInteger() ;
- reqPdu.errorStatus = bdec.fetchInteger() ;
- reqPdu.errorIndex = bdec.fetchInteger() ;
- pdu = reqPdu ;
- break ;
-
- case pduGetBulkRequestPdu :
- SnmpPduBulk bulkPdu = new SnmpPduBulk() ;
- bulkPdu.requestId = bdec.fetchInteger() ;
- bulkPdu.nonRepeaters = bdec.fetchInteger() ;
- bulkPdu.maxRepetitions = bdec.fetchInteger() ;
- pdu = bulkPdu ;
- break ;
-
- case pduV1TrapPdu :
- SnmpPduTrap trapPdu = new SnmpPduTrap() ;
- trapPdu.enterprise = new SnmpOid(bdec.fetchOid()) ;
- byte []b = bdec.fetchOctetString(SnmpValue.IpAddressTag);
- if(b.length != 0)
- trapPdu.agentAddr = new SnmpIpAddress(b) ;
- else
- trapPdu.agentAddr = null;
- trapPdu.genericTrap = bdec.fetchInteger() ;
- trapPdu.specificTrap = bdec.fetchInteger() ;
- trapPdu.timeStamp = bdec.fetchInteger(SnmpValue.TimeticksTag) ;
- pdu = trapPdu ;
- break ;
-
- default:
- throw new SnmpStatusException(snmpRspWrongEncoding) ;
- }
- pdu.type = type ;
- pdu.varBindList = decodeVarBindList(bdec) ;
- bdec.closeSequence() ;
- } catch(BerException e) {
- if (SNMP_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_LOGGER.logp(Level.FINEST, SnmpMessage.class.getName(),
- "decodeSnmpPdu", "BerException", e);
- }
- throw new SnmpStatusException(snmpRspWrongEncoding);
- } catch(IllegalArgumentException e) {
- // bug id 4654066
- if (SNMP_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_LOGGER.logp(Level.FINEST, SnmpMessage.class.getName(),
- "decodeSnmpPdu", "IllegalArgumentException", e);
- }
- throw new SnmpStatusException(snmpRspWrongEncoding);
- }
-
- //
- // The easy work
- //
- pdu.version = version ;
- pdu.community = community ;
- pdu.address = address ;
- pdu.port = port ;
-
- return pdu;
- }
- /**
- * Dumps this message in a string.
- *
- * @return The string containing the dump.
- */
- public String printMessage() {
- StringBuilder sb = new StringBuilder();
- if (community == null) {
- sb.append("Community: null") ;
- }
- else {
- sb.append("Community: {\n") ;
- sb.append(dumpHexBuffer(community, 0, community.length)) ;
- sb.append("\n}\n") ;
- }
- return sb.append(super.printMessage()).toString();
- }
-
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpMsg.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpMsg.java
deleted file mode 100644
index cea4c744ad0..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpMsg.java
+++ /dev/null
@@ -1,476 +0,0 @@
-/*
- * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.jmx.snmp;
-
-import com.sun.jmx.snmp.SnmpSecurityParameters;
-// java imports
-//
-import java.util.Vector;
-import java.net.InetAddress;
-
-
-import com.sun.jmx.snmp.SnmpStatusException;
-/**
- * A partially decoded representation of an SNMP packet. It contains
- * the information contained in any SNMP message (SNMPv1, SNMPv2 or
- * SNMPv3).
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
decodeMessage and encodeMessage do not
- * perform any check on this value.
- * decodeSnmpPdu and encodeSnmpPdu only
- * accept the values 0 (for SNMPv1), 1 (for SNMPv2) and 3 (for SNMPv3).
- */
- public int version = 0;
-
- /**
- * Encoding of the PDU.
- *
This is usually the BER encoding of the PDU's syntax
- * defined in RFC1157 and RFC1902. However, this can be authenticated
- * or encrypted data (but you need to implemented your own
- * SnmpPduFactory class).
- */
- public byte[] data = null;
-
- /**
- * Number of useful bytes in the data field.
- */
- public int dataLength = 0;
-
- /**
- * Source or destination address.
- * For an incoming message it's the source.
- * For an outgoing message it's the destination.
- */
- public InetAddress address = null;
-
- /**
- * Source or destination port.
- * For an incoming message it's the source.
- * For an outgoing message it's the destination.
- */
- public int port = 0;
- /**
- * Security parameters. Contain informations according to Security Model (Usm, community string based, ...).
- */
- public SnmpSecurityParameters securityParameters = null;
- /**
- * Returns the encoded SNMP version present in the passed byte array.
- * @param data The unmarshalled SNMP message.
- * @return The SNMP version (0, 1 or 3).
- */
- public static int getProtocolVersion(byte[] data)
- throws SnmpStatusException {
- int version = 0;
- BerDecoder bdec = null;
- try {
- bdec = new BerDecoder(data);
- bdec.openSequence();
- version = bdec.fetchInteger();
- }
- catch(BerException x) {
- throw new SnmpStatusException("Invalid encoding") ;
- }
- try {
- bdec.closeSequence();
- }
- catch(BerException x) {
- }
- return version;
- }
-
- /**
- * Returns the associated request ID.
- * @param data The flat message.
- * @return The request ID.
- */
- public abstract int getRequestId(byte[] data) throws SnmpStatusException;
-
- /**
- * Encodes this message and puts the result in the specified byte array.
- * For internal use only.
- *
- * @param outputBytes An array to receive the resulting encoding.
- *
- * @exception ArrayIndexOutOfBoundsException If the result does not fit
- * into the specified array.
- */
- public abstract int encodeMessage(byte[] outputBytes)
- throws SnmpTooBigException;
-
- /**
- * Decodes the specified bytes and initializes this message.
- * For internal use only.
- *
- * @param inputBytes The bytes to be decoded.
- *
- * @exception SnmpStatusException If the specified bytes are not a valid encoding.
- */
- public abstract void decodeMessage(byte[] inputBytes, int byteCount)
- throws SnmpStatusException;
-
- /**
- * Initializes this message with the specified pdu.
- *
- * This method initializes the data field with an array of
- * maxDataLength bytes. It encodes the pdu.
- * The resulting encoding is stored in the data field
- * and the length of the encoding is stored in dataLength.
- *
- * If the encoding length exceeds maxDataLength,
- * the method throws an exception.
- *
- * @param pdu The PDU to be encoded.
- * @param maxDataLength The maximum length permitted for the data field.
- *
- * @exception SnmpStatusException If the specified pdu is not valid.
- * @exception SnmpTooBigException If the resulting encoding does not fit
- * into maxDataLength bytes.
- * @exception ArrayIndexOutOfBoundsException If the encoding exceeds maxDataLength.
- */
- public abstract void encodeSnmpPdu(SnmpPdu pdu, int maxDataLength)
- throws SnmpStatusException, SnmpTooBigException;
-
-
- /**
- * Gets the PDU encoded in this message.
- *
- * This method decodes the data field and returns the resulting PDU.
- *
- * @return The resulting PDU.
- * @exception SnmpStatusException If the encoding is not valid.
- */
- public abstract SnmpPdu decodeSnmpPdu()
- throws SnmpStatusException;
-
- /**
- * Dumps the content of a byte buffer using hexadecimal form.
- *
- * @param b The buffer to dump.
- * @param offset The position of the first byte to be dumped.
- * @param len The number of bytes to be dumped starting from offset.
- *
- * @return The string containing the dump.
- */
- public static String dumpHexBuffer(byte [] b, int offset, int len) {
- StringBuilder sb = new StringBuilder(len << 1) ;
- int k = 1 ;
- int flen = offset + len ;
-
- for (int i = offset; i < flen ; i++) {
- int j = b[i] & 0xFF ;
- sb.append(Character.forDigit((j >>> 4), 16)) ;
- sb.append(Character.forDigit((j & 0x0F), 16)) ;
- k++ ;
- if (k%16 == 0) {
- sb.append('\n') ;
- k = 1 ;
- } else
- sb.append(' ') ;
- }
- return sb.toString() ;
- }
-
- /**
- * Dumps this message in a string.
- *
- * @return The string containing the dump.
- */
- public String printMessage() {
- StringBuilder sb = new StringBuilder() ;
- sb.append("Version: ") ;
- sb.append(version) ;
- sb.append("\n") ;
- if (data == null) {
- sb.append("Data: null") ;
- }
- else {
- sb.append("Data: {\n") ;
- sb.append(dumpHexBuffer(data, 0, dataLength)) ;
- sb.append("\n}\n") ;
- }
-
- return sb.toString() ;
- }
-
- /**
- * For SNMP Runtime private use only.
- */
- public void encodeVarBindList(BerEncoder benc,
- SnmpVarBind[] varBindList)
- throws SnmpStatusException, SnmpTooBigException {
- //
- // Remember: the encoder does backward encoding
- //
- int encodedVarBindCount = 0 ;
- try {
- benc.openSequence() ;
- if (varBindList != null) {
- for (int i = varBindList.length - 1 ; i >= 0 ; i--) {
- SnmpVarBind bind = varBindList[i] ;
- if (bind != null) {
- benc.openSequence() ;
- encodeVarBindValue(benc, bind.value) ;
- benc.putOid(bind.oid.longValue()) ;
- benc.closeSequence() ;
- encodedVarBindCount++ ;
- }
- }
- }
- benc.closeSequence() ;
- }
- catch(ArrayIndexOutOfBoundsException x) {
- throw new SnmpTooBigException(encodedVarBindCount) ;
- }
- }
-
- /**
- * For SNMP Runtime private use only.
- */
- void encodeVarBindValue(BerEncoder benc,
- SnmpValue v)throws SnmpStatusException {
- if (v == null) {
- benc.putNull() ;
- }
- else if (v instanceof SnmpIpAddress) {
- benc.putOctetString(((SnmpIpAddress)v).byteValue(), SnmpValue.IpAddressTag) ;
- }
- else if (v instanceof SnmpCounter) {
- benc.putInteger(((SnmpCounter)v).longValue(), SnmpValue.CounterTag) ;
- }
- else if (v instanceof SnmpGauge) {
- benc.putInteger(((SnmpGauge)v).longValue(), SnmpValue.GaugeTag) ;
- }
- else if (v instanceof SnmpTimeticks) {
- benc.putInteger(((SnmpTimeticks)v).longValue(), SnmpValue.TimeticksTag) ;
- }
- else if (v instanceof SnmpOpaque) {
- benc.putOctetString(((SnmpOpaque)v).byteValue(), SnmpValue.OpaqueTag) ;
- }
- else if (v instanceof SnmpInt) {
- benc.putInteger(((SnmpInt)v).intValue()) ;
- }
- else if (v instanceof SnmpString) {
- benc.putOctetString(((SnmpString)v).byteValue()) ;
- }
- else if (v instanceof SnmpOid) {
- benc.putOid(((SnmpOid)v).longValue()) ;
- }
- else if (v instanceof SnmpCounter64) {
- if (version == snmpVersionOne) {
- throw new SnmpStatusException("Invalid value for SNMP v1 : " + v) ;
- }
- benc.putInteger(((SnmpCounter64)v).longValue(), SnmpValue.Counter64Tag) ;
- }
- else if (v instanceof SnmpNull) {
- int tag = ((SnmpNull)v).getTag() ;
- if ((version == snmpVersionOne) && (tag != SnmpValue.NullTag)) {
- throw new SnmpStatusException("Invalid value for SNMP v1 : " + v) ;
- }
- if ((version == snmpVersionTwo) &&
- (tag != SnmpValue.NullTag) &&
- (tag != SnmpVarBind.errNoSuchObjectTag) &&
- (tag != SnmpVarBind.errNoSuchInstanceTag) &&
- (tag != SnmpVarBind.errEndOfMibViewTag)) {
- throw new SnmpStatusException("Invalid value " + v) ;
- }
- benc.putNull(tag) ;
- }
- else {
- throw new SnmpStatusException("Invalid value " + v) ;
- }
-
- }
-
-
- /**
- * For SNMP Runtime private use only.
- */
- public SnmpVarBind[] decodeVarBindList(BerDecoder bdec)
- throws BerException {
- bdec.openSequence() ;
- Vector tmp = new Vector() ;
- while (bdec.cannotCloseSequence()) {
- SnmpVarBind bind = new SnmpVarBind() ;
- bdec.openSequence() ;
- bind.oid = new SnmpOid(bdec.fetchOid()) ;
- bind.setSnmpValue(decodeVarBindValue(bdec)) ;
- bdec.closeSequence() ;
- tmp.addElement(bind) ;
- }
- bdec.closeSequence() ;
- SnmpVarBind[] varBindList= new SnmpVarBind[tmp.size()] ;
- tmp.copyInto(varBindList);
- return varBindList ;
- }
-
-
- /**
- * For SNMP Runtime private use only.
- */
- SnmpValue decodeVarBindValue(BerDecoder bdec)
- throws BerException {
- SnmpValue result = null ;
- int tag = bdec.getTag() ;
-
- // bugId 4641696 : RuntimeExceptions must be transformed in
- // BerException.
- switch(tag) {
-
- //
- // Simple syntax
- //
- case BerDecoder.IntegerTag :
- try {
- result = new SnmpInt(bdec.fetchInteger()) ;
- } catch(RuntimeException r) {
- throw new BerException();
- // BerException("Can't build SnmpInt from decoded value.");
- }
- break ;
- case BerDecoder.OctetStringTag :
- try {
- result = new SnmpString(bdec.fetchOctetString()) ;
- } catch(RuntimeException r) {
- throw new BerException();
- // BerException("Can't build SnmpString from decoded value.");
- }
- break ;
- case BerDecoder.OidTag :
- try {
- result = new SnmpOid(bdec.fetchOid()) ;
- } catch(RuntimeException r) {
- throw new BerException();
- // BerException("Can't build SnmpOid from decoded value.");
- }
- break ;
- case BerDecoder.NullTag :
- bdec.fetchNull() ;
- try {
- result = new SnmpNull() ;
- } catch(RuntimeException r) {
- throw new BerException();
- // BerException("Can't build SnmpNull from decoded value.");
- }
- break ;
-
- //
- // Application syntax
- //
- case SnmpValue.IpAddressTag :
- try {
- result = new SnmpIpAddress(bdec.fetchOctetString(tag)) ;
- } catch (RuntimeException r) {
- throw new BerException();
- // BerException("Can't build SnmpIpAddress from decoded value.");
- }
- break ;
- case SnmpValue.CounterTag :
- try {
- result = new SnmpCounter(bdec.fetchIntegerAsLong(tag)) ;
- } catch(RuntimeException r) {
- throw new BerException();
- // BerException("Can't build SnmpCounter from decoded value.");
- }
- break ;
- case SnmpValue.GaugeTag :
- try {
- result = new SnmpGauge(bdec.fetchIntegerAsLong(tag)) ;
- } catch(RuntimeException r) {
- throw new BerException();
- // BerException("Can't build SnmpGauge from decoded value.");
- }
- break ;
- case SnmpValue.TimeticksTag :
- try {
- result = new SnmpTimeticks(bdec.fetchIntegerAsLong(tag)) ;
- } catch(RuntimeException r) {
- throw new BerException();
- // BerException("Can't build SnmpTimeticks from decoded value.");
- }
- break ;
- case SnmpValue.OpaqueTag :
- try {
- result = new SnmpOpaque(bdec.fetchOctetString(tag)) ;
- } catch(RuntimeException r) {
- throw new BerException();
- // BerException("Can't build SnmpOpaque from decoded value.");
- }
- break ;
-
- //
- // V2 syntaxes
- //
- case SnmpValue.Counter64Tag :
- if (version == snmpVersionOne) {
- throw new BerException(BerException.BAD_VERSION) ;
- }
- try {
- result = new SnmpCounter64(bdec.fetchIntegerAsLong(tag)) ;
- } catch(RuntimeException r) {
- throw new BerException();
- // BerException("Can't build SnmpCounter64 from decoded value.");
- }
- break ;
-
- case SnmpVarBind.errNoSuchObjectTag :
- if (version == snmpVersionOne) {
- throw new BerException(BerException.BAD_VERSION) ;
- }
- bdec.fetchNull(tag) ;
- result = SnmpVarBind.noSuchObject ;
- break ;
-
- case SnmpVarBind.errNoSuchInstanceTag :
- if (version == snmpVersionOne) {
- throw new BerException(BerException.BAD_VERSION) ;
- }
- bdec.fetchNull(tag) ;
- result = SnmpVarBind.noSuchInstance ;
- break ;
-
- case SnmpVarBind.errEndOfMibViewTag :
- if (version == snmpVersionOne) {
- throw new BerException(BerException.BAD_VERSION) ;
- }
- bdec.fetchNull(tag) ;
- result = SnmpVarBind.endOfMibView ;
- break ;
-
- default:
- throw new BerException() ;
-
- }
-
- return result ;
- }
-
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpNull.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpNull.java
deleted file mode 100644
index 9c9302d8be9..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpNull.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package com.sun.jmx.snmp;
-
-
-
-/**
- * Represents an SNMP null value.
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- */
-
-public class SnmpNull extends SnmpValue {
- private static final long serialVersionUID = 1783782515994279177L;
-
- // CONSTRUCTORS
- //-------------
- /**
- * Constructs a new SnmpNull.
- */
- public SnmpNull() {
- tag = NullTag ;
- }
-
- /**
- * Constructs a new SnmpNull.
- * For mibgen private use only.
- */
- public SnmpNull(String dummy) {
- this();
- }
-
- /**
- * Constructs a new SnmpNull from the specified tag value.
- * @param t The initialization value.
- */
- public SnmpNull(int t) {
- tag = t ;
- }
-
- // PUBLIC METHODS
- //---------------
- /**
- * Returns the tag value of this SnmpNull.
- * @return The value.
- */
- public int getTag() {
- return tag ;
- }
-
- /**
- * Converts the NULL value to its ASN.1 String form.
- * When the tag is not the universal one, it is preprended
- * to the String form.
- * @return The String representation of the value.
- */
- public String toString() {
- String result = "" ;
- if (tag != 5) {
- result += "[" + tag + "] " ;
- }
- result += "NULL" ;
- switch(tag) {
- case errNoSuchObjectTag :
- result += " (noSuchObject)" ;
- break ;
-
- case errNoSuchInstanceTag :
- result += " (noSuchInstance)" ;
- break ;
-
- case errEndOfMibViewTag :
- result += " (endOfMibView)" ;
- break ;
- }
- return result ;
- }
-
- /**
- * Converts the NULL value to its SnmpOid form.
- * Normally, a NULL value cannot be used as an index value,
- * this method triggers an exception.
- * @return The OID representation of the value.
- */
- public SnmpOid toOid() {
- throw new IllegalArgumentException() ;
- }
-
- /**
- * Performs a clone action. This provides a workaround for the
- * SnmpValue interface.
- * @return The SnmpValue clone.
- */
- final synchronized public SnmpValue duplicate() {
- return (SnmpValue) clone() ;
- }
-
- /**
- * Clones the SnmpNull object, making a copy of its data.
- * @return The object clone.
- */
- final synchronized public Object clone() {
- SnmpNull newclone = null ;
- try {
- newclone = (SnmpNull) super.clone() ;
- newclone.tag = tag ;
- } catch (CloneNotSupportedException e) {
- throw new InternalError(e) ; // vm bug.
- }
- return newclone ;
- }
-
- /**
- * Returns a textual description of the type object.
- * @return ASN.1 textual description.
- */
- final public String getTypeName() {
- return name ;
- }
-
- /**
- * Checks if this SnmpNull object corresponds to a noSuchObject value.
- * @return true if the tag equals {@link com.sun.jmx.snmp.SnmpDataTypeEnums#errNoSuchObjectTag},
- * false otherwise.
- */
- public boolean isNoSuchObjectValue() {
- return (tag == SnmpDataTypeEnums.errNoSuchObjectTag);
- }
-
- /**
- * Checks if this SnmpNull object corresponds to a noSuchInstance value.
- * @return true if the tag equals {@link com.sun.jmx.snmp.SnmpDataTypeEnums#errNoSuchInstanceTag},
- * false otherwise.
- */
- public boolean isNoSuchInstanceValue() {
- return (tag == SnmpDataTypeEnums.errNoSuchInstanceTag);
- }
-
- /**
- * Checks if this SnmpNull object corresponds to an endOfMibView value.
- * @return true if the tag equals {@link com.sun.jmx.snmp.SnmpDataTypeEnums#errEndOfMibViewTag},
- * false otherwise.
- */
- public boolean isEndOfMibViewValue() {
- return (tag == SnmpDataTypeEnums.errEndOfMibViewTag);
- }
-
- // VARIABLES
- //----------
- /**
- * Name of the type.
- */
- final static String name = "Null" ;
-
- /**
- * This is the tag of the NULL value. By default, it is the universal tag value.
- */
- private int tag = 5 ;
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpOpaque.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpOpaque.java
deleted file mode 100644
index 50bb8b8c9aa..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpOpaque.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package com.sun.jmx.snmp;
-
-
-
-/**
- * Is used to represent an SNMP value.
- * The Opaque type is defined in RFC 1155.
- *
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- */
-
-public class SnmpOpaque extends SnmpString {
- private static final long serialVersionUID = 380952213936036664L;
-
- // CONSTRUCTORS
- //-------------
- /**
- * Constructs a new SnmpOpaque from the specified bytes array.
- * @param v The bytes composing the opaque value.
- */
- public SnmpOpaque(byte[] v) {
- super(v) ;
- }
-
- /**
- * Constructs a new SnmpOpaque with the specified Bytes array.
- * @param v The Bytes composing the opaque value.
- */
- public SnmpOpaque(Byte[] v) {
- super(v) ;
- }
-
- /**
- * Constructs a new SnmpOpaque from the specified String value.
- * @param v The initialization value.
- */
- public SnmpOpaque(String v) {
- super(v) ;
- }
-
- // PUBLIC METHODS
- //---------------
- /**
- * Converts the opaque to its String form, that is, a string of
- * bytes expressed in hexadecimal form.
- * @return The String representation of the value.
- */
- public String toString() {
- StringBuilder result = new StringBuilder() ;
- for (int i = 0 ; i < value.length ; i++) {
- byte b = value[i] ;
- int n = (b >= 0) ? b : b + 256 ;
- result.append(Character.forDigit(n / 16, 16)) ;
- result.append(Character.forDigit(n % 16, 16)) ;
- }
- return result.toString() ;
- }
-
- /**
- * Returns a textual description of the type object.
- * @return ASN.1 textual description.
- */
- final public String getTypeName() {
- return name ;
- }
-
- // VARIABLES
- //----------
- /**
- * Name of the type.
- */
- final static String name = "Opaque" ;
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpParams.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpParams.java
deleted file mode 100644
index c61a69b31b2..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpParams.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.jmx.snmp;
-
-import com.sun.jmx.snmp.SnmpDefinitions;
-
-/**
- * This class is the base class of all parameters that are used when making SNMP requests to an SnmpPeer.
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- * @since 1.5
- */
-public abstract class SnmpParams implements SnmpDefinitions {
- private int protocolVersion = snmpVersionOne;
- SnmpParams(int version) {
- protocolVersion = version;
- }
-
- SnmpParams() {}
- /**
- * Checks whether parameters are in place for an SNMP set operation.
- * @return true if parameters are in place, false otherwise.
- */
- public abstract boolean allowSnmpSets();
- /**
- * Returns the version of the protocol to use.
- * The returned value is:
- *
- *
{@link com.sun.jmx.snmp.SnmpDefinitions#snmpVersionOne snmpVersionOne} if the protocol is SNMPv1
- *
{@link com.sun.jmx.snmp.SnmpDefinitions#snmpVersionTwo snmpVersionTwo} if the protocol is SNMPv2
- *
{@link com.sun.jmx.snmp.SnmpDefinitions#snmpVersionThree snmpVersionThree} if the protocol is SNMPv3
- *
- * @return The version of the protocol to use.
- */
- public int getProtocolVersion() {
- return protocolVersion ;
- }
-
- /**
- * Sets the version of the protocol to be used.
- * The version should be identified using the definitions
- * contained in
- * {@link com.sun.jmx.snmp.SnmpDefinitions SnmpDefinitions}.
- * For instance if you wish to use SNMPv2, you can call the method as follows:
- *
- * @param protocolversion The version of the protocol to be used.
- */
-
- public void setProtocolVersion(int protocolversion) {
- this.protocolVersion = protocolversion ;
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpPdu.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpPdu.java
deleted file mode 100644
index 77a4ed35a70..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpPdu.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.jmx.snmp;
-
-
-import java.io.Serializable;
-import java.net.InetAddress;
-/**
- * Is the fully decoded representation of an SNMP packet.
- *
- * Classes are derived from SnmpPdu to
- * represent the different forms of SNMP packets
- * ({@link com.sun.jmx.snmp.SnmpPduPacket SnmpPduPacket},
- * {@link com.sun.jmx.snmp.SnmpScopedPduPacket SnmpScopedPduPacket})
- * The SnmpPdu class defines the attributes
- * common to every form of SNMP packets.
- *
- *
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- * @see SnmpMessage
- * @see SnmpPduFactory
- *
- * @since 1.5
- */
-@SuppressWarnings("serial") // JDK implementation class
-public abstract class SnmpPdu implements SnmpDefinitions, Serializable {
-
- /**
- * PDU type. Types are defined in
- * {@link com.sun.jmx.snmp.SnmpDefinitions SnmpDefinitions}.
- * @serial
- */
- public int type=0 ;
-
- /**
- * Protocol version. Versions are defined in
- * {@link com.sun.jmx.snmp.SnmpDefinitions SnmpDefinitions}.
- * @serial
- */
- public int version=0 ;
-
- /**
- * List of variables.
- * @serial
- */
- public SnmpVarBind[] varBindList ;
-
-
- /**
- * Request identifier.
- * Note that this field is not used by SnmpPduTrap.
- * @serial
- */
- public int requestId=0 ;
-
- /**
- * Source or destination address.
- *
For an incoming PDU it's the source.
- * For an outgoing PDU it's the destination.
- * @serial
- */
- public InetAddress address ;
-
- /**
- * Source or destination port.
- *
For an incoming PDU it's the source.
- * For an outgoing PDU it's the destination.
- * @serial
- */
- public int port=0 ;
-
- /**
- * Returns the String representation of a PDU type.
- * For instance, if the PDU type is SnmpDefinitions.pduGetRequestPdu,
- * the method will return "SnmpGet".
- * @param cmd The integer representation of the PDU type.
- * @return The String representation of the PDU type.
- */
- public static String pduTypeToString(int cmd) {
- switch (cmd) {
- case pduGetRequestPdu :
- return "SnmpGet" ;
- case pduGetNextRequestPdu :
- return "SnmpGetNext" ;
- case pduWalkRequest :
- return "SnmpWalk(*)" ;
- case pduSetRequestPdu :
- return "SnmpSet" ;
- case pduGetResponsePdu :
- return "SnmpResponse" ;
- case pduV1TrapPdu :
- return "SnmpV1Trap" ;
- case pduV2TrapPdu :
- return "SnmpV2Trap" ;
- case pduGetBulkRequestPdu :
- return "SnmpGetBulk" ;
- case pduInformRequestPdu :
- return "SnmpInform" ;
- }
- return "Unknown Command = " + cmd ;
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpPduBulk.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpPduBulk.java
deleted file mode 100644
index f4e810dc8bc..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpPduBulk.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package com.sun.jmx.snmp;
-
-
-
-/**
- * Represents a get-bulk PDU as defined in RFC 1448.
- *
- * You will not usually need to use this class, except if you
- * decide to implement your own
- * {@link com.sun.jmx.snmp.SnmpPduFactory SnmpPduFactory} object.
- *
- * The SnmpPduBulk extends {@link com.sun.jmx.snmp.SnmpPduPacket SnmpPduPacket}
- * and defines attributes specific to the get-bulk PDU (see RFC 1448).
- *
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- */
-
-public class SnmpPduBulk extends SnmpPduPacket
- implements SnmpPduBulkType {
- private static final long serialVersionUID = -7431306775883371046L;
-
- /**
- * The non-repeaters value.
- * @serial
- */
- public int nonRepeaters ;
-
-
- /**
- * The max-repetitions value.
- * @serial
- */
- public int maxRepetitions ;
-
-
- /**
- * Builds a new get-bulk PDU.
- * type and version fields are initialized with
- * {@link com.sun.jmx.snmp.SnmpDefinitions#pduGetBulkRequestPdu pduGetBulkRequestPdu}
- * and {@link com.sun.jmx.snmp.SnmpDefinitions#snmpVersionTwo snmpVersionTwo}.
- */
- public SnmpPduBulk() {
- type = pduGetBulkRequestPdu ;
- version = snmpVersionTwo ;
- }
- /**
- * Implements the SnmpPduBulkType interface.
- *
- * @since 1.5
- */
- public void setMaxRepetitions(int i) {
- maxRepetitions = i;
- }
- /**
- * Implements the SnmpPduBulkType interface.
- *
- * @since 1.5
- */
- public void setNonRepeaters(int i) {
- nonRepeaters = i;
- }
- /**
- * Implements the SnmpPduBulkType interface.
- *
- * @since 1.5
- */
- public int getMaxRepetitions() { return maxRepetitions; }
- /**
- * Implements the SnmpPduBulkType interface.
- *
- * @since 1.5
- */
- public int getNonRepeaters() { return nonRepeaters; }
- /**
- * Implements the SnmpAckPdu interface.
- *
- * @since 1.5
- */
- public SnmpPdu getResponsePdu() {
- SnmpPduRequest result = new SnmpPduRequest();
- result.address = address;
- result.port = port;
- result.version = version;
- result.community = community;
- result.type = SnmpDefinitions.pduGetResponsePdu;
- result.requestId = requestId;
- result.errorStatus = SnmpDefinitions.snmpRspNoError;
- result.errorIndex = 0;
-
- return result;
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpPduBulkType.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpPduBulkType.java
deleted file mode 100644
index bfc7a4a83c1..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpPduBulkType.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.jmx.snmp;
-/**
- * Interface implemented by classes modelizing bulk pdu.
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- * @since 1.5
- */
-
-public interface SnmpPduBulkType extends SnmpAckPdu {
-
- /**
- * The max-repetitions setter.
- * @param max Maximum repetition.
- */
- public void setMaxRepetitions(int max);
-
- /**
- * The non-repeaters setter.
- * @param nr Non repeaters.
- */
- public void setNonRepeaters(int nr);
-
- /**
- * The max-repetitions getter.
- * @return Maximum repetition.
- */
- public int getMaxRepetitions();
-
- /**
- * The non-repeaters getter.
- * @return Non repeaters.
- */
- public int getNonRepeaters();
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpPduFactory.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpPduFactory.java
deleted file mode 100644
index cafdac90ea6..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpPduFactory.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package com.sun.jmx.snmp;
-
-
-
-
-/**
- * Defines the interface of the object in charge of encoding and decoding SNMP packets.
- *
- * You will not usually need to use this interface, except if you
- * decide to replace the default implementation SnmpPduFactoryBER.
- *
- * An SnmpPduFactory object is attached to an
- * {@link com.sun.jmx.snmp.daemon.SnmpAdaptorServer SNMP protocol adaptor}
- * or an {@link com.sun.jmx.snmp.SnmpPeer SnmpPeer}.
- * It is used each time an SNMP packet needs to be encoded or decoded.
- * {@link com.sun.jmx.snmp.SnmpPduFactoryBER SnmpPduFactoryBER} is the default
- * implementation.
- * It simply applies the standard ASN.1 encoding and decoding
- * on the bytes of the SNMP packet.
- *
- * It's possible to implement your own SnmpPduFactory
- * object and to add authentication and/or encryption to the
- * default encoding/decoding process.
- *
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- * @see SnmpPduFactory
- * @see SnmpPduPacket
- * @see SnmpMessage
- *
- */
-
-public interface SnmpPduFactory {
-
- /**
- * Decodes the specified SnmpMsg and returns the
- * resulting SnmpPdu. If this method returns
- * null, the message will be considered unsafe
- * and will be dropped.
- *
- * @param msg The SnmpMsg to be decoded.
- * @return Null or a fully initialized SnmpPdu.
- * @exception SnmpStatusException If the encoding is invalid.
- *
- * @since 1.5
- */
- public SnmpPdu decodeSnmpPdu(SnmpMsg msg) throws SnmpStatusException ;
-
- /**
- * Encodes the specified SnmpPdu and
- * returns the resulting SnmpMsg. If this
- * method returns null, the specified SnmpPdu
- * will be dropped and the current SNMP request will be
- * aborted.
- *
- * @param p The SnmpPdu to be encoded.
- * @param maxDataLength The size limit of the resulting encoding.
- * @return Null or a fully encoded SnmpMsg.
- * @exception SnmpStatusException If pdu contains
- * illegal values and cannot be encoded.
- * @exception SnmpTooBigException If the resulting encoding does not
- * fit into maxPktSize bytes.
- *
- * @since 1.5
- */
- public SnmpMsg encodeSnmpPdu(SnmpPdu p, int maxDataLength)
- throws SnmpStatusException, SnmpTooBigException ;
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpPduFactoryBER.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpPduFactoryBER.java
deleted file mode 100644
index 4cfbd4cd21c..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpPduFactoryBER.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package com.sun.jmx.snmp;
-
-
-// java imports
-//
-import java.io.Serializable;
-
-// jmx import
-//
-import com.sun.jmx.snmp.SnmpPduFactory;
-import com.sun.jmx.snmp.SnmpMessage;
-import com.sun.jmx.snmp.SnmpPduPacket;
-import com.sun.jmx.snmp.SnmpPdu;
-import com.sun.jmx.snmp.SnmpMsg;
-import com.sun.jmx.snmp.SnmpStatusException;
-import com.sun.jmx.snmp.SnmpTooBigException;
-import com.sun.jmx.snmp.SnmpDefinitions;
-
-// SNMP Runtime import
-//
-import com.sun.jmx.snmp.SnmpV3Message;
-
-/**
- * Default implementation of the {@link com.sun.jmx.snmp.SnmpPduFactory SnmpPduFactory} interface.
- * It uses the BER (basic encoding rules) standardized encoding scheme associated with ASN.1.
- *
- * This implementation of the SnmpPduFactory is very
- * basic: it simply calls encoding and decoding methods from
- * {@link com.sun.jmx.snmp.SnmpMsg}.
- *
- *
- * public SnmpPdu decodeSnmpPdu(SnmpMsg msg)
- * throws SnmpStatusException {
- * return msg.decodeSnmpPdu() ;
- * }
- *
- * public SnmpMsg encodeSnmpPdu(SnmpPdu pdu, int maxPktSize)
- * throws SnmpStatusException, SnmpTooBigException {
- * SnmpMsg result = new SnmpMessage() ; // for SNMP v1/v2
- * or
- * SnmpMsg result = new SnmpV3Message() ; // for SNMP v3
- * result.encodeSnmpPdu(pdu, maxPktSize) ;
- * return result ;
- * }
- *
- *
- * To implement your own object, you can implement SnmpPduFactory
- * or extend SnmpPduFactoryBER.
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- */
-
-public class SnmpPduFactoryBER implements SnmpPduFactory, Serializable {
- private static final long serialVersionUID = -3525318344000547635L;
-
- /**
- * Calls {@link com.sun.jmx.snmp.SnmpMsg#decodeSnmpPdu SnmpMsg.decodeSnmpPdu}
- * on the specified message and returns the resulting SnmpPdu.
- *
- * @param msg The SNMP message to be decoded.
- * @return The resulting SNMP PDU packet.
- * @exception SnmpStatusException If the encoding is invalid.
- *
- * @since 1.5
- */
- public SnmpPdu decodeSnmpPdu(SnmpMsg msg) throws SnmpStatusException {
- return msg.decodeSnmpPdu();
- }
-
- /**
- * Encodes the specified SnmpPdu and
- * returns the resulting SnmpMsg. If this
- * method returns null, the specified SnmpPdu
- * will be dropped and the current SNMP request will be
- * aborted.
- *
- * @param p The SnmpPdu to be encoded.
- * @param maxDataLength The size limit of the resulting encoding.
- * @return Null or a fully encoded SnmpMsg.
- * @exception SnmpStatusException If pdu contains
- * illegal values and cannot be encoded.
- * @exception SnmpTooBigException If the resulting encoding does not
- * fit into maxPktSize bytes.
- *
- * @since 1.5
- */
- public SnmpMsg encodeSnmpPdu(SnmpPdu p, int maxDataLength)
- throws SnmpStatusException, SnmpTooBigException {
- switch(p.version) {
- case SnmpDefinitions.snmpVersionOne:
- case SnmpDefinitions.snmpVersionTwo: {
- SnmpMessage result = new SnmpMessage();
- result.encodeSnmpPdu((SnmpPduPacket) p, maxDataLength);
- return result;
- }
- case SnmpDefinitions.snmpVersionThree: {
- SnmpV3Message result = new SnmpV3Message();
- result.encodeSnmpPdu(p, maxDataLength);
- return result;
- }
- default:
- return null;
- }
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpPduRequest.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpPduRequest.java
deleted file mode 100644
index f2ecdfd435f..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpPduRequest.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package com.sun.jmx.snmp;
-
-
-
-
-/**
- * Is used to represent get, get-next, set, response and SNMPv2-trap PDUs.
- *
- * You will not usually need to use this class, except if you
- * decide to implement your own
- * {@link com.sun.jmx.snmp.SnmpPduFactory SnmpPduFactory} object.
- *
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- */
-
-public class SnmpPduRequest extends SnmpPduPacket
- implements SnmpPduRequestType {
- private static final long serialVersionUID = 2218754017025258979L;
-
-
- /**
- * Error status. Statuses are defined in
- * {@link com.sun.jmx.snmp.SnmpDefinitions SnmpDefinitions}.
- * @serial
- */
- public int errorStatus=0 ;
-
-
- /**
- * Error index. Remember that SNMP indices start from 1.
- * Thus the corresponding SnmpVarBind is
- * varBindList[errorIndex-1].
- * @serial
- */
- public int errorIndex=0 ;
- /**
- * Implements SnmpPduRequestType interface.
- *
- * @since 1.5
- */
- public void setErrorIndex(int i) {
- errorIndex = i;
- }
- /**
- * Implements SnmpPduRequestType interface.
- *
- * @since 1.5
- */
- public void setErrorStatus(int i) {
- errorStatus = i;
- }
- /**
- * Implements SnmpPduRequestType interface.
- *
- * @since 1.5
- */
- public int getErrorIndex() { return errorIndex; }
- /**
- * Implements SnmpPduRequestType interface.
- *
- * @since 1.5
- */
- public int getErrorStatus() { return errorStatus; }
- /**
- * Implements SnmpAckPdu interface.
- *
- * @since 1.5
- */
- public SnmpPdu getResponsePdu() {
- SnmpPduRequest result = new SnmpPduRequest();
- result.address = address;
- result.port = port;
- result.version = version;
- result.community = community;
- result.type = SnmpDefinitions.pduGetResponsePdu;
- result.requestId = requestId;
- result.errorStatus = SnmpDefinitions.snmpRspNoError;
- result.errorIndex = 0;
-
- return result;
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpPduRequestType.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpPduRequestType.java
deleted file mode 100644
index b785b220077..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpPduRequestType.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.jmx.snmp;
-
-/**
- * Interface implemented by classes modelizing request pdu.
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- * @since 1.5
- */
-public interface SnmpPduRequestType extends SnmpAckPdu {
- /**
- * Error index setter. Remember that SNMP indices start from 1.
- * Thus the corresponding SnmpVarBind is
- * varBindList[errorIndex-1].
- * @param i Error index.
- */
- public void setErrorIndex(int i);
- /**
- * Error status setter. Statuses are defined in
- * {@link com.sun.jmx.snmp.SnmpDefinitions SnmpDefinitions}.
- * @param i Error status.
- */
- public void setErrorStatus(int i);
- /**
- * Error index getter. Remember that SNMP indices start from 1.
- * Thus the corresponding SnmpVarBind is
- * varBindList[errorIndex-1].
- * @return Error index.
- */
- public int getErrorIndex();
- /**
- * Error status getter. Statuses are defined in
- * {@link com.sun.jmx.snmp.SnmpDefinitions SnmpDefinitions}.
- * @return Error status.
- */
- public int getErrorStatus();
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpPduTrap.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpPduTrap.java
deleted file mode 100644
index 3c892c545d8..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpPduTrap.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package com.sun.jmx.snmp;
-
-
-
-/**
- * Represents an SNMPv1-trap PDU.
- *
- * You will not usually need to use this class, except if you
- * decide to implement your own
- * {@link com.sun.jmx.snmp.SnmpPduFactory SnmpPduFactory} object.
- *
- * The SnmpPduTrap extends {@link com.sun.jmx.snmp.SnmpPduPacket SnmpPduPacket}
- * and defines attributes specific to an SNMPv1 trap (see RFC1157).
- *
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- */
-
-public class SnmpPduTrap extends SnmpPduPacket {
- private static final long serialVersionUID = -3670886636491433011L;
-
- /**
- * Enterprise object identifier.
- * @serial
- */
- public SnmpOid enterprise ;
-
- /**
- * Agent address. If the agent address source was not an IPv4 one (eg : IPv6), this field is null.
- * @serial
- */
- public SnmpIpAddress agentAddr ;
-
- /**
- * Generic trap number.
- *
- * The possible values are defined in
- * {@link com.sun.jmx.snmp.SnmpDefinitions#trapColdStart SnmpDefinitions}.
- * @serial
- */
- public int genericTrap ;
-
- /**
- * Specific trap number.
- * @serial
- */
- public int specificTrap ;
-
- /**
- * Time-stamp.
- * @serial
- */
- public long timeStamp ;
-
-
-
- /**
- * Builds a new trap PDU.
- * type and version fields are initialized with
- * {@link com.sun.jmx.snmp.SnmpDefinitions#pduV1TrapPdu pduV1TrapPdu}
- * and {@link com.sun.jmx.snmp.SnmpDefinitions#snmpVersionOne snmpVersionOne}.
- */
- public SnmpPduTrap() {
- type = pduV1TrapPdu ;
- version = snmpVersionOne ;
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpScopedPduBulk.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpScopedPduBulk.java
deleted file mode 100644
index 6ae067e718a..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpScopedPduBulk.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.jmx.snmp;
-/**
- * Represents a get-bulk PDU as defined in RFC 1448.
- *
- *
- * The SnmpSocpedPduBulk extends {@link com.sun.jmx.snmp.SnmpScopedPduPacket SnmpScopedPduPacket}
- * and defines attributes specific to the get-bulk PDU (see RFC 1448).
- *
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- * @since 1.5
- */
-
-public class SnmpScopedPduBulk extends SnmpScopedPduPacket
- implements SnmpPduBulkType {
- private static final long serialVersionUID = -1648623646227038885L;
-
- /**
- * The non-repeaters value.
- * @serial
- */
- int nonRepeaters;
-
-
- /**
- * The max-repetitions value.
- * @serial
- */
- int maxRepetitions;
-
- public SnmpScopedPduBulk() {
- type = pduGetBulkRequestPdu;
- version = snmpVersionThree;
- }
-
- /**
- * The max-repetitions setter.
- * @param max Maximum repetition.
- */
- public void setMaxRepetitions(int max) {
- maxRepetitions = max;
- }
-
- /**
- * The non-repeaters setter.
- * @param nr Non repeaters.
- */
- public void setNonRepeaters(int nr) {
- nonRepeaters = nr;
- }
-
- /**
- * The max-repetitions getter.
- * @return Maximum repetition.
- */
- public int getMaxRepetitions() { return maxRepetitions; }
-
- /**
- * The non-repeaters getter.
- * @return Non repeaters.
- */
- public int getNonRepeaters() { return nonRepeaters; }
-
- /**
- * Generates the pdu to use for response.
- * @return Response pdu.
- */
- public SnmpPdu getResponsePdu() {
- SnmpScopedPduRequest result = new SnmpScopedPduRequest();
- result.address = address ;
- result.port = port ;
- result.version = version ;
- result.requestId = requestId;
- result.msgId = msgId;
- result.msgMaxSize = msgMaxSize;
- result.msgFlags = msgFlags;
- result.msgSecurityModel = msgSecurityModel;
- result.contextEngineId = contextEngineId;
- result.contextName = contextName;
- result.securityParameters = securityParameters;
- result.type = pduGetResponsePdu ;
- result.errorStatus = SnmpDefinitions.snmpRspNoError ;
- result.errorIndex = 0 ;
- return result;
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpScopedPduPacket.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpScopedPduPacket.java
deleted file mode 100644
index 934980ffce4..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpScopedPduPacket.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.jmx.snmp;
-
-import java.io.Serializable;
-
-import com.sun.jmx.snmp.SnmpSecurityParameters;
-
-import com.sun.jmx.snmp.SnmpDefinitions;
-/**
- * Is the fully decoded representation of an SNMP V3 packet.
- *
- *
- * Classes are derived from SnmpPdu to
- * represent the different forms of SNMP pdu
- * ({@link com.sun.jmx.snmp.SnmpScopedPduRequest SnmpScopedPduRequest},
- * {@link com.sun.jmx.snmp.SnmpScopedPduBulk SnmpScopedPduBulk}).
- * The SnmpScopedPduPacket class defines the attributes
- * common to every scoped SNMP packets.
- *
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- * @see SnmpV3Message
- *
- * @since 1.5
- */
-@SuppressWarnings("serial") // JDK implementation class
-public abstract class SnmpScopedPduPacket extends SnmpPdu
- implements Serializable {
- /**
- * Message max size the pdu sender can deal with.
- */
- public int msgMaxSize = 0;
-
- /**
- * Message identifier.
- */
- public int msgId = 0;
-
- /**
- * Message flags. Reportable flag and security level.
- *
- * -- .... ...1 authFlag
- * -- .... ..1. privFlag
- * -- .... .1.. reportableFlag
- * -- Please observe:
- * -- .... ..00 is OK, means noAuthNoPriv
- * -- .... ..01 is OK, means authNoPriv
- * -- .... ..10 reserved, must NOT be used.
- * -- .... ..11 is OK, means authPriv
- *
- */
- public byte msgFlags = 0;
-
- /**
- * The security model the security sub system MUST use in order to deal with this pdu (eg: User based Security Model Id = 3).
- */
- public int msgSecurityModel = 0;
-
- /**
- * The context engine Id in which the pdu must be handled (Generaly the local engine Id).
- */
- public byte[] contextEngineId = null;
-
- /**
- * The context name in which the OID have to be interpreted.
- */
- public byte[] contextName = null;
-
- /**
- * The security parameters. This is an opaque member that is
- * interpreted by the concerned security model.
- */
- public SnmpSecurityParameters securityParameters = null;
-
- /**
- * Constructor. Is only called by a son. Set the version to SnmpDefinitions.snmpVersionThree.
- */
- protected SnmpScopedPduPacket() {
- version = SnmpDefinitions.snmpVersionThree;
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpScopedPduRequest.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpScopedPduRequest.java
deleted file mode 100644
index 118f7215e9c..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpScopedPduRequest.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.jmx.snmp;
-/**
- * Is used to represent get, get-next, set, response SNMP V3 scoped PDUs.
- *
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- * @since 1.5
- */
-public class SnmpScopedPduRequest extends SnmpScopedPduPacket
- implements SnmpPduRequestType {
- private static final long serialVersionUID = 6463060973056773680L;
-
- int errorStatus=0 ;
-
- int errorIndex=0 ;
-
- /**
- * Error index setter. Remember that SNMP indices start from 1.
- * Thus the corresponding SnmpVarBind is
- * varBindList[errorIndex-1].
- * @param i Error index.
- */
- public void setErrorIndex(int i) {
- errorIndex = i;
- }
- /**
- * Error status setter. Statuses are defined in
- * {@link com.sun.jmx.snmp.SnmpDefinitions SnmpDefinitions}.
- * @param s Error status.
- */
- public void setErrorStatus(int s) {
- errorStatus = s;
- }
-
- /**
- * Error index getter. Remember that SNMP indices start from 1.
- * Thus the corresponding SnmpVarBind is
- * varBindList[errorIndex-1].
- * @return Error index.
- */
- public int getErrorIndex() { return errorIndex; }
- /**
- * Error status getter. Statuses are defined in
- * {@link com.sun.jmx.snmp.SnmpDefinitions SnmpDefinitions}.
- * @return Error status.
- */
- public int getErrorStatus() { return errorStatus; }
-
- /**
- * Generates the pdu to use for response.
- * @return Response pdu.
- */
- public SnmpPdu getResponsePdu() {
- SnmpScopedPduRequest result = new SnmpScopedPduRequest();
- result.address = address ;
- result.port = port ;
- result.version = version ;
- result.requestId = requestId;
- result.msgId = msgId;
- result.msgMaxSize = msgMaxSize;
- result.msgFlags = msgFlags;
- result.msgSecurityModel = msgSecurityModel;
- result.contextEngineId = contextEngineId;
- result.contextName = contextName;
- result.securityParameters = securityParameters;
- result.type = pduGetResponsePdu ;
- result.errorStatus = SnmpDefinitions.snmpRspNoError ;
- result.errorIndex = 0 ;
- return result;
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpSecurityException.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpSecurityException.java
deleted file mode 100644
index 22dfbadd92b..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpSecurityException.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.jmx.snmp;
-
-/**
- * This exception is thrown when an error occurs in an SnmpSecurityModel .
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- * @since 1.5
- */
-public class SnmpSecurityException extends Exception {
- private static final long serialVersionUID = 5574448147432833480L;
-
- /**
- * The current request varbind list.
- */
- public SnmpVarBind[] list = null;
- /**
- * The status of the exception. See {@link com.sun.jmx.snmp.SnmpDefinitions} for possible values.
- */
- public int status = SnmpDefinitions.snmpReqUnknownError;
- /**
- * The current security model related security parameters.
- */
- public SnmpSecurityParameters params = null;
- /**
- * The current context engine Id.
- */
- public byte[] contextEngineId = null;
- /**
- * The current context name.
- */
- public byte[] contextName = null;
- /**
- * The current flags.
- */
- public byte flags = (byte) SnmpDefinitions.noAuthNoPriv;
- /**
- * Constructor.
- * @param msg The exception msg to display.
- */
- public SnmpSecurityException(String msg) {
- super(msg);
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpSecurityParameters.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpSecurityParameters.java
deleted file mode 100644
index dfc1af9fbbc..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpSecurityParameters.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.jmx.snmp;
-import com.sun.jmx.snmp.SnmpStatusException;
-import com.sun.jmx.snmp.SnmpTooBigException;
-
-/**
- * Security parameters are security model dependent. Every security parameters class wishing to be passed to a security model must implement this marker interface.
- * This interface has to be implemented when developing customized security models.
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- * @since 1.5
- */
-public interface SnmpSecurityParameters {
- /**
- * BER encoding of security parameters.
- * @param outputBytes Array to fill.
- * @return Encoded parameters length.
- */
- int encode(byte[] outputBytes) throws SnmpTooBigException;
- /**
- * BER decoding of security parameters.
- * @param params Encoded parameters.
- */
- void decode(byte[] params) throws SnmpStatusException;
-
- /**
- * Principal coded inside the security parameters.
- * @return The security principal.
- */
- String getPrincipal();
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpStatusException.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpStatusException.java
deleted file mode 100644
index 3f079c79355..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpStatusException.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package com.sun.jmx.snmp;
-
-
-
-/**
- * Reports an error which occurred during a get/set operation on a mib node.
- *
- * This exception includes a status error code as defined in the SNMP protocol.
- *
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- */
-
-public class SnmpStatusException extends Exception implements SnmpDefinitions {
- private static final long serialVersionUID = 5809485694133115675L;
-
- /**
- * Error code as defined in RFC 1448 for: noSuchName.
- */
- public static final int noSuchName = 2 ;
-
- /**
- * Error code as defined in RFC 1448 for: badValue.
- */
- public static final int badValue = 3 ;
-
- /**
- * Error code as defined in RFC 1448 for: readOnly.
- */
- public static final int readOnly = 4 ;
-
-
- /**
- * Error code as defined in RFC 1448 for: noAccess.
- */
- public static final int noAccess = 6 ;
-
- /**
- * Error code for reporting a no such instance error.
- */
- public static final int noSuchInstance = 0xE0;
-
- /**
- * Error code for reporting a no such object error.
- */
- public static final int noSuchObject = 0xE1;
-
- /**
- * Constructs a new SnmpStatusException with the specified status error.
- * @param status The error status.
- */
- public SnmpStatusException(int status) {
- errorStatus = status ;
- }
-
- /**
- * Constructs a new SnmpStatusException with the specified status error and status index.
- * @param status The error status.
- * @param index The error index.
- */
- public SnmpStatusException(int status, int index) {
- errorStatus = status ;
- errorIndex = index ;
- }
-
- /**
- * Constructs a new SnmpStatusException with an error message.
- * The error status is set to 0 (noError) and the index to -1.
- * @param s The error message.
- */
- public SnmpStatusException(String s) {
- super(s);
- }
-
- /**
- * Constructs a new SnmpStatusException with an error index.
- * @param x The original SnmpStatusException.
- * @param index The error index.
- */
- public SnmpStatusException(SnmpStatusException x, int index) {
- super(x.getMessage());
- errorStatus= x.errorStatus;
- errorIndex= index;
- }
-
- /**
- * Return the error status.
- * @return The error status.
- */
- public int getStatus() {
- return errorStatus ;
- }
-
- /**
- * Returns the index of the error.
- * A value of -1 means that the index is not known/applicable.
- * @return The error index.
- */
- public int getErrorIndex() {
- return errorIndex;
- }
-
-
- // PRIVATE VARIABLES
- //--------------------
-
- /**
- * Status of the error.
- * @serial
- */
- private int errorStatus = 0 ;
-
- /**
- * Index of the error.
- * If different from -1, indicates the index where the error occurs.
- * @serial
- */
- private int errorIndex= -1;
-
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpString.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpString.java
deleted file mode 100644
index 675386ab1be..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpString.java
+++ /dev/null
@@ -1,278 +0,0 @@
-/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package com.sun.jmx.snmp;
-
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-
-/**
- * Represents an SNMP string.
- *
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- */
-
-public class SnmpString extends SnmpValue {
- private static final long serialVersionUID = -7011986973225194188L;
-
- // CONSTRUCTORS
- //-------------
- /**
- * Constructs a new empty SnmpString.
- */
- public SnmpString() {
- value = new byte[0] ;
- }
-
- /**
- * Constructs a new SnmpString from the specified bytes array.
- * @param v The bytes composing the string value.
- */
- public SnmpString(byte[] v) {
- value = v.clone() ;
- }
-
- /**
- * Constructs a new SnmpString from the specified Bytes array.
- * @param v The Bytes composing the string value.
- */
- public SnmpString(Byte[] v) {
- value = new byte[v.length] ;
- for (int i = 0 ; i < v.length ; i++) {
- value[i] = v[i].byteValue() ;
- }
- }
-
- /**
- * Constructs a new SnmpString from the specified String value.
- * @param v The initialization value.
- */
- public SnmpString(String v) {
- value = v.getBytes() ;
- }
-
- /**
- * Constructs a new SnmpString from the specified InetAddress .
- * @param address The InetAddress .
- *
- * @since 1.5
- */
- public SnmpString(InetAddress address) {
- value = address.getAddress();
- }
-
- // PUBLIC METHODS
- //---------------
-
- /**
- * Converts the string value to its InetAddress form.
- * @return an {@link InetAddress} defined by the string value.
- * @exception UnknownHostException If string value is not a legal address format.
- *
- * @since 1.5
- */
- public InetAddress inetAddressValue() throws UnknownHostException {
- return InetAddress.getByAddress(value);
- }
-
- /**
- * Converts the specified binary string into a character string.
- * @param bin The binary string value to convert.
- * @return The character string representation.
- */
- public static String BinToChar(String bin) {
- char value[] = new char[bin.length()/8];
- int binLength = value.length;
- for (int i = 0; i < binLength; i++)
- value[i] = (char)Integer.parseInt(bin.substring(8*i, 8*i+8), 2);
- return new String(value);
- }
-
- /**
- * Converts the specified hexadecimal string into a character string.
- * @param hex The hexadecimal string value to convert.
- * @return The character string representation.
- */
- public static String HexToChar(String hex) {
- char value[] = new char[hex.length()/2];
- int hexLength = value.length;
- for (int i = 0; i < hexLength; i++)
- value[i] = (char)Integer.parseInt(hex.substring(2*i, 2*i+2), 16);
- return new String(value);
- }
-
- /**
- * Returns the bytes array of this SnmpString.
- * @return The value.
- */
- public byte[] byteValue() {
- return value.clone() ;
- }
-
- /**
- * Converts the string value to its array of Bytes form.
- * @return The array of Bytes representation of the value.
- */
- public Byte[] toByte() {
- Byte[] result = new Byte[value.length] ;
- for (int i = 0 ; i < value.length ; i++) {
- result[i] = value[i];
- }
- return result ;
- }
-
- /**
- * Converts the string value to its String form.
- * @return The String representation of the value.
- */
- public String toString() {
- return new String(value) ;
- }
-
- /**
- * Converts the string value to its SnmpOid form.
- * @return The OID representation of the value.
- */
- public SnmpOid toOid() {
- long[] ids = new long[value.length] ;
- for (int i = 0 ; i < value.length ; i++) {
- ids[i] = (long)(value[i] & 0xFF) ;
- }
- return new SnmpOid(ids) ;
- }
-
- /**
- * Extracts the string from an index OID and returns its
- * value converted as an SnmpOid.
- * @param index The index array.
- * @param start The position in the index array.
- * @return The OID representing the string value.
- * @exception SnmpStatusException There is no string value
- * available at the start position.
- */
- public static SnmpOid toOid(long[] index, int start) throws SnmpStatusException {
- try {
- if (index[start] > Integer.MAX_VALUE) {
- throw new SnmpStatusException(SnmpStatusException.noSuchName) ;
- }
- int strLen = (int)index[start++] ;
- long[] ids = new long[strLen] ;
- for (int i = 0 ; i < strLen ; i++) {
- ids[i] = index[start + i] ;
- }
- return new SnmpOid(ids) ;
- }
- catch(IndexOutOfBoundsException e) {
- throw new SnmpStatusException(SnmpStatusException.noSuchName) ;
- }
- }
-
- /**
- * Scans an index OID, skips the string value and returns the position
- * of the next value.
- * @param index The index array.
- * @param start The position in the index array.
- * @return The position of the next value.
- * @exception SnmpStatusException There is no string value
- * available at the start position.
- */
- public static int nextOid(long[] index, int start) throws SnmpStatusException {
- try {
- if (index[start] > Integer.MAX_VALUE) {
- throw new SnmpStatusException(SnmpStatusException.noSuchName) ;
- }
- int strLen = (int)index[start++] ;
- start += strLen ;
- if (start <= index.length) {
- return start ;
- }
- else {
- throw new SnmpStatusException(SnmpStatusException.noSuchName) ;
- }
- }
- catch(IndexOutOfBoundsException e) {
- throw new SnmpStatusException(SnmpStatusException.noSuchName) ;
- }
- }
-
- /**
- * Appends an SnmpOid representing an SnmpString to another OID.
- * @param source An OID representing an SnmpString value.
- * @param dest Where source should be appended.
- */
- public static void appendToOid(SnmpOid source, SnmpOid dest) {
- dest.append(source.getLength()) ;
- dest.append(source) ;
- }
-
- /**
- * Performs a clone action. This provides a workaround for the
- * SnmpValue interface.
- * @return The SnmpValue clone.
- */
- final synchronized public SnmpValue duplicate() {
- return (SnmpValue) clone() ;
- }
-
- /**
- * Clones the SnmpString object, making a copy of its data.
- * @return The object clone.
- */
- synchronized public Object clone() {
- SnmpString newclone = null ;
-
- try {
- newclone = (SnmpString) super.clone() ;
- newclone.value = new byte[value.length] ;
- System.arraycopy(value, 0, newclone.value, 0, value.length) ;
- } catch (CloneNotSupportedException e) {
- throw new InternalError(e) ; // vm bug.
- }
- return newclone ;
- }
-
- /**
- * Returns a textual description of the type object.
- * @return ASN.1 textual description.
- */
- public String getTypeName() {
- return name ;
- }
-
- // VARIABLES
- //----------
- /**
- * Name of the type.
- */
- final static String name = "String" ;
-
- /**
- * This is the bytes array of the string value.
- * @serial
- */
- protected byte[] value = null ;
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpStringFixed.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpStringFixed.java
deleted file mode 100644
index cd34df9f4cc..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpStringFixed.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package com.sun.jmx.snmp;
-
-
-
-// java imports
-//
-import java.lang.Math;
-
-/**
- * Represents an SNMP String defined with a fixed length.
- * The class is mainly used when dealing with table indexes for which one of the keys
- * is defined as a String.
- *
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- */
-
-public class SnmpStringFixed extends SnmpString {
- private static final long serialVersionUID = -9120939046874646063L;
-
- // CONSTRUCTORS
- //-------------
- /**
- * Constructs a new SnmpStringFixed from the specified bytes array.
- * @param v The bytes composing the fixed-string value.
- */
- public SnmpStringFixed(byte[] v) {
- super(v) ;
- }
-
- /**
- * Constructs a new SnmpStringFixed with the specified Bytes array.
- * @param v The Bytes composing the fixed-string value.
- */
- public SnmpStringFixed(Byte[] v) {
- super(v) ;
- }
-
- /**
- * Constructs a new SnmpStringFixed from the specified String value.
- * @param v The initialization value.
- */
- public SnmpStringFixed(String v) {
- super(v) ;
- }
-
- /**
- * Constructs a new SnmpStringFixed from the specified bytes array
- * with the specified length.
- * @param l The length of the fixed-string.
- * @param v The bytes composing the fixed-string value.
- * @exception IllegalArgumentException Either the length or the byte array is not valid.
- */
- public SnmpStringFixed(int l, byte[] v) throws IllegalArgumentException {
- if ((l <= 0) || (v == null)) {
- throw new IllegalArgumentException() ;
- }
- int length = Math.min(l, v.length);
- value = new byte[l] ;
- for (int i = 0 ; i < length ; i++) {
- value[i] = v[i] ;
- }
- for (int i = length ; i < l ; i++) {
- value[i] = 0 ;
- }
- }
-
- /**
- * Constructs a new SnmpStringFixed from the specified Bytes array
- * with the specified length.
- * @param l The length of the fixed-string.
- * @param v The Bytes composing the fixed-string value.
- * @exception IllegalArgumentException Either the length or the Byte array is not valid.
- */
- public SnmpStringFixed(int l, Byte[] v) throws IllegalArgumentException {
- if ((l <= 0) || (v == null)) {
- throw new IllegalArgumentException() ;
- }
- int length = Math.min(l, v.length);
- value = new byte[l] ;
- for (int i = 0 ; i < length ; i++) {
- value[i] = v[i].byteValue() ;
- }
- for (int i = length ; i < l ; i++) {
- value[i] = 0 ;
- }
- }
-
- /**
- * Constructs a new SnmpStringFixed from the specified String
- * with the specified length.
- * @param l The length of the fixed-string.
- * @param s The String composing the fixed-string value.
- * @exception IllegalArgumentException Either the length or the String is not valid.
- */
- public SnmpStringFixed(int l, String s) throws IllegalArgumentException {
- if ((l <= 0) || (s == null)) {
- throw new IllegalArgumentException() ;
- }
- byte[] v = s.getBytes();
- int length = Math.min(l, v.length);
- value = new byte[l] ;
- for (int i = 0 ; i < length ; i++) {
- value[i] = v[i] ;
- }
- for (int i = length ; i < l ; i++) {
- value[i] = 0 ;
- }
- }
-
- // PUBLIC METHODS
- //---------------
- /**
- * Extracts the fixed-string from an index OID and returns its
- * value converted as an SnmpOid.
- * @param l The number of successive array elements to be retreived
- * in order to construct the OID.
- * These elements are retreived starting at the start position.
- * @param index The index array.
- * @param start The position in the index array.
- * @return The OID representing the fixed-string value.
- * @exception SnmpStatusException There is no string value
- * available at the start position.
- */
- public static SnmpOid toOid(int l, long[] index, int start) throws SnmpStatusException {
- try {
- long[] ids = new long[l] ;
- for (int i = 0 ; i < l ; i++) {
- ids[i] = index[start + i] ;
- }
- return new SnmpOid(ids) ;
- }
- catch(IndexOutOfBoundsException e) {
- throw new SnmpStatusException(SnmpStatusException.noSuchName) ;
- }
- }
-
- /**
- * Scans an index OID, skip the string value and returns the position
- * of the next value.
- * @param l The number of successive array elements to be passed
- * in order to get the position of the next value.
- * These elements are passed starting at the start position.
- * @param index The index array.
- * @param start The position in the index array.
- * @return The position of the next value.
- * @exception SnmpStatusException There is no string value
- * available at the start position.
- */
- public static int nextOid(int l, long[] index, int start) throws SnmpStatusException {
- int result = start + l ;
- if (result > index.length) {
- throw new SnmpStatusException(SnmpStatusException.noSuchName) ;
- }
- return result ;
- }
-
- /**
- * Appends an SnmpOid representing an SnmpStringFixed to another OID.
- * @param l Unused.
- * @param source An OID representing an SnmpStringFixed value.
- * @param dest Where source should be appended.
- */
- public static void appendToOid(int l, SnmpOid source, SnmpOid dest) {
- dest.append(source) ;
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpTooBigException.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpTooBigException.java
deleted file mode 100644
index a89bbad5b9d..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpTooBigException.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package com.sun.jmx.snmp;
-
-
-/**
- * Is used internally to signal that the size of a PDU exceeds the packet size limitation.
- *
- * You will not usually need to use this class, except if you
- * decide to implement your own
- * {@link com.sun.jmx.snmp.SnmpPduFactory SnmPduFactory} object.
- *
- * The varBindCount property contains the
- * number of SnmpVarBind successfully encoded
- * before the exception was thrown. Its value is 0
- * when this number is unknown.
- *
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- */
-
-public class SnmpTooBigException extends Exception {
- private static final long serialVersionUID = 4754796246674803969L;
-
- /**
- * Builds an SnmpTooBigException with
- * varBindCount set to 0.
- */
- public SnmpTooBigException() {
- varBindCount = 0 ;
- }
-
- /**
- * Builds an SnmpTooBigException with
- * varBindCount set to the specified value.
- * @param n The varBindCount value.
- */
- public SnmpTooBigException(int n) {
- varBindCount = n ;
- }
-
-
- /**
- * Returns the number of SnmpVarBind successfully
- * encoded before the exception was thrown.
- *
- * @return A positive integer (0 means the number is unknown).
- */
- public int getVarBindCount() {
- return varBindCount ;
- }
-
- /**
- * The varBindCount.
- * @serial
- */
- private int varBindCount ;
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpUnknownAccContrModelException.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpUnknownAccContrModelException.java
deleted file mode 100644
index c7b455bbf1f..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpUnknownAccContrModelException.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.jmx.snmp;
-
-import com.sun.jmx.snmp.SnmpUnknownModelException;
-
-/**
- * This exception is thrown when an
- * SnmpAccessControlSubSystem doesn't know the passed ID.
- *
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- * @since 1.5
- */
-public class SnmpUnknownAccContrModelException extends SnmpUnknownModelException {
- private static final long serialVersionUID = -8831186713954487538L;
-
- /**
- * Constructor.
- * @param msg The exception msg to display.
- */
- public SnmpUnknownAccContrModelException(String msg) {
- super(msg);
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpUnknownModelException.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpUnknownModelException.java
deleted file mode 100644
index 7d9feb03ac4..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpUnknownModelException.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.jmx.snmp;
-/**
- * This exception is thrown when a needed model is not present in the engine.
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- * @since 1.5
- */
-public class SnmpUnknownModelException extends Exception {
- private static final long serialVersionUID = -8667664269418048003L;
-
- /**
- * Constructor.
- * @param msg The exception msg to display.
- */
- public SnmpUnknownModelException(String msg) {
- super(msg);
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpUnknownModelLcdException.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpUnknownModelLcdException.java
deleted file mode 100644
index 8e96eaff825..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpUnknownModelLcdException.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.jmx.snmp;
-/**
- * This exception is thrown when an SnmpLcd has no ModelLcd associated to the model.
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- * @since 1.5
- */
-public class SnmpUnknownModelLcdException extends Exception {
- private static final long serialVersionUID = 6369064741633646317L;
-
- /**
- * Constructor.
- * @param msg The exception msg to display.
- */
- public SnmpUnknownModelLcdException(String msg) {
- super(msg);
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpUnknownMsgProcModelException.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpUnknownMsgProcModelException.java
deleted file mode 100644
index 7d83f8b9d5f..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpUnknownMsgProcModelException.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.jmx.snmp;
-
-import com.sun.jmx.snmp.SnmpUnknownModelException;
-
-/**
- * This exception is thrown when an SnmpMsgProcessingSubSystem doesn't know the passed ID.
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- * @since 1.5
- */
-public class SnmpUnknownMsgProcModelException extends SnmpUnknownModelException {
- private static final long serialVersionUID = -4179907244861284771L;
-
- /**
- * Constructor.
- * @param msg The exception msg to display.
- */
- public SnmpUnknownMsgProcModelException(String msg) {
- super(msg);
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpUnknownSecModelException.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpUnknownSecModelException.java
deleted file mode 100644
index a13d050edd9..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpUnknownSecModelException.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.jmx.snmp;
-
-import com.sun.jmx.snmp.SnmpUnknownModelException;
-
-/**
- * This exception is thrown when an SnmpSecuritySubSystem doesn't know the passed ID.
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- * @since 1.5
- */
-public class SnmpUnknownSecModelException extends SnmpUnknownModelException {
- private static final long serialVersionUID = -2173491650805292799L;
-
- /**
- * Constructor.
- * @param msg The exception msg to display.
- */
- public SnmpUnknownSecModelException(String msg) {
- super(msg);
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpUnknownSubSystemException.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpUnknownSubSystemException.java
deleted file mode 100644
index 73cdeaf1084..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpUnknownSubSystemException.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.jmx.snmp;
-/**
- * This exception is thrown when the handled SnmpSubSystem is unknown.
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- * @since 1.5
- */
-public class SnmpUnknownSubSystemException extends Exception {
- private static final long serialVersionUID = 4463202140045245052L;
-
- /**
- * Constructor.
- * @param msg The exception msg to display.
- */
- public SnmpUnknownSubSystemException(String msg) {
- super(msg);
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpUnsignedInt.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpUnsignedInt.java
deleted file mode 100644
index 58002102823..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpUnsignedInt.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package com.sun.jmx.snmp;
-
-
-
-/**
- * Is the base for all SNMP syntaxes based on unsigned integers.
- *
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- */
-@SuppressWarnings("serial") // JDK implementation class
-public abstract class SnmpUnsignedInt extends SnmpInt {
-
- /**
- * The largest value of the type unsigned int (2^32 - 1).
- */
- public static final long MAX_VALUE = 0x0ffffffffL;
-
- // CONSTRUCTORS
- //-------------
- /**
- * Constructs a new SnmpUnsignedInt from the specified integer value.
- * @param v The initialization value.
- * @exception IllegalArgumentException The specified value is negative
- * or larger than {@link #MAX_VALUE SnmpUnsignedInt.MAX_VALUE}.
- */
- public SnmpUnsignedInt(int v) throws IllegalArgumentException {
- super(v);
- }
-
- /**
- * Constructs a new SnmpUnsignedInt from the specified Integer value.
- * @param v The initialization value.
- * @exception IllegalArgumentException The specified value is negative
- * or larger than {@link #MAX_VALUE SnmpUnsignedInt.MAX_VALUE}.
- */
- public SnmpUnsignedInt(Integer v) throws IllegalArgumentException {
- super(v);
- }
-
- /**
- * Constructs a new SnmpUnsignedInt from the specified long value.
- * @param v The initialization value.
- * @exception IllegalArgumentException The specified value is negative
- * or larger than {@link #MAX_VALUE SnmpUnsignedInt.MAX_VALUE}.
- */
- public SnmpUnsignedInt(long v) throws IllegalArgumentException {
- super(v);
- }
-
- /**
- * Constructs a new SnmpUnsignedInt from the specified Long value.
- * @param v The initialization value.
- * @exception IllegalArgumentException The specified value is negative
- * or larger than {@link #MAX_VALUE SnmpUnsignedInt.MAX_VALUE}.
- */
- public SnmpUnsignedInt(Long v) throws IllegalArgumentException {
- super(v);
- }
-
- // PUBLIC METHODS
- //---------------
- /**
- * Returns a textual description of the type object.
- * @return ASN.1 textual description.
- */
- public String getTypeName() {
- return name ;
- }
-
- /**
- * This method has been defined to allow the sub-classes
- * of SnmpInt to perform their own control at intialization time.
- */
- boolean isInitValueValid(int v) {
- if ((v < 0) || (v > SnmpUnsignedInt.MAX_VALUE)) {
- return false;
- }
- return true;
- }
-
- /**
- * This method has been defined to allow the sub-classes
- * of SnmpInt to perform their own control at intialization time.
- */
- boolean isInitValueValid(long v) {
- if ((v < 0) || (v > SnmpUnsignedInt.MAX_VALUE)) {
- return false;
- }
- return true;
- }
-
- // VARIABLES
- //----------
- /**
- * Name of the type.
- */
- final static String name = "Unsigned32" ;
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpUsmKeyHandler.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpUsmKeyHandler.java
deleted file mode 100644
index 0e78f351b0c..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpUsmKeyHandler.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.jmx.snmp;
-
-/**
- * This interface allows you to compute key localization and delta generation. It is useful when adding user in USM MIB. An instance of SnmpUsmKeyHandler is associated to each SnmpEngine object.
- * When computing key, an authentication algorithm is needed. The supported ones are : usmHMACMD5AuthProtocol and usmHMACSHAAuthProtocol.
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- * @since 1.5
- */
-public interface SnmpUsmKeyHandler {
-
- /**
- * DES privacy algorithm key size. To be used when localizing privacy key
- */
- public static int DES_KEY_SIZE = 16;
-
- /**
- * DES privacy algorithm delta size. To be used when calculing privacy key delta.
- */
- public static int DES_DELTA_SIZE = 16;
-
- /**
- * Translate a password to a key. It MUST be compliant to RFC 2574 description.
- * @param algoName The authentication algorithm to use.
- * @param password Password to convert.
- * @return The key.
- * @exception IllegalArgumentException If the algorithm is unknown.
- */
- public byte[] password_to_key(String algoName, String password) throws IllegalArgumentException;
- /**
- * Localize the passed key using the passed SnmpEngineId. It MUST be compliant to RFC 2574 description.
- * @param algoName The authentication algorithm to use.
- * @param key The key to localize;
- * @param engineId The Id used to localize the key.
- * @return The localized key.
- * @exception IllegalArgumentException If the algorithm is unknown.
- */
- public byte[] localizeAuthKey(String algoName, byte[] key, SnmpEngineId engineId) throws IllegalArgumentException;
-
- /**
- * Localize the passed privacy key using the passed SnmpEngineId. It MUST be compliant to RFC 2574 description.
- * @param algoName The authentication algorithm to use.
- * @param key The key to localize;
- * @param engineId The Id used to localize the key.
- * @param keysize The privacy algorithm key size.
- * @return The localized key.
- * @exception IllegalArgumentException If the algorithm is unknown.
- */
- public byte[] localizePrivKey(String algoName, byte[] key, SnmpEngineId engineId,int keysize) throws IllegalArgumentException;
-
- /**
- * Calculate the delta parameter needed when processing key change. This computation is done by the key change initiator. It MUST be compliant to RFC 2574 description.
- * @param algoName The authentication algorithm to use.
- * @param oldKey The old key.
- * @param newKey The new key.
- * @param random The random value.
- * @return The delta.
- * @exception IllegalArgumentException If the algorithm is unknown.
- */
- public byte[] calculateAuthDelta(String algoName, byte[] oldKey, byte[] newKey, byte[] random) throws IllegalArgumentException;
-
- /**
- * Calculate the delta parameter needed when processing key change for a privacy algorithm. This computation is done by the key change initiator. It MUST be compliant to RFC 2574 description.
- * @param algoName The authentication algorithm to use.
- * @param oldKey The old key.
- * @param newKey The new key.
- * @param random The random value.
- * @param deltaSize The algo delta size.
- * @return The delta.
- * @exception IllegalArgumentException If the algorithm is unknown.
- */
- public byte[] calculatePrivDelta(String algoName, byte[] oldKey, byte[] newKey, byte[] random, int deltaSize) throws IllegalArgumentException;
-
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpV3Message.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpV3Message.java
deleted file mode 100644
index 64288f14c61..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpV3Message.java
+++ /dev/null
@@ -1,511 +0,0 @@
-/*
- * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.jmx.snmp;
-
-// java imports
-//
-import java.util.Vector;
-import java.util.logging.Level;
-import java.net.InetAddress;
-
-// import debug stuff
-//
-import static com.sun.jmx.defaults.JmxProperties.SNMP_LOGGER;
-import com.sun.jmx.snmp.internal.SnmpMsgProcessingSubSystem;
-import com.sun.jmx.snmp.internal.SnmpSecurityModel;
-import com.sun.jmx.snmp.internal.SnmpDecryptedPdu;
-import com.sun.jmx.snmp.internal.SnmpSecurityCache;
-
-import com.sun.jmx.snmp.SnmpMsg;
-import com.sun.jmx.snmp.SnmpPdu;
-import com.sun.jmx.snmp.SnmpStatusException;
-import com.sun.jmx.snmp.SnmpTooBigException;
-import com.sun.jmx.snmp.SnmpScopedPduBulk;
-import com.sun.jmx.snmp.BerException;
-import com.sun.jmx.snmp.SnmpScopedPduRequest;
-import com.sun.jmx.snmp.BerDecoder;
-import com.sun.jmx.snmp.SnmpDefinitions;
-import com.sun.jmx.snmp.SnmpEngineId;
-import com.sun.jmx.snmp.SnmpScopedPduPacket;
-import com.sun.jmx.snmp.BerEncoder;
-import com.sun.jmx.snmp.SnmpPduRequestType;
-import com.sun.jmx.snmp.SnmpPduBulkType;
-
-/**
- * Is a partially decoded representation of an SNMP V3 packet.
- *
- * This class can be used when developing customized manager or agent.
- *
- * The SnmpV3Message class is directly mapped onto the
- * message syntax defined in RFC 2572.
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- * @since 1.5
- */
-public class SnmpV3Message extends SnmpMsg {
-
- /**
- * Message identifier.
- */
- public int msgId = 0;
-
- /**
- * Message max size the pdu sender can deal with.
- */
- public int msgMaxSize = 0;
- /**
- * Message flags. Reportable flag and security level.
- *
- * -- .... ...1 authFlag
- * -- .... ..1. privFlag
- * -- .... .1.. reportableFlag
- * -- Please observe:
- * -- .... ..00 is OK, means noAuthNoPriv
- * -- .... ..01 is OK, means authNoPriv
- * -- .... ..10 reserved, must NOT be used.
- * -- .... ..11 is OK, means authPriv
- *
- */
- public byte msgFlags = 0;
- /**
- * The security model the security sub system MUST use in order to deal with this pdu (eg: User based Security Model Id = 3).
- */
- public int msgSecurityModel = 0;
- /**
- * The unmarshalled security parameters.
- */
- public byte[] msgSecurityParameters = null;
- /**
- * The context engine Id in which the pdu must be handled (Generaly the local engine Id).
- */
- public byte[] contextEngineId = null;
- /**
- * The context name in which the OID has to be interpreted.
- */
- public byte[] contextName = null;
- /** The encrypted form of the scoped pdu (Only relevant when dealing with privacy).
- */
- public byte[] encryptedPdu = null;
-
- /**
- * Constructor.
- *
- */
- public SnmpV3Message() {
- }
- /**
- * Encodes this message and puts the result in the specified byte array.
- * For internal use only.
- *
- * @param outputBytes An array to receive the resulting encoding.
- *
- * @exception ArrayIndexOutOfBoundsException If the result does not fit
- * into the specified array.
- */
- public int encodeMessage(byte[] outputBytes)
- throws SnmpTooBigException {
- int encodingLength = 0;
- if (SNMP_LOGGER.isLoggable(Level.FINER)) {
- SNMP_LOGGER.logp(Level.FINER, SnmpV3Message.class.getName(),
- "encodeMessage",
- "Can't encode directly V3Message! Need a SecuritySubSystem");
- }
- throw new IllegalArgumentException("Can't encode");
- }
-
- /**
- * Decodes the specified bytes and initializes this message.
- * For internal use only.
- *
- * @param inputBytes The bytes to be decoded.
- *
- * @exception SnmpStatusException If the specified bytes are not a valid encoding.
- */
- public void decodeMessage(byte[] inputBytes, int byteCount)
- throws SnmpStatusException {
-
- try {
- BerDecoder bdec = new BerDecoder(inputBytes);
- bdec.openSequence();
- version = bdec.fetchInteger();
- bdec.openSequence();
- msgId = bdec.fetchInteger();
- msgMaxSize = bdec.fetchInteger();
- msgFlags = bdec.fetchOctetString()[0];
- msgSecurityModel =bdec.fetchInteger();
- bdec.closeSequence();
- msgSecurityParameters = bdec.fetchOctetString();
- if( (msgFlags & SnmpDefinitions.privMask) == 0 ) {
- bdec.openSequence();
- contextEngineId = bdec.fetchOctetString();
- contextName = bdec.fetchOctetString();
- data = bdec.fetchAny();
- dataLength = data.length;
- bdec.closeSequence();
- }
- else {
- encryptedPdu = bdec.fetchOctetString();
- }
- bdec.closeSequence() ;
- }
- catch(BerException x) {
- x.printStackTrace();
- throw new SnmpStatusException("Invalid encoding") ;
- }
-
- if (SNMP_LOGGER.isLoggable(Level.FINER)) {
- final StringBuilder strb = new StringBuilder()
- .append("Unmarshalled message : \n")
- .append("version : ").append(version)
- .append("\n")
- .append("msgId : ").append(msgId)
- .append("\n")
- .append("msgMaxSize : ").append(msgMaxSize)
- .append("\n")
- .append("msgFlags : ").append(msgFlags)
- .append("\n")
- .append("msgSecurityModel : ").append(msgSecurityModel)
- .append("\n")
- .append("contextEngineId : ").append(contextEngineId == null ? null :
- SnmpEngineId.createEngineId(contextEngineId))
- .append("\n")
- .append("contextName : ").append(contextName)
- .append("\n")
- .append("data : ").append(data)
- .append("\n")
- .append("dat len : ").append((data == null) ? 0 : data.length)
- .append("\n")
- .append("encryptedPdu : ").append(encryptedPdu)
- .append("\n");
- SNMP_LOGGER.logp(Level.FINER, SnmpV3Message.class.getName(),
- "decodeMessage", strb.toString());
- }
- }
-
- /**
- * Returns the associated request Id.
- * @param data The flat message.
- * @return The request Id.
- */
- public int getRequestId(byte[] data) throws SnmpStatusException {
- BerDecoder bdec = null;
- int msgId = 0;
- try {
- bdec = new BerDecoder(data);
- bdec.openSequence();
- bdec.fetchInteger();
- bdec.openSequence();
- msgId = bdec.fetchInteger();
- }catch(BerException x) {
- throw new SnmpStatusException("Invalid encoding") ;
- }
- try {
- bdec.closeSequence();
- }
- catch(BerException x) {
- }
-
- return msgId;
- }
-
- /**
- * Initializes this message with the specified pdu.
- *
- * This method initializes the data field with an array of
- * maxDataLength bytes. It encodes the pdu.
- * The resulting encoding is stored in the data field
- * and the length of the encoding is stored in dataLength.
- *
- * If the encoding length exceeds maxDataLength,
- * the method throws an exception.
- *
- * @param p The PDU to be encoded.
- * @param maxDataLength The maximum length permitted for the data field.
- *
- * @exception SnmpStatusException If the specified pdu
- * is not valid.
- * @exception SnmpTooBigException If the resulting encoding does not fit
- * into maxDataLength bytes.
- * @exception ArrayIndexOutOfBoundsException If the encoding exceeds
- * maxDataLength.
- */
- public void encodeSnmpPdu(SnmpPdu p,
- int maxDataLength)
- throws SnmpStatusException, SnmpTooBigException {
-
- SnmpScopedPduPacket pdu = (SnmpScopedPduPacket) p;
-
- if (SNMP_LOGGER.isLoggable(Level.FINER)) {
- final StringBuilder strb = new StringBuilder()
- .append("PDU to marshall: \n")
- .append("security parameters : ").append(pdu.securityParameters)
- .append("\n")
- .append("type : ").append(pdu.type)
- .append("\n")
- .append("version : ").append(pdu.version)
- .append("\n")
- .append("requestId : ").append(pdu.requestId)
- .append("\n")
- .append("msgId : ").append(pdu.msgId)
- .append("\n")
- .append("msgMaxSize : ").append(pdu.msgMaxSize)
- .append("\n")
- .append("msgFlags : ").append(pdu.msgFlags)
- .append("\n")
- .append("msgSecurityModel : ").append(pdu.msgSecurityModel)
- .append("\n")
- .append("contextEngineId : ").append(pdu.contextEngineId)
- .append("\n")
- .append("contextName : ").append(pdu.contextName)
- .append("\n");
- SNMP_LOGGER.logp(Level.FINER, SnmpV3Message.class.getName(),
- "encodeSnmpPdu", strb.toString());
- }
-
- version = pdu.version;
- address = pdu.address;
- port = pdu.port;
- msgId = pdu.msgId;
- msgMaxSize = pdu.msgMaxSize;
- msgFlags = pdu.msgFlags;
- msgSecurityModel = pdu.msgSecurityModel;
-
- contextEngineId = pdu.contextEngineId;
- contextName = pdu.contextName;
-
- securityParameters = pdu.securityParameters;
-
- //
- // Allocate the array to receive the encoding.
- //
- data = new byte[maxDataLength];
-
- //
- // Encode the pdu
- // Reminder: BerEncoder does backward encoding !
- //
-
- try {
- BerEncoder benc = new BerEncoder(data) ;
- benc.openSequence() ;
- encodeVarBindList(benc, pdu.varBindList) ;
-
- switch(pdu.type) {
-
- case pduGetRequestPdu :
- case pduGetNextRequestPdu :
- case pduInformRequestPdu :
- case pduGetResponsePdu :
- case pduSetRequestPdu :
- case pduV2TrapPdu :
- case pduReportPdu :
- SnmpPduRequestType reqPdu = (SnmpPduRequestType) pdu;
- benc.putInteger(reqPdu.getErrorIndex());
- benc.putInteger(reqPdu.getErrorStatus());
- benc.putInteger(pdu.requestId);
- break;
-
- case pduGetBulkRequestPdu :
- SnmpPduBulkType bulkPdu = (SnmpPduBulkType) pdu;
- benc.putInteger(bulkPdu.getMaxRepetitions());
- benc.putInteger(bulkPdu.getNonRepeaters());
- benc.putInteger(pdu.requestId);
- break ;
-
- default:
- throw new SnmpStatusException("Invalid pdu type " + String.valueOf(pdu.type)) ;
- }
- benc.closeSequence(pdu.type) ;
- dataLength = benc.trim() ;
- }
- catch(ArrayIndexOutOfBoundsException x) {
- throw new SnmpTooBigException() ;
- }
- }
-
-
- /**
- * Gets the PDU encoded in this message.
- *
- * This method decodes the data field and returns the resulting PDU.
- *
- * @return The resulting PDU.
- * @exception SnmpStatusException If the encoding is not valid.
- */
-
- public SnmpPdu decodeSnmpPdu()
- throws SnmpStatusException {
-
- SnmpScopedPduPacket pdu = null;
-
- BerDecoder bdec = new BerDecoder(data) ;
- try {
- int type = bdec.getTag() ;
- bdec.openSequence(type) ;
- switch(type) {
-
- case pduGetRequestPdu :
- case pduGetNextRequestPdu :
- case pduInformRequestPdu :
- case pduGetResponsePdu :
- case pduSetRequestPdu :
- case pduV2TrapPdu :
- case pduReportPdu :
- SnmpScopedPduRequest reqPdu = new SnmpScopedPduRequest() ;
- reqPdu.requestId = bdec.fetchInteger() ;
- reqPdu.setErrorStatus(bdec.fetchInteger());
- reqPdu.setErrorIndex(bdec.fetchInteger());
- pdu = reqPdu ;
- break ;
-
- case pduGetBulkRequestPdu :
- SnmpScopedPduBulk bulkPdu = new SnmpScopedPduBulk() ;
- bulkPdu.requestId = bdec.fetchInteger() ;
- bulkPdu.setNonRepeaters(bdec.fetchInteger());
- bulkPdu.setMaxRepetitions(bdec.fetchInteger());
- pdu = bulkPdu ;
- break ;
- default:
- throw new SnmpStatusException(snmpRspWrongEncoding) ;
- }
- pdu.type = type;
- pdu.varBindList = decodeVarBindList(bdec);
- bdec.closeSequence() ;
- } catch(BerException e) {
- if (SNMP_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_LOGGER.logp(Level.FINEST, SnmpV3Message.class.getName(),
- "decodeSnmpPdu", "BerException", e);
- }
- throw new SnmpStatusException(snmpRspWrongEncoding);
- }
-
- //
- // The easy work.
- //
- pdu.address = address;
- pdu.port = port;
- pdu.msgFlags = msgFlags;
- pdu.version = version;
- pdu.msgId = msgId;
- pdu.msgMaxSize = msgMaxSize;
- pdu.msgSecurityModel = msgSecurityModel;
- pdu.contextEngineId = contextEngineId;
- pdu.contextName = contextName;
-
- pdu.securityParameters = securityParameters;
-
- if (SNMP_LOGGER.isLoggable(Level.FINER)) {
- final StringBuilder strb = new StringBuilder()
- .append("Unmarshalled PDU : \n")
- .append("type : ").append(pdu.type)
- .append("\n")
- .append("version : ").append(pdu.version)
- .append("\n")
- .append("requestId : ").append(pdu.requestId)
- .append("\n")
- .append("msgId : ").append(pdu.msgId)
- .append("\n")
- .append("msgMaxSize : ").append(pdu.msgMaxSize)
- .append("\n")
- .append("msgFlags : ").append(pdu.msgFlags)
- .append("\n")
- .append("msgSecurityModel : ").append(pdu.msgSecurityModel)
- .append("\n")
- .append("contextEngineId : ").append(pdu.contextEngineId)
- .append("\n")
- .append("contextName : ").append(pdu.contextName)
- .append("\n");
- SNMP_LOGGER.logp(Level.FINER, SnmpV3Message.class.getName(),
- "decodeSnmpPdu", strb.toString());
- }
- return pdu ;
- }
-
- /**
- * Dumps this message in a string.
- *
- * @return The string containing the dump.
- */
- public String printMessage() {
- StringBuilder sb = new StringBuilder();
- sb.append("msgId : " + msgId + "\n");
- sb.append("msgMaxSize : " + msgMaxSize + "\n");
- sb.append("msgFlags : " + msgFlags + "\n");
- sb.append("msgSecurityModel : " + msgSecurityModel + "\n");
-
- if (contextEngineId == null) {
- sb.append("contextEngineId : null");
- }
- else {
- sb.append("contextEngineId : {\n");
- sb.append(dumpHexBuffer(contextEngineId,
- 0,
- contextEngineId.length));
- sb.append("\n}\n");
- }
-
- if (contextName == null) {
- sb.append("contextName : null");
- }
- else {
- sb.append("contextName : {\n");
- sb.append(dumpHexBuffer(contextName,
- 0,
- contextName.length));
- sb.append("\n}\n");
- }
- return sb.append(super.printMessage()).toString();
- }
-
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpValue.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpValue.java
deleted file mode 100644
index 93745190800..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/SnmpValue.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package com.sun.jmx.snmp;
-
-
-
-import java.io.Serializable;
-
-/**
- * Is an abstract representation of an SNMP Value.
- * All classes provided for dealing with SNMP types should derive from this
- * class.
- *
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- */
-@SuppressWarnings("serial") // JDK implementation class
-public abstract class SnmpValue implements Cloneable, Serializable, SnmpDataTypeEnums {
-
- /**
- * Returns a String form containing ASN.1 tagging information.
- * @return The String form.
- */
- public String toAsn1String() {
- return "[" + getTypeName() + "] " + toString();
- }
-
- /**
- * Returns the value encoded as an OID.
- * The method is particularly useful when dealing with indexed table made of
- * several SNMP variables.
- * @return The value encoded as an OID.
- */
- public abstract SnmpOid toOid() ;
-
- /**
- * Returns a textual description of the object.
- * @return ASN.1 textual description.
- */
- public abstract String getTypeName() ;
-
- /**
- * Same as clone, but you cannot perform cloning using this object because
- * clone is protected. This method should call clone().
- * @return The SnmpValue clone.
- */
- public abstract SnmpValue duplicate() ;
-
- /**
- * This method returns false by default and is redefined
- * in the {@link com.sun.jmx.snmp.SnmpNull} class.
- */
- public boolean isNoSuchObjectValue() {
- return false;
- }
-
- /**
- * This method returns false by default and is redefined
- * in the {@link com.sun.jmx.snmp.SnmpNull} class.
- */
- public boolean isNoSuchInstanceValue() {
- return false;
- }
-
- /**
- * This method returns false by default and is redefined
- * in the {@link com.sun.jmx.snmp.SnmpNull} class.
- */
- public boolean isEndOfMibViewValue() {
- return false;
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/ThreadContext.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/ThreadContext.java
deleted file mode 100644
index a6f35e09cf7..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/ThreadContext.java
+++ /dev/null
@@ -1,326 +0,0 @@
-/*
- * Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package com.sun.jmx.snmp;
-
-import java.util.Stack;
-import java.util.EmptyStackException;
-
-/**
- *
Warning: The interface of this class is subject to change.
- * Use at your own risk.
- *
- *
This class associates a context with each thread that
- * references it. The context is a set of mappings between Strings
- * and Objects. It is managed as a stack, typically with code like
- * this:
The try...finally block ensures that
- * the restore is done even if
- * doSomeOperation terminates abnormally (with an
- * exception).
- *
- *
A thread can consult its own context using
- * ThreadContext.get(myKey). The result is the
- * value that was most recently pushed with the given key.
- *
- *
A thread cannot read or modify the context of another thread.
- *
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- */
-public class ThreadContext implements Cloneable {
-
- /* The context of a thread is stored as a linked list. At the
- head of the list is the value returned by localContext.get().
- At the tail of the list is a sentinel ThreadContext value with
- "previous" and "key" both null. There is a different sentinel
- object for each thread.
-
- Because a null key indicates the sentinel, we reject attempts to
- push context entries with a null key.
-
- The reason for using a sentinel rather than just terminating
- the list with a null reference is to protect against incorrect
- or even malicious code. If you have a reference to the
- sentinel value, you can erase the context stack. Only the
- caller of the first "push" that put something on the stack can
- get such a reference, so if that caller does not give this
- reference away, no one else can erase the stack.
-
- If the restore method took a null reference to mean an empty
- stack, anyone could erase the stack, since anyone can make a
- null reference.
-
- When the stack is empty, we discard the sentinel object and
- have localContext.get() return null. Then we recreate the
- sentinel object on the first subsequent push.
-
- ThreadContext objects are immutable. As a consequence, you can
- give a ThreadContext object to setInitialContext that is no
- longer current. But the interface says this can be rejected,
- in case we remove immutability later. */
-
- /* We have to comment out "final" here because of a bug in the JDK1.1
- compiler. Uncomment it when we discard 1.1 compatibility. */
- private /*final*/ ThreadContext previous;
- private /*final*/ String key;
- private /*final*/ Object value;
-
- private ThreadContext(ThreadContext previous, String key, Object value) {
- this.previous = previous;
- this.key = key;
- this.value = value;
- }
-
- /**
- *
Get the Object that was most recently pushed with the given key.
- *
- * @param key the key of interest.
- *
- * @return the last Object that was pushed (using
- * push) with that key and not subsequently canceled
- * by a restore; or null if there is no such object.
- * A null return value may also indicate that the last Object
- * pushed was the value null. Use the
- * contains method to distinguish this case from the
- * case where there is no Object.
- *
- * @exception IllegalArgumentException if key is null.
- */
- public static Object get(String key) throws IllegalArgumentException {
- ThreadContext context = contextContaining(key);
- if (context == null)
- return null;
- else
- return context.value;
- }
-
- /**
- *
Check whether a value with the given key exists in the stack.
- * This means that the push method was called with
- * this key and it was not cancelled by a subsequent
- * restore. This method is useful when the
- * get method returns null, to distinguish between
- * the case where the key exists in the stack but is associated
- * with a null value, and the case where the key does not exist in
- * the stack.
- *
- * @return true if the key exists in the stack.
- *
- * @exception IllegalArgumentException if key is null.
- */
- public static boolean contains(String key)
- throws IllegalArgumentException {
- return (contextContaining(key) != null);
- }
-
- /**
- *
Find the ThreadContext in the stack that contains the given key,
- * or return null if there is none.
- *
- * @exception IllegalArgumentException if key is null.
- */
- private static ThreadContext contextContaining(String key)
- throws IllegalArgumentException {
- if (key == null)
- throw new IllegalArgumentException("null key");
- for (ThreadContext context = getContext();
- context != null;
- context = context.previous) {
- if (key.equals(context.key))
- return context;
- /* Note that "context.key" may be null if "context" is the
- sentinel, so don't write "if (context.key.equals(key))"! */
- }
- return null;
- }
-
-// /**
-// * Change the value that was most recently associated with the given key
-// * in a push operation not cancelled by a subsequent
-// * restore. If there is no such association, nothing happens
-// * and the return value is null.
-// *
-// * @param key the key of interest.
-// * @param value the new value to associate with that key.
-// *
-// * @return the value that was previously associated with the key, or null
-// * if the key does not exist in the stack.
-// *
-// * @exception IllegalArgumentException if key is null.
-// */
-// public static Object set(String key, Object value)
-// throws IllegalArgumentException {
-// ThreadContext context = contextContaining(key);
-// if (context == null)
-// return null;
-// Object old = context.value;
-// context.value = value;
-// return old;
-// }
-
- /**
- *
Push an object on the context stack with the given key.
- * This operation can subsequently be undone by calling
- * restore with the ThreadContext value returned
- * here.
- *
- * @param key the key that will be used to find the object while it is
- * on the stack.
- * @param value the value to be associated with that key. It may be null.
- *
- * @return a ThreadContext that can be given to restore to
- * restore the stack to its state before the push.
- *
- * @exception IllegalArgumentException if key is null.
- */
- public static ThreadContext push(String key, Object value)
- throws IllegalArgumentException {
- if (key == null)
- throw new IllegalArgumentException("null key");
-
- ThreadContext oldContext = getContext();
- if (oldContext == null)
- oldContext = new ThreadContext(null, null, null); // make sentinel
- ThreadContext newContext = new ThreadContext(oldContext, key, value);
- setContext(newContext);
- return oldContext;
- }
-
- /**
- *
Return an object that can later be supplied to restore
- * to restore the context stack to its current state. The object can
- * also be given to setInitialContext.
- *
- * @return a ThreadContext that represents the current context stack.
- */
- public static ThreadContext getThreadContext() {
- return getContext();
- }
-
- /**
- *
Restore the context stack to an earlier state. This typically
- * undoes the effect of one or more push calls.
- *
- * @param oldContext the state to return. This is usually the return
- * value of an earlier push operation.
- *
- * @exception NullPointerException if oldContext is null.
- * @exception IllegalArgumentException if oldContext
- * does not represent a context from this thread, or if that
- * context was undone by an earlier restore.
- */
- public static void restore(ThreadContext oldContext)
- throws NullPointerException, IllegalArgumentException {
- /* The following test is not strictly necessary in the code as it
- stands today, since the reference to "oldContext.key" would
- generate a NullPointerException anyway. But if someone
- didn't notice that during subsequent changes, they could
- accidentally permit restore(null) with the semantics of
- trashing the context stack. */
- if (oldContext == null)
- throw new NullPointerException();
-
- /* Check that the restored context is in the stack. */
- for (ThreadContext context = getContext();
- context != oldContext;
- context = context.previous) {
- if (context == null) {
- throw new IllegalArgumentException("Restored context is not " +
- "contained in current " +
- "context");
- }
- }
-
- /* Discard the sentinel if the stack is empty. This means that it
- is an error to call "restore" a second time with the
- ThreadContext value that means an empty stack. That's why we
- don't say that it is all right to restore the stack to the
- state it was already in. */
- if (oldContext.key == null)
- oldContext = null;
-
- setContext(oldContext);
- }
-
- /**
- *
Set the initial context of the calling thread to a context obtained
- * from another thread. After this call, the calling thread will see
- * the same results from the get method as the thread
- * from which the context argument was obtained, at the
- * time it was obtained.
- *
- *
The context argument must be the result of an earlier
- * push or getThreadContext call. It is an
- * error (which may or may not be detected) if this context has been
- * undone by a restore.
- *
- *
The context stack of the calling thread must be empty before this
- * call, i.e., there must not have been a push not undone
- * by a subsequent restore.
- *
- * @exception IllegalArgumentException if the context stack was
- * not empty before the call. An implementation may also throw this
- * exception if context is no longer current in the
- * thread from which it was obtained.
- */
- /* We rely on the fact that ThreadContext objects are immutable.
- This means that we don't have to check that the "context"
- argument is valid. It necessarily represents the head of a
- valid chain of ThreadContext objects, even if the thread from
- which it was obtained has subsequently been set to a point
- later in that chain using "restore". */
- public void setInitialContext(ThreadContext context)
- throws IllegalArgumentException {
- /* The following test assumes that we discard sentinels when the
- stack is empty. */
- if (getContext() != null)
- throw new IllegalArgumentException("previous context not empty");
- setContext(context);
- }
-
- private static ThreadContext getContext() {
- return localContext.get();
- }
-
- private static void setContext(ThreadContext context) {
- localContext.set(context);
- }
-
- private static ThreadLocal localContext =
- new ThreadLocal();
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/UserAcl.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/UserAcl.java
deleted file mode 100644
index 7e916d767d9..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/UserAcl.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.jmx.snmp;
-
-
-// java import
-//
-import java.util.Enumeration;
-import java.net.InetAddress;
-
-/**
- * Defines the user based ACL used by the SNMP protocol adaptor.
- *
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- * @since 1.5
- */
-
-public interface UserAcl {
-
- /**
- * Returns the name of the ACL.
- *
- * @return The name of the ACL.
- */
- public String getName();
-
- /**
- * Checks whether or not the specified user has READ access.
- *
- * @param user The user name to check.
- *
- * @return true if the host has read permission, false otherwise.
- */
- public boolean checkReadPermission(String user);
-
- /**
- * Checks whether or not the specified user and context name have READ access.
- *
- * @param user The user name to check.
- * @param contextName The context name associated with the user.
- * @param securityLevel The request security level.
- * @return true if the pair (user, context) has read permission, false otherwise.
- */
- public boolean checkReadPermission(String user, String contextName, int securityLevel);
-
- /**
- * Checks whether or not a context name is defined.
- *
- * @param contextName The context name to check.
- *
- * @return true if the context is known, false otherwise.
- */
- public boolean checkContextName(String contextName);
-
- /**
- * Checks whether or not the specified user has WRITE access.
- *
- * @param user The user to check.
- *
- * @return true if the user has write permission, false otherwise.
- */
- public boolean checkWritePermission(String user);
-
- /**
- * Checks whether or not the specified user and context name have WRITE access.
- *
- * @param user The user name to check.
- * @param contextName The context name associated with the user.
- * @param securityLevel The request security level.
- * @return true if the pair (user, context) has write permission, false otherwise.
- */
- public boolean checkWritePermission(String user, String contextName, int securityLevel);
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/AcmChecker.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/AcmChecker.java
deleted file mode 100644
index 5f8e51cbbaf..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/AcmChecker.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.jmx.snmp.agent;
-
-import java.io.Serializable;
-import java.util.Enumeration;
-import java.util.logging.Level;
-import java.util.Vector;
-
-import javax.management.ObjectName;
-import javax.management.MBeanServer;
-import javax.management.MalformedObjectNameException;
-import javax.management.InstanceAlreadyExistsException;
-import javax.management.MBeanRegistrationException;
-import javax.management.NotCompliantMBeanException;
-
-import static com.sun.jmx.defaults.JmxProperties.SNMP_ADAPTOR_LOGGER;
-import com.sun.jmx.snmp.SnmpOid;
-import com.sun.jmx.snmp.SnmpVarBind;
-import com.sun.jmx.snmp.SnmpDefinitions;
-import com.sun.jmx.snmp.SnmpStatusException;
-import com.sun.jmx.snmp.SnmpEngine;
-import com.sun.jmx.snmp.SnmpUnknownModelException;
-import com.sun.jmx.snmp.internal.SnmpAccessControlModel;
-import com.sun.jmx.snmp.internal.SnmpEngineImpl;
-
-/**
- * Oid Checker makes use of ACM to check each OID during the getnext process.
- */
-class AcmChecker {
-
-
- SnmpAccessControlModel model = null;
- String principal = null;
- int securityLevel = -1;
- int version = -1;
- int pduType = -1;
- int securityModel = -1;
- byte[] contextName = null;
- SnmpEngineImpl engine = null;
- LongList l = null;
- AcmChecker(SnmpMibRequest req) {
- engine = (SnmpEngineImpl) req.getEngine();
- //We are in V3 architecture, ACM is in the picture.
- if(engine != null) {
- if(engine.isCheckOidActivated()) {
- try {
- if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_ADAPTOR_LOGGER.logp(Level.FINEST,
- SnmpMib.class.getName(),
- "AcmChecker(SnmpMibRequest)",
- "SNMP V3 Access Control to be done");
- }
- model = (SnmpAccessControlModel)
- engine.getAccessControlSubSystem().
- getModel(SnmpDefinitions.snmpVersionThree);
- principal = req.getPrincipal();
- securityLevel = req.getSecurityLevel();
- pduType = req.getPdu().type;
- version = req.getRequestPduVersion();
- securityModel = req.getSecurityModel();
- contextName = req.getAccessContextName();
- l = new LongList();
- if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) {
- final StringBuilder strb = new StringBuilder()
- .append("Will check oid for : principal : ")
- .append(principal)
- .append("; securityLevel : ").append(securityLevel)
- .append("; pduType : ").append(pduType)
- .append("; version : ").append(version)
- .append("; securityModel : ").append(securityModel)
- .append("; contextName : ").append(contextName);
- SNMP_ADAPTOR_LOGGER.logp(Level.FINEST,
- SnmpMib.class.getName(),
- "AcmChecker(SnmpMibRequest)", strb.toString());
- }
-
- }catch(SnmpUnknownModelException e) {
- if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_ADAPTOR_LOGGER.logp(Level.FINEST,
- SnmpMib.class.getName(),
- "AcmChecker(SnmpMibRequest)",
- "Unknown Model, no ACM check.");
- }
- }
- }
- }
- }
-
- void add(int index, long arc) {
- if(model != null)
- l.add(index, arc);
- }
-
- void remove(int index) {
- if(model != null)
- l.remove(index);
- }
-
- void add(final int at,final long[] src, final int from,
- final int count) {
- if(model != null)
- l.add(at,src,from,count);
- }
-
- void remove(final int from, final int count) {
- if(model != null)
- l.remove(from,count);
- }
-
- void checkCurrentOid() throws SnmpStatusException {
- if(model != null) {
- SnmpOid oid = new SnmpOid(l.toArray());
- if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, SnmpMib.class.getName(),
- "checkCurrentOid", "Checking access for : " + oid);
- }
- model.checkAccess(version,
- principal,
- securityLevel,
- pduType,
- securityModel,
- contextName,
- oid);
- }
- }
-
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/LongList.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/LongList.java
deleted file mode 100644
index 249049c8836..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/LongList.java
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.jmx.snmp.agent;
-
-import java.io.Serializable;
-import java.util.Enumeration;
-import java.util.logging.Level;
-import java.util.Vector;
-
-import javax.management.ObjectName;
-import javax.management.MBeanServer;
-import javax.management.MalformedObjectNameException;
-import javax.management.InstanceAlreadyExistsException;
-import javax.management.MBeanRegistrationException;
-import javax.management.NotCompliantMBeanException;
-
-import static com.sun.jmx.defaults.JmxProperties.SNMP_ADAPTOR_LOGGER;
-import com.sun.jmx.snmp.SnmpOid;
-import com.sun.jmx.snmp.SnmpVarBind;
-import com.sun.jmx.snmp.SnmpDefinitions;
-import com.sun.jmx.snmp.SnmpStatusException;
-import com.sun.jmx.snmp.SnmpEngine;
-import com.sun.jmx.snmp.SnmpUnknownModelException;
-import com.sun.jmx.snmp.internal.SnmpAccessControlModel;
-import com.sun.jmx.snmp.internal.SnmpEngineImpl;
-
-/**
- * This list is used in order to construct the OID during the getnext.
- * The constructed oid is checked by the checker AcmChecker.
- */
-final class LongList {
-
- public static int DEFAULT_CAPACITY = 10;
-
- public static int DEFAULT_INCREMENT = 10;
-
-
- private final int DELTA;
- private int size;
-
- /**
- * The list content. Any access to this variable must be protected
- * by a synchronized block on the LongList object.
- * Only read-only action should be performed on this object.
- **/
- public long[] list;
-
- LongList() {
- this(DEFAULT_CAPACITY,DEFAULT_INCREMENT);
- }
-
- LongList(int initialCapacity) {
- this(initialCapacity,DEFAULT_INCREMENT);
- }
-
- LongList(int initialCapacity, int delta) {
- size = 0;
- DELTA = delta;
- list = allocate(initialCapacity);
- }
-
- /**
- * Same behaviour than size() in {@link java.util.List}.
- **/
- public final int size() { return size;}
-
- /**
- * Same behaviour than add(long o) in {@link java.util.List}.
- * Any access to this method should be protected in a synchronized
- * block on the LongList object.
- **/
- public final boolean add(final long o) {
- if (size >= list.length)
- resize();
- list[size++]=o;
- return true;
- }
-
- /**
- * Same behaviour than add(int index, long o) in
- * {@link java.util.List}.
- * Any access to this method should be protected in a synchronized
- * block on the LongList object.
- **/
- public final void add(final int index, final long o) {
- if (index > size) throw new IndexOutOfBoundsException();
- if (index >= list.length) resize();
- if (index == size) {
- list[size++]=o;
- return;
- }
-
- java.lang.System.arraycopy(list,index,list,index+1,size-index);
- list[index]=o;
- size++;
- }
-
- /**
- * Adds count elements to the list.
- * @param at index at which the elements must be inserted. The
- * first element will be inserted at this index.
- * @param src An array containing the elements we want to insert.
- * @param from Index of the first element from src that
- * must be inserted.
- * @param count number of elements to insert.
- * Any access to this method should be protected in a synchronized
- * block on the LongList object.
- **/
- public final void add(final int at,final long[] src, final int from,
- final int count) {
- if (count <= 0) return;
- if (at > size) throw new IndexOutOfBoundsException();
- ensure(size+count);
- if (at < size) {
- java.lang.System.arraycopy(list,at,list,at+count,size-at);
- }
- java.lang.System.arraycopy(src,from,list,at,count);
- size+=count;
- }
-
- /**
- * Any access to this method should be protected in a synchronized
- * block on the LongList object.
- **/
- public final long remove(final int from, final int count) {
- if (count < 1 || from < 0) return -1;
- if (from+count > size) return -1;
-
- final long o = list[from];
- final int oldsize = size;
- size = size - count;
-
- if (from == size) return o;
-
- java.lang.System.arraycopy(list,from+count,list,from,
- size-from);
- return o;
- }
-
- /**
- * Same behaviour than remove(int index) in {@link java.util.List}.
- * Any access to this method should be protected in a synchronized
- * block on the LongList object.
- **/
- public final long remove(final int index) {
- if (index >= size) return -1;
- final long o = list[index];
- list[index]=0;
- if (index == --size) return o;
-
- java.lang.System.arraycopy(list,index+1,list,index,
- size-index);
- return o;
- }
-
- /**
- * Same behaviour than the toArray(long[] a) method in
- * {@link java.util.List}.
- * Any access to this method should be protected in a synchronized
- * block on the LongList object.
- **/
- public final long[] toArray(long[] a) {
- java.lang.System.arraycopy(list,0,a,0,size);
- return a;
- }
-
- /**
- * Same behaviour than the toArray() method in
- * {@link java.util.List}.
- * Any access to this method should be protected in a synchronized
- * block on the LongList object.
- **/
- public final long[] toArray() {
- return toArray(new long[size]);
- }
-
- /**
- * Resize the list. Increase its capacity by DELTA elements.
- * Any call to this method must be protected by a synchronized
- * block on this LongList.
- **/
- private final void resize() {
- final long[] newlist = allocate(list.length + DELTA);
- java.lang.System.arraycopy(list,0,newlist,0,size);
- list = newlist;
- }
-
- /**
- * Resize the list. Insure that the new length will be at
- * least equal to length.
- * @param length new minimal length requested.
- * Any call to this method must be protected by a synchronized
- * block on this LongList.
- **/
- private final void ensure(int length) {
- if (list.length < length) {
- final int min = list.length+DELTA;
- length=(lengthSnmpOid from the specified
- * component array, starting at given position.
- *
- * @param oid The original OID array
- * @param start The position at which to begin.
- *
- **/
- public SnmpEntryOid(long[] oid, int start) {
- final int subLength = oid.length - start;
- final long[] subOid = new long[subLength];
- java.lang.System.arraycopy(oid, start, subOid, 0, subLength) ;
- components = subOid;
- componentCount = subLength;
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/SnmpErrorHandlerAgent.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/SnmpErrorHandlerAgent.java
deleted file mode 100644
index 63bab379467..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/SnmpErrorHandlerAgent.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.jmx.snmp.agent;
-
-import java.io.Serializable;
-import java.util.Enumeration;
-import java.util.logging.Level;
-
-import javax.management.ObjectName;
-import javax.management.MBeanServer;
-
-import static com.sun.jmx.defaults.JmxProperties.SNMP_ADAPTOR_LOGGER;
-import com.sun.jmx.snmp.SnmpStatusException;
-import com.sun.jmx.snmp.SnmpDefinitions;
-import com.sun.jmx.snmp.SnmpVarBind;
-
-/**
- * A simple MIB agent that implements SNMP calls (get, set, getnext and getbulk) in a way that only errors or exceptions are returned. Every call done on this agent fails. Error handling is done according to the manager's SNMP protocol version.
- *
It is used by SnmpAdaptorServer for its default agent behavior. When a received Oid doesn't match, this agent is called to fill the result list with errors.
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- * @since 1.5
- *
- */
-
-public class SnmpErrorHandlerAgent extends SnmpMibAgent
- implements Serializable {
- private static final long serialVersionUID = 7751082923508885650L;
-
- public SnmpErrorHandlerAgent() {}
-
- /**
- * Initializes the MIB (with no registration of the MBeans into the
- * MBean server). Does nothing.
- *
- * @exception IllegalAccessException The MIB cannot be initialized.
- */
-
- @Override
- public void init() throws IllegalAccessException {
- }
-
- /**
- * Initializes the MIB but each single MBean representing the MIB
- * is inserted into the MBean server.
- *
- * @param server The MBean server to register the service with.
- * @param name The object name.
- *
- * @return The passed name parameter.
- *
- * @exception java.lang.Exception
- */
-
- @Override
- public ObjectName preRegister(MBeanServer server, ObjectName name)
- throws Exception {
- return name;
- }
-
- /**
- * Gets the root object identifier of the MIB.
- *
The root object identifier is the object identifier uniquely
- * identifying the MIB.
- *
- * @return The returned oid is null.
- */
-
- @Override
- public long[] getRootOid() {
- return null;
- }
-
- /**
- * Processes a get operation. It will throw an exception for V1 requests or it will set exceptions within the list for V2 requests.
- *
- * @param inRequest The SnmpMibRequest object holding the list of variable to be retrieved.
- *
- * @exception SnmpStatusException An error occurred during the operation.
- */
-
- @Override
- public void get(SnmpMibRequest inRequest) throws SnmpStatusException {
-
- SNMP_ADAPTOR_LOGGER.logp(Level.FINEST,
- SnmpErrorHandlerAgent.class.getName(),
- "get", "Get in Exception");
-
- if(inRequest.getVersion() == SnmpDefinitions.snmpVersionOne)
- throw new SnmpStatusException(SnmpStatusException.noSuchName);
-
- Enumeration l = inRequest.getElements();
- while(l.hasMoreElements()) {
- SnmpVarBind varbind = l.nextElement();
- varbind.setNoSuchObject();
- }
- }
-
- /**
- * Checks if a set operation can be performed.
- * If the operation can not be performed, the method should emit a
- * SnmpStatusException.
- *
- * @param inRequest The SnmpMibRequest object holding the list of variables to
- * be set. This list is composed of
- * SnmpVarBind objects.
- *
- * @exception SnmpStatusException The set operation
- * cannot be performed.
- */
-
- @Override
- public void check(SnmpMibRequest inRequest) throws SnmpStatusException {
-
- SNMP_ADAPTOR_LOGGER.logp(Level.FINEST,
- SnmpErrorHandlerAgent.class.getName(),
- "check", "Check in Exception");
-
- throw new SnmpStatusException(SnmpDefinitions.snmpRspNotWritable);
- }
-
- /**
- * Processes a set operation. Should never be called (check previously called having failed).
- *
- * @param inRequest The SnmpMibRequest object holding the list of variable to be set.
- *
- * @exception SnmpStatusException An error occurred during the operation.
- */
-
- @Override
- public void set(SnmpMibRequest inRequest) throws SnmpStatusException {
-
- SNMP_ADAPTOR_LOGGER.logp(Level.FINEST,
- SnmpErrorHandlerAgent.class.getName(),
- "set", "Set in Exception, CANNOT be called");
-
- throw new SnmpStatusException(SnmpDefinitions.snmpRspNotWritable);
- }
-
- /**
- * Processes a getNext operation. It will throw an exception for V1 requests or it will set exceptions within the list for V2 requests..
- *
- * @param inRequest The SnmpMibRequest object holding the list of variables to be retrieved.
- *
- * @exception SnmpStatusException An error occurred during the operation.
- */
-
- @Override
- public void getNext(SnmpMibRequest inRequest) throws SnmpStatusException {
-
- SNMP_ADAPTOR_LOGGER.logp(Level.FINEST,
- SnmpErrorHandlerAgent.class.getName(),
- "getNext", "GetNext in Exception");
-
- if(inRequest.getVersion() == SnmpDefinitions.snmpVersionOne)
- throw new SnmpStatusException(SnmpStatusException.noSuchName);
-
- Enumeration l = inRequest.getElements();
- while(l.hasMoreElements()) {
- SnmpVarBind varbind = l.nextElement();
- varbind.setEndOfMibView();
- }
- }
-
- /**
- * Processes a getBulk operation. It will throw an exception if the request is a V1 one or it will set exceptions within the list for V2 ones.
- *
- * @param inRequest The SnmpMibRequest object holding the list of variable to be retrieved.
- *
- * @exception SnmpStatusException An error occurred during the operation.
- */
-
- @Override
- public void getBulk(SnmpMibRequest inRequest, int nonRepeat, int maxRepeat)
- throws SnmpStatusException {
-
- SNMP_ADAPTOR_LOGGER.logp(Level.FINEST,
- SnmpErrorHandlerAgent.class.getName(),
- "getBulk", "GetBulk in Exception");
-
- if(inRequest.getVersion() == SnmpDefinitions.snmpVersionOne)
- throw new SnmpStatusException(SnmpDefinitions.snmpRspGenErr, 0);
-
- Enumeration l = inRequest.getElements();
- while(l.hasMoreElements()) {
- SnmpVarBind varbind = l.nextElement();
- varbind.setEndOfMibView();
- }
- }
-
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/SnmpGenericMetaServer.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/SnmpGenericMetaServer.java
deleted file mode 100644
index cf24c929266..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/SnmpGenericMetaServer.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.jmx.snmp.agent;
-
-// jmx imports
-//
-import com.sun.jmx.snmp.SnmpValue;
-import com.sun.jmx.snmp.SnmpStatusException;
-
-/**
- *
- * This interface defines the methods that must be implemented by an
- * SNMP metadata object that needs to interact with an
- * {@link com.sun.jmx.snmp.agent.SnmpGenericObjectServer} object.
- *
- *
- *
- * All these methods are usually generated by mibgen when
- * run in generic-metadata mode.
- *
- *
- *
- * This interface is used internally between the generated Metadata and
- * the SNMP runtime and you shouldn't need to worry about it, because
- * you will never have to use it directly.
- *
- *
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- **/
-public interface SnmpGenericMetaServer {
-
- /**
- * Construct an attribute value (as returned by Attribute::getValue())
- * from an SnmpValue. The returned attribute value can be used to
- * construct an Attribute object.
- *
- * @param id The OID arc identifying the variable for which the
- * value is constructed.
- * @param value The SnmpValue from which the Attribute::value will be
- * constructed.
- * @return The attribute value built from the given value.
- * @exception SnmpStatusException if the attribute value cannot be built
- * from the given SnmpValue value.
- *
- */
- Object buildAttributeValue(long id, SnmpValue value)
- throws SnmpStatusException;
-
- /**
- * Construct an SnmpValue from an Attribute value as returned by
- * Attribute::getValue().
- *
- * @param id The OID arc identifying the variable for which the
- * value is constructed.
- * @param value The attribute value as returned by Attribute::getValue().
- *
- * @return The SnmpValue built from the given value.
- * @exception SnmpStatusException if the SnmpValue cannot be built from
- * the given value.
- **/
- SnmpValue buildSnmpValue(long id, Object value)
- throws SnmpStatusException;
-
- /**
- * Return the name of the attribute corresponding to the
- * SNMP variable identified by the given id.
- *
- * @param id The OID arc identifying the variable.
- *
- * @return The name of the variable identified by the given
- * id.
- *
- * @exception SnmpStatusException if the given id does not
- * correspond to a known variable.
- */
- String getAttributeName(long id)
- throws SnmpStatusException;
-
- /**
- * Check the access rights for a SET operation.
- *
- * @param x The new requested value.
- * @param id The OID arc identifying the variable for which the SET is
- * requested.
- * @param data A contextual object containing user-data.
- * This object is allocated through the
- * {@link com.sun.jmx.snmp.agent.SnmpUserDataFactory}
- * for each incoming SNMP request.
- * @exception SnmpStatusException if the SET operation must be rejected.
- */
- void checkSetAccess(SnmpValue x, long id, Object data)
- throws SnmpStatusException;
-
- /**
- * Check the access rights for a GET operation.
- *
- * @param id The OID arc identifying the variable for which the SET is
- * requested.
- * @param data A contextual object containing user-data.
- * This object is allocated through the
- * {@link com.sun.jmx.snmp.agent.SnmpUserDataFactory}
- * for each incoming SNMP request.
- * @exception SnmpStatusException if the SET operation must be rejected.
- */
- void checkGetAccess(long id, Object data)
- throws SnmpStatusException;
-
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/SnmpGenericObjectServer.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/SnmpGenericObjectServer.java
deleted file mode 100644
index df2a2fef471..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/SnmpGenericObjectServer.java
+++ /dev/null
@@ -1,572 +0,0 @@
-/*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.jmx.snmp.agent;
-
-
-// java imports
-//
-import java.util.Enumeration;
-import java.util.Iterator;
-
-// jmx imports
-//
-import javax.management.AttributeList;
-import javax.management.Attribute;
-import javax.management.MBeanException;
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-import javax.management.ReflectionException;
-import javax.management.InstanceNotFoundException;
-import javax.management.InvalidAttributeValueException;
-import javax.management.InstanceAlreadyExistsException;
-import javax.management.MBeanRegistrationException;
-import javax.management.NotCompliantMBeanException;
-import javax.management.RuntimeOperationsException;
-import com.sun.jmx.snmp.SnmpOid;
-import com.sun.jmx.snmp.SnmpValue;
-import com.sun.jmx.snmp.SnmpVarBind;
-import com.sun.jmx.snmp.SnmpStatusException;
-
-
-/**
- *
- * This class is a utility class that transforms SNMP GET / SET requests
- * into standard JMX getAttributes() setAttributes() requests.
- *
- *
- *
- * The transformation relies on the metadata information provided by the
- * {@link com.sun.jmx.snmp.agent.SnmpGenericMetaServer} object which is
- * passed as the first parameter to every method. This SnmpGenericMetaServer
- * object is usually a Metadata object generated by mibgen.
- *
- *
- *
- * This class is used internally by mibgen generated metadata objects and
- * you should never need to use it directly.
- *
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- **/
-
-public class SnmpGenericObjectServer {
-
- // ----------------------------------------------------------------------
- //
- // Protected variables
- //
- // ----------------------------------------------------------------------
-
- /**
- * The MBean server through which the MBeans will be accessed.
- **/
- protected final MBeanServer server;
-
- // ----------------------------------------------------------------------
- //
- // Constructors
- //
- // ----------------------------------------------------------------------
-
- /**
- * Builds a new SnmpGenericObjectServer. Usually there will be a single
- * object of this type per MIB.
- *
- * @param server The MBeanServer in which the MBean accessed by this
- * MIB are registered.
- **/
- public SnmpGenericObjectServer(MBeanServer server) {
- this.server = server;
- }
-
- /**
- * Execute an SNMP GET request.
- *
- *
- * This method first builds the list of attributes that need to be
- * retrieved from the MBean and then calls getAttributes() on the
- * MBean server. Then it updates the SnmpMibSubRequest with the values
- * retrieved from the MBean.
- *
- *
- *
- * The SNMP metadata information is obtained through the given
- * meta object, which usually is an instance of a
- * mibgen generated class.
- *
- *
- *
- * This method is called internally by mibgen generated
- * objects and you should never need to call it directly.
- *
- *
- * @param meta The metadata object impacted by the subrequest
- * @param name The ObjectName of the MBean impacted by this subrequest
- * @param req The SNMP subrequest to execute on the MBean
- * @param depth The depth of the SNMP object in the OID tree.
- *
- * @exception SnmpStatusException whenever an SNMP exception must be
- * raised. Raising an exception will abort the request.
- * Exceptions should never be raised directly, but only by means of
- *
- * req.registerGetException(VariableId,SnmpStatusException)
- *
- **/
- public void get(SnmpGenericMetaServer meta, ObjectName name,
- SnmpMibSubRequest req, int depth)
- throws SnmpStatusException {
-
- // java.lang.System.out.println(">>>>>>>>> GET " + name);
-
- final int size = req.getSize();
- final Object data = req.getUserData();
- final String[] nameList = new String[size];
- final SnmpVarBind[] varList = new SnmpVarBind[size];
- final long[] idList = new long[size];
- int i = 0;
-
- for (Enumeration e=req.getElements(); e.hasMoreElements();) {
- final SnmpVarBind var= e.nextElement();
- try {
- final long id = var.oid.getOidArc(depth);
- nameList[i] = meta.getAttributeName(id);
- varList[i] = var;
- idList[i] = id;
-
- // Check the access rights according to the MIB.
- // The MBean might be less restrictive (have a getter
- // while the MIB defines the variable as AFN)
- //
- meta.checkGetAccess(id,data);
-
- //java.lang.System.out.println(nameList[i] + " added.");
- i++;
- } catch(SnmpStatusException x) {
- //java.lang.System.out.println("exception for " + nameList[i]);
- //x.printStackTrace();
- req.registerGetException(var,x);
- }
- }
-
- AttributeList result = null;
- int errorCode = SnmpStatusException.noSuchInstance;
-
- try {
- result = server.getAttributes(name,nameList);
- } catch (InstanceNotFoundException f) {
- //java.lang.System.out.println(name + ": instance not found.");
- //f.printStackTrace();
- result = new AttributeList();
- } catch (ReflectionException r) {
- //java.lang.System.out.println(name + ": reflexion error.");
- //r.printStackTrace();
- result = new AttributeList();
- } catch (Exception x) {
- result = new AttributeList();
- }
-
-
- final Iterator> it = result.iterator();
-
- for (int j=0; j < i; j++) {
- if (!it.hasNext()) {
- //java.lang.System.out.println(name + "variable[" + j +
- // "] absent");
- final SnmpStatusException x =
- new SnmpStatusException(errorCode);
- req.registerGetException(varList[j],x);
- continue;
- }
-
- final Attribute att = (Attribute) it.next();
-
- while ((j < i) && (! nameList[j].equals(att.getName()))) {
- //java.lang.System.out.println(name + "variable[" +j +
- // "] not found");
- final SnmpStatusException x =
- new SnmpStatusException(errorCode);
- req.registerGetException(varList[j],x);
- j++;
- }
-
- if ( j == i) break;
-
- try {
- varList[j].value =
- meta.buildSnmpValue(idList[j],att.getValue());
- } catch (SnmpStatusException x) {
- req.registerGetException(varList[j],x);
- }
- //java.lang.System.out.println(att.getName() + " retrieved.");
- }
- //java.lang.System.out.println(">>>>>>>>> END GET");
- }
-
- /**
- * Get the value of an SNMP variable.
- *
- *
- * You should never need to use this method directly.
- *
- *
- * @param meta The impacted metadata object
- * @param name The ObjectName of the impacted MBean
- * @param id The OID arc identifying the variable we're trying to set.
- * @param data User contextual data allocated through the
- * {@link com.sun.jmx.snmp.agent.SnmpUserDataFactory}
- *
- * @return The value of the variable.
- *
- * @exception SnmpStatusException whenever an SNMP exception must be
- * raised. Raising an exception will abort the request.
- * Exceptions should never be raised directly, but only by means of
- *
- * req.registerGetException(VariableId,SnmpStatusException)
- *
- **/
- public SnmpValue get(SnmpGenericMetaServer meta, ObjectName name,
- long id, Object data)
- throws SnmpStatusException {
- final String attname = meta.getAttributeName(id);
- Object result = null;
-
- try {
- result = server.getAttribute(name,attname);
- } catch (MBeanException m) {
- Exception t = m.getTargetException();
- if (t instanceof SnmpStatusException)
- throw (SnmpStatusException) t;
- throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
- } catch (Exception e) {
- throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
- }
-
- return meta.buildSnmpValue(id,result);
- }
-
- /**
- * Execute an SNMP SET request.
- *
- *
- * This method first builds the list of attributes that need to be
- * set on the MBean and then calls setAttributes() on the
- * MBean server. Then it updates the SnmpMibSubRequest with the new
- * values retrieved from the MBean.
- *
- *
- *
- * The SNMP metadata information is obtained through the given
- * meta object, which usually is an instance of a
- * mibgen generated class.
- *
- *
- *
- * This method is called internally by mibgen generated
- * objects and you should never need to call it directly.
- *
- *
- * @param meta The metadata object impacted by the subrequest
- * @param name The ObjectName of the MBean impacted by this subrequest
- * @param req The SNMP subrequest to execute on the MBean
- * @param depth The depth of the SNMP object in the OID tree.
- *
- * @exception SnmpStatusException whenever an SNMP exception must be
- * raised. Raising an exception will abort the request.
- * Exceptions should never be raised directly, but only by means of
- *
- * req.registerGetException(VariableId,SnmpStatusException)
- *
- **/
- public void set(SnmpGenericMetaServer meta, ObjectName name,
- SnmpMibSubRequest req, int depth)
- throws SnmpStatusException {
-
- final int size = req.getSize();
- final AttributeList attList = new AttributeList(size);
- final String[] nameList = new String[size];
- final SnmpVarBind[] varList = new SnmpVarBind[size];
- final long[] idList = new long[size];
- int i = 0;
-
- for (Enumeration e=req.getElements(); e.hasMoreElements();) {
- final SnmpVarBind var= e.nextElement();
- try {
- final long id = var.oid.getOidArc(depth);
- final String attname = meta.getAttributeName(id);
- final Object attvalue=
- meta.buildAttributeValue(id,var.value);
- final Attribute att = new Attribute(attname,attvalue);
- attList.add(att);
- nameList[i] = attname;
- varList[i] = var;
- idList[i] = id;
- i++;
- } catch(SnmpStatusException x) {
- req.registerSetException(var,x);
- }
- }
-
- AttributeList result;
- int errorCode = SnmpStatusException.noAccess;
-
- try {
- result = server.setAttributes(name,attList);
- } catch (InstanceNotFoundException f) {
- result = new AttributeList();
- errorCode = SnmpStatusException.snmpRspInconsistentName;
- } catch (ReflectionException r) {
- errorCode = SnmpStatusException.snmpRspInconsistentName;
- result = new AttributeList();
- } catch (Exception x) {
- result = new AttributeList();
- }
-
- final Iterator> it = result.iterator();
-
- for (int j=0; j < i; j++) {
- if (!it.hasNext()) {
- final SnmpStatusException x =
- new SnmpStatusException(errorCode);
- req.registerSetException(varList[j],x);
- continue;
- }
-
- final Attribute att = (Attribute) it.next();
-
- while ((j < i) && (! nameList[j].equals(att.getName()))) {
- final SnmpStatusException x =
- new SnmpStatusException(SnmpStatusException.noAccess);
- req.registerSetException(varList[j],x);
- j++;
- }
-
- if ( j == i) break;
-
- try {
- varList[j].value =
- meta.buildSnmpValue(idList[j],att.getValue());
- } catch (SnmpStatusException x) {
- req.registerSetException(varList[j],x);
- }
-
- }
- }
-
- /**
- * Set the value of an SNMP variable.
- *
- *
- * You should never need to use this method directly.
- *
- *
- * @param meta The impacted metadata object
- * @param name The ObjectName of the impacted MBean
- * @param x The new requested SnmpValue
- * @param id The OID arc identifying the variable we're trying to set.
- * @param data User contextual data allocated through the
- * {@link com.sun.jmx.snmp.agent.SnmpUserDataFactory}
- *
- * @return The new value of the variable after the operation.
- *
- * @exception SnmpStatusException whenever an SNMP exception must be
- * raised. Raising an exception will abort the request.
- * Exceptions should never be raised directly, but only by means of
- *
- * req.registerSetException(VariableId,SnmpStatusException)
- *
- **/
- public SnmpValue set(SnmpGenericMetaServer meta, ObjectName name,
- SnmpValue x, long id, Object data)
- throws SnmpStatusException {
- final String attname = meta.getAttributeName(id);
- final Object attvalue=
- meta.buildAttributeValue(id,x);
- final Attribute att = new Attribute(attname,attvalue);
-
- Object result = null;
-
- try {
- server.setAttribute(name,att);
- result = server.getAttribute(name,attname);
- } catch(InvalidAttributeValueException iv) {
- throw new
- SnmpStatusException(SnmpStatusException.snmpRspWrongValue);
- } catch (InstanceNotFoundException f) {
- throw new
- SnmpStatusException(SnmpStatusException.snmpRspInconsistentName);
- } catch (ReflectionException r) {
- throw new
- SnmpStatusException(SnmpStatusException.snmpRspInconsistentName);
- } catch (MBeanException m) {
- Exception t = m.getTargetException();
- if (t instanceof SnmpStatusException)
- throw (SnmpStatusException) t;
- throw new
- SnmpStatusException(SnmpStatusException.noAccess);
- } catch (Exception e) {
- throw new
- SnmpStatusException(SnmpStatusException.noAccess);
- }
-
- return meta.buildSnmpValue(id,result);
- }
-
- /**
- * Checks whether an SNMP SET request can be successfully performed.
- *
- *
- * For each variable in the subrequest, this method calls
- * checkSetAccess() on the meta object, and then tries to invoke the
- * checkAttributeName() method on the MBean. If this method
- * is not defined then it is assumed that the SET won't fail.
- *
- *
- *
- * This method is called internally by mibgen generated
- * objects and you should never need to call it directly.
- *
- *
- * @param meta The metadata object impacted by the subrequest
- * @param name The ObjectName of the MBean impacted by this subrequest
- * @param req The SNMP subrequest to execute on the MBean
- * @param depth The depth of the SNMP object in the OID tree.
- *
- * @exception SnmpStatusException if the requested SET operation must
- * be rejected. Raising an exception will abort the request.
- * Exceptions should never be raised directly, but only by means of
- *
- * req.registerCheckException(VariableId,SnmpStatusException)
- *
- *
- **/
- public void check(SnmpGenericMetaServer meta, ObjectName name,
- SnmpMibSubRequest req, int depth)
- throws SnmpStatusException {
-
- final Object data = req.getUserData();
-
- for (Enumeration e=req.getElements(); e.hasMoreElements();) {
- final SnmpVarBind var= e.nextElement();
- try {
- final long id = var.oid.getOidArc(depth);
- // call meta.check() here, and meta.check will call check()
- check(meta,name,var.value,id,data);
- } catch(SnmpStatusException x) {
- req.registerCheckException(var,x);
- }
- }
- }
-
- /**
- * Checks whether a SET operation can be performed on a given SNMP
- * variable.
- *
- * @param meta The impacted metadata object
- * @param name The ObjectName of the impacted MBean
- * @param x The new requested SnmpValue
- * @param id The OID arc identifying the variable we're trying to set.
- * @param data User contextual data allocated through the
- * {@link com.sun.jmx.snmp.agent.SnmpUserDataFactory}
- *
- *
- * This method calls checkSetAccess() on the meta object, and then
- * tries to invoke the checkAttributeName() method on the MBean.
- * If this method is not defined then it is assumed that the SET
- * won't fail.
- *
- *
- *
- * This method is called internally by mibgen generated
- * objects and you should never need to call it directly.
- *
- *
- * @exception SnmpStatusException if the requested SET operation must
- * be rejected. Raising an exception will abort the request.
- * Exceptions should never be raised directly, but only by means of
- *
- * req.registerCheckException(VariableId,SnmpStatusException)
- *
- *
- **/
- // XXX xxx ZZZ zzz Maybe we should go through the MBeanInfo here?
- public void check(SnmpGenericMetaServer meta, ObjectName name,
- SnmpValue x, long id, Object data)
- throws SnmpStatusException {
-
- meta.checkSetAccess(x,id,data);
- try {
- final String attname = meta.getAttributeName(id);
- final Object attvalue= meta.buildAttributeValue(id,x);
- final Object[] params = new Object[1];
- final String[] signature = new String[1];
-
- params[0] = attvalue;
- signature[0] = attvalue.getClass().getName();
- server.invoke(name,"check"+attname,params,signature);
-
- } catch( SnmpStatusException e) {
- throw e;
- }
- catch (InstanceNotFoundException i) {
- throw new
- SnmpStatusException(SnmpStatusException.snmpRspInconsistentName);
- } catch (ReflectionException r) {
- // checkXXXX() not defined => do nothing
- } catch (MBeanException m) {
- Exception t = m.getTargetException();
- if (t instanceof SnmpStatusException)
- throw (SnmpStatusException) t;
- throw new SnmpStatusException(SnmpStatusException.noAccess);
- } catch (Exception e) {
- throw new
- SnmpStatusException(SnmpStatusException.noAccess);
- }
- }
-
- public void registerTableEntry(SnmpMibTable meta, SnmpOid rowOid,
- ObjectName objname, Object entry)
- throws SnmpStatusException {
- if (objname == null)
- throw new
- SnmpStatusException(SnmpStatusException.snmpRspInconsistentName);
- try {
- if (entry != null && !server.isRegistered(objname))
- server.registerMBean(entry, objname);
- } catch (InstanceAlreadyExistsException e) {
- throw new
- SnmpStatusException(SnmpStatusException.snmpRspInconsistentName);
- } catch (MBeanRegistrationException e) {
- throw new SnmpStatusException(SnmpStatusException.snmpRspNoAccess);
- } catch (NotCompliantMBeanException e) {
- throw new SnmpStatusException(SnmpStatusException.snmpRspGenErr);
- } catch (RuntimeOperationsException e) {
- throw new SnmpStatusException(SnmpStatusException.snmpRspGenErr);
- } catch(Exception e) {
- throw new SnmpStatusException(SnmpStatusException.snmpRspGenErr);
- }
- }
-
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/SnmpIndex.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/SnmpIndex.java
deleted file mode 100644
index 727d1896ba0..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/SnmpIndex.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package com.sun.jmx.snmp.agent;
-
-
-
-// java imports
-//
-import java.io.Serializable;
-import java.util.Vector;
-import java.util.Enumeration;
-
-// jmx imports
-//
-import com.sun.jmx.snmp.SnmpOid;
-
-/**
- * Represents a SNMP index.
- * An SnmpIndex is represented as a Vector of SnmpOid.
- *
- * This class is used internally and by the classes generated by mibgen.
- * You should not need to use this class directly.
- *
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- */
-
-public class SnmpIndex implements Serializable {
- private static final long serialVersionUID = 8712159739982192146L;
-
- /**
- * Initializes an SnmpIndex using a vector of object identifiers.
- *
Following the RFC recommendations, every syntax that is used as a
- * table index should have an object identifier representation. There are
- * some guidelines on how to map the different syntaxes into an object identifier.
- * In the different SnmpValue classes provided, there is a toOid method to get
- * the object identifier of the value.
- *
- * @param oidList The list of Object Identifiers.
- */
- public SnmpIndex(SnmpOid[] oidList) {
- size= oidList.length;
- for(int i= 0; i SnmpIndex using the specified Object Identifier.
- *
- * @param oid The Object Identifier.
- */
- public SnmpIndex(SnmpOid oid) {
- oids.addElement(oid);
- size= 1;
- }
-
- /**
- * Gets the number of Object Identifiers the index is made of.
- *
- * @return The number of Object Identifiers.
- */
- public int getNbComponents() {
- return size;
- }
-
- /**
- * Gets the index as a vector of Object Identifiers.
- *
- * @return The index as a vector.
- */
- public Vector getComponents() {
- return oids;
- }
-
- /**
- * Compares two indexes for equality.
- *
- * @param index The index to compare this with.
- *
- * @return true if the two indexes are equal, false otherwise.
- */
- public boolean equals(SnmpIndex index) {
-
- if (size != index.getNbComponents())
- return false;
-
- // The two vectors have the same length.
- // Compare each single element ...
- //
- SnmpOid oid1;
- SnmpOid oid2;
- Vector components= index.getComponents();
- for(int i=0; i this with.
- *
- * @return The value 0 if the two OID vectors have the same elements, another value otherwise.
- */
- public int compareTo(SnmpIndex index) {
-
- int length= index.getNbComponents();
- Vector components= index.getComponents();
- SnmpOid oid1;
- SnmpOid oid2;
- int comp;
- for(int i=0; i < size; i++) {
- if ( i > length) {
- // There is no more element in the index
- //
- return 1;
- }
- // Access the element ...
- //
- oid1= oids.elementAt(i);
- oid2= components.elementAt(i);
- comp= oid1.compareTo(oid2);
- if (comp == 0)
- continue;
- return comp;
- }
- return 0;
- }
-
- /**
- * Returns a String representation of the index.
- * The different elements are separated by "//".
- *
- * @return A string representation of the index.
- */
- @Override
- public String toString() {
- final StringBuilder msg= new StringBuilder();
- for(Enumeration e= oids.elements(); e.hasMoreElements(); ) {
- SnmpOid val= e.nextElement();
- msg.append("//").append( val.toString());
- }
- return msg.toString();
- }
-
- // PRIVATE VARIABLES
- //------------------
-
- /**
- * The list of OIDs.
- * @serial
- */
- private Vector oids = new Vector<>();
-
- /**
- * The number of elements in the index.
- * @serial
- */
- private int size = 0;
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/SnmpMib.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/SnmpMib.java
deleted file mode 100644
index bc993761297..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/SnmpMib.java
+++ /dev/null
@@ -1,738 +0,0 @@
-/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.jmx.snmp.agent;
-
-import java.io.Serializable;
-import java.util.Enumeration;
-import java.util.logging.Level;
-import java.util.Vector;
-
-import javax.management.ObjectName;
-import javax.management.MBeanServer;
-import javax.management.MalformedObjectNameException;
-import javax.management.InstanceAlreadyExistsException;
-import javax.management.MBeanRegistrationException;
-import javax.management.NotCompliantMBeanException;
-
-import static com.sun.jmx.defaults.JmxProperties.SNMP_ADAPTOR_LOGGER;
-import com.sun.jmx.snmp.SnmpOid;
-import com.sun.jmx.snmp.SnmpVarBind;
-import com.sun.jmx.snmp.SnmpDefinitions;
-import com.sun.jmx.snmp.SnmpStatusException;
-
-/**
- * Abstract class for representing an SNMP MIB.
- *
- * When compiling a SNMP MIB, among all the classes generated by
- * mibgen, there is one which extends SnmpMib
- * for representing a whole MIB.
- * The class is used by the SNMP protocol adaptor as the entry point in
- * the MIB.
- *
- *
This generated class can be subclassed in your code in order to
- * plug in your own specific behaviour.
- *
- *
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- */
-@SuppressWarnings("serial") // JDK implementation class
-public abstract class SnmpMib extends SnmpMibAgent implements Serializable {
-
- /**
- * Default constructor.
- * Initializes the OID tree.
- */
- public SnmpMib() {
- root= new SnmpMibOid();
- }
-
-
- // --------------------------------------------------------------------
- // POLYMORHIC METHODS
- // --------------------------------------------------------------------
-
- /**
- *
- * This callback should return the OID associated to the group
- * identified by the given groupName.
- *
- *
- *
- * This method is provided as a hook to plug-in some custom
- * specific behavior. Although doing so is discouraged you might
- * want to subclass this method in order to store & provide more metadata
- * information (mapping OID <-> symbolic name) within the agent,
- * or to "change" the root of the MIB OID by prefixing the
- * defaultOid by an application dependant OID string, for instance.
- *
- *
- *
- * The default implementation of this method is to return the given
- * defaultOid
- *
- *
- * @param groupName The java-ized name of the SNMP group.
- * @param defaultOid The OID defined in the MIB for that group
- * (in dot notation).
- *
- * @return The OID of the group identified by groupName,
- * in dot-notation.
- */
- protected String getGroupOid(String groupName, String defaultOid) {
- return defaultOid;
- }
-
- /**
- *
- * This callback should return the ObjectName associated to the
- * group identified by the given groupName.
- *
- *
- *
- * This method is provided as a hook to plug-in some custom
- * specific behavior. You might want to override this method
- * in order to provide a different object naming scheme than
- * that proposed by default by mibgen.
- *
- *
- *
- * This method is only meaningful if the MIB is registered
- * in the MBeanServer, otherwise, it will not be called.
- *
- *
- *
- * The default implementation of this method is to return an ObjectName
- * built from the given defaultName.
- *
- *
- * @param name The java-ized name of the SNMP group.
- * @param oid The OID returned by getGroupOid() - in dot notation.
- * @param defaultName The name by default generated by
- * mibgen
- *
- * @return The ObjectName of the group identified by name
- */
- protected ObjectName getGroupObjectName(String name, String oid,
- String defaultName)
- throws MalformedObjectNameException {
- return new ObjectName(defaultName);
- }
-
- /**
- *
- * Register an SNMP group and its metadata node in the MIB.
- *
- *
- *
- * This method is provided as a hook to plug-in some custom
- * specific behavior. You might want to override this method
- * if you want to set special links between the MBean, its metadata
- * node, its OID or ObjectName etc..
- *
- *
- *
- * If the MIB is not registered in the MBeanServer, the
- * server and groupObjName parameters will be
- * null.
- * If the given group MBean is not null, and if the
- * server and groupObjName parameters are
- * not null, then this method will also automatically register the
- * group MBean with the given MBeanServer server.
- *
- *
- * @param groupName The java-ized name of the SNMP group.
- * @param groupOid The OID as returned by getGroupOid() - in dot
- * notation.
- * @param groupObjName The ObjectName as returned by getGroupObjectName().
- * This parameter may be null if the
- * MIB is not registered in the MBeanServer.
- * @param node The metadata node, as returned by the metadata
- * factory method for this group.
- * @param group The MBean for this group, as returned by the
- * MBean factory method for this group.
- * @param server The MBeanServer in which the groups are to be
- * registered. This parameter will be null
- * if the MIB is not registered, otherwise it is a
- * reference to the MBeanServer in which the MIB is
- * registered.
- *
- */
- protected void registerGroupNode(String groupName, String groupOid,
- ObjectName groupObjName, SnmpMibNode node,
- Object group, MBeanServer server)
- throws NotCompliantMBeanException, MBeanRegistrationException,
- InstanceAlreadyExistsException, IllegalAccessException {
- root.registerNode(groupOid,node);
- if (server != null && groupObjName != null && group != null)
- server.registerMBean(group,groupObjName);
- }
-
- /**
- *
- * Register an SNMP Table metadata node in the MIB.
- *
- *
- *
- *
- * This method is used internally and you should never need to
- * call it directly. It is used to establish the link
- * between an SNMP table metadata node and its bean-like counterpart.
- *
- * The group metadata nodes will create and register their
- * underlying table metadata nodes in the MIB using this
- * method.
- * The metadata nodes will be later retrieved from the MIB by the
- * bean-like table objects using the getRegisterTableMeta() method.
- *
- *
- * @param name The java-ized name of the SNMP table.
- * @param table The SNMP table metadata node - usually this
- * corresponds to a mibgen generated
- * object.
- */
- public abstract void registerTableMeta(String name, SnmpMibTable table);
-
- /**
- * Returns a registered SNMP Table metadata node.
- *
- *
- * This method is used internally and you should never need to
- * call it directly.
- *
- *
- */
- public abstract SnmpMibTable getRegisteredTableMeta(String name);
-
- // --------------------------------------------------------------------
- // PUBLIC METHODS
- // --------------------------------------------------------------------
-
- /**
- * Processes a get operation.
- *
- **/
- // Implements the method defined in SnmpMibAgent. See SnmpMibAgent
- // for java-doc
- //
- @Override
- public void get(SnmpMibRequest req) throws SnmpStatusException {
-
- // Builds the request tree: creation is not allowed, operation
- // is not atomic.
-
- final int reqType = SnmpDefinitions.pduGetRequestPdu;
- SnmpRequestTree handlers = getHandlers(req,false,false,reqType);
-
- SnmpRequestTree.Handler h = null;
- SnmpMibNode meta = null;
-
- if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, SnmpMib.class.getName(),
- "get", "Processing handlers for GET... ");
- }
-
- // For each sub-request stored in the request-tree, invoke the
- // get() method.
- for (Enumeration eh=handlers.getHandlers();eh.hasMoreElements();) {
- h = eh.nextElement();
-
- // Gets the Meta node. It can be either a Group Meta or a
- // Table Meta.
- //
- meta = handlers.getMetaNode(h);
-
- // Gets the depth of the Meta node in the OID tree
- final int depth = handlers.getOidDepth(h);
-
- for (Enumeration rqs=handlers.getSubRequests(h);
- rqs.hasMoreElements();) {
-
- // Invoke the get() operation.
- meta.get(rqs.nextElement(),depth);
- }
- }
- }
-
- /**
- * Processes a set operation.
- *
- */
- // Implements the method defined in SnmpMibAgent. See SnmpMibAgent
- // for java-doc
- //
- @Override
- public void set(SnmpMibRequest req) throws SnmpStatusException {
-
- SnmpRequestTree handlers = null;
-
- // Optimization: we're going to get the whole SnmpRequestTree
- // built in the "check" method, so that we don't have to rebuild
- // it here.
- //
- if (req instanceof SnmpMibRequestImpl)
- handlers = ((SnmpMibRequestImpl)req).getRequestTree();
-
- // Optimization didn't work: we have to rebuild the tree.
- //
- // Builds the request tree: creation is not allowed, operation
- // is atomic.
- //
- final int reqType = SnmpDefinitions.pduSetRequestPdu;
- if (handlers == null) handlers = getHandlers(req,false,true,reqType);
- handlers.switchCreationFlag(false);
- handlers.setPduType(reqType);
-
- SnmpRequestTree.Handler h;
- SnmpMibNode meta;
-
- if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, SnmpMib.class.getName(),
- "set", "Processing handlers for SET... ");
- }
-
- // For each sub-request stored in the request-tree, invoke the
- // get() method.
- for (Enumeration eh=handlers.getHandlers();eh.hasMoreElements();) {
- h = eh.nextElement();
-
- // Gets the Meta node. It can be either a Group Meta or a
- // Table Meta.
- //
- meta = handlers.getMetaNode(h);
-
- // Gets the depth of the Meta node in the OID tree
- final int depth = handlers.getOidDepth(h);
-
- for (Enumeration rqs=handlers.getSubRequests(h);
- rqs.hasMoreElements();) {
-
- // Invoke the set() operation
- meta.set(rqs.nextElement(),depth);
- }
- }
- }
-
- /**
- * Checks if a set operation can be performed.
- * If the operation cannot be performed, the method will raise a
- * SnmpStatusException.
- *
- */
- // Implements the method defined in SnmpMibAgent. See SnmpMibAgent
- // for java-doc
- //
- @Override
- public void check(SnmpMibRequest req) throws SnmpStatusException {
-
- final int reqType = SnmpDefinitions.pduWalkRequest;
- // Builds the request tree: creation is allowed, operation
- // is atomic.
- SnmpRequestTree handlers = getHandlers(req,true,true,reqType);
-
- SnmpRequestTree.Handler h;
- SnmpMibNode meta;
-
- if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, SnmpMib.class.getName(),
- "check", "Processing handlers for CHECK... ");
- }
-
- // For each sub-request stored in the request-tree, invoke the
- // check() method.
- for (Enumeration eh=handlers.getHandlers();eh.hasMoreElements();) {
- h = eh.nextElement();
-
- // Gets the Meta node. It can be either a Group Meta or a
- // Table Meta.
- //
- meta = handlers.getMetaNode(h);
-
- // Gets the depth of the Meta node in the OID tree
- final int depth = handlers.getOidDepth(h);
-
- for (Enumeration rqs=handlers.getSubRequests(h);
- rqs.hasMoreElements();) {
-
- // Invoke the check() operation
- meta.check(rqs.nextElement(),depth);
- }
- }
-
- // Optimization: we're going to pass the whole SnmpRequestTree
- // to the "set" method, so that we don't have to rebuild it there.
- //
- if (req instanceof SnmpMibRequestImpl) {
- ((SnmpMibRequestImpl)req).setRequestTree(handlers);
- }
-
- }
-
- /**
- * Processes a getNext operation.
- *
- */
- // Implements the method defined in SnmpMibAgent. See SnmpMibAgent
- // for java-doc
- //
- @Override
- public void getNext(SnmpMibRequest req) throws SnmpStatusException {
- // Build the request tree for the operation
- // The subrequest stored in the request tree are valid GET requests
- SnmpRequestTree handlers = getGetNextHandlers(req);
-
- SnmpRequestTree.Handler h;
- SnmpMibNode meta;
-
- if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, SnmpMib.class.getName(),
- "getNext", "Processing handlers for GET-NEXT... ");
- }
-
- // Now invoke get() for each subrequest of the request tree.
- for (Enumeration eh=handlers.getHandlers();eh.hasMoreElements();) {
- h = eh.nextElement();
-
- // Gets the Meta node. It can be either a Group Meta or a
- // Table Meta.
- //
- meta = handlers.getMetaNode(h);
-
- // Gets the depth of the Meta node in the OID tree
- int depth = handlers.getOidDepth(h);
-
- for (Enumeration rqs=handlers.getSubRequests(h);
- rqs.hasMoreElements();) {
-
- // Invoke the get() operation
- meta.get(rqs.nextElement(),depth);
- }
- }
- }
-
-
- /**
- * Processes a getBulk operation.
- * The method implements the getBulk operation by calling
- * appropriately the getNext method.
- *
- */
- // Implements the method defined in SnmpMibAgent. See SnmpMibAgent
- // for java-doc
- //
- @Override
- public void getBulk(SnmpMibRequest req, int nonRepeat, int maxRepeat)
- throws SnmpStatusException {
-
- getBulkWithGetNext(req, nonRepeat, maxRepeat);
- }
-
- /**
- * Gets the root object identifier of the MIB.
- *
In order to be accurate, the method should be called once the
- * MIB is fully initialized (that is, after a call to init
- * or preRegister).
- *
- * @return The root object identifier.
- */
- @Override
- public long[] getRootOid() {
-
- if( rootOid == null) {
- Vector list= new Vector<>(10);
-
- // Ask the tree to do the job !
- //
- root.getRootOid(list);
-
- // Now format the result
- //
- rootOid= new long[list.size()];
- int i=0;
- for(Enumeration e= list.elements(); e.hasMoreElements(); ) {
- Integer val= e.nextElement();
- rootOid[i++]= val.longValue();
- }
- }
- return rootOid.clone();
- }
-
- // --------------------------------------------------------------------
- // PRIVATE METHODS
- //---------------------------------------------------------------------
-
- /**
- * This method builds the temporary request-tree that will be used to
- * perform the SNMP request associated with the given vector of varbinds
- * `list'.
- *
- * @param req The SnmpMibRequest object holding the varbind list
- * concerning this MIB.
- * @param createflag Indicates whether the operation allow for creation
- * of new instances (ie: it is a SET).
- * @param atomic Indicates whether the operation is atomic or not.
- * @param type Request type (from SnmpDefinitions).
- *
- * @return The request-tree where the original varbind list has been
- * dispatched to the appropriate nodes.
- */
- private SnmpRequestTree getHandlers(SnmpMibRequest req,
- boolean createflag, boolean atomic,
- int type)
- throws SnmpStatusException {
-
- // Build an empty request tree
- SnmpRequestTree handlers =
- new SnmpRequestTree(req,createflag,type);
-
- int index=0;
- SnmpVarBind var;
- final int ver= req.getVersion();
-
- // For each varbind in the list finds its handling node.
- for (Enumeration e= req.getElements(); e.hasMoreElements(); index++) {
-
- var= e.nextElement();
-
- try {
- // Find the handling node for this varbind.
- root.findHandlingNode(var,var.oid.longValue(false),
- 0,handlers);
- } catch(SnmpStatusException x) {
-
- if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_ADAPTOR_LOGGER.logp(Level.FINEST,
- SnmpMib.class.getName(),
- "getHandlers",
- "Couldn't find a handling node for " +
- var.oid.toString());
- }
-
- // If the operation is atomic (Check/Set) or the version
- // is V1 we must generate an exception.
- //
- if (ver == SnmpDefinitions.snmpVersionOne) {
-
- if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_ADAPTOR_LOGGER.logp(Level.FINEST,
- SnmpMib.class.getName(),
- "getHandlers", "\tV1: Throwing exception");
- }
-
- // The index in the exception must correspond to the
- // SNMP index ...
- //
- final SnmpStatusException sse =
- new SnmpStatusException(x, index + 1);
- sse.initCause(x);
- throw sse;
- } else if ((type == SnmpDefinitions.pduWalkRequest) ||
- (type == SnmpDefinitions.pduSetRequestPdu)) {
- final int status =
- SnmpRequestTree.mapSetException(x.getStatus(),ver);
-
- if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_ADAPTOR_LOGGER.logp(Level.FINEST,
- SnmpMib.class.getName(),
- "getHandlers", "\tSET: Throwing exception");
- }
-
- final SnmpStatusException sse =
- new SnmpStatusException(status, index + 1);
- sse.initCause(x);
- throw sse;
- } else if (atomic) {
-
- // Should never come here...
- if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_ADAPTOR_LOGGER.logp(Level.FINEST,
- SnmpMib.class.getName(),
- "getHandlers", "\tATOMIC: Throwing exception");
- }
-
- final SnmpStatusException sse =
- new SnmpStatusException(x, index + 1);
- sse.initCause(x);
- throw sse;
- }
-
- final int status =
- SnmpRequestTree.mapGetException(x.getStatus(),ver);
-
- if (status == SnmpStatusException.noSuchInstance) {
-
- if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_ADAPTOR_LOGGER.logp(Level.FINEST,
- SnmpMib.class.getName(),
- "getHandlers",
- "\tGET: Registering noSuchInstance");
- }
-
- var.value= SnmpVarBind.noSuchInstance;
-
- } else if (status == SnmpStatusException.noSuchObject) {
- if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_ADAPTOR_LOGGER.logp(Level.FINEST,
- SnmpMib.class.getName(),
- "getHandlers",
- "\tGET: Registering noSuchObject");
- }
-
- var.value= SnmpVarBind.noSuchObject;
-
- } else {
-
- if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_ADAPTOR_LOGGER.logp(Level.FINEST,
- SnmpMib.class.getName(),
- "getHandlers",
- "\tGET: Registering global error: " + status);
- }
-
- final SnmpStatusException sse =
- new SnmpStatusException(status, index + 1);
- sse.initCause(x);
- throw sse;
- }
- }
- }
- return handlers;
- }
-
- /**
- * This method builds the temporary request-tree that will be used to
- * perform the SNMP GET-NEXT request associated with the given vector
- * of varbinds `list'.
- *
- * @param req The SnmpMibRequest object holding the varbind list
- * concerning this MIB.
- *
- * @return The request-tree where the original varbind list has been
- * dispatched to the appropriate nodes, and where the original
- * OIDs have been replaced with the correct "next" OID.
- */
- private SnmpRequestTree getGetNextHandlers(SnmpMibRequest req)
- throws SnmpStatusException {
-
- // Creates an empty request tree, no entry creation is allowed (false)
- SnmpRequestTree handlers = new
- SnmpRequestTree(req,false,SnmpDefinitions.pduGetNextRequestPdu);
-
- // Sets the getNext flag: if version=V2, status exception are
- // transformed in endOfMibView
- handlers.setGetNextFlag();
-
- if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, SnmpMib.class.getName(),
- "getGetNextHandlers", "Received MIB request : " + req);
- }
- AcmChecker checker = new AcmChecker(req);
- int index=0;
- SnmpVarBind var = null;
- final int ver= req.getVersion();
- SnmpOid original = null;
- // For each varbind, finds the handling node.
- // This function has the side effect of transforming a GET-NEXT
- // request into a valid GET request, replacing the OIDs in the
- // original GET-NEXT request with the OID of the first leaf that
- // follows.
- for (Enumeration e= req.getElements(); e.hasMoreElements(); index++) {
-
- var = e.nextElement();
- SnmpOid result;
- try {
- // Find the node handling the OID that follows the varbind
- // OID. `result' contains this next leaf OID.
- //ACM loop.
- if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_ADAPTOR_LOGGER.logp(Level.FINEST,
- SnmpMib.class.getName(),
- "getGetNextHandlers", " Next OID of : " + var.oid);
- }
- result = new SnmpOid(root.findNextHandlingNode
- (var,var.oid.longValue(false),0,
- 0,handlers, checker));
-
- if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_ADAPTOR_LOGGER.logp(Level.FINEST,
- SnmpMib.class.getName(),
- "getGetNextHandlers", " is : " + result);
- }
- // We replace the varbind original OID with the OID of the
- // leaf object we have to return.
- var.oid = result;
- } catch(SnmpStatusException x) {
-
- // if (isDebugOn())
- // debug("getGetNextHandlers",
- // "Couldn't find a handling node for "
- // + var.oid.toString());
-
- if (ver == SnmpDefinitions.snmpVersionOne) {
- if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_ADAPTOR_LOGGER.logp(Level.FINEST,
- SnmpMib.class.getName(),
- "getGetNextHandlers",
- "\tThrowing exception " + x.toString());
- }
- // The index in the exception must correspond to the
- // SNMP index ...
- //
- throw new SnmpStatusException(x, index + 1);
- }
- if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_ADAPTOR_LOGGER.logp(Level.FINEST,
- SnmpMib.class.getName(),
- "getGetNextHandlers",
- "Exception : " + x.getStatus());
- }
-
- var.setSnmpValue(SnmpVarBind.endOfMibView);
- }
- }
- return handlers;
- }
-
- // --------------------------------------------------------------------
- // PROTECTED VARIABLES
- // --------------------------------------------------------------------
-
- /**
- * The top element in the Mib tree.
- * @serial
- */
- protected SnmpMibOid root;
-
-
- // --------------------------------------------------------------------
- // PRIVATE VARIABLES
- // --------------------------------------------------------------------
-
- /**
- * The root object identifier of the MIB.
- */
- private transient long[] rootOid= null;
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/SnmpMibAgent.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/SnmpMibAgent.java
deleted file mode 100644
index 74e4369f98c..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/SnmpMibAgent.java
+++ /dev/null
@@ -1,768 +0,0 @@
-/*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package com.sun.jmx.snmp.agent;
-
-
-
-// java imports
-//
-import java.io.Serializable;
-import java.util.Vector;
-import java.util.Enumeration;
-
-// jmx imports
-//
-import javax.management.MBeanServer;
-import javax.management.MBeanRegistration;
-import javax.management.ObjectName;
-import javax.management.InstanceNotFoundException;
-import javax.management.ServiceNotFoundException;
-import javax.management.ReflectionException;
-import javax.management.MBeanException;
-import com.sun.jmx.snmp.SnmpVarBind;
-import com.sun.jmx.snmp.SnmpDefinitions;
-import com.sun.jmx.snmp.SnmpStatusException;
-import com.sun.jmx.snmp.SnmpPdu;
-import com.sun.jmx.snmp.SnmpOid;
-import com.sun.jmx.snmp.SnmpEngine;
-
-/**
- * Abstract class for representing an SNMP agent.
- *
- * The class is used by the SNMP protocol adaptor as the entry point in
- * the SNMP agent to query.
- *
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- */
-@SuppressWarnings("serial") // JDK implementation class
-public abstract class SnmpMibAgent
- implements SnmpMibAgentMBean, MBeanRegistration, Serializable {
-
- /**
- * Default constructor.
- */
- public SnmpMibAgent() {
- }
-
- // ---------------------------------------------------------------------
- // PUBLIC METHODS
- //----------------------------------------------------------------------
-
- /**
- * Initializes the MIB (with no registration of the MBeans into the
- * MBean server).
- *
- * @exception IllegalAccessException The MIB can not be initialized.
- */
- public abstract void init() throws IllegalAccessException;
-
- /**
- * Initializes the MIB but each single MBean representing the MIB
- * is inserted into the MBean server.
- *
- * @param server The MBean server to register the service with.
- * @param name The object name.
- *
- * @return The name of the SNMP MIB registered.
- *
- * @exception java.lang.Exception
- */
- @Override
- public abstract ObjectName preRegister(MBeanServer server,
- ObjectName name)
- throws java.lang.Exception;
-
- /**
- * Not used in this context.
- */
- @Override
- public void postRegister (Boolean registrationDone) {
- }
-
- /**
- * Not used in this context.
- */
- @Override
- public void preDeregister() throws java.lang.Exception {
- }
-
- /**
- * Not used in this context.
- */
- @Override
- public void postDeregister() {
- }
-
- /**
- * Processes a get operation.
- * This method must update the SnmpVarBinds contained in the
- * {@link SnmpMibRequest} req parameter.
- *
- * @param req The SnmpMibRequest object holding the list of variable to
- * be retrieved. This list is composed of
- * SnmpVarBind objects.
- *
- * @exception SnmpStatusException An error occurred during the operation.
- */
- @Override
- public abstract void get(SnmpMibRequest req)
- throws SnmpStatusException;
-
- /**
- * Processes a getNext operation.
- * This method must update the SnmpVarBinds contained in the
- * {@link SnmpMibRequest} req parameter.
- *
- * @param req The SnmpMibRequest object holding the list of
- * OIDs from which the next variables should be retrieved.
- * This list is composed of SnmpVarBind objects.
- *
- * @exception SnmpStatusException An error occurred during the operation.
- */
- @Override
- public abstract void getNext(SnmpMibRequest req)
- throws SnmpStatusException;
-
- /**
- * Processes a getBulk operation.
- * This method must update the SnmpVarBinds contained in the
- * {@link SnmpMibRequest} req parameter.
- *
- * @param req The SnmpMibRequest object holding the list of variable to
- * be retrieved. This list is composed of
- * SnmpVarBind objects.
- *
- * @param nonRepeat The number of variables, starting with the first
- * variable in the variable-bindings, for which a single
- * lexicographic successor is requested.
- *
- * @param maxRepeat The number of lexicographic successors requested
- * for each of the last R variables. R is the number of variables
- * following the first nonRepeat variables for which
- * multiple lexicographic successors are requested.
- *
- * @exception SnmpStatusException An error occurred during the operation.
- */
- @Override
- public abstract void getBulk(SnmpMibRequest req, int nonRepeat,
- int maxRepeat)
- throws SnmpStatusException;
-
- /**
- * Processes a set operation.
- * This method must update the SnmpVarBinds contained in the
- * {@link SnmpMibRequest} req parameter.
- * This method is called during the second phase of the SET two-phase
- * commit.
- *
- * @param req The SnmpMibRequest object holding the list of variable to
- * be set. This list is composed of
- * SnmpVarBind objects.
- *
- * @exception SnmpStatusException An error occurred during the operation.
- * Throwing an exception in this method will break the
- * atomicity of the SET operation. Care must be taken so that
- * the exception is thrown in the {@link #check(SnmpMibRequest)}
- * method instead.
- */
- @Override
- public abstract void set(SnmpMibRequest req)
- throws SnmpStatusException;
-
-
- /**
- * Checks if a set operation can be performed.
- * If the operation can not be performed, the method should throw an
- * SnmpStatusException.
- * This method is called during the first phase of the SET two-phase
- * commit.
- *
- * @param req The SnmpMibRequest object holding the list of variable to
- * be set. This list is composed of
- * SnmpVarBind objects.
- *
- * @exception SnmpStatusException The set operation
- * cannot be performed.
- */
- @Override
- public abstract void check(SnmpMibRequest req)
- throws SnmpStatusException;
-
- /**
- * Gets the root object identifier of the MIB.
- *
The root object identifier is the object identifier uniquely
- * identifying the MIB.
- *
- * @return The root object identifier.
- */
- public abstract long[] getRootOid();
-
- // ---------------------------------------------------------------------
- // GETTERS AND SETTERS
- // ---------------------------------------------------------------------
-
- /**
- * Gets the reference to the MBean server in which the SNMP MIB is
- * registered.
- *
- * @return The MBean server or null if the MIB is not registered in any
- * MBean server.
- */
- @Override
- public MBeanServer getMBeanServer() {
- return server;
- }
-
- /**
- * Gets the reference to the SNMP protocol adaptor to which the MIB is
- * bound.
- *
- * @return The SNMP MIB handler.
- */
- @Override
- public SnmpMibHandler getSnmpAdaptor() {
- return adaptor;
- }
-
- /**
- * Sets the reference to the SNMP protocol adaptor through which the MIB
- * will be SNMP accessible and add this new MIB in the SNMP MIB handler.
- *
- * @param stack The SNMP MIB handler.
- */
- @Override
- public void setSnmpAdaptor(SnmpMibHandler stack) {
- if (adaptor != null) {
- adaptor.removeMib(this);
- }
- adaptor = stack;
- if (adaptor != null) {
- adaptor.addMib(this);
- }
- }
-
- /**
- * Sets the reference to the SNMP protocol adaptor through which the MIB
- * will be SNMP accessible and add this new MIB in the SNMP MIB handler.
- * This method is to be called to set a specific agent to a specific OID. This can be useful when dealing with MIB overlapping.
- * Some OID can be implemented in more than one MIB. In this case, the OID nearest the agent will be used on SNMP operations.
- * @param stack The SNMP MIB handler.
- * @param oids The set of OIDs this agent implements.
- *
- * @since 1.5
- */
- @Override
- public void setSnmpAdaptor(SnmpMibHandler stack, SnmpOid[] oids) {
- if (adaptor != null) {
- adaptor.removeMib(this);
- }
- adaptor = stack;
- if (adaptor != null) {
- adaptor.addMib(this, oids);
- }
- }
-
- /**
- * Sets the reference to the SNMP protocol adaptor through which the MIB
- * will be SNMP accessible and adds this new MIB in the SNMP MIB handler.
- * Adds a new contextualized MIB in the SNMP MIB handler.
- *
- * @param stack The SNMP MIB handler.
- * @param contextName The MIB context name. If null is passed, will be registered in the default context.
- *
- * @exception IllegalArgumentException If the parameter is null.
- *
- * @since 1.5
- */
- @Override
- public void setSnmpAdaptor(SnmpMibHandler stack, String contextName) {
- if (adaptor != null) {
- adaptor.removeMib(this, contextName);
- }
- adaptor = stack;
- if (adaptor != null) {
- adaptor.addMib(this, contextName);
- }
- }
- /**
- * Sets the reference to the SNMP protocol adaptor through which the MIB
- * will be SNMP accessible and adds this new MIB in the SNMP MIB handler.
- * Adds a new contextualized MIB in the SNMP MIB handler.
- *
- * @param stack The SNMP MIB handler.
- * @param contextName The MIB context name. If null is passed, will be registered in the default context.
- * @param oids The set of OIDs this agent implements.
- * @exception IllegalArgumentException If the parameter is null.
- *
- * @since 1.5
- */
- @Override
- public void setSnmpAdaptor(SnmpMibHandler stack,
- String contextName,
- SnmpOid[] oids) {
- if (adaptor != null) {
- adaptor.removeMib(this, contextName);
- }
- adaptor = stack;
- if (adaptor != null) {
- adaptor.addMib(this, contextName, oids);
- }
- }
-
- /**
- * Gets the object name of the SNMP protocol adaptor to which the MIB
- * is bound.
- *
- * @return The name of the SNMP protocol adaptor.
- */
- @Override
- public ObjectName getSnmpAdaptorName() {
- return adaptorName;
- }
-
- /**
- * Sets the reference to the SNMP protocol adaptor through which the MIB
- * will be SNMP accessible and add this new MIB in the SNMP MIB handler
- * associated to the specified name.
- *
- * @param name The name of the SNMP protocol adaptor.
- *
- * @exception InstanceNotFoundException The SNMP protocol adaptor does
- * not exist in the MBean server.
- *
- * @exception ServiceNotFoundException This SNMP MIB is not registered
- * in the MBean server or the requested service is not supported.
- */
- @Override
- public void setSnmpAdaptorName(ObjectName name)
- throws InstanceNotFoundException, ServiceNotFoundException {
-
- if (server == null) {
- throw new ServiceNotFoundException(mibName + " is not registered in the MBean server");
- }
- // First remove the reference on the old adaptor server.
- //
- if (adaptor != null) {
- adaptor.removeMib(this);
- }
-
- // Then update the reference to the new adaptor server.
- //
- Object[] params = {this};
- String[] signature = {"com.sun.jmx.snmp.agent.SnmpMibAgent"};
- try {
- adaptor = (SnmpMibHandler)(server.invoke(name, "addMib", params,
- signature));
- } catch (InstanceNotFoundException e) {
- throw new InstanceNotFoundException(name.toString());
- } catch (ReflectionException e) {
- throw new ServiceNotFoundException(name.toString());
- } catch (MBeanException e) {
- // Should never occur...
- }
-
- adaptorName = name;
- }
- /**
- * Sets the reference to the SNMP protocol adaptor through which the MIB
- * will be SNMP accessible and add this new MIB in the SNMP MIB handler
- * associated to the specified name.
- * This method is to be called to set a specific agent to a specific OID. This can be useful when dealing with MIB overlapping.
- * Some OID can be implemented in more than one MIB. In this case, the OID nearer agent will be used on SNMP operations.
- * @param name The name of the SNMP protocol adaptor.
- * @param oids The set of OIDs this agent implements.
- * @exception InstanceNotFoundException The SNMP protocol adaptor does
- * not exist in the MBean server.
- *
- * @exception ServiceNotFoundException This SNMP MIB is not registered
- * in the MBean server or the requested service is not supported.
- *
- * @since 1.5
- */
- @Override
- public void setSnmpAdaptorName(ObjectName name, SnmpOid[] oids)
- throws InstanceNotFoundException, ServiceNotFoundException {
-
- if (server == null) {
- throw new ServiceNotFoundException(mibName + " is not registered in the MBean server");
- }
- // First remove the reference on the old adaptor server.
- //
- if (adaptor != null) {
- adaptor.removeMib(this);
- }
-
- // Then update the reference to the new adaptor server.
- //
- Object[] params = {this, oids};
- String[] signature = {"com.sun.jmx.snmp.agent.SnmpMibAgent",
- oids.getClass().getName()};
- try {
- adaptor = (SnmpMibHandler)(server.invoke(name, "addMib", params,
- signature));
- } catch (InstanceNotFoundException e) {
- throw new InstanceNotFoundException(name.toString());
- } catch (ReflectionException e) {
- throw new ServiceNotFoundException(name.toString());
- } catch (MBeanException e) {
- // Should never occur...
- }
-
- adaptorName = name;
- }
- /**
- * Sets the reference to the SNMP protocol adaptor through which the MIB
- * will be SNMP accessible and add this new MIB in the SNMP MIB handler
- * associated to the specified name.
- *
- * @param name The name of the SNMP protocol adaptor.
- * @param contextName The MIB context name. If null is passed, will be registered in the default context.
- * @exception InstanceNotFoundException The SNMP protocol adaptor does
- * not exist in the MBean server.
- *
- * @exception ServiceNotFoundException This SNMP MIB is not registered
- * in the MBean server or the requested service is not supported.
- *
- * @since 1.5
- */
- @Override
- public void setSnmpAdaptorName(ObjectName name, String contextName)
- throws InstanceNotFoundException, ServiceNotFoundException {
-
- if (server == null) {
- throw new ServiceNotFoundException(mibName + " is not registered in the MBean server");
- }
-
- // First remove the reference on the old adaptor server.
- //
- if (adaptor != null) {
- adaptor.removeMib(this, contextName);
- }
-
- // Then update the reference to the new adaptor server.
- //
- Object[] params = {this, contextName};
- String[] signature = {"com.sun.jmx.snmp.agent.SnmpMibAgent", "java.lang.String"};
- try {
- adaptor = (SnmpMibHandler)(server.invoke(name, "addMib", params,
- signature));
- } catch (InstanceNotFoundException e) {
- throw new InstanceNotFoundException(name.toString());
- } catch (ReflectionException e) {
- throw new ServiceNotFoundException(name.toString());
- } catch (MBeanException e) {
- // Should never occur...
- }
-
- adaptorName = name;
- }
-
- /**
- * Sets the reference to the SNMP protocol adaptor through which the MIB
- * will be SNMP accessible and add this new MIB in the SNMP MIB handler
- * associated to the specified name.
- *
- * @param name The name of the SNMP protocol adaptor.
- * @param contextName The MIB context name. If null is passed, will be registered in the default context.
- * @param oids The set of OIDs this agent implements.
- * @exception InstanceNotFoundException The SNMP protocol adaptor does
- * not exist in the MBean server.
- *
- * @exception ServiceNotFoundException This SNMP MIB is not registered
- * in the MBean server or the requested service is not supported.
- *
- * @since 1.5
- */
- @Override
- public void setSnmpAdaptorName(ObjectName name,
- String contextName, SnmpOid[] oids)
- throws InstanceNotFoundException, ServiceNotFoundException {
-
- if (server == null) {
- throw new ServiceNotFoundException(mibName + " is not registered in the MBean server");
- }
-
- // First remove the reference on the old adaptor server.
- //
- if (adaptor != null) {
- adaptor.removeMib(this, contextName);
- }
-
- // Then update the reference to the new adaptor server.
- //
- Object[] params = {this, contextName, oids};
- String[] signature = {"com.sun.jmx.snmp.agent.SnmpMibAgent", "java.lang.String", oids.getClass().getName()};
- try {
- adaptor = (SnmpMibHandler)(server.invoke(name, "addMib", params,
- signature));
- } catch (InstanceNotFoundException e) {
- throw new InstanceNotFoundException(name.toString());
- } catch (ReflectionException e) {
- throw new ServiceNotFoundException(name.toString());
- } catch (MBeanException e) {
- // Should never occur...
- }
-
- adaptorName = name;
- }
-
- /**
- * Indicates whether or not the MIB module is bound to a SNMP protocol
- * adaptor.
- * As a reminder, only bound MIBs can be accessed through SNMP protocol
- * adaptor.
- *
- * @return true if the MIB module is bound,
- * false otherwise.
- */
- @Override
- public boolean getBindingState() {
- if (adaptor == null)
- return false;
- else
- return true;
- }
-
- /**
- * Gets the MIB name.
- *
- * @return The MIB name.
- */
- @Override
- public String getMibName() {
- return mibName;
- }
-
- /**
- * This is a factory method for creating new SnmpMibRequest objects.
- * @param reqPdu The received PDU.
- * @param vblist The vector of SnmpVarBind objects in which the
- * MIB concerned by this request is involved.
- * @param version The protocol version of the SNMP request.
- * @param userData User allocated contextual data.
- *
- * @return A new SnmpMibRequest object.
- *
- * @since 1.5
- **/
- public static SnmpMibRequest newMibRequest(SnmpPdu reqPdu,
- Vector vblist,
- int version,
- Object userData)
- {
- return new SnmpMibRequestImpl(null,
- reqPdu,
- vblist,
- version,
- userData,
- null,
- SnmpDefinitions.noAuthNoPriv,
- getSecurityModel(version),
- null,null);
- }
- /**
- * This is a factory method for creating new SnmpMibRequest objects.
- * @param engine The local engine.
- * @param reqPdu The received pdu.
- * @param vblist The vector of SnmpVarBind objects in which the
- * MIB concerned by this request is involved.
- * @param version The protocol version of the SNMP request.
- * @param userData User allocated contextual data.
- *
- * @return A new SnmpMibRequest object.
- *
- * @since 1.5
- **/
- public static SnmpMibRequest newMibRequest(SnmpEngine engine,
- SnmpPdu reqPdu,
- Vector vblist,
- int version,
- Object userData,
- String principal,
- int securityLevel,
- int securityModel,
- byte[] contextName,
- byte[] accessContextName) {
- return new SnmpMibRequestImpl(engine,
- reqPdu,
- vblist,
- version,
- userData,
- principal,
- securityLevel,
- securityModel,
- contextName,
- accessContextName);
- }
- // ---------------------------------------------------------------------
- // PACKAGE METHODS
- // ---------------------------------------------------------------------
-
- /**
- * Processes a getBulk operation using call to
- * getNext.
- * The method implements the getBulk operation by calling
- * appropriately the getNext method.
- *
- * @param req The SnmpMibRequest containing the variable list to be
- * retrieved.
- *
- * @param nonRepeat The number of variables, starting with the first
- * variable in the variable-bindings, for which a single lexicographic
- * successor is requested.
- *
- * @param maxRepeat The number of lexicographic successors
- * requested for each of the last R variables. R is the number of
- * variables following the first nonRepeat variables for which
- * multiple lexicographic successors are requested.
- *
- * @return The variable list containing returned values.
- *
- * @exception SnmpStatusException An error occurred during the operation.
- */
- void getBulkWithGetNext(SnmpMibRequest req, int nonRepeat, int maxRepeat)
- throws SnmpStatusException {
- final Vector list = req.getSubList();
-
- // RFC 1905, Section 4.2.3, p14
- final int L = list.size() ;
- final int N = Math.max(Math.min(nonRepeat, L), 0) ;
- final int M = Math.max(maxRepeat, 0) ;
- final int R = L - N ;
-
- // Let's build the varBindList for the response pdu
- //
- // int errorStatus = SnmpDefinitions.snmpRspNoError ;
- // int errorIndex = 0 ;
- if (L != 0) {
-
- // Non-repeaters and first row of repeaters
- //
- getNext(req);
-
- // Now the remaining repeaters
- //
- Vector repeaters= splitFrom(list, N);
- SnmpMibRequestImpl repeatedReq =
- new SnmpMibRequestImpl(req.getEngine(),
- req.getPdu(),
- repeaters,
- SnmpDefinitions.snmpVersionTwo,
- req.getUserData(),
- req.getPrincipal(),
- req.getSecurityLevel(),
- req.getSecurityModel(),
- req.getContextName(),
- req.getAccessContextName());
- for (int i = 2 ; i <= M ; i++) {
- getNext(repeatedReq);
- concatVector(req, repeaters);
- }
- }
- }
-
-
- // ---------------------------------------------------------------------
- // PRIVATE METHODS
- // ---------------------------------------------------------------------
-
- /**
- * This method creates a new Vector which does not contain the first
- * element up to the specified limit.
- *
- * @param original The original vector.
- * @param limit The limit.
- */
- private Vector splitFrom(Vector original, int limit) {
-
- int max= original.size();
- Vector result= new Vector<>(max - limit);
- int i= limit;
-
- // Ok the loop looks a bit strange. But in order to improve the
- // perf, we try to avoid reference to the limit variable from
- // within the loop ...
- //
- for(Enumeration e= original.elements(); e.hasMoreElements(); --i) {
- SnmpVarBind var= e.nextElement();
- if (i >0)
- continue;
- result.addElement(new SnmpVarBind(var.oid, var.value));
- }
- return result;
- }
-
- private void concatVector(SnmpMibRequest req, Vector source) {
- for(Enumeration e= source.elements(); e.hasMoreElements(); ) {
- SnmpVarBind var= e.nextElement();
- // We need to duplicate the SnmpVarBind otherwise it is going
- // to be overloaded by the next get Next ...
- req.addVarBind(new SnmpVarBind(var.oid, var.value));
- }
- }
-
- private static int getSecurityModel(int version) {
- switch(version) {
- case SnmpDefinitions.snmpVersionOne:
- return SnmpDefinitions.snmpV1SecurityModel;
- default:
- return SnmpDefinitions.snmpV2SecurityModel;
- }
- }
-
- // ---------------------------------------------------------------------
- // PROTECTED VARIABLES
- // ---------------------------------------------------------------------
-
- /**
- * The object name of the MIB.
- * @serial
- */
- protected String mibName;
-
- /**
- * The reference to the MBean server.
- * @serial
- */
- protected MBeanServer server;
-
- // ---------------------------------------------------------------------
- // PRIVATE VARIABLES
- // ---------------------------------------------------------------------
-
- /**
- * The object name of the SNMP protocol adaptor.
- * @serial
- */
- private ObjectName adaptorName;
-
- /**
- * The reference to the SNMP stack.
- */
- private transient SnmpMibHandler adaptor;
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/SnmpMibAgentMBean.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/SnmpMibAgentMBean.java
deleted file mode 100644
index c94135df9be..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/SnmpMibAgentMBean.java
+++ /dev/null
@@ -1,316 +0,0 @@
-/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package com.sun.jmx.snmp.agent;
-
-
-
-// java imports
-//
-import java.util.Vector;
-
-// jmx imports
-//
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-import javax.management.MalformedObjectNameException;
-import javax.management.InstanceNotFoundException;
-import javax.management.ServiceNotFoundException;
-import com.sun.jmx.snmp.SnmpOid;
-import com.sun.jmx.snmp.SnmpStatusException;
-
-/**
- * Exposes the remote management interface of the SnmpMibAgent MBean.
- *
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- */
-
-public interface SnmpMibAgentMBean {
-
- // PUBLIC METHODS
- //---------------
-
- /**
- * Processes a get operation.
- * This method must not be called from remote.
- *
- * @param req The SnmpMibRequest object holding the list of variables to
- * be retrieved. This list is composed of
- * SnmpVarBind objects.
- *
- * @exception SnmpStatusException An error occurred during the operation.
- * @see SnmpMibAgent#get(SnmpMibRequest)
- */
- public void get(SnmpMibRequest req) throws SnmpStatusException;
-
- /**
- * Processes a getNext operation.
- * This method must not be called from remote.
- *
- * @param req The SnmpMibRequest object holding the list of variables to
- * be retrieved. This list is composed of
- * SnmpVarBind objects.
- *
- * @exception SnmpStatusException An error occurred during the operation.
- * @see SnmpMibAgent#getNext(SnmpMibRequest)
- */
- public void getNext(SnmpMibRequest req) throws SnmpStatusException;
-
- /**
- * Processes a getBulk operation.
- * This method must not be called from remote.
- *
- * @param req The SnmpMibRequest object holding the list of variables to
- * be retrieved. This list is composed of
- * SnmpVarBind objects.
- *
- * @param nonRepeat The number of variables, starting with the first
- * variable in the variable-bindings, for which a single
- * lexicographic successor is requested.
- *
- * @param maxRepeat The number of lexicographic successors requested
- * for each of the last R variables. R is the number of variables
- * following the first nonRepeat variables for which
- * multiple lexicographic successors are requested.
- *
- * @exception SnmpStatusException An error occurred during the operation.
- * @see SnmpMibAgent#getBulk(SnmpMibRequest,int,int)
- */
- public void getBulk(SnmpMibRequest req, int nonRepeat, int maxRepeat)
- throws SnmpStatusException;
-
- /**
- * Processes a set operation.
- * This method must not be called from remote.
- *
- * @param req The SnmpMibRequest object holding the list of variables to
- * be set. This list is composed of
- * SnmpVarBind objects.
- *
- * @exception SnmpStatusException An error occurred during the operation.
- * @see SnmpMibAgent#set(SnmpMibRequest)
- */
- public void set(SnmpMibRequest req) throws SnmpStatusException;
-
- /**
- * Checks if a set operation can be performed.
- * If the operation cannot be performed, the method should emit a
- * SnmpStatusException.
- *
- * @param req The SnmpMibRequest object holding the list of variables to
- * be set. This list is composed of
- * SnmpVarBind objects.
- *
- * @exception SnmpStatusException The set operation
- * cannot be performed.
- * @see SnmpMibAgent#check(SnmpMibRequest)
- */
- public void check(SnmpMibRequest req) throws SnmpStatusException;
-
- // GETTERS AND SETTERS
- //--------------------
-
- /**
- * Gets the reference to the MBean server in which the SNMP MIB is
- * registered.
- *
- * @return The MBean server or null if the MIB is not registered in any
- * MBean server.
- */
- public MBeanServer getMBeanServer();
-
- /**
- * Gets the reference to the SNMP protocol adaptor to which the MIB is
- * bound.
- * This method is used for accessing the SNMP MIB handler property
- * of the SNMP MIB agent in case of a standalone agent.
- *
- * @return The SNMP MIB handler.
- */
- public SnmpMibHandler getSnmpAdaptor();
-
- /**
- * Sets the reference to the SNMP protocol adaptor through which the
- * MIB will be SNMP accessible and add this new MIB in the SNMP MIB
- * handler.
- * This method is used for setting the SNMP MIB handler property of
- * the SNMP MIB agent in case of a standalone agent.
- *
- * @param stack The SNMP MIB handler.
- */
- public void setSnmpAdaptor(SnmpMibHandler stack);
-
- /**
- * Sets the reference to the SNMP protocol adaptor through which the MIB
- * will be SNMP accessible and add this new MIB in the SNMP MIB handler.
- * This method is to be called to set a specific agent to a specific OID.
- * This can be useful when dealing with MIB overlapping.
- * Some OID can be implemented in more than one MIB. In this case, the
- * OID nearer agent will be used on SNMP operations.
- * @param stack The SNMP MIB handler.
- * @param oids The set of OIDs this agent implements.
- *
- * @since 1.5
- */
- public void setSnmpAdaptor(SnmpMibHandler stack, SnmpOid[] oids);
-
- /**
- * Sets the reference to the SNMP protocol adaptor through which the MIB
- * will be SNMP accessible and add this new MIB in the SNMP MIB handler.
- * Adds a new contextualized MIB in the SNMP MIB handler.
- *
- * @param stack The SNMP MIB handler.
- * @param contextName The MIB context name. If null is passed, will be
- * registered in the default context.
- *
- * @exception IllegalArgumentException If the parameter is null.
- *
- * @since 1.5
- */
- public void setSnmpAdaptor(SnmpMibHandler stack, String contextName);
-
- /**
- * Sets the reference to the SNMP protocol adaptor through which the MIB
- * will be SNMP accessible and adds this new MIB in the SNMP MIB handler.
- * Adds a new contextualized MIB in the SNMP MIB handler.
- *
- * @param stack The SNMP MIB handler.
- * @param contextName The MIB context name. If null is passed, will be
- * registered in the default context.
- * @param oids The set of OIDs this agent implements.
- * @exception IllegalArgumentException If the parameter is null.
- *
- * @since 1.5
- */
- public void setSnmpAdaptor(SnmpMibHandler stack,
- String contextName,
- SnmpOid[] oids);
-
- /**
- * Gets the object name of the SNMP protocol adaptor to which the MIB is
- * bound.
- *
- * @return The name of the SNMP protocol adaptor.
- */
- public ObjectName getSnmpAdaptorName();
-
- /**
- * Sets the reference to the SNMP protocol adaptor through which the MIB
- * will be SNMP accessible and add this new MIB in the SNMP MIB handler
- * associated to the specified name.
- *
- * @param name The object name of the SNMP MIB handler.
- *
- * @exception InstanceNotFoundException The MBean does not exist in the
- * MBean server.
- * @exception ServiceNotFoundException This SNMP MIB is not registered
- * in the MBean server or the requested service is not supported.
- */
- public void setSnmpAdaptorName(ObjectName name)
- throws InstanceNotFoundException, ServiceNotFoundException;
-
-
- /**
- * Sets the reference to the SNMP protocol adaptor through which the MIB
- * will be SNMP accessible and add this new MIB in the SNMP MIB handler
- * associated to the specified name.
- * This method is to be called to set a specific agent to a specific OID.
- * This can be useful when dealing with MIB overlapping.
- * Some OID can be implemented in more than one MIB. In this case, the
- * OID nearer agent will be used on SNMP operations.
- * @param name The name of the SNMP protocol adaptor.
- * @param oids The set of OIDs this agent implements.
- * @exception InstanceNotFoundException The SNMP protocol adaptor does
- * not exist in the MBean server.
- *
- * @exception ServiceNotFoundException This SNMP MIB is not registered
- * in the MBean server or the requested service is not supported.
- *
- * @since 1.5
- */
- public void setSnmpAdaptorName(ObjectName name, SnmpOid[] oids)
- throws InstanceNotFoundException, ServiceNotFoundException;
-
- /**
- * Sets the reference to the SNMP protocol adaptor through which the MIB
- * will be SNMP accessible and add this new MIB in the SNMP MIB handler
- * associated to the specified name.
- *
- * @param name The name of the SNMP protocol adaptor.
- * @param contextName The MIB context name. If null is passed, will be
- * registered in the default context.
- * @exception InstanceNotFoundException The SNMP protocol adaptor does
- * not exist in the MBean server.
- *
- * @exception ServiceNotFoundException This SNMP MIB is not registered
- * in the MBean server or the requested service is not supported.
- *
- * @since 1.5
- */
- public void setSnmpAdaptorName(ObjectName name, String contextName)
- throws InstanceNotFoundException, ServiceNotFoundException;
-
- /**
- * Sets the reference to the SNMP protocol adaptor through which the MIB
- * will be SNMP accessible and add this new MIB in the SNMP MIB handler
- * associated to the specified name.
- *
- * @param name The name of the SNMP protocol adaptor.
- * @param contextName The MIB context name. If null is passed, will be
- * registered in the default context.
- * @param oids The set of OIDs this agent implements.
- * @exception InstanceNotFoundException The SNMP protocol adaptor does
- * not exist in the MBean server.
- *
- * @exception ServiceNotFoundException This SNMP MIB is not registered
- * in the MBean server or the requested service is not supported.
- *
- * @since 1.5
- */
- public void setSnmpAdaptorName(ObjectName name,
- String contextName,
- SnmpOid[] oids)
- throws InstanceNotFoundException, ServiceNotFoundException;
-
- /**
- * Indicates whether or not the MIB module is bound to a SNMP protocol
- * adaptor.
- * As a reminder, only bound MIBs can be accessed through SNMP protocol
- * adaptor.
- *
- * @return true if the MIB module is bound,
- * false otherwise.
- */
- public boolean getBindingState();
-
- /**
- * Gets the MIB name.
- *
- * @return The MIB name.
- */
- public String getMibName();
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/SnmpMibEntry.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/SnmpMibEntry.java
deleted file mode 100644
index 1988cf0a149..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/SnmpMibEntry.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.jmx.snmp.agent;
-
-// java imports
-//
-import com.sun.jmx.snmp.SnmpDefinitions;
-import java.io.Serializable;
-import com.sun.jmx.snmp.SnmpStatusException;
-
-/**
- * Represents a node in an SNMP MIB which corresponds to a table entry
- * meta node.
- *
- * This class is used by the class generated by mibgen.
- * You should not need to use this class directly.
- *
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- */
-@SuppressWarnings("serial") // JDK implementation class
-public abstract class SnmpMibEntry extends SnmpMibNode
- implements Serializable {
-
- /**
- * Tells whether the given arc identifies a variable (scalar object) in
- * this entry.
- *
- * @param arc An OID arc.
- *
- * @return true if `arc' leads to a variable.
- */
- public abstract boolean isVariable(long arc);
-
- /**
- * Tells whether the given arc identifies a readable scalar object in
- * this entry.
- *
- * @param arc An OID arc.
- *
- * @return true if `arc' leads to a readable variable.
- */
- public abstract boolean isReadable(long arc);
-
- /**
- * Get the next OID arc corresponding to a readable scalar variable.
- *
- */
- public long getNextVarId(long id, Object userData)
- throws SnmpStatusException {
- long nextvar = super.getNextVarId(id,userData);
- while (!isReadable(nextvar))
- nextvar = super.getNextVarId(nextvar,userData);
- return nextvar;
- }
-
- /**
- * Checks whether the given OID arc identifies a variable (columnar
- * object).
- *
- * @param userData A contextual object containing user-data.
- * This object is allocated through the
- * {@link com.sun.jmx.snmp.agent.SnmpUserDataFactory}
- * for each incoming SNMP request.
- *
- * @exception If the given `arc' does not identify any variable in this
- * group, throws an SnmpStatusException.
- */
- public void validateVarId(long arc, Object userData)
- throws SnmpStatusException {
- if (isVariable(arc) == false) {
- throw new SnmpStatusException(SnmpDefinitions.snmpRspNoSuchName);
- }
- }
-
- /**
- * Generic handling of the get operation.
- *
The actual implementation of this method will be generated
- * by mibgen. Usually, this implementation only delegates the
- * job to some other provided runtime class, which knows how to
- * access the MBean. The current toolkit thus provides two
- * implementations:
- *
The standard implementation will directly access the
- * MBean through a java reference,
- *
The generic implementation will access the MBean through
- * the MBean server.
- *
- *
Both implementations rely upon specific - and distinct, set of
- * mibgen generated methods.
- *
You can override this method if you need to implement some
- * specific policies for minimizing the accesses made to some remote
- * underlying resources.
- *
- *
- * @param req The sub-request that must be handled by this node.
- *
- * @param depth The depth reached in the OID tree.
- *
- * @exception SnmpStatusException An error occurred while accessing
- * the MIB node.
- */
- abstract public void get(SnmpMibSubRequest req, int depth)
- throws SnmpStatusException;
-
- /**
- * Generic handling of the set operation.
- *
The actual implementation of this method will be generated
- * by mibgen. Usually, this implementation only delegates the
- * job to some other provided runtime class, which knows how to
- * access the MBean. The current toolkit thus provides two
- * implementations:
- *
The standard implementation will directly access the
- * MBean through a java reference,
- *
The generic implementation will access the MBean through
- * the MBean server.
- *
- *
Both implementations rely upon specific - and distinct, set of
- * mibgen generated methods.
- *
You can override this method if you need to implement some
- * specific policies for minimizing the accesses made to some remote
- * underlying resources.
- *
- *
- * @param req The sub-request that must be handled by this node.
- *
- * @param depth The depth reached in the OID tree.
- *
- * @exception SnmpStatusException An error occurred while accessing
- * the MIB node.
- */
- abstract public void set(SnmpMibSubRequest req, int depth)
- throws SnmpStatusException;
-
- /**
- * Generic handling of the check operation.
- *
- *
The actual implementation of this method will be generated
- * by mibgen. Usually, this implementation only delegates the
- * job to some other provided runtime class, which knows how to
- * access the MBean. The current toolkit thus provides two
- * implementations:
- *
The standard implementation will directly access the
- * MBean through a java reference,
- *
The generic implementation will access the MBean through
- * the MBean server.
- *
- *
Both implementations rely upon specific - and distinct, set of
- * mibgen generated methods.
- *
You can override this method if you need to implement some
- * specific policies for minimizing the accesses made to some remote
- * underlying resources, or if you need to implement some consistency
- * checks between the different values provided in the varbind list.
- *
- *
- * @param req The sub-request that must be handled by this node.
- *
- * @param depth The depth reached in the OID tree.
- *
- * @exception SnmpStatusException An error occurred while accessing
- * the MIB node.
- */
- abstract public void check(SnmpMibSubRequest req, int depth)
- throws SnmpStatusException;
-
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/SnmpMibGroup.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/SnmpMibGroup.java
deleted file mode 100644
index 99223ea0cb8..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/SnmpMibGroup.java
+++ /dev/null
@@ -1,521 +0,0 @@
-/*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.jmx.snmp.agent;
-
-// java imports
-//
-import java.io.Serializable;
-import java.util.Hashtable;
-import java.util.Vector;
-
-// jmx imports
-//
-import com.sun.jmx.snmp.SnmpVarBind;
-import com.sun.jmx.snmp.SnmpStatusException;
-
-
-/**
- * Represents a node in an SNMP MIB which corresponds to a group.
- * This class allows subnodes to be registered below a group, providing
- * support for nested groups. The subnodes are registered at run time
- * when registering the nested groups in the global MIB OID tree.
- *
- * This class is used by the class generated by mibgen.
- * You should not need to use this class directly.
- *
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- */
-@SuppressWarnings("serial") // JDK implementation class
-public abstract class SnmpMibGroup extends SnmpMibOid
- implements Serializable {
-
- // We will register the OID arcs leading to subgroups in this hashtable.
- // So for each arc in varList, if the arc is also in subgroups, it leads
- // to a subgroup, if it is not in subgroup, it leads either to a table
- // or to a variable.
- protected Hashtable subgroups = null;
-
- /**
- * Tells whether the given arc identifies a table in this group.
- *
- * @param arc An OID arc.
- *
- * @return true if `arc' leads to a table.
- */
- public abstract boolean isTable(long arc);
-
- /**
- * Tells whether the given arc identifies a variable (scalar object) in
- * this group.
- *
- * @param arc An OID arc.
- *
- * @return true if `arc' leads to a variable.
- */
- public abstract boolean isVariable(long arc);
-
- /**
- * Tells whether the given arc identifies a readable scalar object in
- * this group.
- *
- * @param arc An OID arc.
- *
- * @return true if `arc' leads to a readable variable.
- */
- public abstract boolean isReadable(long arc);
-
-
- /**
- * Gets the table identified by the given `arc'.
- *
- * @param arc An OID arc.
- *
- * @return The SnmpMibTable identified by `arc', or
- * null if `arc' does not identify any table.
- */
- public abstract SnmpMibTable getTable(long arc);
-
- /**
- * Checks whether the given OID arc identifies a variable (scalar
- * object).
- *
- * @exception If the given `arc' does not identify any variable in this
- * group, throws an SnmpStatusException.
- */
- public void validateVarId(long arc, Object userData)
- throws SnmpStatusException {
- if (isVariable(arc) == false) {
- throw new SnmpStatusException(SnmpStatusException.noSuchObject);
- }
- }
-
-
- // -------------------------------------------------------------------
- // We use a hashtable (subgroup) in order to determine whether an
- // OID arc leads to a subgroup. This implementation can be changed if
- // needed...
- // For instance, the subclass could provide a generated isNestedArc()
- // method in which the subgroup OID arcs would be hardcoded.
- // However, the generic approach was preferred because at this time
- // groups and subgroups are dynamically registered in the MIB.
- //
- /**
- * Tell whether the given OID arc identifies a sub-tree
- * leading to a nested SNMP sub-group. This method is used internally.
- * You shouldn't need to call it directly.
- *
- * @param arc An OID arc.
- *
- * @return true if the given OID arc identifies a subtree
- * leading to a nested SNMP sub-group.
- *
- */
- public boolean isNestedArc(long arc) {
- if (subgroups == null) return false;
- Object obj = subgroups.get(arc);
- // if the arc is registered in the hashtable,
- // it leads to a subgroup.
- return (obj != null);
- }
-
- /**
- * Generic handling of the get operation.
- *
The actual implementation of this method will be generated
- * by mibgen. Usually, this implementation only delegates the
- * job to some other provided runtime class, which knows how to
- * access the MBean. The current toolkit thus provides two
- * implementations:
- *
The standard implementation will directly access the
- * MBean through a java reference,
- *
The generic implementation will access the MBean through
- * the MBean server.
- *
- *
Both implementations rely upon specific - and distinct, set of
- * mibgen generated methods.
- *
You can override this method if you need to implement some
- * specific policies for minimizing the accesses made to some remote
- * underlying resources.
- *
- *
- * @param req The sub-request that must be handled by this node.
- *
- * @param depth The depth reached in the OID tree.
- *
- * @exception SnmpStatusException An error occurred while accessing
- * the MIB node.
- */
- @Override
- abstract public void get(SnmpMibSubRequest req, int depth)
- throws SnmpStatusException;
-
- /**
- * Generic handling of the set operation.
- *
The actual implementation of this method will be generated
- * by mibgen. Usually, this implementation only delegates the
- * job to some other provided runtime class, which knows how to
- * access the MBean. The current toolkit thus provides two
- * implementations:
- *
The standard implementation will directly access the
- * MBean through a java reference,
- *
The generic implementation will access the MBean through
- * the MBean server.
- *
- *
Both implementations rely upon specific - and distinct, set of
- * mibgen generated methods.
- *
You can override this method if you need to implement some
- * specific policies for minimizing the accesses made to some remote
- * underlying resources.
- *
- *
- * @param req The sub-request that must be handled by this node.
- *
- * @param depth The depth reached in the OID tree.
- *
- * @exception SnmpStatusException An error occurred while accessing
- * the MIB node.
- */
- @Override
- abstract public void set(SnmpMibSubRequest req, int depth)
- throws SnmpStatusException;
-
- /**
- * Generic handling of the check operation.
- *
- *
The actual implementation of this method will be generated
- * by mibgen. Usually, this implementation only delegates the
- * job to some other provided runtime class, which knows how to
- * access the MBean. The current toolkit thus provides two
- * implementations:
- *
The standard implementation will directly access the
- * MBean through a java reference,
- *
The generic implementation will access the MBean through
- * the MBean server.
- *
- *
Both implementations rely upon specific - and distinct, set of
- * mibgen generated methods.
- *
You can override this method if you need to implement some
- * specific policies for minimizing the accesses made to some remote
- * underlying resources, or if you need to implement some consistency
- * checks between the different values provided in the varbind list.
- *
- *
- * @param req The sub-request that must be handled by this node.
- *
- * @param depth The depth reached in the OID tree.
- *
- * @exception SnmpStatusException An error occurred while accessing
- * the MIB node.
- */
- @Override
- abstract public void check(SnmpMibSubRequest req, int depth)
- throws SnmpStatusException;
-
- // --------------------------------------------------------------------
- // If we reach this node, we are below the root OID, so we just
- // return.
- // --------------------------------------------------------------------
- @Override
- public void getRootOid(Vector result) {
- }
-
- // -------------------------------------------------------------------
- // PACKAGE METHODS
- // -------------------------------------------------------------------
-
- // -------------------------------------------------------------------
- // This method can also be overriden in a subclass to provide a
- // different implementation of the isNestedArc() method.
- // => if isNestedArc() is hardcoded, then registerSubArc() becomes
- // useless and can become empty.
- /**
- * Register an OID arc that identifies a sub-tree
- * leading to a nested SNMP sub-group. This method is used internally.
- * You shouldn't ever call it directly.
- *
- * @param arc An OID arc.
- *
- */
- void registerNestedArc(long arc) {
- Long obj = arc;
- if (subgroups == null) subgroups = new Hashtable<>();
- // registers the arc in the hashtable.
- subgroups.put(obj,obj);
- }
-
- // -------------------------------------------------------------------
- // The SnmpMibOid algorithm relies on the fact that for every arc
- // registered in varList, there is a corresponding node at the same
- // position in children.
- // So the trick is to register a null node in children for each variable
- // in varList, so that the real subgroup nodes can be inserted at the
- // correct location.
- // registerObject() should be called for each scalar object and each
- // table arc by the generated subclass.
- /**
- * Register an OID arc that identifies a scalar object or a table.
- * This method is used internally. You shouldn't ever call it directly.
- *
- * @param arc An OID arc.
- *
- */
- protected void registerObject(long arc)
- throws IllegalAccessException {
-
- // this will register the variable in both varList and children
- // The node registered in children will be null, so that the parent
- // algorithm will behave as if no node were registered. This is a
- // trick that makes the parent algorithm behave as if only subgroups
- // were registered in varList and children.
- long[] oid = new long[1];
- oid[0] = arc;
- super.registerNode(oid,0,null);
- }
-
- // -------------------------------------------------------------------
- // registerNode() will be called at runtime when nested groups are
- // registered in the MIB. So we do know that this method will only
- // be called to register nested-groups.
- // We trap registerNode() in order to call registerSubArc()
- /**
- * Register a child node of this node in the OID tree.
- * This method is used internally. You shouldn't ever call it directly.
- *
- * @param oid The oid of the node being registered.
- * @param cursor The position reached in the oid.
- * @param node The node being registered.
- *
- */
- @Override
- void registerNode(long[] oid, int cursor ,SnmpMibNode node)
- throws IllegalAccessException {
- super.registerNode(oid,cursor,node);
- if (cursor < 0) return;
- if (cursor >= oid.length) return;
- // if we get here, then it means we are registering a subgroup.
- // We will thus register the sub arc in the subgroups hashtable.
- registerNestedArc(oid[cursor]);
- }
-
- // -------------------------------------------------------------------
- // see comments in SnmpMibNode
- // -------------------------------------------------------------------
- @Override
- void findHandlingNode(SnmpVarBind varbind,
- long[] oid, int depth,
- SnmpRequestTree handlers)
- throws SnmpStatusException {
-
- int length = oid.length;
-
- if (handlers == null)
- throw new SnmpStatusException(SnmpStatusException.snmpRspGenErr);
-
- final Object data = handlers.getUserData();
-
- if (depth >= length) {
- // Nothing is left... the oid is not valid
- throw new SnmpStatusException(SnmpStatusException.noAccess);
- }
-
- long arc = oid[depth];
-
- if (isNestedArc(arc)) {
- // This arc leads to a subgroup: delegates the search to the
- // method defined in SnmpMibOid
- super.findHandlingNode(varbind,oid,depth,handlers);
- } else if (isTable(arc)) {
- // This arc leads to a table: forward the search to the table.
-
- // Gets the table
- SnmpMibTable table = getTable(arc);
-
- // Forward the search to the table
- table.findHandlingNode(varbind,oid,depth+1,handlers);
-
- } else {
- // If it's not a variable, throws an exception
- validateVarId(arc, data);
-
- // The trailing .0 is missing in the OID
- if (depth+2 > length) {
- throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
- }
-
- // There are too many arcs left in the OID (there should remain
- // a single trailing .0)
- if (depth+2 < length) {
- throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
- }
-
- // The last trailing arc is not .0
- if (oid[depth+1] != 0L) {
- throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
- }
-
- // It's one of our variable, register this node.
- handlers.add(this,depth,varbind);
- }
- }
-
- // -------------------------------------------------------------------
- // See comments in SnmpMibNode.
- // -------------------------------------------------------------------
- @Override
- long[] findNextHandlingNode(SnmpVarBind varbind,
- long[] oid, int pos, int depth,
- SnmpRequestTree handlers, AcmChecker checker)
- throws SnmpStatusException {
-
- int length = oid.length;
- SnmpMibNode node = null;
-
- if (handlers == null) {
- // This should be considered as a genErr, but we do not want to
- // abort the whole request, so we're going to throw
- // a noSuchObject...
- //
- throw new SnmpStatusException(SnmpStatusException.noSuchObject);
- }
-
- final Object data = handlers.getUserData();
- final int pduVersion = handlers.getRequestPduVersion();
-
-
- // The generic case where the end of the OID has been reached is
- // handled in the superclass
- // XXX Revisit: this works but it is somewhat convoluted. Just setting
- // arc to -1 would work too.
- if (pos >= length)
- return super.findNextHandlingNode(varbind,oid,pos,depth,
- handlers, checker);
-
- // Ok, we've got the arc.
- long arc = oid[pos];
-
- long[] result = null;
-
- // We have a recursive logic. Should we have a loop instead?
- try {
-
- if (isTable(arc)) {
- // If the arc identifies a table, then we need to forward
- // the search to the table.
-
- // Gets the table identified by `arc'
- SnmpMibTable table = getTable(arc);
-
- // Forward to the table
- checker.add(depth, arc);
- try {
- result = table.findNextHandlingNode(varbind,oid,pos+1,
- depth+1,handlers,
- checker);
- }catch(SnmpStatusException ex) {
- throw new SnmpStatusException(SnmpStatusException.noSuchObject);
- } finally {
- checker.remove(depth);
- }
- // Build up the leaf OID
- result[depth] = arc;
- return result;
- } else if (isReadable(arc)) {
- // If the arc identifies a readable variable, then two cases:
-
- if (pos == (length - 1)) {
- // The end of the OID is reached, so we return the leaf
- // corresponding to the variable identified by `arc'
-
- // Build up the OID
- // result = new SnmpOid(0);
- // result.insert((int)arc);
- result = new long[depth+2];
- result[depth+1] = 0L;
- result[depth] = arc;
-
- checker.add(depth, result, depth, 2);
- try {
- checker.checkCurrentOid();
- } catch(SnmpStatusException e) {
- throw new SnmpStatusException(SnmpStatusException.noSuchObject);
- } finally {
- checker.remove(depth,2);
- }
-
- // Registers this node
- handlers.add(this,depth,varbind);
- return result;
- }
-
- // The end of the OID is not yet reached, so we must return
- // the next leaf following the variable identified by `arc'.
- // We cannot return the variable because whatever follows in
- // the OID will be greater or equals to 0, and 0 identifies
- // the variable itself - so we have indeed to return the
- // next object.
- // So we do nothing, because this case is handled at the
- // end of the if ... else if ... else ... block.
-
- } else if (isNestedArc(arc)) {
- // Now if the arc leads to a subgroup, we delegate the
- // search to the child, just as done in SnmpMibNode.
- //
-
- // get the child ( = nested arc node).
- //
- final SnmpMibNode child = getChild(arc);
-
- if (child != null) {
- checker.add(depth, arc);
- try {
- result = child.findNextHandlingNode(varbind,oid,pos+1,
- depth+1,handlers,
- checker);
- result[depth] = arc;
- return result;
- } finally {
- checker.remove(depth);
- }
- }
- }
-
- // The oid is not valid, we will throw an exception in order
- // to try with the next valid identifier...
- //
- throw new SnmpStatusException(SnmpStatusException.noSuchObject);
-
- } catch (SnmpStatusException e) {
- // We didn't find anything at the given arc, so we're going
- // to try with the next valid arc
- //
- long[] newOid = new long[1];
- newOid[0] = getNextVarId(arc,data,pduVersion);
- return findNextHandlingNode(varbind,newOid,0,depth,
- handlers,checker);
- }
- }
-
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/SnmpMibHandler.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/SnmpMibHandler.java
deleted file mode 100644
index 2b602106e5f..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/SnmpMibHandler.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package com.sun.jmx.snmp.agent;
-
-
-
-// java imports
-//
-import java.util.Vector;
-import java.io.IOException;
-
-// jmx imports
-//
-import com.sun.jmx.snmp.SnmpOid;
-import com.sun.jmx.snmp.SnmpStatusException;
-
-/**
- * The logical link between an SNMP MIB and the SNMP communication stack.
- *
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- */
-
-public interface SnmpMibHandler {
-
- /**
- * Adds a new MIB in the SNMP MIB handler.
- * This method is called automatically by {@link com.sun.jmx.snmp.agent.SnmpMibAgent#setSnmpAdaptor(SnmpMibHandler)} and
- * {@link com.sun.jmx.snmp.agent.SnmpMibAgent#setSnmpAdaptorName(ObjectName)} and should not be called directly.
- *
- * @param mib The MIB to add.
- *
- * @return A reference on the SNMP MIB handler.
- *
- * @exception IllegalArgumentException If the parameter is null.
- */
- public SnmpMibHandler addMib(SnmpMibAgent mib) throws IllegalArgumentException;
-
-/**
- * Adds a new MIB in the SNMP MIB handler.
- *
- * @param mib The MIB to add.
- * @param oids The array of oid used to add the mib. Each oid is a root oid for the mib.
- * @return A reference on the SNMP MIB handler.
- *
- * @exception IllegalArgumentException If the parameter is null.
- *
- * @since 1.5
- */
- public SnmpMibHandler addMib(SnmpMibAgent mib, SnmpOid[] oids) throws IllegalArgumentException;
-
- /**
- * Adds a new contextualized MIB in the SNMP MIB handler.
- *
- * @param mib The MIB to add.
- * @param contextName The MIB context name. If null is passed, will be registered in the default context.
- *
- * @return A reference to the SNMP MIB handler.
- *
- * @exception IllegalArgumentException If the parameter is null.
- *
- * @since 1.5
- */
- public SnmpMibHandler addMib(SnmpMibAgent mib, String contextName)
- throws IllegalArgumentException;
-
- /**
- * Adds a new contextualized MIB in the SNMP MIB handler.
- *
- * @param mib The MIB to add.
- * @param contextName The MIB context name. If null is passed, will be registered in the default context.
- * @param oids The array of oid used to add the mib. Each oid is a root oid for the mib.
- *
- * @return A reference to the SNMP MIB handler.
- *
- * @exception IllegalArgumentException If the parameter is null.
- *
- * @since 1.5
- */
- public SnmpMibHandler addMib(SnmpMibAgent mib, String contextName, SnmpOid[] oids)
- throws IllegalArgumentException;
-
- /**
- * Removes the specified MIB from the SNMP protocol adaptor.
- * This method is called automatically by {@link com.sun.jmx.snmp.agent.SnmpMibAgent#setSnmpAdaptor(SnmpMibHandler)} and
- * {@link com.sun.jmx.snmp.agent.SnmpMibAgent#setSnmpAdaptorName(ObjectName)} and should not be called directly.
- *
- * @param mib The MIB to be removed.
- *
- * @return true if the specified mib was a MIB included in the SNMP MIB handler,
- * false otherwise.
- */
- public boolean removeMib(SnmpMibAgent mib);
- /**
- * Removes the specified MIB from the SNMP protocol adaptor.
- * This method is called automatically by {@link com.sun.jmx.snmp.agent.SnmpMibAgent#setSnmpAdaptor(SnmpMibHandler)} and
- * {@link com.sun.jmx.snmp.agent.SnmpMibAgent#setSnmpAdaptorName(ObjectName)} and should not be called directly.
- *
- * @param mib The MIB to be removed.
- * @param oids The oid the MIB was previously registered for.
- * @return true if the specified mib was a MIB included in the SNMP MIB handler,
- * false otherwise.
- *
- * @since 1.5
- */
- public boolean removeMib(SnmpMibAgent mib, SnmpOid[] oids);
- /**
- * Removes the specified MIB from the SNMP protocol adaptor.
- *
- * @param mib The MIB to be removed.
- * @param contextName The context name used at registration time.
- *
- * @return true if the specified mib was a MIB included in the SNMP MIB handler,
- * false otherwise.
- *
- * @since 1.5
- */
- public boolean removeMib(SnmpMibAgent mib, String contextName);
- /**
- * Removes the specified MIB from the SNMP protocol adaptor.
- *
- * @param mib The MIB to be removed.
- * @param contextName The context name used at registration time.
- * @param oids The oid the MIB was previously registered for.
- * @return true if the specified mib was a MIB included in the SNMP MIB handler,
- * false otherwise.
- *
- * @since 1.5
- */
- public boolean removeMib(SnmpMibAgent mib, String contextName, SnmpOid[] oids);
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/SnmpMibNode.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/SnmpMibNode.java
deleted file mode 100644
index f7cc326aa96..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/SnmpMibNode.java
+++ /dev/null
@@ -1,406 +0,0 @@
-/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package com.sun.jmx.snmp.agent;
-
-
-
-// java imports
-//
-import java.io.Serializable;
-import java.util.Vector;
-import java.util.Hashtable;
-import java.util.Enumeration;
-
-// jmx imports
-//
-import com.sun.jmx.snmp.SnmpOid;
-import com.sun.jmx.snmp.SnmpValue;
-import com.sun.jmx.snmp.SnmpVarBind;
-import com.sun.jmx.snmp.SnmpDefinitions;
-import com.sun.jmx.snmp.SnmpStatusException;
-
-/**
- * The SnmpMibNode class represents a node in an SNMP MIB.
- *
- * This class is used internally and by the class generated by
- * mibgen.
- * You should not need to use this class directly.
- *
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- */
-@SuppressWarnings("serial") // JDK implementation class
-public abstract class SnmpMibNode implements Serializable {
-
- // ---------------------------------------------------------------------
- // PUBLIC METHODS
- //----------------------------------------------------------------------
-
- /**
- * Get the next OID arc corresponding to a readable scalar variable,
- * a branch leading to a subgroub, or a table.
- *
- * @param id Id we start from looking for the next.
- * @param userData A contextual object containing user-data.
- * This object is allocated through the
- * {@link com.sun.jmx.snmp.agent.SnmpUserDataFactory}
- * for each incoming SNMP request.
- *
- * @return The next id in this group.
- *
- * @exception SnmpStatusException If no id is found after the given id.
- */
- public long getNextVarId(long id, Object userData)
- throws SnmpStatusException {
- return getNextIdentifier(varList,id);
- }
-
- /**
- * Get the next OID arc corresponding to a readable scalar variable,
- * a branch leading to a subgroub, or a table, possibly skipping over
- * those arcs that must not or cannot be returned.
- *
- * Calls {@link #getNextVarId(long,java.lang.Object)} until
- * {@link #skipVariable(long,java.lang.Object,int)} returns false.
- *
- * @param id Id we start from looking for the next.
- * @param userData A contextual object containing user-data.
- * This object is allocated through the
- * {@link com.sun.jmx.snmp.agent.SnmpUserDataFactory}
- * for each incoming SNMP request.
- * @param pduVersion Protocol version of the original request PDU.
- *
- * @return The next id in this group which can be returned using
- * the given PDU's protocol version.
- *
- * @exception SnmpStatusException If no id is found after the given id.
- */
- public long getNextVarId(long id, Object userData, int pduVersion)
- throws SnmpStatusException {
- long varid=id;
- do {
- varid = getNextVarId(varid,userData);
- } while (skipVariable(varid,userData,pduVersion));
-
- return varid;
- }
-
- /**
- * Hook for subclasses.
- * The default implementation of this method is to always return
- * false. Subclasses should redefine this method so that it returns
- * true when:
- *
the variable is a leaf that is not instantiated,
- *
or the variable is a leaf whose type cannot be returned by that
- * version of the protocol (e.g. an Counter64 with SNMPv1).
- *
- *
- * @param id Id we start from looking for the next.
- * @param userData A contextual object containing user-data.
- * This object is allocated through the
- * {@link com.sun.jmx.snmp.agent.SnmpUserDataFactory}
- * for each incoming SNMP request.
- * @param pduVersion Protocol version of the original request PDU.
- *
- * @return true if the variable must be skipped by the get-next
- * algorithm.
- */
- protected boolean skipVariable(long id, Object userData, int pduVersion) {
- return false;
- }
-
- /**
- * Find the node which handles a varbind, and register it in the
- * SnmpRequestTree. This method is a pure internal method. You should
- * never try to call it directly.
- *
- * @param varbind The varbind to be handled
- *
- * @param oid The OID array extracted from the varbind
- *
- * @param depth The depth reached in the OID at this step of the
- * processing.
- *
- * @param handlers The Hashtable in which the varbind will be registered
- * with its handling node. This hashtable contains
- * SnmpRequestTree.Handler items.
- *
- * @exception SnmpStatusException No handling node was found.
- **/
- void findHandlingNode(SnmpVarBind varbind,
- long[] oid, int depth,
- SnmpRequestTree handlers)
- throws SnmpStatusException {
- throw new SnmpStatusException(SnmpStatusException.noSuchObject);
- }
-
- /**
- * Find the node which handles the leaf that immediately follows the
- * given varbind OID, and register the it in the SnmpRequestTree.
- * This method is a pure internal method. You should never try to call
- * it directly.
- *
- * @param varbind The varbind to be handled
- *
- * @param oid The OID array extracted from the varbind
- *
- * @param depth The depth reached in the OID at this step of the
- * processing.
- *
- * @param handlers The Hashtable in which the varbind will be registered
- * with its handling node. This hashtable contains
- * SnmpRequestTree.Handler items.
- *
- * @return The SnmpOid of the next leaf.
- *
- * @exception SnmpStatusException No handling node was found.
- **/
- long[] findNextHandlingNode(SnmpVarBind varbind,
- long[] oid, int pos, int depth,
- SnmpRequestTree handlers, AcmChecker checker)
- throws SnmpStatusException {
- throw new SnmpStatusException(SnmpStatusException.noSuchObject);
- }
-
- /**
- * Generic handling of the get operation.
- *
- *
You can override this method if you need to implement some
- * specific policies for minimizing the accesses made to some remote
- * underlying resources.
- *
- *
- * @param req The sub-request that must be handled by this node.
- *
- * @param depth The depth reached in the OID tree.
- *
- * @exception SnmpStatusException An error occurred while accessing
- * the MIB node.
- */
- public abstract void get(SnmpMibSubRequest req, int depth)
- throws SnmpStatusException;
-
- /**
- * Generic handling of the set operation.
- *
You can override this method if you need to implement some
- * specific policies for minimizing the accesses made to some remote
- * underlying resources.
- *
- *
- * @param req The sub-request that must be handled by this node.
- *
- * @param depth The depth reached in the OID tree.
- *
- * @exception SnmpStatusException An error occurred while accessing
- * the MIB node.
- */
- public abstract void set(SnmpMibSubRequest req, int depth)
- throws SnmpStatusException;
-
- /**
- * Generic handling of the check operation.
- *
You can override this method if you need to implement some
- * specific policies for minimizing the accesses made to some remote
- * underlying resources, or if you need to implement some consistency
- * checks between the different values provided in the varbind list.
- *
- *
- * @param req The sub-request that must be handled by this node.
- *
- * @param depth The depth reached in the OID tree.
- *
- * @exception SnmpStatusException An error occurred while accessing
- * the MIB node.
- */
- public abstract void check(SnmpMibSubRequest req, int depth)
- throws SnmpStatusException;
-
- /**
- * Sorts the specified integer array.
- *
- * @param array An integer array.
- */
- static public void sort(int array[]) {
- QuickSort(array, 0, array.length - 1);
- }
-
- /**
- * Computes the root OID of the MIB.
- */
- public void getRootOid(Vector result) {
- return;
- }
-
- //----------------------------------------------------------------------
- // PACKAGE METHODS
- //----------------------------------------------------------------------
-
- /**
- * This is a generic version of C.A.R Hoare's Quick Sort
- * algorithm. This will handle arrays that are already
- * sorted, and arrays with duplicate keys.
- *
- * If you think of a one dimensional array as going from
- * the lowest index on the left to the highest index on the right
- * then the parameters to this function are lowest index or
- * left and highest index or right. The first time you call
- * this function it will be with the parameters 0, a.length - 1.
- *
- * @param a An integer array.
- * @param lo0 Left boundary of array partition.
- * @param hi0 Right boundary of array partition.
- */
- static void QuickSort(int a[], int lo0, int hi0) {
- int lo = lo0;
- int hi = hi0;
- int mid;
-
- if ( hi0 > lo0) {
-
- /* Arbitrarily establishing partition element as the midpoint of
- * the array.
- */
- mid = a[ ( lo0 + hi0 ) / 2 ];
-
- // loop through the array until indices cross
- while( lo <= hi ) {
- /* find the first element that is greater than or equal to
- * the partition element starting from the left Index.
- */
- while( ( lo < hi0 ) && ( a[lo] < mid ))
- ++lo;
-
- /* find an element that is smaller than or equal to
- * the partition element starting from the right Index.
- */
- while( ( hi > lo0 ) && ( a[hi] > mid ))
- --hi;
-
- // if the indexes have not crossed, swap
- if( lo <= hi ) {
- swap(a, lo, hi);
- ++lo;
- --hi;
- }
- }
-
- /* If the right index has not reached the left side of array
- * must now sort the left partition.
- */
- if( lo0 < hi )
- QuickSort( a, lo0, hi );
-
- /* If the left index has not reached the right side of array
- * must now sort the right partition.
- */
- if( lo < hi0 )
- QuickSort( a, lo, hi0 );
-
- }
- }
-
- //----------------------------------------------------------------------
- // PROTECTED METHODS
- //----------------------------------------------------------------------
-
- /**
- * This will give the first element greater than value
- * in a sorted array.
- * If there is no element of the array greater than value,
- * the method will throw a SnmpStatusException.
- *
- * @param table A sorted integer array.
- *
- * @param value The greatest value.
- *
- * @exception SnmpStatusException If there is no element greater than
- * value.
- */
- final static protected int getNextIdentifier(int table[], long value)
- throws SnmpStatusException {
-
- final int[] a = table;
- final int val= (int) value;
-
- if (a == null) {
- throw new SnmpStatusException(SnmpStatusException.noSuchObject);
- }
-
- int low= 0;
- int max= a.length;
- int curr= low + (max-low)/2;
- int elmt= 0;
-
- // Basic check
- //
- if (max < 1) {
- throw new SnmpStatusException(SnmpStatusException.noSuchObject);
- }
-
- if (a[max-1] <= val) {
- throw new SnmpStatusException(SnmpStatusException.noSuchObject);
- }
-
- while (low <= max) {
- elmt= a[curr];
- if (val == elmt) {
- // We ned to get the next index ...
- //
- curr++;
- return a[curr];
- }
- if (elmt < val) {
- low= curr +1;
- } else {
- max= curr -1;
- }
- curr= low + (max-low)/2;
- }
- return a[curr];
- }
-
-
- //----------------------------------------------------------------------
- // PRIVATE METHODS
- //----------------------------------------------------------------------
-
- final static private void swap(int a[], int i, int j) {
- int T;
- T = a[i];
- a[i] = a[j];
- a[j] = T;
- }
-
- //----------------------------------------------------------------------
- // PROTECTED VARIABLES
- //----------------------------------------------------------------------
-
- /**
- * Contains the list of variable identifiers.
- */
- protected int[] varList;
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/SnmpMibOid.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/SnmpMibOid.java
deleted file mode 100644
index e99ad82a403..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/SnmpMibOid.java
+++ /dev/null
@@ -1,566 +0,0 @@
-/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-package com.sun.jmx.snmp.agent;
-
-
-
-// java imports
-//
-import java.io.Serializable;
-import java.util.Vector;
-import java.util.Enumeration;
-
-// jmx imports
-//
-import com.sun.jmx.snmp.SnmpOid;
-import com.sun.jmx.snmp.SnmpVarBind;
-import com.sun.jmx.snmp.SnmpStatusException;
-
-/**
- * Represents a node in an SNMP MIB which is neither a group nor a variable.
- * This class defines a list of sub-nodes and the methods that allow to
- * manipulate the sub-nodes.
- *
- * This class is used internally and by the class generated by
- * mibgen.
- * You should not need to use this class directly.
- *
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- */
-
-public class SnmpMibOid extends SnmpMibNode implements Serializable {
- private static final long serialVersionUID = 5012254771107446812L;
-
- /**
- * Default constructor.
- */
- public SnmpMibOid() {
- }
-
- // PUBLIC METHODS
- //---------------
-
- /**
- * Generic handling of the get operation.
- *
- *
This method should be overridden in subclasses.
- *
- *
- * @param req The sub-request that must be handled by this node.
- *
- * @param depth The depth reached in the OID tree.
- *
- * @exception SnmpStatusException The default implementation (if not
- * overridden) is to generate a SnmpStatusException.
- */
- @Override
- public void get(SnmpMibSubRequest req, int depth)
- throws SnmpStatusException {
- for (Enumeration e= req.getElements(); e.hasMoreElements();) {
- SnmpVarBind var= e.nextElement();
- SnmpStatusException x =
- new SnmpStatusException(SnmpStatusException.noSuchObject);
- req.registerGetException(var,x);
- }
- }
-
- /**
- * Generic handling of the set operation.
- *
- *
This method should be overridden in subclasses.
- *
- *
- * @param req The sub-request that must be handled by this node.
- *
- * @param depth The depth reached in the OID tree.
- *
- * @exception SnmpStatusException The default implementation (if not
- * overridden) is to generate a SnmpStatusException.
- */
- @Override
- public void set(SnmpMibSubRequest req, int depth)
- throws SnmpStatusException {
- for (Enumeration e= req.getElements(); e.hasMoreElements();) {
- SnmpVarBind var= e.nextElement();
- SnmpStatusException x =
- new SnmpStatusException(SnmpStatusException.noAccess);
- req.registerSetException(var,x);
- }
- }
-
- /**
- * Generic handling of the check operation.
- *
- *
This method should be overridden in subclasses.
- *
- *
- * @param req The sub-request that must be handled by this node.
- *
- * @param depth The depth reached in the OID tree.
- *
- * @exception SnmpStatusException The default implementation (if not
- * overridden) is to generate a SnmpStatusException.
- */
- @Override
- public void check(SnmpMibSubRequest req, int depth)
- throws SnmpStatusException {
- for (Enumeration e= req.getElements(); e.hasMoreElements();) {
- SnmpVarBind var= e.nextElement();
- SnmpStatusException x =
- new SnmpStatusException(SnmpStatusException.noAccess);
- req.registerCheckException(var,x);
- }
- }
-
-
-
- // ---------------------------------------------------------------------
- //
- // Implements the method defined in SnmpMibNode.
- //
- // ---------------------------------------------------------------------
- //
- @Override
- void findHandlingNode(SnmpVarBind varbind,
- long[] oid, int depth,
- SnmpRequestTree handlers)
- throws SnmpStatusException {
-
-
- final int length = oid.length;
- SnmpMibNode node = null;
-
- if (handlers == null)
- throw new SnmpStatusException(SnmpStatusException.snmpRspGenErr);
-
- if (depth > length) {
- // Nothing is left... the oid is not valid
- throw new SnmpStatusException(SnmpStatusException.noSuchObject);
- } else if (depth == length) {
- // The oid is not complete...
- throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
- } else {
- // Some children variable or subobject is being querried
- // getChild() will raise an exception if no child is found.
- //
- final SnmpMibNode child= getChild(oid[depth]);
-
- // XXXX zzzz : what about null children?
- // (variables for nested groups)
- // if child==null, then we're dealing with a variable or
- // a table: we register this node.
- // This behaviour should be overriden in subclasses,
- // in particular in group meta classes: the group
- // meta classes that hold tables should take care
- // of forwarding this call to all the tables involved.
- //
- if (child == null)
- handlers.add(this,depth,varbind);
- else
- child.findHandlingNode(varbind,oid,depth+1,handlers);
- }
- }
-
- // ---------------------------------------------------------------------
- //
- // Implements the method defined in SnmpMibNode.
- //
- // ---------------------------------------------------------------------
- //
- @Override
- long[] findNextHandlingNode(SnmpVarBind varbind,
- long[] oid, int pos, int depth,
- SnmpRequestTree handlers,
- AcmChecker checker)
- throws SnmpStatusException {
-
-
- final int length = oid.length;
- SnmpMibNode node = null;
- long[] result = null;
- if (handlers == null) {
- // This should be considered as a genErr, but we do not want to
- // abort the whole request, so we're going to throw
- // a noSuchObject...
- //
- throw new SnmpStatusException(SnmpStatusException.noSuchObject);
- }
-
- final Object data = handlers.getUserData();
- final int pduVersion = handlers.getRequestPduVersion();
-
- if (pos >= length) {
- long[] newOid= new long[1];
- newOid[0]= getNextVarId(-1,data,pduVersion);
- result = findNextHandlingNode(varbind,newOid,0,depth,handlers,
- checker);
- return result;
- }
-
- // search the element specified in the oid
- //
- long[] newOid= new long[1];
- long index= oid[pos];
-
- while (true) {
-
- try {
- final SnmpMibNode child = getChild(index);
- // SnmpOid result = null;
- if (child == null) {
- // shouldn't happen
- throw new SnmpStatusException(SnmpStatusException.noSuchObject);
- // validateVarId(index);
- // handlers.add(this,varbind,depth);
- // result = new SnmpOid(0);
- } else {
- checker.add(depth, index);
- try {
- result = child.findNextHandlingNode(varbind,oid,pos+1,
- depth+1,handlers,
- checker);
- } finally {
- checker.remove(depth);
- }
- }
-
- // Build up the leaf OID
- result[depth] = index;
- return result;
-
- } catch(SnmpStatusException e) {
- // If there is no such element go one level up ...
- //
- index= getNextVarId(index,data,pduVersion);
-
- // There is no need to carry the original oid ...
- newOid[0]=index;
- pos= 1;
- oid=newOid;
- }
- }
- }
-
-
- /**
- * Computes the root OID of the MIB.
- */
- @Override
- public void getRootOid(Vector result) {
-
- // If a node has several children, let assume that we are one step to
- // far in order to get the MIB root.
- //
- if (nbChildren != 1)
- return;
-
- result.addElement(varList[0]);
-
- // Now query our child.
- //
- children.firstElement().getRootOid(result);
-
- }
-
- /**
- * Registers a specific node in the tree.
- */
- public void registerNode(String oidString ,SnmpMibNode node)
- throws IllegalAccessException {
- SnmpOid oid= new SnmpOid(oidString);
- registerNode(oid.longValue(), 0, node);
- }
-
- // PROTECTED METHODS
- //------------------
-
- /**
- * Registers a specific node in the tree.
- */
- void registerNode(long[] oid, int cursor ,SnmpMibNode node)
- throws IllegalAccessException {
-
- if (cursor >= oid.length)
- throw new IllegalAccessException();
-
- // Check if the node is already defined
- //
- long var= oid[cursor];
-
- //System.out.println("entering registration for val="
- // + String.valueOf(var) + " position= " + cursor);
-
- int pos = retrieveIndex(var);
- if (pos == nbChildren) {
- nbChildren++;
- varList= new int[nbChildren];
- varList[0]= (int) var;
- pos =0;
- if ( (cursor + 1) == oid.length) {
- // That 's the end of the trip.
- // Do not forward the registration
-
- //System.out.println("End of trip for val="
- // + String.valueOf(var) + " position= " + cursor);
- children.insertElementAt(node,pos);
- return;
- }
-
- //System.out.println("Create node for val="
- // + String.valueOf(var) + " position= " + cursor);
- SnmpMibOid child= new SnmpMibOid();
- children.insertElementAt(child, pos);
- child.registerNode(oid, cursor + 1, node);
- return;
- }
- if (pos == -1) {
- // The node is not yet registered
- //
- int[] tmp= new int[nbChildren + 1];
- tmp[nbChildren]= (int) var;
- System.arraycopy(varList, 0, tmp, 0, nbChildren);
- varList= tmp;
- nbChildren++;
- SnmpMibNode.sort(varList);
- int newPos = retrieveIndex(var);
- varList[newPos]= (int) var;
- if ( (cursor + 1) == oid.length) {
- // That 's the end of the trip.
- // Do not forward the registration
-
- //System.out.println("End of trip for val="
- // + String.valueOf(var) + " position= " + cursor);
- children.insertElementAt(node, newPos);
- return;
- }
- SnmpMibOid child= new SnmpMibOid();
- // System.out.println("Create node for val=" +
- // String.valueOf(var) + " position= " + cursor);
- children.insertElementAt(child, newPos);
- child.registerNode(oid, cursor + 1, node);
- }
- else {
- // The node is already registered
- //
- SnmpMibNode child= children.elementAt(pos);
- if ( (cursor + 1) == oid.length ) {
- //System.out.println("Node already registered val=" +
- // String.valueOf(var) + " position= " + cursor);
- if (child == node) return;
- if (child != null && node != null) {
- // Now we're going to patch the tree the following way:
- // if a subgroup has been registered before its father,
- // we're going to replace the father OID node with
- // the actual group-node and export the children from
- // the temporary OID node to the actual group node.
- //
-
- if (node instanceof SnmpMibGroup) {
- // `node' is a group => replace `child' with `node'
- // export the child's subtree to `node'.
- //
- ((SnmpMibOid)child).exportChildren((SnmpMibOid)node);
- children.setElementAt(node,pos);
- return;
-
- } else if ((node instanceof SnmpMibOid) &&
- (child instanceof SnmpMibGroup)) {
- // `node' is a temporary node, and `child' is a
- // group => keep child and export the node's
- // subtree to `child'.
- //
- ((SnmpMibOid)node).exportChildren((SnmpMibOid)child);
- return;
- } else if (node instanceof SnmpMibOid) {
- // `node' and `child' are both temporary OID nodes
- // => replace `child' with `node' and export child's
- // subtree to `node'.
- //
- ((SnmpMibOid)child).exportChildren((SnmpMibOid)node);
- children.setElementAt(node,pos);
- return;
- }
- }
- children.setElementAt(node,pos);
- } else {
- if (child == null)
- throw new IllegalAccessException();
- ((SnmpMibOid)child).registerNode(oid, cursor + 1, node);
- }
- }
- }
-
- /**
- * Export this node's children to a brother node that will replace
- * this node in the OID tree.
- * This method is a patch that fixes the problem of registering
- * a subnode before its father node.
- *
- **/
- void exportChildren(SnmpMibOid brother)
- throws IllegalAccessException {
-
- if (brother == null) return;
- final long[] oid = new long[1];
- for (int i=0; i= nbChildren) {
- throw new SnmpStatusException(SnmpStatusException.noSuchObject);
- }
-
- if (varList[pos] != (int) id) {
- throw new SnmpStatusException(SnmpStatusException.noSuchObject);
- }
-
- // Access the node
- //
- SnmpMibNode child = null;
- try {
- child = children.elementAtNonSync(pos);
- } catch(ArrayIndexOutOfBoundsException e) {
- throw new SnmpStatusException(SnmpStatusException.noSuchObject);
- }
- if (child == null) {
- throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
- }
- return child;
- }
-
- private int retrieveIndex(long val) {
-
- int low= 0;
- int cursor= (int) val;
- if (varList == null || varList.length < 1)
- return nbChildren;
-
- int max= varList.length -1 ;
- int curr= low + (max-low)/2;
- int elmt;
- while (low <= max) {
- elmt= varList[curr];
- if (cursor == elmt) {
- // We need to get the next index ...
- //
- return curr;
- }
- if (elmt < cursor) {
- low= curr +1;
- } else {
- max= curr -1;
- }
- curr= low + (max-low)/2;
- }
- return -1;
- }
-
- private int getInsertAt(long val) {
-
- int low= 0;
- final int index= (int) val;
- if (varList == null)
- return -1;
- int max= varList.length -1 ;
- int elmt;
- //final int[] v = varList;
-
- //if (index > a[max])
- //return max +1;
-
-
- int curr= low + (max-low)/2;
- while (low <= max) {
-
- elmt= varList[curr];
-
- // never know ...we might find something ...
- //
- if (index == elmt)
- return curr;
-
- if (elmt < index) {
- low= curr +1;
- } else {
- max= curr -1;
- }
- curr= low + (max-low)/2;
- }
-
- return curr;
- }
-
- // PRIVATE VARIABLES
- //------------------
-
- /**
- * Contains the list of sub nodes.
- */
- private NonSyncVector children = new NonSyncVector<>(1);
-
- /**
- * The number of sub nodes.
- */
- private int nbChildren= 0;
-
-
- // All the methods of the Vector class are synchronized.
- // Synchronization is a very expensive operation. In our case it is
- // not always required...
- //
- @SuppressWarnings("serial") // We will never serialize this
- class NonSyncVector extends Vector {
-
- public NonSyncVector(int size) {
- super(size);
- }
-
- final void addNonSyncElement(E obj) {
- ensureCapacity(elementCount + 1);
- elementData[elementCount++] = obj;
- }
-
- @SuppressWarnings("unchecked") // cast to E
- final E elementAtNonSync(int index) {
- return (E) elementData[index];
- }
-
- }
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/SnmpMibRequest.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/SnmpMibRequest.java
deleted file mode 100644
index 0748700e860..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/SnmpMibRequest.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.jmx.snmp.agent;
-
-import java.util.Enumeration;
-import java.util.Vector;
-
-import com.sun.jmx.snmp.SnmpVarBind;
-import com.sun.jmx.snmp.SnmpPdu;
-import com.sun.jmx.snmp.SnmpEngine;
-
-/**
- * This interface models the part of a SNMP request that involves
- * a specific MIB. One object implementing this interface will be created
- * for every MIB involved in a SNMP request, and that object will be passed
- * to the SnmpMibAgent in charge of handling that MIB.
- *
- * Objects implementing this interface will be allocated by the SNMP engine.
- * You will never need to implement this interface. You will only use it.
- *
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- */
-public interface SnmpMibRequest {
- /**
- * Returns the list of varbind to be handled by the SNMP mib node.
- *
- * @return The element of the enumeration are instances of
- * {@link com.sun.jmx.snmp.SnmpVarBind}
- */
- public Enumeration getElements();
-
- /**
- * Returns the vector of varbind to be handled by the SNMP mib node.
- * The caller shall not modify this vector.
- *
- * @return The element of the vector are instances of
- * {@link com.sun.jmx.snmp.SnmpVarBind}
- */
- public Vector getSubList();
-
- /**
- * Returns the SNMP protocol version of the original request. If SNMP V1 request are received, the version is upgraded to SNMP V2.
- *
- * @return The SNMP protocol version of the original request.
- */
- public int getVersion();
-
- /**
- * Returns the SNMP protocol version of the original request. No translation is done on the version. The actual received request SNMP version is returned.
- *
- * @return The SNMP protocol version of the original request.
- *
- * @since 1.5
- */
- public int getRequestPduVersion();
-
- /**
- * Returns the local engine. This parameter is returned only if SnmpV3AdaptorServer is the adaptor receiving this request. Otherwise null is returned.
- * @return the local engine.
- *
- * @since 1.5
- */
- public SnmpEngine getEngine();
- /**
- * Gets the incoming request principal. This parameter is returned only if SnmpV3AdaptorServer is the adaptor receiving this request. Otherwise null is returned.
- * @return The request principal.
- *
- * @since 1.5
- **/
- public String getPrincipal();
- /**
- * Gets the incoming request security level. This level is defined in {@link com.sun.jmx.snmp.SnmpEngine SnmpEngine}. This parameter is returned only if SnmpV3AdaptorServer is the adaptor receiving this request. Otherwise -1 is returned.
- * @return The security level.
- *
- * @since 1.5
- */
- public int getSecurityLevel();
- /**
- * Gets the incoming request security model. This parameter is returned only if SnmpV3AdaptorServer is the adaptor receiving this request. Otherwise -1 is returned.
- * @return The security model.
- *
- * @since 1.5
- */
- public int getSecurityModel();
- /**
- * Gets the incoming request context name. This parameter is returned only if SnmpV3AdaptorServer is the adaptor receiving this request. Otherwise null is returned.
- * @return The context name.
- *
- * @since 1.5
- */
- public byte[] getContextName();
- /**
- * Gets the incoming request context name used by Access Control Model in order to allow or deny the access to OIDs. This parameter is returned only if SnmpV3AdaptorServer is the adaptor receiving this request. Otherwise null is returned.
- * @return The checked context name.
- *
- * @since 1.5
- */
- public byte[] getAccessContextName();
-
- /**
- * Returns a handle on a user allocated contextual object.
- * This contextual object is allocated through the SnmpUserDataFactory
- * on a per SNMP request basis, and is handed back to the user via
- * SnmpMibRequest (and derivative) objects. It is never accessed by
- * the system, but might be handed back in multiple threads. It is thus
- * the user responsibility to make sure he handles this object in a
- * thread safe manner.
- */
- public Object getUserData();
-
- /**
- * Returns the varbind index that should be embedded in an
- * SnmpStatusException for this particular varbind.
- * This does not necessarily correspond to the "real"
- * index value that will be returned in the result PDU.
- *
- * @param varbind The varbind for which the index value is
- * querried. Note that this varbind must have
- * been obtained from the enumeration returned by
- * getElements(), or from the vector
- * returned by getSublist().
- *
- * @return The varbind index that should be embedded in an
- * SnmpStatusException for this particular varbind.
- */
- public int getVarIndex(SnmpVarBind varbind);
-
- /**
- * Adds a varbind to this request sublist. This method is used for
- * internal purposes and you should never need to call it directly.
- *
- * @param varbind The varbind to be added in the sublist.
- *
- */
- public void addVarBind(SnmpVarBind varbind);
-
-
- /**
- * Returns the number of elements (varbinds) in this request sublist.
- *
- * @return The number of elements in the sublist.
- *
- **/
- public int getSize();
- /**
- * Returns the SNMP PDU attached to the request.
- * @return The SNMP PDU.
- *
- * @since 1.5
- **/
- public SnmpPdu getPdu();
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/SnmpMibRequestImpl.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/SnmpMibRequestImpl.java
deleted file mode 100644
index ddcadf72ee9..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/SnmpMibRequestImpl.java
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.jmx.snmp.agent;
-
-import java.util.Enumeration;
-import java.util.Vector;
-
-
-import com.sun.jmx.snmp.SnmpPdu;
-import com.sun.jmx.snmp.SnmpVarBind;
-import com.sun.jmx.snmp.SnmpEngine;
-
-/**
- * This class implements the SnmpMibRequest interface.
- * It represents the part of a SNMP request that involves a specific
- * MIB. One instance of this class will be created for every MIB
- * involved in a SNMP request, and will be passed to the SnmpMibAgent
- * in charge of handling that MIB.
- *
- * Instances of this class are allocated by the SNMP engine. You will
- * never need to use this class directly. You will only access
- * instances of this class through their SnmpMibRequest interface.
- *
- */
-final class SnmpMibRequestImpl implements SnmpMibRequest {
-
- /**
- * @param engine The local engine.
- * @param reqPdu The received pdu.
- * @param vblist The vector of SnmpVarBind objects in which the
- * MIB concerned by this request is involved.
- * @param protocolVersion The protocol version of the SNMP request.
- * @param userData User allocated contextual data. This object must
- * be allocated on a per SNMP request basis through the
- * SnmpUserDataFactory registered with the SnmpAdaptorServer,
- * and is handed back to the user through SnmpMibRequest objects.
- */
- public SnmpMibRequestImpl(SnmpEngine engine,
- SnmpPdu reqPdu,
- Vector vblist,
- int protocolVersion,
- Object userData,
- String principal,
- int securityLevel,
- int securityModel,
- byte[] contextName,
- byte[] accessContextName) {
- varbinds = vblist;
- version = protocolVersion;
- data = userData;
- this.reqPdu = reqPdu;
- this.engine = engine;
- this.principal = principal;
- this.securityLevel = securityLevel;
- this.securityModel = securityModel;
- this.contextName = contextName;
- this.accessContextName = accessContextName;
- }
- // -------------------------------------------------------------------
- // PUBLIC METHODS from SnmpMibRequest
- // -------------------------------------------------------------------
-
- /**
- * Returns the local engine. This parameter is returned only if SnmpV3AdaptorServer is the adaptor receiving this request. Otherwise null is returned.
- * @return the local engine.
- */
- @Override
- public SnmpEngine getEngine() {
- return engine;
- }
-
- /**
- * Gets the incoming request principal. This parameter is returned only if SnmpV3AdaptorServer is the adaptor receiving this request. Otherwise null is returned.
- * @return The request principal.
- **/
- @Override
- public String getPrincipal() {
- return principal;
- }
-
- /**
- * Gets the incoming request security level. This level is defined in {@link com.sun.jmx.snmp.SnmpEngine SnmpEngine}. This parameter is returned only if SnmpV3AdaptorServer is the adaptor receiving this request. Otherwise -1 is returned.
- * @return The security level.
- */
- @Override
- public int getSecurityLevel() {
- return securityLevel;
- }
- /**
- * Gets the incoming request security model. This parameter is returned only if SnmpV3AdaptorServer is the adaptor receiving this request. Otherwise -1 is returned.
- * @return The security model.
- */
- @Override
- public int getSecurityModel() {
- return securityModel;
- }
- /**
- * Gets the incoming request context name. This parameter is returned only if SnmpV3AdaptorServer is the adaptor receiving this request. Otherwise null is returned.
- * @return The context name.
- */
- @Override
- public byte[] getContextName() {
- return contextName;
- }
-
- /**
- * Gets the incoming request context name used by Access Control Model in order to allow or deny the access to OIDs. This parameter is returned only if SnmpV3AdaptorServer is the adaptor receiving this request. Otherwise null is returned.
- * @return The checked context.
- */
- @Override
- public byte[] getAccessContextName() {
- return accessContextName;
- }
-
- // -------------------------------------------------------------------
- // Implements the method defined in SnmpMibRequest interface.
- // See SnmpMibRequest for the java doc.
- // -------------------------------------------------------------------
- @Override
- public final SnmpPdu getPdu() {
- return reqPdu;
- }
-
- // -------------------------------------------------------------------
- // Implements the method defined in SnmpMibRequest interface.
- // See SnmpMibRequest for the java doc.
- // -------------------------------------------------------------------
- @Override
- public final Enumeration getElements() {return varbinds.elements();}
-
- // -------------------------------------------------------------------
- // Implements the method defined in SnmpMibRequest interface.
- // See SnmpMibRequest for the java doc.
- // -------------------------------------------------------------------
- @Override
- public final Vector getSubList() {return varbinds;}
-
- // -------------------------------------------------------------------
- // Implements the method defined in SnmpMibRequest interface.
- // See SnmpMibRequest for the java doc.
- // -------------------------------------------------------------------
- @Override
- public final int getSize() {
- if (varbinds == null) return 0;
- return varbinds.size();
- }
-
- // -------------------------------------------------------------------
- // Implements the method defined in SnmpMibRequest interface.
- // See SnmpMibRequest for the java doc.
- // -------------------------------------------------------------------
- @Override
- public final int getVersion() {return version;}
-
- // -------------------------------------------------------------------
- // Implements the method defined in SnmpMibRequest interface.
- // See SnmpMibRequest for the java doc.
- // -------------------------------------------------------------------
- @Override
- public final int getRequestPduVersion() {return reqPdu.version;}
-
- // -------------------------------------------------------------------
- // Implements the method defined in SnmpMibRequest interface.
- // See SnmpMibRequest for the java doc.
- // -------------------------------------------------------------------
- @Override
- public final Object getUserData() {return data;}
-
- // -------------------------------------------------------------------
- // Implements the method defined in SnmpMibRequest interface.
- // See SnmpMibRequest for the java doc.
- // -------------------------------------------------------------------
- @Override
- public final int getVarIndex(SnmpVarBind varbind) {
- return varbinds.indexOf(varbind);
- }
-
- // -------------------------------------------------------------------
- // Implements the method defined in SnmpMibRequest interface.
- // See SnmpMibRequest for the java doc.
- // -------------------------------------------------------------------
- @Override
- public void addVarBind(SnmpVarBind varbind) {
- varbinds.addElement(varbind);
- }
-
- // -------------------------------------------------------------------
- // PACKAGE METHODS
- // -------------------------------------------------------------------
-
- // -------------------------------------------------------------------
- // Allow to pass the request tree built during the check() phase
- // to the set() method. Note: the if the tree is `null', then the
- // set() method will rebuild a new tree identical to the tree built
- // in the check() method.
- //
- // Passing this tree in the SnmpMibRequestImpl object allows to
- // optimize the SET requests.
- //
- // -------------------------------------------------------------------
- final void setRequestTree(SnmpRequestTree tree) {this.tree = tree;}
-
- // -------------------------------------------------------------------
- // Returns the SnmpRequestTree object built in the first operation
- // phase for two-phase SNMP requests (like SET).
- // -------------------------------------------------------------------
- final SnmpRequestTree getRequestTree() {return tree;}
-
- // -------------------------------------------------------------------
- // Returns the underlying vector of SNMP varbinds (used for algorithm
- // optimization).
- // -------------------------------------------------------------------
- final Vector getVarbinds() {return varbinds;}
-
- // -------------------------------------------------------------------
- // Private variables
- // -------------------------------------------------------------------
-
- // Ideally these variables should be declared final but it makes
- // the jdk1.1.x compiler complain (seems to be a compiler bug, jdk1.2
- // is OK).
- private Vector varbinds;
- private int version;
- private Object data;
- private SnmpPdu reqPdu = null;
- // Non final variable.
- private SnmpRequestTree tree = null;
- private SnmpEngine engine = null;
- private String principal = null;
- private int securityLevel = -1;
- private int securityModel = -1;
- private byte[] contextName = null;
- private byte[] accessContextName = null;
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/SnmpMibSubRequest.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/SnmpMibSubRequest.java
deleted file mode 100644
index 2680dcbf5ee..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/SnmpMibSubRequest.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.jmx.snmp.agent;
-
-import java.util.Enumeration;
-import java.util.Vector;
-import com.sun.jmx.snmp.SnmpVarBind;
-import com.sun.jmx.snmp.SnmpStatusException;
-import com.sun.jmx.snmp.SnmpOid;
-// import com.sun.jmx.snmp.SnmpIndex;
-
-/**
- * This interface models an SNMP sub request to be performed on a specific
- * SNMP MIB node. The node involved can be either an SNMP group, an SNMP table,
- * or an SNMP table entry (conceptual row). The conceptual row may or may not
- * already exist. If the row did not exist at the time when the request
- * was received, the isNewEntry() method will return
- * true.
- *
- * Objects implementing this interface will be allocated by the SNMP engine.
- * You will never need to implement this interface. You will only use it.
- *
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- */
-public interface SnmpMibSubRequest extends SnmpMibRequest {
- /**
- * Return the list of varbind to be handled by the SNMP MIB node.
- *
- * Note:
- * In case of SET operation, if this node is a table row which
- * contains a control variable (as identified by the table's
- * isRowStatus() method) the control variable will not
- * be included in this list: it will be obtained by calling
- * getRowStatusVarBind(). This will allow you to handle the control
- * variable specifically.
- * You will never need to worry about this unless you need to
- * implement a non standard mechanism for handling row
- * creation and deletion.
- *
- *
- * @return The elements of the enumeration are instances of
- * {@link com.sun.jmx.snmp.SnmpVarBind}
- */
- @Override
- public Enumeration getElements();
-
- /**
- * Return the list of varbind to be handled by the SNMP MIB node.
- *
- * Note:
- * In case of SET operation, if this node is a table row which
- * contains a control variable (as identified by the table's
- * isRowStatus() method) the control variable will not
- * be included in this list: it will be obtained by calling
- * getRowStatusVarBind(). This will allow you to handle the control
- * variable specifically.
- * You will never need to worry about this unless you need to
- * implement a non standard mechanism for handling row
- * creation and deletion.
- *
- *
- * @return The elements of the vector are instances of
- * {@link com.sun.jmx.snmp.SnmpVarBind}
- */
- @Override
- public Vector getSubList();
-
- /**
- * Return the part of the OID identifying the table entry involved.
- *
- *
- * @return {@link com.sun.jmx.snmp.SnmpOid} or null
- * if the request is not directed to an entry.
- */
- public SnmpOid getEntryOid();
-
- /**
- * Indicate whether the entry involved is a new entry.
- * This method will return true if the entry was not
- * found when the request was processed. As a consequence,
- * true means that either the entry does not exist yet,
- * or it has been created while processing this request.
- * The result of this method is only significant when an entry
- * is involved.
- *
- *
- * @return true If the entry did not exist,
- * or false if the entry involved was found.
- */
- public boolean isNewEntry();
-
- /**
- * Return the varbind that holds the RowStatus variable.
- * It corresponds to the varbind that was identified by
- * the isRowStatus() method generated by mibgen
- * on {@link com.sun.jmx.snmp.agent.SnmpMibTable} derivatives.
- *
In SMIv2, it is the varbind which contains the columnar
- * object implementing the RowStatus TEXTUAL-CONVENTION.
- *
In SMIv1 nothing special is generated
- *
You may however subclass the generated table metadata
- * class in order to provide your own implementation of
- * isRowStatus(), getRowAction(), isRowReady() and
- * setRowStatus()
- * (see {@link com.sun.jmx.snmp.agent.SnmpMibTable}).
- *
- *
- * @return a varbind that serves to control the table modification.
- * null means that no such varbind could be
- * identified.
- * Note:The runtime will only try to identify
- * the RowStatus varbind when processing an
- * SNMP SET request. In this case, the identified
- * varbind will not be included in the set of varbinds
- * returned by getSubList() and getElements().
- *
- *
- **/
- public SnmpVarBind getRowStatusVarBind();
-
- /**
- * This method should be called when a status exception needs to
- * be raised for a given varbind of an SNMP GET request. This method
- * performs all the necessary conversions (SNMPv1 <=> SNMPv2) and
- * propagates the exception if needed:
- * If the version is SNMP v1, the exception is propagated.
- * If the version is SNMP v2, the exception is stored in the varbind.
- * This method also takes care of setting the correct value of the
- * index field.
- *
- *
- * @param varbind The varbind for which the exception is
- * registered. Note that this varbind must have
- * been obtained from the enumeration returned by
- * getElements(), or from the vector
- * returned by getSubList()
- *
- * @param exception The exception to be registered for the given varbind.
- *
- */
- public void registerGetException(SnmpVarBind varbind,
- SnmpStatusException exception)
- throws SnmpStatusException;
-
- /**
- * This method should be called when a status exception needs to
- * be raised for a given varbind of an SNMP SET request. This method
- * performs all the necessary conversions (SNMPv1 <=> SNMPv2) and
- * propagates the exception if needed.
- * This method also takes care of setting the correct value of the
- * index field.
- *
- *
- * @param varbind The varbind for which the exception is
- * registered. Note that this varbind must have
- * been obtained from the enumeration returned by
- * getElements(), or from the vector
- * returned by getSubList()
- *
- * @param exception The exception to be registered for the given varbind.
- *
- */
- public void registerSetException(SnmpVarBind varbind,
- SnmpStatusException exception)
- throws SnmpStatusException;
-
- /**
- * This method should be called when a status exception needs to
- * be raised when checking a given varbind for an SNMP SET request.
- * This method performs all the necessary conversions (SNMPv1 <=>
- * SNMPv2) and propagates the exception if needed.
- * This method also takes care of setting the correct value of the
- * index field.
- *
- *
- * @param varbind The varbind for which the exception is
- * registered. Note that this varbind must have
- * been obtained from the enumeration returned by
- * getElements(), or from the vector
- * returned by getSubList()
- *
- * @param exception The exception to be registered for the given varbind.
- *
- */
- public void registerCheckException(SnmpVarBind varbind,
- SnmpStatusException exception)
- throws SnmpStatusException;
-}
diff --git a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/SnmpMibTable.java b/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/SnmpMibTable.java
deleted file mode 100644
index 525500d26c8..00000000000
--- a/jdk/src/jdk.snmp/share/classes/com/sun/jmx/snmp/agent/SnmpMibTable.java
+++ /dev/null
@@ -1,2561 +0,0 @@
-/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.jmx.snmp.agent;
-
-import java.io.Serializable;
-import java.util.Date;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
-import java.util.logging.Level;
-
-import javax.management.ListenerNotFoundException;
-import javax.management.MBeanNotificationInfo;
-import javax.management.Notification;
-import javax.management.NotificationBroadcaster;
-import javax.management.NotificationFilter;
-import javax.management.NotificationListener;
-import javax.management.ObjectName;
-
-import static com.sun.jmx.defaults.JmxProperties.SNMP_ADAPTOR_LOGGER;
-import com.sun.jmx.snmp.EnumRowStatus;
-import com.sun.jmx.snmp.SnmpInt;
-import com.sun.jmx.snmp.SnmpOid;
-import com.sun.jmx.snmp.SnmpStatusException;
-import com.sun.jmx.snmp.SnmpValue;
-import com.sun.jmx.snmp.SnmpVarBind;
-
-/**
- * This class is the base class for SNMP table metadata.
- *
- * Its responsibility is to manage a sorted array of OID indexes
- * according to the SNMP indexing scheme over the "real" table.
- * Each object of this class can be bound to an
- * {@link com.sun.jmx.snmp.agent.SnmpTableEntryFactory} to which it will
- * forward remote entry creation requests, and invoke callbacks
- * when an entry has been successfully added to / removed from
- * the OID index array.
- *
- *
- *
- * For each table defined in the MIB, mibgen will generate a specific
- * class called TableTableName that will implement the
- * SnmpTableEntryFactory interface, and a corresponding
- * TableNameMeta class that will extend this class.
- * The TableTableName class corresponds to the MBean view of the
- * table while the TableNameMeta class corresponds to the
- * MIB metadata view of the same table.
- *
- *
- *
- * Objects of this class are instantiated by the generated
- * whole MIB class extending {@link com.sun.jmx.snmp.agent.SnmpMib}
- * You should never need to instantiate this class directly.
- *
- *
- *
This API is a Sun Microsystems internal API and is subject
- * to change without notice.
- * @param mib The SNMP MIB to which the metadata will be linked.
- */
- public SnmpMibTable(SnmpMib mib) {
- this.theMib= mib;
- setCreationEnabled(false);
- }
-
- // -------------------------------------------------------------------
- // PUBLIC METHODS
- // -------------------------------------------------------------------
-
- /**
- * This method is invoked when the creation of a new entry is requested
- * by a remote SNMP manager.
- * By default, remote entry creation is disabled - and this method
- * will not be called. You can dynamically switch the entry creation
- * policy by calling setCreationEnabled(true) and
- * setCreationEnabled(false) on this object.
- *
- * This method is called internally by the SNMP runtime and you
- * should never need to call it directly. However you might want
- * to extend it in order to implement your own specific application
- * behaviour, should the default behaviour not be at your convenience.
- *
- *
- * @param req The SNMP subrequest requesting this creation
- * @param rowOid The OID indexing the conceptual row (entry) for which
- * the creation was requested.
- * @param depth The position of the columnar object arc in the OIDs
- * from the varbind list.
- *
- * @exception SnmpStatusException if the entry cannot be created.
- */
- public abstract void createNewEntry(SnmpMibSubRequest req, SnmpOid rowOid,
- int depth)
- throws SnmpStatusException;
-
- /**
- * Tell whether the specific version of this metadata generated
- * by mibgen requires entries to be registered with
- * the MBeanServer. In this case an ObjectName will have to be
- * passed to addEntry() in order for the table to behave correctly
- * (case of the generic metadata).
- *
- * If that version of the metadata does not require entry to be
- * registered, then passing an ObjectName becomes optional (null
- * can be passed instead).
- *
- * @return true if registration is required by this
- * version of the metadata.
- */
- public abstract boolean isRegistrationRequired();
-
- /**
- * Tell whether a new entry should be created when a SET operation
- * is received for an entry that does not exist yet.
- *
- * @return true if a new entry must be created, false otherwise.
- * [default: returns false]
- **/
- public boolean isCreationEnabled() {
- return creationEnabled;
- }
-
- /**
- * This method lets you dynamically switch the creation policy.
- *
- *
- * @param remoteCreationFlag Tells whether remote entry creation must
- * be enabled or disabled.
- *
- * setCreationEnabled(true) will enable remote entry
- * creation via SET operations.
- *
- * setCreationEnabled(false) will disable remote entry
- * creation via SET operations.
- *
By default remote entry creation via SET operation is disabled.
- *
- *
- **/
- public void setCreationEnabled(boolean remoteCreationFlag) {
- creationEnabled = remoteCreationFlag;
- }
-
- /**
- * Return true if the conceptual row contains a columnar
- * object used to control creation/deletion of rows in this table.
- *
- * This columnar object can be either a variable with RowStatus
- * syntax as defined by RFC 2579, or a plain variable whose
- * semantics is table specific.
- *
- * By default, this function returns false, and it is
- * assumed that the table has no such control variable.
- * When mibgen is used over SMIv2 MIBs, it will generate
- * an hasRowStatus() method returning true
- * for each table containing an object with RowStatus syntax.
- *
- * When this method returns false the default mechanism
- * for remote entry creation is used.
- * Otherwise, creation/deletion is performed as specified
- * by the control variable (see getRowAction() for more details).
- *
- * This method is called internally when a SET request involving
- * this table is processed.
- *
- * If you need to implement a control variable which do not use
- * the RowStatus convention as defined by RFC 2579, you should
- * subclass the generated table metadata class in order to redefine
- * this method and make it returns true.
- * You will then have to redefine the isRowStatus(), mapRowStatus(),
- * isRowReady(), and setRowStatus() methods to suit your specific
- * implementation.
- *
- * @return
true if this table contains a control
- * variable (eg: a variable with RFC 2579 RowStatus syntax),
- *
- *
false if this table does not contain
- * any control variable.
- *
- **/
- public boolean hasRowStatus() {
- return false;
- }
-
- // ---------------------------------------------------------------------
- //
- // Implements the method defined in SnmpMibNode.
- //
- // ---------------------------------------------------------------------
- /**
- * Generic handling of the get operation.
- *
The default implementation of this method is to
- *
- *
check whether the entry exists, and if not register an
- * exception for each varbind in the list.
- *
call the generated
- * get(req,oid,depth+1) method.
- *
- *
- *
- * public void get(SnmpMibSubRequest req, int depth)
- * throws SnmpStatusException {
- * boolean isnew = req.isNewEntry();
- *
- * // if the entry does not exists, then registers an error for
- * // each varbind involved (nb: this should not happen, since
- * // the error should already have been detected earlier)
- * //
- * if (isnew) {
- * SnmpVarBind var = null;
- * for (Enumeration e= req.getElements(); e.hasMoreElements();) {
- * var = (SnmpVarBind) e.nextElement();
- * req.registerGetException(var,noSuchNameException);
- * }
- * }
- *
- * final SnmpOid oid = req.getEntryOid();
- * get(req,oid,depth+1);
- * }
- *
- *
You should not need to override this method in any cases, because
- * it will eventually call
- * get(SnmpMibSubRequest req, int depth) on the generated
- * derivative of SnmpMibEntry. If you need to implement
- * specific policies for minimizing the accesses made to some remote
- * underlying resources, or if you need to implement some consistency
- * checks between the different values provided in the varbind list,
- * you should then rather override
- * get(SnmpMibSubRequest req, int depth) on the generated
- * derivative of SnmpMibEntry.
- *
- *
- */
- @Override
- public void get(SnmpMibSubRequest req, int depth)
- throws SnmpStatusException {
-
- final boolean isnew = req.isNewEntry();
- final SnmpMibSubRequest r = req;
-
- // if the entry does not exists, then registers an error for
- // each varbind involved (nb: should not happen, the error
- // should have been registered earlier)
- if (isnew) {
- SnmpVarBind var;
- for (Enumeration e= r.getElements(); e.hasMoreElements();) {
- var = e.nextElement();
- r.registerGetException(var,new SnmpStatusException(SnmpStatusException.noSuchInstance));
- }
- }
-
- final SnmpOid oid = r.getEntryOid();
-
- // SnmpIndex index = buildSnmpIndex(oid.longValue(false), 0);
- // get(req,index,depth+1);
- //
- get(req,oid,depth+1);
- }
-
- // ---------------------------------------------------------------------
- //
- // Implements the method defined in SnmpMibNode.
- //
- // ---------------------------------------------------------------------
- /**
- * Generic handling of the check operation.
- *
The default implementation of this method is to
- *
- *
check whether a new entry must be created, and if remote
- * creation of entries is enabled, create it.
- *
call the generated
- * check(req,oid,depth+1) method.
- *
- *
- *
- * public void check(SnmpMibSubRequest req, int depth)
- * throws SnmpStatusException {
- * final SnmpOid oid = req.getEntryOid();
- * final int action = getRowAction(req,oid,depth+1);
- *
- * beginRowAction(req,oid,depth+1,action);
- * check(req,oid,depth+1);
- * }
- *
- *
You should not need to override this method in any cases, because
- * it will eventually call
- * check(SnmpMibSubRequest req, int depth) on the generated
- * derivative of SnmpMibEntry. If you need to implement
- * specific policies for minimizing the accesses made to some remote
- * underlying resources, or if you need to implement some consistency
- * checks between the different values provided in the varbind list,
- * you should then rather override
- * check(SnmpMibSubRequest req, int depth) on the generated
- * derivative of SnmpMibEntry.
- *
- *
- */
- @Override
- public void check(SnmpMibSubRequest req, int depth)
- throws SnmpStatusException {
- final SnmpOid oid = req.getEntryOid();
- final int action = getRowAction(req,oid,depth+1);
-
- if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, SnmpMibTable.class.getName(),
- "check", "Calling beginRowAction");
- }
-
- beginRowAction(req,oid,depth+1,action);
-
- if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, SnmpMibTable.class.getName(),
- "check",
- "Calling check for " + req.getSize() + " varbinds");
- }
-
- check(req,oid,depth+1);
-
- if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, SnmpMibTable.class.getName(),
- "check", "check finished");
- }
- }
-
- // ---------------------------------------------------------------------
- //
- // Implements the method defined in SnmpMibNode.
- //
- // ---------------------------------------------------------------------
- /**
- * Generic handling of the set operation.
- *
The default implementation of this method is to
- * call the generated
- * set(req,oid,depth+1) method.
- *
- *
- * public void set(SnmpMibSubRequest req, int depth)
- * throws SnmpStatusException {
- * final SnmpOid oid = req.getEntryOid();
- * final int action = getRowAction(req,oid,depth+1);
- *
- * set(req,oid,depth+1);
- * endRowAction(req,oid,depth+1,action);
- * }
- *
- *
You should not need to override this method in any cases, because
- * it will eventually call
- * set(SnmpMibSubRequest req, int depth) on the generated
- * derivative of SnmpMibEntry. If you need to implement
- * specific policies for minimizing the accesses made to some remote
- * underlying resources, or if you need to implement some consistency
- * checks between the different values provided in the varbind list,
- * you should then rather override
- * set(SnmpMibSubRequest req, int depth) on the generated
- * derivative of SnmpMibEntry.
- *
- *
- */
- @Override
- public void set(SnmpMibSubRequest req, int depth)
- throws SnmpStatusException {
-
-
- if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, SnmpMibTable.class.getName(),
- "set", "Entering set");
- }
-
- final SnmpOid oid = req.getEntryOid();
- final int action = getRowAction(req,oid,depth+1);
-
- if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, SnmpMibTable.class.getName(),
- "set", "Calling set for " + req.getSize() + " varbinds");
- }
-
- set(req,oid,depth+1);
-
- if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, SnmpMibTable.class.getName(),
- "set", "Calling endRowAction");
- }
-
- endRowAction(req,oid,depth+1,action);
-
- if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) {
- SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, SnmpMibTable.class.getName(),
- "set", "RowAction finished");
- }
-
- }
-
- /**
- * Add a new entry in this SnmpMibTable.
- * Also triggers the addEntryCB() callback of the
- * {@link com.sun.jmx.snmp.agent.SnmpTableEntryFactory} interface
- * if this node is bound to a factory.
- *
- * This method assumes that the given entry will not be registered.
- * If the entry is going to be registered, or if ObjectName's are
- * required, then
- * {@link com.sun.jmx.snmp.agent.SnmpMibTable#addEntry(SnmpOid,
- * ObjectName, Object)} should be preferred.
- * This function is mainly provided for backward compatibility.
- *
- *
- * @param rowOid The SnmpOid identifying the table
- * row to be added.
- * @param entry The entry to add.
- *
- * @exception SnmpStatusException The entry couldn't be added
- * at the position identified by the given
- * rowOid, or this version of the metadata
- * requires ObjectName's.
- */
- // public void addEntry(SnmpIndex index, Object entry)
- public void addEntry(SnmpOid rowOid, Object entry)
- throws SnmpStatusException {
-
- addEntry(rowOid, null, entry);
- }
-
- /**
- * Add a new entry in this SnmpMibTable.
- * Also triggers the addEntryCB() callback of the
- * {@link com.sun.jmx.snmp.agent.SnmpTableEntryFactory} interface
- * if this node is bound to a factory.
- *
- *
- * @param oid The SnmpOid identifying the table
- * row to be added.
- *
- * @param name The ObjectName with which this entry is registered.
- * This parameter can be omitted if isRegistrationRequired()
- * return false.
- *
- * @param entry The entry to add.
- *
- * @exception SnmpStatusException The entry couldn't be added
- * at the position identified by the given
- * rowOid, or if this version of the metadata
- * requires ObjectName's, and the given name is null.
- */
- // protected synchronized void addEntry(SnmpIndex index, ObjectName name,
- // Object entry)
- public synchronized void addEntry(SnmpOid oid, ObjectName name,
- Object entry)
- throws SnmpStatusException {
-
- if (isRegistrationRequired() == true && name == null)
- throw new SnmpStatusException(SnmpStatusException.badValue);
-
- if (size == 0) {
- // indexes.addElement(index);
- // XX oids.addElement(oid);
- insertOid(0,oid);
- if (entries != null)
- entries.addElement(entry);
- if (entrynames != null)
- entrynames.addElement(name);
- size++;
-
- // triggers callbacks on the entry factory
- //
- if (factory != null) {
- try {
- factory.addEntryCb(0,oid,name,entry,this);
- } catch (SnmpStatusException x) {
- removeOid(0);
- if (entries != null)
- entries.removeElementAt(0);
- if (entrynames != null)
- entrynames.removeElementAt(0);
- throw x;
- }
- }
-
- // sends the notifications
- //
- sendNotification(SnmpTableEntryNotification.SNMP_ENTRY_ADDED,
- (new Date()).getTime(), entry, name);
- return;
- }
-
- // Get the insertion position ...
- //
- int pos= 0;
- // bug jaw.00356.B : use oid rather than index to get the
- // insertion point.
- //
- pos= getInsertionPoint(oid,true);
- if (pos == size) {
- // Add a new element in the vectors ...
- //
- // indexes.addElement(index);
- // XX oids.addElement(oid);
- insertOid(tablecount,oid);
- if (entries != null)
- entries.addElement(entry);
- if (entrynames != null)
- entrynames.addElement(name);
- size++;
- } else {
- // Insert new element ...
- //
- try {
- // indexes.insertElementAt(index, pos);
- // XX oids.insertElementAt(oid, pos);
- insertOid(pos,oid);
- if (entries != null)
- entries.insertElementAt(entry, pos);
- if (entrynames != null)
- entrynames.insertElementAt(name,pos);
- size++;
- } catch(ArrayIndexOutOfBoundsException e) {
- }
- }
-
- // triggers callbacks on the entry factory
- //
- if (factory != null) {
- try {
- factory.addEntryCb(pos,oid,name,entry,this);
- } catch (SnmpStatusException x) {
- removeOid(pos);
- if (entries != null)
- entries.removeElementAt(pos);
- if (entrynames != null)
- entrynames.removeElementAt(pos);
- throw x;
- }
- }
-
- // sends the notifications
- //
- sendNotification(SnmpTableEntryNotification.SNMP_ENTRY_ADDED,
- (new Date()).getTime(), entry, name);
- }
-
- /**
- * Remove the specified entry from the table.
- * Also triggers the removeEntryCB() callback of the
- * {@link com.sun.jmx.snmp.agent.SnmpTableEntryFactory} interface
- * if this node is bound to a factory.
- *
- *
- * @param rowOid The SnmpOid identifying the table
- * row to remove.
- *
- * @param entry The entry to be removed. This parameter is not used
- * internally, it is simply passed along to the
- * removeEntryCB() callback.
- *
- * @exception SnmpStatusException if the specified entry couldn't
- * be removed (if the given rowOid is not
- * valid for instance).
- */
- public synchronized void removeEntry(SnmpOid rowOid, Object entry)
- throws SnmpStatusException {
- int pos = findObject(rowOid);
- if (pos == -1)
- return;
- removeEntry(pos,entry);
- }
-
- /**
- * Remove the specified entry from the table.
- * Also triggers the removeEntryCB() callback of the
- * {@link com.sun.jmx.snmp.agent.SnmpTableEntryFactory} interface
- * if this node is bound to a factory.
- *
- *
- * @param rowOid The SnmpOid identifying the table
- * row to remove.
- *
- * @exception SnmpStatusException if the specified entry couldn't
- * be removed (if the given rowOid is not
- * valid for instance).
- */
- public void removeEntry(SnmpOid rowOid)
- throws SnmpStatusException {
- int pos = findObject(rowOid);
- if (pos == -1)
- return;
- removeEntry(pos,null);
- }
-
- /**
- * Remove the specified entry from the table.
- * Also triggers the removeEntryCB() callback of the
- * {@link com.sun.jmx.snmp.agent.SnmpTableEntryFactory} interface
- * if this node is bound to a factory.
- *
- *
- * @param pos The position of the entry in the table.
- *
- * @param entry The entry to be removed. This parameter is not used
- * internally, it is simply passed along to the
- * removeEntryCB() callback.
- *
- * @exception SnmpStatusException if the specified entry couldn't
- * be removed.
- */
- public synchronized void removeEntry(int pos, Object entry)
- throws SnmpStatusException {
- if (pos == -1)
- return;
- if (pos >= size) return;
-
- Object obj = entry;
- if (entries != null && entries.size() > pos) {
- obj = entries.elementAt(pos);
- entries.removeElementAt(pos);
- }
-
- ObjectName name = null;
- if (entrynames != null && entrynames.size() > pos) {
- name = entrynames.elementAt(pos);
- entrynames.removeElementAt(pos);
- }
-
- final SnmpOid rowOid = tableoids[pos];
- removeOid(pos);
- size --;
-
- if (obj == null) obj = entry;
-
- if (factory != null)
- factory.removeEntryCb(pos,rowOid,name,obj,this);
-
- sendNotification(SnmpTableEntryNotification.SNMP_ENTRY_REMOVED,
- (new Date()).getTime(), obj, name);
- }
-
- /**
- * Get the entry corresponding to the specified rowOid.
- *
- *
- * @param rowOid The SnmpOid identifying the
- * row to be retrieved.
- *
- * @return The entry.
- *
- * @exception SnmpStatusException There is no entry with the specified
- * rowOid in the table.
- */
- public synchronized Object getEntry(SnmpOid rowOid)
- throws SnmpStatusException {
- int pos= findObject(rowOid);
- if (pos == -1)
- throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
- return entries.elementAt(pos);
- }
-
- /**
- * Get the ObjectName of the entry corresponding to the
- * specified rowOid.
- * The result of this method is only meaningful if
- * isRegistrationRequired() yields true.
- *
- *
- * @param rowOid The SnmpOid identifying the table
- * row whose ObjectName we want to retrieve.
- *
- * @return The object name of the entry.
- *
- * @exception SnmpStatusException There is no entry with the specified
- * rowOid in the table.
- */
- public synchronized ObjectName getEntryName(SnmpOid rowOid)
- throws SnmpStatusException {
- int pos = findObject(rowOid);
- if (entrynames == null) return null;
- if (pos == -1 || pos >= entrynames.size())
- throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
- return entrynames.elementAt(pos);
- }
-
- /**
- * Return the entries stored in this table SnmpMibTable.
- *
- * If the subclass generated by mibgen uses the generic way to access
- * the entries (i.e. if it goes through the MBeanServer) then some of
- * the entries may be null. It all depends whether a non
- * null entry was passed to addEntry().
- * Otherwise, if it uses the standard way (access the entry directly
- * through their standard MBean interface) this array will contain all
- * the entries.
- *
- * @return The entries array.
- */
- public Object[] getBasicEntries() {
- Object[] array= new Object[size];
- entries.copyInto(array);
- return array;
- }
-
- /**
- * Get the size of the table.
- *
- * @return The number of entries currently registered in this table.
- */
- public int getSize() {
- return size;
- }
-
- // EVENT STUFF
- //------------
-
- /**
- * Enable to add an SNMP entry listener to this
- * SnmpMibTable.
- *
- *
- * @param listener The listener object which will handle the
- * notifications emitted by the registered MBean.
- *
- * @param filter The filter object. If filter is null, no filtering
- * will be performed before handling notifications.
- *
- * @param handback The context to be sent to the listener when a
- * notification is emitted.
- *
- * @exception IllegalArgumentException Listener parameter is null.
- */
- @Override
- public synchronized void
- addNotificationListener(NotificationListener listener,
- NotificationFilter filter, Object handback) {
-
- // Check listener
- //
- if (listener == null) {
- throw new java.lang.IllegalArgumentException
- ("Listener can't be null") ;
- }
-
- // looking for listener in handbackTable
- //
- Vector