IP*Works! S/SNMP V6

ipworksssnmp
Class Snmpmgr

java.lang.Object
  |
  +--ipworksssnmp.Snmpmgr

public class Snmpmgr
extends java.lang.Object

The SNMPMgr bean is used to implement SNMP Management Applications.

The SNMPMgr bean implements a standard SNMP Manager as specified in the SNMP RFCs. The bean supports SNMP v1, v2c, and v3.

The bean provides both encoding/decoding and transport capabilities, making the task of developing a custom SNMP manager as simple as setting a few key properties and handling a few events. SNMP data, such as for instance SNMP object id-s (OID-s) are exchanged as text strings, thus further simplifying the task of handling them.

The bean is activated/deactivated by setting the Active property. This property enables or disables sending and receiving.

Messages are received through events such as Response , Trap , or InformRequest . SNMP Traps are received through the Trap event.

Messages are sent to other agents or managers by using bean's methods such as SendGetRequest , SendGetNextRequest , SendGetBulkRequest , SendSetRequest , and SendInformRequest .

SNMP OIDs, types, and values are provided in arrays such as ObjId , ObjType , and ObjValue , for both sent and received packets. ObjCount provides the number of elements in each of the arrays.

SNMPv3 USM security is enabled by setting properties such as User and Password and calling the Discover method to bind to a particular agent ( RemoteEngineId ). Upon successful discovery, received packets are checked for integrity (authentication) and timeliness. Note that the discovery step is optional, and may be avoided if the values for RemoteEngineId , RemoteEngineBoots , and RemoteEngineTime are known in advance and provided to the bean through the respective properties.

By default, the bean operates synchronously (except for the Discover method), sending a request and waiting until the corresponding response has been received. This behavior may be overridden by setting Timeout to 0, in which case the bean returns control immediately after a send, and responses are received exclusively through the Response event.


Field Summary
static int authpHMACMD596
           
static int authpHMACSHA96
           
static int otCounter32
           
static int otCounter64
           
static int otEndOfMibView
           
static int otGauge32
           
static int otInteger
           
static int otIPAddress
           
static int otNoSuchInstance
           
static int otNoSuchObject
           
static int otNSAP
           
static int otNull
           
static int otObjectId
           
static int otOctetString
           
static int otOpaque
           
static int otTimeTicks
           
static int otUnsignedInteger32
           
static int snmpverV1
           
static int snmpverV2c
           
static int snmpverV3
           
 
Constructor Summary
Snmpmgr()
           
 
Method Summary
 void addSnmpmgrEventListener(SnmpmgrEventListener l)
           
 java.lang.String config(java.lang.String configurationString)
          Sets or retrieves a beanconfiguration setting.
 void discover()
          Performs SNMPv3 discovery.
 void doEvents()
          Processes events from the internal message queue.
 java.lang.String getAuthenticationPassword()
          The password used for SNMPv3 authentication.
 int getAuthenticationProtocol()
          The authentication protocol used for SNMPv3 packets.
 java.lang.String getCommunity()
          The community string used to authenticate SNMP packets.
 java.lang.String getEncryptionPassword()
          The password used for SNMPv3 privacy.
 java.lang.String getErrorDescription()
          Description of the status code for the last SNMP packet received by the bean.
 int getErrorIndex()
          Index of the first variable (object) that caused an error from the last SNMP response.
 int getErrorStatus()
          Status code for the last SNMP packet received by the bean.
 byte[] getLocalEngineId()
          The Engine Id of the SNMP Manager.
 java.lang.String getLocalHost()
          The name of the local host or user-assigned IP interface through which connections are initiated or accepted.
 int getLocalPort()
          The UDP port in the local host where the SNMP Manager is bound to.
 int getObjCount()
          Number of objects in the current request.
 java.lang.String getObjId(int objIndex)
          Array of OIDs encoded as strings.
 int getObjType(int objIndex)
          Array of object types.
 byte[] getObjValue(int objIndex)
          Array of object values.
 int getRemoteEngineBoots()
          The remote engine boots (SNMPv3).
 byte[] getRemoteEngineId()
          The Engine Id of the remote agent.
 int getRemoteEngineTime()
          The remote engine time (SNMPv3).
 java.lang.String getRemoteHost()
          The address of the remote host.
 int getRemotePort()
          The UDP port where the remote SNMP agent is listening.
 int getRequestId()
          The request-id to mark outgoing packets with.
 int getSNMPVersion()
          Version of SNMP used for outgoing requests.
 int getTimeout()
          A timeout for the bean.
 java.lang.String getUser()
          The user name used for SNMPv3 authentication.
 void hashPasswords()
          Hashes all passwords in the cache.
 void interrupt()
          Interrupt the current method.
 boolean isAcceptData()
          Enables or disables data reception.
 boolean isActive()
          Enables or disables sending and receiving of SNMP packets.
 void removeSnmpmgrEventListener(SnmpmgrEventListener l)
           
 void reset()
          Clears the object arrays.
 void sendGetBulkRequest(int nonRepeaters, int maxRepetitions)
          Send a GetBulkRequest packet.
 void sendGetNextRequest()
          Send GetNextRequest packet.
 void sendGetRequest()
          Send GetRequest packet.
 void sendInformRequest()
          Send an InformRequest packet.
 void sendSetRequest()
          Send Set Request packet.
 void setAcceptData(boolean acceptData)
          Enables or disables data reception.
 void setActive(boolean active)
          Enables or disables sending and receiving of SNMP packets.
 void setAuthenticationPassword(java.lang.String authenticationPassword)
          The password used for SNMPv3 authentication.
 void setAuthenticationProtocol(int authenticationProtocol)
          The authentication protocol used for SNMPv3 packets.
 void setCommunity(java.lang.String community)
          The community string used to authenticate SNMP packets.
 void setEncryptionPassword(java.lang.String encryptionPassword)
          The password used for SNMPv3 privacy.
 void setLocalEngineId(byte[] localEngineId)
          The Engine Id of the SNMP Manager.
 void setLocalHost(java.lang.String localHost)
          The name of the local host or user-assigned IP interface through which connections are initiated or accepted.
 void setLocalPort(int localPort)
          The UDP port in the local host where the SNMP Manager is bound to.
 void setObjCount(int objCount)
          Number of objects in the current request.
 void setObjId(int objIndex, java.lang.String objId)
          Array of OIDs encoded as strings.
 void setObjType(int objIndex, int objType)
          Array of object types.
 void setObjValue(int objIndex, byte[] objValue)
          Array of object values.
 void setRemoteEngineBoots(int remoteEngineBoots)
          The remote engine boots (SNMPv3).
 void setRemoteEngineId(byte[] remoteEngineId)
          The Engine Id of the remote agent.
 void setRemoteEngineTime(int remoteEngineTime)
          The remote engine time (SNMPv3).
 void setRemoteHost(java.lang.String remoteHost)
          The address of the remote host.
 void setRemotePort(int remotePort)
          The UDP port where the remote SNMP agent is listening.
 void setRequestId(int requestId)
          The request-id to mark outgoing packets with.
 void setSNMPVersion(int SNMPVersion)
          Version of SNMP used for outgoing requests.
 void setTimeout(int timeout)
          A timeout for the bean.
 void setUser(java.lang.String user)
          The user name used for SNMPv3 authentication.
 java.lang.String value(java.lang.String OID)
          Returns the value corresponding to an OID.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

authpHMACMD596

public static final int authpHMACMD596
See Also:
Constant Field Values

authpHMACSHA96

public static final int authpHMACSHA96
See Also:
Constant Field Values

otInteger

public static final int otInteger
See Also:
Constant Field Values

otOctetString

public static final int otOctetString
See Also:
Constant Field Values

otNull

public static final int otNull
See Also:
Constant Field Values

otObjectId

public static final int otObjectId
See Also:
Constant Field Values

otIPAddress

public static final int otIPAddress
See Also:
Constant Field Values

otCounter32

public static final int otCounter32
See Also:
Constant Field Values

otGauge32

public static final int otGauge32
See Also:
Constant Field Values

otTimeTicks

public static final int otTimeTicks
See Also:
Constant Field Values

otOpaque

public static final int otOpaque
See Also:
Constant Field Values

otNSAP

public static final int otNSAP
See Also:
Constant Field Values

otCounter64

public static final int otCounter64
See Also:
Constant Field Values

otUnsignedInteger32

public static final int otUnsignedInteger32
See Also:
Constant Field Values

otNoSuchObject

public static final int otNoSuchObject
See Also:
Constant Field Values

otNoSuchInstance

public static final int otNoSuchInstance
See Also:
Constant Field Values

otEndOfMibView

public static final int otEndOfMibView
See Also:
Constant Field Values

snmpverV1

public static final int snmpverV1
See Also:
Constant Field Values

snmpverV2c

public static final int snmpverV2c
See Also:
Constant Field Values

snmpverV3

public static final int snmpverV3
See Also:
Constant Field Values
Constructor Detail

Snmpmgr

public Snmpmgr()
Method Detail

isAcceptData

public boolean isAcceptData()
Enables or disables data reception.

Setting the property to False temporarily disables data reception. Setting the property to True re-enables data reception.


setAcceptData

public void setAcceptData(boolean acceptData)
                   throws IPWorksSSNMPException
