Search in sources :

Example 31 with SnmpVarBind

use of com.sun.jmx.snmp.SnmpVarBind in project jdk8u_jdk by JetBrains.

the class SnmpMibTable method setRowStatusFail.

// ---------------------------------------------------------------------
//
// Register an exception when checking the RowStatus variable
//
// ---------------------------------------------------------------------
static void setRowStatusFail(SnmpMibSubRequest req, int errorStatus) throws SnmpStatusException {
    final SnmpVarBind statusvb = req.getRowStatusVarBind();
    final SnmpStatusException x = new SnmpStatusException(errorStatus);
    req.registerSetException(statusvb, x);
}
Also used : SnmpStatusException(com.sun.jmx.snmp.SnmpStatusException) SnmpVarBind(com.sun.jmx.snmp.SnmpVarBind)

Example 32 with SnmpVarBind

use of com.sun.jmx.snmp.SnmpVarBind in project jdk8u_jdk by JetBrains.

the class SnmpSubNextRequestHandler method init.

private void init(SnmpPdu req, SnmpAdaptorServer server) {
    this.server = server;
    // The translation table is easy in this case ...
    //
    final int max = translation.length;
    final SnmpVarBind[] list = req.varBindList;
    final NonSyncVector<SnmpVarBind> nonSyncVarBind = ((NonSyncVector<SnmpVarBind>) varBind);
    for (int i = 0; i < max; i++) {
        translation[i] = i;
        // we need to allocate a new SnmpVarBind. Otherwise the first
        // sub request will modify the list...
        //
        final SnmpVarBind newVarBind = new SnmpVarBind(list[i].oid, list[i].value);
        nonSyncVarBind.addNonSyncElement(newVarBind);
    }
}
Also used : SnmpVarBind(com.sun.jmx.snmp.SnmpVarBind)

Example 33 with SnmpVarBind

use of com.sun.jmx.snmp.SnmpVarBind in project jdk8u_jdk by JetBrains.

the class SnmpRequestHandler method mergeBulkResponses.

private SnmpVarBind[] mergeBulkResponses(int size) {
    // Let's allocate the array for storing the result
    //
    SnmpVarBind[] result = new SnmpVarBind[size];
    for (int i = size - 1; i >= 0; --i) {
        result[i] = new SnmpVarBind();
        result[i].value = SnmpVarBind.endOfMibView;
    }
    //
    for (Enumeration<SnmpSubRequestHandler> e = subs.elements(); e.hasMoreElements(); ) {
        SnmpSubRequestHandler sub = e.nextElement();
        sub.updateResult(result);
    }
    return result;
}
Also used : SnmpVarBind(com.sun.jmx.snmp.SnmpVarBind)

Example 34 with SnmpVarBind

use of com.sun.jmx.snmp.SnmpVarBind in project jdk8u_jdk by JetBrains.

the class SnmpRequestHandler method mergeNextResponses.

private SnmpPduPacket mergeNextResponses(SnmpPduRequest req) {
    int max = req.varBindList.length;
    SnmpVarBind[] result = new SnmpVarBind[max];
    //
    for (Enumeration<SnmpSubRequestHandler> e = subs.elements(); e.hasMoreElements(); ) {
        SnmpSubRequestHandler sub = e.nextElement();
        sub.updateResult(result);
    }
    if (req.version == snmpVersionTwo) {
        return newValidResponsePdu(req, result);
    }
    //
    for (int i = 0; i < max; i++) {
        SnmpValue val = result[i].value;
        if (val == SnmpVarBind.endOfMibView)
            return newErrorResponsePdu(req, SnmpDefinitions.snmpRspNoSuchName, i + 1);
    }
    //
    return newValidResponsePdu(req, result);
}
Also used : SnmpValue(com.sun.jmx.snmp.SnmpValue) SnmpVarBind(com.sun.jmx.snmp.SnmpVarBind)

Example 35 with SnmpVarBind

use of com.sun.jmx.snmp.SnmpVarBind in project jdk8u_jdk by JetBrains.

the class SnmpSubBulkRequestHandler method init.

private void init(SnmpAdaptorServer server, SnmpPdu req, int nonRepeat, int maxRepeat, int R) {
    this.server = server;
    this.nonRepeat = nonRepeat;
    this.maxRepeat = maxRepeat;
    this.globalR = R;
    final int max = translation.length;
    final SnmpVarBind[] list = req.varBindList;
    final NonSyncVector<SnmpVarBind> nonSyncVarBind = ((NonSyncVector<SnmpVarBind>) varBind);
    for (int i = 0; i < max; i++) {
        translation[i] = i;
        // we need to allocate a new SnmpVarBind. Otherwise the first
        // sub request will modify the list...
        //
        final SnmpVarBind newVarBind = new SnmpVarBind(list[i].oid, list[i].value);
        nonSyncVarBind.addNonSyncElement(newVarBind);
    }
}
Also used : SnmpVarBind(com.sun.jmx.snmp.SnmpVarBind)

Aggregations

SnmpVarBind (com.sun.jmx.snmp.SnmpVarBind)35 SnmpStatusException (com.sun.jmx.snmp.SnmpStatusException)18 SnmpTimeticks (com.sun.jmx.snmp.SnmpTimeticks)5 SnmpVarBindList (com.sun.jmx.snmp.SnmpVarBindList)5 SnmpOid (com.sun.jmx.snmp.SnmpOid)4 SnmpPduRequest (com.sun.jmx.snmp.SnmpPduRequest)3 SnmpValue (com.sun.jmx.snmp.SnmpValue)3 SnmpMibAgent (com.sun.jmx.snmp.agent.SnmpMibAgent)2 Vector (java.util.Vector)2 Attribute (javax.management.Attribute)2 AttributeList (javax.management.AttributeList)2 InstanceAlreadyExistsException (javax.management.InstanceAlreadyExistsException)2 InstanceNotFoundException (javax.management.InstanceNotFoundException)2 InvalidAttributeValueException (javax.management.InvalidAttributeValueException)2 MBeanException (javax.management.MBeanException)2 MBeanRegistrationException (javax.management.MBeanRegistrationException)2 NotCompliantMBeanException (javax.management.NotCompliantMBeanException)2 ReflectionException (javax.management.ReflectionException)2 RuntimeOperationsException (javax.management.RuntimeOperationsException)2 SnmpPduPacket (com.sun.jmx.snmp.SnmpPduPacket)1