Record Class PacketHeader.Handshake

java.lang.Object
java.lang.Record
io.github.mahmoudimus.quic.packet.PacketHeader.Handshake
Record Components:
version - the QUIC version
destinationId - the Destination Connection ID
sourceId - the Source Connection ID
packetNumber - the full packet number
packetNumberLength - the packet number length on the wire, 1 to 4
All Implemented Interfaces:
PacketHeader, PacketHeader.Numbered
Enclosing interface:
PacketHeader

public static record PacketHeader.Handshake(QuicVersion version, ConnectionId destinationId, ConnectionId sourceId, long packetNumber, int packetNumberLength) extends Record implements PacketHeader.Numbered
A Handshake packet header (RFC 9000 section 17.2.4).
  • Constructor Details

    • Handshake

      public Handshake(QuicVersion version, ConnectionId destinationId, ConnectionId sourceId, long packetNumber, int packetNumberLength)
      A Handshake header.
      Parameters:
      version - the QUIC version
      destinationId - the Destination Connection ID
      sourceId - the Source Connection ID
      packetNumber - the full packet number
      packetNumberLength - the packet number length on the wire, 1 to 4
  • Method Details

    • type

      public PacketType type()
      Description copied from interface: PacketHeader
      The packet type.
      Specified by:
      type in interface PacketHeader
      Returns:
      the type
    • encode

      public HeaderLayout encode(ByteBuffer out)
      Description copied from interface: PacketHeader
      Writes the header at the buffer's position.
      Specified by:
      encode in interface PacketHeader
      Parameters:
      out - the buffer
      Returns:
      where the fields landed
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • version

      public QuicVersion version()
      Returns the value of the version record component.
      Returns:
      the value of the version record component
    • destinationId

      public ConnectionId destinationId()
      Returns the value of the destinationId record component.
      Specified by:
      destinationId in interface PacketHeader
      Returns:
      the value of the destinationId record component
    • sourceId

      public ConnectionId sourceId()
      Returns the value of the sourceId record component.
      Returns:
      the value of the sourceId record component
    • packetNumber

      public long packetNumber()
      Returns the value of the packetNumber record component.
      Specified by:
      packetNumber in interface PacketHeader.Numbered
      Returns:
      the value of the packetNumber record component
    • packetNumberLength

      public int packetNumberLength()
      Returns the value of the packetNumberLength record component.
      Specified by:
      packetNumberLength in interface PacketHeader.Numbered
      Returns:
      the value of the packetNumberLength record component