Enables or disables data reception.

Setting the property to False temporarily disables data reception. Setting the property to True re-enables data reception.

IPWorksSSNMPException

isActive

public boolean isActive()
Enables or disables sending and receiving of SNMP packets.

The Active property must be set to True before any SNMP requests or traps are sent or received.


setActive

public void setActive(boolean active)
               throws IPWorksSSNMPException
Enables or disables sending and receiving of SNMP packets.

The Active property must be set to True before any SNMP requests or traps are sent or received.

IPWorksSSNMPException

getAuthenticationPassword

public java.lang.String getAuthenticationPassword()
The password used for SNMPv3 authentication.

Every time EncryptionPassword , AuthenticationPassword , or RemoteEngineId are set, a localized key is computed automatically, and cached internally.


setAuthenticationPassword

public void setAuthenticationPassword(java.lang.String authenticationPassword)
                               throws IPWorksSSNMPException
The password used for SNMPv3 authentication.

Every time EncryptionPassword , AuthenticationPassword , or RemoteEngineId are set, a localized key is computed automatically, and cached internally.

IPWorksSSNMPException

getAuthenticationProtocol

public int getAuthenticationProtocol()
The authentication protocol used for SNMPv3 packets.

The supported protocols are HMAC-MD5-96 (1) and HMAC-SHA-96 (2).

The default value is HMAC-MD5-96 (1).


setAuthenticationProtocol

public void setAuthenticationProtocol(int authenticationProtocol)
                               throws IPWorksSSNMPException
The authentication protocol used for SNMPv3 packets.

The supported protocols are HMAC-MD5-96 (1) and HMAC-SHA-96 (2).

The default value is HMAC-MD5-96 (1).

IPWorksSSNMPException

getCommunity

public java.lang.String getCommunity()
The community string used to authenticate SNMP packets.

Must match the community name that is specified on the agent.

Typical values are "public" or "private".

This property is used for all SNMP packets sent by the bean.


setCommunity

public void setCommunity(java.lang.String community)
                  throws IPWorksSSNMPException
The community string used to authenticate SNMP packets.

Must match the community name that is specified on the agent.

Typical values are "public" or "private".

This property is used for all SNMP packets sent by the bean.

IPWorksSSNMPException

getEncryptionPassword

public java.lang.String getEncryptionPassword()
The password used for SNMPv3 privacy.

Every time EncryptionPassword , AuthenticationPassword , or RemoteEngineId are set, a localized key is computed automatically, and cached internally.


setEncryptionPassword

public void setEncryptionPassword(java.lang.String encryptionPassword)
                           throws IPWorksSSNMPException
The password used for SNMPv3 privacy.

Every time EncryptionPassword , AuthenticationPassword , or RemoteEngineId are set, a localized key is computed automatically, and cached internally.

IPWorksSSNMPException

getErrorDescription

public java.lang.String getErrorDescription()
Description of the status code for the last SNMP packet received by the bean.

Please refer to the ErrorStatus property for more information.


getErrorIndex

public int getErrorIndex()
Index of the first variable (object) that caused an error from the last SNMP response.

This property is used in conjunction with the ErrorStatus property.

Variable indexes start with 0. The ErrorIndex property has no meaning when the ErrorStatus property is 0 (no error).


getErrorStatus

public int getErrorStatus()
Status code for the last SNMP packet received by the bean.

This property is used in conjunction with the ErrorIndex property, which denotes the index of the variable in error. The ErrorDescription property provides a textual description of the error.

The following is a list of valid SNMP status code values:

0 (noError)
No error.
1 (tooBig)
The response cannot fit in a single SNMP message.
2 (noSuchName)
Variable does not exist.
3 (badValue)
Invalid value or syntax.
4 (readOnly)
Variable is read-only.
5 (genError)
Other error (SNMPv1).
6 (noAccess)
Access denied.
7 (wrongType)
Wrong object type.
8 (wrongLength)
Wrong length.
9 (wrongEncoding)
Wrong encoding.
10 (wrongValue)
Wrong value.
11 (noCreation)
No creation.
12 (inconsistentValue)
Inconsistent value.
13 (resourceUnavailable)
Resource unavailable.
14 (commitFailed)
Commit failed.
15 (undoFailed)
Undo failed.
16 (authorizationError)
Authorization error.
17 (notWritable)
Variable is not writable.
18 (inconsistentName)
Inconsistent name.
The ErrorIndex parameter indicates the index of the first variable (object) that caused an error. The default value is 0.

Variable indexes start with 0. ErrorIndex has no meaning when ErrorStatus is 0 (no error).

The default value is 0 (no error).


getLocalEngineId

public byte[] getLocalEngineId()
The Engine Id of the SNMP Manager.

