ascii-chat
Binary v0.15.83-53-gb711d8720
Library lib/v0.3.2-701-gb711d8720
Video chat in your terminal
Loading...
Searching...
No Matches
record.h
Go to the documentation of this file.
1#pragma once
4#include <ascii-chat/buffer.h>
5#include <limits.h>
6
7#define CRYPTO_RECORD_CHANNELS 3
8#define CRYPTO_RECORD_CONTROL_CHANNEL 0
9#define CRYPTO_RECORD_RELIABLE 0
10#define CRYPTO_RECORD_DATAGRAM 1
11#define CRYPTO_RECORD_ANY_CHANNEL UINT_MAX
12
29
30typedef asciichat_error_t (*crypto_record_validate_fn)(void *, unsigned, unsigned, const void *, size_t);
33asciichat_error_t crypto_record_seal_into(crypto_record_t *, unsigned channel, unsigned delivery, const void *, size_t,
34 uint8_t *, size_t, size_t *);
35asciichat_error_t crypto_record_seal_into_domain(crypto_record_t *, unsigned channel, unsigned delivery, const void *,
36 size_t, uint8_t *, size_t, size_t *, buffer_domain_t *);
37asciichat_error_t crypto_record_open_sequence(crypto_record_t *, unsigned channel, unsigned delivery, const void *,
38 size_t, uint8_t **, size_t *, uint64_t *, crypto_record_validate_fn,
39 void *);
Synchronized per-thread pending error stacks and value snapshots. SET_ERRNO pushes,...
struct buffer_domain buffer_domain_t
Definition buffer.h:24
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
asciichat_error_t(* crypto_record_validate_fn)(void *, unsigned, unsigned, const void *, size_t)
Definition record.h:30
struct crypto_record crypto_record_t
When code needs to work with crypto record, it keeps crypto, key_epoch, last_receive_epoch,...
asciichat_error_t crypto_record_seal_into(crypto_record_t *, unsigned channel, unsigned delivery, const void *, size_t, uint8_t *, size_t, size_t *)
Definition record.c:32
void crypto_record_cleanup(crypto_record_t *)
Definition record.c:248
asciichat_error_t crypto_record_commit_epoch(crypto_record_t *)
Definition record.c:211
asciichat_error_t crypto_record_open_sequence(crypto_record_t *, unsigned channel, unsigned delivery, const void *, size_t, uint8_t **, size_t *, uint64_t *, crypto_record_validate_fn, void *)
Definition record.c:88
asciichat_error_t crypto_record_retire_epoch_flow(crypto_record_t *, unsigned channel, uint64_t epoch)
Definition record.c:236
asciichat_error_t crypto_record_prepare_epoch(crypto_record_t *)
Definition record.c:203
asciichat_error_t crypto_record_init(crypto_record_t *, crypto_context_t *, bool server)
Definition record.c:23
#define CRYPTO_RECORD_CHANNELS
Definition record.h:7
asciichat_error_t crypto_record_seal_into_domain(crypto_record_t *, unsigned channel, unsigned delivery, const void *, size_t, uint8_t *, size_t, size_t *, buffer_domain_t *)
Definition record.c:39
Endpoint cryptographic state for handshake, packet protection, authentication, and rekeying.
When code needs to work with crypto record, it keeps crypto, key_epoch, last_receive_epoch,...
Definition record.h:17
uint64_t last_receive_epoch
Definition record.h:19
unsigned last_receive_delivery
Definition record.h:26
bool previous_valid
Definition record.h:22
crypto_context_t previous_crypto
Definition record.h:20
uint64_t datagram_seen[3]
Definition record.h:25
bool pending_prepared
Definition record.h:22
uint64_t receive_high[3][2]
Definition record.h:24
crypto_context_t * crypto
Definition record.h:18
uint64_t key_epoch
Definition record.h:19
uint64_t send_sequence[3][2]
Definition record.h:23
bool server
Definition record.h:27
bool previous_allowed[3]
Definition record.h:22
unsigned last_receive_channel
Definition record.h:26
uint64_t previous_epoch
Definition record.h:21