public class SnmpPduTrap extends Object implements SnmpSyntax, Cloneable
Modifier and Type | Field and Description |
---|---|
static int |
GenericAuthenticationFailure
Generic trap type: authentication-failure.
|
static int |
GenericColdStart
Generic trap type: cold start.
|
static int |
GenericEgpNeighborLoss
Generic trap type: EGP Neighbor Loss.
|
static int |
GenericEnterpriseSpecific
Generic trap type: Enterprise Specific.
|
static int |
GenericLinkDown
Generic trap type: link down.
|
static int |
GenericLinkUp
Generic trap type: link up.
|
static int |
GenericWarmStart
Generic trap type: warm start.
|
static int |
TRAP
The ASN.1 type for the SNMPv1 Trap.
|
Modifier | Constructor and Description |
---|---|
|
SnmpPduTrap()
Constructs a new SnmpPduTrap with the default values.
|
protected |
SnmpPduTrap(SnmpPduTrap second)
Constructs a new trap pdu that is identical to the passed pdu.
|
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.
|
Object |
clone() |
int |
decodeASN(byte[] buf,
int offset,
AsnEncoder encoder)
Decodes the protocol data unit from the passed buffer.
|
SnmpSyntax |
duplicate()
Creates a duplicate (in memory) object of the caller.
|
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.
|
SnmpIPAddress |
getAgentAddress()
Gets the remote agent's IP address.
|
SnmpObjectId |
getEnterprise()
Used to get the enterpise identifier of the trap.
|
int |
getGeneric()
Returns the generic code for the trap.
|
int |
getLength()
Returns the number of variables contained in the PDU.
|
int |
getSpecific()
Returns the specific code for the trap.
|
long |
getTimeStamp()
Returns the timeticks from the trap.
|
SnmpVarBind |
getVarBindAt(int ndx)
Retrieves the variable at the specific index.
|
SnmpVarBind |
removeVarBindAt(int ndx)
Removes the variable as defined by the index
|
void |
setAgentAddress(SnmpIPAddress addr)
Sets the remote agent's IP address.
|
void |
setEnterprise(SnmpObjectId id)
Sets the enterprise identifier for the trap.
|
void |
setEnterprise(String id)
Sets the enterprise identifier for the trap.
|
void |
setGeneric(int generic)
Sets the generic code for the trap.
|
void |
setSpecific(int spec)
Sets the specific type for the trap.
|
void |
setTimeStamp(long ts)
Set's the timeticks in the trap.
|
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
|
public static final int TRAP
public static final int GenericColdStart
public static final int GenericWarmStart
public static final int GenericLinkDown
public static final int GenericLinkUp
public static final int GenericAuthenticationFailure
public static final int GenericEgpNeighborLoss
public static final int GenericEnterpriseSpecific
public SnmpPduTrap()
protected SnmpPduTrap(SnmpPduTrap second)
second
- The object to copy.public SnmpObjectId getEnterprise()
public void setEnterprise(SnmpObjectId id)
id
- The object identifier.public void setEnterprise(String id)
id
- The new identifier.public SnmpIPAddress getAgentAddress()
public void setAgentAddress(SnmpIPAddress addr)
addr
- The remote agent's ip address.public int getGeneric()
public void setGeneric(int generic)
generic
- The new generic code for the trap.public int getSpecific()
public void setSpecific(int spec)
spec
- The new specific identifier.public long getTimeStamp()
public void setTimeStamp(long ts)
ts
- The timeticks for the trap.public 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 SnmpSyntax duplicate()
SnmpSyntax
duplicate
in interface SnmpSyntax
Copyright © 2021. All rights reserved.