ascii-chat 0.6.0
Real-time terminal-based video chat with ASCII art conversion
Loading...
Searching...
No Matches
presets.c File Reference

Preset option configurations for ascii-chat modes. More...

Go to the source code of this file.

Functions

const options_config_toptions_preset_binary (const char *program_name, const char *description)
 Get binary-level options preset.
 
const options_config_toptions_preset_server (const char *program_name, const char *description)
 Get server mode options preset.
 
const options_config_toptions_preset_client (const char *program_name, const char *description)
 Get client mode options preset.
 
const options_config_toptions_preset_mirror (const char *program_name, const char *description)
 Get mirror mode options preset.
 
const options_config_toptions_preset_acds (const char *program_name, const char *description)
 Get acds mode options preset.
 

Detailed Description

Preset option configurations for ascii-chat modes.

Definition in file presets.c.

Function Documentation

◆ options_preset_acds()

const options_config_t * options_preset_acds ( const char *  program_name,
const char *  description 
)

Get acds mode options preset.

Parameters
program_nameOptional program name (defaults to "ascii-chat acds")
descriptionOptional program description (defaults to "ASCII Chat Discovery Service")
Returns
Preset config (caller must free after use)

Definition at line 571 of file presets.c.

571 {
572 // Note: Each call creates a new config (no static caching) since program_name/description vary
574 if (!b)
575 return NULL;
576
577 b->program_name = program_name ? program_name : "ascii-chat discovery service";
578 b->description = description ? description : "session management and WebRTC signaling";
579
580 // Help and version
581 options_builder_add_bool(b, "help", 'h', offsetof(options_t, help), false, "Show this help", "GENERAL", false, NULL);
582
583 // Network options
584 // Note: Bind addresses are specified via positional arguments, not flags
585 add_port_option(b, "27225", "ACDS_PORT");
586
587 // ACDS-specific options
588 options_builder_add_string(b, "key", 'k', offsetof(options_t, acds_key_path), "",
589 "Path to ACDS identity key file (default: ~/.ascii-chat/acds_identity)", "ACDS", false,
590 "ACDS_KEY_PATH", NULL);
591
592 options_builder_add_string(b, "database", 'd', offsetof(options_t, acds_database_path), "",
593 "Path to ACDS database file (default: ~/.ascii-chat/acds.db)", "ACDS", false,
594 "ACDS_DATABASE_PATH", NULL);
595
596 // Logging options (binary-level, work before or after mode name)
597 // Note: ACDS uses partial logging options due to short name conflicts with identity verification options
598 options_builder_add_string(b, "log-file", 'L', offsetof(options_t, log_file), "", "Redirect logs to FILE", "LOGGING",
599 false, "ASCII_CHAT_LOG_FILE", NULL);
600
601 options_builder_add_callback(b, "log-level", '\0', offsetof(options_t, log_level), &(log_level_t){LOG_INFO},
603 "Set log level: dev, debug, info, warn, error, fatal", "LOGGING", false, NULL);
604
605 // Encryption options (shared with client and server)
606 options_builder_add_bool(b, "encrypt", 'E', offsetof(options_t, encrypt_enabled), false, "Enable encryption",
607 "SECURITY", false, NULL);
608
609 options_builder_add_string(b, "key", 'K', offsetof(options_t, encrypt_key), "", "SSH/GPG key file path", "SECURITY",
610 false, "ASCII_CHAT_KEY", NULL);
611
612 options_builder_add_string(b, "password", '\0', offsetof(options_t, password), "",
613 "Shared password for authentication", "SECURITY", false, "ASCII_CHAT_PASSWORD", NULL);
614
615 options_builder_add_string(b, "keyfile", 'F', offsetof(options_t, encrypt_keyfile), "", "Alternative key file path",
616 "SECURITY", false, NULL, NULL);
617
618 options_builder_add_bool(b, "no-encrypt", '\0', offsetof(options_t, no_encrypt), false, "Disable encryption",
619 "SECURITY", false, NULL);
620
621 // Identity verification options
622 options_builder_add_bool(b, "require-server-identity", 'S', offsetof(options_t, require_server_identity), false,
623 "Require servers to provide signed Ed25519 identity when creating sessions", "SECURITY",
624 false, NULL);
625
626 options_builder_add_bool(b, "require-client-identity", 'C', offsetof(options_t, require_client_identity), false,
627 "Require clients to provide signed Ed25519 identity when joining sessions", "SECURITY",
628 false, NULL);
629
630 options_builder_add_bool(b, "require-server-verify", 'V', offsetof(options_t, require_server_verify), false,
631 "ACDS policy: require servers to verify client identity during handshake", "SECURITY", false,
632 NULL);
633
634 options_builder_add_bool(b, "require-client-verify", 'c', offsetof(options_t, require_client_verify), false,
635 "ACDS policy: require clients to verify server identity during handshake", "SECURITY", false,
636 NULL);
637
638 // WebRTC connectivity options
639 options_builder_add_string(b, "stun-servers", '\0', offsetof(options_t, stun_servers),
640 "stun:stun.ascii-chat.com:3478,stun:stun.l.google.com:19302",
641 "Comma-separated list of STUN server URLs", "WEBRTC", false, "ASCII_CHAT_STUN_SERVERS",
642 NULL);
643
644 options_builder_add_string(b, "turn-servers", '\0', offsetof(options_t, turn_servers),
645 "turn:turn.ascii-chat.com:3478", "Comma-separated list of TURN server URLs", "WEBRTC",
646 false, "ASCII_CHAT_TURN_SERVERS", NULL);
647
648 options_builder_add_string(b, "turn-username", '\0', offsetof(options_t, turn_username), "ascii",
649 "Username for TURN server authentication", "WEBRTC", false, "ASCII_CHAT_TURN_USERNAME",
650 NULL);
651
652 options_builder_add_string(b, "turn-credential", '\0', offsetof(options_t, turn_credential),
653 "0aa9917b4dad1b01631e87a32b875e09", "Credential/password for TURN server authentication",
654 "WEBRTC", false, "ASCII_CHAT_TURN_CREDENTIAL", NULL);
655
656 options_builder_add_string(b, "turn-secret", '\0', offsetof(options_t, turn_secret), "",
657 "Shared secret for dynamic TURN credential generation (HMAC-SHA1)", "WEBRTC", false,
658 "ASCII_CHAT_TURN_SECRET", NULL);
659
660 options_builder_add_bool(b, "upnp", '\0', offsetof(options_t, enable_upnp), true,
661 "Enable UPnP/NAT-PMP for automatic port mapping (enables direct TCP for most home users)",
662 "WEBRTC", false, "ASCII_CHAT_UPNP");
663
664 options_builder_add_bool(b, "no-upnp", '\0', offsetof(options_t, no_upnp), false,
665 "Disable UPnP/NAT-PMP port mapping (requires manual port forwarding)", "WEBRTC", false,
666 NULL);
667
668 // Action options (execute and exit)
669 options_builder_add_action(b, "version", 'v', action_show_version, "Show version information and exit", "ACTIONS");
670
671 // Positional arguments: 0-2 bind addresses (IPv4 and/or IPv6)
672 options_builder_add_positional(b, "bind-address", "IPv4 or IPv6 bind address (can specify 0-2 addresses)",
673 false, // Not required (defaults to localhost)
674 "BIND ADDRESS FORMATS", g_server_bind_address_examples,
675 sizeof(g_server_bind_address_examples) / sizeof(g_server_bind_address_examples[0]),
677
678 const options_config_t *config = options_builder_build(b);
680 return config;
681}
void action_show_version(void)
Show version information and exit.
Definition actions.c:153
void options_builder_add_action(options_builder_t *builder, const char *long_name, char short_name, void(*action_fn)(void), const char *help_text, const char *group)
Add action option (executes action and may exit)
Definition builder.c:532
void options_builder_add_bool(options_builder_t *builder, const char *long_name, char short_name, size_t offset, bool default_value, const char *help_text, const char *group, bool required, const char *env_var_name)
Add boolean flag option.
Definition builder.c:344
void options_builder_add_callback(options_builder_t *builder, const char *long_name, char short_name, size_t offset, const void *default_value, size_t value_size, bool(*parse_fn)(const char *, void *, char **), const char *help_text, const char *group, bool required, const char *env_var_name)
Definition builder.c:467
void options_builder_destroy(options_builder_t *builder)
Free options builder.
Definition builder.c:255
void options_builder_add_string(options_builder_t *builder, const char *long_name, char short_name, size_t offset, const char *default_value, const char *help_text, const char *group, bool required, const char *env_var_name, bool(*validate)(const void *, char **))
Definition builder.c:399
options_config_t * options_builder_build(options_builder_t *builder)
Build immutable options config.
Definition builder.c:265
void options_builder_add_positional(options_builder_t *builder, const char *name, const char *help_text, bool required, const char *section_heading, const char **examples, size_t num_examples, int(*parse_fn)(const char *arg, void *config, char **remaining, int num_remaining, char **error_msg))
Add positional argument descriptor.
Definition builder.c:627
options_builder_t * options_builder_create(size_t struct_size)
Create empty options builder.
Definition builder.c:184
log_level_t
Logging levels enumeration.
Definition log/logging.h:59
#define log_file(...)
File-only logging - writes to log file only, no stderr output.
@ LOG_INFO
Definition log/logging.h:62
int parse_server_bind_address(const char *arg, void *config, char **remaining, int num_remaining, char **error_msg)
Parse server bind address positional argument.
Definition parsers.c:306
bool parse_log_level(const char *arg, void *dest, char **error_msg)
Parse log level option.
Definition parsers.c:233
Options builder.
Definition builder.h:192
const char * program_name
Program name for usage.
Definition builder.h:206
const char * description
Program description for usage.
Definition builder.h:207
Options configuration.
Definition builder.h:165
Consolidated options structure.
Definition options.h:439

References action_show_version(), options_builder_t::description, log_file, LOG_INFO, options_builder_add_action(), options_builder_add_bool(), options_builder_add_callback(), options_builder_add_positional(), options_builder_add_string(), options_builder_build(), options_builder_create(), options_builder_destroy(), parse_log_level(), parse_server_bind_address(), and options_builder_t::program_name.

Referenced by parse_acds_options(), and usage_acds().

◆ options_preset_binary()

const options_config_t * options_preset_binary ( const char *  program_name,
const char *  description 
)

Get binary-level options preset.

Binary options are parsed BEFORE mode selection. Includes: –help, –version, –log-file, –log-level, etc.

Parameters
program_nameOptional program name (defaults to "ascii-chat")
descriptionOptional program description
Returns
Preset config (caller must free after use)

Definition at line 273 of file presets.c.

273 {
274 // Note: Each call creates a new config (no static caching) since program_name/description vary
276 if (!b)
277 return NULL;
278
279 b->program_name = program_name ? program_name : "ascii-chat";
280 b->description = description ? description : "Video chat in your terminal";
281
282 // Help and version
283 options_builder_add_bool(b, "help", '\0', offsetof(options_t, help), false, "Show this help", "GENERAL", false, NULL);
284
285 options_builder_add_bool(b, "version", '\0', offsetof(options_t, version), false, "Show version information",
286 "GENERAL", false, NULL);
287
288 // Add logging options
289 add_binary_logging_options(b);
290
291 const options_config_t *config = options_builder_build(b);
293 return config;
294}

References options_builder_t::description, options_builder_add_bool(), options_builder_build(), options_builder_create(), options_builder_destroy(), and options_builder_t::program_name.

◆ options_preset_client()

const options_config_t * options_preset_client ( const char *  program_name,
const char *  description 
)

Get client mode options preset.

Parameters
program_nameOptional program name (defaults to "ascii-chat client")
descriptionOptional program description (defaults to "Connect to ascii-chat server")
Returns
Preset config (caller must free after use)

Definition at line 398 of file presets.c.

398 {
399 // Note: Each call creates a new config (no static caching) since program_name/description vary
401 if (!b)
402 return NULL;
403
404 b->program_name = program_name ? program_name : "ascii-chat client";
405 b->description = description ? description : "Connect to ascii-chat server";
406
407 // Network options
408 // Note: Server address and port are specified via positional argument [address][:port], not flags
409 add_port_option(b, OPT_PORT_DEFAULT, "ASCII_CHAT_PORT");
410
411 options_builder_add_int(b, "reconnect", 'r', offsetof(options_t, reconnect_attempts), OPT_RECONNECT_ATTEMPTS_DEFAULT,
412 "Reconnection attempts (-1=infinite)", "NETWORK", false, NULL, NULL);
413
414 options_builder_add_bool(b, "scan", '\0', offsetof(options_t, lan_discovery), false,
415 "Scan for ASCII-Chat servers on local network (mDNS)", "NETWORK", false, NULL);
416
417 // Terminal dimensions, webcam, display, and snapshot options (shared with mirror)
418 add_terminal_dimension_options(b);
419 add_webcam_options(b);
420 add_display_options(b);
421 add_snapshot_options(b);
422
423 // Audio options
424 options_builder_add_bool(b, "audio", 'A', offsetof(options_t, audio_enabled), false, "Enable audio streaming",
425 "AUDIO", false, NULL);
426
427 options_builder_add_int(b, "microphone-index", '\0', offsetof(options_t, microphone_index),
428 OPT_MICROPHONE_INDEX_DEFAULT, "Microphone device index (-1=default)", "AUDIO", false, NULL,
429 NULL);
430
431 options_builder_add_int(b, "speakers-index", '\0', offsetof(options_t, speakers_index), OPT_SPEAKERS_INDEX_DEFAULT,
432 "Speakers device index (-1=default)", "AUDIO", false, NULL, NULL);
433
434 options_builder_add_bool(b, "audio-analysis", '\0', offsetof(options_t, audio_analysis_enabled), false,
435 "Enable audio analysis (debug)", "AUDIO", false, NULL);
436
437 options_builder_add_bool(b, "no-audio-playback", '\0', offsetof(options_t, audio_no_playback), false,
438 "Disable speaker playback (debug)", "AUDIO", false, NULL);
439
440 // Compression and audio encoding options (shared with server)
441 add_compression_options(b);
442
443 // ACDS Discovery options (shared with server)
444 add_acds_discovery_options(b);
445
446 // WebRTC Connection Strategy Options (Phase 3 fallback control)
447 options_builder_add_bool(b, "prefer-webrtc", '\0', offsetof(options_t, prefer_webrtc), false,
448 "Try WebRTC before Direct TCP (useful when Direct TCP fails)", "NETWORK", false, NULL);
449
450 options_builder_add_bool(b, "no-webrtc", '\0', offsetof(options_t, no_webrtc), false,
451 "Disable WebRTC, use Direct TCP only", "NETWORK", false, NULL);
452
453 options_builder_add_bool(b, "webrtc-skip-stun", '\0', offsetof(options_t, webrtc_skip_stun), false,
454 "Skip WebRTC+STUN stage, go straight to TURN relay", "NETWORK", false, NULL);
455
456 options_builder_add_bool(b, "webrtc-disable-turn", '\0', offsetof(options_t, webrtc_disable_turn), false,
457 "Disable WebRTC+TURN relay, use STUN only", "NETWORK", false, NULL);
458
459 // WebRTC Server Configuration (for testing/debugging - production uses ACDS)
460 // Note: In production, ACDS provides these automatically via SESSION_JOINED response
461 options_builder_add_string(b, "stun-servers", '\0', offsetof(options_t, stun_servers), "",
462 "Comma-separated STUN server URLs (debug/test only - ACDS provides in production)",
463 "WEBRTC", false, "ASCII_CHAT_STUN_SERVERS", NULL);
464
465 options_builder_add_string(b, "turn-servers", '\0', offsetof(options_t, turn_servers), "",
466 "Comma-separated TURN server URLs (debug/test only - ACDS provides in production)",
467 "WEBRTC", false, "ASCII_CHAT_TURN_SERVERS", NULL);
468
469 options_builder_add_string(b, "turn-username", '\0', offsetof(options_t, turn_username), "",
470 "TURN authentication username (debug/test only - ACDS provides in production)", "WEBRTC",
471 false, "ASCII_CHAT_TURN_USERNAME", NULL);
472
473 options_builder_add_string(b, "turn-credential", '\0', offsetof(options_t, turn_credential), "",
474 "TURN authentication credential (debug/test only - ACDS provides in production)", "WEBRTC",
475 false, "ASCII_CHAT_TURN_CREDENTIAL", NULL);
476
477 // Security options (common with server, plus client-specific server-key)
478 add_crypto_common_options(b);
479
480 options_builder_add_string(b, "server-key", '\0', offsetof(options_t, server_key), "", "Expected server public key",
481 "SECURITY", false, NULL, NULL);
482
483 options_builder_add_bool(b, "acds-insecure", '\0', offsetof(options_t, acds_insecure), false,
484 "Skip server key verification (MITM-vulnerable, requires explicit opt-in)", "SECURITY",
485 false, NULL);
486
487 // Add binary-level logging options (--log-file, --log-level, -V, -q)
488 // These work before or after the mode name
489 add_binary_logging_options(b);
490
491 // Dependencies
492 options_builder_add_dependency_requires(b, "snapshot-delay", "snapshot",
493 "Option --snapshot-delay requires --snapshot");
494 options_builder_add_dependency_conflicts(b, "no-compress", "compression-level",
495 "Cannot use --no-compress with --compression-level");
496 options_builder_add_dependency_conflicts(b, "encode-audio", "no-encode-audio",
497 "Cannot use both --encode-audio and --no-encode-audio");
498
499 // Action options (execute and exit)
500 options_builder_add_action(b, "help", 'h', action_help_client, "Show this help message and exit", "ACTIONS");
501
502 options_builder_add_action(b, "list-webcams", '\0', action_list_webcams, "List available webcam devices and exit",
503 "ACTIONS");
504
505 options_builder_add_action(b, "list-microphones", '\0', action_list_microphones,
506 "List available microphone devices and exit", "ACTIONS");
507
508 options_builder_add_action(b, "list-speakers", '\0', action_list_speakers, "List available speaker devices and exit",
509 "ACTIONS");
510
511 options_builder_add_action(b, "show-capabilities", '\0', action_show_capabilities,
512 "Show terminal capabilities and exit", "ACTIONS");
513
514 // Positional argument: [address][:port]
516 b, "address", "[address][:port] - Server address (IPv4, IPv6, or hostname) with optional port",
517 false, // Not required (defaults to localhost:27224)
518 "ADDRESS FORMATS", g_client_address_examples,
519 sizeof(g_client_address_examples) / sizeof(g_client_address_examples[0]), parse_client_address);
520
521 const options_config_t *config = options_builder_build(b);
523 return config;
524}
void action_show_capabilities(void)
Show terminal capabilities and exit.
Definition actions.c:118
void action_list_microphones(void)
List available microphone devices and exit.
Definition actions.c:58
void action_list_webcams(void)
List available webcam devices and exit.
Definition actions.c:30
void action_list_speakers(void)
List available speaker devices and exit.
Definition actions.c:86
void action_help_client(void)
Show client mode help and exit.
Definition actions.c:198
void options_builder_add_dependency_requires(options_builder_t *builder, const char *option_name, const char *depends_on, const char *error_message)
Add dependency: if option_name is set, depends_on must be set.
Definition builder.c:565
void options_builder_add_dependency_conflicts(options_builder_t *builder, const char *option_name, const char *conflicts_with, const char *error_message)
Add anti-dependency: if option_name is set, conflicts_with must NOT be set.
Definition builder.c:577
void options_builder_add_int(options_builder_t *builder, const char *long_name, char short_name, size_t offset, int default_value, const char *help_text, const char *group, bool required, const char *env_var_name, bool(*validate)(const void *, char **))
Definition builder.c:367
#define OPT_MICROPHONE_INDEX_DEFAULT
Default microphone device index (-1 means system default)
Definition options.h:237
#define OPT_RECONNECT_ATTEMPTS_DEFAULT
Default reconnect attempts (-1 means auto/infinite)
Definition options.h:243
#define OPT_PORT_DEFAULT
Default TCP port for client/server communication.
Definition options.h:216
#define OPT_SPEAKERS_INDEX_DEFAULT
Default speakers device index (-1 means system default)
Definition options.h:240
int parse_client_address(const char *arg, void *config, char **remaining, int num_remaining, char **error_msg)
Parse client address positional argument.
Definition parsers.c:393

