SNMP Stack 4_12

uk.co.westhawk.snmp.stack
Class DefaultUsmAgent

java.lang.Object
  |
  +--uk.co.westhawk.snmp.stack.DefaultUsmAgent
All Implemented Interfaces:
UsmAgent

public class DefaultUsmAgent
extends java.lang.Object
implements UsmAgent

This implementation of UsmAgent tries to discover the parameters by doing the default USM discovery process on localhost.

Note that it is not guaranteed that the agent will allow discovery by itself. Also, if the SNMP agent reboots while the stack is running, it will not pick up the new boots and time.

Users are advised and encouraged to provide a better, more accurate implementation of UsmAgent.

Version:
$Revision: 3.3 $ $Date: 2002/10/10 15:13:57 $
Author:
Birgit Arkesteijn
See Also:
SnmpContextv3

Field Summary
static java.lang.String LOCAL_HOST
          The default name of the local host, localhost.
static int LOCAL_PORT
          The default port number of the local host, 161.
 
Fields inherited from interface uk.co.westhawk.snmp.stack.UsmAgent
version_id
 
Constructor Summary
DefaultUsmAgent()
           
 
Method Summary
 int getSnmpEngineBoots()
          Returns the authoritative Engine Boots.
 java.lang.String getSnmpEngineId()
          Returns the authoritative SNMP Engine ID.
 int getSnmpEngineTime()
          Returns the authoritative Engine Time.
 void setAgentName(java.lang.String host)
          Sets the my own hostname, ie the name of the agent or authoritative engine.
 void setAgentPort(int p)
          Sets the my own port number, ie the port number of the agent or authoritative engine.
 void setSnmpContext(SnmpContextv3 c)
          Sets the SNMP context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOCAL_HOST

public static final java.lang.String LOCAL_HOST
The default name of the local host, localhost.

LOCAL_PORT

public static final int LOCAL_PORT
The default port number of the local host, 161.
Constructor Detail

DefaultUsmAgent

public DefaultUsmAgent()
Method Detail

getSnmpEngineId

public java.lang.String getSnmpEngineId()
Returns the authoritative SNMP Engine ID. If the discovery failed, null will be returned.
Specified by:
getSnmpEngineId in interface UsmAgent
Returns:
The Engine ID

getSnmpEngineBoots

public int getSnmpEngineBoots()
Returns the authoritative Engine Boots. If the discovery failed, 1 will be returned.
Specified by:
getSnmpEngineBoots in interface UsmAgent
Returns:
The Engine Boots

getSnmpEngineTime

public int getSnmpEngineTime()
Returns the authoritative Engine Time. If the discovery failed, 1 will be returned.
Specified by:
getSnmpEngineTime in interface UsmAgent
Returns:
The Engine Time

setSnmpContext

public void setSnmpContext(SnmpContextv3 c)
Sets the SNMP context. It will do a discovery if needed.
Specified by:
setSnmpContext in interface UsmAgent

setAgentName

public void setAgentName(java.lang.String host)
Sets the my own hostname, ie the name of the agent or authoritative engine. By default localhost is used.
See Also:
LOCAL_HOST

setAgentPort

public void setAgentPort(int p)
Sets the my own port number, ie the port number of the agent or authoritative engine. By default 161 is used.
See Also:
LOCAL_PORT

SNMP Stack 4_12