Package org.snmp4j

Class CommunityTarget

java.lang.Object
org.snmp4j.AbstractTarget
org.snmp4j.CommunityTarget
All Implemented Interfaces:
Serializable, Cloneable, Target

public class CommunityTarget extends AbstractTarget
A CommunityTarget represents SNMP target properties for community based message processing models (SNMPv1 and SNMPv2c).
Version:
1.1
Author:
Frank Fock
See Also:
  • Constructor Details

    • CommunityTarget

      public CommunityTarget()
      Default constructor.
    • CommunityTarget

      public CommunityTarget(Address address, OctetString community)
      Creates a fully specified community target.
      Parameters:
      address - the transport Address of the target.
      community - the community to be used for the target.
  • Method Details

    • duplicate

      public Target duplicate()
      Description copied from interface: Target
      Creates a new copy of this target with the same address type.
      Returns:
      a copy of this target with the same address type.
    • getCommunity

      public OctetString getCommunity()
      Gets the community octet string (which is the same as the security name). Thus, you can (and should) use AbstractTarget.getSecurityName() directly.
      Returns:
      an OctetString instance, should be never null when using this target to send messages over community based SNMP (v1 and v2c).
    • setCommunity

      public void setCommunity(OctetString community)
      Sets the community octet sting. This is a convenience method to set the security name for community based SNMP (v1 and v2c). It basically checks that the community is not null and then calls AbstractTarget.setSecurityName(org.snmp4j.smi.OctetString) with the supplied parameter.
      Parameters:
      community - an OctetString instance which must not be null.
    • getSecurityModel

      public int getSecurityModel()
      Description copied from interface: Target
      Gets the security model associated with this target.
      Specified by:
      getSecurityModel in interface Target
      Overrides:
      getSecurityModel in class AbstractTarget
      Returns:
      an int value as defined in the SecurityModel interface or any third party subclass thereof.
    • setSecurityLevel

      public void setSecurityLevel(int securityLevel)
      Description copied from class: AbstractTarget
      Sets the security level for this target. The supplied security level must be supported by the security model dependent information associated with the security name set for this target.
      Specified by:
      setSecurityLevel in interface Target
      Overrides:
      setSecurityLevel in class AbstractTarget
      Parameters:
      securityLevel - one of
    • setSecurityModel

      public void setSecurityModel(int securityModel)
      Description copied from class: AbstractTarget
      Sets the security model for this target.
      Specified by:
      setSecurityModel in interface Target
      Overrides:
      setSecurityModel in class AbstractTarget
      Parameters:
      securityModel - an int value as defined in the SecurityModel interface or any third party subclass thereof.
    • toString

      public String toString()
      Overrides:
      toString in class AbstractTarget