|
wired
libc-free QUIC/HTTP3 SDK in C for x86_64-linux
|
Value-type views that fold the SDK's recurring argument shapes into single parameters, keeping every function at <=3 args without a calling cost: More...
#include "common/platform/sys/syscall.h"Go to the source code of this file.
Data Structures | |
| struct | quic_span |
| Read-only view of a byte range. More... | |
| struct | quic_mspan |
| Mutable view of a byte range. More... | |
| struct | quic_obuf |
| Growing output buffer view for variable-length results. More... | |
Functions | |
| static quic_span | quic_span_of (const u8 *p, usz n) |
| Make a read-only span over p[0..n). | |
| static quic_mspan | quic_mspan_of (u8 *p, usz n) |
| Make a mutable span over p[0..n). | |
| static quic_obuf | quic_obuf_of (u8 *p, usz cap) |
| Make an output buffer over p[0..cap) with len starting at 0. | |
Value-type views that fold the SDK's recurring argument shapes into single parameters, keeping every function at <=3 args without a calling cost:
(const u8 *p, usz n) -> quic_span (by value: 16 bytes, two (u8 *p, usz n) -> quic_mspan registers under SysV, the same as the loose pair) (u8 *out, usz cap, usz *out_len)-> quic_obuf * (one register instead of three; callee fills .len)
These are views, not owners: a span never copies and never frees. The caller's buffer must stay alive for as long as the span (or anything the span was handed to) is in use. Build them with the quic_span_of / quic_mspan_of / quic_obuf_of constructors below.
|
inlinestatic |
Make a mutable span over p[0..n).
The span borrows p; the buffer must outlive every use of the returned value. Example: quic_mspan out = quic_mspan_of(key, sizeof key);
| p | first byte of the writable range |
| n | number of writable bytes |
Make an output buffer over p[0..cap) with len starting at 0.
The buffer borrows p; the storage must outlive every use of the returned value. Pass its address to the producing call and read .len afterwards: quic_obuf ob = quic_obuf_of(buf, sizeof buf); ... use ob.len.
| p | caller-provided storage |
| cap | capacity of p in bytes |
Make a read-only span over p[0..n).
The span borrows p; the buffer must outlive every use of the returned value. Example: quic_span msg = quic_span_of(buf, buf_len);
| p | first byte of the range (may be 0 when n is 0) |
| n | number of readable bytes |