This property is only used for SNMPv3 packets (when SNMPVersion is 3).


setLocalEngineId

public void setLocalEngineId(byte[] localEngineId)
                      throws IPWorksSSNMPException
The Engine Id of the SNMP Manager.

This property is only used for SNMPv3 packets (when SNMPVersion is 3).

IPWorksSSNMPException

getLocalHost

public java.lang.String getLocalHost()
The name of the local host or user-assigned IP interface through which connections are initiated or accepted.

The LocalHost property contains the name of the local host as obtained by the gethostname() system call, or if the user has assigned an IP address, the value of that address.

In multihomed hosts (machines with more than one IP interface) setting LocalHost to the value of an interface will make the bean initiate connections (or accept in the case of server beans) only through that interface.

If the bean is connected, the LocalHost property shows the IP address of the interface through which the connection is made in internet dotted format (aaa.bbb.ccc.ddd). In most cases, this is the address of the local host, except for multihomed hosts (machines with more than one IP interface).

NOTE: LocalHost is not persistent. You must always set it in code, and never in the property window.


setLocalHost

public void setLocalHost(java.lang.String localHost)
                  throws IPWorksSSNMPException
The name of the local host or user-assigned IP interface through which connections are initiated or accepted.

The LocalHost property contains the name of the local host as obtained by the gethostname() system call, or if the user has assigned an IP address, the value of that address.

In multihomed hosts (machines with more than one IP interface) setting LocalHost to the value of an interface will make the bean initiate connections (or accept in the case of server beans) only through that interface.

If the bean is connected, the LocalHost property shows the IP address of the interface through which the connection is made in internet dotted format (aaa.bbb.ccc.ddd). In most cases, this is the address of the local host, except for multihomed hosts (machines with more than one IP interface).

NOTE: LocalHost is not persistent. You must always set it in code, and never in the property window.

IPWorksSSNMPException

getLocalPort

public int getLocalPort()
The UDP port in the local host where the SNMP Manager is bound to.

The LocalPort property must be set before the bean is activated ( Active is set to True). It instructs the bean to bind to a specific port (or communication endpoint) in the local machine. The default port is 0 (random port). If you would like to receive traps, set LocalPort to 162 (standard trap port). However, it is recommended that the SNMPTRAPMGR bean be used for listening to traps, because SNMPMGR is limited to receiving SNMPv3 traps from a single agent only. SNMPTRAPMGR does not have this limitation.

LocalPort cannot be changed once the bean is Active . Any attempt to set the LocalPort property when the bean is Active will generate an error.


setLocalPort

public void setLocalPort(int localPort)
                  throws IPWorksSSNMPException
The UDP port in the local host where the SNMP Manager is bound to.

The LocalPort property must be set before the bean is activated ( Active is set to True). It instructs the bean to bind to a specific port (or communication endpoint) in the local machine. The default port is 0 (random port). If you would like to receive traps, set LocalPort to 162 (standard trap port). However, it is recommended that the SNMPTRAPMGR bean be used for listening to traps, because SNMPMGR is limited to receiving SNMPv3 traps from a single agent only. SNMPTRAPMGR does not have this limitation.

LocalPort cannot be changed once the bean is Active . Any attempt to set the LocalPort property when the bean is Active will generate an error.

IPWorksSSNMPException

getObjCount

public int getObjCount()
Number of objects in the current request.

The ObjCount property provides the number of elements in the various Obj arrays ( ObjId , ObjType , ObjValue ).

The arrays may be cleared at any time by setting the ObjCount to 0.


setObjCount

public void setObjCount(int objCount)
                 throws IPWorksSSNMPException
Number of objects in the current request.

The ObjCount property provides the number of elements in the various Obj arrays ( ObjId , ObjType , ObjValue ).

The arrays may be cleared at any time by setting the ObjCount to 0.

IPWorksSSNMPException

getObjId

public java.lang.String getObjId(int objIndex)
                          throws IPWorksSSNMPException
Array of OIDs encoded as strings.

The object id-s are encoded as strings of numbers separated by "."-s, for instance: "1.3.6.1.2.1.1.1.0" (OID for "system description").

The size of the array is determined by the ObjCount property. Element indexes start at 1.

The array is populated and its size is set every time an SNMP packet is received. It is also used to create outgoing SNMP packets.

The corresponding object type and value (if any) are specified by the ObjType and ObjValue property arrays.

Example

 SNMPControl.ObjCount = 2
 SNMPControl.ObjID(1) = "1.3.6.1.2.1.1.1.0"
 SNMPControl.ObjID(2) = "1.3.6.1.2.1.1.2.0" 

IPWorksSSNMPException

setObjId

