wired
libc-free QUIC/HTTP3 SDK in C for x86_64-linux
Loading...
Searching...
No Matches
span.h
Go to the documentation of this file.
1#ifndef QUIC_SPAN_H
2#define QUIC_SPAN_H
3
5
22
30typedef struct {
31 const u8* p;
33} quic_span;
34
42typedef struct {
43 u8* p;
46
54typedef struct {
55 u8* p;
58} quic_obuf;
59
70static inline quic_span quic_span_of(const u8* p, usz n) {
71 quic_span s = {p, n};
72 return s;
73}
74
85static inline quic_mspan quic_mspan_of(u8* p, usz n) {
86 quic_mspan s = {p, n};
87 return s;
88}
89
101static inline quic_obuf quic_obuf_of(u8* p, usz cap) {
102 quic_obuf b = {p, cap, 0};
103 return b;
104}
105
106#endif
static quic_mspan quic_mspan_of(u8 *p, usz n)
Make a mutable span over p[0..n).
Definition span.h:85
static quic_span quic_span_of(const u8 *p, usz n)
Make a read-only span over p[0..n).
Definition span.h:70
static quic_obuf quic_obuf_of(u8 *p, usz cap)
Make an output buffer over p[0..cap) with len starting at 0.
Definition span.h:101
Mutable view of a byte range.
Definition span.h:42
u8 * p
first byte of the writable range (not owned)
Definition span.h:43
usz n
number of writable bytes at p
Definition span.h:44
Growing output buffer view for variable-length results.
Definition span.h:54
usz len
bytes written so far; the callee advances this
Definition span.h:57
usz cap
capacity of p in bytes
Definition span.h:56
u8 * p
caller-provided storage (not owned)
Definition span.h:55
Read-only view of a byte range.
Definition span.h:30
usz n
number of readable bytes at p
Definition span.h:32
const u8 * p
first byte of the viewed range (not owned)
Definition span.h:31
x86_64 Linux direct syscalls.
u64 usz
unsigned size (size_t equivalent)
Definition syscall.h:19
unsigned char u8
unsigned 8-bit integer / byte
Definition syscall.h:17