IP*Works!

ipworks
Class Snmp

java.lang.Object
  |
  +--ipworks.Snmp

public class Snmp
extends java.lang.Object

The SNMP class is used to implement SNMP Management Applications and SNMP Agent Applications.

The SNMP class implements a standard SNMP Version 1 Manager and/or Agent as specified in RFC 1157.

The class provides both encoding/decoding and transport capabilities, making the task of developing a custom SNMP agent or 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 class is activated/deactivated by first setting the LocalPort to 161 or 162, depending on whether you want to implement an SNMP agent or SNMP manager, and then setting the Active property. This property enables or disables sending or receiving. It operates completely asynchronously. Messages are sent to other agents or managers by using the Action property, and are recieved through events such as GetRequest , GetResponse , or Trap .

SNMP object ids, 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. Other packet information is provided through corresponding properties, such as Community , or RequestId , or similarly named parameters in events.

The class may behave as an SNMP agent or SNMP manager, depending on the value of the LocalPort property. If the class listens to port 161 it may act as an SNMP agent by responding to SNMP requests from SNMP managers, and sending traps through the Action property. If the LocalPort is set to 162, the class listens for SNMP traps, and may send requests to SNMP agents listening on port 161.

SNMP Traps are received through the Trap event, and may be sent through the Action property by specifying appropriate values in the various trap properties, such as TrapAgentAddress , TrapEnterprise , TrapGenericType , TrapSpecificType , and TrapTimeStamp .


Field Summary
static int a_Reset
           
static int a_SendGetNextRequest
           
static int a_SendGetRequest
           
static int a_SendGetResponse
           
static int a_SendSetRequest
           
static int a_SendTrap
           
static int ot_Counter32
           
static int ot_Counter64
           
static int ot_Gauge32
           
static int ot_Integer
           
static int ot_IPAddress
           
static int ot_NSAP
           
static int ot_Null
           
static int ot_ObjectId
           
static int ot_OctetString
           
static int ot_Opaque
           
static int ot_TimeTicks
           
static int ot_UnsignedInteger32
           
static int tgt_AuthenticationFailure
           
static int tgt_ColdStart
           
static int tgt_EGPNeighborLoss
           
static int tgt_EnterpriseSpecific
           
static int tgt_LinkDown
           
static int tgt_LinkUp
           
static int tgt_WarmStart
           
 
Constructor Summary
Snmp()
           
 
Method Summary
 void addSnmpEventListener(SnmpEventListener l)
           
 void fireError(int errorCode, java.lang.String description)
          Information about errors during data delivery.
 void fireGetNextRequest(int requestId, java.lang.String community, java.lang.String sourceAddress, int sourcePort)
          Fired when a GetNextRequest packet is received.
 void fireGetRequest(int requestId, java.lang.String community, java.lang.String sourceAddress, int sourcePort)
          Fired when a GetRequest packet is received.
 void fireGetResponse(int requestId, java.lang.String community, int errorStatus, int errorIndex, java.lang.String sourceAddress, int sourcePort)
          Fired when a GetResponse packet is received.
 void fireReadyToSend()
          Fired when the component is ready to send data.
 void fireSetRequest(int requestId, java.lang.String community, java.lang.String sourceAddress, int sourcePort)
          Fired when a SetRequest packet is received.
 void fireTrap(java.lang.String community, java.lang.String enterprise, java.lang.String agentAddress, int genericType, int specificType, int timeStamp, java.lang.String sourceAddress, int sourcePort)
          Fired when a SNMP trap packet is received.
 int getAction()
          An action code for the component.
 java.lang.String getCommunity()
          The community string used to authenticate SNMP packets.
 int getErrorIndex()
          Index of the first variable (object) that caused an error.
 int getErrorStatus()
          Status code for outgoing 'Get-Response' packets.
 int getInBufferSize()
          The size in bytes of the incoming queue of the socket.
 java.lang.String getLocalHost()
          The name of the local host.
 int getLocalPort()
          The UDP port in the local host where the SNMP component listens 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 getOutBufferSize()
          The size in bytes of the outgoing queue of the socket.
 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.
 java.lang.String getTrapAgentAddress()
          The address of the object generating the trap.
 java.lang.String getTrapEnterprise()
          The type of the object generating the trap.
 int getTrapGenericType()
          The generic type of the trap being sent.
 int getTrapSpecificType()
          The specific type of the trap being sent.
 int getTrapTimeStamp()
          Time passed since the agent was initialized (in hundredths of a second).
 boolean isActive()
          Enables or disables sending and receiving of SNMP packets.
 boolean isShareLocalPort()
          If set to True, allows more than one instance of the component to be Active on the same LocalPort .
 void removeSnmpEventListener(SnmpEventListener l)
           
 void setAction(int action)
          An action code for the component.
 void setActive(boolean active)
          Enables or disables sending and receiving of SNMP packets.
 void setCommunity(java.lang.String community)
          The community string used to authenticate SNMP packets.
 void setErrorIndex(int errorIndex)
          Index of the first variable (object) that caused an error.
 void setErrorStatus(int errorStatus)
          Status code for outgoing 'Get-Response' packets.
 void setInBufferSize(int inBufferSize)
          The size in bytes of the incoming queue of the socket.
 void setLocalPort(int localPort)
          The UDP port in the local host where the SNMP component listens 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 setOutBufferSize(int outBufferSize)
          The size in bytes of the outgoing queue of the socket.
 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 setShareLocalPort(boolean shareLocalPort)
          If set to True, allows more than one instance of the component to be Active on the same LocalPort .
 void setTrapAgentAddress(java.lang.String trapAgentAddress)
          The address of the object generating the trap.
 void setTrapEnterprise(java.lang.String trapEnterprise)
          The type of the object generating the trap.
 void setTrapGenericType(int trapGenericType)
          The generic type of the trap being sent.
 void setTrapSpecificType(int trapSpecificType)
          The specific type of the trap being sent.
 void setTrapTimeStamp(int trapTimeStamp)
          Time passed since the agent was initialized (in hundredths of a second).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

