All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sun.jaw.impl.adaptor.snmp.AdaptorServerImpl

java.lang.Object
   |
   +----com.sun.jaw.impl.adaptor.generic.AdaptorServer
           |
           +----com.sun.jaw.impl.adaptor.snmp.AdaptorServerImpl

public class AdaptorServerImpl
extends AdaptorServer
implements SnmpDefinitions, SnmpMibHandlerSrvIf
The AdaptorServerImpl class implements an adaptor on top of the SNMP protocol.

When this adaptor is started it creates a datagram socket and is able to receive requests and send traps. When it is stopped, the socket is closed and no requests and no traps are processed.

The default port number of the socket is 161. This default value can be changed by specifying a port number in :

For instance, if you want to use port 44450, you can specify the following object name:

The SNMP adaptor supports versions 1 and 2 of the SNMP protocol in a stateless way : when it receives an v1 request, it replies with a v1 response, when it receives a v2 request it replies with a v2 response. The method sendTrap sends traps using SNMP v1 format. The method sendV2Trapsends traps using SNMP v2 format.

To receive data packets, the SNMP adaptor uses a buffer whose size can be configured using the property bufferSize (default value is 1024). Packets which does not fit in buffer are rejected. Increasing bufferSize allows to exchange bigger packets. However the underlying networking system may impose a limit on the size of UDP packets. Packets bigger than this limit will rejected too, no matter the value of bufferSize.


Constructor Index

 o AdaptorServerImpl()
Initializes this AdaptorServerImpl using the default port (161).
 o AdaptorServerImpl(int)
Initializes this AdaptorServerImpl using the specified port.
 o AdaptorServerImpl(IPAclSrvIf)
Initializes this AdaptorServerImpl using the default port (161)and the specified IPAclSrvIf implementation.
 o AdaptorServerImpl(IPAclSrvIf, int)
Initializes this AdaptorServerImpl using the specified port and the specified IPAclSrvIf implementation.

Method Index

 o addMib(SnmpMib)
For Java DMK internal use only.
 o getAuthRespEnabled()
Returns true if this AdaptorServerImpl sends a response in case of authentication failure.
 o getAuthTrapEnabled()
Returns true if authentication traps are enabled.
 o getBufferSize()
Returns the buffer size of this AdaptorServerImpl.
 o getClassVersion()
Returns the version of this class.
 o getEnterpriseOid()
Returns the enterprise oid.
 o getMibs()
Returns the names of the MIB available in the adaptor.
 o getPort()
Returns the port used by this AdaptorServerImpl.
 o getProtocol()
Returns the protocol of this AdaptorServerImpl.
 o getSnmpInASNParseErrs()
 o getSnmpInBadCommunityNames()
 o getSnmpInBadCommunityUses()
 o getSnmpInBadVersions()
 o getSnmpInGetNexts()
 o getSnmpInGetRequests()
 o getSnmpInPkts()
 o getSnmpInSetRequests()
 o getSnmpInTotalReqVars()
 o getSnmpInTotalSetVars()
 o getSnmpOutBadValues()
 o getSnmpOutGenErrs()
 o getSnmpOutGetResponses()
 o getSnmpOutNoSuchNames()
 o getSnmpOutPkts()
 o getSnmpOutTooBigs()
 o getSnmpOutTraps()
 o getTrapPort()
Returns the port used by this AdaptorServerImpl for sending traps.
 o incSnmpInASNParseErrs(int)
For Java DMK private use only.
 o incSnmpInBadCommunityNames(int)
For Java DMK private use only.
 o incSnmpInBadCommunityUses(int)
For Java DMK private use only.
 o incSnmpInBadVersions(int)
For Java DMK private use only.
 o initCmf(Framework, ObjectName, boolean, ModificationList)
For Java DMK internal use only.
 o isAuthRespEnabled()
Returns true if this AdaptorServerImpl sends a response in case of authentication failure.
 o isAuthTrapEnabled()
Returns true if authentication traps are enabled.
 o performStop()
 o removeMib(SnmpMib)
For Java DMK internal use only.
 o sendTrap(int, int, Vector)
Sends a trap using SNMP V1 trap format.
 o sendV2Trap(SnmpOid, Vector)
Sends a trap using SNMP V2 trap format.
 o setAuthRespEnabled(boolean)
Enables sending of responses in case of authentication failure.
 o setAuthTrapEnabled(boolean)
Enables sending of traps in case of authentication failure.
 o setBufferSize(Integer)
Set the buffer size of this AdaptorServerImpl (default 1024).
 o setEnterpriseOid(String)
Sets the enterprise oid.
 o setTrapPort(Integer)
