wired
libc-free QUIC/HTTP3 SDK in C for x86_64-linux
Loading...
Searching...
No Matches
control_settings.h
1#ifndef H3SETTINGS_CONTROL_SETTINGS_H
2#define H3SETTINGS_CONTROL_SETTINGS_H
3
4#include "app/http3/core/h3settings/settings_build.h"
5#include "app/qpack/qpack/dyntable.h"
7
17#define WIRED_H3_MAX_FIELD_SECTION 2048
18
23#define DEFAULT_QPACK_MAX_TABLE_CAP QPACK_DYN_MAX_CAPACITY
24
30#define H3SETTINGS_CONTROL_STREAM_MAX 96
31
32/* RFC 9114 6.2.1 / 7.2.4: the opening bytes of an HTTP/3 control stream:
33 * stream type 0x00 followed by a SETTINGS frame with default values. When
34 * advertise_wt is non-zero the SETTINGS additionally carry SETTINGS_H3_
35 * DATAGRAM=1 (RFC 9297 2.1.1) and SETTINGS_WEBTRANSPORT_MAX_SESSIONS=1
36 * (draft-ietf-webtrans-http3 8.2) -- the pair a browser requires before it
37 * will open a WebTransport session; only advertise it when the QUIC
38 * transport also negotiated max_datagram_frame_size (RFC 9297 2.1.1 makes
39 * that a MUST). Returns 1 ok with *out_len set, 0 if no room. */
40int h3settings_control_stream(int advertise_wt, u8* out, usz cap, usz* out_len);
41
42/* RFC 9297 2.1.1 / 9297-014: "When servers decide to accept 0-RTT data, they
43 * MUST send a SETTINGS_H3_DATAGRAM setting greater than or equal to the
44 * value they sent to the client in the connection where they sent them the
45 * NewSessionTicket message." A pure predicate: the caller supplies both the
46 * value remembered from the ticket-issuing connection (prior_value) and the
47 * value this 0-RTT-accepting connection is about to send (new_value) --
48 * mirrors zerortt_policy.h's zerortt_replay_ok, which likewise leaves
49 * resolving/storing its own inputs to the caller rather than owning state
50 * itself.
51 * @param prior_value the SETTINGS_H3_DATAGRAM value sent when the resumed
52 * ticket was issued
53 * @param new_value the value this connection is about to send
54 * @return 1 if new_value >= prior_value (ok to send), 0 if it would regress
55 * (H3_SETTINGS_ERROR territory on the client's own validation side) */
56int h3settings_h3_datagram_monotonic_ok(u64 prior_value, u64 new_value);
57
58/* RFC 9114 7.2.4.2 (9114-066): "If the server cannot determine that the
59 * settings remembered by a client are compatible with its current
60 * settings, it MUST NOT accept 0-RTT data. Remembered settings are
61 * compatible if a client complying with those settings would not violate
62 * the server's current settings." Every settings value this SDK sends
63 * (settings_build.h's h3settings_in, minus grease_id -- a
64 * per-connection random reserved identifier the client is required to
65 * ignore regardless of value, RFC 9114 7.2.8) is a limit that only gets
66 * MORE permissive as it grows (a higher table capacity, more blocked
67 * streams, a larger field section, or datagram/CONNECT-protocol/WebTransport
68 * support switched on rather than off); a client complying with `prior`
69 * cannot be violated by `current` as long as every one of those fields in
70 * `current` is at least as permissive as in `prior`.
71 * @param prior the settings sent on the connection that issued the
72 * resumed ticket (what the client remembers and complies with)
73 * @param current the settings this connection is about to send while
74 * accepting 0-RTT
75 * @return 1 if compatible (safe to accept 0-RTT), 0 if not (the caller
76 * MUST NOT accept 0-RTT data) */
77int h3settings_zerortt_compatible(
78 const h3settings_in* prior, const h3settings_in* current);
79
80#endif
The common HTTP/3 + QPACK settings values to encode.
Definition settings_build.h:8
Linux direct syscalls.
u64 usz
unsigned size (size_t equivalent)
Definition types.h:20
unsigned char u8
unsigned 8-bit integer / byte
Definition types.h:18
unsigned long u64
unsigned 64-bit integer
Definition types.h:13