a_Reset

public static final int a_Reset

a_SendGetRequest

public static final int a_SendGetRequest

a_SendGetNextRequest

public static final int a_SendGetNextRequest

a_SendSetRequest

public static final int a_SendSetRequest

a_SendGetResponse

public static final int a_SendGetResponse

a_SendTrap

public static final int a_SendTrap

ot_Integer

public static final int ot_Integer

ot_OctetString

public static final int ot_OctetString

ot_Null

public static final int ot_Null

ot_ObjectId

public static final int ot_ObjectId

ot_IPAddress

public static final int ot_IPAddress

ot_Counter32

public static final int ot_Counter32

ot_Gauge32

public static final int ot_Gauge32

ot_TimeTicks

public static final int ot_TimeTicks

ot_Opaque

public static final int ot_Opaque

ot_NSAP

public static final int ot_NSAP

ot_Counter64

public static final int ot_Counter64

ot_UnsignedInteger32

public static final int ot_UnsignedInteger32

tgt_ColdStart

public static final int tgt_ColdStart

tgt_WarmStart

public static final int tgt_WarmStart

tgt_LinkDown

public static final int tgt_LinkDown

tgt_LinkUp

public static final int tgt_LinkUp

tgt_AuthenticationFailure

public static final int tgt_AuthenticationFailure

tgt_EGPNeighborLoss

public static final int tgt_EGPNeighborLoss

tgt_EnterpriseSpecific

public static final int tgt_EnterpriseSpecific
Constructor Detail

Snmp

public Snmp()
Method Detail

getAction

public int getAction()
An action code for the component. Setting the Action property to a valid action code makes the class perform the associated action. If the action completes successfully, execution continues normally, and Action is reset to 0 (Idle). If an error happens, then an IPWorksException exception is raised.

For every action except 'Reset' the class creates an SNMP packet based on the values provided in the correspoding properties (described below), and attempts to send it to RemoteHost at the port specified by RemotePort .

The class attempts to send the packet as a complete message. If the socket buffer is full, or the message cannot be delivered for any other reason, an error is returned, and no portion of the packet is sent. You may then try to resend the packet later.

The same thing may happend if you are sending packets to the remote host faster than it can process them, or faster than the network's bandwidth allows. If this is the case, the assignment to Action

The following are the possible values for the Action property:

