Package uk.co.westhawk.snmp.stack
Class TrapPduv1
java.lang.Object
java.util.Observable
uk.co.westhawk.snmp.stack.Pdu
uk.co.westhawk.snmp.stack.TrapPduv1
- Direct Known Subclasses:
OneTrapPduv1
,PassiveTrapPduv1
This class represents the ASN SNMPv1 Trap PDU object.
See RFC1157-SNMP.
Note that the SNMPv1 Trap PDU is the only PDU with a different PDU
format. It has additional fields like enterprise
,
ipAddress
, genericTrap
,
specificTrap
and timeTicks
.
- Version:
- $Revision: 3.14 $ $Date: 2007/10/17 10:44:09 $
- Author:
- Birgit Arkesteijn
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionTrapPduv1
(SnmpContext con) Constructor.TrapPduv1
(SnmpContextPool con) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionReturns the type of object generating the trap.int
Returns the generic trap type.Returns the string representation of the generic trap.byte[]
Returns the IP Address of the object generating the trap.int
Returns the specific trap code.long
Returns the sysUpTime of the agent.boolean
send()
Sends the TrapPduv1.void
setEnterprise
(String var) Sets the type of object generating the trap.void
setGenericTrap
(int var) Sets the generic trap type.void
setIpAddress
(byte[] var) Sets the IP Address of the object generating the trap.void
setSpecificTrap
(int var) Sets the specific trap code.void
setTimeTicks
(long var) Sets the sysUpTime of the agent.toString()
Returns the string representation of this object.Methods inherited from class uk.co.westhawk.snmp.stack.Pdu
addOid, addOid, addOid, addOid, addOid, getContext, getErrorIndex, getErrorStatus, getErrorStatusString, getMsgType, getReqId, getRequestVarbinds, getResponseVarbinds, getRetryIntervals, isTimedOut, notifyObservers, send, setRetryIntervals, waitForSelf
Methods inherited from class java.util.Observable
addObserver, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers
-
Constructor Details
-
TrapPduv1
Constructor.- Parameters:
con
- The context (v1) of the TrapPduv1- See Also:
-
TrapPduv1
Constructor.- Parameters:
con
- The context pool (v1) of the TrapPduv1- See Also:
-
-
Method Details
-
setEnterprise
Sets the type of object generating the trap. This parameter is based on the sysObjectId. -
getEnterprise
Returns the type of object generating the trap. -
setIpAddress
public void setIpAddress(byte[] var) Sets the IP Address of the object generating the trap. -
getIpAddress
public byte[] getIpAddress()Returns the IP Address of the object generating the trap. -
setGenericTrap
public void setGenericTrap(int var) Sets the generic trap type. By default the warmStart is sent. -
getGenericTrap
public int getGenericTrap()Returns the generic trap type. -
getGenericTrapString
Returns the string representation of the generic trap.- Returns:
- the generic trap string
- See Also:
-
setSpecificTrap
public void setSpecificTrap(int var) Sets the specific trap code. -
getSpecificTrap
public int getSpecificTrap()Returns the specific trap code. -
setTimeTicks
public void setTimeTicks(long var) Sets the sysUpTime of the agent.RFC1155-SMI: TimeTicks:
This application-wide type represents a non-negative integer which counts the time in hundredths of a second since some epoch. When object types are defined in the MIB which use this ASN.1 type, the description of the object type identifies the reference epoch. -
getTimeTicks
public long getTimeTicks()Returns the sysUpTime of the agent.- See Also:
-
send
Sends the TrapPduv1. Since the Trap v1 PDU has a different format (sigh), a different encoding message has to be called. Note that all properties of the context have to be set before this point.- Overrides:
send
in classPdu
- Throws:
IOException
PduException
-
toString
Returns the string representation of this object.
-