public void setObjId(int objIndex,
                     java.lang.String objId)
              throws IPWorksSSNMPException
Array of OIDs encoded as strings.

The object id-s are encoded as strings of numbers separated by "."-s, for instance: "1.3.6.1.2.1.1.1.0" (OID for "system description").

The size of the array is determined by the ObjCount property. Element indexes start at 1.

The array is populated and its size is set every time an SNMP packet is received. It is also used to create outgoing SNMP packets.

The corresponding object type and value (if any) are specified by the ObjType and ObjValue property arrays.

Example

 SNMPControl.ObjCount = 2
 SNMPControl.ObjID(1) = "1.3.6.1.2.1.1.1.0"
 SNMPControl.ObjID(2) = "1.3.6.1.2.1.1.2.0" 

IPWorksSSNMPException

getObjType

public int getObjType(int objIndex)
               throws IPWorksSSNMPException
Array of object types.

The size of the array is determined by the ObjCount property. Element indexes start at 1.

The array is populated and its size is set every time an SNMP packet is received. It is also used to create an outgoing SNMP packet when a send or request method is called. The default type is NULL (5).

The corresponding object id and value are specified by the ObjId and ObjValue property arrays.

Possible object type values include:

otInteger (2)
2
otOctetString (4)
4
otNull (5)
5
otObjectID (6)
6
otIPAddress (64)
64
otCounter32 (65)
65
otGauge32 (66)
66
otTimeTicks (67)
67
otOpaque (68)
68
otNSAP (69)
69
otCounter64 (70)
70
otUnsignedInteger32 (71)
71

The bean also supports the following artificial object values used to designate error conditions:

otNoSuchObject (128)
No such object error.
otNoSuchInstance (129)
No such instance error.
otEndOfMibView (130)
End of MIB View error.

IPWorksSSNMPException

setObjType

public void setObjType(int objIndex,
                       int objType)
                throws IPWorksSSNMPException
Array of object types.

The size of the array is determined by the ObjCount property. Element indexes start at 1.

The array is populated and its size is set every time an SNMP packet is received. It is also used to create an outgoing SNMP packet when a send or request method is called. The default type is NULL (5).

The corresponding object id and value are specified by the ObjId and ObjValue property arrays.

Possible object type values include:

otInteger (2)
2
otOctetString (4)
4
otNull (5)
5
otObjectID (6)
6
otIPAddress (64)
64
otCounter32 (65)
65
otGauge32 (66)
66
otTimeTicks (67)
67
otOpaque (68)
68
otNSAP (69)
69
otCounter64 (70)
70
otUnsignedInteger32 (71)
71

The bean also supports the following artificial object values used to designate error conditions:

otNoSuchObject (128)
No such object error.
otNoSuchInstance (129)
No such instance error.
otEndOfMibView (130)
End of MIB View error.

IPWorksSSNMPException

getObjValue

public byte[] getObjValue(int objIndex)
                   throws IPWorksSSNMPException
Array of object values.

The size of the array is determined by the ObjCount property. Element indexes start at 1.

The array is populated and its size is set every time an SNMP packet is received. It is also used to create an outgoing SNMP packet when a send or request method is called.

The corresponding object id and type are specified by the ObjId and ObjType property arrays.

Example

 SNMPControl.ObjCount = 1
 SNMPControl.ObjID(1) = "1.3.6.1.2.1.1.1.0"
 SNMPControl.ObjValue(1) = "New Value" 

IPWorksSSNMPException

setObjValue

public void setObjValue(int objIndex,
                        byte[] objValue)
                 throws IPWorksSSNMPException
Array of object values.

The size of the array is determined by the ObjCount property. Element indexes start at 1.

The array is populated and its size is set every time an SNMP packet is received. It is also used to create an outgoing SNMP packet when a send or request method is called.

The corresponding object id and type are specified by the ObjId and ObjType property arrays.

Example

 SNMPControl.ObjCount = 1
 SNMPControl.ObjID(1) = "1.3.6.1.2.1.1.1.0"
 SNMPControl.ObjValue(1) = "New Value" 

IPWorksSSNMPException

getRemoteEngineBoots

public int getRemoteEngineBoots()
The remote engine boots (SNMPv3).

This property is used in conjunction with the RemoteEngineTime property. Please refer to the description of the RemoteEngineTime property, and the Discover method for further information.


setRemoteEngineBoots

public void setRemoteEngineBoots(int remoteEngineBoots)
                          throws IPWorksSSNMPException
The remote engine boots (SNMPv3).

This property is used in conjunction with the RemoteEngineTime property. Please refer to the description of the RemoteEngineTime property, and the Discover method for further information.

IPWorksSSNMPException

getRemoteEngineId

public byte[] getRemoteEngineId()
The Engine Id of the remote agent.