a_Reset
Clears the object arrays, and sets the trap and error properties to their default values. This is useful for reinitializing the all the properties that are used to create outgoing packets before building a new packet.
a_SendGetRequest
Sends a GetRequest packet. The properties used to build the packet are the following: RequestId , Community , ErrorStatus , ErrorIndex , ObjId , ObjType , ObjCount .
a_SendGetNextRequest
Sends a GetNextRequest packet. The properties used to build the packet are the following: RequestId , Community , ErrorStatus , ErrorIndex , ObjId , ObjType , ObjCount .
a_SendGetNextRequest
Sends a SetRequest packet. The properties used to build the packet are the following: RequestId , Community , ErrorStatus , ErrorIndex , ObjId , ObjType , ObjValue , ObjCount .
a_SendGetResponse
Sends a GetResponse packet. The properties used to build the packet are the following: RequestId , Community , ErrorStatus , ErrorIndex , ObjId , ObjType , ObjValue , ObjCount .
a_SendTrap
Sends a Trap packet. The properties used to build the packet are the following: Community , TrapEnterprise , TrapAgentAddress , TrapGenericType , TrapSpecificType , TrapTimeStamp , ObjId , ObjType , ObjValue , ObjCount .


setAction

public void setAction(int action)
               throws IPWorksException
An action code for the component. Setting the Action property to a valid action code makes the class perform the associated action. If the action completes successfully, execution continues normally, and Action is reset to 0 (Idle). If an error happens, then an IPWorksException exception is raised.

For every action except 'Reset' the class creates an SNMP packet based on the values provided in the correspoding properties (described below), and attempts to send it to RemoteHost at the port specified by RemotePort .

The class attempts to send the packet as a complete message. If the socket buffer is full, or the message cannot be delivered for any other reason, an error is returned, and no portion of the packet is sent. You may then try to resend the packet later.

The same thing may happend if you are sending packets to the remote host faster than it can process them, or faster than the network's bandwidth allows. If this is the case, the assignment to Action

The following are the possible values for the Action property:

a_Reset
Clears the object arrays, and sets the trap and error properties to their default values. This is useful for reinitializing the all the properties that are used to create outgoing packets before building a new packet.
a_SendGetRequest
Sends a GetRequest packet. The properties used to build the packet are the following: RequestId , Community , ErrorStatus , ErrorIndex , ObjId , ObjType , ObjCount .
a_SendGetNextRequest
Sends a GetNextRequest packet. The properties used to build the packet are the following: RequestId , Community , ErrorStatus , ErrorIndex , ObjId , ObjType , ObjCount .
a_SendGetNextRequest
Sends a SetRequest packet. The properties used to build the packet are the following: RequestId , Community , ErrorStatus , ErrorIndex , ObjId , ObjType , ObjValue , ObjCount .
a_SendGetResponse
Sends a GetResponse packet. The properties used to build the packet are the following: RequestId , Community , ErrorStatus , ErrorIndex , ObjId , ObjType , ObjValue , ObjCount .
a_SendTrap
Sends a Trap packet. The properties used to build the packet are the following: Community , TrapEnterprise , TrapAgentAddress , TrapGenericType , TrapSpecificType , TrapTimeStamp , ObjId , ObjType , ObjValue , ObjCount .


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 may be sent through the Action property. or received through the respective events.


setActive

public void setActive(boolean active)
               throws IPWorksException
Enables or disables sending and receiving of SNMP packets. The Active property must be set to True before any SNMP requests or traps may be sent through the Action property. or received through the respective events.


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 when SNMP packets are sent via the Action property. When a packet is received through events such as Trap , GetRequest etc.., the corresponding value is provided through the respective event parameter.


setCommunity

public void setCommunity(java.lang.String community)
                  throws IPWorksException
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 when SNMP packets are sent via the Action property. When a packet is received through events such as Trap , GetRequest etc.., the corresponding value is provided through the respective event parameter.


getErrorIndex

public int getErrorIndex()
Index of the first variable (object) that caused an error. This property is used in conjunction with the ErrorStatus property and is used to construct outgoing 'Get-Response' packets. For 'Get-Response' packets received through the GetResponse event, the corresponding value is provided as an event parameter.

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


setErrorIndex

public void setErrorIndex(int errorIndex)
                   throws IPWorksException
Index of the first variable (object) that caused an error. This property is used in conjunction with the ErrorStatus property and is used to construct outgoing 'Get-Response' packets. For 'Get-Response' packets received through the GetResponse event, the corresponding value is provided as an event parameter.

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 outgoing 'Get-Response' packets. This property is used in conjunction with the ErrorIndex property and is used to construct outgoing 'Get-Response' packets. For 'Get-Response' packets received through the GetResponse event, the corresponding value is provided as an event parameter.

