|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.Observable
com.tivoli.twg.snmp.SNMPPDU
This class represents an SNMP PDU. One is required for every request sent, and one will be provided for each response, and trap received. In order to issue a request, it is required to register as an observer of the newly created instance. Submition of the PDU to the stack will fail without at least one observer, unless the PDU is a trap. The observer is required as the notification mechanism when the PDU has either timed out, or the response has been received.
SNMP
,
SNMPContext
,
SNMPEntity
Constructor Summary | |
---|---|
|
SNMPPDU(int pduType)
Construct An SNMPPDU for building a Get, Set, GetNext request. |
|
SNMPPDU(int pduType,
java.util.Observer observer)
Construct An SNMPPDU for building a Get, Set, GetNext, GetBulk request. |
|
SNMPPDU(SNMP Session,
int PDU_Type)
Deprecated. |
|
SNMPPDU(SNMP Session,
int PDU_Type,
java.util.Observer Done)
Deprecated. |
|
SNMPPDU(SNMPPDU pdu)
Copy constructor |
protected |
SNMPPDU(SnmpPDU rsp,
SNMPEntity source,
SNMPContext context)
Construct a SNMPPDU representing a response PDU |
Method Summary | |
---|---|
int |
AddVblItem(int Item,
java.lang.String OID)
This method will add an empty item into/in the PDUs VBL. |
int |
AddVblItem(int Item,
java.lang.String OID,
int Type)
This method will add or update a NULL item into/in the PDUs VBL. |
int |
AddVblItem(int Item,
java.lang.String OID,
int Type,
byte[] Octets)
This method will add or update a string/octet item into/in the PDUs VBL. |
int |
AddVblItem(int Item,
java.lang.String OID,
int Type,
int smiIntx)
This method will add or update an integer item into/in the PDUs VBL. |
int |
AddVblItem(int Item,
java.lang.String OID,
int Type,
int len,
byte[] Octets)
Deprecated. Use same method without len parm. |
int |
AddVblItem(int Item,
java.lang.String OID,
int Type,
long smiLong)
This method will add or update a long item into/in the PDUs VBL. |
int |
AddVblItem(int Item,
java.lang.String OID,
int Type,
java.lang.String smiOCTETS)
This method will add or update a string/octet item into/in the PDUs VBL. |
int |
DeleteVblItem(int Item)
Deprecated. Only for native code which is no longer included |
void |
Done()
Deprecated. |
protected int |
GetCorrelator()
INTERNAL USE ONLY |
byte[] |
getEngineID()
Returns the context engine ID for this response PDU. |
int |
GetError()
This method will return the Status code for this PDU. |
int |
getMaxRepetitions()
This method will get the maximum number of repetitions for a Get Bulk Request PDU. |
int |
getNonRepeaters()
This method will get the number of non-repeaters for a Get Bulk Request PDU. |
int |
GetReqID()
This method will return the Request ID assigned to this PDU transaction. |
SNMPContext |
GetResponseContext()
This method will return the Destination Context for the response. |
SNMPEntity |
GetResponseDest()
This method will return the Destination Entity for the response. |
SNMPPDU |
GetResponsePDU()
This method will return the Response PDU for this request, assuming it has completed normally. |
SNMPEntity |
GetResponseSrc()
This method will return the Source Entity for the response. |
protected SnmpPDU |
getSnmpPDU(SNMPEntity sourceEntity,
SnmpPDU pdu)
Return the this PDU in the form of a SnmpPDU |
protected SnmpTrap |
getSnmpTrap(SNMPEntity sourceEntity,
SnmpTrap trap)
Return the this PDU in the form of a SnmpTrap |
protected SnmpV2PDU |
getSnmpV2PDU(SNMPEntity sourceEntity,
SnmpV2PDU pdu)
Return the this PDU in the form of a SnmpV2PDU |
protected SnmpV3PDU |
getSnmpV3PDU(SNMPEntity sourceEntity,
SnmpV3PDU pdu)
Return the this PDU in the form of a SnmpV3PDU |
int |
GetType()
This method will return the Type of this PDU (See the Constructors for a list). |
int |
GetVblCount()
This method will return the number of Variable Binding (VarBind) elements in this PDU. |
int |
GetVblInt(int vblIndex)
This method will return the value for an integer type VBL item. |
long |
GetVblint64(int vblIndex)
Deprecated. Use GetVblInt64 instead |
long |
GetVblInt64(int vblIndex)
This method will return the value for an Counter64 type VBL item. |
java.lang.String |
GetVblItemName(int vblIndex)
This method will return the OID name for this item in the VBL. |
int |
GetVblItemType(int vblIndex)
This method will return the SNMP type of the VBL item requested. |
byte[] |
GetVblOctet(int vblIndex)
This method will return the value for an Octet type VBL item. |
java.lang.String |
GetVblOID(int vblIndex)
This method will return the value for a OID type VBL item. |
java.lang.String |
GetVblString(int vblIndex)
This method will return the value for a String type VBL item. |
int |
getVersion()
Sets the SNMP version for this PDU |
boolean |
IsTimedOut()
This method will return the Timeout status of this PDU. |
boolean |
IsVblItemValid(int vblIndex)
This method will test to see if there is a valid VBL item present. |
protected void |
loadVarBindList(java.util.Vector vblist,
int maxVarbind)
Load varbind list from SnmpMetaPDU varbind list (Vector instance) |
void |
printTrap()
Print the details of the trap and varbinds to standard out |
void |
setMaxRepetitions(int maxRepetitions)
This method will set the maximum number of repetitions for a Get Bulk Request PDU. |
void |
setNonRepeaters(int nonRepeaters)
This method will set the number of non-repeaters for a Get Bulk Request PDU. |
protected void |
SetResponseDone(SNMPEntity Src,
SNMPEntity Dest,
SNMPContext Context,
SNMPPDU Resp)
INTERNAL USE ONLY |
protected void |
SetTimeoutState(SNMPEntity Src,
SNMPEntity Dest,
SNMPContext Context,
int Err)
INTERNAL USE ONLY |
protected void |
SetTrapInfo(SNMPEntity Src,
SNMPEntity Dest,
SNMPContext Context)
INTERNAL USE ONLY |
void |
setVersion(int version)
Sets the SNMP version for this PDU |
java.lang.String |
toString()
|
void |
VBLUpdate(int Item,
int Type,
java.lang.String OID,
byte[] Value,
java.lang.String SValue)
INTERNAL USE ONLY |
void |
VBLUpdate(int Item,
int Type,
java.lang.String OID,
int Value)
INTERNAL USE ONLY |
void |
VBLUpdate(int Item,
int Type,
java.lang.String OID,
long Value)
INTERNAL USE ONLY |
void |
VBLUpdate(int Item,
int Type,
java.lang.String OID,
java.lang.String Value)
INTERNAL USE ONLY |
Methods inherited from class java.util.Observable |
---|
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int SNMP_PDU_GET
public static final int SNMP_PDU_GETNEXT
public static final int SNMP_PDU_RESPONSE
public static final int SNMP_PDU_SET
public static final int SNMP_PDU_V1TRAP
public static final int SNMP_PDU_GETBULK
public static final int SNMP_PDU_INFORM
public static final int SNMP_PDU_V2TRAP
public static final int SNMP_SYNTAX_SEQUENCE
public static final int SNMP_SYNTAX_INT
public static final int SNMP_SYNTAX_BITS
public static final int SNMP_SYNTAX_OCTETS
public static final int SNMP_SYNTAX_NULL
public static final int SNMP_SYNTAX_OID
public static final int SNMP_SYNTAX_INT32
public static final int SNMP_SYNTAX_IPADDR
public static final int SNMP_SYNTAX_CNTR32
public static final int SNMP_SYNTAX_GAUGE32
public static final int SNMP_SYNTAX_TIMETICKS
public static final int SNMP_SYNTAX_OPAQUE
public static final int SNMP_SYNTAX_NSAPADDR
public static final int SNMP_SYNTAX_CNTR64
public static final int SNMP_SYNTAX_UINT32
public static final int SNMP_SYNTAX_NOSUCHOBJECT
public static final int SNMP_SYNTAX_NOSUCHINSTANCE
public static final int SNMP_SYNTAX_ENDOFMIBVIEW
public static final int SNMP_SYNTAX_EMPTY
public static final int SNMP_TRAP_COLDSTART
public static final int SNMP_TRAP_WARMSTART
public static final int SNMP_TRAP_LINKDOWN
public static final int SNMP_TRAP_LINKUP
public static final int SNMP_TRAP_AUTHFAIL
public static final int SNMP_TRAP_EGPNEIGHBORLOSS
public static final int SNMP_TRAP_ENTERPRISESPECIFIC
public int Err
public int Type
Constructor Detail |
public SNMPPDU(int pduType)
pduType
- Can be one of the following:
SNMP_PDU_GET
SNMP_PDU_GETNEXT
SNMP_PDU_SET
SNMP_PDU_V1TRAP
SNMP_PDU_GETBULK
SNMP_PDU_INFORM
SNMP_PDU_V2TRAPpublic SNMPPDU(int pduType, java.util.Observer observer)
pduType
- Can be one of the following:
SNMP_PDU_GET
SNMP_PDU_GETNEXT
SNMP_PDU_SET
SNMP_PDU_V1TRAP
SNMP_PDU_GETBULK
SNMP_PDU_INFORM
SNMP_PDU_V2TRAPobserver
- An instance of the Observer class that will be informed when the processing of
this PDU has completed. That can be through the receipt of a response, or a timeout.
This value is ignored if pduType is a trap.public SNMPPDU(SNMPPDU pdu)
pdu
- PDU to copypublic SNMPPDU(SNMP Session, int PDU_Type)
public SNMPPDU(SNMP Session, int PDU_Type, java.util.Observer Done)
protected SNMPPDU(SnmpPDU rsp, SNMPEntity source, SNMPContext context)
Method Detail |
public java.lang.String toString()
protected void loadVarBindList(java.util.Vector vblist, int maxVarbind)
public void printTrap()
protected final void SetTrapInfo(SNMPEntity Src, SNMPEntity Dest, SNMPContext Context)
protected final void SetTimeoutState(SNMPEntity Src, SNMPEntity Dest, SNMPContext Context, int Err)
protected final void SetResponseDone(SNMPEntity Src, SNMPEntity Dest, SNMPContext Context, SNMPPDU Resp)
protected final int GetCorrelator()
public final int GetReqID()
public final int GetType()
public final int GetError()
public final int GetVblCount()
public final int DeleteVblItem(int Item)
Item
- - the item number to be removed from the VBL. Again, these are 1 based.
public final int AddVblItem(int Item, java.lang.String OID, int Type, int smiIntx)
Item
- - the item number to be updated in the PDUs VBL. Note, if this value is zero, then
this will be treated as an addition to the VBL, rather then an update.OID
- - this is the OID to be added, or in the case of an update operation, to replace the
old one with, in the VBL.Type
- - one of the following SNMP types:
SNMP_SYNTAX_INT
SNMP_SYNTAX_INT32smiIntx
-
public final int AddVblItem(int Item, java.lang.String OID)
Item
- - the item number to be updated in the PDUs VBL. Note, if this value is zero, then
this will be treated as an addition to the VBL, rather then an update.OID
- - this is the OID to be added, or in the case of an update operation, to replace the
old one with, in the VBL.
public final int AddVblItem(int Item, java.lang.String OID, int Type, long smiLong)
Item
- - the item number to be updated in the PDUs VBL. Note, if this value is zero, then
this will be treated as an addition to the VBL, rather then an update.OID
- - this is the OID to be added, or in the case of an update operation, to replace the
old one with, in the VBL.Type
- - one of the following SNMP types:
SNMP_SYNTAX_UINT32
SNMP_SYNTAX_CNTR32
SNMP_SYNTAX_GAUGE32
SNMP_SYNTAX_TIMETICKSsmiLong
-
public final int AddVblItem(int Item, java.lang.String OID, int Type, java.lang.String smiOCTETS)
Item
- - the item number to be updated in the PDUs VBL. Note, if this value is zero, then
this will be treated as an addition to the VBL, rather then an update.OID
- - this is the OID to be added, or in the case of an update operation, to replace the
old one with, in the VBL.Type
- - one of the following SNMP types:
SNMP_SYNTAX_IPADDR
SNMP_SYNTAX_OID
SNMP_SYNTAX_CNTR64smiOCTETS
- the octet value to add/update.
public final int AddVblItem(int Item, java.lang.String OID, int Type, byte[] Octets)
Item
- - the item number to be updated in the PDUs VBL. Note, if this value is zero, then
this will be treated as an addition to the VBL, rather then an update.OID
- - this is the OID to be added, or in the case of an update operation, to replace the
old one with, in the VBL.Type
- - one of the following SNMP types:
SNMP_SYNTAX_OCTETS
SNMP_SYNTAX_BITS
SNMP_SYNTAX_OPAQUEOctets
- the octet value to add/update.
public final int AddVblItem(int Item, java.lang.String OID, int Type, int len, byte[] Octets)
public final int AddVblItem(int Item, java.lang.String OID, int Type)
Item
- - the item number to be updated in the PDUs VBL. Note, if this value is zero, then
this will be treated as an addition to the VBL, rather then an update.OID
- - this is the OID to be added, or in the case of an update operation, to replace the
old one with, in the VBL.Type
- - one of the following SNMP types:
SNMP_SYNTAX_NULL
SNMP_SYNTAX_NOSUCHOBJECT
SNMP_SYNTAX_NOSUCHINSTANCE
SNMP_SYNTAX_ENDOFMIBVIEW
public int getMaxRepetitions()
public void setMaxRepetitions(int maxRepetitions)
maxRepetitions
- the maximum number of oid repetitionspublic int getNonRepeaters()
public void setNonRepeaters(int nonRepeaters)
nonRepeaters
- the number of oid non-repeaterspublic int getVersion()
public void setVersion(int version)
version
- either 1 (for SNMPV1), 2 (for SNMPV2), or 3 for (SNMPv3)public byte[] getEngineID()
public final int GetVblItemType(int vblIndex)
vblIndex
- - the item number to be queried in the PDUs VBL.
public final boolean IsVblItemValid(int vblIndex)
vblIndex
-
public final java.lang.String GetVblItemName(int vblIndex)
vblIndex
- - the item number to be queried in the PDUs VBL.
public final int GetVblInt(int vblIndex)
vblIndex
- - the item number to be queried in the PDUs VBL.
public final long GetVblInt64(int vblIndex)
vblIndex
- - the item number to be queried in the PDUs VBL.
public final long GetVblint64(int vblIndex)
public final java.lang.String GetVblString(int vblIndex)
public final byte[] GetVblOctet(int vblIndex)
vblIndex
- - the item number to be queried in the PDUs VBL.
public final java.lang.String GetVblOID(int vblIndex)
vblIndex
- - the item number to be queried in the PDUs VBL.
public final boolean IsTimedOut()
public final SNMPPDU GetResponsePDU()
public final SNMPEntity GetResponseSrc()
public final SNMPEntity GetResponseDest()
public final SNMPContext GetResponseContext()
public void VBLUpdate(int Item, int Type, java.lang.String OID, int Value)
public void VBLUpdate(int Item, int Type, java.lang.String OID, long Value)
public void VBLUpdate(int Item, int Type, java.lang.String OID, java.lang.String Value)
public void VBLUpdate(int Item, int Type, java.lang.String OID, byte[] Value, java.lang.String SValue)
public void Done()
protected SnmpV3PDU getSnmpV3PDU(SNMPEntity sourceEntity, SnmpV3PDU pdu)
pdu
- SnmpV3PDU to start modifing with
protected SnmpV2PDU getSnmpV2PDU(SNMPEntity sourceEntity, SnmpV2PDU pdu)
pdu
- SnmpV2PDU to start modifing with
protected SnmpPDU getSnmpPDU(SNMPEntity sourceEntity, SnmpPDU pdu)
pdu
- SnmpPDU to start modifing with
protected SnmpTrap getSnmpTrap(SNMPEntity sourceEntity, SnmpTrap trap)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |