Module org.snmp4j

Interface MessageLengthDecoder

  • All Known Implementing Classes:
    DefaultTcpTransportMapping.SnmpMesssageLengthDecoder

    public interface MessageLengthDecoder
    The MessageLengthDecoder needs to be implemented for connection oriented transport mappings, because those transport mappings have no message boundaries. To determine the message length, the message header is decoded in a protocol specific way.
    Since:
    1.7
    Version:
    1.7
    Author:
    Frank Fock
    • Method Detail

      • getMinHeaderLength

        int getMinHeaderLength()
        Returns the minimum length of the header to be decoded. Typically this is a constant value.
        Returns:
        the minimum length in bytes.
      • getMessageLength

        MessageLength getMessageLength​(java.nio.ByteBuffer buf)
                                throws java.io.IOException
        Returns the total message length to read (including header) and the actual header length.
        Parameters:
        buf - a ByteBuffer with a minimum of getMinHeaderLength().
        Returns:
        the total message length in bytes and the actual header length in bytes.
        Throws:
        java.io.IOException - if the header cannot be decoded.