Module org.snmp4j

Class SnmpCommand

java.lang.Object
org.snmp4j.tools.console.SnmpCommand
All Implemented Interfaces:
Runnable, EventListener, CommandResponder, TransportListener

public class SnmpCommand extends Object implements Runnable, CommandResponder, TransportListener
  • Field Details

    • operation

      protected int operation
  • Constructor Details

  • Method Details

    • help

      public String help(String prefix, String command, boolean listOptionsDetails, boolean withDescription)
    • example

      public String example(String prefix, String command)
    • spaces

      public static String spaces(int n)
    • send

      public PDU send() throws IOException
      Throws:
      IOException
    • printReport

      protected static void printReport(PDU response)
    • processPdu

      public <A extends Address> void processPdu(CommandResponderEvent<A> e)
      Description copied from interface: CommandResponder
      Process an incoming request, report or notification PDU.
      Specified by:
      processPdu in interface CommandResponder
      Type Parameters:
      A - type of the peer Address.
      Parameters:
      e - a CommandResponderEvent instance containing the PDU to process and some additional information returned by the message processing model that decoded the SNMP message.
    • printVariableBindings

      protected static void printVariableBindings(PDU response)
    • table

      public int table() throws IOException
      Throws:
      IOException
    • listen

      public int listen() throws IOException
      Throws:
      IOException
    • main

      public static void main(String[] args)
    • run

      public void run()
      Specified by:
      run in interface Runnable
    • printVersion

      protected static void printVersion()
    • printUsage

      public static void printUsage() throws IOException
      Throws:
      IOException
    • processMessage

      public <A extends Address> void processMessage(TransportMapping<? super A> sourceTransport, A incomingAddress, ByteBuffer wholeMessage, TransportStateReference tmStateReference)
      Description copied from interface: TransportListener
      Processes an incoming message.
      Specified by:
      processMessage in interface TransportListener
      Type Parameters:
      A - the Address type.
      Parameters:
      sourceTransport - a TransportMapping instance denoting the transport that received the message and that will be used to send any responses to this message. The sourceTransport has to support the incomingAddress's implementation class.
      incomingAddress - the Address from which the message has been received.
      wholeMessage - an ByteBuffer containing the received message.
      tmStateReference - the transport model state reference as defined by RFC 5590.
    • processMessage

      public void processMessage(TransportMapping<?> sourceTransport, Address destAddress, byte[] message)