Sets the port used by this AdaptorServerImpl for sending traps.
 o updateErrorCounters(int)
For Java DMK private use only.
 o updateRequestCounters(int)
For Java DMK private use only.
 o updateVarCounters(int, int)
For Java DMK private use only.
 o usePduFactory(SnmpPduFactoryIf)
Set the message factory of this AdaptorServerImpl.

Constructors

 o AdaptorServerImpl
 public AdaptorServerImpl()
Initializes this AdaptorServerImpl using the default port (161).

 o AdaptorServerImpl
 public AdaptorServerImpl(int p)
Initializes this AdaptorServerImpl using the specified port.

 o AdaptorServerImpl
 public AdaptorServerImpl(IPAclSrvIf acl)
Initializes this AdaptorServerImpl using the default port (161)and the specified IPAclSrvIf implementation.

 o AdaptorServerImpl
 public AdaptorServerImpl(IPAclSrvIf acl,
                          int p)
Initializes this AdaptorServerImpl using the specified port and the specified IPAclSrvIf implementation.

Methods

 o getClassVersion
 public String getClassVersion()
Returns the version of this class.

Returns:
the version of this class.
 o getPort
 public Integer getPort()
Returns the port used by this AdaptorServerImpl. This is the port used when creating the UDP socket. Its value is specified at creation time. But it can be changed by initCmf if the ObjectName assigned to the adaptor contains a 'port' key.

Returns:
The port number.
Overrides:
getPort in class AdaptorServer
 o getTrapPort
 public Integer getTrapPort()
Returns the port used by this AdaptorServerImpl for sending traps. By default, port 162 is used.

Returns:
The port number.
 o setTrapPort
 public void setTrapPort(Integer v)
Sets the port used by this AdaptorServerImpl for sending traps. By default, port 162 is used.

 o getProtocol
 public String getProtocol()
Returns the protocol of this AdaptorServerImpl.

Returns:
The string "snmp".
Overrides:
getProtocol in class AdaptorServer
 o getBufferSize
 public Integer getBufferSize()
Returns the buffer size of this AdaptorServerImpl.

 o setBufferSize
 public void setBufferSize(Integer s)
Set the buffer size of this AdaptorServerImpl (default 1024).

 o usePduFactory
 public void usePduFactory(SnmpPduFactoryIf factory)
Set the message factory of this AdaptorServerImpl.

Parameters:
factory - the factory object (null means the default factory).
 o isAuthTrapEnabled
 public boolean isAuthTrapEnabled()
Returns true if authentication traps are enabled.

When this feature is enabled, the AdaptorServerImpl sends an authenticationFailure trap each time an authentication fails.

The default behaviour is to send authentication traps.

Returns:
true if authentication traps are enable.
 o getAuthTrapEnabled
 public boolean getAuthTrapEnabled()
Returns true if authentication traps are enabled.

When this feature is enabled, the AdaptorServerImpl sends an authenticationFailure trap each time an authentication fails.

The default behaviour is to send authentication traps.

Returns:
true if authentication traps are enable.
 o setAuthTrapEnabled
 public void setAuthTrapEnabled(boolean enabled)
Enables sending of traps in case of authentication failure.

Parameters:
enabled - true if traps need to be sent.
See Also:
isAuthTrapEnabled
 o isAuthRespEnabled
 public boolean isAuthRespEnabled()
Returns true if this AdaptorServerImpl sends a response in case of authentication failure.

When this feature is enabled, the adaptor sends a response with noSuchName or readOnly when the authentication failed. If the flag is disable, the adaptor trashes the pdu silently.

The default behavior is to send responses.

Returns:
true if responses are sent
 o getAuthRespEnabled
 public boolean getAuthRespEnabled()
Returns true if this AdaptorServerImpl sends a response in case of authentication failure.

When this feature is enabled, the adaptor sends a response with noSuchName or readOnly when the authentication failed. If the flag is disable, the adaptor trashes the pdu silently.

The default behavior is to send responses.

Returns:
true if responses are sent
 o setAuthRespEnabled
 public void setAuthRespEnabled(boolean enabled)
Enables sending of responses in case of authentication failure.

Returns:
true if responses must be sent
 o addMib
 public void addMib(SnmpMib mib) throws IllegalArgumentException
For Java DMK internal use only.

Adds a new MIB in the adaptor. This method is called automatically by SnmpMib.setSnmpAdaptor.

Parameters:
mib - The mib to add
Throws: IllegalArgumentException
if the argument is null.
 o removeMib
 public Boolean removeMib(SnmpMib mib)
For Java DMK internal use only.

Removes a MIB from the adaptor. This method is called automatically by SnmpMib.setSnmpAdaptor(null).

