ascii-chat 0.6.0
Real-time terminal-based video chat with ASCII art conversion
Loading...
Searching...
No Matches
connection_attempt_context_t Struct Reference

Master context for connection attempt with fallback. More...

#include <src/client/connection_state.h>

Data Fields

connection_state_t current_state
 Current connection state.
 
connection_state_t previous_state
 Previous state (for debugging)
 
time_t stage_start_time
 When current stage began.
 
uint32_t current_stage_timeout_seconds
 Timeout for current stage (3/8/15)
 
acip_transport_ttcp_transport
 TCP transport (Stage 1) - may be NULL.
 
acip_transport_tacds_transport
 ACDS signaling transport (Stages 2/3) - may be NULL.
 
acip_transport_twebrtc_transport
 WebRTC transport (Stages 2/3) - may be NULL.
 
acip_transport_tactive_transport
 Currently active transport (whichever succeeded)
 
struct tcp_clienttcp_client_instance
 TCP client instance (Direct TCP only) - owned by context.
 
connection_session_context_t session_ctx
 Session context from ACDS.
 
webrtc_peer_manager_tpeer_manager
 WebRTC peer manager (Stages 2/3)
 
mutex_t webrtc_mutex
 Mutex for WebRTC callback synchronization.
 
cond_t webrtc_ready_cond
 Condition variable for on_transport_ready.
 
bool webrtc_transport_received
 Flag: transport_ready callback fired.
 
connection_stun_turn_config_t stun_turn_cfg
 STUN/TURN server config.
 
bool prefer_webrtc
 –prefer-webrtc flag
 
bool no_webrtc
 –no-webrtc flag (disable WebRTC, TCP only)
 
bool webrtc_skip_stun
 –webrtc-skip-stun flag (skip Stage 2 STUN)
 
bool webrtc_disable_turn
 –webrtc-disable-turn flag (skip Stage 3 TURN)
 
uint32_t reconnect_attempt
 Reconnection attempt number (1st, 2nd, etc.)
 
uint32_t stage_failures
 How many stages have failed.
 
uint32_t total_transitions
 Total state transitions (for metrics)
 

Detailed Description

Master context for connection attempt with fallback.

Orchestrates the entire connection flow including:

  • State machine tracking (current state, previous state)
  • Timeout management (stage start time, elapsed time)
  • Transport management (TCP socket, WebRTC peer connection)
  • Session context (session_id, participant_id)
  • Configuration (STUN/TURN servers, CLI flags)
  • Statistics (retry count, stage transitions)

Created at client startup, passed through all connection stages. Persists across reconnection attempts to maintain state.

Definition at line 140 of file connection_state.h.

Field Documentation

◆ acds_transport

acip_transport_t* connection_attempt_context_t::acds_transport

ACDS signaling transport (Stages 2/3) - may be NULL.

Definition at line 160 of file connection_state.h.

◆ active_transport

acip_transport_t* connection_attempt_context_t::active_transport

Currently active transport (whichever succeeded)

Definition at line 162 of file connection_state.h.

Referenced by client_main(), and connection_context_cleanup().

◆ current_stage_timeout_seconds

uint32_t connection_attempt_context_t::current_stage_timeout_seconds

Timeout for current stage (3/8/15)

Definition at line 153 of file connection_state.h.

Referenced by connection_check_timeout(), connection_context_init(), and connection_state_transition().

◆ current_state

connection_state_t connection_attempt_context_t::current_state

Current connection state.

Definition at line 145 of file connection_state.h.

Referenced by connection_check_timeout(), connection_context_init(), and connection_state_transition().

◆ no_webrtc

bool connection_attempt_context_t::no_webrtc

–no-webrtc flag (disable WebRTC, TCP only)

Definition at line 192 of file connection_state.h.

Referenced by connection_attempt_with_fallback(), and connection_context_init().

◆ peer_manager

webrtc_peer_manager_t* connection_attempt_context_t::peer_manager

WebRTC peer manager (Stages 2/3)

Definition at line 171 of file connection_state.h.

Referenced by connection_context_cleanup().

◆ prefer_webrtc

bool connection_attempt_context_t::prefer_webrtc

–prefer-webrtc flag

Definition at line 191 of file connection_state.h.

Referenced by connection_attempt_with_fallback(), and connection_context_init().

◆ previous_state

connection_state_t connection_attempt_context_t::previous_state

Previous state (for debugging)

Definition at line 146 of file connection_state.h.

Referenced by connection_context_init(), and connection_state_transition().

◆ reconnect_attempt

uint32_t connection_attempt_context_t::reconnect_attempt

Reconnection attempt number (1st, 2nd, etc.)

Definition at line 200 of file connection_state.h.

Referenced by client_main(), connection_attempt_with_fallback(), and connection_context_init().

◆ session_ctx

connection_session_context_t connection_attempt_context_t::session_ctx

Session context from ACDS.

Definition at line 170 of file connection_state.h.

Referenced by client_main().

◆ stage_failures

uint32_t connection_attempt_context_t::stage_failures

How many stages have failed.

Definition at line 201 of file connection_state.h.

Referenced by connection_context_init().

◆ stage_start_time

time_t connection_attempt_context_t::stage_start_time

When current stage began.

Definition at line 152 of file connection_state.h.

Referenced by connection_check_timeout(), connection_context_init(), and connection_state_transition().

◆ stun_turn_cfg

connection_stun_turn_config_t connection_attempt_context_t::stun_turn_cfg

STUN/TURN server config.

Definition at line 185 of file connection_state.h.

◆ tcp_client_instance

struct tcp_client* connection_attempt_context_t::tcp_client_instance

TCP client instance (Direct TCP only) - owned by context.

Definition at line 164 of file connection_state.h.

Referenced by connection_context_cleanup().

◆ tcp_transport

acip_transport_t* connection_attempt_context_t::tcp_transport

TCP transport (Stage 1) - may be NULL.

Definition at line 159 of file connection_state.h.

Referenced by connection_context_cleanup().

◆ total_transitions

uint32_t connection_attempt_context_t::total_transitions

Total state transitions (for metrics)

Definition at line 202 of file connection_state.h.

Referenced by connection_context_init(), and connection_state_transition().

◆ webrtc_disable_turn

bool connection_attempt_context_t::webrtc_disable_turn

–webrtc-disable-turn flag (skip Stage 3 TURN)

Definition at line 194 of file connection_state.h.

Referenced by connection_attempt_with_fallback(), and connection_context_init().

◆ webrtc_mutex

mutex_t connection_attempt_context_t::webrtc_mutex

Mutex for WebRTC callback synchronization.

Definition at line 177 of file connection_state.h.

◆ webrtc_ready_cond

cond_t connection_attempt_context_t::webrtc_ready_cond

Condition variable for on_transport_ready.

Definition at line 178 of file connection_state.h.

◆ webrtc_skip_stun

bool connection_attempt_context_t::webrtc_skip_stun

–webrtc-skip-stun flag (skip Stage 2 STUN)

Definition at line 193 of file connection_state.h.

Referenced by connection_attempt_with_fallback(), and connection_context_init().

◆ webrtc_transport

acip_transport_t* connection_attempt_context_t::webrtc_transport

WebRTC transport (Stages 2/3) - may be NULL.

Definition at line 161 of file connection_state.h.

Referenced by connection_context_cleanup().

◆ webrtc_transport_received

bool connection_attempt_context_t::webrtc_transport_received

Flag: transport_ready callback fired.

Definition at line 179 of file connection_state.h.


The documentation for this struct was generated from the following file: