|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.sun.jaw.impl.adaptor.generic.AdaptorServer | +--com.sun.jaw.impl.adaptor.snmp.AdaptorServerImpl
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 :
port
domain:com.sun.jaw.impl.adaptor.snmp.AdaptorServerImpl.port=44450,protocol=snmp
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 sendV2Trap
sends 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
.
Fields inherited from class com.sun.jaw.impl.adaptor.generic.AdaptorServer |
cmf,
maxActiveClientCount,
objectName,
OFFLINE,
ONLINE,
port,
STARTING,
state,
STOPPING |
Constructor Summary | |
AdaptorServerImpl()
Initializes this AdaptorServerImpl using the default port (161). |
|
AdaptorServerImpl(int p)
Initializes this AdaptorServerImpl using the specified port. |
|
AdaptorServerImpl(IPAclSrvIf acl)
Initializes this AdaptorServerImpl using the default port (161)and the
specified IPAclSrvIf
implementation. |
|
AdaptorServerImpl(IPAclSrvIf acl,
int p)
Initializes this AdaptorServerImpl using the specified port and the
specified IPAclSrvIf
implementation. |
Method Summary | |
boolean |
getAuthRespEnabled()
Returns true if this AdaptorServerImpl sends a response in case
of authentication failure. |
boolean |
getAuthTrapEnabled()
Returns true if authentication traps are enabled. |
java.lang.Integer |
getBufferSize()
Returns the buffer size of this AdaptorServerImpl . |
java.lang.String |
getClassVersion()
Returns the version of this class. |
java.lang.String |
getEnterpriseOid()
Returns the enterprise oid. |
java.lang.String[] |
getMibs()
Returns the names of the MIB available in the adaptor. |
java.lang.Integer |
getPort()
Returns the port used by this AdaptorServerImpl . |
java.lang.String |
getProtocol()
Returns the protocol of this AdaptorServerImpl . |
java.lang.Long |
getSnmpInASNParseErrs()
|
java.lang.Long |
getSnmpInBadCommunityNames()
|
java.lang.Long |
getSnmpInBadCommunityUses()
|
java.lang.Long |
getSnmpInBadVersions()
|
java.lang.Long |
getSnmpInGetNexts()
|
java.lang.Long |
getSnmpInGetRequests()
|
java.lang.Long |
getSnmpInPkts()
|
java.lang.Long |
getSnmpInSetRequests()
|
java.lang.Long |
getSnmpInTotalReqVars()
|
java.lang.Long |
getSnmpInTotalSetVars()
|
java.lang.Long |
getSnmpOutBadValues()
|
java.lang.Long |
getSnmpOutGenErrs()
|
java.lang.Long |
getSnmpOutGetResponses()
|
java.lang.Long |
getSnmpOutNoSuchNames()
|
java.lang.Long |
getSnmpOutPkts()
|
java.lang.Long |
getSnmpOutTooBigs()
|
java.lang.Long |
getSnmpOutTraps()
|
java.lang.Integer |
getTrapPort()
Returns the port used by this AdaptorServerImpl for sending traps. |
void |
initCmf(Framework f,
ObjectName name,
boolean db,
ModificationList list)
For Java DMK internal use only. |
boolean |
isAuthRespEnabled()
Returns true if this AdaptorServerImpl sends a response in case
of authentication failure. |
boolean |
isAuthTrapEnabled()
Returns true if authentication traps are enabled. |
void |
sendTrap(int generic,
int specific,
java.util.Vector varBindList)
Sends a trap using SNMP V1 trap format. |
void |
sendV2Trap(SnmpOid trapOid,
java.util.Vector varBindList)
Sends a trap using SNMP V2 trap format. |
void |
setAuthRespEnabled(boolean enabled)
Enables sending of responses in case of authentication failure. |
void |
setAuthTrapEnabled(boolean enabled)
Enables sending of traps in case of authentication failure. |
void |
setBufferSize(java.lang.Integer s)
Set the buffer size of this AdaptorServerImpl (default 1024). |
void |
setEnterpriseOid(java.lang.String oid)
Sets the enterprise oid. |
void |
setTrapPort(java.lang.Integer v)
Sets the port used by this AdaptorServerImpl for sending traps. |
void |
usePduFactory(SnmpPduFactoryIf factory)
Set the message factory of this AdaptorServerImpl . |
Methods inherited from class com.sun.jaw.impl.adaptor.generic.AdaptorServer |
addAdaptorListener,
deleteCmf,
getActiveClientCount,
getMaxActiveClientCount,
getServedClientCount,
getState,
getStateString,
isActive,
performStart,
performStop,
performWaitState,
removeAdaptorListener,
setMaxActiveClientCount |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public AdaptorServerImpl()
AdaptorServerImpl
using the default port (161).public AdaptorServerImpl(int p)
AdaptorServerImpl
using the specified port.public AdaptorServerImpl(IPAclSrvIf acl)
AdaptorServerImpl
using the default port (161)and the
specified IPAclSrvIf
implementation.public AdaptorServerImpl(IPAclSrvIf acl, int p)
AdaptorServerImpl
using the specified port and the
specified IPAclSrvIf
implementation.Method Detail |
public java.lang.String getClassVersion()
public java.lang.Integer getPort()
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.public java.lang.Integer getTrapPort()
AdaptorServerImpl
for sending traps.
By default, port 162 is used.public void setTrapPort(java.lang.Integer v)
AdaptorServerImpl
for sending traps.
By default, port 162 is used.public java.lang.String getProtocol()
AdaptorServerImpl
.public java.lang.Integer getBufferSize()
AdaptorServerImpl
.public void setBufferSize(java.lang.Integer s)
AdaptorServerImpl
(default 1024).public void usePduFactory(SnmpPduFactoryIf factory)
AdaptorServerImpl
.factory
- the factory object (null means the default factory).public boolean isAuthTrapEnabled()
When this feature is enabled, the AdaptorServerImpl
sends
an authenticationFailure
trap each time an authentication
fails.
The default behaviour is to send authentication traps.
true
if authentication traps are enable.public boolean getAuthTrapEnabled()
When this feature is enabled, the AdaptorServerImpl
sends
an authenticationFailure
trap each time an authentication
fails.
The default behaviour is to send authentication traps.
true
if authentication traps are enable.public void setAuthTrapEnabled(boolean enabled)
enabled
- true if traps need to be sent.isAuthTrapEnabled()
public boolean isAuthRespEnabled()
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.
public boolean getAuthRespEnabled()
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.
public void setAuthRespEnabled(boolean enabled)
public java.lang.String[] getMibs()
public void sendTrap(int generic, int specific, java.util.Vector varBindList) throws java.io.IOException, SnmpStatusException
generic
- The generic number of the trap.specific
- The specific number of the trap.varBindList
- A vector of SnmpVarBind instances or null.bufferSize
public void sendV2Trap(SnmpOid trapOid, java.util.Vector varBindList) throws java.io.IOException, SnmpStatusException
sysUpTime.0
with its current value
snmpTrapOid.0
with the value specified by trapOid
all the (oid,values)
from varBindList
trapOid
- The OID identifying the trap.varBindList
- A vector of SnmpVarBind instances or null.bufferSize
public java.lang.String getEnterpriseOid()
sendTrap
to fill
the 'enterprise' field of the trap request.public void setEnterpriseOid(java.lang.String oid) throws java.lang.IllegalArgumentException
oid
- The oid in string format "x.x.x.x"public java.lang.Long getSnmpOutTraps()
public java.lang.Long getSnmpOutGetResponses()
public java.lang.Long getSnmpOutGenErrs()
public java.lang.Long getSnmpOutBadValues()
public java.lang.Long getSnmpOutNoSuchNames()
public java.lang.Long getSnmpOutTooBigs()
public java.lang.Long getSnmpInASNParseErrs()
public java.lang.Long getSnmpInBadCommunityUses()
public java.lang.Long getSnmpInBadCommunityNames()
public java.lang.Long getSnmpInBadVersions()
public java.lang.Long getSnmpOutPkts()
public java.lang.Long getSnmpInPkts()
public java.lang.Long getSnmpInGetRequests()
public java.lang.Long getSnmpInGetNexts()
public java.lang.Long getSnmpInSetRequests()
public java.lang.Long getSnmpInTotalSetVars()
public java.lang.Long getSnmpInTotalReqVars()
public void initCmf(Framework f, ObjectName name, boolean db, ModificationList list) throws InstanceAlreadyExistException
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.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |