Package org.snmp4j.smi

Examples of org.snmp4j.smi.Integer32


   * @return
   *    a sub-index value corresponding to the seed sub-index type.
   */
  public synchronized OID getNextSubIndex() {
    if (seedSubIndex instanceof Integer32) {
      Integer32 i = (Integer32)seedSubIndex;
      i.setValue(i.getValue()+1);
    }
    else if (seedSubIndex instanceof UnsignedInteger32) {
      UnsignedInteger32 ui = (UnsignedInteger32)seedSubIndex;
      ui.setValue(ui.getValue()+1);
    }
View Full Code Here


    }
    return super.validate(newValue, oldValue);
  }

  public boolean isVolatile(MOTableRow row, int column) {
    Integer32 value = (Integer32) row.getValue(column);
    if (value != null) {
      int storageType = value.getValue();
      switch (storageType) {
        case other:
        case volatile_:
        case readOnly: {
          return true;
View Full Code Here

      return SnmpConstants.SNMP_MP_UNSUPPORTED_SECURITY_MODEL;
    }


    OctetString community = new OctetString(securityName);
    Integer32 version = new Integer32(messageProcessingModel);
    // compute total length
    int length = pdu.getBERLength();
    length += community.getBERLength();
    length += version.getBERLength();

    ByteBuffer buf = ByteBuffer.allocate(length +
                                         BER.getBERLengthOfLength(length) + 1);
    // set the buffer of the outgoing message
    outgoingMessage.setBuffer(buf);

    // encode the message
    BER.encodeHeader(outgoingMessage, BER.SEQUENCE, length);
    version.encodeBER(outgoingMessage);

    community.encodeBER(outgoingMessage);
    pdu.encodeBER(outgoingMessage);

    return SnmpConstants.SNMP_MP_OK;
View Full Code Here

    if (mutableByte.getValue() != BER.SEQUENCE) {
      String txt = "SNMPv1 PDU must start with a SEQUENCE";
      logger.error(txt);
      throw new IOException(txt);
    }
    Integer32 version = new Integer32();
    version.decodeBER(wholeMsg);

    securityName.decodeBER(wholeMsg);
    securityLevel.setValue(SecurityLevel.NOAUTH_NOPRIV);
    securityModel.setValue(SecurityModel.SECURITY_MODEL_SNMPv1);
    messageProcessingModel.setValue(ID);
View Full Code Here

   * @param model
   *    a <code>SecurityModel</code>. If a security model with the same ID
   *    already
   */
  public void addSecurityModel(SecurityModel model) {
    securityModels.put(new Integer32(model.getID()), model);
  }
View Full Code Here

      logger.error("MPv2c used with unsupported SNMP version");
      return SnmpConstants.SNMP_MP_UNSUPPORTED_SECURITY_MODEL;
    }

    OctetString community = new OctetString(securityName);
    Integer32 version = new Integer32(messageProcessingModel);
    // compute total length
    int length = pdu.getBERLength();
    length += community.getBERLength();
    length += version.getBERLength();

    ByteBuffer buf = ByteBuffer.allocate(length +
                                         BER.getBERLengthOfLength(length) + 1);
    // set the buffer of the outgoing message
    outgoingMessage.setBuffer(buf);

    // encode the message
    BER.encodeHeader(outgoingMessage, BER.SEQUENCE, length);
    version.encodeBER(outgoingMessage);

    community.encodeBER(outgoingMessage);
    pdu.encodeBER(outgoingMessage);

    return SnmpConstants.SNMP_MP_OK;
View Full Code Here

    if (mutableByte.getValue() != BER.SEQUENCE) {
      String txt = "SNMPv2c PDU must start with a SEQUENCE";
      logger.error(txt);
      throw new IOException(txt);
    }
    Integer32 version = new Integer32();
    version.decodeBER(wholeMsg);

    securityName.decodeBER(wholeMsg);
    securityLevel.setValue(SecurityLevel.NOAUTH_NOPRIV);
    securityModel.setValue(SecurityModel.SECURITY_MODEL_SNMPv2c);
    messageProcessingModel.setValue(ID);
View Full Code Here

    }

    length += BER.getBERLengthOfLength(length) + 1;

    // req id, error status, error index
    Integer32 i32 = new Integer32(requestID.getValue());
    length += i32.getBERLength();
    i32 = errorStatus;
    length += i32.getBERLength();
    i32 = errorIndex;
    length += i32.getBERLength();
    i32 = null;
    return length;
  }
View Full Code Here

   * Removes all variable bindings from the PDU and sets the request ID to zero.
   * This can be used to reuse a PDU for another request.
   */
  public void clear() {
    variableBindings.clear();
    setRequestID(new Integer32(0));
  }
View Full Code Here

        new OctetString("public"),              // community name
        new OctetString("public"),              // security name
        agent.getLocalEngineID(),               // 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.