Class NrpePacket


  • public class NrpePacket
    extends Object

    NrpePacket class.

    Version:
    $Id: $
    Author:
    ranger
    • Field Detail

      • QUERY_PACKET

        public static final short QUERY_PACKET
        Constant QUERY_PACKET=1
        See Also:
        Constant Field Values
      • RESPONSE_PACKET

        public static final short RESPONSE_PACKET
        Constant RESPONSE_PACKET=2
        See Also:
        Constant Field Values
      • PACKET_VERSION_2

        public static final short PACKET_VERSION_2
        Constant PACKET_VERSION_2=2
        See Also:
        Constant Field Values
      • MAX_PACKETBUFFER_LENGTH

        public static final int MAX_PACKETBUFFER_LENGTH
        Constant MAX_PACKETBUFFER_LENGTH=1024
        See Also:
        Constant Field Values
      • PACKET_SIZE

        public static final int PACKET_SIZE
        Constant PACKET_SIZE=2 + // packet version, 16 bit integer 2 + // packet type, 16 bit integer 4 + // crc32, 32 bit unsigned integer 2 + // result code MAX_PACKETBUFFER_LENGTH
        See Also:
        Constant Field Values
      • DEFAULT_PADDING

        public static final int DEFAULT_PADDING
        Constant DEFAULT_PADDING=2
        See Also:
        Constant Field Values
    • Constructor Detail

      • NrpePacket

        public NrpePacket()

        Constructor for NrpePacket.

      • NrpePacket

        public NrpePacket​(short type,
                          short resultCode,
                          String buffer)

        Constructor for NrpePacket.

        Parameters:
        type - a short.
        resultCode - a short.
        buffer - a String object.
    • Method Detail

      • getVersion

        public short getVersion()

        getVersion

        Returns:
        a short.
      • setVersion

        public void setVersion​(short version)

        setVersion

        Parameters:
        version - a short.
      • getType

        public short getType()

        getType

        Returns:
        a short.
      • setType

        public void setType​(short type)

        setType

        Parameters:
        type - a short.
      • getResultCode

        public short getResultCode()

        getResultCode

        Returns:
        a short.
      • setResultCode

        public void setResultCode​(short resultCode)

        setResultCode

        Parameters:
        resultCode - a short.
      • getBuffer

        public String getBuffer()

        getBuffer

        Returns:
        a String object.
      • setBuffer

        public void setBuffer​(String buffer)

        setBuffer

        Parameters:
        buffer - a String object.
      • positive

        public static int positive​(byte b)

        positive

        Parameters:
        b - a byte.
        Returns:
        a int.
      • buildPacket

        public byte[] buildPacket​(int padding)

        buildPacket

        Parameters:
        padding - a int.
        Returns:
        an array of byte.
      • buildPacket

        public byte[] buildPacket​(int padding,
                                  SecureRandom random)

        buildPacket

        Parameters:
        padding - a int.
        random - a SecureRandom object.
        Returns:
        an array of byte.