- java.lang.Object
-
- org.snmp4j.agent.mo.snmp.UsmMIB
-
- All Implemented Interfaces:
java.util.EventListener
,MOTableRowListener<MOMutableRow2PC>
,MOValueValidationListener
,MOGroup
,org.snmp4j.event.CounterListener
,org.snmp4j.event.UsmUserListener
public class UsmMIB extends java.lang.Object implements MOGroup, org.snmp4j.event.CounterListener, MOValueValidationListener, MOTableRowListener<MOMutableRow2PC>, org.snmp4j.event.UsmUserListener
TheUsmMIB
implements the SNMP-USER-BASED-SM-MIB defined in RFC 3414. The MIB implementation is backed by aUSM
instance. The configuration of the user based security model can be changed using the underlyingUSM
or via SNMP but at least one user must be created programatically in order to allow any access to the agent via SNMP.When modifying the USM after having created this MIB, you will have to register this object as
UsmUserListener
to the USM.By using SNMP, a new users can only be created by cloning it from an existing user with the same or higher security level.
- Version:
- 1.2
- Author:
- Frank Fock
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
UsmMIB.UsmTableModel
class
UsmMIB.UsmTableRow
-
Field Summary
Fields Modifier and Type Field Description static int
colUsmUserAuthKey
static int
colUsmUserAuthKeyChange
static int
colUsmUserAuthPassword
static int
colUsmUserAuthProtocol
static int
colUsmUserCloneFrom
static int
colUsmUserLocalizationEngineID
static int
colUsmUserOwnAuthKeyChange
static int
colUsmUserOwnPrivKeyChange
static int
colUsmUserPrivKey
static int
colUsmUserPrivKeyChange
static int
colUsmUserPrivPassword
static int
colUsmUserPrivProtocol
static int
colUsmUserPublic
static int
colUsmUserSecurityName
static int
colUsmUserStatus
static int
colUsmUserStorageType
static org.snmp4j.smi.OID
noAuthProtocol
static org.snmp4j.smi.OID
noPrivProtocol
static org.snmp4j.smi.OID
usmUserEntryOID
static org.snmp4j.smi.OID
usmUserSpinLockOID
-
Constructor Summary
Constructors Constructor Description UsmMIB(org.snmp4j.security.USM usm, org.snmp4j.security.SecurityProtocols securityProtocols)
Creates a USM MIB implementation connected to the supplied USM.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.snmp4j.smi.OID
getProtocolForKeyChange(Request request, org.snmp4j.smi.OID rowIndex, org.snmp4j.security.dh.DHOperations.KeyType keyType)
org.snmp4j.security.SecurityProtocols
getSecurityProtocols()
DefaultMOTable<MOMutableRow2PC,MOColumn,DefaultMOMutableTableModel<MOMutableRow2PC>>
getUsmUserEntry()
void
incrementCounter(org.snmp4j.event.CounterEvent event)
void
registerMOs(MOServer server, org.snmp4j.smi.OctetString context)
Registers the managed objects of this group with the server for the supplied context.void
rowChanged(MOTableRowEvent event)
A column or a complete row is changed/has been changed.void
unregisterMOs(MOServer server, org.snmp4j.smi.OctetString context)
Unregisters the managed objects of this group from the supplied server and from the supplied context.void
usmUserChange(org.snmp4j.event.UsmUserEvent event)
void
validate(MOValueValidationEvent validationEvent)
Validates a value by returning a SNMP error code if validation fails or 0 (SnmpConstants.SNMP_ERROR_SUCCESS
) if the validation was successful.
-
-
-
Field Detail
-
noAuthProtocol
public static final org.snmp4j.smi.OID noAuthProtocol
-
noPrivProtocol
public static final org.snmp4j.smi.OID noPrivProtocol
-
usmUserSpinLockOID
public static final org.snmp4j.smi.OID usmUserSpinLockOID
-
usmUserEntryOID
public static final org.snmp4j.smi.OID usmUserEntryOID
-
colUsmUserSecurityName
public static final int colUsmUserSecurityName
- See Also:
- Constant Field Values
-
colUsmUserCloneFrom
public static final int colUsmUserCloneFrom
- See Also:
- Constant Field Values
-
colUsmUserAuthProtocol
public static final int colUsmUserAuthProtocol
- See Also:
- Constant Field Values
-
colUsmUserAuthKeyChange
public static final int colUsmUserAuthKeyChange
- See Also:
- Constant Field Values
-
colUsmUserOwnAuthKeyChange
public static final int colUsmUserOwnAuthKeyChange
- See Also:
- Constant Field Values
-
colUsmUserPrivProtocol
public static final int colUsmUserPrivProtocol
- See Also:
- Constant Field Values
-
colUsmUserPrivKeyChange
public static final int colUsmUserPrivKeyChange
- See Also:
- Constant Field Values
-
colUsmUserOwnPrivKeyChange
public static final int colUsmUserOwnPrivKeyChange
- See Also:
- Constant Field Values
-
colUsmUserPublic
public static final int colUsmUserPublic
- See Also:
- Constant Field Values
-
colUsmUserStorageType
public static final int colUsmUserStorageType
- See Also:
- Constant Field Values
-
colUsmUserStatus
public static final int colUsmUserStatus
- See Also:
- Constant Field Values
-
colUsmUserAuthPassword
public static final int colUsmUserAuthPassword
- See Also:
- Constant Field Values
-
colUsmUserPrivPassword
public static final int colUsmUserPrivPassword
- See Also:
- Constant Field Values
-
colUsmUserLocalizationEngineID
public static final int colUsmUserLocalizationEngineID
- See Also:
- Constant Field Values
-
colUsmUserAuthKey
public static final int colUsmUserAuthKey
- See Also:
- Constant Field Values
-
colUsmUserPrivKey
public static final int colUsmUserPrivKey
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
UsmMIB
public UsmMIB(org.snmp4j.security.USM usm, org.snmp4j.security.SecurityProtocols securityProtocols)
Creates a USM MIB implementation connected to the supplied USM. The MIB contents will reflect any changes to the USM after completion of this constructor if you register this object asUsmUserListener
to the USM!- Parameters:
usm
- a User-based Security Model.securityProtocols
- the supportedSecurityProtocols
.
-
-
Method Detail
-
getProtocolForKeyChange
public org.snmp4j.smi.OID getProtocolForKeyChange(Request request, org.snmp4j.smi.OID rowIndex, org.snmp4j.security.dh.DHOperations.KeyType keyType)
-
getSecurityProtocols
public org.snmp4j.security.SecurityProtocols getSecurityProtocols()
-
registerMOs
public void registerMOs(MOServer server, org.snmp4j.smi.OctetString context) throws DuplicateRegistrationException
Description copied from interface:MOGroup
Registers the managed objects of this group with the server for the supplied context.- Specified by:
registerMOs
in interfaceMOGroup
- Parameters:
server
- theMOServer
where to register the managed objects.context
- the context to use (may benull
if no specific context is selected).- Throws:
DuplicateRegistrationException
- if a managed object's scope (i.e. lower bound) is already registered at the server.
-
unregisterMOs
public void unregisterMOs(MOServer server, org.snmp4j.smi.OctetString context)
Description copied from interface:MOGroup
Unregisters the managed objects of this group from the supplied server and from the supplied context.- Specified by:
unregisterMOs
in interfaceMOGroup
- Parameters:
server
- theMOServer
where to unregister the managed objects.context
- the context to use (may benull
if no specific context is selected).
-
incrementCounter
public void incrementCounter(org.snmp4j.event.CounterEvent event)
- Specified by:
incrementCounter
in interfaceorg.snmp4j.event.CounterListener
-
validate
public void validate(MOValueValidationEvent validationEvent)
Description copied from interface:MOValueValidationListener
Validates a value by returning a SNMP error code if validation fails or 0 (SnmpConstants.SNMP_ERROR_SUCCESS
) if the validation was successful. The validation is returned by calling theMOValueValidationEvent.setValidationStatus(int)
method. If an error occured the returned status value should be one of the following values:SnmpConstants.SNMP_ERROR_WRONG_LENGTH
SnmpConstants.SNMP_ERROR_WRONG_VALUE
SnmpConstants.SNMP_ERROR_WRONG_TYPE
SnmpConstants.SNMP_ERROR_WRONG_ENCODING
SnmpConstants.SNMP_ERROR_BAD_VALUE
- Specified by:
validate
in interfaceMOValueValidationListener
- Parameters:
validationEvent
- theMOValueValidationEvent
containing the value to validate.
-
usmUserChange
public void usmUserChange(org.snmp4j.event.UsmUserEvent event)
- Specified by:
usmUserChange
in interfaceorg.snmp4j.event.UsmUserListener
-
getUsmUserEntry
public DefaultMOTable<MOMutableRow2PC,MOColumn,DefaultMOMutableTableModel<MOMutableRow2PC>> getUsmUserEntry()
-
rowChanged
public void rowChanged(MOTableRowEvent event)
Description copied from interface:MOTableRowListener
A column or a complete row is changed/has been changed.- Specified by:
rowChanged
in interfaceMOTableRowListener<MOMutableRow2PC>
- Parameters:
event
- aMOTableRowEvent
describing the event. To veto the event theMOTableRowEvent.setVetoStatus(int)
and optionally also theMOTableRowEvent.setVetoColumn(int)
can be called. IfMOTableRowEvent.getNumberOfConsecutiveEventsOfSameOrigin()
is greater than zero you need to setMOTableRowEvent.setSendNextEventsOfSameOrigin(boolean)
totrue
in order to receive those consecutive events too. Otherwise they will be ignored and not been propagated to this listener.
-
-