public abstract class SnmpPduPacket extends Object implements SnmpSyntax, Cloneable
SnmpPduRequest
,
SnmpPduBulk
Modifier and Type | Field and Description |
---|---|
static int |
ErrAuthorizationError
The authorization failed.
|
static int |
ErrBadValue
If the object type does not match the object value in the agent's tables.
|
static int |
ErrCommitFailed
Unable to commit the required values.
|
static int |
ErrGenError
A generic SNMPv1 error occured.
|
static int |
ErrInconsistentName
The passed object identifier is not consistent.
|
static int |
ErrInconsistentValue
The specified value are not consistant.
|
static int |
ErrNoAccess
The specified SET request could not access the specified instance.
|
static int |
ErrNoCreation
The manager does not have the permission to create the specified
object(s).
|
static int |
ErrNoError
No error occured in the request.
|
static int |
ErrNoSuchName
There was no such object identifier defined in the agent's tables.
|
static int |
ErrNotWritable
The specified instance or table is not writable
|
static int |
ErrReadOnly
Attempting to set a read-only object in the agent's tables.
|
static int |
ErrResourceUnavailable
The requested resource are not available.
|
static int |
ErrTooBig
The PDU was too large for the agent to process
|
static int |
ErrUndoFailed
Unable to perform the undo request
|
static int |
ErrWrongEncoding
The specified object is not correctly encoded.
|
static int |
ErrWrongLength
The specified object is not the correct length.
|
static int |
ErrWrongType
The specified object is not the correct type.
|
static int |
ErrWrongValue
The specified object doe not have the correct value.
|
static int |
GET
Defines a SNMPv1 Get Request PDU message.
|
static int |
GETBULK
Defines a SNMPv2 Get Bulk Request message.
|
static int |
GETNEXT
Defines a SNMPv1 Get Next Request PDU message.
|
static int |
INFORM
Defines a SNMPv2 Inform Request message
|
protected int |
m_errIndex
The error index in a normal pdu, it is used as the maximum repititions in
the get bulk pdu.
|
protected int |
m_errStatus
The error status in a normal pdu, is is used as the non-repeaters in the
getbulk.
|
static int |
REPORT
Defines a SNMPv2 Report message.
|
static int |
RESPONSE
Defines a SNMPv1 Response PDU message.
|
static int |
SET
Defines a SNMPv1 PDU Set Request message.
|
static int |
V2TRAP
Defines a SNMPv2 Trap message
|
Modifier | Constructor and Description |
---|---|
protected |
SnmpPduPacket()
Default class constructor.
|
protected |
SnmpPduPacket(int command)
creates a new pdu with the command set to the passed value.
|
protected |
SnmpPduPacket(int command,
SnmpVarBind[] vars)
Creates a new pdu with the spcified command and the list of variables.
|
protected |
SnmpPduPacket(SnmpPduPacket second)
Class copy constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addVarBind(SnmpVarBind vb)
Adds a new variable to the protocol data unit.
|
void |
addVarBindAt(int ndx,
SnmpVarBind vb)
Adds a variable at a specific index.
|
abstract Object |
clone()
Defined for derived classes to return a duplicate of self.
|
int |
decodeASN(byte[] buf,
int offset,
AsnEncoder encoder)
Decodes the protocol data unit from the passed buffer.
|
abstract SnmpSyntax |
duplicate()
Defined for derived classes to return a duplicate of self.
|
int |
encodeASN(byte[] buf,
int offset,
AsnEncoder encoder)
Encodes the protocol data unit using the passed encoder and stores the
results in the passed buffer.
|
int |
getCommand()
Returns the type of PDU.
|
int |
getLength()
/** Returns the number of variables in the data unit.
|
SnmpPeer |
getPeer()
Returns the current peer for this packet.
|
int |
getRequestId()
Returns the current request id for this packet.
|
SnmpVarBind |
getVarBindAt(int ndx)
Retrieves the variable at the specific index.
|
static int |
nextSequence()
Use to sequence the all pdu request across the entire library.
|
SnmpVarBind |
removeVarBindAt(int ndx)
Removes the variable as defined by the index
|
void |
setCommand(int cmd)
Sets the PDU's current command
|
void |
setPeer(SnmpPeer peer)
Sets the Peer for the Packet
|
void |
setRequestId(int reqid)
Sets the protocol data unit's sequence identifer
|
void |
setVarBindAt(int ndx,
SnmpVarBind vb)
Sets the specific variable at the requested location.
|
SnmpVarBind[] |
toVarBindArray()
Returns a list of all the variables managed by this protocol data unit.
|
byte |
typeId()
Returns the PDU commmand in an 8-bit format
|
protected int m_errStatus
SnmpPduRequest
,
SnmpPduBulk
protected int m_errIndex
SnmpPduRequest
,
SnmpPduBulk
public static final int GET
public static final int GETNEXT
public static final int RESPONSE
public static final int SET
public static final int GETBULK
public static final int INFORM
public static final int V2TRAP
public static final int REPORT
public static final int ErrNoError
public static final int ErrTooBig
public static final int ErrNoSuchName
public static final int ErrBadValue
public static final int ErrReadOnly
public static final int ErrGenError
public static final int ErrNoAccess
public static final int ErrWrongType
public static final int ErrWrongLength
public static final int ErrWrongEncoding
public static final int ErrWrongValue
public static final int ErrNoCreation
public static final int ErrInconsistentValue
public static final int ErrResourceUnavailable
public static final int ErrCommitFailed
public static final int ErrUndoFailed
public static final int ErrAuthorizationError
public static final int ErrNotWritable
public static final int ErrInconsistentName
protected SnmpPduPacket()
protected SnmpPduPacket(SnmpPduPacket second)
second
- The source pdu to copy values from.protected SnmpPduPacket(int command)
command
- The type of pdu packet.protected SnmpPduPacket(int command, SnmpVarBind[] vars)
command
- The type of pdu packet.vars
- The variable list for the pdu.public static int nextSequence()
public int getCommand()
public void setCommand(int cmd)
cmd
- The new command.public int getRequestId()
public void setPeer(SnmpPeer peer)
peer
- The peer of this packetpublic SnmpPeer getPeer()
public void setRequestId(int reqid)
reqid
- The new request idpublic int getLength()
public void addVarBind(SnmpVarBind vb)
vb
- The new variable to addpublic void addVarBindAt(int ndx, SnmpVarBind vb)
ndx
- The index of the variablevb
- The new variable.public SnmpVarBind getVarBindAt(int ndx)
ndx
- The index of the variablepublic void setVarBindAt(int ndx, SnmpVarBind vb)
ndx
- The location to setvb
- The new variablepublic SnmpVarBind removeVarBindAt(int ndx)
ndx
- The index of the variable to removepublic SnmpVarBind[] toVarBindArray()
public byte typeId()
typeId
in interface SnmpSyntax
public int encodeASN(byte[] buf, int offset, AsnEncoder encoder) throws AsnEncodingException
encodeASN
in interface SnmpSyntax
buf
- The buffer to write the encoded information.offset
- The offset to start writing informationencoder
- The encoder object.AsnEncodingException
- Thrown if the encoder finds an error in the buffer.public int decodeASN(byte[] buf, int offset, AsnEncoder encoder) throws AsnDecodingException
decodeASN
in interface SnmpSyntax
buf
- The encode bufferoffset
- The offset byte to begin decodingencoder
- The decoder object.AsnDecodingException
- Thrown by the encoder if an error occurs trying to decode
the data buffer.public abstract SnmpSyntax duplicate()
duplicate
in interface SnmpSyntax
Copyright © 2021. All rights reserved.