This property is only used for SNMPv3 packets (see SNMPVersion ), and is reset every time RemoteHost or RemotePort changes.

RemoteEngineId is normally discovered through the Discover method. However, by manually supplying a value for the property, RemoteEngineId discovery step may be eliminated, thus avoiding the extra roundtrip to the agent ( RemoteEngineBoots and RemoteEngineTime are also required for User authentication - please refer to the Discover method for more information).


setRemoteEngineId

public void setRemoteEngineId(byte[] remoteEngineId)
                       throws IPWorksSSNMPException
The Engine Id of the remote agent.

This property is only used for SNMPv3 packets (see SNMPVersion ), and is reset every time RemoteHost or RemotePort changes.

RemoteEngineId is normally discovered through the Discover method. However, by manually supplying a value for the property, RemoteEngineId discovery step may be eliminated, thus avoiding the extra roundtrip to the agent ( RemoteEngineBoots and RemoteEngineTime are also required for User authentication - please refer to the Discover method for more information).

IPWorksSSNMPException

getRemoteEngineTime

public int getRemoteEngineTime()
The remote engine time (SNMPv3).

RemoteEngineTime is used by SNMPv3 authentication to ensure timeliness of requests, and avoid replay attacks.

The value of RemoteEngineTime is provided as what is expected to be the current value of the remote engine clock based on a cached time differential between the remote engine clock and the local engine time obtained during the discovery process (see Discover ).

This property is used in conjunction with RemoteEngineBoots . Please refer to the RemoteEngineBoots property and the Discover method for more information.


setRemoteEngineTime

public void setRemoteEngineTime(int remoteEngineTime)
                         throws IPWorksSSNMPException
The remote engine time (SNMPv3).

RemoteEngineTime is used by SNMPv3 authentication to ensure timeliness of requests, and avoid replay attacks.

The value of RemoteEngineTime is provided as what is expected to be the current value of the remote engine clock based on a cached time differential between the remote engine clock and the local engine time obtained during the discovery process (see Discover ).

This property is used in conjunction with RemoteEngineBoots . Please refer to the RemoteEngineBoots property and the Discover method for more information.

IPWorksSSNMPException

getRemoteHost

public java.lang.String getRemoteHost()
The address of the remote host. Domain names are resolved to IP addresses.

The RemoteHost property specifies the IP address (IP number in dotted internet format) or Domain Name of the host SNMP requests or traps are sent to.

If RemoteHost is set to 255.255.255.255, the bean broadcasts data on the local subnet.

If the RemoteHost property is set to a Domain Name, a DNS request is initiated and upon successful termination of the request, the RemoteHost property is set to the corresponding address. If the search is not successful, an error is returned.


setRemoteHost

public void setRemoteHost(java.lang.String remoteHost)
                   throws IPWorksSSNMPException
The address of the remote host. Domain names are resolved to IP addresses.

The RemoteHost property specifies the IP address (IP number in dotted internet format) or Domain Name of the host SNMP requests or traps are sent to.

If RemoteHost is set to 255.255.255.255, the bean broadcasts data on the local subnet.

If the RemoteHost property is set to a Domain Name, a DNS request is initiated and upon successful termination of the request, the RemoteHost property is set to the corresponding address. If the search is not successful, an error is returned.

IPWorksSSNMPException

getRemotePort

public int getRemotePort()
The UDP port where the remote SNMP agent is listening.

The RemotePort is the UDP port on the RemoteHost to send SNMP requests to.

A valid port number (a value between 1 and 65535) is required. The default value is 161.


setRemotePort

public void setRemotePort(int remotePort)
                   throws IPWorksSSNMPException
The UDP port where the remote SNMP agent is listening.

The RemotePort is the UDP port on the RemoteHost to send SNMP requests to.

A valid port number (a value between 1 and 65535) is required. The default value is 161.

IPWorksSSNMPException

getRequestId

public int getRequestId()
The request-id to mark outgoing packets with.

If a custom value is needed for RequestId , the property must be set before sending the request. The bean increments RequestId automatically after sending each packet.


setRequestId

public void setRequestId(int requestId)
                  throws IPWorksSSNMPException
The request-id to mark outgoing packets with.

If a custom value is needed for RequestId , the property must be set before sending the request. The bean increments RequestId automatically after sending each packet.

IPWorksSSNMPException

getSNMPVersion

public int getSNMPVersion()
Version of SNMP used for outgoing requests.

This property takes one of the following values:

snmpverV1 (1)
SNMP Version 1.
snmpverV2c (2)
SNMP Version 2c.
snmpverV3 (3)
SNMP Version 3.


setSNMPVersion

public void setSNMPVersion(int SNMPVersion)
                    throws IPWorksSSNMPException
