OpenNMS API 1.2.9

## org.opennms.protocols.snmp
Class SnmpPeer

    java.lang.Object
      org.opennms.protocols.snmp.SnmpPeer

All Implemented Interfaces:
  java.lang.Cloneable

public class SnmpPeer
extends java.lang.Object
implements java.lang.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:
  `SnmpSession`, `SnmpPeer`

Field Summary
`static int` `defaultRemotePort` The default remote port.
`static int` `defaultRetries` The library default for the number of retries.
`static int` `defaultTimeout` The library default for the number of milliseconds to wait for a reply from the remote agent.
`private SnmpParameters` `m_params` The default parameters for communicating with the agent.
`private java.net.InetAddress` `m_peer` The internet address of the peer
`private int` `m_port` The remote port of the agent.
`private int` `m_retries` The number of time to resend the datagram to the host.
`private int` `m_serverport` The local port of the agent.
`private int` `m_timeout` The length of time to wait on the remote agent to respond.

Constructor Summary
`SnmpPeer(java.net.InetAddress peer)` Class constructor.
`SnmpPeer(java.net.InetAddress peer, int port)` Class constructor.
`SnmpPeer(SnmpPeer second)` Class copy constructor.

Method Summary
`java.lang.Object` `clone()` Used to get a newly created copy of the current object.
`SnmpParameters` `getParameters()` Retuns the current parameters for the peer agent.
`java.net.InetAddress` `getPeer()` Returns the peer agent's internet address to the caller
`int` `getPort()` Returns the remote agent's port for communications
`int` `getRetries()` Returns the currently set number of retries defined by this peer
`int` `getServerPort()` Returns the local agent's port for communications
`int` `getTimeout()` Retreives the currently configured timeout for the remote agent in milliseconds (1/1000th second).
`void` `setParameters(SnmpParameters params)` Used to set the current parameters for the SnmpPeer object.
`void` `setPeer(java.net.InetAddress addr)` Used to set the peer's internet address for the remote agent.
`void` `setPeer(java.net.InetAddress addr, int port)` Used to set the peer's internet address and port for communications.
`void` `setPort(int port)` Used to set the remote communication port
`void` `setRetries(int retry)` Used to set the default number of retries for this peer agent.
`void` `setServerPort(int port)` Used to set the local communication port
`void` `setTimeout(int timeout)` Sets the millisecond timeout for the communications with the remote agent.

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### m_peer

    private java.net.InetAddress m_peer

  The internet address of the peer

### m_port

    private int m_port

  The remote port of the agent. By default this is usually 161, but it can change.

### m_serverport

    private int m_serverport

  The local port of the agent. By default this is usually 0 when acting as manager, 161 as agent

### m_retries

    private int m_retries

  The number of time to resend the datagram to the host.

### m_timeout

    private int m_timeout

  The length of time to wait on the remote agent to respond. The time is measured in milliseconds (1/1000th of a second).

### m_params

    private SnmpParameters m_params

  The default parameters for communicating with the agent. These include the read/write community string and the snmp protocol version.

### 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(java.net.InetAddress peer)

  Class constructor. Constructs a SnmpPeer to the passed remote agent.

Parameters:
  `peer` - The remote internet address

### SnmpPeer

    public SnmpPeer(java.net.InetAddress peer,
                    int port)

  Class constructor. Constructs a peer object with the specified internet address and port.

Parameters:
  `peer` - The remote agent address
  `port` - 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 java.net.InetAddress getPeer()

  Returns the peer agent's internet address to the caller

  Returns:
    The peer's internet address

### setPeer

    public void setPeer(java.net.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(java.net.InetAddress addr,
                        int port)

  Used to set the peer's internet address and port for communications.

  Parameters:
    `addr` - The remote agent's internet address
    `port` - 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.

### clone

    public java.lang.Object clone()

  Used to get a newly created copy of the current object.

  Returns:
    A duplicate peer object.

OpenNMS API 1.2.9

Generated by ranger on May 19 2007 2335.