java.lang.Object
org.snmp4j.tools.console.SnmpCommand
- All Implemented Interfaces:
Runnable,EventListener,CommandResponder,TransportListener
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) class(package private) static classclass(package private) class(package private) class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Stringprivate static final String(package private) OctetString(package private) OctetString(package private) OIDprivate static final String(package private) Stringprivate static final String[][](package private) OctetStringprivate static final String(package private) OctetString(package private) OctetStringprivate static final intprivate static final int(package private) intprivate static PrintStreamprivate static ResourceBundleprivate static final int(package private) OctetString(package private) OID(package private) int(package private) intprivate static final intprivate static final Stringprivate static final Stringprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprotected intprivate static final Stringprivate static final Stringprivate static final Stringprivate static PrintStreamprivate static boolean(package private) PDUFactory(package private) int(package private) OctetString(package private) OID(package private) intprivate int(package private) OctetStringprivate static booleanprivate static final intprivate static final intprivate static final int(package private) File(package private) Snmpprivate static final Stringprivate static final Stringprivate static int(package private) TimeTicksprivate static final intprivate static final Stringprivate static int[](package private) Target<?> private static final int(package private) intprivate static final Stringprivate static final String(package private) OID(package private) OID(package private) booleanprivate static final Stringprivate static final String(package private) Vector<VariableBinding> (package private) intprivate static final intprivate static final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddUsmUser(Snmp snmp) private voidassignOptions(Map<String, List<Object>> args) private voidcheckTrapVariables(List<VariableBinding> vbs, int pduType, OID trapOID, TimeTicks sysUpTime) private voidcreateSnapshot(List<?> snapshot) private intprivate static Stringprivate static AddressgetAddress(String transportAddress) private static intgetTabPosition(int tabNo) private byte[]private static List<VariableBinding> getVariableBindings(String[] args, int position) intlisten()static voidprivate voidoptionDetailList(int indentation, String prefix, StringBuffer buf, SortedMap<String, ArgumentParser.ArgumentFormat> soptions) private StringoptionList(int indentation, String prefix, String command) private Stringprivate voidprotected static voidprintReport(PDU response) static voidprotected static voidprintVariableBindings(PDU response) protected static voidvoidprocessMessage(TransportMapping<?> sourceTransport, Address destAddress, byte[] message) <A extends Address>
voidprocessMessage(TransportMapping<? super A> sourceTransport, A incomingAddress, ByteBuffer wholeMessage, TransportStateReference tmStateReference) Processes an incoming message.<A extends Address>
voidProcess an incoming request, report or notification PDU.voidrun()private String[]selectFormat(String command) send()static Stringspaces(int n) private static Stringtab(int offset, int position, int tabNo) inttable()private PDUprivate static String
-
Field Details
-
OPTIONS
- See Also:
-
CONSOLE_OPTIONS
- See Also:
-
V3_AUTH_PRIV_PROTOCOL
- See Also:
-
V3_OPTIONS
- See Also:
-
TRAP_OPTIONS
- See Also:
-
TLS_OPTIONS
- See Also:
-
SNMP_OPTIONS
- See Also:
-
SNMPV3_ONLY_OPTIONS
- See Also:
-
BULK_OPTIONS
- See Also:
-
TABLE_OPTIONS
- See Also:
-
WALK_OPTIONS
- See Also:
-
ADDRESS_PARAMETER
- See Also:
-
OID_PARAMETER
- See Also:
-
OPT_OID_PARAMETER
- See Also:
-
OIDLIST_PARAMETER
- See Also:
-
OPT_OIDLIST_PARAMETER
- See Also:
-
ALL_OPTIONS
- See Also:
-
COMMANDS
-
DEFAULT
private static final int DEFAULT- See Also:
-
WALK
private static final int WALK- See Also:
-
LISTEN
private static final int LISTEN- See Also:
-
TABLE
private static final int TABLE- See Also:
-
CVS_TABLE
private static final int CVS_TABLE- See Also:
-
TIME_BASED_CVS_TABLE
private static final int TIME_BASED_CVS_TABLE- See Also:
-
SNAPSHOT_CREATION
private static final int SNAPSHOT_CREATION- See Also:
-
SNAPSHOT_DUMP
private static final int SNAPSHOT_DUMP- See Also:
-
OID_FIND
private static final int OID_FIND- See Also:
-
SMI_DUMP
private static final int SMI_DUMP- See Also:
-
OP_USM_USER
private static final int OP_USM_USER- See Also:
-
OP_USM_KEY
private static final int OP_USM_KEY- See Also:
-
OP_USM_DH_KEY
private static final int OP_USM_DH_KEY- See Also:
-
OP_USM_DH_KICKSTART_INIT
private static final int OP_USM_DH_KICKSTART_INIT- See Also:
-
OP_USM_DH_KICKSTART_RUN
private static final int OP_USM_DH_KICKSTART_RUN- See Also:
-
packetDumpEnabled
private static boolean packetDumpEnabled -
target
Target<?> target -
authProtocol
OID authProtocol -
privProtocol
OID privProtocol -
privPassphrase
OctetString privPassphrase -
authPassphrase
OctetString authPassphrase -
community
OctetString community -
authoritativeEngineID
OctetString authoritativeEngineID -
contextEngineID
OctetString contextEngineID -
contextName
OctetString contextName -
securityName
OctetString securityName -
localEngineID
OctetString localEngineID -
sysUpTime
TimeTicks sysUpTime -
trapOID
OID trapOID -
version
int version -
engineBootCount
int engineBootCount -
retries
int retries -
timeout
int timeout -
pduType
int pduType -
maxSizeResponsePDU
int maxSizeResponsePDU -
vbs
Vector<VariableBinding> vbs -
snapshotFile
File snapshotFile -
operation
protected int operation -
numDispatcherThreads
int numDispatcherThreads -
useDenseTableOperation
boolean useDenseTableOperation -
stdoutWidth
private static int stdoutWidth -
lowerBoundIndex
OID lowerBoundIndex -
upperBoundIndex
OID upperBoundIndex -
pduFactory
PDUFactory pduFactory -
snmp
Snmp snmp -
settings
-
command
String command -
err
-
out
-
help
-
tabs
private static int[] tabs -
silent
private static boolean silent -
returnCode
private int returnCode
-
-
Constructor Details
-
SnmpCommand
- Throws:
IOException
-
-
Method Details
-
assignOptions
-
parseOIDs
- Throws:
IllegalArgumentException
-
addUsmUser
-
help
-
example
-
optionList
-
options
-
optionDetailList
private void optionDetailList(int indentation, String prefix, StringBuffer buf, SortedMap<String, ArgumentParser.ArgumentFormat> soptions) -
selectFormat
-
tab
-
getTabPosition
private static int getTabPosition(int tabNo) -
format
-
wrap
-
spaces
-
send
- Throws:
IOException
-
checkTrapVariables
private void checkTrapVariables(List<VariableBinding> vbs, int pduType, OID trapOID, TimeTicks sysUpTime) -
printReport
-
processPdu
Description copied from interface:CommandResponderProcess an incoming request, report or notification PDU.- Specified by:
processPduin interfaceCommandResponder- Type Parameters:
A- type of the peerAddress.- Parameters:
e- aCommandResponderEventinstance containing the PDU to process and some additional information returned by the message processing model that decoded the SNMP message.
-
printVariableBindings
-
table
- Throws:
IOException
-
createSnapshot
-
dumpSnapshot
private int dumpSnapshot() -
walk
private PDU walk(Snmp snmp, PDU request, Target<?> target, List<VariableBinding> snapshot) throws IOException - Throws:
IOException
-
getVariableBindings
-
getAddress
-
listen
- Throws:
IOException
-
main
-
run
public void run() -
getUserEngineID
private byte[] getUserEngineID() -
printVersion
protected static void printVersion() -
printUsage
- Throws:
IOException
-
processMessage
public <A extends Address> void processMessage(TransportMapping<? super A> sourceTransport, A incomingAddress, ByteBuffer wholeMessage, TransportStateReference tmStateReference) Description copied from interface:TransportListenerProcesses an incoming message.- Specified by:
processMessagein interfaceTransportListener- Type Parameters:
A- theAddresstype.- Parameters:
sourceTransport- aTransportMappinginstance denoting the transport that received the message and that will be used to send any responses to this message. ThesourceTransporthas to support theincomingAddress's implementation class.incomingAddress- theAddressfrom which the message has been received.wholeMessage- anByteBuffercontaining the received message.tmStateReference- the transport model state reference as defined by RFC 5590.
-
processMessage
public void processMessage(TransportMapping<?> sourceTransport, Address destAddress, byte[] message)
-