Overview | Package | Class | Tree | Deprecated | Index | Help
| SNMP Stack 5_1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## uk.co.westhawk.snmp.pdu
Class BlockPdu

    java.lang.Object
      |
      +--uk.co.westhawk.snmp.pdu.BlockPdu

public class BlockPdu
extends java.lang.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:
  `Pdu`

Field Summary
`static int` | `GET` The GET PDU type.
`static int` | `GETBULK` The GETBULK PDU type.
`static int` | `GETNEXT` The GETNEXT PDU type.
`protected java.util.Vector` | `reqVarbinds`
`static int` | `SET` The SET PDU type.

Constructor Summary
`BlockPdu(SnmpContextBasisFace con)` Constructor.

Method Summary
`void` | `addOid(AsnObjectId oid)` Adds an OID (object identifier) to the PDU.
`void` | `addOid(AsnObjectId oid, AsnObject val)` Adds an OID (object identifier) to the PDU and the value that has to be set.
`void` | `addOid(java.lang.String oid)` Adds an OID to the PDU.
`void` | `addOid(java.lang.String[] oids)` Adds a list of OIDs to the PDU.
`void` | `addOid(java.lang.String oid, AsnObject val)` Adds an OID to the PDU and the value that has to be set.
`void` | `addOid(varbind var)` Adds an OID (object identifier) to the PDU.
`int` | `getErrorIndex()` Returns the error index of the PDU.
`int` | `getErrorStatus()` Returns the error status of the PDU.
`java.lang.String` | `getErrorStatusString()` Returns the error status string of the PDU.
`AsnObject` | `getResponseVariable()` Sends the request and waits (blocks) for the response.
`varbind` | `getResponseVariableBinding()` Sends the request and waits (blocks) for the response.
`varbind[]` | `getResponseVariableBindings()` Sends the request and waits (blocks) for the response.
`AsnObject[]` | `getResponseVariables()` Sends the request and waits (blocks) for the response.
`protected varbind[]` | `sendAndWait()` Sends the request and waits (blocks) for the response.
`void` | `setBulkParameters(int nr, int mr)` Sets the getBulkRequest parameters.
`void` | `setPduType(int newType)` Sets the type of PDU.
`void` | `setRetryIntervals(int[] retryIntervals)` Sets the retry intervals of the PDU.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### GET

    public static final int GET

  The GET PDU type.

  See Also:
    Constant Field Values

### SET

    public static final int SET

  The SET PDU type.

  See Also:
    Constant Field Values

### GETNEXT

    public static final int GETNEXT

  The GETNEXT PDU type.

  See Also:
    Constant Field Values

### 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:
    Constant Field Values

### reqVarbinds

    protected java.util.Vector reqVarbinds

Constructor Detail

### BlockPdu

    public BlockPdu(SnmpContextBasisFace con)

  Constructor.

Parameters:
  `con` - The context of the request

Method Detail

### addOid

    public void addOid(java.lang.String oid)

  Adds an OID to the PDU.

  Parameters:
    `oid` - The oid
  See Also:
    `Pdu.addOid(String)`

### addOid

    public void addOid(java.lang.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:
    `Pdu.addOid(String, AsnObject)`, `SET`

### 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:
    `Pdu.addOid(AsnObjectId, AsnObject)`, `varbind`

### 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:
    `Pdu.addOid(AsnObjectId)`, `varbind`

### addOid

    public void addOid(varbind var)

  Adds an OID (object identifier) to the PDU.

  Parameters:
    `var` - The varbind
  See Also:
    `addOid(String)`

### 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:
    `GetBulkPdu.setMaxRepetitions(int)`, `GetBulkPdu.setNonRepeaters(int)`, `GETBULK`

### addOid

    public void addOid(java.lang.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:
    `GET`, `SET`, `GETNEXT`, `GETBULK`

### 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:
    `Pdu.setRetryIntervals(int[])`

### getResponseVariable

    public AsnObject getResponseVariable()
                                  throws PduException,
                                         java.io.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
    `PduException`
    `java.io.IOException`
  See Also:
    `sendAndWait()`

### getResponseVariables

    public AsnObject[] getResponseVariables()
                                     throws PduException,
                                            java.io.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
    `PduException`
    `java.io.IOException`
  See Also:
    `sendAndWait()`

### getResponseVariableBinding

    public varbind getResponseVariableBinding()
                                       throws PduException,
                                              java.io.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
    `PduException`
    `java.io.IOException`
  See Also:
    `sendAndWait()`

### getResponseVariableBindings

    public varbind[] getResponseVariableBindings()
                                          throws PduException,
                                                 java.io.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
    `PduException`
    `java.io.IOException`
  See Also:
    `sendAndWait()`

### sendAndWait

    protected varbind[] sendAndWait()
                             throws PduException,
                                    java.io.IOException

  Sends the request and waits (blocks) for the response. This is the core of the blocking getResponseVariableX() methods.

  Returns:
    The response, can be null if there was a timeout
    `PduException`
    `java.io.IOException`
  See Also:
    `Pdu.send()`, `Pdu.waitForSelf()`, `Pdu.getResponseVarbinds()`

### 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:
    `Pdu.getErrorIndex()`

### 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:
    `Pdu.getErrorStatus()`

### getErrorStatusString

    public java.lang.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:
    `Pdu.getErrorStatusString()`

Overview | Package | Class | Tree | Deprecated | Index | Help
| SNMP Stack 5_1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD