ascii-chat
Binary v0.15.83-53-gb711d8720
Library lib/v0.3.2-701-gb711d8720
Video chat in your terminal
Loading...
Searching...
No Matches
include/ascii-chat/network/errors.h
Go to the documentation of this file.
1#pragma once
2
10
11#include "../common.h"
12#include "../os/socket.h"
15#include <stddef.h>
16#include <stdbool.h>
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
28asciichat_error_t network_error_decode(packet_type_t type, const void *payload, size_t size);
31
43
55asciichat_error_t send_error_packet_message(socket_t sockfd, asciichat_error_t error_code, const char *message);
56
72asciichat_error_t check_and_record_rate_limit(rate_limiter_t *rate_limiter, const char *client_ip,
73 rate_event_type_t event_type, bool *allowed);
74
96 packet_type_t packet_type, bool *allowed);
97
98#ifdef __cplusplus
99}
100#endif
ascii-chat Discovery Service (ACDS) Protocol Message Formats
⚙️ Common definitions, error codes, macros, and types shared throughout the application
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
packet_type_t
Network protocol packet type enumeration.
Definition packet.h:301
int socket_t
asciichat_error_t send_error_packet(socket_t sockfd, asciichat_error_t error_code)
Send an ACIP error packet using asciichat_error_t.
asciichat_error_t check_and_record_packet_rate_limit(rate_limiter_t *rate_limiter, const char *client_ip, packet_type_t packet_type, bool *allowed)
Map packet type to rate event type and check rate limit.
asciichat_error_t network_error_public_code(asciichat_error_t code)
asciichat_error_t network_error_decode(packet_type_t type, const void *payload, size_t size)
asciichat_error_t check_and_record_rate_limit(rate_limiter_t *rate_limiter, const char *client_ip, rate_event_type_t event_type, bool *allowed)
Check rate limit and record an allowed event.
network_error_action_t network_error_action(asciichat_error_t code)
bool network_error_is_local_rejection(asciichat_error_t code)
asciichat_error_t network_error_from_acip(uint8_t code)
asciichat_error_t send_error_packet_message(socket_t sockfd, asciichat_error_t error_code, const char *message)
Send an ACIP error packet with a public message.
🚦 Rate limiting API with pluggable backends
rate_event_type_t
One sliding-window rate-limit policy.
Definition rate_limit.h:48
struct rate_limiter_s rate_limiter_t
Opaque rate limiter handle.
Definition rate_limit.h:83