Possible values include:

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 (genErr)
Other error.

The default value is 0 (no error).


setErrorStatus

public void setErrorStatus(int errorStatus)
                    throws IPWorksException
Status code for outgoing 'Get-Response' packets. This property is used in conjunction with the ErrorIndex property and is used to construct outgoing 'Get-Response' packets. For 'Get-Response' packets received through the GetResponse event, the corresponding value is provided as an event parameter.

Possible values include:

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 (genErr)
Other error.

The default value is 0 (no error).


getInBufferSize

public int getInBufferSize()
The size in bytes of the incoming queue of the socket. This is the size of an internal queue in the Winsock stack. You can increase or decrease its size depending on the amount of data that you will be receiving. Increasing the value of the InBufferSize property can provide drastic improvements in performance in some cases.

Some TCP/IP implementations do not support variable buffer sizes. If that is the case, when class is activated the InBufferSize property reverts to its defined size. The same happens if you attempt to make it too large or too small.


setInBufferSize

public void setInBufferSize(int inBufferSize)
                     throws IPWorksException
The size in bytes of the incoming queue of the socket. This is the size of an internal queue in the Winsock stack. You can increase or decrease its size depending on the amount of data that you will be receiving. Increasing the value of the InBufferSize property can provide drastic improvements in performance in some cases.

Some TCP/IP implementations do not support variable buffer sizes. If that is the case, when class is activated the InBufferSize property reverts to its defined size. The same happens if you attempt to make it too large or too small.


getLocalPort

public int getLocalPort()
The UDP port in the local host where the SNMP component listens to. The LocalPort property must be set before the SNMP class is activated ( Active is set to True). It instructs the class to bind to a specific port (or communication endpoint) in the local machine.

Setting it to 0 (default) allows Winsock to choose a port at random. The value chosen is provided via the $rpLocalPort; property after the class is activated through the Active property.

If you are implementing an SNMP Agent, then LocalPort must be set to 161 to listen for SNMP requests, or 162 to listen for SNMP traps. Note that only one application on the machine may bind to a particular port, so use this property carefully.

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


setLocalPort

public void setLocalPort(int localPort)
                  throws IPWorksException
The UDP port in the local host where the SNMP component listens to. The LocalPort property must be set before the SNMP class is activated ( Active is set to True). It instructs the class to bind to a specific port (or communication endpoint) in the local machine.

Setting it to 0 (default) allows Winsock to choose a port at random. The value chosen is provided via the $rpLocalPort; property after the class is activated through the Active property.

If you are implementing an SNMP Agent, then LocalPort must be set to 161 to listen for SNMP requests, or 162 to listen for SNMP traps. Note that only one application on the machine may bind to a particular port, so use this property carefully.

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


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 IPWorksException
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.


getObjId

public java.lang.String getObjId(int objIndex)
                          throws IPWorksException
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 an outgoing SNMP packet when the Action is set.

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


setObjId

public void setObjId(int objIndex,
                     java.lang.String objId)
              throws IPWorksException
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 an outgoing SNMP packet when the Action is set.

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


getObjType

public int getObjType(int objIndex)
               throws IPWorksException
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 the Action is set. The default type is OCTET STRING (4).

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

Possible values include:

INTEGER
2
OCTET STRING
4
NULL
5
OBJECT ID
6
IP ADDRESS
64
32 BIT COUNTER
65
32 BIT GAUGE
66
TIMETICKS
67
OPAQUE
68
NSAP
69
64 BIT COUNTER
70
UNSIGNED INTEGER32
71


setObjType

public void setObjType(int objIndex,
                       int objType)
                throws IPWorksException
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 the Action is set. The default type is OCTET STRING (4).

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

Possible values include:

INTEGER
2
OCTET STRING
4
NULL
5
OBJECT ID
6
IP ADDRESS
64
32 BIT COUNTER
65
32 BIT GAUGE
66
TIMETICKS
67
OPAQUE
68
NSAP
69
64 BIT COUNTER
70
UNSIGNED INTEGER32
71


getObjValue

public byte[] getObjValue(int objIndex)
                   throws IPWorksException
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 the Action is set.

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


