All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sun.jaw.snmp.manager.SnmpPeer

java.lang.Object
   |
   +----com.sun.jaw.snmp.manager.SnmpPeer

public class SnmpPeer
extends Object
implements Serializable
This class holds information about a SNMP agent. Such information is used to communicate with the agent. These are the IP address, port number, SNMP parameters, and peer channel parameters (such as the maximum request packet size, maximum number of varbinds in a packet, retries, and timeouts). Changing these would affect all active requests.

The class contains the following properties:

JavaBean compliant getters and setters allow to modify the properties listed above.

See Also:
SnmpSession, SnmpRequest, SnmpParameters, SnmpConst

Constructor Index

 o SnmpPeer(InetAddress)
Creates an SNMP peer object for a device.
 o SnmpPeer(String)
Creates an SNMP peer object for a device.
 o SnmpPeer(String, int)
Creates an SNMP peer object for a device with the specified port.

Method Index

 o allowSnmpSets()
Determines if a SNMP set operation is allowed using this peer object.
 o equals(Object)
Compares the two peer objects to determine if they are the same.
 o finalize()
We will enter this stage only when the thread was stopped, all sessions are destroyed, and no references to the peer exist.
 o getAvgRtt()
Returns the average round trip time for a packet with the peer.
 o getDestAddr()
Returns the InetAddress object for this peer.
 o getDestAddrList()
Returns the list of alternate InetAddress configured for this peer.
 o getDestPort()
Returns the destination port number of the peer to which SNMP requests are to be sent.
 o getDevName()
Returns the name specified in the constructor while creating this object.
 o getMaxRetries()
Returns the number of times to retry before giving up.
 o getMaxRtt()
Gets the maximum round trip time for a packet with the peer.
 o getMaxSnmpPktSize()
Returns the maximum request packet size that is currently used.
 o getMinRtt()
Returns the minimum round trip time for a packet with the peer.
 o getPduFactory()
Get the PDU factory.
 o getSnmpParam()
Returns the SnmpParameter object associated with the peer.
 o getTimeout()
Returns the timeout to wait for a response from the peer.
 o getVarbindLimit()
Returns the maximum number of varbinds that can be sent to a peer.
 o ipAddressInUse()
Returns the dot-formatted IP address string (for example, 171.69.220.224).
 o setDestPort(int)
Changes the port address of the destination for the request.
 o setMaxRetries(int)
Changes the mximun number of times to retry before giving up.
 o setMaxSnmpPktSize(int)
Configures the maximum packet size that can be used when generating an SNMP request.
 o setPduFactory(SnmpPduFactoryIf)
Set the PDU factory.
 o setSnmpParam(SnmpParameters)
Sets the SnmpParameter object associated with the peer.
 o setTimeout(int)
Changes the timeout to wait for a response from the peer.
 o setVarbindLimit(int)
Configures the maximum number of varbinds that can be sent to a peer.
 o toString()
Returns a string representation of the object.
 o useAddressList(InetAddress[])
Specifies the list of address to be used.
 o useIPAddress(String)
Sets a specific IP address where the peer will communicate.
 o useNextAddress()
Causes all subsequent requests to go to the new address that is obtained from the specified list of alternate addresses.

Constructors

 o SnmpPeer
 public SnmpPeer(String host) throws UnknownHostException
Creates an SNMP peer object for a device. The default port is 161.

Parameters:
host - The peer name.
Throws: UnknownHostException
if the host name cannot be resolved.
 o SnmpPeer
 public SnmpPeer(InetAddress netaddr)
Creates an SNMP peer object for a device. The default port is 161.

Parameters:
netaddr - The peer InetAddress.
 o SnmpPeer
 public SnmpPeer(String host,
                 int port) throws UnknownHostException
Creates an SNMP peer object for a device with the specified port.

Parameters:
host - The peer name.
port - The port number.
Throws: UnknownHostException
if the host name cannot be resolved.

Methods

 o useIPAddress
 public final synchronized void useIPAddress(String ipaddr) throws UnknownHostException
Sets a specific IP address where the peer will communicate. Typically used to set an alternate IP address or a specific address which is known to respond to requests. It will not resolve the IP address if specified in dot format such as, 171.69.220.225.

Parameters:
ipaddr - Dot formatted IP address. It can also be a name.
Throws: UnknownHostException
if the host name cannot be resolved.
 o ipAddressInUse
 public final synchronized String ipAddressInUse()
Returns the dot-formatted IP address string (for example, 171.69.220.224). Useful when you like to know which IP address is used when the address was resolved using a DNS name.

