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:
- destPort: port number of the destination host.
The default port is161.
- varbindLimit: Maximum number of OIDs which can be encoded in a single
request packet. This is set by the user.
A request which contains more than this limit will be automatically split
into multiple request. Typically used when multiplexing requests.
The default value is SnmpConst.MAX_VARBIND_LIMIT
- maxSnmpPktSize: maximum packet size of Request PDU.
This could be set by the user.
If the request crosses this limit while encoding, the request is
automatically split into multiple small request. Each of these requests
will again be within this limit.
The default value is SnmpConst.defaultSnmpRequestPktSize.
- maxRetries: number of times to retry before giving up.
The default number is 3.
- timeout: The amount of time to wait for a response from the peer.
The default amount of time is 3000 milliseconds.
- snmpParam: The SNMP parameters to be used when communicating with the agent.
The parameters contain the protocol version and security information. (The parameters
can be shared amongst several peers).
JavaBean compliant getters and setters allow to modify the properties listed above.
- See Also:
- SnmpSession, SnmpRequest, SnmpParameters, SnmpConst
-
SnmpPeer(InetAddress)
- Creates an SNMP peer object for a device.
-
SnmpPeer(String)
- Creates an SNMP peer object for a device.
-
SnmpPeer(String, int)
- Creates an SNMP peer object for a device with the specified port.
-
allowSnmpSets()
- Determines if a SNMP
set operation is allowed using this
peer object.
-
equals(Object)
- Compares the two peer objects to determine if they are the same.
-
finalize()
- We will enter this stage only when the thread was stopped,
all sessions are destroyed, and no references to the peer exist.
-
getAvgRtt()
- Returns the average round trip time for a packet with the peer.
-
getDestAddr()
- Returns the InetAddress object for this peer.
-
getDestAddrList()
- Returns the list of alternate
InetAddress configured for this peer.
-
getDestPort()
- Returns the destination port number of the peer to which SNMP requests
are to be sent.
-
getDevName()
- Returns the name specified in the constructor while creating this object.
-
getMaxRetries()
- Returns the number of times to retry before giving up.
-
getMaxRtt()
- Gets the maximum round trip time for a packet with the peer.
-
getMaxSnmpPktSize()
- Returns the maximum request packet size that is currently used.
-
getMinRtt()
- Returns the minimum round trip time for a packet with the peer.
-
getPduFactory()
-
Get the PDU factory.
-
getSnmpParam()
- Returns the
SnmpParameter object associated with the peer.
-
getTimeout()
- Returns the timeout to wait for a response from the peer.
-
getVarbindLimit()
- Returns the maximum number of
varbinds that can be sent to a peer.
-
ipAddressInUse()
- Returns the dot-formatted IP address string (for example,
171.69.220.224).
-
setDestPort(int)
- Changes the port address of the destination for the request.
-
setMaxRetries(int)
- Changes the mximun number of times to retry before giving up.
-
setMaxSnmpPktSize(int)
- Configures the maximum packet size that can be used when generating
an SNMP request.
-
setPduFactory(SnmpPduFactoryIf)
- Set the PDU factory.
-
setSnmpParam(SnmpParameters)
- Sets the
SnmpParameter object associated with the peer.
-
setTimeout(int)
- Changes the timeout to wait for a response from the peer.
-
setVarbindLimit(int)
- Configures the maximum number of
varbinds that can be sent to a peer.
-
toString()
- Returns a string representation of the object.
-
useAddressList(InetAddress[])
- Specifies the list of address to be used.
-
useIPAddress(String)
- Sets a specific IP address where the peer will communicate.
-
useNextAddress()
- Causes all subsequent requests to go to the new address
that is obtained from the specified list of alternate addresses.
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.
SnmpPeer
public SnmpPeer(InetAddress netaddr)
- Creates an SNMP peer object for a device. The default port is 161.
- Parameters:
- netaddr - The peer
InetAddress.
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.
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.
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.
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.
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.
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.
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
getDestAddrList
public final InetAddress[] getDestAddrList()
- Returns the list of alternate
InetAddress configured for this peer.
- Returns:
- InetAddress of the peer.
- See Also:
- InetAddress
getDestAddr
public final InetAddress getDestAddr()
- Returns the InetAddress object for this peer.
- Returns:
- InetAddress of the peer.
- See Also:
- InetAddress
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.
setDestPort
public final synchronized void setDestPort(int newPort)
- Changes the port address of the destination for the request.
- Parameters:
- newPort - The destination port.
getTimeout
public final int getTimeout()
- Returns the timeout to wait for a response from the peer.
- Returns:
- value of timeout property
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).
getMaxRetries
public final int getMaxRetries()
- Returns the number of times to retry before giving up.
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.
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.
toString
public String toString()
- Returns a string representation of the object.
- Overrides:
- toString in class Object
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.
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.
getSnmpParam
public final SnmpParameters getSnmpParam()
- Returns the
SnmpParameter object associated with the peer.
- Returns:
- the associated parameter.
setSnmpParam
public final synchronized void setSnmpParam(SnmpParameters param)
- Sets the
SnmpParameter object associated with the peer.
- Parameters:
- param - The desired parameter.
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.
getMaxSnmpPktSize
public final int getMaxSnmpPktSize()
- Returns the maximum request packet size that is currently used.
- Returns:
- maximum request packet size.
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.
getPduFactory
public final SnmpPduFactoryIf getPduFactory()
- Get the PDU factory.
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
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.
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.
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