wired
libc-free QUIC/HTTP3 SDK in C for x86_64-linux
Loading...
Searching...
No Matches
header.h
Go to the documentation of this file.
1
#ifndef WIRED_PACKET_HEADER_H
2
#define WIRED_PACKET_HEADER_H
3
4
#include "
common/platform/sys/syscall.h
"
5
8
10
#define WIRED_FORM_LONG 1
12
#define WIRED_FORM_SHORT 0
13
15
#define WIRED_LP_INITIAL 0x0
17
#define WIRED_LP_0RTT 0x1
19
#define WIRED_LP_HANDSHAKE 0x2
21
#define WIRED_LP_RETRY 0x3
22
24
#define WIRED_MAX_CID_LEN 20
25
27
typedef
struct
{
28
u8
form
;
29
u8
long_type
;
30
u32
version
;
31
u8
dcid_len
;
32
u8
dcid
[
WIRED_MAX_CID_LEN
];
33
u8
scid_len
;
34
u8
scid
[
WIRED_MAX_CID_LEN
];
35
}
wired_header
;
36
44
usz
wired_header_parse
(
const
u8
* buf,
usz
n,
wired_header
* h);
45
51
usz
wired_header_build_long
(
u8
* buf,
usz
cap,
const
wired_header
* h);
52
53
#endif
wired_header_parse
usz wired_header_parse(const u8 *buf, usz n, wired_header *h)
Parse the invariant (version-independent) part of a packet header.
wired_header_build_long
usz wired_header_build_long(u8 *buf, usz cap, const wired_header *h)
Build the invariant part of a long header into buf (cap bytes).
WIRED_MAX_CID_LEN
#define WIRED_MAX_CID_LEN
RFC 9000 17.2: longest connection id in a version 1 long header.
Definition
header.h:24
wired_header
Parsed invariant (version-independent) packet header fields.
Definition
header.h:27
wired_header::version
u32 version
valid when form == long
Definition
header.h:30
wired_header::scid
u8 scid[WIRED_MAX_CID_LEN]
source connection id (long header)
Definition
header.h:34
wired_header::form
u8 form
WIRED_FORM_LONG / WIRED_FORM_SHORT.
Definition
header.h:28
wired_header::long_type
u8 long_type
valid when form == long
Definition
header.h:29
wired_header::scid_len
u8 scid_len
valid when form == long
Definition
header.h:33
wired_header::dcid_len
u8 dcid_len
destination connection id length in bytes
Definition
header.h:31
wired_header::dcid
u8 dcid[WIRED_MAX_CID_LEN]
destination connection id
Definition
header.h:32
syscall.h
x86_64 Linux direct syscalls.
u32
unsigned int u32
unsigned 32-bit integer
Definition
syscall.h:14
usz
u64 usz
unsigned size (size_t equivalent)
Definition
syscall.h:19
u8
unsigned char u8
unsigned 8-bit integer / byte
Definition
syscall.h:17
transport
packet
header
packet
header.h
Generated by
1.16.1