Record Class PacketHeader.Short
java.lang.Object
java.lang.Record
io.github.mahmoudimus.quic.packet.PacketHeader.Short
- Record Components:
spin- the latency spin bitkeyPhase- the key phase bitdestinationId- the Destination Connection IDpacketNumber- the full packet numberpacketNumberLength- the packet number length on the wire, 1 to 4
- All Implemented Interfaces:
PacketHeader,PacketHeader.Numbered
- Enclosing interface:
PacketHeader
public static record PacketHeader.Short(boolean spin, boolean keyPhase, ConnectionId destinationId, long packetNumber, int packetNumberLength)
extends Record
implements PacketHeader.Numbered
A short (1-RTT) packet header (RFC 9000 section 17.3.1). It carries no version: the
connection's version applies.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.github.mahmoudimus.quic.packet.PacketHeader
PacketHeader.Handshake, PacketHeader.Initial, PacketHeader.Numbered, PacketHeader.Retry, PacketHeader.Short, PacketHeader.VersionNegotiation, PacketHeader.ZeroRtt -
Field Summary
Fields inherited from interface io.github.mahmoudimus.quic.packet.PacketHeader
FIXED_BIT, KEY_PHASE_BIT, LONG_HEADER_FORM, LONG_RESERVED_BITS, SHORT_RESERVED_BITS, SPIN_BIT -
Constructor Summary
ConstructorsConstructorDescriptionShort(boolean spin, boolean keyPhase, ConnectionId destinationId, long packetNumber, int packetNumberLength) A short header. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thedestinationIdrecord component.encode(ByteBuffer out) Writes the header at the buffer's position.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleankeyPhase()Returns the value of thekeyPhaserecord component.longReturns the value of thepacketNumberrecord component.intReturns the value of thepacketNumberLengthrecord component.booleanspin()Returns the value of thespinrecord component.final StringtoString()Returns a string representation of this record class.type()The packet type.
-
Constructor Details
-
Short
public Short(boolean spin, boolean keyPhase, ConnectionId destinationId, long packetNumber, int packetNumberLength) A short header.- Parameters:
spin- the latency spin bitkeyPhase- the key phase bitdestinationId- the Destination Connection IDpacketNumber- the full packet numberpacketNumberLength- the packet number length on the wire, 1 to 4
-
-
Method Details
-
type
Description copied from interface:PacketHeaderThe packet type.- Specified by:
typein interfacePacketHeader- Returns:
- the type
-
encode
Description copied from interface:PacketHeaderWrites the header at the buffer's position.- Specified by:
encodein interfacePacketHeader- Parameters:
out- the buffer- Returns:
- where the fields landed
-
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
spin
public boolean spin()Returns the value of thespinrecord component.- Returns:
- the value of the
spinrecord component
-
keyPhase
public boolean keyPhase()Returns the value of thekeyPhaserecord component.- Returns:
- the value of the
keyPhaserecord component
-
destinationId
Returns the value of thedestinationIdrecord component.- Specified by:
destinationIdin interfacePacketHeader- Returns:
- the value of the
destinationIdrecord component
-
packetNumber
public long packetNumber()Returns the value of thepacketNumberrecord component.- Specified by:
packetNumberin interfacePacketHeader.Numbered- Returns:
- the value of the
packetNumberrecord component
-
packetNumberLength
public int packetNumberLength()Returns the value of thepacketNumberLengthrecord component.- Specified by:
packetNumberLengthin interfacePacketHeader.Numbered- Returns:
- the value of the
packetNumberLengthrecord component
-