setObjValue

public void setObjValue(int objIndex,
                        byte[] objValue)
                 throws IPWorksException
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 the Action is set.

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


getOutBufferSize

public int getOutBufferSize()
The size in bytes of the outgoing queue of the socket. This is the size of an internal queue in the Winsock stack. You can increase or decrease its size depending on the amount of data that you will be sending. Increasing the value of the OutBufferSize property can provide drastic improvements in performance in some cases.

Some TCP/IP implementations do not support variable buffer sizes. If that is the case, when the class is activated the OutBufferSize property reverts to its defined size. The same happens if you attempt to make it too large or too small.


setOutBufferSize

public void setOutBufferSize(int outBufferSize)
                      throws IPWorksException
The size in bytes of the outgoing queue of the socket. This is the size of an internal queue in the Winsock stack. You can increase or decrease its size depending on the amount of data that you will be sending. Increasing the value of the OutBufferSize property can provide drastic improvements in performance in some cases.

Some TCP/IP implementations do not support variable buffer sizes. If that is the case, when the class is activated the OutBufferSize property reverts to its defined size. The same happens if you attempt to make it too large or too small.


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 class 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 IPWorksException
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 class 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.


getRemotePort

public int getRemotePort()
The UDP port where the remote SNMP agent is listening. The RemotePort is the UDP port on the RemoteHost where to send SNMP requests to.

A valid port number (a value between 1 and 65535) is required. The special value 0 directs class to automatically select 161 for SNMP requests and 162 for SNMP traps.


setRemotePort

public void setRemotePort(int remotePort)
                   throws IPWorksException
The UDP port where the remote SNMP agent is listening. The RemotePort is the UDP port on the RemoteHost where to send SNMP requests to.

A valid port number (a value between 1 and 65535) is required. The special value 0 directs class to automatically select 161 for SNMP requests and 162 for SNMP traps.


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 setting Action . The class increments RequestId automatically after sending each packet.


setRequestId

public void setRequestId(int requestId)
                  throws IPWorksException
The request-id to mark outgoing packets with. If a custom value is needed for RequestId , the property must be set before setting Action . The class increments RequestId automatically after sending each packet.


isShareLocalPort

public boolean isShareLocalPort()
If set to True, allows more than one instance of the component to be Active on the same LocalPort . This option must be set before the class is activated through the Active property or it will have no effect.


setShareLocalPort

public void setShareLocalPort(boolean shareLocalPort)
                       throws IPWorksException
If set to True, allows more than one instance of the component to be Active on the same LocalPort . This option must be set before the class is activated through the Active property or it will have no effect.


getTrapAgentAddress

public java.lang.String getTrapAgentAddress()
The address of the object generating the trap. Defaults to the address of the localhost.

This property is used when traps are sent via the Action property. When a trap is received through the Trap event, the corresponding value is provided through the respective event parameter.


setTrapAgentAddress

public void setTrapAgentAddress(java.lang.String trapAgentAddress)
                         throws IPWorksException
The address of the object generating the trap. Defaults to the address of the localhost.

This property is used when traps are sent via the Action property. When a trap is received through the Trap event, the corresponding value is provided through the respective event parameter.


getTrapEnterprise

public java.lang.String getTrapEnterprise()
The type of the object generating the trap. The TrapEnterprise property is equal to the OID (object id) of the sending agent.

This property is used when traps are sent via the Action property. When a trap is received through the Trap event, the corresponding value is provided through the respective event parameter.


setTrapEnterprise

public void setTrapEnterprise(java.lang.String trapEnterprise)
                       throws IPWorksException
The type of the object generating the trap. The TrapEnterprise property is equal to the OID (object id) of the sending agent.

This property is used when traps are sent via the Action property. When a trap is received through the Trap event, the corresponding value is provided through the respective event parameter.


getTrapGenericType

public int getTrapGenericType()
The generic type of the trap being sent. This property is used when traps are sent via the Action property. When a trap is received through the Trap event, the corresponding value is provided through the respective event parameter.

Possible values of TrapGenericType include:

0 (coldStart)
The agent is initializing itself.
1 (warmStart)
The agent is reinitializing itself.
2 (linkDown)
An interface has gone down.
3 (linkUp)
An interface has gone up.
4 (authenticationFailure)
A message was received from an SNMP manager with an invalid community.
5 (egpNeighborLoss)
An EGP peer has gone down.
6 (enterpriseSpecific)
Specific to the local SNMP implementation.


