Class PduBuilder

java.lang.Object
org.snmp4j.fluent.PduBuilder
All Implemented Interfaces:
PDUFactory

public class PduBuilder extends Object implements PDUFactory
The PduBuilder creates SNMP PDUs based on a provided TargetBuilder.
Since:
3.5.0
Author:
Frank Fock
  • Field Details

  • Constructor Details

    • PduBuilder

      protected PduBuilder(TargetBuilder<?> targetBuilder)
  • Method Details

    • contextName

      public PduBuilder contextName(String contextName)
    • contextName

      public PduBuilder contextName(OctetString contextName)
    • contextEngineID

      public PduBuilder contextEngineID(byte[] contextEngineID)
    • contextEngineID

      public PduBuilder contextEngineID(OctetString contextEngineID)
    • type

      public PduBuilder type(int pduType)
    • oid

      public PduBuilder oid(OID... oids)
    • oids

      public PduBuilder oids(String... oids)
    • vb

      public PduBuilder vb(OID oid, Variable value)
    • vbs

      public PduBuilder vbs(VariableBinding... vbs)
    • build

      public PDU build()
      Build the actual PDU based on the previously provided parameters and return it.
      Returns:
      a new PDU instance. For an SNMP version greater or equal 3, a ScopedPDU is returned.
    • build

      public PDU build(int messageProcessingModel)
      Build the actual PDU based on the previously provided parameters and return it.
      Parameters:
      messageProcessingModel - a message processing model ID (see MessageProcessingModel.getID()).
      Returns:
      a new PDU instance. For an SNMP version greater or equal 3, a ScopedPDU is returned.
      Since:
      3.11.0
    • initPdu

      public PDU initPdu(PDU pdu)
      Initialize the PDU with the previously provided parameters.
      Parameters:
      pdu - the PDU instance to be initialized.
      Returns:
      the initialized PDU.
      Since:
      3.11.0
    • createPDU

      public PDU createPDU(Target<?> target)
      Description copied from interface: PDUFactory
      Creates a PDU instance for the supplied target. The created PDU has to be compliant to the SNMP version defined by the supplied target. For example, a SNMPv3 target requires a ScopedPDU instance.
      Specified by:
      createPDU in interface PDUFactory
      Parameters:
      target - the Target where the PDU to be created will be sent.
      Returns:
      PDU a PDU instance that is compatible with the supplied target.
    • createPDU

      public PDU createPDU(MessageProcessingModel messageProcessingModel)
      Description copied from interface: PDUFactory
      Creates a PDU instance that is compatible with the given SNMP version (message processing model).
      Specified by:
      createPDU in interface PDUFactory
      Parameters:
      messageProcessingModel - a MessageProcessingModel instance.
      Returns:
      a PDU instance that is compatible with the given SNMP version (message processing model).