Module org.snmp4j
Package org.snmp4j.mp

Class StateReference<A extends Address>

java.lang.Object
org.snmp4j.mp.StateReference<A>
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
MPv3.CacheEntry

public class StateReference<A extends Address> extends Object implements Serializable
The StateReference class represents state information associated with SNMP messages. The state reference is used to send response or report (SNMPv3 only). Depending on the security model not all fields may be filled.
Version:
3.1.0
Author:
Frank Fock
See Also:
  • Field Details

  • Constructor Details

    • StateReference

      public StateReference()
      Default constructor.
    • StateReference

      public StateReference(PduHandle pduHandle, A peerAddress, TransportMapping<? super A> peerTransport, SecurityModel secModel, byte[] secName, int errorCode)
      Creates a state reference for community based security models.
      Parameters:
      pduHandle - PduHandle
      peerAddress - Address
      peerTransport - the TransportMapping to be used to communicate with the peer.
      secModel - SecurityModel
      secName - a community string.
      errorCode - an error code associated with the SNMP message.
    • StateReference

      public StateReference(int msgID, int msgFlags, int maxSizeResponseScopedPDU, PduHandle pduHandle, A peerAddress, TransportMapping<? super A> peerTransport, byte[] secEngineID, SecurityModel secModel, byte[] secName, int secLevel, byte[] contextEngineID, byte[] contextName, SecurityStateReference secStateReference, int errorCode)
      Creates a state reference for SNMPv3 messages.
      Parameters:
      msgID - int
      msgFlags - int
      maxSizeResponseScopedPDU - int
      pduHandle - PduHandle
      peerAddress - Address
      peerTransport - the TransportMapping to be used to communicate with the peer.
      secEngineID - byte[]
      secModel - SecurityModel
      secName - byte[]
      secLevel - int
      contextEngineID - byte[]
      contextName - byte[]
      secStateReference - SecurityStateReference
      errorCode - int
  • Method Details

    • isReportable

      public boolean isReportable()
    • getAddress

      public A getAddress()
    • setAddress

      public void setAddress(A address)
    • setContextEngineID

      public void setContextEngineID(byte[] contextEngineID)
    • getContextEngineID

      public byte[] getContextEngineID()
    • setContextName

      public void setContextName(byte[] contextName)
    • getContextName

      public byte[] getContextName()
    • setSecurityModel

      public void setSecurityModel(SecurityModel securityModel)
    • getSecurityModel

      public SecurityModel getSecurityModel()
    • setSecurityName

      public void setSecurityName(byte[] securityName)
    • getSecurityName

      public byte[] getSecurityName()
    • setSecurityLevel

      public void setSecurityLevel(int securityLevel)
    • getSecurityLevel

      public int getSecurityLevel()
    • setSecurityStateReference

      public void setSecurityStateReference(SecurityStateReference securityStateReference)
    • getSecurityStateReference

      public SecurityStateReference getSecurityStateReference()
    • setMsgID

      public void setMsgID(MessageID msgID)
    • setMsgID

      public void setMsgID(int msgID)
    • getMsgID

      public MessageID getMsgID()
    • setMsgFlags

      public void setMsgFlags(int msgFlags)
    • getMsgFlags

      public int getMsgFlags()
    • setMaxSizeResponseScopedPDU

      public void setMaxSizeResponseScopedPDU(int maxSizeResponseScopedPDU)
    • getMaxSizeResponseScopedPDU

      public int getMaxSizeResponseScopedPDU()
    • getPduHandle

      public PduHandle getPduHandle()
    • getSecurityEngineID

      public byte[] getSecurityEngineID()
    • getErrorCode

      public int getErrorCode()
    • getTransportMapping

      public TransportMapping<? super A> getTransportMapping()
    • setPduHandle

      public void setPduHandle(PduHandle pduHandle)
    • updateRequestStatisticsPduHandle

      protected void updateRequestStatisticsPduHandle(PduHandle pduHandle)
    • setSecurityEngineID

      public void setSecurityEngineID(byte[] securityEngineID)
    • setErrorCode

      public void setErrorCode(int errorCode)
    • setTransportMapping

      public void setTransportMapping(TransportMapping<? super A> transportMapping)
    • isMatchingMessageID

      protected boolean isMatchingMessageID(MessageID msgID)
    • isMatchingMessageID

      public boolean isMatchingMessageID(int msgID)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • equalsExceptMsgID

      public boolean equalsExceptMsgID(StateReference<?> other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • addMessageIDs

      public void addMessageIDs(List<MessageID> msgIDs)
    • getMessageIDs

      public List<MessageID> getMessageIDs()
    • createMessageID

      public static MessageID createMessageID(int msgID)