wired
libc-free QUIC/HTTP3 SDK in C for x86_64-linux
Loading...
Searching...
No Matches
srvboot.h
Go to the documentation of this file.
1#ifndef WIRED_SRVBOOT_SRVBOOT_H
2#define WIRED_SRVBOOT_SRVBOOT_H
3
9
16
69
75int wired_srvboot_is_initial(const u8* dg, usz len);
76
83int wired_srvboot_is_zerortt(const u8* dg, usz len);
84
92
99
104#define WIRED_SRVBOOT_FLIGHT_MAX 12
105
120
136 const wired_srvboot_conn* conn,
137 const wired_srvboot_in* in,
138 wired_srvboot_out* out);
139
152
156#define WIRED_SRVBOOT_ZERORTT_MAX 32
160#define WIRED_SRVBOOT_ZERORTT_DG_MAX 1500
161
207
211
227
232
238
246
260 wired_srvboot_acc* a, quic_span scid, u8* out, usz cap);
261
265
276 const wired_srvboot_conn* conn,
277 const wired_srvboot_id* id,
279 wired_srvboot_out* out);
280
294 const wired_srvboot_acc* a,
295 quic_span scid,
296 u64 error_code,
297 u8* out,
298 usz cap);
299
300#endif
RFC 9000 19.6 / 7.5: reassemble CRYPTO frames received in a Handshake (or Initial) packet payload int...
RFC 9000 17.
#define WIRED_MAX_CID_LEN
RFC 9000 17.2: longest connection id in a version 1 long header.
Definition header.h:24
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:104
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...
usz wired_srvboot_partial_ack(wired_srvboot_acc *a, quic_span scid, u8 *out, usz cap)
Seal an ACK-only server Initial acknowledging the highest Initial opened so far (RFC 9000 13....
quic_span wired_srvboot_acc_zerortt_take(const wired_srvboot_acc *a, usz i)
The i'th buffered 0-RTT datagram, verbatim as received.
#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:160
usz wired_srvboot_vneg(quic_span dg, u8 *out, usz cap)
Answer a long-header datagram of an unsupported version with a Version Negotiation packet offering th...
int wired_srvboot_acc_feed(wired_srvboot_acc *a, quic_mspan dg)
Absorb one Initial datagram: every coalesced Initial packet in it is opened with the bound ODCID's ke...
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.
#define WIRED_SRVBOOT_ZERORTT_MAX
Datagrams a boot's accumulator holds verbatim while waiting for 0-RTT keys (wired_srvboot_acc....
Definition srvboot.h:156
int wired_srvboot_acc_complete(const wired_srvboot_acc *a)
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...
usz wired_srvboot_refusal(const wired_srvboot_acc *a, quic_span scid, u64 error_code, u8 *out, usz cap)
Refuse an authenticated but unservable connection attempt: an Initial CONNECTION_CLOSE acknowledging ...
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_allow(wired_srvboot_acc *a, quic_span dcid)
Admit dcid alongside the bound one: after the server's first packet the client switches its DCID to t...
usz wired_srvboot_acc_zerortt_count(const wired_srvboot_acc *a)
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
Read-only view of a byte range.
Definition span.h:30
Parsed invariant (version-independent) packet header fields.
Definition header.h:27
Server-side handshake orchestrator state, initialized by wired_server_init.
Definition server.h:46
One nascent connection's ClientHello reassembly across Initial datagrams: a ClientHello too big for o...
Definition srvboot.h:167
u64 largest_pn
highest Initial packet number opened so far (the one the boot flight acknowledges,...
Definition srvboot.h:172
usz opened
Initial packets successfully opened so far — 0 means nothing authenticated yet and the attempt is aba...
Definition srvboot.h:175
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:201
u64 ack_pn
Next server Initial packet number for a partial-ClientHello ACK (wired_srvboot_partial_ack).
Definition srvboot.h:182
quic_crecv cr
CRYPTO stream reassembly buffer.
Definition srvboot.h:168
usz zerortt_len[WIRED_SRVBOOT_ZERORTT_MAX]
Byte length of each held 0-RTT datagram in zerortt_dg.
Definition srvboot.h:203
u8 alt_dcid_len
Length of alt_dcid; 0 while none is allowed.
Definition srvboot.h:189
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:187
int any
1 once the first datagram bound this accumulator
Definition srvboot.h:174
usz zerortt_n
Number of 0-RTT datagrams currently held.
Definition srvboot.h:205
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:169
The server orchestrator and its HTTP/3 loop, freshly cold-started by wired_srvboot_accept and driven ...
Definition srvboot.h:88
wired_server * s
server-side handshake orchestrator
Definition srvboot.h:89
wired_srvloop * l
HTTP/3 wire loop driven after the bootstrap.
Definition srvboot.h:90
The fixed server identity a bootstrap needs: the X25519 handshake key pair, the ECDSA P-256 signing s...
Definition srvboot.h:23
const quic_span * chain
optional: external chain, leaf first
Definition srvboot.h:30
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
usz chain_count
entries in chain; 0 = self-signed
Definition srvboot.h:31
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 encryption key (QUIC_TICKET_KEY_LEN bytes,...
Definition srvboot.h:67
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
The fixed server identity to boot with and the client's Initial datagram to recover the ClientHello f...
Definition srvboot.h:95
quic_mspan dgram
the client's Initial datagram
Definition srvboot.h:97
const wired_srvboot_id * id
fixed server identity to boot with
Definition srvboot.h:96
The sealed reply datagrams of a bootstrap.
Definition srvboot.h:111
usz dgram_len[WIRED_SRVBOOT_FLIGHT_MAX]
each flight datagram's length
Definition srvboot.h:114
quic_obuf * initial
sealed server Initial datagram (>= 1200 bytes)
Definition srvboot.h:112
u64 client_pn
the client Initial's recovered packet number (the one the server Initial acknowledges,...
Definition srvboot.h:117
usz dgram_count
flight datagrams sealed (their lengths sum to flight->len)
Definition srvboot.h:115
quic_obuf * flight
all sealed Handshake datagrams, concatenated
Definition srvboot.h:113
Per-connection state of the server wire loop, re-armed by wired_srvloop_init and driven by wired_srvl...
Definition srvloop.h:345
u64 usz
unsigned size (size_t equivalent)
Definition syscall.h:19
unsigned char u8
unsigned 8-bit integer / byte
Definition syscall.h:17
unsigned long u64
unsigned 64-bit integer
Definition syscall.h:12