|
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 | wired_span |
| Read-only view of a byte range. More... | |
| struct | wired_mspan |
| Mutable view of a byte range. More... | |
| struct | wired_obuf |
| Growing output buffer view for variable-length results. More... | |
Functions | |
| static wired_span | wired_span_of (const u8 *p, usz n) |
| Make a read-only span over p[0..n). | |
| static wired_mspan | wired_mspan_of (u8 *p, usz n) |
| Make a mutable span over p[0..n). | |
| static wired_obuf | 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) -> wired_span (by value: 16 bytes, two (u8 *p, usz n) -> wired_mspan registers under SysV, the same as the loose pair) (u8 *out, usz cap, usz *out_len)-> wired_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 wired_span_of / wired_mspan_of / obuf_of constructors below.
|
inlinestatic |
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: wired_obuf ob = obuf_of(buf, sizeof buf); ... use ob.len.
| p | caller-provided storage |
| cap | capacity of p in bytes |
|
inlinestatic |
Make a mutable span over p[0..n).
The span borrows p; the buffer must outlive every use of the returned value. Example: wired_mspan out = wired_mspan_of(key, sizeof key);
| p | first byte of the writable range |
| n | number of writable bytes |
|
inlinestatic |
Make a read-only span over p[0..n).
The span borrows p; the buffer must outlive every use of the returned value. Example: wired_span msg = wired_span_of(buf, buf_len);
| p | first byte of the range (may be 0 when n is 0) |
| n | number of readable bytes |