com.sun.management.snmp.manager.usm
Class SnmpUsmPeer

java.lang.Object
  extended by com.sun.management.snmp.manager.SnmpPeer
      extended by com.sun.management.snmp.manager.usm.SnmpUsmPeer
All Implemented Interfaces:
Serializable

public class SnmpUsmPeer
extends SnmpPeer

This class models a distant SNMP V3 agent using the User based Security Model for V3 requests.

Since:
Java DMK 5.1
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.sun.management.snmp.manager.SnmpPeer
defaultSnmpRequestPktSize, defaultSnmpResponsePktSize
 
Constructor Summary
SnmpUsmPeer(SnmpEngine engine, InetAddress netaddr)
          Creates an SNMP peer object for a device.
SnmpUsmPeer(SnmpEngine engine, InetAddress netaddr, SnmpEngineId id)
          Creates an SNMP peer object for a device.
SnmpUsmPeer(SnmpEngine engine, String host)
          Creates an SNMP peer object for a device.
SnmpUsmPeer(SnmpEngine engine, String host, int port)
          Creates an SNMP peer object for a device with the specified port.
SnmpUsmPeer(SnmpEngine engine, String host, int port, SnmpEngineId id)
          Creates an SNMP peer object for a device with the specified port.
SnmpUsmPeer(SnmpEngine engine, String host, SnmpEngineId id)
          Creates an SNMP peer object for a device.
 
Method Summary
 int getEngineBoots()
          Returns the nb boots of the distant engine.
 SnmpEngineId getEngineId()
          Returns the distant engine Id or null if not yet known.
 int getEngineTime()
          Returns the time of the distant engine.
 boolean isAuthoritative()
          A peer is authoritative if the remote engine Id is useless when making requests.
 boolean isTimelinessSynchronized()
          Test is the peer is synchronized with distant Engine time and boots.
 void processUsmTimelinessDiscovery()
          Call this method in order to discover Usm timeliness needed infos.
 void setParams(SnmpParams p)
          Set the params used when making requests.
 
Methods inherited from class com.sun.management.snmp.manager.SnmpPeer
allowSnmpSets, equals, getAvgRtt, getDestAddr, getDestAddrList, getDestPort, getDevName, getMaxRtt, getMaxSnmpPktSize, getMaxTries, getMinRtt, getParams, getTimeout, getVarBindLimit, ipAddressInUse, setDestPort, setMaxSnmpPktSize, setMaxTries, setTimeout, setVarBindLimit, toString, useAddressList, useIPAddress, useNextAddress
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SnmpUsmPeer

public SnmpUsmPeer(SnmpEngine engine,
                   String host)
            throws UnknownHostException,
                   SnmpUnknownModelException,
                   SnmpStatusException
Creates an SNMP peer object for a device. The default port is 161. The passed parameters are used to discover the authoritative engine Id.

Parameters:
engine - The SNMP engine.
host - The peer name.
Throws:
UnknownHostException - If the host name cannot be resolved.
SnmpUnknownModelException - If Usm is not present in the passed engine.
SnmpStatusException - If an error occurred when discovering the distant engine Id.

SnmpUsmPeer

public SnmpUsmPeer(SnmpEngine engine,
                   InetAddress netaddr)
            throws SnmpUnknownModelException,
                   SnmpStatusException
Creates an SNMP peer object for a device. The default port is 161. The passed parameters are used to discover the authoritative engine Id.

Parameters:
engine - The SNMP engine.
netaddr - The peer InetAddress.
Throws:
SnmpUnknownModelException - If Usm is not present in the passed engine.
SnmpStatusException - If an error occurred when discovering the distant engine Id.

SnmpUsmPeer

public SnmpUsmPeer(SnmpEngine engine,
                   String host,
                   int port)
            throws UnknownHostException,
                   SnmpUnknownModelException,
                   SnmpStatusException
Creates an SNMP peer object for a device with the specified port. The passed parameters are used to discover the authoritative engine Id.

Parameters:
engine - The SNMP engine.
host - The peer name.
port - The port number.
Throws:
UnknownHostException - If the host name cannot be resolved.
SnmpUnknownModelException - If Usm is not present in the passed engine.
SnmpStatusException - If an error occurred when discovering the distant engine Id.

