Class SnmpPduRequest

  • All Implemented Interfaces:
    java.lang.Cloneable, SnmpSyntax

    public class SnmpPduRequest
    extends SnmpPduPacket
    The SnmpPduRequest defines the SNMPv1 and SNMPv2 Protocol Data Unit (PDU) for certain message types. The types include: GetRequest, GetNextRequest, SetRequest, SNMPv2-Trap, InformRequest, and Response. By default the class is constructed as a SNMP GetRequest, but can be defined to any of the accepted types. For more information see [Stallings99] page 368.
    Author:
    Brian Weaver
    • Method Detail

      • getErrorStatus

        public int getErrorStatus()
        Returns the error status for the request. This is only value on RESPONSE pdu's. Otherwise the value should be equal to zero. For information on error conditions see the SnmpPduPacket class.
        Returns:
        The error status of the pdu
        See Also:
        SnmpPduPacket
      • setErrorStatus

        public void setErrorStatus​(int status)
        Used to set the value of the error status member. This should normally be equal to zero, except for RESPONSE pdu's
        Parameters:
        status - The new error status for the pdu.
      • getErrorIndex

        public int getErrorIndex()
        Returns the index of the variable in error if the error status is non-zero. The index is base one, not zero. Thus an error index equal to one is the first variable in the PDU. An index equal to zero is not valid.
        Returns:
        The index of the bad variable.
      • setErrorIndex

        public void setErrorIndex​(int ndx)
        Sets the current error index in the PDU. the index must be in the range (0..#variables] unless there is no error. If there is no error then the index should be equal to zero.
        Parameters:
        ndx - The new error index.
      • fix

        public void fix()
        Fixes a PDU in error. If the error index and error status is non-zero then the variable in error is removed from the PDU. Once the variable is removed the error index and error status are reset to zero.
      • duplicate

        public SnmpSyntax duplicate()
        Used to get a duplicate of self. The duplicate is identical to self but shares no common data.
        Specified by:
        duplicate in interface SnmpSyntax
        Specified by:
        duplicate in class SnmpPduPacket
        Returns:
        A newly created copy of self.
      • clone

        public java.lang.Object clone()
        Used to get a duplicate of self. The duplicate is identical to self but shares no common data.
        Specified by:
        clone in class SnmpPduPacket
        Returns:
        A newly created copy of self.