Module org.snmp4j
Package org.snmp4j.mp

Interface MPv3ScopedPDUExtractor

All Known Implementing Classes:
MPv3

public interface MPv3ScopedPDUExtractor
Interface defining the mechanism to extract the ScopedPDU from an SNMPv3 message. The extraction process involves dissecting the whole SNMP message, applying security models, and converting the necessary parts into a ScopedPDU.
Since:
3.9.0
Version:
3.9.2
  • Method Details

    • extractScopedPDU

      int extractScopedPDU(BERInputStream wholeMsg, SecurityModel secModel, TransportStateReference tmStateReference, MPv3.HeaderData header, Integer32 securityLevel, Integer32 maxSizeResponseScopedPDU, StatusInformation statusInformation, OctetString securityName, OctetString securityEngineID, Integer32 snmpVersion, SecurityParameters secParameters, BEROutputStream scopedPDU, SecurityStateReference secStateReference) throws IOException
      Use a security model to extract the scoped PDU from the wholeMsg and return state information.
      Parameters:
      wholeMsg - the incoming SNMP message with position at the beginning of the scoped PDU.
      secModel - the security model to be used.
      tmStateReference - the already collected transport model state reference.
      header - provides the message length data from the already read message header.
      securityLevel - the target security level.
      maxSizeResponseScopedPDU - returns the maximum size of the response PDU allowed for this security model.
      statusInformation - returns the status information
      securityName - returns the extracted security name used to authenticate/encrypt the message.
      securityEngineID - returns the security engine ID
      snmpVersion - returns the SNMP version
      secParameters - returns the security parameters.
      scopedPDU - returns the scoped PDU.
      secStateReference - returns security state reference.
      Returns:
      the status of the operation. See SecurityModel.processIncomingMsg(int, int, SecurityParameters, SecurityModel, int, BERInputStream, TransportStateReference, OctetString, OctetString, BEROutputStream, Integer32, SecurityStateReference, StatusInformation)
      Throws:
      IOException - on fatal encoding errors.
      Since:
      3.9.0
    • validatePreparedPDU

      default <A extends Address> Integer validatePreparedPDU(OctetString securityName, Integer32 securityLevel, ScopedPDU scopedPdu, MPv3.HeaderData header, OctetString securityEngineID, SecurityModel secModel, StateReference<A> stateReference, SecurityStateReference secStateReference, PduHandle sendPduHandle, MutableStateReference<A> mutableStateReference, StatusInformation statusInformation)
      Validates the prepared PDU (Protocol Data Unit) for conformance to SNMPv3 message processing. This method performs various checks to ensure the received or prepared PDU is consistent with the expected values as per SNMPv3 specifications.
      Parameters:
      securityName - The security name representing the user or entity.
      securityLevel - The security level of the message (e.g., noAuthNoPriv, authNoPriv, authPriv).
      scopedPdu - The SNMP ScopedPDU to be validated.
      header - The SNMP HeaderData containing metadata like message ID.
      securityEngineID - The security engine ID of the sender or receiver.
      secModel - The SecurityModel used to process the PDU.
      stateReference - State reference associated with the message.
      secStateReference - The SecurityStateReference associated with processing.
      sendPduHandle - The handle used to track the PDU being sent.
      mutableStateReference - The mutable state reference for updating internal state during processing.
      statusInformation - The status information in case of errors or processing outcomes.
      Returns:
      An integer value indicating the result of the validation: - SnmpConstants.SNMP_MP_OK if the validation is successful. - SnmpConstants.SNMP_MP_MATCH_ERROR if the received message does not match the expected cached values. - SnmpConstants.SNMP_MP_UNKNOWN_MSGID if the message ID could not be found in the cache. - SnmpConstants.SNMP_MP_INVALID_ENGINEID if the security engine ID does not match the local engine ID. - SnmpConstants.SNMP_MP_DOUBLED_MESSAGE if a duplicate message is detected. - null if the validation fails undefined and processing cannot continue.
      Since:
      3.9.2