SNMP Stack 4_12

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

public abstract class TrapPduv1
extends Pdu

This class represents the ASN SNMPv1 Trap Pdu object. See RFC 1157.

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.8 $ $Date: 2002/10/10 15:13:57 $
Author:
Birgit Arkesteijn
See Also:
TrapPduv2

Fields inherited from class uk.co.westhawk.snmp.stack.Pdu
added, answered, context, encodedPacket, errind, errstat, msg_type, reqVarbinds, respVarbinds
 
Constructor Summary
TrapPduv1(SnmpContext con)
          Constructor.
 
Method Summary
 java.lang.String getEnterprise()
          Returns the type of object generating the trap.
 int getGenericTrap()
          Returns the generic trap type.
 java.lang.String getGenericTrapString()
          Returns the string representation of the generic trap.
 byte[] getIpAddress()
          Returns the IP Address of the object generating the trap.
 int getSpecificTrap()
          Returns the specific trap code.
 long getTimeTicks()
          Returns the sysUpTime of the agent.
protected  void new_value(int n, varbind res)
          Has no meaning, since there is not response.
 boolean send()
          Send the TrapPduv1.
 void setEnterprise(java.lang.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.
protected  void tell_them()
          Has no meaning, since there is not response.
 java.lang.String toString()
          Returns the string representation of this object.
 
Methods inherited from class uk.co.westhawk.snmp.stack.Pdu
addOid, addOid, addOid, addOid, addOid, addToTrans, getContext, getErrorIndex, getErrorStatus, getErrorStatusString, getMsgType, getReqId, getRequestVarbinds, getResponseVarbinds, isTimedOut, notifyObservers, send, send, sendme, setErrorIndex, setErrorStatus, setErrorStatus, setMsgType, setRetryIntervals, toString, waitForSelf
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TrapPduv1

public TrapPduv1(SnmpContext con)
Constructor.
Parameters:
con - The context v1 of the TrapPduv1
See Also:
SnmpContext
Method Detail

setEnterprise

public void setEnterprise(java.lang.String var)
Sets the type of object generating the trap. This parameter is based on the sysObjectId.

getEnterprise

public java.lang.String 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.
See Also:
SnmpConstants.SNMP_TRAP_COLDSTART, SnmpConstants.SNMP_TRAP_WARMSTART, SnmpConstants.SNMP_TRAP_LINKDOWN, SnmpConstants.SNMP_TRAP_LINKUP, SnmpConstants.SNMP_TRAP_AUTHFAIL, SnmpConstants.SNMP_TRAP_EGPNEIGHBORLOSS, SnmpConstants.SNMP_TRAP_ENTERPRISESPECIFIC

getGenericTrap

public int getGenericTrap()
Returns the generic trap type.

getGenericTrapString

public java.lang.String getGenericTrapString()
Returns the string representation of the generic trap.
Returns:
the generic trap string
See Also:
getGenericTrap()

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.

getTimeTicks

public long getTimeTicks()
Returns the sysUpTime of the agent.

send

public boolean send()
             throws java.io.IOException,
                    PduException
Send 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 class Pdu

toString

public java.lang.String toString()
Returns the string representation of this object.
Overrides:
toString in class Pdu
Returns:
The string of the Pdu

new_value

protected void new_value(int n,
                         varbind res)
Has no meaning, since there is not response.
Overrides:
new_value in class Pdu

tell_them

protected void tell_them()
Has no meaning, since there is not response.
Overrides:
tell_them in class Pdu

SNMP Stack 4_12