Module org.snmp4j
Package org.snmp4j.mp

Class StateReference<A extends Address>

  • All Implemented Interfaces:
    java.io.Serializable
    Direct Known Subclasses:
    MPv3.CacheEntry

    public class StateReference<A extends Address>
    extends java.lang.Object
    implements java.io.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:
    Serialized Form
    • Field Detail

      • retryMsgIDs

        protected java.util.List<MessageID> retryMsgIDs
    • Constructor Detail

      • 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 Detail

      • 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)
      • 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)
      • setMsgID

        public void setMsgID​(MessageID msgID)
      • setMsgID

        public void setMsgID​(int msgID)
      • 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()
      • 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​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • equalsExceptMsgID

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

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

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

        public void addMessageIDs​(java.util.List<MessageID> msgIDs)
      • getMessageIDs

        public java.util.List<MessageID> getMessageIDs()
      • createMessageID

        protected MessageID createMessageID​(int msgID)