Package org.snmp4j.smi

Examples of org.snmp4j.smi.Integer32


    { new OctetString("public"), // community name
        new OctetString("public"), // security name
        getAgent().getContextEngineID(), // local engine ID
        new OctetString(), // default context name
        new OctetString(), // transport tag
        new Integer32(StorageType.nonVolatile), // storage type
        new Integer32(RowStatus.active) // row status
    };
    MOTableRow row = communityMIB.getSnmpCommunityEntry().createRow(
        new OctetString("public2public").toSubIndex(true), com2sec);
    communityMIB.getSnmpCommunityEntry().addRow(row);
  }
View Full Code Here


  public int getScalarValue(OID scalarInstanceOID, Variable value) {
    MBeanActionMOInfo mBeanActionMOInfo = getActionInfo(scalarInstanceOID);
    if (mBeanActionMOInfo != null) {
      // get state
      Integer32 v = (Integer32)value;
      for (MBeanStateInfo stateInfo : mBeanActionMOInfo.getStates()) {
        // check for default state
        if (stateInfo.getStateAttribute() == null) {
          v.setValue(stateInfo.getStateID());
          return PDU.noError;
        }
        try {
          Object attr;
          if (stateInfo.getStateAttribute().getName() == null) {
            attr = mBeanActionMOInfo.getLastActionResult();
          }
          else {
            attr = MBeanAttributeMOInfo.getAttribute(server,
                mBeanActionMOInfo.getObjectName(),
                stateInfo.getStateAttribute());
          }
          if (((attr == null) && (stateInfo.getStateIndication() == null)) ||
              ((attr != null) && attr.equals(stateInfo.getStateIndication()))) {
            v.setValue(stateInfo.getStateID());
            return PDU.noError;
          }
        }
        catch (Exception ex) {
          // ignore
View Full Code Here

        VariableBinding vb = new VariableBinding(new OID(oid));
        if (value != null) {
            Variable variable;
            switch (type) {
            case 'i': {
                variable = new Integer32(Integer.parseInt(value));
                break;
            }

            case 'u': {
                variable = new UnsignedInteger32(Long.parseLong(value));
View Full Code Here

import org.snmp4j.agent.request.RequestStatus;

public class TestAndIncr extends MOScalar {

  public TestAndIncr(OID oid) {
    super(oid, MOAccessImpl.ACCESS_READ_WRITE, new Integer32(0));
  }
View Full Code Here

  public TestAndIncr(OID oid) {
    super(oid, MOAccessImpl.ACCESS_READ_WRITE, new Integer32(0));
  }

  public void commit(SubRequest request) {
    Integer32 requestValue =
        (Integer32)request.getVariableBinding().getVariable();
    int v = requestValue.getValue();
    if (v == Integer.MAX_VALUE) {
      v = 0;
    }
    else {
      v++;
    }
    request.getVariableBinding().setVariable(new Integer32(v));
    super.commit(request);
    request.getVariableBinding().setVariable(requestValue);
  }
View Full Code Here

  }

  public void prepare(SubRequest request) {
    super.prepare(request);
    if (!request.hasError()) {
      Integer32 value = (Integer32) request.getVariableBinding().getVariable();
      if (!getValue().equals(value)) {
        request.getStatus().
            setErrorStatus(SnmpConstants.SNMP_ERROR_INCONSISTENT_VALUE);
      }
    }
View Full Code Here

      }
    }
  }

  public int isValueOK(SubRequest request) {
    Integer32 value = (Integer32) request.getVariableBinding().getVariable();
    if (value.getValue() < 0) {
      return SnmpConstants.SNMP_ERROR_WRONG_VALUE;
    }
    return SnmpConstants.SNMP_ERROR_SUCCESS;
  }
View Full Code Here

      if (!isValidSize(((OctetString)variable).length())) {
        return PDU.wrongLength;
      }
    }
    else if (variable instanceof Integer32) {
      Integer32 i = (Integer32)variable;
      if (!isValidSize(i.getValue())) {
        return PDU.wrongValue;
      }
    }
    else if (variable instanceof UnsignedInteger32) {
      UnsignedInteger32 ui = (UnsignedInteger32)variable;
View Full Code Here

    };
    snmpEngineBoots = new MOScalar(new OID("1.3.6.1.6.3.10.2.1.2.0"),
                                   MOAccessImpl.ACCESS_READ_ONLY,
                                   null) {
      public Variable getValue() {
        return new Integer32(getUSM().getEngineBoots());
      }
    };
    snmpEngineTime = new MOScalar(new OID("1.3.6.1.6.3.10.2.1.3.0"),
                                  MOAccessImpl.ACCESS_READ_ONLY,
                                  null) {
      public Variable getValue() {
        return new Integer32(getUSM().getEngineTime());
      }
    };
    Integer32 maxMsgSize = new Integer32(getMaxMessageSize());
    snmpEngineMaxMessageSize = new MOScalar(new OID("1.3.6.1.6.3.10.2.1.4.0"),
                                            MOAccessImpl.ACCESS_READ_ONLY,
                                            maxMsgSize);
  }
View Full Code Here

        new OctetString("public"),              // community name
        new OctetString("cpublic"),              // security name
        getAgent().getContextEngineID(),        // local engine ID
        new OctetString(),              // default context name
        new OctetString(),                      // transport tag
        new Integer32(StorageType.nonVolatile), // storage type
        new Integer32(RowStatus.active)         // row status
    };
    MOTableRow row =
        communityMIB.getSnmpCommunityEntry().createRow(
          new OctetString("public2public").toSubIndex(true), com2sec);
    communityMIB.getSnmpCommunityEntry().addRow(row);
View Full Code Here

TOP

Related Classes of org.snmp4j.smi.Integer32

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.