Class BlockPdu

java.lang.Object
uk.co.westhawk.snmp.pdu.BlockPdu

public class BlockPdu extends Object
The BlockPdu class is a wrapper class that will block until it receives the answer.
Version:
$Revision: 3.13 $ $Date: 2006/01/17 17:43:53 $
Author:
Birgit Arkesteijn
See Also:
  • Field Details

    • GET

      public static final int GET
      The GET PDU type.
      See Also:
    • SET

      public static final int SET
      The SET PDU type.
      See Also:
    • GETNEXT

      public static final int GETNEXT
      The GETNEXT PDU type.
      See Also:
    • GETBULK

      public static final int GETBULK
      The GETBULK PDU type. Note, the getBulkRequest was introduced in SNMPv2c. For that reason it should not be sent with SNMPv1.
      See Also:
  • Constructor Details

    • BlockPdu

      public BlockPdu(SnmpContextBasisFace con)
      Constructor.
      Parameters:
      con - The context of the request
  • Method Details

    • addOid

      public void addOid(String oid)
      Adds an OID to the PDU.
      Parameters:
      oid - The oid
      See Also:
    • addOid

      public void addOid(String oid, AsnObject val)
      Adds an OID to the PDU and the value that has to be set. This is only useful for the SET type.
      Parameters:
      oid - The oid
      See Also:
    • addOid

      public void addOid(AsnObjectId oid, AsnObject val)
      Adds an OID (object identifier) to the PDU and the value that has to be set. This is only useful for the SET type.
      Parameters:
      oid - The oid
      val - The value
      Since:
      4_12
      See Also:
    • addOid

      public void addOid(AsnObjectId oid)
      Adds an OID (object identifier) to the PDU. The OID indicates which MIB variable we request or which MIB variable should be set.
      Parameters:
      oid - The oid
      Since:
      4_12
      See Also:
    • addOid

      public void addOid(varbind var)
      Adds an OID (object identifier) to the PDU.
      Parameters:
      var - The varbind
      See Also:
    • setBulkParameters

      public void setBulkParameters(int nr, int mr)
      Sets the getBulkRequest parameters. This is only useful for the GETBULK type. If these parameters are not set, they both default to zero.
      Parameters:
      nr - The non repeaters.
      mr - The max repetitions.
      See Also:
    • addOid

      public void addOid(String[] oids)
      Adds a list of OIDs to the PDU.
      Parameters:
      oids - The OIDs to be added
    • setPduType

      public void setPduType(int newType)
      Sets the type of PDU. The type indicates the kind of request, i.e. the getRequest (the default), the setRequest, the getNextRequest, or the getBulkRequest.
      Parameters:
      newType - The type of request
      See Also:
    • setRetryIntervals

      public void setRetryIntervals(int[] retryIntervals)
      Sets the retry intervals of the PDU. This method overwrites the default values in the PDU class.
      Parameters:
      retryIntervals - The interval in msec of each retry
      See Also:
    • getResponseVariable

      public AsnObject getResponseVariable() throws PduException, IOException
      Sends the request and waits (blocks) for the response. Returns the value of the first variable binding in the response. If no response was received, this will be null.
      Returns:
      The value of the first variable binding in the response
      Throws:
      PduException
      IOException
      See Also:
      • sendAndWait()
    • getResponseVariables

      public AsnObject[] getResponseVariables() throws PduException, IOException
      Sends the request and waits (blocks) for the response. Returns the values of the variable bindings in the response. If no response was received, this will be null.
      Returns:
      The values of the variable bindings in the response
      Throws:
      PduException
      IOException
      See Also:
      • sendAndWait()
    • getResponseVariableBinding

      public varbind getResponseVariableBinding() throws PduException, IOException
      Sends the request and waits (blocks) for the response. Returns the first variable binding in the response. If no response was received, this will be null.
      Returns:
      The first variable binding in the response
      Throws:
      PduException
      IOException
      See Also:
      • sendAndWait()
    • getResponseVariableBindings

      public varbind[] getResponseVariableBindings() throws PduException, IOException
      Sends the request and waits (blocks) for the response. Returns the variable bindings in the response. If no response was received, this will be null.
      Returns:
      The variable bindings in the response
      Throws:
      PduException
      IOException
      See Also:
      • sendAndWait()
    • getErrorIndex

      public int getErrorIndex()
      Returns the error index of the PDU. This will only have been set after the response is received. Thanks to Maga Hegde (mhegde@zumanetworks.com) to requesting this method.
      Returns:
      The error index
      See Also:
    • getErrorStatus

      public int getErrorStatus()
      Returns the error status of the PDU. This will only have been set after the response is received.
      Returns:
      The error status
      See Also:
    • getErrorStatusString

      public String getErrorStatusString()
      Returns the error status string of the PDU. This will only have been set after the response is received.
      Returns:
      The error status string
      See Also: