Beispiel #1
0
  public void updateByValue(
      URI url, List<Variable> values, SnmpUriCallback callback, Object userObject)
      throws UnknownHostException {
    Request request = createSnmpRequest(url);
    PDU pdu = request.getPdu();
    pdu.setType(PDU.SET);
    OID[] oids = request.getOIDs();
    for (int i = 0; i < oids.length && i < values.size(); i++) {
      pdu.add(new VariableBinding(oids[i], values.get(i)));
    }

    sendSnmpRequest(request, pdu, url, callback, userObject);
  }
Beispiel #2
0
 public void browse(URI url, SnmpUriCallback callback, Object userObject)
     throws UnknownHostException {
   Request request = createSnmpRequest(url);
   PDU pdu = request.getPdu();
   switch (request.getType()) {
     case GET:
       pdu.setType(PDU.GET);
       pdu.addAll(VariableBinding.createFromOIDs(request.getOIDs()));
       sendSnmpRequest(request, pdu, url, callback, userObject);
       break;
     case NEXT:
       pdu.setType(PDU.GETNEXT);
       pdu.addAll(VariableBinding.createFromOIDs(request.getOIDs()));
       sendSnmpRequest(request, pdu, url, callback, userObject);
       break;
     case SUBTREE:
       TreeUtils treeUtils = new TreeUtils(snmp, pduFactory);
       TreeListener treeListener = new AsyncTreeListener(url, callback);
       treeUtils.walk(request.getTarget(), request.getOIDs(), userObject, treeListener);
       break;
   }
 }
Beispiel #3
0
  public void sendByBinding(
      URI url,
      List<VariableBinding> values,
      int pduType,
      SnmpUriCallback callback,
      Object userObject)
      throws UnknownHostException {
    Request request = createSnmpRequest(url);
    PDU pdu = request.getPdu();
    pdu.setType(pduType);
    for (VariableBinding vb : values) {
      pdu.add(vb);
    }

    sendSnmpRequest(request, pdu, url, callback, userObject);
  }