Class SnmpRequest

java.lang.Object
org.snmp4j.tools.console.SnmpRequest
All Implemented Interfaces:
EventListener, CommandResponder, PDUFactory

public class SnmpRequest extends Object implements CommandResponder, PDUFactory
The SnmpRequest application is an example implementation of most of the SNMP4J features. It can be used to send SNMP requests to a target or to listen for traps/notifications and inform requests.
Version:
1.9
Author:
Frank Fock
  • Field Details

  • Constructor Details

    • SnmpRequest

      public SnmpRequest(String[] args)
  • Method Details

    • getPduType

      public int getPduType()
    • getVersion

      public int getVersion()
    • getVbs

      public Vector<? extends VariableBinding> getVbs()
    • isUseDenseTableOperation

      public boolean isUseDenseTableOperation()
    • getUpperBoundIndex

      public OID getUpperBoundIndex()
    • getTrapOID

      public OID getTrapOID()
    • getTimeout

      public int getTimeout()
    • getTarget

      public Target getTarget()
    • getSysUpTime

      public TimeTicks getSysUpTime()
    • getSecurityName

      public OctetString getSecurityName()
    • getRetries

      public int getRetries()
    • getPrivProtocol

      public OID getPrivProtocol()
    • getPrivPassphrase

      public OctetString getPrivPassphrase()
    • getOperation

      public int getOperation()
    • getNumDispatcherThreads

      public int getNumDispatcherThreads()
    • getNonRepeaters

      public int getNonRepeaters()
    • getMaxRepetitions

      public int getMaxRepetitions()
    • getLowerBoundIndex

      public OID getLowerBoundIndex()
    • getContextName

      public OctetString getContextName()
    • getContextEngineID

      public OctetString getContextEngineID()
    • getCommunity

      public OctetString getCommunity()
    • getAuthoritativeEngineID

      public OctetString getAuthoritativeEngineID()
    • getAuthProtocol

      public OID getAuthProtocol()
    • getAuthPassphrase

      public OctetString getAuthPassphrase()
    • getAddress

      public Address getAddress()
    • listen

      public void listen() throws IOException
      Throws:
      IOException
    • send

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

      protected static void printVersion()
    • printUsage

      protected static void printUsage()
      printUsage
    • printVariableBindings

      protected static void printVariableBindings(PDU response)
    • printReport

      protected static void printReport(PDU response)
    • processPdu

      public void processPdu(CommandResponderEvent e)
      Description copied from interface: CommandResponder
      Process an incoming request, report or notification PDU.
      Specified by:
      processPdu in interface CommandResponder
      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.
    • createPDU

      public PDU createPDU(Target target)
      Description copied from interface: PDUFactory
      Creates a PDU instance for the supplied target. The created PDU has to be compliant to the SNMP version defined by the supplied target. For example, a SNMPv3 target requires a ScopedPDU instance.
      Specified by:
      createPDU in interface PDUFactory
      Parameters:
      target - the Target where the PDU to be created will be sent.
      Returns:
      PDU a PDU instance that is compatible with the supplied target.
    • createPDU

      public PDU createPDU(MessageProcessingModel messageProcessingModel)
      Description copied from interface: PDUFactory
      Creates a PDU instance that is compatible with the given SNMP version (message processing model).
      Specified by:
      createPDU in interface PDUFactory
      Parameters:
      messageProcessingModel - a MessageProcessingModel instance.
      Returns:
      a PDU instance that is compatible with the given SNMP version (message processing model).
    • table

      public void table() throws IOException
      Throws:
      IOException
    • main

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

      public void setAddress(Address address)
    • setVersion

      public void setVersion(int version)
    • setVbs

      public void setVbs(Vector<VariableBinding> vbs)
    • setUseDenseTableOperation

      public void setUseDenseTableOperation(boolean useDenseTableOperation)
    • setUpperBoundIndex

      public void setUpperBoundIndex(OID upperBoundIndex)
    • setTrapOID

      public void setTrapOID(OID trapOID)
    • setTimeout

      public void setTimeout(int timeout)
    • setTarget

      public void setTarget(Target target)
    • setSysUpTime

      public void setSysUpTime(TimeTicks sysUpTime)
    • setSecurityName

      public void setSecurityName(OctetString securityName)
    • setRetries

      public void setRetries(int retries)
    • setPrivProtocol

      public void setPrivProtocol(OID privProtocol)
    • setPrivPassphrase

      public void setPrivPassphrase(OctetString privPassphrase)
    • setPduType

      public void setPduType(int pduType)
    • setOperation

      public void setOperation(int operation)
    • setNumDispatcherThreads

      public void setNumDispatcherThreads(int numDispatcherThreads)
    • setNonRepeaters

      public void setNonRepeaters(int nonRepeaters)
    • setMaxRepetitions

      public void setMaxRepetitions(int maxRepetitions)
    • setLowerBoundIndex

      public void setLowerBoundIndex(OID lowerBoundIndex)
    • setContextName

      public void setContextName(OctetString contextName)
    • setContextEngineID

      public void setContextEngineID(OctetString contextEngineID)
    • setCommunity

      public void setCommunity(OctetString community)
    • setAuthoritativeEngineID

      public void setAuthoritativeEngineID(OctetString authoritativeEngineID)
    • setAuthProtocol

      public void setAuthProtocol(OID authProtocol)
    • setAuthPassphrase

      public void setAuthPassphrase(OctetString authPassphrase)