ascii-chat
Binary v0.15.83-53-gb711d8720
Library lib/v0.3.2-701-gb711d8720
Video chat in your terminal
Loading...
Searching...
No Matches
datagram.h
Go to the documentation of this file.
1#pragma once
2
5#include <stddef.h>
6#include <stdint.h>
7
8/* Private ACQD v1 fragments carry an encrypted ACIP packet. The envelope is
9 * not authenticated end-to-end: do not dispatch a completed packet until
10 * the ACIP security codec authenticates it and checks replay state. */
11#define QUIC_DATAGRAM_HEADER_SIZE 28U
12#define QUIC_DATAGRAM_MAX_FRAGMENTS 4096U
13#define QUIC_DATAGRAM_SLOTS 8U
14#define QUIC_DATAGRAM_BUDGET (4U * 1024U * 1024U)
15#define QUIC_DATAGRAM_EXPIRY_NS UINT64_C(1000000000)
16
28
44
45/* unit is the payload capacity of every non-final fragment. IDs must be
46 * unique per flow and key epoch. The output buffer is owned by the caller. */
47asciichat_error_t quic_datagram_fragment(acip_traffic_class_t traffic_class, uint64_t id, const void *packet,
48 size_t length, uint16_t unit, uint16_t index, void *out, size_t capacity,
49 size_t *out_length);
50
51/* Returns a buffer-owned complete encrypted packet in *out, or NULL if still
52 * incomplete. Identical duplicates are ignored; conflicting fragments fail.
53 * now_ns is monotonic and expiry is measured from the first fragment. */
54asciichat_error_t quic_datagram_read(quic_datagram_reader_t *reader, const void *data, size_t length, uint64_t now_ns,
55 acip_traffic_class_t *traffic_class, uint8_t **out, size_t *out_length);
Synchronized per-thread pending error stacks and value snapshots. SET_ERRNO pushes,...
void quic_datagram_reset(quic_datagram_reader_t *reader)
Definition datagram.c:96
void quic_datagram_expire(quic_datagram_reader_t *reader, uint64_t now_ns)
Definition datagram.c:85
asciichat_error_t quic_datagram_read(quic_datagram_reader_t *reader, const void *data, size_t length, uint64_t now_ns, acip_traffic_class_t *traffic_class, uint8_t **out, size_t *out_length)
Definition datagram.c:104
asciichat_error_t quic_datagram_fragment(acip_traffic_class_t traffic_class, uint64_t id, const void *packet, size_t length, uint16_t unit, uint16_t index, void *out, size_t capacity, size_t *out_length)
Definition datagram.c:45
#define QUIC_DATAGRAM_SLOTS
Definition datagram.h:13
unsigned short uint16_t
Definition common.h:61
unsigned int uint32_t
Definition common.h:62
unsigned long long uint64_t
Definition common.h:63
unsigned char uint8_t
Definition common.h:60
asciichat_error_t
Error and exit codes - unified status values (0-255).
Definition error_codes.h:44
static bool size_t index
Definition queries.h:8
static bool size_t gotel_query_t * out
Definition queries.h:8
acip quic datagram slot keeps the values that move through the subsystem: data, received,...
Definition datagram.h:34
quic_datagram_slot_t slots[8U]
Definition datagram.h:35
uint16_t received_count
Definition datagram.h:23
uint64_t started_ns
Definition datagram.h:21
uint8_t * received
Definition datagram.h:19
acip_traffic_class_t traffic_class
Definition datagram.h:24
acip_traffic_class_t
Definition traffic.h:5