Package uk.co.westhawk.snmp.pdu
Class BlockPdu
java.lang.Object
uk.co.westhawk.snmp.pdu.BlockPdu
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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds an OID to the PDU.void
Adds a list of OIDs to the PDU.void
Adds an OID to the PDU and the value that has to be set.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
Adds an OID (object identifier) to the PDU.int
Returns the error index of the PDU.int
Returns the error status of the PDU.Returns the error status string of the PDU.Sends the request and waits (blocks) for the response.Sends the request and waits (blocks) for the response.varbind[]
Sends the request and waits (blocks) for the response.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.
-
Field Details
-
GET
public static final int GETThe GET PDU type.- See Also:
-
SET
public static final int SETThe SET PDU type.- See Also:
-
GETNEXT
public static final int GETNEXTThe GETNEXT PDU type.- See Also:
-
GETBULK
public static final int GETBULKThe 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
Constructor.- Parameters:
con
- The context of the request
-
-
Method Details
-
addOid
Adds an OID to the PDU.- Parameters:
oid
- The oid- See Also:
-
addOid
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
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 oidval
- The value- Since:
- 4_12
- See Also:
-
addOid
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
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
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. -
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
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
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
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
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
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:
-