ascii-chat
Binary v0.16.114-28-gf5913657f
Library lib/v0.3.2-3302-gf5913657f
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, size_t length, uint16_t unit, uint16_t index, void *out, size_t capacity,
48 size_t *out_length);
49
50/* Returns a buffer-owned complete encrypted packet in *out, or NULL if still
51 * incomplete. Identical duplicates are ignored; conflicting fragments fail.
52 * now_ns is monotonic and expiry is measured from the first fragment. */
53asciichat_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);
Synchronized per-thread pending error stacks and value snapshots. SET_ERRNO pushes,...
void quic_datagram_reset(quic_datagram_reader_t *reader)
Definition datagram.c:94
void quic_datagram_expire(quic_datagram_reader_t *reader, uint64_t now_ns)
Definition datagram.c:83
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:102
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
unsigned int uint32_t
unsigned long long uint64_t
unsigned char uint8_t
asciichat_error_t
Error and exit codes - unified status values (0-255).
Definition error_codes.h:48
static bool size_t index
Definition queries.h:10
static bool size_t gotel_query_t * out
Definition queries.h:10
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:9