public class AgentXSubagent extends Object implements AgentXCommandListener, NotificationOriginator
AgentXSubagent
class implements the AgentX communication
for an AgentX subagent implementation.Modifier and Type | Field and Description |
---|---|
protected int |
nextTransactionID |
protected Map<Address,AgentXPeer> |
peers |
protected RequestHandler<AgentXRequest> |
requestHandlerCleanupSet |
protected RequestHandler<AgentXRequest> |
requestHandlerCommitSet |
protected RequestHandler<AgentXRequest> |
requestHandlerGet |
protected RequestHandler<AgentXRequest> |
requestHandlerGetBulk |
protected RequestHandler<AgentXRequest> |
requestHandlerGetNext |
protected RequestHandler<AgentXRequest> |
requestHandlerTestSet |
protected RequestHandler<AgentXRequest> |
requestHandlerUndoSet |
protected Map<org.snmp4j.agent.agentx.subagent.AgentXSubagent.RequestID,AgentXRequest> |
requestList |
protected Map<Integer,AgentXSession> |
sessions |
protected Map<String,AgentXSharedMOTableSupport> |
sharedMOTableSupport |
Constructor and Description |
---|
AgentXSubagent(AgentX agentX,
OID subagentID,
OctetString subagentDescr) |
Modifier and Type | Method and Description |
---|---|
int |
addAgentCaps(AgentXSession session,
OctetString context,
OID id,
OctetString descr) |
protected TransportMapping |
addMaster(Address localAddress) |
void |
addMOServer(MOServer server) |
void |
addPingListener(PingListener l) |
int |
close(AgentXSession session,
byte reason) |
protected int |
closeSession(int sessionID,
byte reason) |
int |
connect(Address masterAddress,
Address localAddress,
AgentXSession session) |
protected AgentXSharedMOTableSupport |
createSharedTableSupport(AgentXSession session,
OctetString context)
Create a new
AgentXSharedMOTableSupport instance for the given AgentX session and context. |
void |
disconnect(Address masterAddress) |
void |
dispatchCommand(AgentXCommandEvent cmd) |
protected void |
firePinged(PingEvent event) |
AgentXSession |
firstSession()
Returns the first session that have been opened by this subagent and is
still open.
|
Collection<OctetString> |
getContexts() |
byte |
getDefaultPriority() |
protected int |
getNextTransactionID() |
protected byte |
getPriority(ManagedObject mo,
AgentXRegion region)
Gets the priority with which the supplied managed object and
region should be registered at the master agent.
|
MOServer |
getServer(OctetString context) |
WorkerPool |
getWorkerPool() |
AgentXResponseEvent |
notify(AgentXSession session,
OctetString context,
OID notificationID,
TimeTicks sysUpTime,
VariableBinding[] vbs) |
Object |
notify(OctetString context,
OID notificationID,
TimeTicks sysUpTime,
VariableBinding[] vbs) |
Object |
notify(OctetString context,
OID notificationID,
VariableBinding[] vbs)
Sends notifications (traps) to all appropriate notification targets
through the master agent.
|
protected int |
openSession(TransportMapping transport,
Address masterAddress,
AgentXSession session) |
void |
processCommand(AgentXCommandEvent event) |
protected void |
processNextSubRequest(Request request,
MOServer server,
OctetString context,
SubRequest sreq) |
protected void |
processResponse(AgentXCommandEvent cmd) |
protected int |
registerRegion(AgentXSession session,
OctetString context,
AgentXRegion region,
byte priority,
TimeTicks sysUpTime) |
void |
registerRegions(AgentXSession session,
OctetString context,
TimeTicks sysUpTime,
RegistrationCallback registrationCallback)
Registers the subagent regions at the master agent.
|
void |
registerSharedTableRows(AgentXSession session,
OctetString context,
AgentXSharedMOTable mo,
RegistrationCallback registrationCallback)
Deprecated.
Use
registerSharedTableRows(org.snmp4j.agent.agentx.AgentXSession, org.snmp4j.smi.OctetString,
AgentXSharedMOTable, RegistrationCallback, AgentXSharedMOTableSupport) instead. This version creates
a new table support object for each call (shared table) which is not recommended. |
void |
registerSharedTableRows(AgentXSession session,
OctetString context,
AgentXSharedMOTable mo,
RegistrationCallback registrationCallback,
AgentXSharedMOTableSupport sharedTableSupport)
Registers the indexes and (row) regions of a shared table.
|
protected void |
release(MOServer server,
AgentXRequest req) |
int |
removeAgentCaps(AgentXSession session,
OctetString context,
OID id) |
protected void |
removeMaster(TransportMapping transport) |
void |
removeMOServer(MOServer server) |
void |
removePingListener(PingListener l) |
protected void |
sendResponse(AgentXCommandEvent cmd,
AgentXRequest request) |
void |
setDefaultPriority(byte priority) |
void |
setPingDelay(int seconds)
Sets the ping delay in seconds.
|
void |
setThreadPool(ThreadPool threadPool) |
protected int |
unregisterRegion(AgentXSession session,
OctetString context,
AgentXRegion region,
byte timeout) |
protected Map<org.snmp4j.agent.agentx.subagent.AgentXSubagent.RequestID,AgentXRequest> requestList
protected Map<Address,AgentXPeer> peers
protected Map<Integer,AgentXSession> sessions
protected RequestHandler<AgentXRequest> requestHandlerGet
protected RequestHandler<AgentXRequest> requestHandlerGetNext
protected RequestHandler<AgentXRequest> requestHandlerGetBulk
protected RequestHandler<AgentXRequest> requestHandlerTestSet
protected RequestHandler<AgentXRequest> requestHandlerCommitSet
protected RequestHandler<AgentXRequest> requestHandlerUndoSet
protected RequestHandler<AgentXRequest> requestHandlerCleanupSet
protected int nextTransactionID
protected Map<String,AgentXSharedMOTableSupport> sharedMOTableSupport
public AgentXSubagent(AgentX agentX, OID subagentID, OctetString subagentDescr)
public void setPingDelay(int seconds)
PingListener
with addPingListener(org.snmp4j.agent.agentx.event.PingListener)
.seconds
- the delay. If zero or a negative value is supplied, no pings are sentpublic void processCommand(AgentXCommandEvent event)
processCommand
in interface AgentXCommandListener
protected int getNextTransactionID()
protected int closeSession(int sessionID, byte reason) throws IOException
IOException
protected int openSession(TransportMapping transport, Address masterAddress, AgentXSession session) throws IOException
IOException
public void disconnect(Address masterAddress) throws IOException
IOException
public int connect(Address masterAddress, Address localAddress, AgentXSession session) throws IOException
IOException
public int close(AgentXSession session, byte reason) throws IOException
IOException
public void setDefaultPriority(byte priority)
public byte getDefaultPriority()
protected byte getPriority(ManagedObject mo, AgentXRegion region)
getDefaultPriority()
.mo
- ManagedObject
a managed object instance that manages region
.region
- the region to be registered.public void registerRegions(AgentXSession session, OctetString context, TimeTicks sysUpTime, RegistrationCallback registrationCallback)
AgentXSharedMOTableSupport
instances of AgentXSharedMutableMOTable
instances. For any other instances a support object instance will
be created for each session and context.session
- the session on whose behalf regions are registered.context
- the context to use for registration.sysUpTime
- if not null
, the master agent's notion of the sysUpTime
for the registered context is returned. The input value is always
ignored!registrationCallback
- a possibly null
reference to a
RegistrationCallback
instance to handle registration
events.protected AgentXSharedMOTableSupport createSharedTableSupport(AgentXSession session, OctetString context)
AgentXSharedMOTableSupport
instance for the given AgentX session and context.session
- an AgentXSession instance.context
- a AgentX context.public void registerSharedTableRows(AgentXSession session, OctetString context, AgentXSharedMOTable mo, RegistrationCallback registrationCallback)
registerSharedTableRows(org.snmp4j.agent.agentx.AgentXSession, org.snmp4j.smi.OctetString,
AgentXSharedMOTable, RegistrationCallback, AgentXSharedMOTableSupport)
instead. This version creates
a new table support object for each call (shared table) which is not recommended.registerRegions(org.snmp4j.agent.agentx.AgentXSession,
org.snmp4j.smi.OctetString, org.snmp4j.smi.TimeTicks, RegistrationCallback)
.session
- the session on whose behalf regions are registered.context
- the context to use for registration.mo
- the AgentXSharedMOTable
instance to register.registrationCallback
- if not null
the callback is informed when registration
of a row succeeded or failed.public void registerSharedTableRows(AgentXSession session, OctetString context, AgentXSharedMOTable mo, RegistrationCallback registrationCallback, AgentXSharedMOTableSupport sharedTableSupport)
registerRegions(org.snmp4j.agent.agentx.AgentXSession,
org.snmp4j.smi.OctetString, org.snmp4j.smi.TimeTicks, RegistrationCallback)
.session
- the session on whose behalf regions are registered.context
- the context to use for registration.mo
- the AgentXSharedMOTable
instance to register.registrationCallback
- if not null
the callback is informed when registration
of a row succeeded or failed.sharedTableSupport
- the shared table support to be used for row registration. If mo
has
no table support instance and is a AgentXSharedMutableMOTable
then its
sharedTableSupport will be set to sharedTableSupport
.protected int registerRegion(AgentXSession session, OctetString context, AgentXRegion region, byte priority, TimeTicks sysUpTime) throws IOException
IOException
protected int unregisterRegion(AgentXSession session, OctetString context, AgentXRegion region, byte timeout) throws IOException
IOException
protected TransportMapping addMaster(Address localAddress) throws IOException
IOException
protected void removeMaster(TransportMapping transport)
public void addMOServer(MOServer server)
public void removeMOServer(MOServer server)
public MOServer getServer(OctetString context)
public Collection<OctetString> getContexts()
public WorkerPool getWorkerPool()
public void setThreadPool(ThreadPool threadPool)
public void dispatchCommand(AgentXCommandEvent cmd)
protected void sendResponse(AgentXCommandEvent cmd, AgentXRequest request)
protected void release(MOServer server, AgentXRequest req)
protected void processResponse(AgentXCommandEvent cmd)
protected void processNextSubRequest(Request request, MOServer server, OctetString context, SubRequest sreq) throws NoSuchElementException
NoSuchElementException
public Object notify(OctetString context, OID notificationID, VariableBinding[] vbs)
notify
in interface NotificationOriginator
context
- the context name of the context on whose behalf this
notification has been generated.notificationID
- the object ID that uniquely identifies this
notification. For SNMPv1 traps, the notification ID has to be build
using the rules provided by RFC 2576.vbs
- an array of VariableBinding
instances
representing the payload of the notification.AgentXResponseEvent
instance or null
if the
notification request timed out.public Object notify(OctetString context, OID notificationID, TimeTicks sysUpTime, VariableBinding[] vbs)
notify
in interface NotificationOriginator
public final AgentXSession firstSession()
null
is returned.AgentXSession
.public AgentXResponseEvent notify(AgentXSession session, OctetString context, OID notificationID, TimeTicks sysUpTime, VariableBinding[] vbs) throws IOException
IOException
public int addAgentCaps(AgentXSession session, OctetString context, OID id, OctetString descr)
public int removeAgentCaps(AgentXSession session, OctetString context, OID id)
public void addPingListener(PingListener l)
public void removePingListener(PingListener l)
protected void firePinged(PingEvent event)
Copyright © 2016 SNMP4J.org. All rights reserved.