APIdia Launch Partner
Top Description Inners Fields Constructors Methods
jdk.internal.net.http.quic

public final Class QuicTransportParameters

extends Object
Class Inheritance
Imports
java.net.Inet4Address, .Inet6Address, .InetAddress, .InetSocketAddress, .UnknownHostException, java.nio.BufferOverflowException, .ByteBuffer, .ByteOrder, java.util.EnumMap, .HexFormat, .List, .Locale, .Map, .Optional, java.util.stream.Stream, jdk.internal.net.http.common.Log, jdk.internal.net.quic.QuicTransportErrors, .QuicTransportException, .QuicTransportParametersConsumer, .QuicVersion

This class models a collection of Quic transport parameters. This class is mutable and not thread safe. A parameter is considered absent if getParameter(TransportParameterId) yields null. The parameter is present otherwise. Parameters can be removed by calling setParameter(id, null). The methods getBooleanParameter(TransportParameterId) and getIntParameter(TransportParameterId) allow easy access to parameters whose type is boolean or int, respectively. When such a parameter is absent, its default value is returned by those methods. From RFC 9000, section 18.2:
Many transport parameters listed here have integer values.
Those transport parameters that are identified as integers use a
variable-length integer encoding; see Section 16. Transport parameters
have a default value of 0 if the transport parameter is absent, unless
otherwise stated.

[...]

If present, transport parameters that set initial per-stream flow control limits
(initial_max_stream_data_bidi_local, initial_max_stream_data_bidi_remote, and
initial_max_stream_data_uni) are equivalent to sending a MAX_STREAM_DATA frame
(Section 19.10) on every stream of the corresponding type immediately after opening.
If the transport parameter is absent, streams of that type start with a flow control
limit of 0.

A client MUST NOT include any server-only transport parameter:
       original_destination_connection_id,
       preferred_address,
       retry_source_connection_id, or
       stateless_reset_token.

A server MUST treat receipt of any of these transport parameters as a connection error
of type TRANSPORT_PARAMETER_ERROR.
External Specification
https://www.rfc-editor.org/info/rfc9000
See Also
ParameterId

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
QuicTransportParameters.ParameterId

Standard Quic transport parameter names and ids.

public static interface
QuicTransportParameters.TransportParameterId

An interface to model a transport parameter ID. A transport parameter ID has a name (which is not transmitted) and an identifier.

public static record

Field Summary

Modifier and TypeField and Description
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final byte[]
pack-priv static final int
pack-priv static final int
private final Map<QuicTransportParameters.ParameterId, byte[]>
values

A map to store transport parameter values.

Constructor Summary

AccessConstructor and Description
public
QuicTransportParameters()

Constructs a new empty array of Quic transport parameters.

public
QuicTransportParameters(QuicTransportParameters
the parameter collection used to initialize this object *
params
)

Constructs a new collection of Quic transport parameters initialized from the specified collection.

Method Summary

Modifier and TypeMethod and Description
public static QuicTransportParameters.VersionInformation

Returns:

a VersionInformation object corresponding to the specified versions
buildVersionInformation
(QuicVersion
chosen version
chosenVersion
,
List<QuicVersion>
available versions
availableVersions
)

Returns a VersionInformation object corresponding to the specified versions.

private static QuicTransportParameters.ParameterId

Returns:

the corresponding parameter id if the value is acceptable, else throws a IllegalArgumentException
checkParameterValue
(QuicTransportParameters.TransportParameterId
the transport parameter id
tpid
,
byte[]
the value
value
)

verifies that the value is acceptable (as specified in the RFC) for the tpid

public static QuicTransportParameters

Returns:

the decoded transport parameters
decode
(ByteBuffer
a byte buffer containing the transport parameters
buffer
)

Decodes the quic transport parameters from the given buffer.

private static long
public int

Returns:

the number of bytes written
encode
(ByteBuffer
a byte buffer in which to encode the transport parameters
buffer
)

Encodes the transport parameters into the given byte buffer.

public boolean

Returns:

the value of the given parameter, as a boolean
getBooleanParameter
(QuicTransportParameters.TransportParameterId
the parameter id
id
)

Returns the value of the given parameter, as a boolean.

private static InetAddress
public long

Returns:

the value of the given parameter, as an unsigned int in the range [0, 2^62 - 1]
getIntParameter
(QuicTransportParameters.TransportParameterId
the parameter id
id
)

Returns the value of the given parameter, as an unsigned int in the range [0, 2^62 - 1].

private long
public long

Returns:

the value of the given parameter, as an unsigned int in the range [0, 2^62 - 1]
getIntParameter
(QuicTransportParameters.TransportParameterId
the parameter id
id
,
long defaultValue)

Returns the value of the given parameter, as an unsigned int in the range [0, 2^62 - 1].

public byte[]
getParameter(QuicTransportParameters.TransportParameterId
the parameter id
id
)

{@return the value of the given parameter, as a byte array, or null if the parameter is absent.

public static List<InetSocketAddress>

Returns:

a list of InetSocketAddress, or null if the given value is null.
getPreferredAddress
(QuicTransportParameters.TransportParameterId
the parameter id
id
,
byte[]
the value of the parameter
value
)

Reads the preferred address encoded in the value of a parameter whose format corresponds to the ParameterId#preferred_address parameter.

public static ByteBuffer

Returns:

the connection id bytes
getPreferredConnectionId
(final byte[] preferredAddressValue)

Reads the connection id bytes from the value of a parameter whose format corresponds to the ParameterId#preferred_address parameter.

private static int
public static byte[]

Returns:

the stateless reset token bytes
getPreferredStatelessResetToken
(final byte[] preferredAddressValue)

Reads the stateless token bytes from the value of a parameter whose format corresponds to the ParameterId#preferred_address parameter.

public QuicTransportParameters.VersionInformation

Returns:

the value of the given parameter, as VersionInformation
getVersionInformationParameter
(QuicTransportParameters.TransportParameterId
the parameter id
id
)

Returns the value of the given parameter, as VersionInformation.

public boolean

Returns:

true if the given parameter is present, false otherwise
isPresent
(QuicTransportParameters.TransportParameterId
the parameter id
id
)

Returns true if the given parameter is present, false otherwise.

public boolean

Returns:

true if the value of the given parameter matches the given connection ID
matches
(QuicTransportParameters.TransportParameterId
the transport parameter id
id
,
QuicConnectionId
the connection id to match against
connectionId
)

Returns true if the value of the given parameter matches the given connection ID.

public void
setBooleanParameter(QuicTransportParameters.TransportParameterId
the parameter id
id
,
boolean
the new value of the parameter
value
)

Sets the value of the given parameter, as a boolean.

public void
setIntParameter(QuicTransportParameters.TransportParameterId
the parameter id
id
,
long
the new value of the parameter, or a negative value
value
)

Sets the value of the given parameter, as an unsigned int.

private void
public void
setParameter(QuicTransportParameters.TransportParameterId
the parameter id
id
,
byte[]
the new parameter value, or null.
value
)

Sets the value of the given parameter.

public void
setPreferredAddressParameter(QuicTransportParameters.TransportParameterId
the parameter id
id
,
Inet4Address
the preferred IPv4 address (or the IPv4 wildcard address)
ipv4
,
int
the preferred IPv4 port (or 0)
port4
,
Inet6Address
the preferred IPv6 address (or the IPv6 wildcard address)
ipv6
,
int
the preferred IPv6 port (or 0)
port6
,
ByteBuffer
the connection id bytes
connectionId
,
ByteBuffer
the stateless token
statelessToken
)

Sets the value of a parameter whose format corresponds to the ParameterId#preferred_address parameter.

public void
setVersionInformationParameter(QuicTransportParameters.TransportParameterId
the parameter id
id
,
QuicTransportParameters.VersionInformation
the new value of the parameter
value
)

Sets the value of the given parameter, as VersionInformation.

public int

Returns:

the size in bytes required to encode the parameter array
size
()

Returns the size in bytes required to encode the parameter array.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public String
private String
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait