com.sun.jmx.snmp.SnmpStatusException
SnmpStatusException is described in the javadoc comments as:
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.
version: 3.2 11/05/98 author: Sun Microsystems, Inc
Where is this exception thrown?
Following, is a list of exception messages cross-referenced to the source code responsible for throwing them. Click on the method link to view the code and see how the exception is thrown.
- The message 'com.sun.jmx.snmp.SnmpStatusException: ...' is thrown within the method:
com.sun.jmx.snmp.SnmpCounter64.nextOid(long[], int) - The message 'com.sun.jmx.snmp.SnmpStatusException: ...' is thrown within the method:
com.sun.jmx.snmp.SnmpCounter64.toOid(long[], int) - The message 'com.sun.jmx.snmp.SnmpStatusException: ...' is thrown within the method:
com.sun.jmx.snmp.SnmpInt.nextOid(long[], int) - The message 'com.sun.jmx.snmp.SnmpStatusException: ...' is thrown within the method:
com.sun.jmx.snmp.SnmpInt.toOid(long[], int) - The message 'com.sun.jmx.snmp.SnmpStatusException: ...' is thrown within the method:
com.sun.jmx.snmp.SnmpIpAddress.nextOid(long[], int) - The message 'com.sun.jmx.snmp.SnmpStatusException: ...' is thrown within the method:
com.sun.jmx.snmp.SnmpIpAddress.toOid(long[], int) - The message 'com.sun.jmx.snmp.SnmpStatusException: ...' is thrown within the method:
com.sun.jmx.snmp.SnmpMessage.decodeSnmpPdu() - The message 'com.sun.jmx.snmp.SnmpStatusException: ...' is thrown within the method:
com.sun.jmx.snmp.SnmpOid.getOidArc(int) - The message 'com.sun.jmx.snmp.SnmpStatusException: ...' is thrown within the method:
com.sun.jmx.snmp.SnmpOid.nextOid(long[], int) - The message 'com.sun.jmx.snmp.SnmpStatusException: ...' is thrown within the method:
com.sun.jmx.snmp.SnmpOid.resolveVarName(String) - The message 'com.sun.jmx.snmp.SnmpStatusException: ...' is thrown within the method:
com.sun.jmx.snmp.SnmpOid.toOid(long[], int) - The message 'com.sun.jmx.snmp.SnmpStatusException: ...' is thrown within the method:
com.sun.jmx.snmp.SnmpOidDatabaseSupport.resolveVarName(String) - The message 'com.sun.jmx.snmp.SnmpStatusException: ...' is thrown within the method:
com.sun.jmx.snmp.SnmpOidDatabaseSupport.resolveVarOid(String) - The message 'com.sun.jmx.snmp.SnmpStatusException: ...' is thrown within the method:
com.sun.jmx.snmp.SnmpParameters.encodeAuthentication(int) - The message 'com.sun.jmx.snmp.SnmpStatusException: ...' is thrown within the method:
com.sun.jmx.snmp.SnmpString.nextOid(long[], int) - The message 'com.sun.jmx.snmp.SnmpStatusException: ...' is thrown within the method:
com.sun.jmx.snmp.SnmpString.toOid(long[], int) - The message 'com.sun.jmx.snmp.SnmpStatusException: ...' is thrown within the method:
com.sun.jmx.snmp.SnmpStringFixed.nextOid(int, long[], int) - The message 'com.sun.jmx.snmp.SnmpStatusException: ...' is thrown within the method:
com.sun.jmx.snmp.SnmpStringFixed.toOid(int, long[], int) - The message 'com.sun.jmx.snmp.SnmpStatusException: ...' is thrown within the method:
com.sun.jmx.snmp.SnmpV3Message.decodeSnmpPdu() - The message 'com.sun.jmx.snmp.SnmpStatusException: ...' is thrown within the method:
com.sun.jmx.snmp.SnmpVarBind.resolveVarName(String) - The message 'com.sun.jmx.snmp.SnmpStatusException: ...' is thrown within the method:
com.sun.jmx.snmp.agent.SnmpErrorHandlerAgent.check(SnmpMibRequest) - The message 'com.sun.jmx.snmp.SnmpStatusException: ...' is thrown within the method:
com.sun.jmx.snmp.agent.SnmpErrorHandlerAgent.get(SnmpMibRequest) - The message 'com.sun.jmx.snmp.SnmpStatusException: ...' is thrown within the method:
com.sun.jmx.snmp.agent.SnmpErrorHandlerAgent.getBulk(SnmpMibRequest, int, int) - The message 'com.sun.jmx.snmp.SnmpStatusException: ...' is thrown within the method:
com.sun.jmx.snmp.agent.SnmpErrorHandlerAgent.getNext(SnmpMibRequest) - The message 'com.sun.jmx.snmp.SnmpStatusException: ...' is thrown within the method:
com.sun.jmx.snmp.agent.SnmpErrorHandlerAgent.set(SnmpMibRequest) - The message 'com.sun.jmx.snmp.SnmpStatusException: ...' is thrown within the method:
com.sun.jmx.snmp.agent.SnmpGenericObjectServer.check(SnmpGenericMetaServer, ObjectName, SnmpValue, long, Object) - The message 'com.sun.jmx.snmp.SnmpStatusException: ...' is thrown within the method:
com.sun.jmx.snmp.agent.SnmpGenericObjectServer.get(SnmpGenericMetaServer, ObjectName, long, Object) - The message 'com.sun.jmx.snmp.SnmpStatusException: ...' is thrown within the method:
com.sun.jmx.snmp.agent.SnmpGenericObjectServer.registerTableEntry(SnmpMibTable, SnmpOid, ObjectName, Object) - The message 'com.sun.jmx.snmp.SnmpStatusException: ...' is thrown within the method:
com.sun.jmx.snmp.agent.SnmpGenericObjectServer.set(SnmpGenericMetaServer, ObjectName, SnmpValue, long, Object) - The message 'com.sun.jmx.snmp.SnmpStatusException: ...' is thrown within the method:
com.sun.jmx.snmp.agent.SnmpMib.getGetNextHandlers(SnmpMibRequest) - The message 'com.sun.jmx.snmp.SnmpStatusException: ...' is thrown within the method:
com.sun.jmx.snmp.agent.SnmpMibGroup.findHandlingNode(SnmpVarBind, long[], int, SnmpRequestTree) - The message 'com.sun.jmx.snmp.SnmpStatusException: ...' is thrown within the method:
com.sun.jmx.snmp.agent.SnmpMibOid.findHandlingNode(SnmpVarBind, long[], int, SnmpRequestTree) - The message 'com.sun.jmx.snmp.SnmpStatusException: ...' is thrown within the method:
com.sun.jmx.snmp.agent.SnmpMibTable.addEntry(SnmpOid, ObjectName, Object) - The message 'com.sun.jmx.snmp.SnmpStatusException: ...' is thrown within the method:
com.sun.jmx.snmp.agent.SnmpMibTable.findHandlingNode(SnmpVarBind, long[], int, SnmpRequestTree) - The message 'com.sun.jmx.snmp.SnmpStatusException: ...' is thrown within the method:
com.sun.jmx.snmp.agent.SnmpMibTable.getEntry(SnmpOid) - The message 'com.sun.jmx.snmp.SnmpStatusException: ...' is thrown within the method:
com.sun.jmx.snmp.agent.SnmpMibTable.getEntryName(SnmpOid) - The message 'com.sun.jmx.snmp.SnmpStatusException: ...' is thrown within the method:
com.sun.jmx.snmp.agent.SnmpMibTable.getInsertionPoint(SnmpOid, boolean) - The message 'com.sun.jmx.snmp.SnmpStatusException: ...' is thrown within the method:
com.sun.jmx.snmp.agent.SnmpMibTable.mapRowStatus(SnmpOid, SnmpVarBind, Object) - The message 'com.sun.jmx.snmp.SnmpStatusException: ...' is thrown within the method:
com.sun.jmx.snmp.agent.SnmpTableSupport.addEntryCb(int, SnmpOid, ObjectName, Object, SnmpMibTable) - The message 'com.sun.jmx.snmp.SnmpStatusException: ...' is thrown within the method:
com.sun.jmx.snmp.daemon.SnmpAdaptorServer.sendTrapPdu(InetAddress, SnmpPduPacket) - The message 'com.sun.jmx.snmp.SnmpStatusException: ...' is thrown within the method:
com.sun.jmx.snmp.daemon.SnmpAdaptorServer.sendTrapPdu(SnmpPduPacket) - The message 'com.sun.jmx.snmp.SnmpStatusException: ...' is thrown within the method:
com.sun.jmx.snmp.daemon.SnmpInformRequest.sendPdu() - The message 'com.sun.jmx.snmp.SnmpStatusException: Inform request already in progress.' is thrown within the method:
com.sun.jmx.snmp.daemon.SnmpInformRequest.start(SnmpVarBindList) - The message 'com.sun.jmx.snmp.SnmpStatusException: Invalid encoding' is thrown within the method:
com.sun.jmx.snmp.SnmpMessage.decodeMessage(byte[], int) - The message 'com.sun.jmx.snmp.SnmpStatusException: Invalid encoding' is thrown within the method:
com.sun.jmx.snmp.SnmpMessage.getRequestId(byte[]) - The message 'com.sun.jmx.snmp.SnmpStatusException: Invalid encoding' is thrown within the method:
com.sun.jmx.snmp.SnmpMsg.getProtocolVersion(byte[]) - The message 'com.sun.jmx.snmp.SnmpStatusException: Invalid encoding' is thrown within the method:
com.sun.jmx.snmp.SnmpV3Message.decodeMessage(byte[], int) - The message 'com.sun.jmx.snmp.SnmpStatusException: Invalid encoding' is thrown within the method:
com.sun.jmx.snmp.SnmpV3Message.getRequestId(byte[]) - The message 'com.sun.jmx.snmp.SnmpStatusException: Invalid pdu type ...' is thrown within the method:
com.sun.jmx.snmp.SnmpMessage.encodeSnmpPdu(SnmpPdu, int) - The message 'com.sun.jmx.snmp.SnmpStatusException: Invalid pdu type ...' is thrown within the method:
com.sun.jmx.snmp.SnmpV3Message.encodeSnmpPdu(SnmpPdu, int) - The message 'com.sun.jmx.snmp.SnmpStatusException: Invalid value ...' is thrown within the method:
com.sun.jmx.snmp.SnmpMsg.encodeVarBindValue(BerEncoder, SnmpValue) - The message 'com.sun.jmx.snmp.SnmpStatusException: Invalid value for SNMP v1 : ...' is thrown within the method:
com.sun.jmx.snmp.SnmpMsg.encodeVarBindValue(BerEncoder, SnmpValue) - The message 'com.sun.jmx.snmp.SnmpStatusException: SNMP adaptor is not ONLINE or session is dead...' is thrown within the method:
com.sun.jmx.snmp.daemon.SnmpSession.addInformRequest(SnmpInformRequest) - The message 'com.sun.jmx.snmp.SnmpStatusException: SNMP adaptor server not ONLINE' is thrown within the method:
com.sun.jmx.snmp.daemon.SnmpSession.makeAsyncRequest(InetAddress, String, SnmpInformHandler, SnmpVarBindList, int) - The message 'com.sun.jmx.snmp.SnmpStatusException: The specified SnmpOidTable does not exist in this SnmpOidDatabase' is thrown within the method:
com.sun.jmx.snmp.SnmpOidDatabaseSupport.remove(SnmpOidTable) - The message 'com.sun.jmx.snmp.SnmpStatusException: Variable name < ...> not found in Oid repository' is thrown within the method:
com.sun.jmx.snmp.SnmpOidTableSupport.resolveVarName(String) - The message 'com.sun.jmx.snmp.SnmpStatusException: Variable oid < ...> not found in Oid repository' is thrown within the method:
com.sun.jmx.snmp.SnmpOidTableSupport.resolveVarOid(String)
How is this exception thrown?
The following sub-sections identify where this exception is thrown, and how (or why) the code is throwing the exception.
Any source code quoted in this section is subject to the Java Research License unless stated otherwise.
com.sun.jmx.snmp.SnmpCounter64.nextOid(long[], int)
/** * 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; } }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.SnmpCounter64.toOid(long[], int)
/** * Extracts the counter from an index OID and returns its * value converted as an <CODE>SnmpOid</CODE>. * @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); } }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.SnmpInt.nextOid(long[], int)
/** * 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; } }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.SnmpInt.toOid(long[], int)
/** * Extracts the integer from an index OID and returns its * value converted as an <CODE>SnmpOid</CODE>. * @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); } }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.SnmpIpAddress.nextOid(long[], int)
/** * 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); } }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.SnmpIpAddress.toOid(long[], int)
/** * Extracts the ip address from an index OID and returns its * value converted as an <CODE>SnmpOid</CODE>. * @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); } }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.SnmpMessage.decodeSnmpPdu()
/** * Gets the PDU encoded in this message. * <P> * 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 { 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 (isDebugOn()) { debug('decodeSnmpPdu', e); } throw new SnmpStatusException(snmpRspWrongEncoding); } catch (IllegalArgumentException e) { if (isDebugOn()) { debug('decodeSnmpPdu', e); } throw new SnmpStatusException(snmpRspWrongEncoding); } pdu.version = version; pdu.community = community; pdu.address = address; pdu.port = port; return pdu; }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.SnmpOid.getOidArc(int)
/** * Returns the value of the OID arc found at the requested position * in the <CODE>components</CODE> array. The first element is at * position <code>0</code>. * @param pos The position at which the OID arc should be peeked. * @return The OID arc found at the requested position. * @exception SnmpStatusException No OID arc was found at the requested * position. */ public final long getOidArc(int pos) throws SnmpStatusException { try { return components[pos]; } catch (Exception e) { throw new SnmpStatusException(SnmpStatusException.noAccess); } }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.SnmpOid.nextOid(long[], int)
/** * Scans an index OID, skips the OID 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 OID 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 idCount = (int) index[start++]; start += idCount; if (start <= index.length) { return start; } else { throw new SnmpStatusException(SnmpStatusException.noSuchName); } } catch (IndexOutOfBoundsException e) { throw new SnmpStatusException(SnmpStatusException.noSuchName); } }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.SnmpOid.resolveVarName(String)
/** * Resolves a MIB variable <CODE>String</CODE> with the MIB database. * @param s The variable name to resolve. * @exception SnmpStatusException If the variable is not found in the MIB database. */ public String resolveVarName(String s) throws SnmpStatusException { int index = s.indexOf('.'); try { return handleLong(s, index); } catch (NumberFormatException e) { } if (meta == null) throw new SnmpStatusException(SnmpStatusException.noSuchName); if (index <= 0) { SnmpOidRecord rec = meta.resolveVarName(s); return rec.getOid(); } else { SnmpOidRecord rec = meta.resolveVarName(s.substring(0, index)); return (rec.getOid() + s.substring(index)); } }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.SnmpOid.toOid(long[], int)
/** * Extracts the OID from an index OID and returns its * value converted as an <CODE>SnmpOid</CODE>. * @param index The index array. * @param start The position in the index array. * @return The OID representing the OID value. * @exception SnmpStatusException There is no OID 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 idCount = (int) index[start++]; long[] ids = new long[idCount]; for (int i = 0; i < idCount; i++) { ids[i] = index[start + i]; } return new SnmpOid(ids); } catch (IndexOutOfBoundsException e) { throw new SnmpStatusException(SnmpStatusException.noSuchName); } }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.SnmpOidDatabaseSupport.resolveVarName(String)
/** * Searches for a MIB variable given its logical name and returns an <CODE>SnmpOidRecord</CODE> * object containing information on the variable. * @param name The name of the MIB variable. * @return The <CODE>SnmpOidRecord</CODE> object containing information on the variable. * @exception SnmpStatusException The specified name does not exist in this <CODE>SnmpOidDatabase</CODE> */ public SnmpOidRecord resolveVarName(String name) throws SnmpStatusException { for (int i = 0; i < tables.size(); i++) { try { return (((SnmpOidTable) tables.elementAt(i)).resolveVarName(name)); } catch (SnmpStatusException e) { if (i == tables.size() - 1) { throw new SnmpStatusException(e.getMessage()); } } } return null; }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.SnmpOidDatabaseSupport.resolveVarOid(String)
/** * Searches for a MIB variable given its OID and returns an <CODE>SnmpOidRecord</CODE> object containing * information on the variable. * @param oid The OID of the MIB variable. * @return The <CODE>SnmpOidRecord</CODE> object containing information on the variable. * @exception SnmpStatusException The specified oid does not exist in this <CODE>SnmpOidDatabase</CODE>. */ public SnmpOidRecord resolveVarOid(String oid) throws SnmpStatusException { for (int i = 0; i < tables.size(); i++) { try { return (((SnmpOidTable) tables.elementAt(i)).resolveVarOid(oid)); } catch (SnmpStatusException e) { if (i == tables.size() - 1) { throw new SnmpStatusException(e.getMessage()); } } } return null; }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.SnmpParameters.encodeAuthentication(int)
/** * For SNMP Runtime internal use only. */ public byte[] encodeAuthentication(int snmpCmd) throws SnmpStatusException { try { if (snmpCmd == pduSetRequestPdu) return _writeCommunity.getBytes('8859_1'); else if (snmpCmd == pduInformRequestPdu) return _informCommunity.getBytes('8859_1'); else return _readCommunity.getBytes('8859_1'); } catch (UnsupportedEncodingException e) { throw new SnmpStatusException(e.getMessage()); } }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.SnmpString.nextOid(long[], int)
/** * 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); } }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.SnmpString.toOid(long[], int)
/** * Extracts the string from an index OID and returns its * value converted as an <CODE>SnmpOid</CODE>. * @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); } }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.SnmpStringFixed.nextOid(int, long[], int)
/** * 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 <CODE>start</CODE> 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; }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.SnmpStringFixed.toOid(int, long[], int)
/** * Extracts the fixed-string from an index OID and returns its * value converted as an <CODE>SnmpOid</CODE>. * @param l The number of successive array elements to be retreived * in order to construct the OID. * These elements are retreived starting at the <CODE>start</CODE> 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); } }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.SnmpV3Message.decodeSnmpPdu()
/** * Gets the PDU encoded in this message. * <P> * 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 (isDebugOn()) { debug('decodeSnmpPdu', e); } throw new SnmpStatusException(snmpRspWrongEncoding); } 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 (isTraceOn()) { trace('decodeSnmpPdu', 'Unmarshalled pdu : \n' + 'type :' + pdu.type + '\n' + 'version :' + pdu.version + '\n' + 'requestId :' + pdu.requestId + '\n' + 'msgId :' + pdu.msgId + '\n' + 'msgMaxSize :' + pdu.msgMaxSize + '\n' + 'msgFlags :' + pdu.msgFlags + '\n' + 'msgSecurityModel :' + pdu.msgSecurityModel + '\n' + 'contextEngineId :' + pdu.contextEngineId + '\n' + 'contextName :' + pdu.contextName + '\n'); } return pdu; }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.SnmpVarBind.resolveVarName(String)
/** * Consults the MIB table storage to resolve the name to its OID type structure. * @param name The MIB variable name or a dot-formatted OID <CODE>String</CODE>. * @return The <CODE>SnmpOidRecord</CODE> object containing information on the MIB variable. * @exception SnmpStatusException An error occurred while resolving the MIB variable name. */ public SnmpOidRecord resolveVarName(String name) throws SnmpStatusException { SnmpOidTable mibTable = oid.getSnmpOidTable(); if (mibTable == null) throw new SnmpStatusException(SnmpStatusException.noSuchName); int index = name.indexOf('.'); if (index < 0) { return mibTable.resolveVarName(name); } else { return mibTable.resolveVarOid(name); } }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.agent.SnmpErrorHandlerAgent.check(SnmpMibRequest)
/** * Checks if a <CODE>set</CODE> operation can be performed. * If the operation can not be performed, the method should emit a * <CODE>SnmpStatusException</CODE>. * @param inRequest The SnmpMibRequest object holding the list of variables to * be set. This list is composed of * <CODE>SnmpVarBind</CODE> objects. * @exception SnmpStatusException The <CODE>set</CODE> operation * cannot be performed. */ public void check(SnmpMibRequest inRequest) throws SnmpStatusException { if (isDebugOn()) trace('check', 'Check in Exception'); throw new SnmpStatusException(SnmpDefinitions.snmpRspNotWritable); }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.agent.SnmpErrorHandlerAgent.get(SnmpMibRequest)
/** * Processes a <CODE>get</CODE> 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 occured during the operation. */ public void get(SnmpMibRequest inRequest) throws SnmpStatusException { if (isDebugOn()) trace('get', 'Get in Exception'); if (inRequest.getVersion() == SnmpDefinitions.snmpVersionOne) throw new SnmpStatusException(SnmpStatusException.noSuchName); Enumeration l = inRequest.getElements(); while (l.hasMoreElements()) { SnmpVarBind varbind = (SnmpVarBind) l.nextElement(); varbind.setNoSuchObject(); } }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.agent.SnmpErrorHandlerAgent.getBulk(SnmpMibRequest, int, int)
/** * Processes a <CODE>getBulk</CODE> 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 occured during the operation. */ public void getBulk(SnmpMibRequest inRequest, int nonRepeat, int maxRepeat) throws SnmpStatusException { if (isDebugOn()) trace('getBulk', 'GetBulk in Exception'); if (inRequest.getVersion() == SnmpDefinitions.snmpVersionOne) throw new SnmpStatusException(SnmpDefinitions.snmpRspGenErr, 0); Enumeration l = inRequest.getElements(); while (l.hasMoreElements()) { SnmpVarBind varbind = (SnmpVarBind) l.nextElement(); varbind.setEndOfMibView(); } }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.agent.SnmpErrorHandlerAgent.getNext(SnmpMibRequest)
/** * Processes a <CODE>getNext</CODE> 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 occured during the operation. */ public void getNext(SnmpMibRequest inRequest) throws SnmpStatusException { if (isDebugOn()) trace('getNext', 'GetNext in Exception'); if (inRequest.getVersion() == SnmpDefinitions.snmpVersionOne) throw new SnmpStatusException(SnmpStatusException.noSuchName); Enumeration l = inRequest.getElements(); while (l.hasMoreElements()) { SnmpVarBind varbind = (SnmpVarBind) l.nextElement(); varbind.setEndOfMibView(); } }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.agent.SnmpErrorHandlerAgent.set(SnmpMibRequest)
/** * Processes a <CODE>set</CODE> 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 occured during the operation. */ public void set(SnmpMibRequest inRequest) throws SnmpStatusException { if (isDebugOn()) trace('set', 'Set in Exception, CAN't be called'); throw new SnmpStatusException(SnmpDefinitions.snmpRspNotWritable); }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.agent.SnmpGenericObjectServer.check(SnmpGenericMetaServer, ObjectName, SnmpValue, long, Object)
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) { } 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); } }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.agent.SnmpGenericObjectServer.get(SnmpGenericMetaServer, ObjectName, long, Object)
/** * Get the value of an SNMP variable. * <b><i> * You should never need to use this method directly. * </i></b> * @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 * <code> * req.registerGetException(<i>VariableId</i>,<i>SnmpStatusException</i>) * </code> **/ 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); }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.agent.SnmpGenericObjectServer.registerTableEntry(SnmpMibTable, SnmpOid, ObjectName, Object)
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); } }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.agent.SnmpGenericObjectServer.set(SnmpGenericMetaServer, ObjectName, SnmpValue, long, Object)
/** * Set the value of an SNMP variable. * <b><i> * You should never need to use this method directly. * </i></b> * @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 * <code> * req.registerSetException(<i>VariableId</i>,<i>SnmpStatusException</i>) * </code> **/ 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); }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.agent.SnmpMib.getGetNextHandlers(SnmpMibRequest)
/** * 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 { SnmpRequestTree handlers = new SnmpRequestTree(req, false, SnmpDefinitions.pduGetNextRequestPdu); handlers.setGetNextFlag(); if (isDebugOn()) debug('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 (Enumeration e = req.getElements(); e.hasMoreElements(); index++) { var = (SnmpVarBind) e.nextElement(); SnmpOid result = null; try { if (isDebugOn()) debug('getGetNextHandlers', ' Next Oid of :' + var.oid); result = new SnmpOid(root.findNextHandlingNode(var, var.oid.longValue(false), 0, 0, handlers, checker)); if (isDebugOn()) debug('getGetNextHandlers', ' is :' + result); var.oid = result; } catch (SnmpStatusException x) { if (ver == SnmpDefinitions.snmpVersionOne) { if (isDebugOn()) debug('getGetNextHandlers', '\tThrowing exception' + x.toString()); throw new SnmpStatusException(x, index + 1); } if (isDebugOn()) debug('getGetNextHandlers', 'Exception : ' + x.getStatus()); var.setSnmpValue(SnmpVarBind.endOfMibView); } } return handlers; }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.agent.SnmpMibGroup.findHandlingNode(SnmpVarBind, long[], int, SnmpRequestTree)
void findHandlingNode(SnmpVarBind varbind, long[] oid, int depth, SnmpRequestTree handlers) throws SnmpStatusException { int length = oid.length; SnmpMibNode node = null; if (handlers == null) throw new SnmpStatusException(SnmpStatusException.snmpRspGenErr); final Object data = handlers.getUserData(); if (depth >= length) { throw new SnmpStatusException(SnmpStatusException.noAccess); } long arc = oid[depth]; if (isNestedArc(arc)) { super.findHandlingNode(varbind, oid, depth, handlers); return; } else if (isTable(arc)) { SnmpMibTable table = getTable(arc); table.findHandlingNode(varbind, oid, depth + 1, handlers); } else { validateVarId(arc, data); if (depth + 2 > length) throw noSuchInstanceException; if (depth + 2 < length) throw noSuchInstanceException; if (oid[depth + 1] != 0L) throw noSuchInstanceException; handlers.add(this, depth, varbind); } }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.agent.SnmpMibOid.findHandlingNode(SnmpVarBind, long[], int, SnmpRequestTree)
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) { throw noSuchObjectException; } else if (depth == length) { throw noSuchInstanceException; } else { final SnmpMibNode child = getChild(oid[depth]); if (child == null) handlers.add(this, depth, varbind); else child.findHandlingNode(varbind, oid, depth + 1, handlers); } }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.agent.SnmpMibTable.addEntry(SnmpOid, ObjectName, Object)
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) { insertOid(0, oid); if (entries != null) entries.addElement(entry); if (entrynames != null) entrynames.addElement(name); size++; 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; } } sendNotification(SnmpTableEntryNotification.SNMP_ENTRY_ADDED, (new Date()).getTime(), entry, name); return; } int pos = 0; pos = getInsertionPoint(oid, true); if (pos == size) { insertOid(tablecount, oid); if (entries != null) entries.addElement(entry); if (entrynames != null) entrynames.addElement(name); size++; } else { try { insertOid(pos, oid); if (entries != null) entries.insertElementAt(entry, pos); if (entrynames != null) entrynames.insertElementAt(name, pos); size++; } catch (ArrayIndexOutOfBoundsException e) { } } 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; } } sendNotification(SnmpTableEntryNotification.SNMP_ENTRY_ADDED, (new Date()).getTime(), entry, name); }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.agent.SnmpMibTable.findHandlingNode(SnmpVarBind, long[], int, SnmpRequestTree)
final synchronized void findHandlingNode(SnmpVarBind varbind, long[] oid, int depth, SnmpRequestTree handlers) throws SnmpStatusException { final int length = oid.length; if (handlers == null) throw new SnmpStatusException(SnmpStatusException.snmpRspGenErr); if (depth >= length) throw new SnmpStatusException(SnmpStatusException.noAccess); if (oid[depth] != nodeId) throw new SnmpStatusException(SnmpStatusException.noAccess); if (depth + 2 >= length) throw new SnmpStatusException(SnmpStatusException.noAccess); final SnmpOid entryoid = new SnmpEntryOid(oid, depth + 2); final Object data = handlers.getUserData(); final boolean hasEntry = contains(entryoid, data); if (!hasEntry) { if (!handlers.isCreationAllowed()) throw noSuchInstanceException; else if (!isCreationEnabled()) throw new SnmpStatusException(SnmpStatusException.snmpRspNoAccess); } final long var = oid[depth + 1]; if (hasEntry) { validateVarEntryId(entryoid, var, data); } if (handlers.isSetRequest() && isRowStatus(entryoid, var, data)) handlers.add(this, depth, entryoid, varbind, (!hasEntry), varbind); else handlers.add(this, depth, entryoid, varbind, (!hasEntry)); }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.agent.SnmpMibTable.getEntry(SnmpOid)
/** * Get the entry corresponding to the specified rowOid. * * @param rowOid The <CODE>SnmpOid</CODE> identifying the * row to be retrieved. * @return The entry. * @exception SnmpStatusException There is no entry with the specified * <code>rowOid</code> 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); }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.agent.SnmpMibTable.getEntryName(SnmpOid)
/** * 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 <CODE>SnmpOid</CODE> 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 * <code>rowOid</code> 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 (ObjectName) entrynames.elementAt(pos); }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.agent.SnmpMibTable.getInsertionPoint(SnmpOid, boolean)
/** * Search the position at which the given oid should be inserted * in the OID table (tableoids). * * @param oid The OID we would like to insert. * @param fail Tells whether a SnmpStatusException must be generated * if the given OID is already present in the table. * @return The position at which the OID should be inserted in * the table. When the OID is found, it returns the next * position. Note that it is not valid to insert twice the * same OID. This feature is only an optimization to improve * the getNextOid() behaviour. * @exception SnmpStatusException if the OID is already present in the * table and <code>fail</code> is <code>true</code>. **/ private final int getInsertionPoint(SnmpOid oid, boolean fail) throws SnmpStatusException { final int failStatus = SnmpStatusException.snmpRspNotWritable; int low = 0; int max = size - 1; SnmpOid pos; int comp; int curr = low + (max - low) / 2; while (low <= max) { pos = tableoids[curr]; comp = oid.compareTo(pos); if (comp == 0) { if (fail) throw new SnmpStatusException(failStatus, curr); else return curr + 1; } if (comp > 0) { low = curr + 1; } else { max = curr - 1; } curr = low + (max - low) / 2; } return curr; }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.agent.SnmpMibTable.mapRowStatus(SnmpOid, SnmpVarBind, Object)
/** * Map the value of the <code>vbstatus</code> varbind to the * corresponding RowStatus code defined in * {@link com.sun.jmx.snmp.EnumRowStatus}. * These codes correspond to RowStatus codes as defined in RFC 2579, * plus the <i>unspecified</i> value which is SNMP Runtime specific. * By default, this method assumes that the control variable is * an Integer, and it simply returns its value without further * analysis. * If this table was defined using SMIv2, and if it contains a * control variable with RowStatus syntax, <code>mibgen</code> * will generate a non default implementation for this method. * You will have to redefine this method if you need to implement * control variables that do not conform to RFC 2579 RowStatus * TEXTUAL-CONVENTION. * * @param rowOid The <CODE>SnmpOid</CODE> identifying the table * row involved in the operation. * @param vbstatus The SnmpVarBind containing the value of the control * variable, as identified by the isRowStatus() method. * @param userData A contextual object containing user-data. * This object is allocated through the <code> * {@link com.sun.jmx.snmp.agent.SnmpUserDataFactory}</code> * for each incoming SNMP request. * @return The RowStatus code mapped from the value contained * in <code>vbstatus</code>. * @exception SnmpStatusException if the value of the control variable * could not be mapped to a RowStatus code. * @see com.sun.jmx.snmp.EnumRowStatus **/ protected int mapRowStatus(SnmpOid rowOid, SnmpVarBind vbstatus, Object userData) throws SnmpStatusException { final SnmpValue rsvalue = vbstatus.value; if (rsvalue instanceof SnmpInt) return ((SnmpInt) rsvalue).intValue(); else throw new SnmpStatusException(SnmpStatusException.snmpRspInconsistentValue); }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.agent.SnmpTableSupport.addEntryCb(int, SnmpOid, ObjectName, Object, SnmpMibTable)
/** * This callback is called by the associated metadata object * when a new table entry has been registered in the * table metadata. * This method will update the <code>entries</code> list. * @param pos The position at which the new entry was inserted * in the table. * @param row The row OID of the new entry * @param name The ObjectName of the new entry (as specified by the * factory) * @param entry The new entry (as returned by the factory) * @param meta The table metadata object. **/ public void addEntryCb(int pos, SnmpOid row, ObjectName name, Object entry, SnmpMibTable meta) throws SnmpStatusException { try { if (entries != null) entries.add(pos, entry); } catch (Exception e) { throw new SnmpStatusException(SnmpStatusException.noSuchName); } }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.daemon.SnmpAdaptorServer.sendTrapPdu(InetAddress, SnmpPduPacket)
/** * Send the specified trap PDU to the specified destination. */ private void sendTrapPdu(InetAddress addr, SnmpPduPacket pdu) throws SnmpStatusException, IOException { SnmpMessage msg = null; try { msg = (SnmpMessage) pduFactory.encodeSnmpPdu(pdu, bufferSize); if (msg == null) { throw new SnmpStatusException(SnmpDefinitions.snmpRspAuthorizationError); } } catch (SnmpTooBigException x) { if (isDebugOn()) { debug('sendTrapPdu', 'trap pdu is too big'); debug('sendTrapPdu', 'trap hasn't been sent to the specified host'); } throw new SnmpStatusException(SnmpDefinitions.snmpRspTooBig); } openTrapSocketIfNeeded(); if (addr != null) { msg.address = addr; try { sendTrapMessage(msg); } catch (SnmpTooBigException x) { if (isDebugOn()) { debug('sendTrapPdu', 'trap pdu is too big'); debug('sendTrapPdu', 'trap hasn't been sent to ' + msg.address); } } } closeTrapSocketIfNeeded(); }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.daemon.SnmpAdaptorServer.sendTrapPdu(SnmpPduPacket)
/** * Send the specified trap PDU to every destinations from the ACL file. */ private void sendTrapPdu(SnmpPduPacket pdu) throws SnmpStatusException, IOException { SnmpMessage msg = null; try { msg = (SnmpMessage) pduFactory.encodeSnmpPdu(pdu, bufferSize); if (msg == null) { throw new SnmpStatusException(SnmpDefinitions.snmpRspAuthorizationError); } } catch (SnmpTooBigException x) { if (isDebugOn()) { debug('sendTrapPdu', 'trap pdu is too big'); debug('sendTrapPdu', 'trap hasn't been sent to anyone'); } throw new SnmpStatusException(SnmpDefinitions.snmpRspTooBig); } int sendingCount = 0; openTrapSocketIfNeeded(); if (ipacl != null) { Enumeration ed = ((InetAddressAcl) ipacl).getTrapDestinations(); while (ed.hasMoreElements()) { msg.address = (InetAddress) ed.nextElement(); Enumeration ec = ((InetAddressAcl) ipacl).getTrapCommunities(msg.address); while (ec.hasMoreElements()) { msg.community = ((String) ec.nextElement()).getBytes(); try { sendTrapMessage(msg); sendingCount++; } catch (SnmpTooBigException x) { if (isDebugOn()) { debug('sendTrapPdu', 'trap pdu is too big'); debug('sendTrapPdu', 'trap hasn't been sent to ' + msg.address); } } } } } if (sendingCount == 0) { try { msg.address = InetAddress.getLocalHost(); sendTrapMessage(msg); } catch (SnmpTooBigException x) { if (isDebugOn()) { debug('sendTrapPdu', 'trap pdu is too big'); debug('sendTrapPdu', 'trap hasn't been sent'); } } catch (UnknownHostException e) { if (isDebugOn()) { debug('sendTrapPdu', 'cannot get the local host'); debug('sendTrapPdu', 'trap hasn't been sent'); } } } closeTrapSocketIfNeeded(); }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.daemon.SnmpInformRequest.sendPdu()
boolean sendPdu() { try { responsePdu = null; SnmpPduFactory pduFactory = adaptor.getPduFactory(); SnmpMessage msg = (SnmpMessage) pduFactory.encodeSnmpPdu((SnmpPduPacket) requestPdu, adaptor.getBufferSize().intValue()); if (msg == null) { if (isDebugOn()) { debug('sendPdu', 'pdu factory returned a null value'); } throw new SnmpStatusException(snmpReqUnknownError); } int maxPktSize = adaptor.getBufferSize().intValue(); byte[] encoding = new byte[maxPktSize]; int encodingLength = msg.encodeMessage(encoding); if (isTraceOn()) { trace('sendPdu', 'Dump : \n' + msg.printMessage()); } sendPduPacket(encoding, encodingLength); return true; } catch (SnmpTooBigException ar) { if (isDebugOn()) { debug('sendPdu', ar); } setErrorStatusAndIndex(snmpReqPacketOverflow, ar.getVarBindCount()); requestPdu = null; reason = ar.getMessage(); if (isDebugOn()) { debug('sendPdu', 'Packet Overflow while building inform request'); } } catch (java.io.IOException ioe) { setErrorStatusAndIndex(snmpReqSocketIOError, 0); reason = ioe.getMessage(); } catch (Exception e) { if (isDebugOn()) { debug('sendPdu', e); } setErrorStatusAndIndex(snmpReqUnknownError, 0); reason = e.getMessage(); } return false; }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.daemon.SnmpInformRequest.start(SnmpVarBindList)
/** * For SNMP Runtime internal use only. * Starts an inform request in asynchronous mode. The callback interface * is used to notify the user upon request completion. * @param vblst The list of <CODE>SnmpVarBind</CODE> to be used. * @exception SnmpStatusException This inform request is already in progress. */ synchronized void start(SnmpVarBindList vblst) throws SnmpStatusException { if (inProgress()) throw new SnmpStatusException('Inform request already in progress.'); setVarBindList(vblst); initializeAndFire(); }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.SnmpMessage.decodeMessage(byte[], int)
/** * 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(); community = bdec.fetchOctetString(); data = bdec.fetchAny(); dataLength = data.length; bdec.closeSequence(); } catch (BerException x) { throw new SnmpStatusException('Invalid encoding'); } }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.SnmpMessage.getRequestId(byte[])
/** * 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; }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.SnmpMsg.getProtocolVersion(byte[])
/** * 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; }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.SnmpV3Message.decodeMessage(byte[], int)
/** * 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 (isTraceOn()) { trace('decodeMessage', 'Unmarshalled message : \n' + 'version :' + version + '\n' + 'msgId :' + msgId + '\n' + 'msgMaxSize :' + msgMaxSize + '\n' + 'msgFlags :' + msgFlags + '\n' + 'msgSecurityModel :' + msgSecurityModel + '\n' + 'contextEngineId :' + (contextEngineId == null ? null : SnmpEngineId.createEngineId(contextEngineId)) + '\n' + 'contextName :' + (contextName == null ? null : new String(contextName)) + '\n' + 'data :' + data + '\n' + 'dat len :' + ((data == null) ? 0 : data.length) + '\n' + 'encryptedPdu :' + encryptedPdu + '\n'); } }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.SnmpV3Message.getRequestId(byte[])
/** * 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; }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.SnmpMessage.encodeSnmpPdu(SnmpPdu, int)
/** * Initializes this message with the specified <CODE>pdu</CODE>. * <P> * This method initializes the data field with an array of * <CODE>maxDataLength</CODE> bytes. It encodes the <CODE>pdu</CODE>. * The resulting encoding is stored in the data field * and the length of the encoding is stored in <CODE>dataLength</CODE>. * If the encoding length exceeds <CODE>maxDataLength</CODE>, * 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 <CODE>pdu</CODE> is not valid. * @exception SnmpTooBigException If the resulting encoding does not fit * into <CODE>maxDataLength</CODE> bytes. * @exception ArrayIndexOutOfBoundsException If the encoding exceeds <CODE>maxDataLength</CODE>. * @since 1.5 */ public void encodeSnmpPdu(SnmpPdu pdu, int maxDataLength) throws SnmpStatusException, SnmpTooBigException { SnmpPduPacket pdupacket = (SnmpPduPacket) pdu; version = pdupacket.version; community = pdupacket.community; address = pdupacket.address; port = pdupacket.port; data = new byte[maxDataLength]; 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(); } }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.SnmpV3Message.encodeSnmpPdu(SnmpPdu, int)
/** * Initializes this message with the specified <CODE>pdu</CODE>. * <P> * This method initializes the data field with an array of * <CODE>maxDataLength</CODE> bytes. It encodes the <CODE>pdu</CODE>. * The resulting encoding is stored in the data field * and the length of the encoding is stored in <CODE>dataLength</CODE>. * If the encoding length exceeds <CODE>maxDataLength</CODE>, * 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 <CODE>pdu</CODE> * is not valid. * @exception SnmpTooBigException If the resulting encoding does not fit * into <CODE>maxDataLength</CODE> bytes. * @exception ArrayIndexOutOfBoundsException If the encoding exceeds * <CODE>maxDataLength</CODE>. */ public void encodeSnmpPdu(SnmpPdu p, int maxDataLength) throws SnmpStatusException, SnmpTooBigException { SnmpScopedPduPacket pdu = (SnmpScopedPduPacket) p; if (isTraceOn()) { trace('encodeSnmpPdu', 'Pdu to marshall: \n' + 'security parameters : ' + pdu.securityParameters + '\n' + 'type :' + pdu.type + '\n' + 'version :' + pdu.version + '\n' + 'requestId :' + pdu.requestId + '\n' + 'msgId :' + pdu.msgId + '\n' + 'msgMaxSize :' + pdu.msgMaxSize + '\n' + 'msgFlags :' + pdu.msgFlags + '\n' + 'msgSecurityModel :' + pdu.msgSecurityModel + '\n' + 'contextEngineId :' + pdu.contextEngineId + '\n' + 'contextName :' + pdu.contextName + '\n'); } 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; data = new byte[maxDataLength]; 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(); } }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.SnmpMsg.encodeVarBindValue(BerEncoder, SnmpValue)
/** * 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); } }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.daemon.SnmpSession.addInformRequest(SnmpInformRequest)
/** * Adds an inform request. * @param snmpreq The inform request to add. * @exception SnmpStatusException SNMP adaptor is not ONLINE or session is dead. */ synchronized void addInformRequest(SnmpInformRequest snmpreq) throws SnmpStatusException { if (!isSessionActive()) { throw new SnmpStatusException('SNMP adaptor is not ONLINE or session is dead...'); } informRequestList.put(snmpreq, snmpreq); }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.daemon.SnmpSession.makeAsyncRequest(InetAddress, String, SnmpInformHandler, SnmpVarBindList, int)
/** * Sends an inform request to the specified InetAddress destination using the specified community string. * @param addr The InetAddress destination for this inform request. * @param cs The community string to be used for the inform request. * @param cb The callback that is invoked when a request is complete. * @param vblst A list of SnmpVarBind instances or null. * @exception SnmpStatusException SNMP adaptor is not ONLINE or session * is dead. */ SnmpInformRequest makeAsyncRequest(InetAddress addr, String cs, SnmpInformHandler cb, SnmpVarBindList vblst, int port) throws SnmpStatusException { if (!isSessionActive()) { throw new SnmpStatusException('SNMP adaptor server not ONLINE'); } SnmpInformRequest snmpreq = new SnmpInformRequest(this, adaptor, addr, cs, port, cb); snmpreq.start(vblst); return snmpreq; }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.SnmpOidDatabaseSupport.remove(SnmpOidTable)
/** * Removes a <CODE>SnmpOidTable</CODE> object from this <CODE>SnmpOidDatabase</CODE>. * @param table The table to be removed. * @exception SnmpStatusException The specified <CODE>SnmpOidTable</CODE> does not exist in this <CODE>SnmpOidDatabase</CODE>. */ public void remove(SnmpOidTable table) throws SnmpStatusException { if (!tables.contains(table)) { throw new SnmpStatusException('The specified SnmpOidTable does not exist in this SnmpOidDatabase'); } tables.removeElement(table); }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.SnmpOidTableSupport.resolveVarName(String)
/** * Searches for a MIB variable given its logical name and returns an {@link com.sun.jmx.snmp.SnmpOidRecord} object * containing information on the variable. * @param name The name of the MIB variable. * @return The <CODE>SnmpOidRecord</CODE> object containing information on the variable. * @exception SnmpStatusException If the variable is not found. */ public SnmpOidRecord resolveVarName(String name) throws SnmpStatusException { SnmpOidRecord var = (SnmpOidRecord) oidStore.get(name); if (var != null) { return var; } else { throw new SnmpStatusException('Variable name <' + name + '> not found in Oid repository'); } }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
com.sun.jmx.snmp.SnmpOidTableSupport.resolveVarOid(String)
/** * Searches for a MIB variable given its OID and returns an {@link com.sun.jmx.snmp.SnmpOidRecord} object * containing information on the variable. * @param oid The OID of the MIB variable. * @return The <CODE>SnmpOidRecord</CODE> object containing information on the variable. * @exception SnmpStatusException If the variable is not found. */ public SnmpOidRecord resolveVarOid(String oid) throws SnmpStatusException { int index = oid.indexOf('.'); if (index < 0) { throw new SnmpStatusException('Variable oid <' + oid + '> not found in Oid repository'); } if (index == 0) { oid = oid.substring(1, oid.length()); } for (Enumeration list = oidStore.elements(); list.hasMoreElements(); ) { SnmpOidRecord element = (SnmpOidRecord) list.nextElement(); if (element.getOid().equals(oid)) return element; } throw new SnmpStatusException('Variable oid <' + oid + '> not found in Oid repository'); }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
Comments
Post a Comment