Package org.snmp4j

Examples of org.snmp4j.Target


      final String walk_base             = config.remove("walk");
      final String separate_queries      = config.remove("separate_queries");
      /* Assigned Later */
      boolean send_separate_queries = false;
      final HashMap<String,String> oids  = new HashMap<String,String>();
      Target target;
      HashMap<String, ArrayList<oid_data>> oid_hashmap = new HashMap<String, ArrayList<oid_data>>();
      OctetString localEngineID = new OctetString(MPv3.createLocalEngineID());

      if (port == null) {
        port = "161";
View Full Code Here


        (String) ArgumentParser.getValue(settings, oVersion, 0);
    OctetString community =
        createOctetString((String)
                          ArgumentParser.getValue(settings, oCommunity, 0),
                          "public");
    Target t;
    if ("1".equals(version)) {
      t = new CommunityTarget();
      t.setVersion(SnmpConstants.version1);
      ((CommunityTarget)t).setCommunity(community);
    }
    else if ("2c".equals(version)) {
      t = new CommunityTarget();
      t.setVersion(SnmpConstants.version2c);
      ((CommunityTarget)t).setCommunity(community);
    }
    else {
      UserTarget ut = new UserTarget();
      t = ut;
      String ae = (String)
          ArgumentParser.getValue(settings, oAuthoritativeEngineID, 0);
      if (ae != null) {
        ut.setAuthoritativeEngineID(createOctetString(ae, null).getValue());
      }
      ut.setSecurityModel(USM.SECURITY_MODEL_USM);
      String sn = (String)
          ArgumentParser.getValue(settings, oSecurityName, 0);
      if (sn != null) {
        ut.setSecurityName(createOctetString(sn, null));
      }
      Integer secLevel =
          (Integer) ArgumentParser.getValue(settings, oSecLevel, 0);
      if (secLevel == null) {
        if (settings.containsKey(oPrivPassphrase)) {
          ut.setSecurityLevel(SecurityLevel.AUTH_PRIV);
        }
        else if (settings.containsKey(oAuthPassphrase)) {
          ut.setSecurityLevel(SecurityLevel.AUTH_NOPRIV);
        }
        else {
          ut.setSecurityLevel(SecurityLevel.NOAUTH_NOPRIV);
        }
      }
      else {
        ut.setSecurityLevel(secLevel.intValue());
      }
    }
    int retries = 0;
    Number r = (Number) ArgumentParser.getValue(settings, oRetries, 0);
    if (r != null) {
      retries = r.intValue();
    }
    t.setRetries(retries);
    long timeout = 5000;
    Number to = (Number) ArgumentParser.getValue(settings, oTimeout, 0);
    if (to != null) {
      timeout = to.longValue();
    }
    t.setTimeout(timeout);
    String addr = (String) ArgumentParser.getValue(settings, oAddress, 0);
    if (addr != null) {
      if (addr.indexOf('/') <= 0) {
        addr += "/161";
      }
      t.setAddress(GenericAddress.parse(addr));
    }
    return t;
  }
View Full Code Here

  public ResponseEvent createRowSync(final A address, final OID rowStatusColumnOid, final OID rowIndex,
      final VariableBinding... bindings) {

    checkNoNulls(address, rowStatusColumnOid, rowIndex, bindings);

    final Target target = this.createTarget(address);
    final TableUtils tableUtils = new TableUtils(this.snmp, new DefaultPDUFactory());
    return tableUtils.createRow(target, rowStatusColumnOid, rowIndex, bindings);
  }
View Full Code Here

  @Override
  public ResponseEvent destroyRowSync(final A address, final OID rowStatusColumnOid, final OID rowIndex) {

    checkNoNulls(address, rowStatusColumnOid, rowIndex);

    final Target target = this.createTarget(address);
    final TableUtils tableUtils = new TableUtils(this.snmp, new DefaultPDUFactory());
    return tableUtils.destroyRow(target, rowStatusColumnOid, rowIndex);
  }
View Full Code Here

  public void getAsync(final A address, final ResponseListener listener, final Object handle, final OID... oids)
      throws IOException {

    checkNoNulls(address, listener, oids);

    final Target target = this.createTarget(address);
    final PDU requestPdu = this.createRequestPdu(PDU.GET, target, VariableBindings.wrapOids(oids));
    this.snmp.send(requestPdu, target, handle, listener);
  }
View Full Code Here

  public void getDenseTableAsync(final A address, final TableListener listener, final Object handle,
      final OID lowerBoundIndex, final OID upperBoundIndex, final OID... columnOids) {

    checkNoNulls(address, listener, handle, lowerBoundIndex, upperBoundIndex, columnOids);

    final Target target = this.createTarget(address);
    final TableUtils tableUtils = new TableUtils(this.snmp, new DefaultPDUFactory());
    tableUtils.getDenseTable(target, columnOids, listener, handle, lowerBoundIndex, upperBoundIndex);
  }
View Full Code Here

  public void getNextAsync(final A address, final ResponseListener listener, final Object handle, final OID... oids)
      throws IOException {

    checkNoNulls(address, listener, oids);

    final Target target = this.createTarget(address);
    final PDU requestPdu = this.createRequestPdu(PDU.GETNEXT, target, VariableBindings.wrapOids(oids));
    this.snmp.send(requestPdu, target, handle, listener);
  }
View Full Code Here

  @Override
  public ResponseEvent getNextSync(final A address, final OID... oids) throws IOException {

    checkNoNulls(address, oids);

    final Target target = this.createTarget(address);
    final PDU requestPdu = this.createRequestPdu(PDU.GETNEXT, target, VariableBindings.wrapOids(oids));
    return this.snmp.send(requestPdu, target);
  }
View Full Code Here

  @Override
  public ResponseEvent getSync(final A address, final OID... oids) throws IOException {

    checkNoNulls(address, oids);

    final Target target = this.createTarget(address);
    final PDU requestPdu = this.createRequestPdu(PDU.GET, target, VariableBindings.wrapOids(oids));
    return this.snmp.send(requestPdu, target);
  }
View Full Code Here

  public void getTableAsync(final A address, final TableListener listener, final Object handle,
      final OID lowerBoundIndex, final OID upperBoundIndex, final OID... columnOids) {

    checkNoNulls(address, listener, handle, lowerBoundIndex, upperBoundIndex, columnOids);

    final Target target = this.createTarget(address);
    final TableUtils tableUtils = new TableUtils(this.snmp, new DefaultPDUFactory());
    tableUtils.getTable(target, columnOids, listener, handle, lowerBoundIndex, upperBoundIndex);
  }
View Full Code Here

TOP

Related Classes of org.snmp4j.Target

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.