References action_help_client(), action_list_microphones(), action_list_speakers(), action_list_webcams(), action_show_capabilities(), options_builder_t::description, OPT_MICROPHONE_INDEX_DEFAULT, OPT_PORT_DEFAULT, OPT_RECONNECT_ATTEMPTS_DEFAULT, OPT_SPEAKERS_INDEX_DEFAULT, options_builder_add_action(), options_builder_add_bool(), options_builder_add_dependency_conflicts(), options_builder_add_dependency_requires(), options_builder_add_int(), options_builder_add_positional(), options_builder_add_string(), options_builder_build(), options_builder_create(), options_builder_destroy(), parse_client_address(), and options_builder_t::program_name.

Referenced by parse_client_options(), and usage_client().

◆ options_preset_mirror()

const options_config_t * options_preset_mirror ( const char *  program_name,
const char *  description 
)

Get mirror mode options preset.

Parameters
program_nameOptional program name (defaults to "ascii-chat mirror")
descriptionOptional program description (defaults to "Local webcam viewing (no network)")
Returns
Preset config (caller must free after use)

Definition at line 530 of file presets.c.

530 {
531 // Note: Each call creates a new config (no static caching) since program_name/description vary
533 if (!b)
534 return NULL;
535
536 b->program_name = program_name ? program_name : "ascii-chat mirror";
537 b->description = description ? description : "Local webcam viewing (no network)";
538
539 // Terminal dimensions, webcam, display, and snapshot options (shared with client)
540 add_terminal_dimension_options(b);
541 add_webcam_options(b);
542 add_display_options(b);
543 add_snapshot_options(b);
544
545 // Add binary-level logging options (--log-file, --log-level, -V, -q)
546 // These work before or after the mode name
547 add_binary_logging_options(b);
548
549 // Dependencies
550 options_builder_add_dependency_requires(b, "snapshot-delay", "snapshot",
551 "Option --snapshot-delay requires --snapshot");
552
553 // Action options (execute and exit)
554 options_builder_add_action(b, "help", 'h', action_help_mirror, "Show this help message and exit", "ACTIONS");
555
556 options_builder_add_action(b, "list-webcams", '\0', action_list_webcams, "List available webcam devices and exit",
557 "ACTIONS");
558
559 options_builder_add_action(b, "show-capabilities", '\0', action_show_capabilities,
560 "Show terminal capabilities and exit", "ACTIONS");
561
562 const options_config_t *config = options_builder_build(b);
564 return config;
565}
void action_help_mirror(void)
Show mirror mode help and exit.
Definition actions.c:204

References action_help_mirror(), action_list_webcams(), action_show_capabilities(), options_builder_t::description, options_builder_add_action(), options_builder_add_dependency_requires(), options_builder_build(), options_builder_create(), options_builder_destroy(), and options_builder_t::program_name.

Referenced by parse_mirror_options(), and usage_mirror().

◆ options_preset_server()

const options_config_t * options_preset_server ( const char *  program_name,
const char *  description 
)

Get server mode options preset.

Parameters
program_nameOptional program name (defaults to "ascii-chat server")
descriptionOptional program description (defaults to "Start ascii-chat server")
Returns
Preset config (caller must free after use)

Definition at line 300 of file presets.c.

300 {
301 // Note: Each call creates a new config (no static caching) since program_name/description vary
303 if (!b)
304 return NULL;
305
306 b->program_name = program_name ? program_name : "ascii-chat server";
307 b->description = description ? description : "Start ascii-chat server";
308
309 // Network options
310 // Note: Server bind addresses are positional arguments only, not flags
311 add_port_option(b, OPT_PORT_DEFAULT, "ASCII_CHAT_PORT");
312
313 options_builder_add_int(b, "max-clients", '\0', offsetof(options_t, max_clients), OPT_MAX_CLIENTS_DEFAULT,
314 "Maximum concurrent clients", "NETWORK", false, "ASCII_CHAT_MAX_CLIENTS", NULL);
315
316 // Compression and audio encoding options (shared with client)
317 add_compression_options(b);
318
319 options_builder_add_bool(b, "no-audio-mixer", '\0', offsetof(options_t, no_audio_mixer), false,
320 "Disable audio mixer (debug)", "PERFORMANCE", false, NULL);
321
322 // Security options (common with client, plus server-specific client-keys and no-encrypt)
323 add_crypto_common_options(b);
324
325 options_builder_add_string(b, "client-keys", '\0', offsetof(options_t, client_keys), "",
326 "Allowed client keys whitelist", "SECURITY", false, NULL, NULL);
327
328 options_builder_add_bool(b, "acds-expose-ip", '\0', offsetof(options_t, acds_expose_ip), false,
329 "Explicitly allow public IP disclosure in ACDS sessions (requires ACDS, opt-in only)",
330 "SECURITY", false, NULL);
331
332 options_builder_add_bool(b, "no-encrypt", '\0', offsetof(options_t, no_encrypt), false, "Disable encryption",
333 "SECURITY", false, NULL);
334
335 // ACDS Session Registration
336 options_builder_add_bool(b, "acds", '\0', offsetof(options_t, acds), false,
337 "Enable ACDS session registration (requires --key or --password or --acds-expose-ip)",
338 "DISCOVERY", false, NULL);
339
340 // ACDS Discovery options (shared with client)
341 add_acds_discovery_options(b);
342
343 options_builder_add_bool(b, "upnp", '\0', offsetof(options_t, enable_upnp), true,
344 "Enable UPnP/NAT-PMP for automatic port mapping (enables direct TCP for most home users)",
345 "DISCOVERY", false, "ASCII_CHAT_UPNP");
346
347 options_builder_add_bool(b, "no-upnp", '\0', offsetof(options_t, no_upnp), false,
348 "Disable UPnP/NAT-PMP port mapping (requires manual port forwarding)", "DISCOVERY", false,
349 NULL);
350
351 options_builder_add_bool(b, "no-mdns-advertise", '\0', offsetof(options_t, no_mdns_advertise), false,
352 "Disable mDNS service advertisement on local network (LAN discovery won't find this server)",
353 "DISCOVERY", false, NULL);
354
355 // Add binary-level logging options (--log-file, --log-level, -V, -q)
356 // These work before or after the mode name
357 add_binary_logging_options(b);
358
359 // Dependencies
360 options_builder_add_dependency_conflicts(b, "no-encrypt", "encrypt", "Cannot use --no-encrypt with --encrypt");
361 options_builder_add_dependency_conflicts(b, "no-encrypt", "key", "Cannot use --no-encrypt with --key");
362 options_builder_add_dependency_conflicts(b, "no-encrypt", "password", "Cannot use --no-encrypt with --password");
363 options_builder_add_dependency_conflicts(b, "no-compress", "compression-level",
364 "Cannot use --no-compress with --compression-level");
365 options_builder_add_dependency_conflicts(b, "encode-audio", "no-encode-audio",
366 "Cannot use both --encode-audio and --no-encode-audio");
367
368 // Action options (execute and exit)
369 options_builder_add_action(b, "help", 'h', action_help_server, "Show this help message and exit", "ACTIONS");
370
371 options_builder_add_action(b, "list-webcams", '\0', action_list_webcams, "List available webcam devices and exit",
372 "ACTIONS");
373
374 options_builder_add_action(b, "list-microphones", '\0', action_list_microphones,
375 "List available microphone devices and exit", "ACTIONS");
376
377 options_builder_add_action(b, "list-speakers", '\0', action_list_speakers, "List available speaker devices and exit",
378 "ACTIONS");
379
380 options_builder_add_action(b, "version", 'V', action_show_version, "Show version information and exit", "ACTIONS");
381
382 // Positional arguments: 0-2 bind addresses (IPv4 and/or IPv6)
383 options_builder_add_positional(b, "bind-address", "IPv4 or IPv6 bind address (can specify 0-2 addresses)",
384 false, // Not required (defaults to localhost)
385 "BIND ADDRESS FORMATS", g_server_bind_address_examples,
386 sizeof(g_server_bind_address_examples) / sizeof(g_server_bind_address_examples[0]),
388
389 const options_config_t *config = options_builder_build(b);
391 return config;
392}
void action_help_server(void)
Show server mode help and exit.
Definition actions.c:192
#define OPT_MAX_CLIENTS_DEFAULT
Default maximum concurrent clients (server only)
Definition options.h:225

References action_help_server(), action_list_microphones(), action_list_speakers(), action_list_webcams(), action_show_version(), options_builder_t::description, OPT_MAX_CLIENTS_DEFAULT, OPT_PORT_DEFAULT, options_builder_add_action(), options_builder_add_bool(), options_builder_add_dependency_conflicts(), options_builder_add_int(), options_builder_add_positional(), options_builder_add_string(), options_builder_build(), options_builder_create(), options_builder_destroy(), parse_server_bind_address(), and options_builder_t::program_name.

Referenced by parse_server_options(), and usage_server().