|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sun.jdmk.comm.CommunicatorServer com.sun.management.comm.CommunicatorServer com.sun.management.comm.SnmpAdaptorServer
public class SnmpAdaptorServer
Implements an adaptor on top of the SNMP protocol.
When this SNMP protocol adaptor is started it creates a datagram socket and is able to receive requests and send traps or inform requests. When it is stopped, the socket is closed and neither requests and nor traps/inform request are processed.
The default port number of the socket is 161. This default value can be changed by specifying a port number:
setPort
method before
starting the adaptorcom.sun.jdmk.ServiceName.DOMAIN
and com.sun.jdmk.ServiceName.SNMP_ADAPTOR_SERVER
.
The SNMP protocol adaptor supports versions 1 and 2 of the SNMP protocol
in a stateless way:
when it receives a v1 request, it replies with a v1 response,
when it receives a v2 request it replies with a v2 response.
The method snmpV1Trap
sends traps using SNMP v1
format.
The method snmpV2Trap
sends traps using SNMP v2 format.
The method snmpInformRequest
sends inform
requests using SNMP v2 format.
To receive data packets, the SNMP protocol adaptor uses a buffer whose
size can be configured using the property
bufferSize
(default value is 1024).
Packets which do not fit into the buffer are rejected.
Increasing bufferSize
allows the exchange of bigger packets.
However, the underlying networking system may impose a limit on the size
of UDP packets.
Packets bigger than this limit will be rejected, no matter what the value
of bufferSize
.
An SNMP protocol adaptor may serve several managers concurrently. The
number of concurrent managers can be limited using the property
maxActiveClientCount
.
The SNMP protocol adaptor specifies a default value (10) for the
maxActiveClientCount
property. When the adaptor is stopped,
the active requests are interrupted and an error result is sent to the
managers.
Field Summary |
---|
Fields inherited from class com.sun.jdmk.comm.CommunicatorServer |
---|
HTML_TYPE, HTTP_TYPE, HTTPS_TYPE, OFFLINE, ONLINE, RMI_TYPE, SNMP_TYPE, STARTING, STOPPING |
Constructor Summary | |
---|---|
SnmpAdaptorServer()
Initializes this SNMP protocol adaptor using the default port (161). |
|
SnmpAdaptorServer(boolean useAcl,
int port,
InetAddress addr)
Initializes this SNMP protocol adaptor using the specified port and the specified InetAddress . |
|
SnmpAdaptorServer(InetAddress addr)
Initializes this SNMP protocol adaptor using the default port (161) and the specified InetAddress . |
|
SnmpAdaptorServer(InetAddressAcl acl)
Initializes this SNMP protocol adaptor using the default port (161) and the specified IP address based ACL implementation. |
|
SnmpAdaptorServer(InetAddressAcl acl,
InetAddress addr)
Initializes this SNMP protocol adaptor using the specified IP address based ACL implementation and the specified InetAddress . |
|
SnmpAdaptorServer(InetAddressAcl acl,
int port)
Initializes this SNMP protocol adaptor using the specified port and the specified IP address based ACL implementation. |
|
SnmpAdaptorServer(InetAddressAcl acl,
int port,
InetAddress addr)
Initializes this SNMP protocol adaptor using the specified port, the specified address based ACL implementation and the specified InetAddress . |
|
SnmpAdaptorServer(int port)
Initializes this SNMP protocol adaptor using the specified port. |
|
SnmpAdaptorServer(int port,
InetAddress addr)
Initializes this SNMP protocol adaptor using the specified port and the specified InetAddress . |
Method Summary | |
---|---|
SnmpMibHandler |
addMib(SnmpMibAgent mib)
Adds a new MIB in the SNMP MIB handler. |
SnmpMibHandler |
addMib(SnmpMibAgent mib,
SnmpOid[] oids)
Adds a new MIB in the SNMP MIB handler. |
SnmpMibHandler |
addMib(SnmpMibAgent mib,
String contextName)
Adds a new MIB in the SNMP MIB handler. |
SnmpMibHandler |
addMib(SnmpMibAgent mib,
String contextName,
SnmpOid[] oids)
Adds a new MIB in the SNMP MIB handler. |
protected void |
doBind()
Creates the datagram socket. |
protected void |
doError(Exception e)
|
protected void |
doProcess()
Not used in this context. |
protected void |
doReceive()
Reads a packet from the datagram socket and creates a request handler which decodes and processes the request. |
protected void |
doUnbind()
Closes the datagram socket. |
protected void |
finalize()
Finalizer of the SNMP protocol adaptor objects. |
int |
getActiveClientCount()
Gets the number of managers currently being processed by this SNMP protocol adaptor. |
boolean |
getAuthRespEnabled()
Returns true if this SNMP protocol adaptor sends a
response in case of authentication failure. |
boolean |
getAuthTrapEnabled()
Returns true if authentication traps are enabled. |
Integer |
getBufferSize()
Returns the buffer size of this SNMP protocol adaptor. |
String |
getEnterpriseOid()
Returns the enterprise OID. |
String |
getHost()
Gets the host name used by this CommunicatorServer . |
InetAddressAcl |
getInetAddressAcl()
Returns the Ip address based ACL used by this SNMP protocol adaptor. |
int |
getInformPort()
Returns the port used by this SNMP protocol adaptor for sending inform requests. |
int |
getMaxActiveClientCount()
Gets the maximum number of managers that this SNMP protocol adaptor can process concurrently. |
int |
getMaxTries()
Gets the number of times to try sending an inform request before giving up. |
String[] |
getMibs()
Returns the names of the MIBs available in this SNMP protocol adaptor. |
SnmpPduFactory |
getPduFactory()
Returns the message factory of this SNMP protocol adaptor. |
int |
getPort()
Gets the port number used by this CommunicatorServer . |
String |
getProtocol()
Returns the protocol of this SNMP protocol adaptor. |
int |
getServedClientCount()
Gets the number of managers that have been processed by this SNMP protocol adaptor since its creation. |
Long |
getSnmpInASNParseErrs()
Returns the snmpInASNParseErrs value defined in MIB-II. |
Long |
getSnmpInBadCommunityNames()
Returns the snmpInBadCommunityNames value defined in
MIB-II. |
Long |
getSnmpInBadCommunityUses()
Returns the snmpInBadCommunityUses value defined in MIB-II. |
Long |
getSnmpInBadVersions()
Returns the snmpInBadVersions value defined in MIB-II. |
Long |
getSnmpInGetNexts()
Returns the snmpInGetNexts value defined in MIB-II. |
Long |
getSnmpInGetRequests()
Returns the snmpInGetRequests value defined in MIB-II. |
Long |
getSnmpInPkts()
Returns the snmpInPkts value defined in MIB-II. |
Long |
getSnmpInSetRequests()
Returns the snmpInSetRequests value defined in MIB-II. |
Long |
getSnmpInTotalReqVars()
Returns the snmpInTotalReqVars value defined in MIB-II. |
Long |
getSnmpInTotalSetVars()
Returns the snmpInTotalSetVars value defined in MIB-II. |
Long |
getSnmpOutBadValues()
Returns the snmpOutBadValues value defined in MIB-II. |
Long |
getSnmpOutGenErrs()
Returns the snmpOutGenErrs value defined in MIB-II. |
Long |
getSnmpOutGetResponses()
Returns the snmpOutGetResponses value defined in MIB-II. |
Long |
getSnmpOutNoSuchNames()
Returns the snmpOutNoSuchNames value defined in MIB-II. |
Long |
getSnmpOutPkts()
Returns the snmpOutPkts value defined in MIB-II. |
Long |
getSnmpOutTooBigs()
Returns the snmpOutTooBigs value defined in MIB-II. |
Long |
getSnmpOutTraps()
Returns the snmpOutTraps value defined in MIB-II. |
Long |
getSnmpProxyDrops()
Returns the snmpProxyDrops value defined in RFC
1907 NMPv2-MIB . |
Long |
getSnmpSilentDrops()
Returns the snmpSilentDrops value defined in RFC
1907 NMPv2-MIB . |
long |
getSysUpTime()
Returns the time (in hundredths of second) elapsed since the SNMP protocol adaptor startup. |
int |
getTimeout()
Gets the timeout to wait for an inform response from the manager. |
Integer |
getTrapPort()
Returns the port used by this SNMP protocol adaptor for sending traps. |
SnmpUserDataFactory |
getUserDataFactory()
Get the user-data factory associated with this SNMP protocol adaptor. |
static int |
mapErrorStatus(int errorStatus,
int protocolVersion,
int reqPduType)
Method that maps an SNMP error status in the passed protocolVersion according to the provided pdu type. |
void |
postDeregister()
Not used in this context. |
void |
postRegister(Boolean registrationDone)
Not used in this context. |
void |
preDeregister()
Not used in this context. |
ObjectName |
preRegister(MBeanServer server,
ObjectName name)
Allows the MBean to perform any operations it needs before being registered in the MBean server. |
boolean |
removeMib(SnmpMibAgent mib)
Removes the specified MIB from the SNMP protocol adaptor. |
boolean |
removeMib(SnmpMibAgent mib,
SnmpOid[] oids)
Removes the specified MIB from the SNMP protocol adaptor. |
boolean |
removeMib(SnmpMibAgent mib,
String contextName)
Removes the specified MIB from the SNMP protocol adaptor. |
boolean |
removeMib(SnmpMibAgent mib,
String contextName,
SnmpOid[] oids)
Removes the specified MIB from the SNMP protocol adaptor. |
void |
setAuthRespEnabled(boolean enabled)
Sets the flag indicating if responses need to be sent in case of authentication failure. |
void |
setAuthTrapEnabled(boolean enabled)
Sets the flag indicating if traps need to be sent in case of authentication failure. |
void |
setBufferSize(Integer s)
Sets the buffer size of this SNMP protocol adaptor. |
void |
setEnterpriseOid(String oid)
Sets the enterprise OID. |
void |
setInformPort(int port)
Sets the port used by this SNMP protocol adaptor for sending inform requests. |
void |
setMaxActiveClientCount(int c)
Sets the maximum number of managers this SNMP protocol adaptor can process concurrently. |
void |
setMaxTries(int newMaxTries)
Changes the maximum number of times to try sending an inform request before giving up. |
void |
setPduFactory(SnmpPduFactory factory)
Sets the message factory of this SNMP protocol adaptor. |
void |
setPort(int port)
Sets the port number used by this CommunicatorServer . |
void |
setTimeout(int newTimeout)
Changes the timeout to wait for an inform response from the manager. |
void |
setTrapPort(Integer port)
Sets the port used by this SNMP protocol adaptor for sending traps. |
void |
setUserDataFactory(SnmpUserDataFactory factory)
Set the user-data factory of this SNMP protocol adaptor. |
SnmpInformRequest |
snmpInformRequest(InetAddress addr,
String cs,
SnmpInformHandler cb,
SnmpOid trapOid,
SnmpVarBindList varBindList)
Sends an inform using SNMP V2 inform request format. |
Vector |
snmpInformRequest(SnmpInformHandler cb,
SnmpOid trapOid,
SnmpVarBindList varBindList)
Sends an inform using SNMP V2 inform request format. |
SnmpInformRequest |
snmpInformRequest(SnmpPeer peer,
SnmpInformHandler cb,
SnmpOid trapOid,
SnmpVarBindList varBindList)
Sends an inform using SNMP V2 inform request format. |
void |
snmpPduTrap(InetAddress address,
SnmpPduPacket pdu)
Send the specified trap PDU to the passed InetAddress . |
void |
snmpPduTrap(SnmpPeer peer,
SnmpPduPacket pdu)
Send the specified trap PDU to the passed SnmpPeer . |
void |
snmpV1Trap(InetAddress addr,
SnmpIpAddress agentAddr,
String cs,
SnmpOid enterpOid,
int generic,
int specific,
SnmpVarBindList varBindList,
SnmpTimeticks time)
Sends a trap using SNMP V1 trap format. |
void |
snmpV1Trap(InetAddress addr,
String cs,
int generic,
int specific,
SnmpVarBindList varBindList)
Sends a trap using SNMP V1 trap format. |
void |
snmpV1Trap(int generic,
int specific,
SnmpVarBindList varBindList)
Sends a trap using SNMP V1 trap format. |
void |
snmpV1Trap(SnmpPeer peer,
SnmpIpAddress agentAddr,
SnmpOid enterpOid,
int generic,
int specific,
SnmpVarBindList varBindList,
SnmpTimeticks time)
Sends a trap using SNMP V1 trap format. |
void |
snmpV2Trap(InetAddress addr,
String cs,
SnmpOid trapOid,
SnmpVarBindList varBindList)
Sends a trap using SNMP V2 trap format. |
void |
snmpV2Trap(InetAddress addr,
String cs,
SnmpOid trapOid,
SnmpVarBindList varBindList,
SnmpTimeticks time)
Sends a trap using SNMP V2 trap format. |
void |
snmpV2Trap(SnmpOid trapOid,
SnmpVarBindList varBindList)
Sends a trap using SNMP V2 trap format. |
void |
snmpV2Trap(SnmpPeer peer,
SnmpOid trapOid,
SnmpVarBindList varBindList,
SnmpTimeticks time)
Sends a trap using SNMP V2 trap format. |
void |
stop()
Stops this SNMP protocol adaptor. |
Methods inherited from class com.sun.management.comm.CommunicatorServer |
---|
addNotificationListener, getMBeanServer, getNotificationInfo, getState, getStateString, isActive, removeNotificationListener, run, setMBeanServer, start, waitState |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.sun.jdmk.comm.CommunicatorServerMBean |
---|
getState, getStateString, isActive, start, waitState |
Constructor Detail |
---|
public SnmpAdaptorServer()
JdmkAcl
default
implementation of the InetAddressAcl
interface.
public SnmpAdaptorServer(int port)
JdmkAcl
default
implementation of the InetAddressAcl
interface.
port
- The port number for sending SNMP responses.public SnmpAdaptorServer(InetAddressAcl acl)
acl
- The InetAddressAcl
implementation.public SnmpAdaptorServer(InetAddress addr)
InetAddress
.
Use the JdmkAcl
default implementation
of the InetAddressAcl
interface.
addr
- The IP address to bind.public SnmpAdaptorServer(InetAddressAcl acl, int port)
acl
- The InetAddressAcl
implementation.port
- The port number for sending SNMP responses.public SnmpAdaptorServer(int port, InetAddress addr)
InetAddress
.
Use the JdmkAcl
default implementation
of the InetAddressAcl
interface.
port
- The port number for sending SNMP responses.addr
- The IP address to bind.public SnmpAdaptorServer(InetAddressAcl acl, InetAddress addr)
InetAddress
.
acl
- The InetAddressAcl
implementation.addr
- The IP address to bind.public SnmpAdaptorServer(InetAddressAcl acl, int port, InetAddress addr)
InetAddress
.
acl
- The InetAddressAcl
implementation.port
- The port number for sending SNMP responses.addr
- The IP address to bind.public SnmpAdaptorServer(boolean useAcl, int port, InetAddress addr)
InetAddress
.
This constructor allows to initialize an SNMP adaptor without using
the ACL mechanism (by setting the useAcl
parameter to
false).
java.security.acl
package like pJava.
useAcl
- Specifies if this new SNMP adaptor uses the ACL mechanism.
If the specified parameter is set to true
, this
constructor is equivalent to
SnmpAdaptorServer(int port, InetAddress addr)
.port
- The port number for sending SNMP responses.addr
- The IP address to bind.Method Detail |
---|
public int getServedClientCount()
getServedClientCount
in interface SnmpAdaptorServerMBean
stop
method.public int getActiveClientCount()
getActiveClientCount
in interface SnmpAdaptorServerMBean
public int getMaxActiveClientCount()
getMaxActiveClientCount
in interface SnmpAdaptorServerMBean
public void setMaxActiveClientCount(int c) throws IllegalStateException
setMaxActiveClientCount
in interface SnmpAdaptorServerMBean
c
- The number of managers.
IllegalStateException
- This method has been invoked
while the communicator was ONLINE
or STARTING
.public InetAddressAcl getInetAddressAcl()
getInetAddressAcl
in interface SnmpAdaptorServerMBean
InetAddressAcl
implementation.public Integer getTrapPort()
getTrapPort
in interface SnmpAdaptorServerMBean
public void setTrapPort(Integer port)
setTrapPort
in interface SnmpAdaptorServerMBean
port
- The port number for sending SNMP traps.public int getInformPort()
getInformPort
in interface SnmpAdaptorServerMBean
public void setInformPort(int port)
setInformPort
in interface SnmpAdaptorServerMBean
port
- The port number for sending SNMP inform requests.public String getProtocol()
getProtocol
in interface CommunicatorServerMBean
getProtocol
in interface SnmpAdaptorServerMBean
getProtocol
in class CommunicatorServer
public Integer getBufferSize()
getBufferSize
in interface SnmpAdaptorServerMBean
public void setBufferSize(Integer s) throws IllegalStateException
setBufferSize
in interface SnmpAdaptorServerMBean
s
- The buffer size.
IllegalStateException
- This method has been invoked
while the communicator was ONLINE
or STARTING
.public final int getMaxTries()
getMaxTries
in interface SnmpAdaptorServerMBean
public final void setMaxTries(int newMaxTries)
setMaxTries
in interface SnmpAdaptorServerMBean
newMaxTries
- The maximum number of tries.public final int getTimeout()
getTimeout
in interface SnmpAdaptorServerMBean
public final void setTimeout(int newTimeout)
setTimeout
in interface SnmpAdaptorServerMBean
newTimeout
- The timeout (in milliseconds).public SnmpPduFactory getPduFactory()
getPduFactory
in interface SnmpAdaptorServerMBean
public void setPduFactory(SnmpPduFactory factory)
setPduFactory
in interface SnmpAdaptorServerMBean
factory
- The factory object (null means the default factory).public void setUserDataFactory(SnmpUserDataFactory factory)
setUserDataFactory
in interface SnmpAdaptorServerMBean
factory
- The factory object (null means no factory).SnmpUserDataFactory
public SnmpUserDataFactory getUserDataFactory()
getUserDataFactory
in interface SnmpAdaptorServerMBean
SnmpUserDataFactory
public boolean getAuthTrapEnabled()
true
if authentication traps are enabled.
When this feature is enabled, the SNMP protocol adaptor sends
an authenticationFailure
trap each time an authentication
fails.
The default behavior is to send authentication traps.
getAuthTrapEnabled
in interface SnmpAdaptorServerMBean
true
if authentication traps are enabled,
false
otherwise.public void setAuthTrapEnabled(boolean enabled)
setAuthTrapEnabled
in interface SnmpAdaptorServerMBean
enabled
- Flag indicating if traps need to be sent.public boolean getAuthRespEnabled()
true
if this SNMP protocol adaptor sends a
response in case of authentication failure.
When this feature is enabled, the SNMP protocol adaptor sends a
response with noSuchName
or readOnly
when
the authentication failed. If the flag is disabled, the SNMP protocol
adaptor trashes the PDU silently.
The default behavior is to send responses.
getAuthRespEnabled
in interface SnmpAdaptorServerMBean
true
if responses are sent.public void setAuthRespEnabled(boolean enabled)
setAuthRespEnabled
in interface SnmpAdaptorServerMBean
enabled
- Flag indicating if responses need to be sent.public String getEnterpriseOid()
snmpV1Trap
to fill the 'enterprise' field of
the trap request.
getEnterpriseOid
in interface SnmpAdaptorServerMBean
public void setEnterpriseOid(String oid) throws IllegalArgumentException
setEnterpriseOid
in interface SnmpAdaptorServerMBean
oid
- The OID in string format "x.x.x.x".
IllegalArgumentException
- The string format is incorrectpublic String[] getMibs()
getMibs
in interface SnmpAdaptorServerMBean
public Long getSnmpOutTraps()
snmpOutTraps
value defined in MIB-II.
getSnmpOutTraps
in interface SnmpAdaptorServerMBean
snmpOutTraps
value.public Long getSnmpOutGetResponses()
snmpOutGetResponses
value defined in MIB-II.
getSnmpOutGetResponses
in interface SnmpAdaptorServerMBean
snmpOutGetResponses
value.public Long getSnmpOutGenErrs()
snmpOutGenErrs
value defined in MIB-II.
getSnmpOutGenErrs
in interface SnmpAdaptorServerMBean
snmpOutGenErrs
value.public Long getSnmpOutBadValues()
snmpOutBadValues
value defined in MIB-II.
getSnmpOutBadValues
in interface SnmpAdaptorServerMBean
snmpOutBadValues
value.public Long getSnmpOutNoSuchNames()
snmpOutNoSuchNames
value defined in MIB-II.
getSnmpOutNoSuchNames
in interface SnmpAdaptorServerMBean
snmpOutNoSuchNames
value.public Long getSnmpOutTooBigs()
snmpOutTooBigs
value defined in MIB-II.
getSnmpOutTooBigs
in interface SnmpAdaptorServerMBean
snmpOutTooBigs
value.public Long getSnmpInASNParseErrs()
snmpInASNParseErrs
value defined in MIB-II.
getSnmpInASNParseErrs
in interface SnmpAdaptorServerMBean
snmpInASNParseErrs
value.public Long getSnmpInBadCommunityUses()
snmpInBadCommunityUses
value defined in MIB-II.
getSnmpInBadCommunityUses
in interface SnmpAdaptorServerMBean
snmpInBadCommunityUses
value.public Long getSnmpInBadCommunityNames()
snmpInBadCommunityNames
value defined in
MIB-II.
getSnmpInBadCommunityNames
in interface SnmpAdaptorServerMBean
snmpInBadCommunityNames
value.public Long getSnmpInBadVersions()
snmpInBadVersions
value defined in MIB-II.
getSnmpInBadVersions
in interface SnmpAdaptorServerMBean
snmpInBadVersions
value.public Long getSnmpOutPkts()
snmpOutPkts
value defined in MIB-II.
getSnmpOutPkts
in interface SnmpAdaptorServerMBean
snmpOutPkts
value.public Long getSnmpInPkts()
snmpInPkts
value defined in MIB-II.
getSnmpInPkts
in interface SnmpAdaptorServerMBean
snmpInPkts
value.public Long getSnmpInGetRequests()
snmpInGetRequests
value defined in MIB-II.
getSnmpInGetRequests
in interface SnmpAdaptorServerMBean
snmpInGetRequests
value.public Long getSnmpInGetNexts()
snmpInGetNexts
value defined in MIB-II.
getSnmpInGetNexts
in interface SnmpAdaptorServerMBean
snmpInGetNexts
value.public Long getSnmpInSetRequests()
snmpInSetRequests
value defined in MIB-II.
getSnmpInSetRequests
in interface SnmpAdaptorServerMBean
snmpInSetRequests
value.public Long getSnmpInTotalSetVars()
snmpInTotalSetVars
value defined in MIB-II.
getSnmpInTotalSetVars
in interface SnmpAdaptorServerMBean
snmpInTotalSetVars
value.public Long getSnmpInTotalReqVars()
snmpInTotalReqVars
value defined in MIB-II.
getSnmpInTotalReqVars
in interface SnmpAdaptorServerMBean
snmpInTotalReqVars
value.public Long getSnmpSilentDrops()
snmpSilentDrops
value defined in RFC
1907 NMPv2-MIB .
getSnmpSilentDrops
in interface SnmpAdaptorServerMBean
snmpSilentDrops
value.public Long getSnmpProxyDrops()
snmpProxyDrops
value defined in RFC
1907 NMPv2-MIB .
getSnmpProxyDrops
in interface SnmpAdaptorServerMBean
snmpProxyDrops
value.public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception
com.sun.jdmk.ServiceName.DOMAIN
:
com.sun.jdmk.ServiceName.SNMP_ADAPTOR_SERVER
.
If any exception is raised, the SNMP protocol adaptor MBean will not
be registered in the MBean server.
preRegister
in interface MBeanRegistration
preRegister
in class CommunicatorServer
server
- The MBean server to register the service with.name
- The object name.
Exception
public void postRegister(Boolean registrationDone)
postRegister
in interface MBeanRegistration
postRegister
in class CommunicatorServer
registrationDone
- Indicates whether or not the MBean has been
successfully registered in the MBeanServer
.
The value false means that the registration phase has failed.public void preDeregister() throws Exception
preDeregister
in interface MBeanRegistration
preDeregister
in class CommunicatorServer
Exception
- This exception should be caught by
the MBeanServer
and re-thrown
as an MBeanRegistrationException
.public void postDeregister()
postDeregister
in interface MBeanRegistration
postDeregister
in class CommunicatorServer
public SnmpMibHandler addMib(SnmpMibAgent mib) throws IllegalArgumentException
addMib
in interface SnmpAdaptorServerMBean
addMib
in interface SnmpMibHandler
mib
- The MIB to add.
IllegalArgumentException
- If the parameter is null.public SnmpMibHandler addMib(SnmpMibAgent mib, SnmpOid[] oids) throws IllegalArgumentException
addMib
in interface SnmpAdaptorServerMBean
addMib
in interface SnmpMibHandler
mib
- The MIB to add.oids
- The set of OIDs this agent implements.
If null or oids.length == 0, this is equivalent to calling
addMib(SnmpMibAgent mib)
IllegalArgumentException
- If the parameter is null.public SnmpMibHandler addMib(SnmpMibAgent mib, String contextName) throws IllegalArgumentException
addMib(SnmpMibAgent mib)
.
Note that MIB scoping is only supported by the SnmpV3AdaptorServer
. This class does not support it.
addMib
in interface SnmpAdaptorServerMBean
addMib
in interface SnmpMibHandler
mib
- The MIB to add.contextName
- The MIB context name.
The SnmpAdaptorServer base class always ignores this parameter.
IllegalArgumentException
- If the parameter is null.public SnmpMibHandler addMib(SnmpMibAgent mib, String contextName, SnmpOid[] oids) throws IllegalArgumentException
addMib(SnmpMibAgent mib, SnmpOid[] oids)
.
Note that MIB scoping is only supported by the SnmpV3AdaptorServer
. This class does not support it.
addMib
in interface SnmpMibHandler
mib
- The MIB to add.contextName
- The MIB context.
The SnmpAdaptorServer base class always ignores this parameter.oids
- The set of OIDs this agent implements.
If null or oids.length == 0, this is equivalent to calling
addMib(SnmpMibAgent mib, String contextName)
IllegalArgumentException
- If the parameter is null.public boolean removeMib(SnmpMibAgent mib, String contextName)
removeMib(SnmpMibAgent mib)
.
Note that MIB scoping is only supported by the SnmpV3AdaptorServer
. This class does not support it.
removeMib
in interface SnmpMibHandler
mib
- The MIB to be removed.contextName
- The context name used at registration time.
The SnmpAdaptorServer base class always ignores this parameter.
true
if the specified mib
was
a MIB included in the SNMP MIB handler, false
otherwise.public boolean removeMib(SnmpMibAgent mib)
removeMib
in interface SnmpAdaptorServerMBean
removeMib
in interface SnmpMibHandler
mib
- The MIB to be removed.
true
if the specified mib
was a MIB included in the SNMP MIB handler,
false
otherwise.public boolean removeMib(SnmpMibAgent mib, SnmpOid[] oids)
removeMib
in interface SnmpMibHandler
mib
- The MIB to be removed.oids
- The oid the MIB was previously registered for.
If null or oids.length == 0, this is equivalent to calling
removeMib(SnmpMibAgent mib)
true
if the specified mib
was
a MIB included in the SNMP MIB handler, false
otherwise.public boolean removeMib(SnmpMibAgent mib, String contextName, SnmpOid[] oids)
removeMib(SnmpMibAgent mib, SnmpOid[] oids)
.
Note that MIB scoping is only supported by the SnmpV3AdaptorServer
. This class does not support it.
removeMib
in interface SnmpMibHandler
mib
- The MIB to be removed.contextName
- The context name used at registration time.
The SnmpAdaptorServer base class always ignores this parameter.oids
- The oid the MIB was previously registered for.
true
if the specified mib
was
a MIB included in the SNMP MIB handler, false
otherwise.public void setPort(int port) throws IllegalStateException
CommunicatorServer
.
setPort
in interface CommunicatorServerMBean
setPort
in class CommunicatorServer
port
- The port number used by this CommunicatorServer
.
IllegalStateException
- This method has been invoked
while the communicator was ONLINE or STARTING.protected void doBind() throws CommunicationException, InterruptedException
doBind
in class CommunicatorServer
CommunicationException
InterruptedException
protected void doUnbind() throws CommunicationException, InterruptedException
doUnbind
in class CommunicatorServer
CommunicationException
InterruptedException
protected void doReceive() throws CommunicationException, InterruptedException
doReceive
in class CommunicatorServer
CommunicationException
InterruptedException
protected void doError(Exception e) throws CommunicationException
doError
in class CommunicatorServer
CommunicationException
protected void doProcess() throws CommunicationException, InterruptedException
doProcess
in class CommunicatorServer
CommunicationException
InterruptedException
public void stop()
Has no effect if this SNMP protocol adaptor is OFFLINE
or
STOPPING
.
stop
in interface CommunicatorServerMBean
stop
in class CommunicatorServer
public void snmpV1Trap(int generic, int specific, SnmpVarBindList varBindList) throws IOException, SnmpStatusException
snmpV1Trap
in interface SnmpAdaptorServerMBean
generic
- The generic number of the trap.specific
- The specific number of the trap.varBindList
- A list of SnmpVarBind
instances or null.
IOException
- An I/O error occurred while sending the trap.
SnmpStatusException
- If the trap exceeds the limit defined
by bufferSize
.public void snmpV1Trap(InetAddress addr, String cs, int generic, int specific, SnmpVarBindList varBindList) throws IOException, SnmpStatusException
InetAddress
destination using the specified community string (and the ACL file
is not used).
snmpV1Trap
in interface SnmpAdaptorServerMBean
addr
- The InetAddress
destination of the trap.cs
- The community string to be used for the trap.generic
- The generic number of the trap.specific
- The specific number of the trap.varBindList
- A list of SnmpVarBind
instances or null.
IOException
- An I/O error occurred while sending the trap.
SnmpStatusException
- If the trap exceeds the limit defined
by bufferSize
.public void snmpV1Trap(InetAddress addr, SnmpIpAddress agentAddr, String cs, SnmpOid enterpOid, int generic, int specific, SnmpVarBindList varBindList, SnmpTimeticks time) throws IOException, SnmpStatusException
InetAddress
destination using the specified parameters (and the ACL file is not
used).
Note that if the specified InetAddress
destination is null,
then the ACL file mechanism is used.
addr
- The InetAddress
destination of the trap.agentAddr
- The agent address to be used for the trap.cs
- The community string to be used for the trap.enterpOid
- The enterprise OID to be used for the trap.generic
- The generic number of the trap.specific
- The specific number of the trap.varBindList
- A list of SnmpVarBind
instances or null.time
- The time stamp (overwrite the current time).
IOException
- An I/O error occurred while sending the trap.
SnmpStatusException
- If the trap exceeds the limit defined
by bufferSize
.public void snmpV1Trap(SnmpPeer peer, SnmpIpAddress agentAddr, SnmpOid enterpOid, int generic, int specific, SnmpVarBindList varBindList, SnmpTimeticks time) throws IOException, SnmpStatusException
SnmpPeer
destination.
The community string used is the one located in the
SnmpPeer
parameters
(SnmpParameters.getRdCommunity()
).
snmpV1Trap
in interface SnmpAdaptorServerMBean
peer
- The SnmpPeer
destination of the trap.agentAddr
- The agent address to be used for the trap.enterpOid
- The enterprise OID to be used for the trap.generic
- The generic number of the trap.specific
- The specific number of the trap.varBindList
- A list of SnmpVarBind
instances or null.time
- The time stamp (overwrite the current time).
IOException
- An I/O error occurred while sending the trap.
SnmpStatusException
- If the trap exceeds the limit
defined by bufferSize
.public void snmpV2Trap(SnmpPeer peer, SnmpOid trapOid, SnmpVarBindList varBindList, SnmpTimeticks time) throws IOException, SnmpStatusException
SnmpPeer
destination.
SnmpPeer
parameters
(SnmpParameters.getRdCommunity()
).
sysUpTime.0
with the value specified by
time
snmpTrapOid.0
with the value specified by
trapOid
all the (oid,values)
from the specified
varBindList
snmpV2Trap
in interface SnmpAdaptorServerMBean
peer
- The SnmpPeer
destination of the trap.trapOid
- The OID identifying the trap.varBindList
- A list of SnmpVarBind
instances or null.time
- The time stamp (overwrite the current time).
IOException
- An I/O error occurred while sending the trap.
SnmpStatusException
- If the trap exceeds the limit
defined by bufferSize
.public void snmpV2Trap(SnmpOid trapOid, SnmpVarBindList varBindList) throws IOException, SnmpStatusException
sysUpTime.0
with its current valuesnmpTrapOid.0
with the value specified by
trapOid
all the (oid,values)
from the specified
varBindList
snmpV2Trap
in interface SnmpAdaptorServerMBean
trapOid
- The OID identifying the trap.varBindList
- A list of SnmpVarBind
instances or null.
IOException
- An I/O error occurred while sending the trap.
SnmpStatusException
- If the trap exceeds the limit defined
by bufferSize
.public void snmpV2Trap(InetAddress addr, String cs, SnmpOid trapOid, SnmpVarBindList varBindList) throws IOException, SnmpStatusException
InetAddress
destination using the specified community string (and the ACL file is
not used).
sysUpTime.0
with its current valuesnmpTrapOid.0
with the value specified by
trapOid
all the (oid,values)
from the specified
varBindList
snmpV2Trap
in interface SnmpAdaptorServerMBean
addr
- The InetAddress
destination of the trap.cs
- The community string to be used for the trap.trapOid
- The OID identifying the trap.varBindList
- A list of SnmpVarBind
instances or null.
IOException
- An I/O error occurred while sending the trap.
SnmpStatusException
- If the trap exceeds the limit defined
by bufferSize
.public void snmpV2Trap(InetAddress addr, String cs, SnmpOid trapOid, SnmpVarBindList varBindList, SnmpTimeticks time) throws IOException, SnmpStatusException
InetAddress
destination using the specified parameters (and the ACL file is
not used).
Note that if the specified InetAddress
destination is null,
then the ACL file mechanism is used.
sysUpTime.0
with the value specified by
time
snmpTrapOid.0
with the value specified by
trapOid
all the (oid,values)
from the specified
varBindList
addr
- The InetAddress
destination of the trap.cs
- The community string to be used for the trap.trapOid
- The OID identifying the trap.varBindList
- A list of SnmpVarBind
instances or null.time
- The time stamp (overwrite the current time).
IOException
- An I/O error occurred while sending the trap.
SnmpStatusException
- If the trap exceeds the limit
defined by bufferSize
.public void snmpPduTrap(InetAddress address, SnmpPduPacket pdu) throws IOException, SnmpStatusException
InetAddress
.
snmpPduTrap
in interface SnmpAdaptorServerMBean
address
- The destination address.pdu
- The pdu to send.
IOException
- An I/O error occurred while sending the trap.
SnmpStatusException
- If the trap exceeds the limit
defined by bufferSize
.public void snmpPduTrap(SnmpPeer peer, SnmpPduPacket pdu) throws IOException, SnmpStatusException
SnmpPeer
.
snmpPduTrap
in interface SnmpAdaptorServerMBean
peer
- The destination peer. The Read community string is used of
SnmpParameters
is used as the trap community string.pdu
- The pdu to send.
IOException
- An I/O error occurred while sending the trap.
SnmpStatusException
- If the trap exceeds the limit defined
by bufferSize
.public Vector snmpInformRequest(SnmpInformHandler cb, SnmpOid trapOid, SnmpVarBindList varBindList) throws IllegalStateException, IOException, SnmpStatusException
sysUpTime.0
with its current valuesnmpTrapOid.0
with the value specified by
trapOid
all the (oid,values)
from the specified
varBindList
snmpInformRequest
in interface SnmpAdaptorServerMBean
cb
- The callback that is invoked when a request is complete.trapOid
- The OID identifying the trap.varBindList
- A list of SnmpVarBind
instances or null.
SnmpInformRequest
objects.
If there is no destination host for this inform request, the returned vector will be empty.
IllegalStateException
- This method has been invoked while
the SNMP adaptor server was not active.
IOException
- An I/O error occurred while sending the inform
request.
SnmpStatusException
- If the inform request exceeds the limit
defined by bufferSize
.public SnmpInformRequest snmpInformRequest(InetAddress addr, String cs, SnmpInformHandler cb, SnmpOid trapOid, SnmpVarBindList varBindList) throws IllegalStateException, IOException, SnmpStatusException
InetAddress
destination using the specified community string.
sysUpTime.0
with its current valuesnmpTrapOid.0
with the value specified by
trapOid
all the (oid,values)
from the specified
varBindList
snmpInformRequest
in interface SnmpAdaptorServerMBean
addr
- The InetAddress
destination for this inform
request.cs
- The community string to be used for the inform request.cb
- The callback that is invoked when a request is complete.trapOid
- The OID identifying the trap.varBindList
- A list of SnmpVarBind
instances or null.
IllegalStateException
- This method has been invoked while
the SNMP adaptor server was not active.
IOException
- An I/O error occurred while sending the
inform request.
SnmpStatusException
- If the inform request exceeds the
limit defined by bufferSize
.public SnmpInformRequest snmpInformRequest(SnmpPeer peer, SnmpInformHandler cb, SnmpOid trapOid, SnmpVarBindList varBindList) throws IllegalStateException, IOException, SnmpStatusException
SnmpPeer
destination.
SnmpPeer
parameters
(SnmpParameters.getInformCommunity()
).
sysUpTime.0
with its current valuesnmpTrapOid.0
with the value specified by
trapOid
all the (oid,values)
from the specified
varBindList
snmpInformRequest
in interface SnmpAdaptorServerMBean
peer
- The SnmpPeer
destination for this inform
request.cb
- The callback that is invoked when a request is complete.trapOid
- The OID identifying the trap.varBindList
- A list of SnmpVarBind
instances or null.
IllegalStateException
- This method has been invoked while
the SNMP adaptor server was not active.
IOException
- An I/O error occurred while sending the
inform request.
SnmpStatusException
- If the inform request exceeds the
limit defined by bufferSize
.public static final int mapErrorStatus(int errorStatus, int protocolVersion, int reqPduType)
errorStatus
- The error status to convert.protocolVersion
- The protocol version.reqPduType
- The pdu type.public String getHost()
CommunicatorServer
CommunicatorServer
.
getHost
in interface CommunicatorServerMBean
getHost
in class CommunicatorServer
CommunicatorServer
.public int getPort()
CommunicatorServer
CommunicatorServer
.
getPort
in interface CommunicatorServerMBean
getPort
in class CommunicatorServer
CommunicatorServer
.protected void finalize()
Closes the datagram socket associated to this SNMP protocol adaptor.
finalize
in class Object
public long getSysUpTime()
|
Open Source build 02 opendmk-1.0-b02 2007.10.01_19:17:46_MEST |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |