/** * Creates a variable binding with the supplied OID and value. * @param oid * the OID for the new variable binding (must not be <code>null</code>). * @param variable * the value for the new variable binding (must not be <code>null</code>). */ public VariableBinding(OID oid, Variable variable) { setOid(oid); setVariable(variable); }
/** * Creates a variable binding with the supplied OID and value. * @param oid * the OID for the new variable binding (must not be <code>null</code>). * @param variable * the value for the new variable binding (must not be <code>null</code>). */ public VariableBinding(OID oid, Variable variable) { setOid(oid); setVariable(variable); }
/** * Creates a variable binding with the supplied OID and value. * @param oid * the OID for the new variable binding (must not be <code>null</code>). * @param variable * the value for the new variable binding (must not be <code>null</code>). */ public VariableBinding(OID oid, Variable variable) { setOid(oid); setVariable(variable); }
public void get(SubRequest request) { OID oid = request.getVariableBinding().getOid(); Variable vb = vbs.get(oid); if (vb == null) { request.getVariableBinding().setVariable(Null.noSuchInstance); } else { request.getVariableBinding().setVariable(vb); } request.completed(); }
public void get(SubRequest request) { OID oid = request.getVariableBinding().getOid(); Variable vb = (Variable) vbs.get(oid); if (vb == null) { request.getVariableBinding().setVariable(Null.noSuchInstance); } request.getVariableBinding().setVariable(vb); request.completed(); }
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); }
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); }
public void get(SubRequest subRequest, MOTableRow row, int column) { if (getAccess().isAccessibleForRead()) { Variable value = getValue(row, column); if (value != null) { subRequest.getVariableBinding().setVariable((Variable) value.clone()); } else { subRequest.getVariableBinding().setVariable(Null.noSuchInstance); } subRequest.completed(); } else { subRequest.getStatus().setErrorStatus(SnmpConstants.SNMP_ERROR_NO_ACCESS); } }
public void get(SubRequest request) { RequestStatus status = request.getStatus(); if (checkRequestScope(request)) { if (access.isAccessibleForRead()) { VariableBinding vb = request.getVariableBinding(); vb.setOid(getOid()); Variable variable = getValue(); if (variable == null) { vb.setVariable(Null.noSuchObject); } else { vb.setVariable((Variable) variable.clone()); } request.completed(); } else { status.setErrorStatus(SnmpConstants.SNMP_ERROR_NO_ACCESS); } } }
public void get(SubRequest subRequest, MOTableRow row, int column) { if (getAccess().isAccessibleForRead()) { subRequest.getVariableBinding().setVariable(new OctetString()); } else { subRequest.getStatus().setErrorStatus(SnmpConstants.SNMP_ERROR_NO_ACCESS); } subRequest.completed(); }
private void getVariable(final SubRequest request, final OID oid) { try { final Variable value = findValueForOID(oid); final VariableBinding vb = request.getVariableBinding(); vb.setOid(oid); vb.setVariable(value == null ? Null.noSuchObject : value); request.completed(); } catch (SnmpErrorStatusException e) { request.setErrorStatus(e.getErrorStatus()); request.completed(); } }
public void get(SubRequest subRequest, MOTableRow row, int column) { if (getAccess().isAccessibleForRead()) { subRequest.getVariableBinding().setVariable(new OctetString()); } else { subRequest.getStatus().setErrorStatus(SnmpConstants.SNMP_ERROR_NO_ACCESS); } subRequest.completed(); }
private void getVariable(final SubRequest request, final OID oid) { try { final Variable value = findValueForOID(oid); final VariableBinding vb = request.getVariableBinding(); vb.setOid(oid); vb.setVariable(value == null ? Null.noSuchObject : value); request.completed(); } catch (SnmpErrorStatusException e) { request.setErrorStatus(e.getErrorStatus()); request.completed(); } }
public void get(SubRequest request) { OID oid = request.getVariableBinding().getOid(); Variable var = get(oid); if (var == null) { request.getVariableBinding().setVariable(Null.noSuchInstance); request.completed(); if (enableSnmpAccessStatisticsGatherer) { snmpAccessStatisticsGatherer .snmpGetFailed(request.getRequest().getContext(), oid); } return; } request.getVariableBinding().setVariable(var); request.completed(); if (enableSnmpAccessStatisticsGatherer) { snmpAccessStatisticsGatherer .snmpGetSucceeded(request.getRequest().getContext(), oid); } }
/** * Checks whether the request is within the scope of this scalar or not. * @param request * a SubRequest. * @return * <code>true</code> if the request is within scope and <code>false</code> * otherwise. In the latter case, the variable of the request is set * to {@link Null#noSuchInstance} and the request is marked completed. */ protected boolean checkRequestScope(SubRequest request) { if (!request.getVariableBinding().getOid().equals(oid)) { VariableBinding vb = request.getVariableBinding(); vb.setOid(getOid()); vb.setVariable(Null.noSuchInstance); request.completed(); return false; } return true; }
/** * Checks whether the request is within the scope of this scalar or not. * * @param request a SubRequest. * @return {@code true} if the request is within scope and {@code false} * otherwise. In the latter case, the variable of the request is set * to {@link Null#noSuchInstance} and the request is marked completed. */ protected boolean checkRequestScope(SubRequest request) { if (!request.getVariableBinding().getOid().equals(oid)) { VariableBinding vb = request.getVariableBinding(); vb.setOid(getOid()); vb.setVariable(Null.noSuchInstance); request.completed(); return false; } return true; }
public void get(SubRequest request) { RequestStatus status = request.getStatus(); if (checkRequestScope(request)) { if (access.isAccessibleForRead()) { VariableBinding vb = request.getVariableBinding(); vb.setOid(getOid()); vb.setVariable((Variable) getValue().clone()); request.completed(); } else { status.setErrorStatus(SnmpConstants.SNMP_ERROR_NO_ACCESS); } } }
public boolean next(SubRequest request) { MOScope scope = request.getQuery().getScope(); OID requestedOid = scope.getLowerBound(); OID nextOid = find(scope); if (nextOid == null) { request.getVariableBinding().setVariable(Null.noSuchInstance); request.completed(); if (enableSnmpAccessStatisticsGatherer) { snmpAccessStatisticsGatherer .snmpNextFailed(request.getRequest().getContext(), requestedOid); } return false; } request.getVariableBinding().setOid(nextOid); request.getVariableBinding().setVariable(get(nextOid)); request.completed(); if (enableSnmpAccessStatisticsGatherer) { snmpAccessStatisticsGatherer .snmpNextSucceeded(request.getRequest().getContext(), requestedOid); } return true; }
@Override public void get(SubRequest subRequest, MOTableRow row, int column) { DHKeyInfo keyInfo = getDHKeyInfo(row, column); if (keyInfo != null && getAccess().isAccessibleForRead()) { if (keyInfo.getKeyPair() == null) { try { keyInfo.generatePublicKey(dhParameters); } catch (NoSuchAlgorithmException e) { LOGGER.error("Failed to generate DH public key because Diffie-Hellman algorithm is not available", e); } catch (InvalidAlgorithmParameterException e) { LOGGER.error("Failed to generate DH public key because of invalid parameters", e); } } subRequest.getVariableBinding().setVariable(DHOperations.derivePublicKey(keyInfo.getKeyPair())); } else { subRequest.getStatus().setErrorStatus(SnmpConstants.SNMP_ERROR_NO_ACCESS); } subRequest.completed(); }
public boolean next(SubRequest request) { if (access.isAccessibleForRead() && (request.getScope().isCovered(getSingleInstanceScope()))) { VariableBinding vb = request.getVariableBinding(); vb.setOid(getOid()); vb.setVariable((Variable)getValue().clone()); request.completed(); if (logger.isDebugEnabled()) { logger.debug("Processed GETNEXT/BULK request '"+request+"' by '"+ getOid()); } return true; } if (logger.isDebugEnabled()) { logger.debug("Skipped '"+ getOid()+"' for GETNEXT/BULK request '"+request+"'"); } return false; }