ascii-chat
Binary v0.16.50-198-g78f51665f
Library lib/v0.3.2-2240-g78f51665f
Video chat in your terminal
Loading...
Searching...
No Matches
main.h File Reference

Go to the source code of this file.

Data Structures

struct  acds_config_t
 Discovery server configuration. More...

Macros

#define DISCOVERY_SERVICE_MAIN_ADDRESS_BUFFER_SIZE   256
#define DISCOVERY_SERVICE_MAIN_ADDRESS6_BUFFER_SIZE   256
#define DISCOVERY_SERVICE_MAIN_DATABASE_PATH_BUFFER_SIZE   512
#define DISCOVERY_SERVICE_MAIN_KEY_PATH_BUFFER_SIZE   512
#define DISCOVERY_SERVICE_MAIN_LOG_FILE_BUFFER_SIZE   512
#define DISCOVERY_SERVICE_MAIN_TURN_SECRET_BUFFER_SIZE   256

Functions

int acds_main (void)
 This is the handoff point for acds config. Callers fill port, log_level, require_server_identity, require_client_identity before passing it on; consumers read the values during the operation and return ownership only where the member contract explicitly says they do.

Macro Definition Documentation

◆ DISCOVERY_SERVICE_MAIN_ADDRESS6_BUFFER_SIZE

#define DISCOVERY_SERVICE_MAIN_ADDRESS6_BUFFER_SIZE   256

Definition at line 61 of file discovery-service/main.h.

◆ DISCOVERY_SERVICE_MAIN_ADDRESS_BUFFER_SIZE

#define DISCOVERY_SERVICE_MAIN_ADDRESS_BUFFER_SIZE   256

Definition at line 60 of file discovery-service/main.h.

◆ DISCOVERY_SERVICE_MAIN_DATABASE_PATH_BUFFER_SIZE

#define DISCOVERY_SERVICE_MAIN_DATABASE_PATH_BUFFER_SIZE   512

Definition at line 62 of file discovery-service/main.h.

◆ DISCOVERY_SERVICE_MAIN_KEY_PATH_BUFFER_SIZE

#define DISCOVERY_SERVICE_MAIN_KEY_PATH_BUFFER_SIZE   512

Definition at line 63 of file discovery-service/main.h.

◆ DISCOVERY_SERVICE_MAIN_LOG_FILE_BUFFER_SIZE

#define DISCOVERY_SERVICE_MAIN_LOG_FILE_BUFFER_SIZE   512

Definition at line 64 of file discovery-service/main.h.

◆ DISCOVERY_SERVICE_MAIN_TURN_SECRET_BUFFER_SIZE

#define DISCOVERY_SERVICE_MAIN_TURN_SECRET_BUFFER_SIZE   256

Definition at line 65 of file discovery-service/main.h.

Function Documentation

◆ acds_main()

int acds_main ( void )

This is the handoff point for acds config. Callers fill port, log_level, require_server_identity, require_client_identity before passing it on; consumers read the values during the operation and return ownership only where the member contract explicitly says they do.

ACDS (discovery-service mode) entry point

Expects options already parsed and shared initialization complete. Called by main.c mode dispatcher after options_init() and asciichat_shared_init().

Returns
Exit code (0 = success, non-zero = error)

Definition at line 318 of file discovery-service/main.c.

318 {
320 // Required callbacks
321 .init_fn = acds_init_fn,
322 .init_user_data = NULL,
323 .interrupt_fn = acds_interrupt_fn,
324
325 // Cleanup
326 .cleanup_fn = acds_cleanup_fn,
327 .cleanup_user_data = NULL,
328
329 .status_fn = acds_status_fn,
330 .status_user_data = NULL,
331
332 .connections = acds_network_callbacks,
333 .connection_user_data = &g_server,
334 .websocket_enabled = true,
336 .partial_timeout_ms = 5000,
337 .idle_timeout_ms = 60000,
338
339 // mDNS
340 .mdns =
341 {
342 .enabled = true,
343 .service_name = "ascii-chat-Discovery-Service",
344 .service_type = "_ascii-chat-discovery-service._tcp",
345 },
346
347 // UPnP
348 .upnp =
349 {
350 .enabled = true,
351 .description = "ascii-chat ACDS",
352 },
353
354 // System
355 .raise_fd_limit = true,
356 .fd_limit_target = 65536,
357 };
358
359 // Native Windows console events reach signal_exit(), not the CRT signal handler.
360 // Route them through the owner so the listener stops and its mapping is removed.
364 return result;
365}
asciichat_error_t
Error and exit codes - unified status values (0-255).
Definition error_codes.h:48
#define CONSENSUS_HANDOFF_HEADER
Definition handoff.h:15
#define CONSENSUS_HANDOFF_PROBE_BYTES
Definition handoff.h:16
void set_interrupt_callback(void(*cb)(void))
Definition main.c:272
void session_server_like_request_shutdown(void)
asciichat_error_t session_server_like_run(const session_server_like_config_t *config)
struct session_server_like_config session_server_like_config_t
The useful part of session server like config is in [struct].mdns, [struct].upnp, init_fn,...
const network_connection_callbacks_t acds_network_callbacks

References acds_network_callbacks, CONSENSUS_HANDOFF_HEADER, CONSENSUS_HANDOFF_PROBE_BYTES, session_server_like_request_shutdown(), session_server_like_run(), and set_interrupt_callback().