Package org.opennms.protocols.snmp
Class SnmpPeer
- java.lang.Object
-
- org.opennms.protocols.snmp.SnmpPeer
-
- All Implemented Interfaces:
Cloneable
public class SnmpPeer extends Object implements Cloneable
The peer object defines a SNMP peer agent that is communicated with. The SnmpPeer object is used by the SnmpSession class to define the remote agent. The information includes the peer's port and address. Also included is the number of retries and timeouts that should be used when sending packets to the agent.- Version:
- 1.1.1.1
- Author:
- Brian Weaver
- See Also:
SnmpSession,SnmpPeer
-
-
Field Summary
Fields Modifier and Type Field Description static intdefaultRemotePortThe default remote port.static intdefaultRetriesThe library default for the number of retries.static intdefaultTimeoutThe library default for the number of milliseconds to wait for a reply from the remote agent.
-
Constructor Summary
Constructors Constructor Description SnmpPeer(InetAddress peer)Class constructor.SnmpPeer(InetAddress peer, int port)Class constructor.SnmpPeer(SnmpPeer second)Class copy constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectclone()Used to get a newly created copy of the current object.SnmpParametersgetParameters()Retuns the current parameters for the peer agent.InetAddressgetPeer()Returns the peer agent's internet address to the callerintgetPort()Returns the remote agent's port for communicationsintgetRetries()Returns the currently set number of retries defined by this peerintgetServerPort()Returns the local agent's port for communicationsintgetTimeout()Retreives the currently configured timeout for the remote agent in milliseconds (1/1000th second).voidsetParameters(SnmpParameters params)Used to set the current parameters for the SnmpPeer object.voidsetPeer(InetAddress addr)Used to set the peer's internet address for the remote agent.voidsetPeer(InetAddress addr, int port)Used to set the peer's internet address and port for communications.voidsetPort(int port)Used to set the remote communication portvoidsetRetries(int retry)Used to set the default number of retries for this peer agent.voidsetServerPort(int port)Used to set the local communication portvoidsetTimeout(int timeout)Sets the millisecond timeout for the communications with the remote agent.
-
-
-
Field Detail
-
defaultRemotePort
public static final int defaultRemotePort
The default remote port. On most systems this is port 161, the default trap receiver is on port 162.- See Also:
- Constant Field Values
-
defaultRetries
public static final int defaultRetries
The library default for the number of retries.- See Also:
- Constant Field Values
-
defaultTimeout
public static final int defaultTimeout
The library default for the number of milliseconds to wait for a reply from the remote agent.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SnmpPeer
public SnmpPeer(InetAddress peer)
Class constructor. Constructs a SnmpPeer to the passed remote agent.- Parameters:
peer- The remote internet address
-
SnmpPeer
public SnmpPeer(InetAddress peer, int port)
Class constructor. Constructs a peer object with the specified internet address and port.- Parameters:
peer- The remote agent addressport- The SNMP port on the remote
-
SnmpPeer
public SnmpPeer(SnmpPeer second)
Class copy constructor. Constructs a SnmpPeer object that is identical to the passed SnmpPeer object.- Parameters:
second- The peer object to copy.
-
-
Method Detail
-
getPeer
public InetAddress getPeer()
Returns the peer agent's internet address to the caller- Returns:
- The peer's internet address
-
setPeer
public void setPeer(InetAddress addr)
Used to set the peer's internet address for the remote agent.- Parameters:
addr- The remote agents internet address
-
setPeer
public void setPeer(InetAddress addr, int port)
Used to set the peer's internet address and port for communications.- Parameters:
addr- The remote agent's internet addressport- The remote agent's port
-
getPort
public int getPort()
Returns the remote agent's port for communications- Returns:
- The remote agent's port
-
setPort
public void setPort(int port)
Used to set the remote communication port- Parameters:
port- The remote communication port
-
getServerPort
public int getServerPort()
Returns the local agent's port for communications- Returns:
- The local agent's port
-
setServerPort
public void setServerPort(int port)
Used to set the local communication port- Parameters:
port- The local communication port
-
getRetries
public int getRetries()
Returns the currently set number of retries defined by this peer- Returns:
- The currently configured number of retries.
-
setRetries
public void setRetries(int retry)
Used to set the default number of retries for this peer agent.- Parameters:
retry- The new number of retries for the peer
-
getTimeout
public int getTimeout()
Retreives the currently configured timeout for the remote agent in milliseconds (1/1000th second).- Returns:
- The timeout value in milliseconds.
-
setTimeout
public void setTimeout(int timeout)
Sets the millisecond timeout for the communications with the remote agent.- Parameters:
timeout- The timeout in milliseconds
-
getParameters
public SnmpParameters getParameters()
Retuns the current parameters for the peer agent.- Returns:
- The current SNMP parameters
-
setParameters
public void setParameters(SnmpParameters params)
Used to set the current parameters for the SnmpPeer object.- Parameters:
params- The SnmpParameters for the peer.
-
-