SnmpUsmPeer

public SnmpUsmPeer(SnmpEngine engine,
                   String host,
                   SnmpEngineId id)
            throws UnknownHostException,
                   SnmpUnknownModelException,
                   SnmpStatusException
Creates an SNMP peer object for a device. The default port is 161.

Parameters:
engine - The SNMP engine.
host - The peer name.
id - The remote agent engine Id. If no discovery is to be done and the engine Id is useless (when sending trap from the SnmpV3AdaptorServer , null can be provided as the engineId. Having null as engineId will make the other requests to fail (thrown of a SnmpStatusException/CODE> when sending get, set, inform, ...).
Throws:
UnknownHostException - If the host name cannot be resolved.
SnmpUnknownModelException - If Usm is not present in the passed engine.
SnmpStatusException - If the passed engine Id is equal to the local engine Id.

SnmpUsmPeer

public SnmpUsmPeer(SnmpEngine engine,
                   InetAddress netaddr,
                   SnmpEngineId id)
            throws SnmpUnknownModelException,
                   SnmpStatusException
Creates an SNMP peer object for a device. The default port is 161.

Parameters:
engine - The SNMP engine.
netaddr - The peer InetAddress.
id - The remote agent engine Id. If no discovery is to be done and the engine Id is useless (when sending trap from the SnmpV3AdaptorServer , null can be provided as the engineId. Having null as engineId will make the other requests to fail (thrown of a SnmpStatusException when sending get, set, inform, ...).
Throws:
SnmpUnknownModelException - If Usm is not present in the passed engine.
SnmpStatusException - If the passed engine Id is equal to the local engine Id.

SnmpUsmPeer

public SnmpUsmPeer(SnmpEngine engine,
                   String host,
                   int port,
                   SnmpEngineId id)
            throws UnknownHostException,
                   SnmpUnknownModelException,
                   SnmpStatusException
Creates an SNMP peer object for a device with the specified port.

Parameters:
engine - The SNMP engine.
host - The peer name.
port - The port number.
id - The remote agent engine Id. If no discovery is to be done and the engine Id is useless (when sending trap from the SnmpV3AdaptorServer ) you should provide null for this parameter. Doing so will make the SnmpUsmPeer an authoritative one. Sending get,set,getnext,getbulk,informs, ... with an authoritative peer will make the requests to fail.
Throws:
UnknownHostException - If the host name cannot be resolved.
SnmpUnknownModelException - If Usm is not present in the passed engine.
SnmpStatusException - If the passed engine Id is equal to the local engine Id.
Method Detail

isTimelinessSynchronized

public boolean isTimelinessSynchronized()
Test is the peer is synchronized with distant Engine time and boots.

Returns:
True synchronized, processUsmTimelinessDiscovery() has been successfully called. False not synchronized.

isAuthoritative

public boolean isAuthoritative()
A peer is authoritative if the remote engine Id is useless when making requests. This is true when using SnmpUsmPeer for trap sending. Every SnmpUsmPeer created with a null SnmpEngineId is an authoritative peer.

Returns:
true if authoritative, false otherwise.

getEngineBoots

public int getEngineBoots()
Returns the nb boots of the distant engine.

Returns:
The nb boots.

getEngineTime

public int getEngineTime()
Returns the time of the distant engine.

Returns:
The engine time.

getEngineId

public SnmpEngineId getEngineId()
Returns the distant engine Id or null if not yet known.

Returns:
The engine Id.

processUsmTimelinessDiscovery

public void processUsmTimelinessDiscovery()
                                   throws SnmpStatusException
Call this method in order to discover Usm timeliness needed infos. You should call this method only if you do some authenticated requests.

Throws:
SnmpStatusException - If an error occurs during timeliness discovery. Check SnmpDefinitions in order to define error status.

setParams

public void setParams(SnmpParams p)
Set the params used when making requests.

Overrides:
setParams in class SnmpPeer
Parameters:
p - The params to set.

Open Source build 02
opendmk-1.0-b02 2007.10.01_19:17:46_MEST

Copyright 1998-2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.