Parameters:
mib - The mib to be removed.
Returns:
True if mib was a MIB included in the adaptor, false otherwise.
 o getMibs
 public String[] getMibs()
Returns the names of the MIB available in the adaptor.

Returns:
An array of MIB names.
 o sendTrap
 public void sendTrap(int generic,
                      int specific,
                      Vector varBindList) throws IOException, SnmpStatusException
Sends a trap using SNMP V1 trap format. The trap is sent to each destination defined in the ACL file (if available). If no ACL file or no destinations are available, the trap is sent to the local host.

Parameters:
generic - The generic number of the trap.
specific - The specific number of the trap.
varBindList - The variables to be included in the trap.
Throws: IOException
An I/O error occured while sending the traps
Throws: SnmpStatusException
If the trap exceeds the limit defined by bufferSize
 o sendV2Trap
 public void sendV2Trap(SnmpOid trapOid,
                        Vector varBindList) throws IOException, SnmpStatusException
Sends a trap using SNMP V2 trap format. The trap is sent to each destination defined in the ACL file (if available). If no ACL file or no destinations are available, the trap is sent to the local host. The variable list included in the outgoing trap is composed of the following items:

Parameters:
trapOid - The OID identifying the trap.
varBindList - The variables to be included in the trap.
Throws: IOException
An I/O error occured while sending the traps
Throws: SnmpStatusException
If the trap exceeds the limit defined by bufferSize
 o getEnterpriseOid
 public String getEnterpriseOid()
Returns the enterprise oid. It is used by sendTrap to fill the 'enterprise' field of the trap request.

Returns:
The oid in string format "x.x.x.x"
 o setEnterpriseOid
 public void setEnterpriseOid(String oid) throws IllegalArgumentException
Sets the enterprise oid.

Parameters:
oid - The oid in string format "x.x.x.x"
Throws: IllegalArgumentException
The string format is incorrect
 o getSnmpOutTraps
 public Long getSnmpOutTraps()
 o getSnmpOutGetResponses
 public Long getSnmpOutGetResponses()
 o getSnmpOutGenErrs
 public Long getSnmpOutGenErrs()
 o getSnmpOutBadValues
 public Long getSnmpOutBadValues()
 o getSnmpOutNoSuchNames
 public Long getSnmpOutNoSuchNames()
 o getSnmpOutTooBigs
 public Long getSnmpOutTooBigs()
 o getSnmpInASNParseErrs
 public Long getSnmpInASNParseErrs()
 o getSnmpInBadCommunityUses
 public Long getSnmpInBadCommunityUses()
 o getSnmpInBadCommunityNames
 public Long getSnmpInBadCommunityNames()
 o getSnmpInBadVersions
 public Long getSnmpInBadVersions()
 o getSnmpOutPkts
 public Long getSnmpOutPkts()
 o getSnmpInPkts
 public Long getSnmpInPkts()
 o getSnmpInGetRequests
 public Long getSnmpInGetRequests()
 o getSnmpInGetNexts
 public Long getSnmpInGetNexts()
 o getSnmpInSetRequests
 public Long getSnmpInSetRequests()
 o getSnmpInTotalSetVars
 public Long getSnmpInTotalSetVars()
 o getSnmpInTotalReqVars
 public Long getSnmpInTotalReqVars()
 o updateRequestCounters
 public void updateRequestCounters(int pduType)
For Java DMK private use only.

 o updateErrorCounters
 public void updateErrorCounters(int errorStatus)
For Java DMK private use only.

 o updateVarCounters
 public void updateVarCounters(int pduType,
                               int n)
For Java DMK private use only.

 o incSnmpInASNParseErrs
 public void incSnmpInASNParseErrs(int n)
For Java DMK private use only.

 o incSnmpInBadVersions
 public void incSnmpInBadVersions(int n)
For Java DMK private use only.

 o incSnmpInBadCommunityUses
 public void incSnmpInBadCommunityUses(int n)
For Java DMK private use only.

 o incSnmpInBadCommunityNames
 public void incSnmpInBadCommunityNames(int n)
For Java DMK private use only.

 o initCmf
 public void initCmf(Framework f,
                     ObjectName name,
                     boolean db,
                     ModificationList list) throws InstanceAlreadyExistException
For Java DMK internal use only.

This method add SNMP specific processing to the ancestor initCmf(). It parses the object name to find a port key: if this key is found, its value supersedes the current port number.

Throws: InstanceAlreadyExistException
The m-bean is already registered in the repository.
Overrides:
initCmf in class AdaptorServer
 o performStop
 public void performStop()
Overrides:
performStop in class AdaptorServer
See Also:
AdaptorServer

All Packages  Class Hierarchy  This Package  Previous  Next  Index