| java.lang.Object org.snmp4j.security.USM
USM | public class USM implements SecurityModel(Code) | | The USM class implements the User Based Security Model (USM)
as defined in RFC3414.
When a user is added or removed from the USM, a UsmUserEvent
is fired and forwarded to registered listeners.
author: Frank Fock version: 1.2 |
Constructor Summary | |
public | USM(SecurityProtocols securityProtocols, OctetString localEngineID, int engineBoots) Creates a USM with the support for the supplied security protocols. |
Method Summary | |
public UsmUserEntry | addLocalizedUser(byte[] engineID, OctetString userName, OID authProtocol, byte[] authKey, OID privProtocol, byte[] privKey) Adds a localized user to the USM. | public void | addUser(OctetString userName, UsmUser user) Adds an USM user to the internal user name table. | public void | addUser(OctetString userName, OctetString engineID, UsmUser user) Adds an USM user to the internal user name table and associates it with
an authoritative engine ID. | public synchronized void | addUsmUserListener(UsmUserListener l) Adds a UsmUserListener that should be informed whenever the
internal USM user table is changed. | protected void | fireIncrementCounter(CounterEvent e) | protected void | fireUsmUserChange(UsmUserEvent e) Fires a UsmUserEvent . | public int | generateRequestMessage(int snmpVersion, byte[] globalData, int maxMessageSize, int securityModel, byte[] securityEngineID, byte[] securityName, int securityLevel, BERInputStream scopedPDU, SecurityParameters securityParameters, BEROutputStream wholeMsg) | public int | generateResponseMessage(int snmpVersion, byte[] globalData, int maxMessageSize, int securityModel, byte[] securityEngineID, byte[] securityName, int securityLevel, BERInputStream scopedPDU, SecurityStateReference securityStateReference, SecurityParameters securityParameters, BEROutputStream wholeMsg) | public CounterSupport | getCounterSupport() Gets the counter support instance that can be used to register for
counter incremnetation events. | public int | getEngineBoots() Returns the number of engine boots counted for the local engine ID. | public int | getEngineTime() Returns the number of seconds since the value of
the engineBoots object last changed. | public int | getID() | public OctetString | getLocalEngineID() Returns the local engine ID. | public SecurityProtocols | getSecurityProtocols() Returns the security protocol collection used by this USM. | public UsmTimeTable | getTimeTable() Returns the UsmTimeTable instance used by this USM for holding
timing information about the local and remote SNMP entities. | public UsmUserEntry | getUser(OctetString engineID, OctetString securityName) | public UsmUserTable | getUserTable() Returns the UsmUserTable instance used by the USM for local
storage of USM user information. | public boolean | isEngineDiscoveryEnabled() Checks whether engine ID discovery is enabled or not. | public SecurityParameters | newSecurityParametersInstance() | public SecurityStateReference | newSecurityStateReference() | public int | processIncomingMsg(int snmpVersion, int maxMessageSize, SecurityParameters securityParameters, SecurityModel securityModel, int securityLevel, BERInputStream wholeMsg, OctetString securityEngineID, OctetString securityName, BEROutputStream scopedPDU, Integer32 maxSizeResponseScopedPDU, SecurityStateReference securityStateReference, StatusInformation statusInfo) | public void | removeAllUsers() Removes all users from the USM. | public void | removeEngineTime(OctetString engineID) Removes the specified engine ID from the internal time cache and thus
forces an engine time rediscovery the next time the SNMP engine with
the supplied ID is contacted. | public UsmUser | removeUser(OctetString engineID, OctetString userName) Removes an USM user from the internal user name table. | public synchronized void | removeUsmUserListener(UsmUserListener l) Removes a UsmUserListener . | public void | setCounterSupport(CounterSupport counterSupport) Sets the counter support instance. | public void | setEngineBoots(int engineBoots) Sets the number of engine boots. | public void | setEngineDiscoveryEnabled(boolean engineDiscoveryEnabled) Enables or disables automatic engine ID discovery. | public void | setLocalEngine(OctetString localEngineID, int engineBoots, int engineTime) Sets the local engine ID, number of boots, and time after boot. | public void | setUsers(UsmUser[] users) Sets the users of this USM. | public void | updateUser(UsmUserEntry entry) Updates the USM user entry with the same engine ID and user name as the
supplied instance and fires an appropriate UsmUserEvent . |
USM | public USM(SecurityProtocols securityProtocols, OctetString localEngineID, int engineBoots)(Code) | | Creates a USM with the support for the supplied security protocols.
Parameters: securityProtocols - the security protocols to support. Parameters: localEngineID - the local engine ID. Parameters: engineBoots - the number of engine boots. since: 1.2 |
addLocalizedUser | public UsmUserEntry addLocalizedUser(byte[] engineID, OctetString userName, OID authProtocol, byte[] authKey, OID privProtocol, byte[] privKey)(Code) | | Adds a localized user to the USM.
Parameters: engineID - the engine ID for which the user has been localized. Parameters: userName - the user's name. Parameters: authProtocol - the authentication protocol ID. Parameters: authKey - the authentication key. Parameters: privProtocol - the privacy protocol ID. Parameters: privKey - the privacy key.the added UsmUserEntry . |
addUser | public void addUser(OctetString userName, UsmUser user)(Code) | | Adds an USM user to the internal user name table.
Parameters: userName - a user name. Parameters: user - the UsmUser to add. |
addUser | public void addUser(OctetString userName, OctetString engineID, UsmUser user)(Code) | | Adds an USM user to the internal user name table and associates it with
an authoritative engine ID. This user can only be used with the specified
engine ID - other engine IDs cannot be discovered on behalf of this entry.
Parameters: userName - a user name. Parameters: engineID - the authoritative engine ID to be associated with this entry. IfengineID is null this method behaves exactlylike USM.addUser(OctetString userName,UsmUser user). Parameters: user - the UsmUser to add. |
addUsmUserListener | public synchronized void addUsmUserListener(UsmUserListener l)(Code) | | Adds a UsmUserListener that should be informed whenever the
internal USM user table is changed.
Parameters: l - a UsmUserListener that should be informed aboutUsmUserEvent events. |
fireUsmUserChange | protected void fireUsmUserChange(UsmUserEvent e)(Code) | | Fires a UsmUserEvent .
Parameters: e - the UsmUserEvent to fire. |
generateResponseMessage | public int generateResponseMessage(int snmpVersion, byte[] globalData, int maxMessageSize, int securityModel, byte[] securityEngineID, byte[] securityName, int securityLevel, BERInputStream scopedPDU, SecurityStateReference securityStateReference, SecurityParameters securityParameters, BEROutputStream wholeMsg) throws IOException(Code) | | |
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. |
getEngineBoots | public int getEngineBoots()(Code) | | Returns the number of engine boots counted for the local engine ID.
the number of engine boots (zero based). |
getEngineTime | public int getEngineTime()(Code) | | Returns the number of seconds since the value of
the engineBoots object last changed. When incrementing this object's value
would cause it to exceed its maximum, engineBoots is incremented as if a
re-initialization had occurred, and this
object's value consequently reverts to zero.
a positive integer value denoting the number of seconds sincethe engineBoots value has been changed. since: 1.2 |
getLocalEngineID | public OctetString getLocalEngineID()(Code) | | Returns the local engine ID.
the local engine ID. since: 1.2 |
getTimeTable | public UsmTimeTable getTimeTable()(Code) | | Returns the UsmTimeTable instance used by this USM for holding
timing information about the local and remote SNMP entities.
UsmTimeTable since: 1.6 |
getUserTable | public UsmUserTable getUserTable()(Code) | | Returns the UsmUserTable instance used by the USM for local
storage of USM user information. The returned table should not be modified,
because modifications will not be reported to registered
UsmUserListener s.
the UsmUserTable instance containing the users known bythis USM. |
isEngineDiscoveryEnabled | public boolean isEngineDiscoveryEnabled()(Code) | | Checks whether engine ID discovery is enabled or not. If enabled, the USM
will try to discover unknown engine IDs "on-the-fly" while processing the
message.
true if discovery is enabled, false otherwise. |
processIncomingMsg | public int processIncomingMsg(int snmpVersion, int maxMessageSize, SecurityParameters securityParameters, SecurityModel securityModel, int securityLevel, BERInputStream wholeMsg, OctetString securityEngineID, OctetString securityName, BEROutputStream scopedPDU, Integer32 maxSizeResponseScopedPDU, SecurityStateReference securityStateReference, StatusInformation statusInfo) throws IOException(Code) | | |
removeAllUsers | public void removeAllUsers()(Code) | | Removes all users from the USM.
|
removeEngineTime | public void removeEngineTime(OctetString engineID)(Code) | | Removes the specified engine ID from the internal time cache and thus
forces an engine time rediscovery the next time the SNMP engine with
the supplied ID is contacted.
Parameters: engineID - the SNMP engine ID whose engine time to remove. since: 1.6 |
removeUser | public UsmUser removeUser(OctetString engineID, OctetString userName)(Code) | | Removes an USM user from the internal user name table.
Parameters: engineID - the authoritative engine ID associated with the user, ornull Parameters: userName - a user name.the removed UsmUser instance associate with the givenuserName or null if such a user could notbe found. |
removeUsmUserListener | public synchronized void removeUsmUserListener(UsmUserListener l)(Code) | | Removes a UsmUserListener .
Parameters: l - a proeviously added UsmUserListener . |
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. |
setEngineBoots | public void setEngineBoots(int engineBoots)(Code) | | Sets the number of engine boots.
Parameters: engineBoots - the number of engine boots. |
setEngineDiscoveryEnabled | public void setEngineDiscoveryEnabled(boolean engineDiscoveryEnabled)(Code) | | Enables or disables automatic engine ID discovery.
Parameters: engineDiscoveryEnabled - true if discovery should be enabled,false otherwise. |
setLocalEngine | public void setLocalEngine(OctetString localEngineID, int engineBoots, int engineTime)(Code) | | Sets the local engine ID, number of boots, and time after boot.
Parameters: localEngineID - the local engine ID. Parameters: engineBoots - the number of engine boots. Parameters: engineTime - the number sendonds since the last boot. |
setUsers | public void setUsers(UsmUser[] users)(Code) | | Sets the users of this USM. All previously added users and all localized
user information will be discarded and replaced by the supplied users.
Parameters: users - a possibly empty UsmUser array of users. since: 1.1 |
updateUser | public void updateUser(UsmUserEntry entry)(Code) | | Updates the USM user entry with the same engine ID and user name as the
supplied instance and fires an appropriate UsmUserEvent .
If the corresponding user entry does not yet exist then it will be added.
Parameters: entry - an UsmUserEntry instance not necessarily the same as analready existing entry. since: 1.2 |
|
|