Class NTSKERecord

java.lang.Object
nts.NTSKERecords.NTSKERecord
Direct Known Subclasses:
AEADAlgorithmNegotiation, EndOfMessage, Error, NewCookieForNTPv4, NTPv4PortNegotiation, NTPv4ServerNegotiation, NTSNextProtocolNegotiation, Warning

public class NTSKERecord extends Object
  • Field Details

    • criticalBit

      public int criticalBit
    • recordType_raw

      public int recordType_raw
    • recordType

      public NTSKERecordType recordType
    • bodyLength

      public int bodyLength
    • recordBody

      public byte[] recordBody
  • Constructor Details

    • NTSKERecord

      public NTSKERecord(int criticalBit, int recordType, int bodyLength, byte[] recordBody)
      Constructor for NTSKERecord from arbitrary parameters.
      Parameters:
      criticalBit - 0 or 1 to indicate if an error should be raised if the record is not understood.
      recordType - the type of the record, as defined in NTSKERecordType, encoded in 15 bits.
      bodyLength - the length of the record body in octets, encoded in 2 bytes.
      recordBody - the body of the record, which can be empty.
    • NTSKERecord

      public NTSKERecord(byte[] raw_record)
      Constructor for NTSKERecord from a raw byte array.
      Parameters:
      raw_record - the raw byte array containing the record data.
  • Method Details

    • toBytes

      public byte[] toBytes()
      Converts the NTSKERecord to a byte array to be send over the network.
      Returns:
      the byte array representation of the record.
    • toString

      public String toString()
      Converts the NTSKERecord to a string representation for debugging purposes.
      Overrides:
      toString in class Object
      Returns:
      the string representation of the record.
    • toByteString

      public String toByteString()
      Converts the NTSKERecord to a byte string representation for debugging purposes.
      Returns:
      the byte string representation of the record.