| java.lang.Object org.snmp4j.mp.MPv3
MPv3 | public class MPv3 implements MessageProcessingModel(Code) | | The MPv3 is the message processing model for SNMPv3.
author: Frank Fock version: 1.9.1 |
Inner Class :protected static class Cache | |
Constructor Summary | |
public | MPv3() Creates a MPv3 with a default local engine ID. | public | MPv3(byte[] localEngineID) Creates a MPv3 with a supplied local engine ID.
Parameters: localEngineID - the local engine ID. | public | MPv3(byte[] localEngineID, PDUFactory incomingPDUFactory) Creates a MPv3 with a supplied local engine ID and
PDUFactory for incoming messages.
Parameters: localEngineID - the local engine ID. |
Method Summary | |
public boolean | addEngineID(Address address, OctetString engineID) Adds an engine ID (other than the local engine ID) to the internal storage. | public synchronized void | addSnmpEngineListener(SnmpEngineListener l) Adds a SNMP engine listener that needs to be informed about changes to
the engine ID cache. | public static byte[] | createLocalEngineID() Creates a local engine ID based on the local IP address. | public static byte[] | createLocalEngineID(OctetString id) | public PDU | createPDU(Target target) Creates a PDU class that is used to parse incoming SNMP messages. | protected void | fireEngineChanged(SnmpEngineEvent engineEvent) Fires a SNMP engine event the registered listeners. | protected void | fireIncrementCounter(CounterEvent e) Fire a counter incrementation event. | public AuthenticationProtocol | getAuthProtocol(OID id) Gets an authentication protocol for the supplied ID. | public CounterSupport | getCounterSupport() Gets the counter support instance that can be used to register for
counter incremnetation events. | protected int | getDefaultSecurityModel() Gets the default security model to be used for engine ID discovery. | public OctetString | getEngineID(Address address) Gets the engine ID associated with the supplied address from the local
storage and fires the corresponding
SnmpEngineEvent . | public static int | getEnterpriseID() Gets the enterprise ID used for creating the local engine ID. | public int | getID() | public byte[] | getLocalEngineID() Gets a copy of the local engine ID. | public synchronized int | getNextMessageID() Gets unique message ID. | public PrivacyProtocol | getPrivProtocol(OID id) Gets an privacy protocol for the supplied ID. | public SecurityModel | getSecurityModel(int id) Gets the security model for the supplied ID. | public SecurityModels | getSecurityModels() Gets the security models supported by this MPv3. | public SecurityProtocols | getSecurityProtocols() Gets the security protocols supported by this MPv3 . | public void | initDefaults() Creates and initializes the default security protocols. | public boolean | isProtocolVersionSupported(int version) | public int | prepareDataElements(MessageDispatcher messageDispatcher, Address transportAddress, BERInputStream wholeMsg, Integer32 messageProcessingModel, Integer32 securityModel, OctetString securityName, Integer32 securityLevel, MutablePDU pdu, PduHandle sendPduHandle, Integer32 maxSizeResponseScopedPDU, StatusInformation statusInformation, MutableStateReference mutableStateReference) | public int | prepareOutgoingMessage(Address transportAddress, int maxMessageSize, int messageProcessingModel, int securityModel, byte[] securityName, int securityLevel, PDU pdu, boolean expectResponse, PduHandle sendPduHandle, Address destTransportAddress, BEROutputStream outgoingMessage) | public int | prepareResponseMessage(int messageProcessingModel, int maxMessageSize, int securityModel, byte[] securityName, int securityLevel, PDU pdu, int maxSizeResponseScopedPDU, StateReference stateReference, StatusInformation statusInformation, BEROutputStream outgoingMessage) | public void | releaseStateReference(PduHandle pduHandle) | public OctetString | removeEngineID(Address address) Removes an engine ID association from the local storage and fires the
corresponding
SnmpEngineEvent . | public synchronized void | removeSnmpEngineListener(SnmpEngineListener l) Removes a SNMP engine listener. | public int | sendReport(MessageDispatcher messageDispatcher, ScopedPDU pdu, int securityLevel, int securityModel, OctetString securityName, int maxSizeResponseScopedPDU, StateReference stateReference, VariableBinding payload) Sends a report message. | public void | setCounterSupport(CounterSupport counterSupport) Sets the counter support instance. | public static void | setEnterpriseID(int newEnterpriseID) Sets the IANA enterprise ID to be used for creating local engine ID by
MPv3.createLocalEngineID() . | public void | setLocalEngineID(byte[] engineID) Sets the local engine ID. | public void | setSecurityModels(SecurityModels securityModels) Sets the security models supported by this MPv3. | public void | setSecurityProtocols(SecurityProtocols securityProtocols) Sets the security protocols for this MPv3 . |
ID | final public static int ID(Code) | | |
MAXLEN_ENGINE_ID | final public static int MAXLEN_ENGINE_ID(Code) | | |
MAX_MESSAGE_ID | final public static int MAX_MESSAGE_ID(Code) | | |
MINLEN_ENGINE_ID | final public static int MINLEN_ENGINE_ID(Code) | | |
MPv3_REPORTABLE_FLAG | final public static int MPv3_REPORTABLE_FLAG(Code) | | |
snmpEngineListeners | transient Vector snmpEngineListeners(Code) | | |
MPv3 | public MPv3()(Code) | | Creates a MPv3 with a default local engine ID.
|
MPv3 | public MPv3(byte[] localEngineID)(Code) | | Creates a MPv3 with a supplied local engine ID.
Parameters: localEngineID - the local engine ID. Its length must be >= 5 and <= 32. |
MPv3 | public MPv3(byte[] localEngineID, PDUFactory incomingPDUFactory)(Code) | | Creates a MPv3 with a supplied local engine ID and
PDUFactory for incoming messages.
Parameters: localEngineID - the local engine ID. Its length must be >= 5 and <= 32. Parameters: incomingPDUFactory - a PDUFactory. If null the default factory will beused which creates ScopedPDU instances. since: 1.9.1 |
addEngineID | public boolean addEngineID(Address address, OctetString engineID)(Code) | | Adds an engine ID (other than the local engine ID) to the internal storage.
Parameters: address - the Address of the remote SNMP engine. Parameters: engineID - the engine ID of the remote SNMP engine.true if the engine ID has been added, false otherwise (if the supplied engineID equals the local one). |
addSnmpEngineListener | public synchronized void addSnmpEngineListener(SnmpEngineListener l)(Code) | | Adds a SNMP engine listener that needs to be informed about changes to
the engine ID cache.
Parameters: l - a SnmpEngineListener instance. since: 1.6 |
createLocalEngineID | public static byte[] createLocalEngineID()(Code) | | Creates a local engine ID based on the local IP address.
a new local engine ID. |
createLocalEngineID | public static byte[] createLocalEngineID(OctetString id)(Code) | | Creates a local engine ID based on the ID string supplied
Parameters: id - an ID string.a new local engine ID. |
createPDU | public PDU createPDU(Target target)(Code) | | Creates a PDU class that is used to parse incoming SNMP messages.
Parameters: target - the target parameter must be ignored.a ScopedPDU instance by default. since: 1.9.1 |
fireEngineChanged | protected void fireEngineChanged(SnmpEngineEvent engineEvent)(Code) | | Fires a SNMP engine event the registered listeners.
Parameters: engineEvent - the SnmpEngineEvent instance to fire. since: 1.6 |
fireIncrementCounter | protected void fireIncrementCounter(CounterEvent e)(Code) | | Fire a counter incrementation event.
Parameters: e - CounterEvent |
getAuthProtocol | public AuthenticationProtocol getAuthProtocol(OID id)(Code) | | Gets an authentication protocol for the supplied ID.
Parameters: id - an authentication protocol OID.an AuthenticationProtocol instance if the supplied IDis supported, otherwise null is returned. |
getCounterSupport | public CounterSupport getCounterSupport()(Code) | | Gets the counter support instance that can be used to register for
counter incremnetation events.
a CounterSupport instance that is used to fireCounterEvent. |
getDefaultSecurityModel | protected int getDefaultSecurityModel()(Code) | | Gets the default security model to be used for engine ID discovery.
a security model ID. See Also: USM.getID |
getEngineID | public OctetString getEngineID(Address address)(Code) | | Gets the engine ID associated with the supplied address from the local
storage and fires the corresponding
SnmpEngineEvent .
Parameters: address - the Address of the remote SNMP engine.the engine ID of the remote SNMP engine or null if thereis no entry for address in the local storage. |
getEnterpriseID | public static int getEnterpriseID()(Code) | | Gets the enterprise ID used for creating the local engine ID.
an enterprise ID as registered by the IANA (see http://www.iana.org). |
getLocalEngineID | public byte[] getLocalEngineID()(Code) | | Gets a copy of the local engine ID.
a byte array containing the local engine ID. |
getNextMessageID | public synchronized int getNextMessageID()(Code) | | Gets unique message ID.
a message ID >= 1 and <= MPv3.MAX_MESSAGE_ID. |
getPrivProtocol | public PrivacyProtocol getPrivProtocol(OID id)(Code) | | Gets an privacy protocol for the supplied ID.
Parameters: id - an privacy protocol OID.an PrivacyProtocol instance if the supplied IDis supported, otherwise null is returned. |
getSecurityModel | public SecurityModel getSecurityModel(int id)(Code) | | Gets the security model for the supplied ID.
Parameters: id - a security model ID.a SecurityModel instance if the supplied IDis supported, otherwise null is returned. |
getSecurityModels | public SecurityModels getSecurityModels()(Code) | | Gets the security models supported by this MPv3.
a SecurityModels instance. |
getSecurityProtocols | public SecurityProtocols getSecurityProtocols()(Code) | | Gets the security protocols supported by this MPv3 .
return a SecurityProtocols . |
isProtocolVersionSupported | public boolean isProtocolVersionSupported(int version)(Code) | | |
prepareDataElements | public int prepareDataElements(MessageDispatcher messageDispatcher, Address transportAddress, BERInputStream wholeMsg, Integer32 messageProcessingModel, Integer32 securityModel, OctetString securityName, Integer32 securityLevel, MutablePDU pdu, PduHandle sendPduHandle, Integer32 maxSizeResponseScopedPDU, StatusInformation statusInformation, MutableStateReference mutableStateReference)(Code) | | |
prepareOutgoingMessage | public int prepareOutgoingMessage(Address transportAddress, int maxMessageSize, int messageProcessingModel, int securityModel, byte[] securityName, int securityLevel, PDU pdu, boolean expectResponse, PduHandle sendPduHandle, Address destTransportAddress, BEROutputStream outgoingMessage) throws IOException(Code) | | |
releaseStateReference | public void releaseStateReference(PduHandle pduHandle)(Code) | | |
removeEngineID | public OctetString removeEngineID(Address address)(Code) | | Removes an engine ID association from the local storage and fires the
corresponding
SnmpEngineEvent .
Parameters: address - the Address of the remote SNMP engine for whose engine IDis to be removed.the removed engine ID of the remote SNMP engine or null ifthere is no entry for address in the local storage. |
removeSnmpEngineListener | public synchronized void removeSnmpEngineListener(SnmpEngineListener l)(Code) | | Removes a SNMP engine listener.
Parameters: l - a SnmpEngineListener instance. since: 1.6 |
sendReport | public int sendReport(MessageDispatcher messageDispatcher, ScopedPDU pdu, int securityLevel, int securityModel, OctetString securityName, int maxSizeResponseScopedPDU, StateReference stateReference, VariableBinding payload)(Code) | | Sends a report message.
Parameters: messageDispatcher - Send the message on behalf the supplied MessageDispatcher instance. Parameters: pdu - ScopedPDUIf null , then contextEngineID, contextName, and requestIDof the report generated will be zero length and zero respective.Otherwise these values are extracted from the PDU. Parameters: securityLevel - The security level to use when sending this report. Parameters: securityModel - The security model to use when sending this report. Parameters: securityName - The security name to use when sending this report. Parameters: maxSizeResponseScopedPDU - the maximum size of of the report message (will be most likely ignoredbecause a report should always fit in 484 bytes). Parameters: payload - the variable binding to include in the report message. Parameters: stateReference - the state reference associated with the original message.an SNMP MPv3 error code or 0 if the report has been send successfully. |
setCounterSupport | public void setCounterSupport(CounterSupport counterSupport)(Code) | | Sets the counter support instance. By default, the singleton instance
provided by the
CounterSupport instance is used.
Parameters: counterSupport - a CounterSupport subclass instance. |
setEnterpriseID | public static void setEnterpriseID(int newEnterpriseID)(Code) | | Sets the IANA enterprise ID to be used for creating local engine ID by
MPv3.createLocalEngineID() .
Parameters: newEnterpriseID - an enterprise ID as registered by the IANA (see http://www.iana.org). |
setLocalEngineID | public void setLocalEngineID(byte[] engineID)(Code) | | Sets the local engine ID. This value must not be changed after message
processing has been started.
Parameters: engineID - the local engine ID. Its length must be >= 5 and <= 32. |
setSecurityModels | public void setSecurityModels(SecurityModels securityModels)(Code) | | Sets the security models supported by this MPv3.
Parameters: securityModels - a SecurityModels instance. |
setSecurityProtocols | public void setSecurityProtocols(SecurityProtocols securityProtocols)(Code) | | Sets the security protocols for this MPv3 .
Parameters: securityProtocols - SecurityProtocols |
|
|