ascii-chat 0.6.0
Real-time terminal-based video chat with ASCII art conversion
Loading...
Searching...
No Matches
src/server/client.h
Go to the documentation of this file.
1
10#pragma once
11
12#include "network/client.h"
13
14// Forward declaration to avoid circular dependency with main.h
15// Files that need the full definition should include main.h themselves
17
75
76// Global client manager
79
80// Client management functions
81int add_client(server_context_t *server_ctx, socket_t socket, const char *client_ip, int port);
82int add_webrtc_client(server_context_t *server_ctx, acip_transport_t *transport, const char *client_ip);
83int remove_client(server_context_t *server_ctx, uint32_t client_id);
88
89// Client thread functions
90void *client_receive_thread(void *arg);
92
93// Packet processing functions
94int process_encrypted_packet(client_info_t *client, packet_type_t *type, void **data, size_t *len, uint32_t *sender_id);
95void process_decrypted_packet(client_info_t *client, packet_type_t type, void *data, size_t len);
96
97// Client initialization
unsigned int uint32_t
Definition common.h:58
#define MAX_CLIENTS
Maximum possible clients (static array size) - actual runtime limit set by –max-clients (1-32)
Definition limits.h:23
packet_type_t
Network protocol packet type enumeration.
Definition packet.h:281
int socket_t
Socket handle type (POSIX: int)
Definition socket.h:50
pthread_mutex_t mutex_t
Mutex type (POSIX: pthread_mutex_t)
Definition mutex.h:38
pthread_rwlock_t rwlock_t
Read-write lock type (POSIX: pthread_rwlock_t)
Definition rwlock.h:40
Client state structure and network logging macros.
void initialize_client_info(client_info_t *client)
client_info_t * find_client_by_id(uint32_t client_id)
int add_client(server_context_t *server_ctx, socket_t socket, const char *client_ip, int port)
void cleanup_client_media_buffers(client_info_t *client)
void process_decrypted_packet(client_info_t *client, packet_type_t type, void *data, size_t len)
void cleanup_client_packet_queues(client_info_t *client)
rwlock_t g_client_manager_rwlock
Reader-writer lock protecting the global client manager.
void * client_receive_thread(void *arg)
int remove_client(server_context_t *server_ctx, uint32_t client_id)
void stop_client_threads(client_info_t *client)
client_info_t * find_client_by_socket(socket_t socket)
Find client by socket descriptor using linear search.
int process_encrypted_packet(client_info_t *client, packet_type_t *type, void **data, size_t *len, uint32_t *sender_id)
client_manager_t g_client_manager
Global client manager singleton - central coordination point.
int add_webrtc_client(server_context_t *server_ctx, acip_transport_t *transport, const char *client_ip)
Transport instance structure.
Definition transport.h:169
Per-client state structure for server-side client management.
Global client manager structure for server-side client coordination.
_Atomic uint32_t next_client_id
Monotonic counter for unique client IDs (atomic for thread-safety)
client_info_t * clients_by_id
uthash head pointer for O(1) client_id -> client_info_t* lookups
mutex_t mutex
Legacy mutex (mostly replaced by rwlock)
int client_count
Current number of active clients.
Server context - encapsulates all server state.
Definition server/main.h:81