public abstract class AbstractTarget extends Object implements Target
AbstratTarget
class is an abstract representation of a remote
SNMP entity. It represents a target with an Address object, as well protocol
parameters such as retransmission and timeout policy. Implementers of the
Target
interface can subclass AbstractTarget
to
take advantage of the implementation of common Target
properties.Modifier and Type | Field and Description |
---|---|
protected int |
securityLevel |
protected int |
securityModel |
protected OctetString |
securityName |
Modifier | Constructor and Description |
---|---|
protected |
AbstractTarget()
Default constructor
|
protected |
AbstractTarget(Address address)
Creates a SNMPv3 target with no retries and a timeout of one second.
|
protected |
AbstractTarget(Address address,
OctetString securityName) |
Modifier and Type | Method and Description |
---|---|
Object |
clone() |
boolean |
equals(Object o) |
Address |
getAddress()
Gets the address of this target.
|
int |
getMaxSizeRequestPDU()
Gets the maximum size of request PDUs that this target is able to respond
to.
|
List<TransportMapping<? extends Address>> |
getPreferredTransports()
Gets the prioritised list of transport mappings to be used for this
target.
|
int |
getRetries()
Gets the number of retries.
|
int |
getSecurityLevel()
Gets the security level associated with this target.
|
int |
getSecurityModel()
Gets the security model associated with this target.
|
OctetString |
getSecurityName()
Gets the security name associated with this target.
|
long |
getTimeout()
Gets the timeout for a target.
|
int |
getVersion()
Gets the SNMP version (NMP messagen processing model) of the target.
|
int |
hashCode() |
void |
setAddress(Address address)
Sets the address of the target.
|
void |
setMaxSizeRequestPDU(int maxSizeRequestPDU)
Sets the maximum size of request PDUs that this target is able to receive.
|
void |
setPreferredTransports(List<TransportMapping<? extends Address>> preferredTransports)
Sets the prioritised list of transport mappings to be used for this
target.
|
void |
setRetries(int retries)
Sets the number of retries to be performed before a request is timed out.
|
void |
setSecurityLevel(int securityLevel)
Sets the security level for this target.
|
void |
setSecurityModel(int securityModel)
Sets the security model for this target.
|
void |
setSecurityName(OctetString securityName)
Sets the security name to be used with this target.
|
void |
setTimeout(long timeout)
Sets the timeout for a target.
|
void |
setVersion(int version)
Sets the SNMP version (thus the SNMP message processing model) of the
target.
|
String |
toString() |
protected String |
toStringAbstractTarget() |
protected int securityLevel
protected int securityModel
protected OctetString securityName
protected AbstractTarget()
protected AbstractTarget(Address address)
address
- an Address
instance.protected AbstractTarget(Address address, OctetString securityName)
public Address getAddress()
getAddress
in interface Target
public void setAddress(Address address)
setAddress
in interface Target
address
- an Address instance.public void setVersion(int version)
setVersion
in interface Target
version
- the message processing model ID.SnmpConstants.version1
,
SnmpConstants.version2c
,
SnmpConstants.version3
public int getVersion()
getVersion
in interface Target
SnmpConstants.version1
,
SnmpConstants.version2c
,
SnmpConstants.version3
public void setRetries(int retries)
setRetries
in interface Target
retries
- the number of retries. Note: If the number of retries is set to
0, then the request will be sent out exactly once.public int getRetries()
getRetries
in interface Target
public void setTimeout(long timeout)
setTimeout
in interface Target
timeout
- timeout in milliseconds before a confirmed request is resent or
timed out.public long getTimeout()
getTimeout
in interface Target
public int getMaxSizeRequestPDU()
getMaxSizeRequestPDU
in interface Target
public void setMaxSizeRequestPDU(int maxSizeRequestPDU)
setMaxSizeRequestPDU
in interface Target
maxSizeRequestPDU
- the maximum PDU (SNMP message) size this session will be able to
process.public List<TransportMapping<? extends Address>> getPreferredTransports()
Target
getPreferredTransports
in interface Target
TransportMapping
instances.public void setPreferredTransports(List<TransportMapping<? extends Address>> preferredTransports)
null
(default), the appropriate TransportMapping
will be chosen by the supplied address
of the target.
If an entity supports more than one TransportMapping
for
an Address
class, the the results are not defined.
This situation can be controlled by setting this preferredTransports
list.protected String toStringAbstractTarget()
public Object clone()
public int getSecurityModel()
Target
getSecurityModel
in interface Target
int
value as defined in the SecurityModel
interface or any third party subclass thereof.public final OctetString getSecurityName()
Target
getSecurityName
in interface Target
OctetString
instance (never null
).public int getSecurityLevel()
Target
getSecurityLevel
in interface Target
public void setSecurityLevel(int securityLevel)
setSecurityLevel
in interface Target
securityLevel
- one of
public void setSecurityModel(int securityModel)
setSecurityModel
in interface Target
securityModel
- an int
value as defined in the SecurityModel
interface or any third party subclass thereof.public final void setSecurityName(OctetString securityName)
setSecurityName
in interface Target
securityName
- an OctetString
instance (must not be null
).getSecurityName()
Copyright © 2016 SNMP4J.org. All rights reserved.