Ejemplo n.º 1
0
  /** For SNMP Runtime internal use only. */
  final void processResponse() {

    if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINER)) {
      SNMP_ADAPTOR_LOGGER.logp(
          Level.FINER,
          SnmpInformRequest.class.getName(),
          "processResponse",
          "errstatus = " + errorStatus);
    }

    if (inProgress() == false) { // check if this request is still alive.
      responsePdu = null;
      return; // the request may have  cancelled.
    }

    if (errorStatus >= snmpReqInternalError) {
      handleInternalError("Internal Error...");
      return;
    }

    try {
      parsePduPacket(responsePdu);
      // responsePdu = null;

      // At this point the errorIndex is rationalized to start with 0.
      switch (errorStatus) {
        case snmpRspNoError:
          handleSuccess();
          return;
        case snmpReqTimeout:
          handleTimeout();
          return;
        case snmpReqInternalError:
          handleInternalError("Unknown internal error.  deal with it later!");
          return;
        case snmpReqHandleTooBig:
          setErrorStatusAndIndex(snmpRspTooBig, 0);
          handleError("Cannot handle too-big situation...");
          return;
        case snmpReqRefireAfterVbFix:
          // Refire request after fixing varbindlist.
          initializeAndFire();
          return;
        default:
          handleError("Error status set in packet...!!");
          return;
      }
    } catch (Exception e) {
      if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) {
        SNMP_ADAPTOR_LOGGER.logp(
            Level.FINEST,
            SnmpInformRequest.class.getName(),
            "processResponse",
            "Got unexpected exception",
            e);
      }
      reason = e.getMessage();
    }
    handleInternalError(reason);
  }
Ejemplo n.º 2
0
 /**
  * For SNMP Runtime internal use only. Starts an inform request in asynchronous mode. The callback
  * interface is used to notify the user upon request completion.
  *
  * @param vblst The list of <CODE>SnmpVarBind</CODE> to be used.
  * @exception SnmpStatusException This inform request is already in progress.
  */
 synchronized void start(SnmpVarBindList vblst) throws SnmpStatusException {
   if (inProgress()) throw new SnmpStatusException("Inform request already in progress.");
   setVarBindList(vblst);
   initializeAndFire();
 }