ascii-chat 0.11.33
Video chat in your terminal
Loading...
Searching...
No Matches
network.c File Reference

Network protocol options. More...

Go to the source code of this file.

Variables

const registry_entry_t g_network_entries []
 

Detailed Description

Network protocol options.

Options for controlling ports, compression, discovery, WebRTC, and network connectivity.

Author
Zachary Fogg me@zf.nosp@m.o.gg
Date
January 2026

Definition in file options/registry/network.c.

Variable Documentation

◆ g_network_entries

const registry_entry_t g_network_entries[]

Definition at line 21 of file options/registry/network.c.

21 {
22 // NETWORK GROUP - port and client management
23 {"port",
24 'p',
26 offsetof(options_t, port),
27 NULL, // Use mode_default_getter instead
28 sizeof(int),
29 "Port to host a server or discovery-service on, or port to connect to a server as a client (default: 27224 for "
30 "server/client, 27225 for discovery-service).",
31 "NETWORK",
32 NULL,
33 false,
34 "ASCII_CHAT_PORT",
35 NULL,
37 false,
38 false,
40 {.numeric_range = {1, 65535, 1}, .input_type = OPTION_INPUT_NUMERIC},
42 {"websocket-port",
43 '\0',
45 offsetof(options_t, websocket_port),
46 NULL, // Use mode_default_getter instead
47 sizeof(int),
48 "WebSocket server port (default: 27226 for server, 27227 for discovery-service, 443 when TLS cert+key provided).",
49 "NETWORK",
50 NULL,
51 false,
52 "ASCII_CHAT_WEBSOCKET_PORT",
53 NULL,
54 NULL,
55 false,
56 false,
58 {.numeric_range = {1, 65535, 1}, .input_type = OPTION_INPUT_NUMERIC},
60 {"websocket-tls-cert",
61 '\0',
63 offsetof(options_t, websocket_tls_cert),
64 NULL,
66 "WebSocket TLS certificate file path for WSS (secure WebSocket) support (server/discovery-service only).",
67 "NETWORK",
68 NULL,
69 false,
70 "ASCII_CHAT_WEBSOCKET_TLS_CERT",
71 NULL,
72 NULL,
73 false,
74 false,
76 {.input_type = OPTION_INPUT_STRING},
77 NULL},
78 {"websocket-tls-key",
79 '\0',
81 offsetof(options_t, websocket_tls_key),
82 NULL,
84 "WebSocket TLS private key file path for WSS (secure WebSocket) support (server/discovery-service only).",
85 "NETWORK",
86 NULL,
87 false,
88 "ASCII_CHAT_WEBSOCKET_TLS_KEY",
89 NULL,
90 NULL,
91 false,
92 false,
94 {.input_type = OPTION_INPUT_STRING},
95 NULL},
96 {"websocket-tls-key-password",
97 '\0',
99 offsetof(options_t, websocket_tls_key_password),
100 NULL,
102 "Password for password-protected WebSocket TLS private key (use ASCII_CHAT_WEBSOCKET_TLS_KEY_PASSWORD env var for "
103 "security).",
104 "NETWORK",
105 NULL,
106 false,
107 "ASCII_CHAT_WEBSOCKET_TLS_KEY_PASSWORD",
108 NULL,
109 NULL,
110 false,
111 false,
113 {.input_type = OPTION_INPUT_STRING},
114 NULL},
115 {"max-clients",
116 '\0',
118 offsetof(options_t, max_clients),
119 &default_max_clients_value,
120 sizeof(int),
121 "Maximum concurrent clients.",
122 "NETWORK",
123 NULL,
124 false,
125 "ASCII_CHAT_MAX_CLIENTS",
126 NULL,
127 NULL,
128 false,
129 false,
131 {.numeric_range = {1, 99, 1}, .examples = g_maxclients_examples, .input_type = OPTION_INPUT_NUMERIC},
132 NULL},
133 {"reconnect-attempts",
134 '\0',
136 offsetof(options_t, reconnect_attempts),
137 &default_reconnect_attempts_value,
138 sizeof(int),
139 "Number of reconnection attempts before giving up (-1=infinite, 0=none).",
140 "NETWORK",
141 NULL,
142 false,
143 "ASCII_CHAT_RECONNECT_ATTEMPTS",
144 NULL,
145 NULL,
146 false,
147 false,
149 {.numeric_range = {-1, 99, 1}, .examples = g_reconnect_examples, .input_type = OPTION_INPUT_NUMERIC},
150 NULL},
151 {"port-forwarding",
152 '\0',
154 offsetof(options_t, enable_upnp),
155 &default_enable_upnp_value,
156 sizeof(bool),
157 "Use UPnP/NAT-PMP port mapping to open a port in your router to ascii-chat (might fail with some routers).",
158 "NETWORK",
159 NULL,
160 false,
161 "ASCII_CHAT_PORT_FORWARDING",
162 NULL,
163 NULL,
164 false,
165 false,
167 {0},
168 NULL},
169 {"scan",
170 '\0',
172 offsetof(options_t, lan_discovery),
173 &default_lan_discovery_value,
174 sizeof(bool),
175 "Scan for servers on local network via mDNS.",
176 "NETWORK",
177 NULL,
178 false,
179 "ASCII_CHAT_SCAN",
180 NULL,
181 NULL,
182 false,
183 false,
185 {0},
186 NULL},
187
188 // NETWORK GROUP - compression options
189 {"compression-level",
190 '\0',
192 offsetof(options_t, compression_level),
193 &default_compression_level_value,
194 sizeof(int),
195 "zstd compression level (1-9).",
196 "NETWORK",
197 NULL,
198 false,
199 "ASCII_CHAT_COMPRESSION_LEVEL",
200 NULL,
201 NULL,
202 false,
203 false,
205 {.numeric_range = {1, 9, 1}, .examples = g_compression_examples, .input_type = OPTION_INPUT_NUMERIC},
206 NULL},
207 {"no-compress",
208 '\0',
210 offsetof(options_t, no_compress),
211 &default_no_compress_value,
212 sizeof(bool),
213 "Disable compression.",
214 "NETWORK",
215 NULL,
216 false,
217 "ASCII_CHAT_NO_COMPRESS",
218 NULL,
219 NULL,
220 false,
221 false,
223 {0},
224 NULL},
225
226 // NETWORK GROUP - discovery service options
227 {"discovery-service",
228 '\0',
230 offsetof(options_t, discovery_server),
232 0,
233 "Discovery service endpoint (IP address or hostname).",
234 "NETWORK",
235 NULL,
236 false,
237 "ASCII_CHAT_DISCOVERY_SERVER",
238 NULL,
239 NULL,
240 false,
241 false,
243 {0},
244 NULL},
245 {"discovery-service-port",
246 '\0',
248 offsetof(options_t, discovery_port),
249 &default_discovery_port_value,
250 sizeof(int),
251 "Discovery service port (1-65535).",
252 "NETWORK",
253 NULL,
254 false,
255 "ASCII_CHAT_DISCOVERY_SERVICE_PORT",
256 NULL,
257 NULL,
258 false,
259 false,
261 {0},
262 NULL},
263 {"discovery-service-url",
264 '\0',
266 offsetof(options_t, discovery_service_url),
267 NULL,
269 "Discovery service WebSocket URL (ws:// or wss://). Mutually exclusive with --discovery-service-port.",
270 "NETWORK",
271 NULL,
272 false,
273 "ASCII_CHAT_DISCOVERY_SERVICE_URL",
274 NULL,
275 NULL,
276 false,
277 false,
279 {0},
280 NULL},
281 {"discovery-expose-ip",
282 '\0',
284 offsetof(options_t, discovery_expose_ip),
285 &default_discovery_expose_ip_value,
286 sizeof(bool),
287 "Allow public IP disclosure in discovery sessions (requires confirmation).",
288 "NETWORK",
289 NULL,
290 false,
291 "ASCII_CHAT_DISCOVERY_EXPOSE_IP",
292 NULL,
293 NULL,
294 false,
295 false,
297 {0},
298 NULL},
299 {"discovery",
300 '\0',
302 offsetof(options_t, discovery),
303 &default_discovery_value,
304 sizeof(bool),
305 "Enable discovery session registration.",
306 "NETWORK",
307 NULL,
308 false,
309 "ASCII_CHAT_DISCOVERY",
310 NULL,
311 NULL,
312 false,
313 false,
315 {0},
316 NULL},
317
318 // NETWORK GROUP - WebRTC options
319 {"webrtc",
320 '\0',
322 offsetof(options_t, webrtc),
323 &default_webrtc_value,
324 sizeof(bool),
325 "Make calls using WebRTC p2p connections.",
326 "NETWORK",
327 NULL,
328 false,
329 "ASCII_CHAT_WEBRTC",
330 NULL,
331 NULL,
332 false,
333 false,
335 {0},
336 NULL},
337 {"no-webrtc",
338 '\0',
340 offsetof(options_t, no_webrtc),
341 &default_no_webrtc_value,
342 sizeof(bool),
343 "Disable WebRTC, use direct TCP only.",
344 "NETWORK",
345 NULL,
346 false,
347 "ASCII_CHAT_NO_WEBRTC",
348 NULL,
349 NULL,
350 false,
351 false,
353 {0},
354 NULL},
355 {"prefer-webrtc",
356 '\0',
358 offsetof(options_t, prefer_webrtc),
359 &default_prefer_webrtc_value,
360 sizeof(bool),
361 "Try WebRTC before direct TCP.",
362 "NETWORK",
363 NULL,
364 false,
365 "ASCII_CHAT_PREFER_WEBRTC",
366 NULL,
367 NULL,
368 false,
369 false,
371 {0},
372 NULL},
373 {"webrtc-relay-only",
374 '\0',
376 offsetof(options_t, webrtc_relay_only),
377 &default_webrtc_relay_only_value,
378 sizeof(bool),
379 "Require TURN relay for WebRTC connections (no direct connection or TCP fallback).",
380 "NETWORK",
381 NULL,
382 false,
383 "ASCII_CHAT_WEBRTC_RELAY_ONLY",
384 NULL,
385 NULL,
386 false,
387 false,
389 {0},
390 NULL},
391 {"webrtc-skip-stun",
392 '\0',
394 offsetof(options_t, webrtc_skip_stun),
395 &default_webrtc_skip_stun_value,
396 sizeof(bool),
397 "Skip WebRTC+STUN stage, go straight to TURN relay.",
398 "NETWORK",
399 NULL,
400 false,
401 "ASCII_CHAT_WEBRTC_SKIP_STUN",
402 NULL,
403 NULL,
404 false,
405 false,
407 {0},
408 NULL},
409 {"webrtc-disable-turn",
410 '\0',
412 offsetof(options_t, webrtc_disable_turn),
413 &default_webrtc_disable_turn_value,
414 sizeof(bool),
415 "Disable WebRTC+TURN relay, use STUN only.",
416 "NETWORK",
417 NULL,
418 false,
419 "ASCII_CHAT_WEBRTC_DISABLE_TURN",
420 NULL,
421 NULL,
422 false,
423 false,
425 {0},
426 NULL},
427 {"webrtc-skip-host",
428 '\0',
430 offsetof(options_t, webrtc_skip_host),
431 &default_webrtc_skip_host_value,
432 sizeof(bool),
433 "Skip host candidates, force STUN/TURN (for testing).",
434 "NETWORK",
435 NULL,
436 false,
437 "ASCII_CHAT_WEBRTC_SKIP_HOST",
438 NULL,
439 NULL,
440 false,
441 false,
443 {0},
444 NULL},
445 {"webrtc-ice-timeout",
446 '\0',
448 offsetof(options_t, webrtc_ice_timeout_ms),
449 &default_webrtc_ice_timeout_ms_value,
450 sizeof(int),
451 "ICE gathering timeout in milliseconds.",
452 "NETWORK",
453 NULL,
454 false,
455 "ASCII_CHAT_WEBRTC_ICE_TIMEOUT",
456 NULL,
457 NULL,
458 false,
459 false,
461 {0},
462 NULL},
463 {"webrtc-reconnect-attempts",
464 '\0',
466 offsetof(options_t, webrtc_reconnect_attempts),
467 &default_webrtc_reconnect_attempts_value,
468 sizeof(int),
469 "Number of WebRTC connection retry attempts.",
470 "NETWORK",
471 NULL,
472 false,
473 "ASCII_CHAT_WEBRTC_RECONNECT_ATTEMPTS",
474 NULL,
475 NULL,
476 false,
477 false,
479 {0},
480 NULL},
481 {"stun-servers",
482 '\0',
484 offsetof(options_t, stun_servers),
486 0,
487 "Comma-separated list of WebRTC+STUN server URLs.",
488 "NETWORK",
489 NULL,
490 false,
491 "ASCII_CHAT_STUN_SERVERS",
492 NULL,
493 NULL,
494 false,
495 false,
497 {0},
498 NULL},
499 {"turn-servers",
500 '\0',
502 offsetof(options_t, turn_servers),
504 0,
505 "Comma-separated list of WebRTC+TURN server URLs.",
506 "NETWORK",
507 NULL,
508 false,
509 "ASCII_CHAT_TURN_SERVERS",
510 NULL,
511 NULL,
512 false,
513 false,
515 {0},
516 NULL},
517 {"turn-username",
518 '\0',
520 offsetof(options_t, turn_username),
522 0,
523 "Username for WebRTC+TURN authentication.",
524 "NETWORK",
525 NULL,
526 false,
527 "ASCII_CHAT_TURN_USERNAME",
528 NULL,
529 NULL,
530 false,
531 false,
533 {0},
534 NULL},
535 {"turn-credential",
536 '\0',
538 offsetof(options_t, turn_credential),
540 0,
541 "Credential/password for WebRTC+TURN authentication.",
542 "NETWORK",
543 NULL,
544 false,
545 "ASCII_CHAT_TURN_CREDENTIAL",
546 NULL,
547 NULL,
548 false,
549 false,
551 {0},
552 NULL},
553 {"turn-secret",
554 '\0',
556 offsetof(options_t, turn_secret),
557 "",
558 0,
559 "Shared secret for dynamic WebRTC+TURN credential generation (HMAC-SHA1).",
560 "NETWORK",
561 NULL,
562 false,
563 "ASCII_CHAT_TURN_SECRET",
564 NULL,
565 NULL,
566 false,
567 false,
569 {0},
570 NULL},
571
@ OPTION_INPUT_STRING
Free-form text input.
Definition builder.h:180
@ OPTION_INPUT_NUMERIC
Numeric value with optional min/max/step.
Definition builder.h:179
@ OPTION_TYPE_INT
Integer value (–count 42)
Definition builder.h:163
@ OPTION_TYPE_STRING
String value (–name foo)
Definition builder.h:164
@ OPTION_TYPE_CALLBACK
Custom parser function.
Definition builder.h:166
@ OPTION_TYPE_BOOL
Boolean flag (–flag, no value)
Definition builder.h:162
#define OPT_ENDPOINT_DISCOVERY_SERVICE
Default discovery service endpoint (what to connect to by default)
#define OPT_TURN_SERVERS_DEFAULT
Default TURN server URLs (comma-separated)
#define OPT_STUN_SERVERS_DEFAULT
Default STUN server URLs (comma-separated)
#define OPTIONS_BUFF_SIZE
Buffer size for option string values.
#define OPT_TURN_CREDENTIAL_DEFAULT
Default TURN credential (empty = use ACDS credentials)
#define OPT_TURN_USERNAME_DEFAULT
Default TURN username (empty = use ACDS credentials)
@ OPTION_MODE_CLIENT
Client mode (bit 1)
@ OPTION_MODE_DISCOVERY
Discovery mode (bit 4)
@ OPTION_MODE_SERVER
Server mode (bit 0)
@ OPTION_MODE_DISCOVERY_SVC
Discovery server mode (bit 3)
const char * g_compression_examples[]
Definition metadata.c:180
const char * g_reconnect_examples[]
Definition metadata.c:185
const char * g_maxclients_examples[]
Definition metadata.c:184
#define REGISTRY_TERMINATOR()
Initialize a terminator entry (sentinel value for array end) Uses designated initializers to properly...
const void * get_default_websocket_port(asciichat_mode_t mode)
Get mode-specific default value for –websocket-port.
const void * get_default_port(asciichat_mode_t mode)
Get mode-specific default value for –port.
bool parse_port_option(const char *arg, void *dest, char **error_msg)
Parse and validate port option for CLI.
Definition parsers.c:512
#define bool
Definition stdbool.h:61
Consolidated options structure.