pdu.setType(PDU.RESPONSE); StatusInformation statusInformation = new StatusInformation(); StateReference ref = event.getStateReference(); try { event.getMessageDispatcher().returnResponsePdu(event.getMessageProcessingModel(),
command.setType(PDU.RESPONSE); StatusInformation statusInformation = new StatusInformation(); StateReference ref = e.getStateReference();
/** * Sends a RESPONSE PDU to the source address of a INFORM request. * @param event * the <code>CommandResponderEvent</code> with the INFORM request. * @throws * MessageException if the response could not be created and sent. */ protected void sendInformResponse(CommandResponderEvent event) throws MessageException { PDU responsePDU = (PDU) event.getPDU().clone(); responsePDU.setType(PDU.RESPONSE); responsePDU.setErrorStatus(PDU.noError); responsePDU.setErrorIndex(0); messageDispatcher.returnResponsePdu(event.getMessageProcessingModel(), event.getSecurityModel(), event.getSecurityName(), event.getSecurityLevel(), responsePDU, event.getMaxSizeResponsePDU(), event.getStateReference(), new StatusInformation()); } }
command.setType(PDU.RESPONSE); StatusInformation statusInformation = new StatusInformation(); StateReference ref = e.getStateReference();
public synchronized void processPdu(CommandResponderEvent e) { PDU command = e.getPDU(); if (command != null) { if ((command.getType() != PDU.TRAP) && (command.getType() != PDU.V1TRAP) && (command.getType() != PDU.REPORT) && (command.getType() != PDU.RESPONSE)) { out.println(command.toString()); command.setErrorIndex(0); command.setErrorStatus(0); command.setType(PDU.RESPONSE); StatusInformation statusInformation = new StatusInformation(); StateReference ref = e.getStateReference(); try { e.getMessageDispatcher().returnResponsePdu(e. getMessageProcessingModel(), e.getSecurityModel(), e.getSecurityName(), e.getSecurityLevel(), command, e.getMaxSizeResponsePDU(), ref, statusInformation); } catch (MessageException ex) { err.println("Error while sending response: " + ex.getMessage()); LogFactory.getLogger(SnmpCommand.class).error(ex); } } } }
public synchronized void processPdu(CommandResponderEvent e) { PDU command = e.getPDU(); if (command != null) { System.out.println(command.toString()); if ((command.getType() != PDU.TRAP) && (command.getType() != PDU.V1TRAP) && (command.getType() != PDU.REPORT) && (command.getType() != PDU.RESPONSE)) { command.setErrorIndex(0); command.setErrorStatus(0); command.setType(PDU.RESPONSE); StatusInformation statusInformation = new StatusInformation(); StateReference ref = e.getStateReference(); try { e.getMessageDispatcher().returnResponsePdu(e.getMessageProcessingModel(), e.getSecurityModel(), e.getSecurityName(), e.getSecurityLevel(), command, e.getMaxSizeResponsePDU(), ref, statusInformation); } catch (MessageException ex) { System.err.println("Error while sending response: "+ex.getMessage()); LogFactory.getLogger(SnmpRequest.class).error(ex); } } } }
/** * Sends a RESPONSE PDU to the source address of a INFORM request. * @param event * the <code>CommandResponderEvent</code> with the INFORM request. * @throws * MessageException if the response could not be created and sent. */ protected void sendInformResponse(CommandResponderEvent event) throws MessageException { PDU responsePDU = (PDU) event.getPDU().clone(); responsePDU.setType(PDU.RESPONSE); responsePDU.setErrorStatus(PDU.noError); responsePDU.setErrorIndex(0); messageDispatcher.returnResponsePdu(event.getMessageProcessingModel(), event.getSecurityModel(), event.getSecurityName(), event.getSecurityLevel(), responsePDU, event.getMaxSizeResponsePDU(), event.getStateReference(), new StatusInformation()); } }
command.setType(PDU.RESPONSE); StatusInformation statusInformation = new StatusInformation(); StateReference ref = e.getStateReference(); try { e.getMessageDispatcher().returnResponsePdu(e.
StateReference ref = requestEvent.getStateReference(); requestEvent.getMessageDispatcher().returnResponsePdu(requestEvent. getMessageProcessingModel(),
StateReference ref = requestEvent.getStateReference(); requestEvent.getMessageDispatcher().returnResponsePdu(requestEvent. getMessageProcessingModel(),
/** * Sends a RESPONSE PDU to the source address of a INFORM request. * * @param event * the <code>CommandResponderEvent</code> with the INFORM request. * * @throws MessageException * if the response could not be created and sent. */ protected void sendInformResponse(CommandResponderEvent event) throws MessageException { PDU responsePDU = (PDU) event.getPDU().clone(); responsePDU.setType(PDU.RESPONSE); responsePDU.setErrorStatus(PDU.noError); responsePDU.setErrorIndex(0); messageDispatcher.returnResponsePdu(event.getMessageProcessingModel(), event.getSecurityModel(), event.getSecurityName(), event.getSecurityLevel(), responsePDU, event.getMaxSizeResponsePDU(), event.getStateReference(), new StatusInformation()); } }
@Override public void processPdu(CommandResponderEvent e) { PDU command = e.getPDU(); if (command == null) return; PDU response = processRequest(command); if (response == null) return; StatusInformation statusInformation = new StatusInformation(); StateReference ref = e.getStateReference(); try { LOG.debug("Replying with: {}", command); e.setProcessed(true); e.getMessageDispatcher().returnResponsePdu(e.getMessageProcessingModel(), e.getSecurityModel(), e.getSecurityName(), e.getSecurityLevel(), command, e.getMaxSizeResponsePDU(), ref, statusInformation); } catch (MessageException ex) { LOG.error("Error while sending response", ex); } }
response.setType(PDU.RESPONSE); StatusInformation statusInformation = new StatusInformation(); StateReference ref = e.getStateReference(); try { e.getMessageDispatcher().returnResponsePdu(e.getMessageProcessingModel(),
StateReference stateRef = requestEvent.getStateReference(); if (stateRef == null) { logger.warn("No state reference available for requestEvent=" + response, requestEvent.getMaxSizeResponsePDU(), requestEvent.getStateReference(), status);
StateReference stateRef = requestEvent.getStateReference(); if (stateRef == null) { logger.warn("No state reference available for requestEvent="+ response, requestEvent.getMaxSizeResponsePDU(), requestEvent.getStateReference(), status);
public void run() { if (forwarder.forward(request)) { PDU response = request.getResponsePDU(); if (response != null) { sendResponse(request.getCommandEvent(), response); } } else if (request.getProxyType() != ProxyForwarder.PROXY_TYPE_NOTIFY) { // proxy drop CounterEvent cevent = new CounterEvent(this, SnmpConstants.snmpProxyDrops); fireIncrementCounter(cevent); CommandResponderEvent cre = request.getCommandEvent(); if ((cre.getMessageProcessingModel() == MPv3.ID) && (cre.getStateReference() != null)) { ScopedPDU reportPDU = new ScopedPDU(); reportPDU.setType(PDU.REPORT); reportPDU.setContextEngineID(request.getContextEngineID()); reportPDU.setContextName(request.getContext()); reportPDU.add(new VariableBinding(SnmpConstants.snmpProxyDrops, cevent.getCurrentValue())); sendResponse(request.getCommandEvent(), reportPDU); } } }
public void run() { if (forwarder.forward(request)) { PDU response = request.getResponsePDU(); if (response != null) { sendResponse(request.getCommandEvent(), response); } } else if (request.getProxyType() != ProxyForwarder.PROXY_TYPE_NOTIFY) { // proxy drop CounterEvent cevent = new CounterEvent(this, SnmpConstants.snmpProxyDrops); fireIncrementCounter(cevent); CommandResponderEvent cre = request.getCommandEvent(); if ((cre.getMessageProcessingModel() == MPv3.ID) && (cre.getStateReference() != null)) { ScopedPDU reportPDU = new ScopedPDU(); reportPDU.setType(PDU.REPORT); reportPDU.setContextEngineID(request.getContextEngineID()); reportPDU.setContextName(request.getContext()); reportPDU.add(new VariableBinding(SnmpConstants.snmpProxyDrops, cevent.getCurrentValue())); sendResponse(request.getCommandEvent(), reportPDU); } } }