1#ifndef WIRED_SRVBOOT_SRVBOOT_H
2#define WIRED_SRVBOOT_SRVBOOT_H
122#define WIRED_SRVBOOT_FLIGHT_MAX 12
174#define WIRED_SRVBOOT_ZERORTT_MAX 32
178#define WIRED_SRVBOOT_ZERORTT_DG_MAX 1500
335#define WIRED_SRVBOOT_HRR 2
RFC 9000 19.6 / 7.5: reassemble CRYPTO frames received in a Handshake (or Initial) packet payload int...
RFC 9001 4 / 4.1.2, RFC 8446 4 / 4.4.4, RFC 9000 7: server-side handshake orchestrator,...
Value-type views that fold the SDK's recurring argument shapes into single parameters,...
#define WIRED_SRVBOOT_FLIGHT_MAX
Most Handshake flight datagrams a bootstrap seals: sized past quic-interop-runner's deliberately infl...
Definition srvboot.h:122
int wired_srvboot_is_initial(const u8 *dg, usz len)
RFC 9000 17.2: 1 if dg is a long-header Initial datagram (a Handshake or short-header packet is the l...
#define WIRED_SRVBOOT_ZERORTT_DG_MAX
Byte capacity of one buffered 0-RTT datagram: past RFC 9000 14.1's 1200-byte Initial floor and a real...
Definition srvboot.h:178
u64 wired_srvboot_flight_pn(wired_srvboot_acc *a)
The accept flight's server Initial packet number: 1, or the next unused pn from the partial-ack count...
int wired_srvboot_is_zerortt(const u8 *dg, usz len)
RFC 9000 17.2.3: 1 if dg is a long-header 0-RTT datagram.
usz wired_srvboot_vneg(wired_span dg, u8 *out, usz cap)
Answer a long-header datagram of an unsupported version with a Version Negotiation packet offering th...
#define WIRED_SRVBOOT_ZERORTT_MAX
Datagrams a boot's accumulator holds verbatim while waiting for 0-RTT keys (wired_srvboot_acc....
Definition srvboot.h:174
usz wired_srvboot_partial_ack(wired_srvboot_acc *a, wired_span scid, u8 *out, usz cap)
Seal an ACK-only server Initial acknowledging the highest Initial opened so far (RFC 9000 13....
int wired_srvboot_acc_complete(const wired_srvboot_acc *a)
int wired_srvboot_acc_feed(wired_srvboot_acc *a, wired_mspan dg)
Absorb one Initial datagram: every coalesced Initial packet in it is opened with the bound ODCID's ke...
int wired_srvboot_accept(const wired_srvboot_conn *conn, const wired_srvboot_in *in, wired_srvboot_out *out)
Recover the ClientHello from the protected Initial datagram, initialize the server and its HTTP/3 loo...
wired_span wired_srvboot_acc_zerortt_take(const wired_srvboot_acc *a, usz i)
The i'th buffered 0-RTT datagram, verbatim as received.
void wired_srvboot_acc_hold(wired_srvboot_acc *a, wired_mspan dg)
RFC 9001 4.6.1 / 5.7: buffer dg verbatim for later replay – a 0-RTT datagram arriving before this boo...
int wired_srvboot_accept_acc(const wired_srvboot_conn *conn, const wired_srvboot_id *id, wired_srvboot_acc *a, wired_srvboot_out *out)
Cold-start the connection from a completed accumulator: initialize the server and loop from the bound...
void wired_srvboot_acc_ecn_note(wired_srvboot_acc *a, u8 ecn)
RFC 9000 13.4.1: count one received datagram's ECN codepoint (RFC 3168: 0 Not-ECT,...
usz wired_srvboot_acc_zerortt_count(const wired_srvboot_acc *a)
usz wired_srvboot_refusal(const wired_srvboot_acc *a, wired_span scid, u64 error_code, u8 *out, usz cap)
Refuse an authenticated but unservable connection attempt: an Initial CONNECTION_CLOSE acknowledging ...
void wired_srvboot_acc_allow(wired_srvboot_acc *a, wired_span dcid)
Admit dcid alongside the bound one: after the server's first packet the client switches its DCID to t...
void wired_srvboot_acc_reset(wired_srvboot_acc *a)
Empty the accumulator for a fresh connection attempt.
RFC 9001 4 / 5 / RFC 9000 17.2: the socket-free core of the server wire loop.
CRYPTO stream reassembly state.
Definition collect.h:16
Mutable view of a byte range.
Definition span.h:42
Growing output buffer view for variable-length results.
Definition span.h:54
Server-side handshake orchestrator state, initialized by wired_server_init.
Definition server.h:46
Read-only view of a byte range.
Definition span.h:30
One nascent connection's ClientHello reassembly across Initial datagrams: a ClientHello too big for o...
Definition srvboot.h:185
u64 ecn_ce
Cumulative count of CE-marked datagrams (see ecn_ect0).
Definition srvboot.h:222
u64 largest_pn
highest Initial packet number opened so far (the one the boot flight acknowledges,...
Definition srvboot.h:190
crecv cr
CRYPTO stream reassembly buffer.
Definition srvboot.h:186
usz hrr_off
RFC 8446 4.1.4: crypto-stream offset the retried ClientHello2 starts at (= ClientHello1's full length...
Definition srvboot.h:206
u64 ecn_ect0
RFC 9000 13.4.1: cumulative ECN counts of the datagrams this boot has physically received (wired_srvb...
Definition srvboot.h:218
usz opened
Initial packets successfully opened so far — 0 means nothing authenticated yet and the attempt is aba...
Definition srvboot.h:193
u8 zerortt_dg[WIRED_SRVBOOT_ZERORTT_MAX][WIRED_SRVBOOT_ZERORTT_DG_MAX]
RFC 9001 4.6.1: 0-RTT datagrams arrive interleaved with the Initials this accumulator is reassembling...
Definition srvboot.h:241
u64 ecn_ect1
Cumulative count of ECT(1)-marked datagrams (see ecn_ect0).
Definition srvboot.h:220
u64 ack_pn
Next server Initial packet number for a partial-ClientHello ACK (wired_srvboot_partial_ack).
Definition srvboot.h:200
usz zerortt_len[WIRED_SRVBOOT_ZERORTT_MAX]
Byte length of each held 0-RTT datagram in zerortt_dg.
Definition srvboot.h:243
u8 alt_dcid_len
Length of alt_dcid; 0 while none is allowed.
Definition srvboot.h:229
u8 alt_dcid[WIRED_MAX_CID_LEN]
An additional DCID admitted alongside the bound one (wired_srvboot_acc_allow): the server's own scid,...
Definition srvboot.h:227
int any
1 once the first datagram bound this accumulator
Definition srvboot.h:192
usz zerortt_n
Number of 0-RTT datagrams currently held.
Definition srvboot.h:245
wired_header hdr
the first datagram's header: its DCID is the ODCID the Initial keys derive from (fixed for the whole ...
Definition srvboot.h:187
usz ini_tx_off
RFC 9000 19.6: the server->client Initial crypto stream's next send offset – the HelloRetryRequest's ...
Definition srvboot.h:211
The server orchestrator and its HTTP/3 loop, freshly cold-started by wired_srvboot_accept and driven ...
Definition srvboot.h:106
wired_server * s
server-side handshake orchestrator
Definition srvboot.h:107
wired_srvloop * l
HTTP/3 wire loop driven after the bootstrap.
Definition srvboot.h:108
The fixed server identity a bootstrap needs: the X25519 handshake key pair, the ECDSA P-256 signing s...
Definition srvboot.h:23
u64 now_secs
RFC 5280 4.1.2.5.1: UNIX epoch seconds the self-signed certificate's validity window is anchored to (...
Definition srvboot.h:54
u64 max_streams_bidi
advertised initial_max_streams_bidi; 0 = default
Definition srvboot.h:33
u64 max_datagram_frame_size
advertised max_datagram_frame_size (RFC 9221 3); 0 = not advertised (no default – opt in once DATAGRA...
Definition srvboot.h:34
const u8 * priv
X25519 private, 32 bytes.
Definition srvboot.h:24
const u8 * retry_odcid
RFC 9000 7.3 after a Retry: the true original DCID (recovered from the validated Retry token) to adve...
Definition srvboot.h:60
u64 max_data
advertised initial_max_data; 0 = default
Definition srvboot.h:32
const u8 * random
ServerHello.random, 32 bytes.
Definition srvboot.h:29
const u8 * cert_seed
ECDSA P-256 signing scalar, 32 bytes.
Definition srvboot.h:26
const u8 * pref_v6
16 bytes; required when pref_v4 is set
Definition srvboot.h:75
const u8 * pref_v4
RFC 9000 9.6: the preferred_address this server advertises – both addresses in network byte order,...
Definition srvboot.h:74
const wired_span * chain
optional: external chain, leaf first
Definition srvboot.h:30
usz chain_count
entries in chain; 0 = self-signed
Definition srvboot.h:31
u16 pref_v6_port
port of pref_v6
Definition srvboot.h:77
const u8 * scid
server source connection id
Definition srvboot.h:27
u8 scid_len
scid length in octets, at most 20
Definition srvboot.h:28
const u8 * ticket_key
RFC 8446 4.6.1: this server's session-ticket key seed (TICKET_KEY_LEN bytes), or 0 to disable session...
Definition srvboot.h:68
const char * raw_alpns
RFC 7301 3.2 / draft-ietf-moq-transport-22 6.1.2: raw-QUIC application ALPN ids this server also sele...
Definition srvboot.h:85
const u8 * san_ipv4
RFC 5280 4.2.1.6: 4-byte IPv4 address (network byte order) added to the self-signed certificate's Sub...
Definition srvboot.h:45
u8 retry_odcid_len
Bytes at retry_odcid; 0 = no Retry preceded this accept.
Definition srvboot.h:62
const u8 * pub
X25519 public, 32 bytes.
Definition srvboot.h:25
u16 pref_v4_port
port of pref_v4
Definition srvboot.h:76
The fixed server identity to boot with and the client's Initial datagram to recover the ClientHello f...
Definition srvboot.h:113
wired_mspan dgram
the client's Initial datagram
Definition srvboot.h:115
const wired_srvboot_id * id
fixed server identity to boot with
Definition srvboot.h:114
The sealed reply datagrams of a bootstrap.
Definition srvboot.h:129
usz dgram_len[WIRED_SRVBOOT_FLIGHT_MAX]
each flight datagram's length
Definition srvboot.h:132
wired_obuf * flight
all sealed Handshake datagrams, concatenated
Definition srvboot.h:131
u64 client_pn
the client Initial's recovered packet number (the one the server Initial acknowledges,...
Definition srvboot.h:135
usz dgram_count
flight datagrams sealed (their lengths sum to flight->len)
Definition srvboot.h:133
wired_obuf * initial
sealed server Initial datagram (>= 1200 bytes)
Definition srvboot.h:130
Per-connection state of the server wire loop, re-armed by wired_srvloop_init and driven by wired_srvl...
Definition srvloop.h:537
u64 usz
unsigned size (size_t equivalent)
Definition types.h:20
unsigned short u16
unsigned 16-bit integer
Definition types.h:17
unsigned char u8
unsigned 8-bit integer / byte
Definition types.h:18
unsigned long u64
unsigned 64-bit integer
Definition types.h:13