ascii-chat
Binary v0.16.114-28-gf5913657f
Library lib/v0.3.2-3302-gf5913657f
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"
14#include <libplatform/socket.h>
15#include <stdbool.h>
16#include <stddef.h>
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
32 size_t size);
39
51 asciichat_error_t error_code);
52
66 asciichat_error_t error_code,
67 const char *message);
68
85 const char *client_ip,
86 rate_event_type_t event_type,
87 bool *allowed);
88
112 const char *client_ip,
113 packet_type_t packet_type, bool *allowed);
114
115#ifdef __cplusplus
116}
117#endif
ascii-chat Discovery Service (ACDS) Protocol Message Formats
unsigned char uint8_t
asciichat_error_t
Error and exit codes - unified status values (0-255).
Definition error_codes.h:48
packet_type_t
Network protocol packet type enumeration.
Definition packet.h:315
int socket_t
⚙️ Common definitions, error codes, macros, and types shared throughout the application
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:52
struct rate_limiter_s rate_limiter_t
Opaque rate limiter handle.
Definition rate_limit.h:87