Returns:
dot-formatted IP address being use.
 o useAddressList
 public final synchronized void useAddressList(InetAddress adrList[])
Specifies the list of address to be used. When a host is not responding the user can switch to the next address by calling useNextAddress.

Parameters:
adrList - List of InetAddresses.
 o useNextAddress
 public final synchronized void useNextAddress()
Causes all subsequent requests to go to the new address that is obtained from the specified list of alternate addresses. If it reaches the end of list, it begins again with the first address.

 o allowSnmpSets
 public boolean allowSnmpSets()
Determines if a SNMP set operation is allowed using this peer object. For now it just makes sure parameter is configured for a write operation.

Returns:
true if SNMP set is allowed and parameter is configured.
 o equals
 public boolean equals(Object obj)
Compares the two peer objects to determine if they are the same. This is used to determine whether requests can be multiplexed.

Returns:
true if they are referring to same peer and using same address.
Overrides:
equals in class Object
 o getDestAddrList
 public final InetAddress[] getDestAddrList()
Returns the list of alternate InetAddress configured for this peer.

Returns:
InetAddress of the peer.
See Also:
InetAddress
 o getDestAddr
 public final InetAddress getDestAddr()
Returns the InetAddress object for this peer.

Returns:
InetAddress of the peer.
See Also:
InetAddress
 o getDestPort
 public final int getDestPort()
Returns the destination port number of the peer to which SNMP requests are to be sent.

Returns:
destination port number.
 o setDestPort
 public final synchronized void setDestPort(int newPort)
Changes the port address of the destination for the request.

Parameters:
newPort - The destination port.
 o getTimeout
 public final int getTimeout()
Returns the timeout to wait for a response from the peer.

Returns:
value of timeout property
 o setTimeout
 public final synchronized void setTimeout(int newTimeout)
Changes the timeout to wait for a response from the peer.

Parameters:
newTimeout - The timeout (in milliseconds).
 o getMaxRetries
 public final int getMaxRetries()
Returns the number of times to retry before giving up.

 o setMaxRetries
 public final synchronized void setMaxRetries(int newMaxRetries)
Changes the mximun number of times to retry before giving up.

Parameters:
newMaxRetries - The maximun number of retries.
 o getDevName
 public final String getDevName()
Returns the name specified in the constructor while creating this object.

Returns:
the name of the host as specified while creating this object.
 o toString
 public String toString()
Returns a string representation of the object.

Overrides:
toString in class Object
 o getVarbindLimit
 public final synchronized int getVarbindLimit()
Returns the maximum number of varbinds that can be sent to a peer.

Returns:
maximum varbind that can be encoded into a request packet.
 o setVarbindLimit
 public final synchronized void setVarbindLimit(int limit)
Configures the maximum number of varbinds that can be sent to a peer.

Parameters:
limit - The desired limit.
 o getSnmpParam
 public final SnmpParameters getSnmpParam()
Returns the SnmpParameter object associated with the peer.

Returns:
the associated parameter.
 o setSnmpParam
 public final synchronized void setSnmpParam(SnmpParameters param)
Sets the SnmpParameter object associated with the peer.

Parameters:
param - The desired parameter.
 o setMaxSnmpPktSize
 public final synchronized void setMaxSnmpPktSize(int newsize)
Configures the maximum packet size that can be used when generating an SNMP request.

Parameters:
newsize - The desired packet size.
 o getMaxSnmpPktSize
 public final int getMaxSnmpPktSize()
Returns the maximum request packet size that is currently used.

Returns:
maximum request packet size.
 o setPduFactory
 public final synchronized void setPduFactory(SnmpPduFactoryIf factory)
Set the PDU factory.

Parameters:
factory - the new factory. If null is passed the default factory will be set.
 o getPduFactory
 public final SnmpPduFactoryIf getPduFactory()
Get the PDU factory.

 o finalize
 public void finalize()
We will enter this stage only when the thread was stopped, all sessions are destroyed, and no references to the peer exist.

Overrides:
finalize in class Object
 o getMinRtt
 public long getMinRtt()
Returns the minimum round trip time for a packet with the peer.

Returns:
gets the minimum round trip time for a packet with the peer.
 o getMaxRtt
 public long getMaxRtt()
Gets the maximum round trip time for a packet with the peer.

Returns:
gets the maximum round trip time for a packet with the peer.
 o getAvgRtt
 public long getAvgRtt()
Returns the average round trip time for a packet with the peer.

Returns:
gets the average round trip time for a packet with the peer.

All Packages  Class Hierarchy  This Package  Previous  Next  Index