setTrapGenericType

public void setTrapGenericType(int trapGenericType)
                        throws IPWorksException
The generic type of the trap being sent. This property is used when traps are sent via the Action property. When a trap is received through the Trap event, the corresponding value is provided through the respective event parameter.

Possible values of TrapGenericType include:

0 (coldStart)
The agent is initializing itself.
1 (warmStart)
The agent is reinitializing itself.
2 (linkDown)
An interface has gone down.
3 (linkUp)
An interface has gone up.
4 (authenticationFailure)
A message was received from an SNMP manager with an invalid community.
5 (egpNeighborLoss)
An EGP peer has gone down.
6 (enterpriseSpecific)
Specific to the local SNMP implementation.


getTrapSpecificType

public int getTrapSpecificType()
The specific type of the trap being sent. This property is used when traps are sent via the Action property. When a trap is received through the Trap event, the corresponding value is provided through the respective event parameter.


setTrapSpecificType

public void setTrapSpecificType(int trapSpecificType)
                         throws IPWorksException
The specific type of the trap being sent. This property is used when traps are sent via the Action property. When a trap is received through the Trap event, the corresponding value is provided through the respective event parameter.


getTrapTimeStamp

public int getTrapTimeStamp()
Time passed since the agent was initialized (in hundredths of a second). This property is used when traps are sent via the Action property. When a trap is received through the Trap event, the corresponding value is provided through the respective event parameter.


setTrapTimeStamp

public void setTrapTimeStamp(int trapTimeStamp)
                      throws IPWorksException
Time passed since the agent was initialized (in hundredths of a second). This property is used when traps are sent via the Action property. When a trap is received through the Trap event, the corresponding value is provided through the respective event parameter.


getLocalHost

public java.lang.String getLocalHost()
The name of the local host. When connected, the IP address of the interface through which the connection was made. The LocalHost property contains the name of the local host as obtained by the gethostname() Winsock call.

If the class 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).


fireGetNextRequest

public void fireGetNextRequest(int requestId,
                               java.lang.String community,
                               java.lang.String sourceAddress,
                               int sourcePort)
Fired when a GetNextRequest packet is received. (Called internally to dispatch the event.)
See Also:
SnmpGetNextRequestEvent

fireGetRequest

public void fireGetRequest(int requestId,
                           java.lang.String community,
                           java.lang.String sourceAddress,
                           int sourcePort)
Fired when a GetRequest packet is received. (Called internally to dispatch the event.)
See Also:
SnmpGetRequestEvent

fireGetResponse

public void fireGetResponse(int requestId,
                            java.lang.String community,
                            int errorStatus,
                            int errorIndex,
                            java.lang.String sourceAddress,
                            int sourcePort)
Fired when a GetResponse packet is received. (Called internally to dispatch the event.)
See Also:
SnmpGetResponseEvent

fireReadyToSend

public void fireReadyToSend()
Fired when the component is ready to send data. (Called internally to dispatch the event.)
See Also:
SnmpReadyToSendEvent

fireSetRequest

public void fireSetRequest(int requestId,
                           java.lang.String community,
                           java.lang.String sourceAddress,
                           int sourcePort)
Fired when a SetRequest packet is received. (Called internally to dispatch the event.)
See Also:
SnmpSetRequestEvent

fireTrap

public void fireTrap(java.lang.String community,
                     java.lang.String enterprise,
                     java.lang.String agentAddress,
                     int genericType,
                     int specificType,
                     int timeStamp,
                     java.lang.String sourceAddress,
                     int sourcePort)
Fired when a SNMP trap packet is received. (Called internally to dispatch the event.)
See Also:
SnmpTrapEvent

fireError

public void fireError(int errorCode,
                      java.lang.String description)
Information about errors during data delivery. (Called internally to dispatch the event.)
See Also:
SnmpErrorEvent

addSnmpEventListener

public void addSnmpEventListener(SnmpEventListener l)
                          throws java.util.TooManyListenersException

removeSnmpEventListener

public void removeSnmpEventListener(SnmpEventListener l)

IP*Works!

Copyright (c) 1995-2000 by /n software inc. - All rights reserved.