com.adventnet.simulator.netsim.snmp
Class SimulatorSnmpPdu

java.lang.Object
|
+--com.adventnet.simulator.netsim.snmp.SimulatorSnmpPdu

public class SimulatorSnmpPdu
extends java.lang.Object

The SimulatorSnmpPdu class provides methods to override the parameters of the PDU of the agents present in the Network .When ever the value of the parameter is set in the PDU, it overrides the value in the session. These methods should be used only for Network Simulator.


Constructor Summary
SimulatorSnmpPdu()
           
 
Method Summary
 byte getCommand()
           Gets the command type of this PDU.
 java.lang.String getCommunity()
           Gets the community string of this PDU.
 com.adventnet.snmp.snmp2.SnmpOID getEnterprise()
           Gets the enterprise field of the trap PDU which is of type SnmpOID.
 int getErrindex()
           Gets the error index of this PDU.
 int getErrstat()
           Gets the error status of this PDU.
 java.lang.String getIPAddress()
           Returns the IPAddress of the agents present in the Network .The returned IPAddress can be checked with the specified one.
                 java.lang.String getOid()
           Returns the Object id for which the manager has placed a request.
 int getPort()
           Returns the Port number of the agents present in the Network .The returned port number can be checked with the specified one.
 int getReqid()
           Gets the request id of this PDU.
                 java.lang.String getValue()
           Returns the value of the request object id.
               java.lang.String[] getVarbindOids()
           Returns the list of varbind OIDs present in the PDU.
               java.lang.String[] getVarbindValues()
           Returns the list of varbind values for the corresponding varbind OIDs geot using getVarbindOids() method.
 void setCommand(byte type)
           Sets the command type of this PDU .The command type is one of the constants defined in the SNMP API.
 void setCommunity(java.lang.String community)
           Sets community string recieved/sent.The community string in the PDU overrides the community set in session.
 void setEnterprise(com.adventnet.snmp.snmp2.SnmpOID oid)
           Sets the enterprise field of the trap PDU which is of type SnmpOID.
 void setErrIndex(int errIndex)
           Sets Error Index for this PDU.
 void setErrStat(int errStat)
           Sets Error Status for this PDU.
 void setReqid(int reqId)
           Sets Request id for this PDU .If request Id is set non zero , the said request Id will be set .If its 0 a unique request ID will be assigned to ensure no conflict with other requests .So if you do not want to manage the request Ids yourself set it to 0.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimulatorSnmpPdu

public SimulatorSnmpPdu()
Method Detail

setCommunity

public void setCommunity(java.lang.String community)

Sets community string recieved/sent.The community string in the PDU overrides the community set in session.

Parameters:
community - - Community to be set for this PDU

setCommand

public void setCommand(byte type)

Sets the command type of this PDU .The command type is one of the constants defined in the SNMP API.

Parameters:
type - - Command type to be set for this PDU. The various command types that can be passed as argument to this method are: SnmpAPI.GET_REQ_MSG,SnmpAPI.GETNEXT_REQ_MSG,SnmpAPI.SET_REQ_MSG,SnmpAPI.GETBULK_REQ_MSG, SnmpAPI.GET_RSP_MSG,SnmpAPI.TRP_REQ_MSG

setEnterprise

public void setEnterprise(com.adventnet.snmp.snmp2.SnmpOID oid)

Sets the enterprise field of the trap PDU which is of type SnmpOID.

Parameters:
oid - - The SnmpOID representing the enterprise field of PDU to be set.

setErrIndex

public void setErrIndex(int errIndex)

Sets Error Index for this PDU.

Parameters:
errIndex - - The error index to be set for this PDU.Only values greater than or equal to zero will be accepted by this method

setErrStat

public void setErrStat(int errStat)

Sets Error Status for this PDU.

Parameters:
errStat - - The error status to be set for this PDU. The error status value that can be set using this method are : SnmpAPI.SNMP_ERR_TOOBIG,SnmpAPI.SNMP_ERR_NOACCESS,SnmpAPI.SNMP_ERR_READONLY, SnmpAPI.SNMP_ERR_BADVALUE,SnmpAPI.SNMP_ERR_GENERR,SnmpAPI.SNMP_ERR_NOSUCHNAME This method will not accept values other than the one mentioned above.

setReqid

public void setReqid(int reqId)

Sets Request id for this PDU .If request Id is set non zero , the said request Id will be set .If its 0 a unique request ID will be assigned to ensure no conflict with other requests .So if you do not want to manage the request Ids yourself set it to 0.

Parameters:
reqId - - The requestId for this PDU.

getPort

public int getPort()

Returns the Port number of the agents present in the Network .The returned port number can be checked with the specified one.

Returns:
- Port Number.

getIPAddress

public java.lang.String getIPAddress()

Returns the IPAddress of the agents present in the Network .The returned IPAddress can be checked with the specified one.

Returns:
- IPAddress of the agent.

getCommand

public byte getCommand()

Gets the command type of this PDU.

Returns:
- command type of the PDU.

getCommunity

public java.lang.String getCommunity()

Gets the community string of this PDU.

Returns:
- community string of the PDU.

getEnterprise

public com.adventnet.snmp.snmp2.SnmpOID getEnterprise()

Gets the enterprise field of the trap PDU which is of type SnmpOID.

Returns:
- enterprise field of the PDU.

getErrindex

public int getErrindex()

Gets the error index of this PDU.

Returns:
- error index of the PDU.

getErrstat

public int getErrstat()

Gets the error status of this PDU.

Returns:
- error status of the PDU.


getOid

public java.lang.String getOid()

Returns the Object id for which the manager has placed a request.

Returns:
-OID in the first varbind of the PDU

getReqid

public int getReqid()

Gets the request id of this PDU.

Returns:
- request id of the PDU.


getValue

public java.lang.String getValue()

Returns the value of the request object id.

Returns:
- value of the first varbind of the PDU


getVarbindOids

public java.lang.String[] getVarbindOids()

Returns the list of varbind OIDs present in the PDU.

Returns:
-All the varbind OIDs in the PDU


getVarbindValues

public java.lang.String[] getVarbindValues()

Returns the list of varbind values for the corresponding varbind OIDs geot using getVarbindOids() method.

Returns:
-All the varbind OIDs values in the PDU