Version of SNMP used for outgoing requests.

This property takes one of the following values:

snmpverV1 (1)
SNMP Version 1.
snmpverV2c (2)
SNMP Version 2c.
snmpverV3 (3)
SNMP Version 3.

IPWorksSSNMPException

getTimeout

public int getTimeout()
A timeout for the bean.

If the Timeout property is set to 0, all operations return immediately, potentially failing with an error if they can't be completed immediately.

If Timeout is set to a positive value, the bean will wait for the operation to complete before returning control.

The bean will use DoEvents to enter an efficient wait loop during any potential waiting period, making sure that all system events are processed immediately as they arrive. This ensures that the host application does not "freeze" and remains responsive.

If Timeout expires, and the operation is not yet complete, the bean throws an IPWorksException raises an IPWorksException exception .

Please note that by default, all timeouts are inactivity timeouts , i.e. the timeout period is extended by Timeout seconds when data is successfully sent or received.

Optionally, the behavior of the bean may be changed to absolute timeouts , i.e. the bean will wait for a maximum of Timeout seconds since the beginning of the operation, without extending the timeout period during communications.

This behavior is controlled by theAbsoluteTimeoutconfiguration setting.

The default value for the Timeout property is 60 seconds.


setTimeout

public void setTimeout(int timeout)
                throws IPWorksSSNMPException
A timeout for the bean.

If the Timeout property is set to 0, all operations return immediately, potentially failing with an error if they can't be completed immediately.

If Timeout is set to a positive value, the bean will wait for the operation to complete before returning control.

The bean will use DoEvents to enter an efficient wait loop during any potential waiting period, making sure that all system events are processed immediately as they arrive. This ensures that the host application does not "freeze" and remains responsive.

If Timeout expires, and the operation is not yet complete, the bean throws an IPWorksException raises an IPWorksException exception .

Please note that by default, all timeouts are inactivity timeouts , i.e. the timeout period is extended by Timeout seconds when data is successfully sent or received.

Optionally, the behavior of the bean may be changed to absolute timeouts , i.e. the bean will wait for a maximum of Timeout seconds since the beginning of the operation, without extending the timeout period during communications.

This behavior is controlled by theAbsoluteTimeoutconfiguration setting.

The default value for the Timeout property is 60 seconds.

IPWorksSSNMPException

getUser

public java.lang.String getUser()
The user name used for SNMPv3 authentication.

If authentication is desired, this property must be set before the bean attempts to connect to an SNMPv3 Agent.


setUser

public void setUser(java.lang.String user)
             throws IPWorksSSNMPException
The user name used for SNMPv3 authentication.

If authentication is desired, this property must be set before the bean attempts to connect to an SNMPv3 Agent.

IPWorksSSNMPException

config

public java.lang.String config(java.lang.String configurationString)
                        throws IPWorksSSNMPException
Sets or retrieves a beanconfiguration setting.

Config is a generic method available in every bean. It is used to set and retrieveconfiguration settingsfor the bean.

Configuration settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the bean, access to these internal properties is provided through the Config method.

To set a configuration setting named PROPERTY , you must call Config("PROPERTY=VALUE") , where VALUE is the value of the setting expressed as a string. For boolean values, use the strings "True", "False", "0", "1", "Yes", or "No" (case does not matter).

To read (query) the value of a configuration setting, you must call Config("PROPERTY") . The value will be returned as a string.

IPWorksSSNMPException

discover

public void discover()
              throws IPWorksSSNMPException
Performs SNMPv3 discovery.

When the method is called an SNMPv3 engine discovery request is sent to RemoteHost .

If an AuthenticationPassword is provided, the engine id discovery request is followed by an engine time discovery request, as required by the SNMPv3 User Security Model (USM). In this case Timeout must be set to a non-zero value before calling Discover and the bean will wait until a response is received from RemoteHost .

The DiscoveryResponse event is fired upon receipt of a valid discovery response and the values of RemoteEngineId , RemoteEngineBoots , and RemoteEngineTime will then be updated with the received Engine Id, Time, and Boots.

IPWorksSSNMPException

doEvents

public void doEvents()
              throws IPWorksSSNMPException
Processes events from the internal message queue.

When DoEvents is called, the bean processes any available events. If no events are available, it waits for a preset period of time, and then returns.

IPWorksSSNMPException

hashPasswords

public void hashPasswords()
                   throws IPWorksSSNMPException
Hashes all passwords in the cache.

Forces computation of all passwords hashes in the cache. Used together with the HashPassword event to enable implementations of external password hash storage.

IPWorksSSNMPException

interrupt

public void interrupt()
               throws IPWorksSSNMPException
Interrupt the current method.

