Class AgentXMessageDispatcherImpl

java.lang.Object
org.snmp4j.agent.agentx.AgentXMessageDispatcherImpl
All Implemented Interfaces:
AgentXMessageDispatcher, org.snmp4j.transport.TransportListener

public class AgentXMessageDispatcherImpl extends Object implements AgentXMessageDispatcher
  • Constructor Details

  • Method Details

    • getNextPacketID

      public int getNextPacketID()
      Increments the internal packet ID counter and returns the next ID.
      Returns:
      a new (positive) packet ID. If there is an overrun, 1 is returned.
    • createPduHandle

      protected org.snmp4j.mp.PduHandle createPduHandle()
      Creates a new PDU handle.
      Returns:
      a new PduHandle.
    • addTransportMapping

      public void addTransportMapping(org.snmp4j.TransportMapping<?> transport)
      Description copied from interface: AgentXMessageDispatcher
      Adds a TransportMapping to the dispatcher. The transport mapping is used to send and receive messages to/from the network.
      Specified by:
      addTransportMapping in interface AgentXMessageDispatcher
      Parameters:
      transport - a TransportMapping instance.
    • getTransportMappings

      public Collection<org.snmp4j.TransportMapping<?>> getTransportMappings()
      Description copied from interface: AgentXMessageDispatcher
      Gets the Collection of transport mappings in this message dispatcher.
      Specified by:
      getTransportMappings in interface AgentXMessageDispatcher
      Returns:
      Collection
    • processMessage

      public <A extends org.snmp4j.smi.Address> void processMessage(org.snmp4j.TransportMapping<? super A> sourceTransport, A incomingAddress, ByteBuffer wholeMessage, org.snmp4j.TransportStateReference tmStateReference)
      Specified by:
      processMessage in interface org.snmp4j.transport.TransportListener
    • removeTransportMapping

      public org.snmp4j.TransportMapping<?> removeTransportMapping(org.snmp4j.TransportMapping<?> transport)
      Description copied from interface: AgentXMessageDispatcher
      Removes a previously added TransportMapping from the dispatcher.
      Specified by:
      removeTransportMapping in interface AgentXMessageDispatcher
      Parameters:
      transport - a TransportMapping instance.
      Returns:
      the TransportMapping instance supplied if it could be successfully removed, null otherwise.
    • send

      public <A extends org.snmp4j.smi.Address> org.snmp4j.mp.PduHandle send(org.snmp4j.TransportMapping<? super A> transport, A address, AgentXPDU message, org.snmp4j.mp.PduHandleCallback<AgentXPDU> callback) throws IOException
      Sends a AgentXPDU to a target.
      Specified by:
      send in interface AgentXMessageDispatcher
      Type Parameters:
      A - the address type.
      Parameters:
      transport - the TransportMapping.
      address - the target address.
      message - the AgentXPDU to be sent.
      callback - the PduHandleCallback to generate a PduHandle whe required.
      Returns:
      the PduHandle associated with the PDU.
      Throws:
      IOException - if sending fails because of an IOException.
    • send

      public <A extends org.snmp4j.smi.Address> void send(A address, org.snmp4j.TransportMapping<? super A> transport, ByteBuffer message, org.snmp4j.TransportStateReference tmStateReference) throws IOException
      Sends a AgentXPDU encoded in a ByteBuffer to a target.
      Type Parameters:
      A - the address type.
      Parameters:
      address - the target address.
      transport - the TransportMapping.
      message - the message to be sent.
      tmStateReference - the TransportStateReference to hold SNMPv3 state reference.
      Throws:
      IOException - if sending fails because of an IOException.
    • fireCommandEvent

      protected void fireCommandEvent(AgentXCommandEvent<?> event)
      Parameters:
      event - the AgentXCommandEvent to be fired.
    • addCommandListener

      public void addCommandListener(AgentXCommandListener l)
      Description copied from interface: AgentXMessageDispatcher
      Adds a AgentXCommandListener to this message dispatcher.
      Specified by:
      addCommandListener in interface AgentXMessageDispatcher
      Parameters:
      l - the command listener to add.
    • removeCommandListener

      public void removeCommandListener(AgentXCommandListener l)
      Description copied from interface: AgentXMessageDispatcher
      Removes a AgentXCommandListener from this message dispatcher.
      Specified by:
      removeCommandListener in interface AgentXMessageDispatcher
      Parameters:
      l - the listener to be removed.