public class AgentXSubagent extends Object implements AgentXCommandListener, org.snmp4j.agent.NotificationOriginator
AgentXSubagent class implements the AgentX communication
for an AgentX subagent implementation.| Modifier and Type | Field and Description |
|---|---|
protected int |
nextTransactionID |
protected Map<org.snmp4j.smi.Address,AgentXPeer> |
peers |
protected org.snmp4j.agent.RequestHandler |
requestHandlerCleanupSet |
protected org.snmp4j.agent.RequestHandler |
requestHandlerCommitSet |
protected org.snmp4j.agent.RequestHandler |
requestHandlerGet |
protected org.snmp4j.agent.RequestHandler |
requestHandlerGetBulk |
protected org.snmp4j.agent.RequestHandler |
requestHandlerGetNext |
protected org.snmp4j.agent.RequestHandler |
requestHandlerTestSet |
protected org.snmp4j.agent.RequestHandler |
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,
org.snmp4j.smi.OID subagentID,
org.snmp4j.smi.OctetString subagentDescr) |
| Modifier and Type | Method and Description |
|---|---|
int |
addAgentCaps(AgentXSession session,
org.snmp4j.smi.OctetString context,
org.snmp4j.smi.OID id,
org.snmp4j.smi.OctetString descr) |
protected org.snmp4j.TransportMapping |
addMaster(org.snmp4j.smi.Address localAddress) |
void |
addMOServer(org.snmp4j.agent.MOServer server) |
void |
addPingListener(PingListener l) |
int |
close(AgentXSession session,
byte reason) |
protected int |
closeSession(int sessionID,
byte reason) |
int |
connect(org.snmp4j.smi.Address masterAddress,
org.snmp4j.smi.Address localAddress,
AgentXSession session) |
protected AgentXSharedMOTableSupport |
createSharedTableSupport(AgentXSession session,
org.snmp4j.smi.OctetString context)
Create a new
AgentXSharedMOTableSupport instance for the given AgentX session and context. |
void |
disconnect(org.snmp4j.smi.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<org.snmp4j.smi.OctetString> |
getContexts() |
byte |
getDefaultPriority() |
protected int |
getNextTransactionID() |
protected byte |
getPriority(org.snmp4j.agent.ManagedObject mo,
AgentXRegion region)
Gets the priority with which the supplied managed object and
region should be registered at the master agent.
|
org.snmp4j.agent.MOServer |
getServer(org.snmp4j.smi.OctetString context) |
org.snmp4j.util.WorkerPool |
getWorkerPool() |
AgentXResponseEvent |
notify(AgentXSession session,
org.snmp4j.smi.OctetString context,
org.snmp4j.smi.OID notificationID,
org.snmp4j.smi.TimeTicks sysUpTime,
org.snmp4j.smi.VariableBinding[] vbs) |
Object |
notify(org.snmp4j.smi.OctetString context,
org.snmp4j.smi.OID notificationID,
org.snmp4j.smi.TimeTicks sysUpTime,
org.snmp4j.smi.VariableBinding[] vbs) |
Object |
notify(org.snmp4j.smi.OctetString context,
org.snmp4j.smi.OID notificationID,
org.snmp4j.smi.VariableBinding[] vbs)
Sends notifications (traps) to all appropriate notification targets
through the master agent.
|
protected int |
openSession(org.snmp4j.TransportMapping transport,
org.snmp4j.smi.Address masterAddress,
AgentXSession session) |
void |
processCommand(AgentXCommandEvent event) |
protected void |
processNextSubRequest(org.snmp4j.agent.request.Request request,
org.snmp4j.agent.MOServer server,
org.snmp4j.smi.OctetString context,
org.snmp4j.agent.request.SubRequest sreq) |
protected void |
processResponse(AgentXCommandEvent cmd) |
protected int |
registerRegion(AgentXSession session,
org.snmp4j.smi.OctetString context,
AgentXRegion region,
byte priority,
org.snmp4j.smi.TimeTicks sysUpTime) |
void |
registerRegions(AgentXSession session,
org.snmp4j.smi.OctetString context,
org.snmp4j.smi.TimeTicks sysUpTime,
RegistrationCallback registrationCallback)
Registers the subagent regions at the master agent.
|
void |
registerSharedTableRows(AgentXSession session,
org.snmp4j.smi.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,
org.snmp4j.smi.OctetString context,
AgentXSharedMOTable mo,
RegistrationCallback registrationCallback,
AgentXSharedMOTableSupport sharedTableSupport)
Registers the indexes and (row) regions of a shared table.
|
protected void |
release(org.snmp4j.agent.MOServer server,
org.snmp4j.agent.request.Request<AgentXCommandEvent,AgentXResponsePDU> req) |
int |
removeAgentCaps(AgentXSession session,
org.snmp4j.smi.OctetString context,
org.snmp4j.smi.OID id) |
protected void |
removeMaster(org.snmp4j.TransportMapping transport) |
void |
removeMOServer(org.snmp4j.agent.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(org.snmp4j.util.ThreadPool threadPool) |
protected int |
unregisterRegion(AgentXSession session,
org.snmp4j.smi.OctetString context,
AgentXRegion region,
byte timeout) |
protected Map<org.snmp4j.agent.agentx.subagent.AgentXSubagent.RequestID,AgentXRequest> requestList
protected Map<org.snmp4j.smi.Address,AgentXPeer> peers
protected Map<Integer,AgentXSession> sessions
protected org.snmp4j.agent.RequestHandler requestHandlerGet
protected org.snmp4j.agent.RequestHandler requestHandlerGetNext
protected org.snmp4j.agent.RequestHandler requestHandlerGetBulk
protected org.snmp4j.agent.RequestHandler requestHandlerTestSet
protected org.snmp4j.agent.RequestHandler requestHandlerCommitSet
protected org.snmp4j.agent.RequestHandler requestHandlerUndoSet
protected org.snmp4j.agent.RequestHandler requestHandlerCleanupSet
protected int nextTransactionID
protected Map<String,AgentXSharedMOTableSupport> sharedMOTableSupport
public AgentXSubagent(AgentX agentX, org.snmp4j.smi.OID subagentID, org.snmp4j.smi.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 AgentXCommandListenerprotected int getNextTransactionID()
protected int closeSession(int sessionID,
byte reason)
throws IOException
IOExceptionprotected int openSession(org.snmp4j.TransportMapping transport,
org.snmp4j.smi.Address masterAddress,
AgentXSession session)
throws IOException
IOExceptionpublic void disconnect(org.snmp4j.smi.Address masterAddress)
throws IOException
IOExceptionpublic int connect(org.snmp4j.smi.Address masterAddress,
org.snmp4j.smi.Address localAddress,
AgentXSession session)
throws IOException
IOExceptionpublic int close(AgentXSession session, byte reason) throws IOException
IOExceptionpublic void setDefaultPriority(byte priority)
public byte getDefaultPriority()
protected byte getPriority(org.snmp4j.agent.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, org.snmp4j.smi.OctetString context, org.snmp4j.smi.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, org.snmp4j.smi.OctetString context)
AgentXSharedMOTableSupport instance for the given AgentX session and context.session - an AgentXSession instance.context - a AgentX context.public void registerSharedTableRows(AgentXSession session, org.snmp4j.smi.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, org.snmp4j.smi.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, org.snmp4j.smi.OctetString context, AgentXRegion region, byte priority, org.snmp4j.smi.TimeTicks sysUpTime) throws IOException
IOExceptionprotected int unregisterRegion(AgentXSession session, org.snmp4j.smi.OctetString context, AgentXRegion region, byte timeout) throws IOException
IOExceptionprotected org.snmp4j.TransportMapping addMaster(org.snmp4j.smi.Address localAddress)
throws IOException
IOExceptionprotected void removeMaster(org.snmp4j.TransportMapping transport)
public void addMOServer(org.snmp4j.agent.MOServer server)
public void removeMOServer(org.snmp4j.agent.MOServer server)
public org.snmp4j.agent.MOServer getServer(org.snmp4j.smi.OctetString context)
public Collection<org.snmp4j.smi.OctetString> getContexts()
public org.snmp4j.util.WorkerPool getWorkerPool()
public void setThreadPool(org.snmp4j.util.ThreadPool threadPool)
public void dispatchCommand(AgentXCommandEvent cmd)
protected void sendResponse(AgentXCommandEvent cmd, AgentXRequest request)
protected void release(org.snmp4j.agent.MOServer server,
org.snmp4j.agent.request.Request<AgentXCommandEvent,AgentXResponsePDU> req)
protected void processResponse(AgentXCommandEvent cmd)
protected void processNextSubRequest(org.snmp4j.agent.request.Request request,
org.snmp4j.agent.MOServer server,
org.snmp4j.smi.OctetString context,
org.snmp4j.agent.request.SubRequest sreq)
throws NoSuchElementException
NoSuchElementExceptionpublic Object notify(org.snmp4j.smi.OctetString context, org.snmp4j.smi.OID notificationID, org.snmp4j.smi.VariableBinding[] vbs)
notify in interface org.snmp4j.agent.NotificationOriginatorcontext - 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(org.snmp4j.smi.OctetString context, org.snmp4j.smi.OID notificationID, org.snmp4j.smi.TimeTicks sysUpTime, org.snmp4j.smi.VariableBinding[] vbs)
notify in interface org.snmp4j.agent.NotificationOriginatorpublic final AgentXSession firstSession()
null is returned.AgentXSession.public AgentXResponseEvent notify(AgentXSession session, org.snmp4j.smi.OctetString context, org.snmp4j.smi.OID notificationID, org.snmp4j.smi.TimeTicks sysUpTime, org.snmp4j.smi.VariableBinding[] vbs) throws IOException
IOExceptionpublic int addAgentCaps(AgentXSession session, org.snmp4j.smi.OctetString context, org.snmp4j.smi.OID id, org.snmp4j.smi.OctetString descr)
public int removeAgentCaps(AgentXSession session, org.snmp4j.smi.OctetString context, org.snmp4j.smi.OID id)
public void addPingListener(PingListener l)
public void removePingListener(PingListener l)
protected void firePinged(PingEvent event)
Copyright © 2014 SNMP4J.org. All Rights Reserved.