If there is no method in progress, Interrupt simply returns doing nothing.

IPWorksSSNMPException

reset

public void reset()
           throws IPWorksSSNMPException
Clears the object arrays.

Clears the object arrays, and sets the trap and error properties to their default values. This is useful for reinitializing all the properties that are used to create outgoing packets before building a new packet.

IPWorksSSNMPException

sendGetBulkRequest

public void sendGetBulkRequest(int nonRepeaters,
                               int maxRepetitions)
                        throws IPWorksSSNMPException
Send a GetBulkRequest packet.

Sends a GetBulkRequest packet.

NonRepeaters specifies the number of variables for which a single lexicographic successor is to be returned.

MaxRepetitions specifies the number of lexicographic successors to be returned for variables other than those in the NonRepeaters list.

The object identifiers and types for the request are taken from the ObjId and ObjType arrays. Any values are returned in the ObjValue array.

Example (Sending a GetBulk Request)

 SNMPControl.RemoteHost = "MyAgent"
 SNMPControl.ObjCount = 2
 SNMPControl.ObjID(1) = "1.3.6.1.2.1.1.1.0"
 SNMPControl.ObjID(2) = "1.3.6.1.2.1.1.3.0"
 SNMPControl.SendGetBulkRequest(1,4) 

The code sample above will send a GetBulkRequest with 1 non repeater, and a maxrepetitions of 4. Since there is only 1 non repeater, only one ObjID will "not repeat" and will only return one successor. The rest of the ObjID's (in this case, only 1) will return 4 successors. This particular example will return the following ObjID's:

1
1.3.6.1.2.1.1.2.0
2
1.3.6.1.2.1.1.4.0
3
1.3.6.1.2.1.1.5.0
4
1.3.6.1.2.1.1.6.0
5
1.3.6.1.2.1.1.7.0

IPWorksSSNMPException

sendGetNextRequest

public void sendGetNextRequest()
                        throws IPWorksSSNMPException
Send GetNextRequest packet.

Sends a GetNextRequest packet. The object identifiers and types for the request are taken from the ObjId and ObjType arrays. Any values are returned in the ObjValue array.

Example (Sending a GetNext Request)

 SNMPControl.ObjCount = 1
 SNMPControl.ObjID(1) = "1.3.6.1.2.1.1.1.0"
 SNMPControl.SendGetNextRequest() 
The agent will respond with the "next" (relative to the ObjID(s) you specify) OID in the table.

IPWorksSSNMPException

sendGetRequest

public void sendGetRequest()
                    throws IPWorksSSNMPException
Send GetRequest packet.

Sends a GetRequest packet. The object identifiers and types for the request are taken from the ObjId and ObjType arrays. Any values are returned in the ObjValue array. .

Example (Sending a GetRequest)

 SNMPControl.RemoteHost = "MyAgent"
 SNMPControl.ObjCount = 2
 SNMPControl.ObjID(1) = "1.3.6.1.2.1.1.1.0"
 SNMPControl.ObjID(2) = "1.3.6.1.2.1.1.2.0"
 SNMPControl.SendGetRequest() 

IPWorksSSNMPException

sendInformRequest

public void sendInformRequest()
                       throws IPWorksSSNMPException
Send an InformRequest packet.

Sends an InformRequest packet. The object identifiers and types for the request are taken from the ObjId and ObjType arrays. Any values are returned in the ObjValue array.

IPWorksSSNMPException

sendSetRequest

public void sendSetRequest()
                    throws IPWorksSSNMPException
Send Set Request packet.

Sends a SetRequest packet. The object identifiers and types for the request are taken from the ObjId and ObjType arrays. Any values are returned in the ObjValue array.

Example (Sending a SetRequest)

 SNMPControl.RemoteHost = "MyAgent"
 SNMPControl.ObjCount = 1
 SNMPControl.ObjID(1) = "1.3.6.1.2.1.1.1.0"
 SNMPControl.ObjValue(1) = "New Value"
 SNMPControl.SendSetRequest() 

IPWorksSSNMPException

value

public java.lang.String value(java.lang.String OID)
                       throws IPWorksSSNMPException
Returns the value corresponding to an OID.

If the OID does not exist in the ObjId array, a trappable error is generated.

Please refer to the ObjId and ObjValue properties for more information.

IPWorksSSNMPException

addSnmpmgrEventListener

public void addSnmpmgrEventListener(SnmpmgrEventListener l)
                             throws java.util.TooManyListenersException
java.util.TooManyListenersException

removeSnmpmgrEventListener

public void removeSnmpmgrEventListener(SnmpmgrEventListener l)

IP*Works! S/SNMP V6

Copyright (c) 2005 /n software inc. - All rights reserved.