SNMP Stack 4_12

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.11 $ $Date: 2002/10/23 09:56:20 $
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)
          Add an OID (object identifier) to the Pdu.
 void addOid(AsnObjectId oid, AsnObject val)
          Add 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)
          Add 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.

SET

public static final int SET
The SET pdu type.

GETNEXT

public static final int GETNEXT
The GETNEXT pdu type.

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.

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)
Add 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)
Add an OID (object identifier) to the Pdu. The OID indicates WHAT MIB variable we request for or WHAT MIB variable should be set.
Parameters:
oid - The oid
Since:
4_12
See Also:
Pdu.addOid(AsnObjectId), varbind

addOid

public void addOid(varbind var)
Add 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, both values will be 0 (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
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
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
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
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
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()

SNMP Stack 4_12