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

Discovery session context. More...

#include <src/discovery/session.h>

Data Fields

discovery_state_t state
asciichat_error_t error
uint64_t waiting_peer_start_ns
 Timestamp when entered WAITING_PEER state (for timeout).
uint8_t session_id [SESSION_ID_SIZE]
uint8_t participant_id [SESSION_ID_SIZE]
uint8_t initiator_id [SESSION_ID_SIZE]
char session_string [SESSION_STRING_BUFFER_SIZE]
char password [ACIP_PASSWORD_SIZE]
 Session password used when joining password-protected sessions.
bool is_initiator
bool is_host
bool host_elected
 True if we've been elected as host (even if waiting for peer).
uint8_t identity_pubkey [ED25519_PUBLIC_KEY_SIZE]
 Ed25519 public key for this participant (primary key).
uint8_t identity_seckey [ED25519_PRIVATE_KEY_SIZE]
 Ed25519 secret key for signing (primary key).
uint8_t identity_pubkeys [MAX_SESSION_KEYS][ED25519_PUBLIC_KEY_SIZE]
 All public keys for multi-key protocol.
uint8_t identity_seckeys [MAX_SESSION_KEYS][ED25519_PRIVATE_KEY_SIZE]
 Matching Ed25519 signing keys.
size_t num_identity_keys
 Number of identity keys loaded.
network_connection_t * acds_connection
acip_transport_t * acds_transport
 Persistent transport for ACDS communication.
uint64_t last_acds_keepalive_ns
 Last keepalive sent to the discovery service.
char acds_address [64]
uint16_t acds_port
char acds_url [512]
 instead of TCP)
uint8_t host_id [SESSION_ID_SIZE]
char host_address [ACIP_ADDRESS_SIZE]
uint16_t host_port
uint8_t session_type
 0 = DIRECT_TCP, 1 = WEBRTC
char turn_username [ACIP_TURN_AUTH_SIZE]
char turn_password [ACIP_PASSWORD_SIZE]
negotiate_ctx_t negotiate
nat_quality_t cached_nat_quality
bool nat_quality_cached
uint64_t nat_quality_measured_ms
platform_thread_t nat_detection_thread
bool nat_detection_thread_started
bool nat_detection_completed
 Protected by nat_quality_mutex.
bool nat_detection_attempted
uint64_t nat_detection_last_attempt_ms
mutex_t nat_quality_mutex
host_liveness_t liveness
uint64_t handoff_last_sample_ms
uint32_t handoff_sequence
uint32_t handoff_generation
bool handoff_pending
bool host_authority_received
uint32_t host_authority_generation
uint32_t host_authority_sequence
uint64_t host_loss_detected_ms
 Local deadline origin while awaiting ACDS recovery.
struct webrtc_peer_manager * peer_manager
 The useful part of discovery session is in state, error, waiting_peer_start_ns, is_initiator: together they describe what is pending, who owns it, and how much data is valid. Keep the object with its parent operation and use the parent cleanup path.
bool webrtc_transport_ready
 True when DataChannel is open and transport created.
bool webrtc_connection_initiated
 True when we've called webrtc_peer_manager_connect().
int webrtc_retry_attempt
 Current retry attempt number (0 = initial, 1+ = retries).
uint64_t webrtc_last_attempt_time_ms
 Timestamp of last connection attempt (monotonic time).
uint64_t webrtc_disconnected_since_ms
 Start of a transient peer disconnection.
stun_server_t * stun_servers
 STUN servers from ACDS.
size_t stun_count
 Number of STUN servers.
turn_server_t * turn_servers
 TURN servers from ACDS.
size_t turn_count
 Number of TURN servers.
session_host_t * host_ctx
session_participant_t * participant_ctx
acip_transport_t * host_control_transport
 Host control connection retained during WebRTC media.
network_connection_t * host_control_connection
 Ownership transferred with the control connection.
void(* on_state_change )(discovery_state_t new_state, void *user_data)
void(* on_session_ready )(const char *session_string, void *user_data)
void(* on_error )(asciichat_error_t error, const char *message, void *user_data)
void * callback_user_data
discovery_should_exit_fn should_exit_callback
void * exit_callback_data

Detailed Description

Discovery session context.

Definition at line 99 of file src/discovery/session.h.

Field Documentation

◆ acds_address

char discovery_session_t::acds_address[64]

Definition at line 128 of file src/discovery/session.h.

Referenced by discovery_session_create().

◆ acds_connection

network_connection_t* discovery_session_t::acds_connection

Definition at line 125 of file src/discovery/session.h.

Referenced by discovery_session_destroy(), and discovery_session_start().

◆ acds_port

uint16_t discovery_session_t::acds_port

Definition at line 129 of file src/discovery/session.h.

Referenced by discovery_session_create().

◆ acds_transport

acip_transport_t* discovery_session_t::acds_transport

◆ acds_url

char discovery_session_t::acds_url[512]

instead of TCP)

ACDS WebSocket URL (ws:// or wss://, if set uses WebSocket

Definition at line 130 of file src/discovery/session.h.

Referenced by discovery_session_create(), and discovery_session_start().

◆ cached_nat_quality

nat_quality_t discovery_session_t::cached_nat_quality

Definition at line 147 of file src/discovery/session.h.

◆ callback_user_data

void* discovery_session_t::callback_user_data

Definition at line 203 of file src/discovery/session.h.

Referenced by discovery_session_create().

◆ error

asciichat_error_t discovery_session_t::error

Definition at line 102 of file src/discovery/session.h.

Referenced by discovery_session_process().

◆ exit_callback_data

void* discovery_session_t::exit_callback_data

Definition at line 207 of file src/discovery/session.h.

Referenced by discovery_session_create(), and discovery_session_start().

◆ handoff_generation

uint32_t discovery_session_t::handoff_generation

Definition at line 164 of file src/discovery/session.h.

Referenced by discovery_session_create().

◆ handoff_last_sample_ms

uint64_t discovery_session_t::handoff_last_sample_ms

Definition at line 162 of file src/discovery/session.h.

◆ handoff_pending

bool discovery_session_t::handoff_pending

Definition at line 165 of file src/discovery/session.h.

Referenced by discovery_session_apply_handoff().

◆ handoff_sequence

uint32_t discovery_session_t::handoff_sequence

Definition at line 163 of file src/discovery/session.h.

◆ host_address

char discovery_session_t::host_address[ACIP_ADDRESS_SIZE]

Definition at line 135 of file src/discovery/session.h.

◆ host_authority_generation

uint32_t discovery_session_t::host_authority_generation

Definition at line 167 of file src/discovery/session.h.

◆ host_authority_received

bool discovery_session_t::host_authority_received

Definition at line 166 of file src/discovery/session.h.

◆ host_authority_sequence

uint32_t discovery_session_t::host_authority_sequence

Definition at line 168 of file src/discovery/session.h.

◆ host_control_connection

network_connection_t* discovery_session_t::host_control_connection

Ownership transferred with the control connection.

Definition at line 197 of file src/discovery/session.h.

◆ host_control_transport

acip_transport_t* discovery_session_t::host_control_transport

Host control connection retained during WebRTC media.

Definition at line 196 of file src/discovery/session.h.

◆ host_ctx

◆ host_elected

bool discovery_session_t::host_elected

True if we've been elected as host (even if waiting for peer).

Definition at line 113 of file src/discovery/session.h.

◆ host_id

uint8_t discovery_session_t::host_id[SESSION_ID_SIZE]

◆ host_loss_detected_ms

uint64_t discovery_session_t::host_loss_detected_ms

Local deadline origin while awaiting ACDS recovery.

Definition at line 170 of file src/discovery/session.h.

Referenced by discovery_session_apply_handoff(), and discovery_session_handle_host_disconnect().

◆ host_port

uint16_t discovery_session_t::host_port

Definition at line 136 of file src/discovery/session.h.

◆ identity_pubkey

uint8_t discovery_session_t::identity_pubkey[ED25519_PUBLIC_KEY_SIZE]

Ed25519 public key for this participant (primary key).

Definition at line 116 of file src/discovery/session.h.

Referenced by discovery_session_create(), and discovery_session_start().

◆ identity_pubkeys

uint8_t discovery_session_t::identity_pubkeys[MAX_SESSION_KEYS][ED25519_PUBLIC_KEY_SIZE]

All public keys for multi-key protocol.

Definition at line 120 of file src/discovery/session.h.

Referenced by discovery_session_create().

◆ identity_seckey

uint8_t discovery_session_t::identity_seckey[ED25519_PRIVATE_KEY_SIZE]

Ed25519 secret key for signing (primary key).

Definition at line 117 of file src/discovery/session.h.

Referenced by discovery_session_create(), discovery_session_destroy(), and discovery_session_start().

◆ identity_seckeys

uint8_t discovery_session_t::identity_seckeys[MAX_SESSION_KEYS][ED25519_PRIVATE_KEY_SIZE]

Matching Ed25519 signing keys.

Definition at line 121 of file src/discovery/session.h.

Referenced by discovery_session_create(), and discovery_session_destroy().

◆ initiator_id

uint8_t discovery_session_t::initiator_id[SESSION_ID_SIZE]

Definition at line 108 of file src/discovery/session.h.

◆ is_host

bool discovery_session_t::is_host

◆ is_initiator

bool discovery_session_t::is_initiator

Definition at line 111 of file src/discovery/session.h.

Referenced by discovery_session_create(), and discovery_session_start().

◆ last_acds_keepalive_ns

uint64_t discovery_session_t::last_acds_keepalive_ns

Last keepalive sent to the discovery service.

Definition at line 127 of file src/discovery/session.h.

◆ liveness

◆ nat_detection_attempted

bool discovery_session_t::nat_detection_attempted

Definition at line 155 of file src/discovery/session.h.

◆ nat_detection_completed

bool discovery_session_t::nat_detection_completed

Protected by nat_quality_mutex.

Definition at line 154 of file src/discovery/session.h.

◆ nat_detection_last_attempt_ms

uint64_t discovery_session_t::nat_detection_last_attempt_ms

Definition at line 156 of file src/discovery/session.h.

◆ nat_detection_thread

platform_thread_t discovery_session_t::nat_detection_thread

Definition at line 152 of file src/discovery/session.h.

Referenced by discovery_session_destroy().

◆ nat_detection_thread_started

bool discovery_session_t::nat_detection_thread_started

Definition at line 153 of file src/discovery/session.h.

Referenced by discovery_session_destroy().

◆ nat_quality_cached

bool discovery_session_t::nat_quality_cached

Definition at line 148 of file src/discovery/session.h.

◆ nat_quality_measured_ms

uint64_t discovery_session_t::nat_quality_measured_ms

Definition at line 149 of file src/discovery/session.h.

◆ nat_quality_mutex

mutex_t discovery_session_t::nat_quality_mutex

Definition at line 157 of file src/discovery/session.h.

Referenced by discovery_session_create(), and discovery_session_destroy().

◆ negotiate

negotiate_ctx_t discovery_session_t::negotiate

Definition at line 144 of file src/discovery/session.h.

◆ num_identity_keys

size_t discovery_session_t::num_identity_keys

Number of identity keys loaded.

Definition at line 122 of file src/discovery/session.h.

Referenced by discovery_session_create().

◆ on_error

void(* discovery_session_t::on_error) (asciichat_error_t error, const char *message, void *user_data)

Definition at line 202 of file src/discovery/session.h.

Referenced by discovery_session_create().

◆ on_session_ready

void(* discovery_session_t::on_session_ready) (const char *session_string, void *user_data)

Definition at line 201 of file src/discovery/session.h.

Referenced by discovery_session_create().

◆ on_state_change

void(* discovery_session_t::on_state_change) (discovery_state_t new_state, void *user_data)

Definition at line 200 of file src/discovery/session.h.

Referenced by discovery_session_create().

◆ participant_ctx

◆ participant_id

◆ password

char discovery_session_t::password[ACIP_PASSWORD_SIZE]

Session password used when joining password-protected sessions.

Definition at line 110 of file src/discovery/session.h.

Referenced by discovery_session_create(), and discovery_session_destroy().

◆ peer_manager

struct webrtc_peer_manager* discovery_session_t::peer_manager

The useful part of discovery session is in state, error, waiting_peer_start_ns, is_initiator: together they describe what is pending, who owns it, and how much data is valid. Keep the object with its parent operation and use the parent cleanup path.

WebRTC peer connection manager (NULL for TCP sessions)

Definition at line 178 of file src/discovery/session.h.

Referenced by discovery_session_apply_handoff(), discovery_session_create(), discovery_session_destroy(), and discovery_session_process().

◆ session_id

uint8_t discovery_session_t::session_id[SESSION_ID_SIZE]

◆ session_string

char discovery_session_t::session_string[SESSION_STRING_BUFFER_SIZE]

◆ session_type

uint8_t discovery_session_t::session_type

0 = DIRECT_TCP, 1 = WEBRTC

Definition at line 137 of file src/discovery/session.h.

Referenced by discovery_session_apply_handoff(), discovery_session_check_host_alive(), and discovery_session_process().

◆ should_exit_callback

discovery_should_exit_fn discovery_session_t::should_exit_callback

Definition at line 206 of file src/discovery/session.h.

Referenced by discovery_session_create(), and discovery_session_start().

◆ state

◆ stun_count

size_t discovery_session_t::stun_count

Number of STUN servers.

Definition at line 189 of file src/discovery/session.h.

Referenced by discovery_session_create(), and discovery_session_destroy().

◆ stun_servers

stun_server_t* discovery_session_t::stun_servers

STUN servers from ACDS.

Definition at line 188 of file src/discovery/session.h.

Referenced by discovery_session_create(), and discovery_session_destroy().

◆ turn_count

size_t discovery_session_t::turn_count

Number of TURN servers.

Definition at line 191 of file src/discovery/session.h.

Referenced by discovery_session_create(), and discovery_session_destroy().

◆ turn_password

char discovery_session_t::turn_password[ACIP_PASSWORD_SIZE]

Definition at line 141 of file src/discovery/session.h.

◆ turn_servers

turn_server_t* discovery_session_t::turn_servers

TURN servers from ACDS.

Definition at line 190 of file src/discovery/session.h.

Referenced by discovery_session_create(), and discovery_session_destroy().

◆ turn_username

char discovery_session_t::turn_username[ACIP_TURN_AUTH_SIZE]

Definition at line 140 of file src/discovery/session.h.

◆ waiting_peer_start_ns

uint64_t discovery_session_t::waiting_peer_start_ns

Timestamp when entered WAITING_PEER state (for timeout).

Definition at line 103 of file src/discovery/session.h.

◆ webrtc_connection_initiated

bool discovery_session_t::webrtc_connection_initiated

True when we've called webrtc_peer_manager_connect().

Definition at line 180 of file src/discovery/session.h.

Referenced by discovery_session_apply_handoff(), and discovery_session_create().

◆ webrtc_disconnected_since_ms

uint64_t discovery_session_t::webrtc_disconnected_since_ms

Start of a transient peer disconnection.

Definition at line 183 of file src/discovery/session.h.

Referenced by discovery_session_apply_handoff(), and discovery_session_create().

◆ webrtc_last_attempt_time_ms

uint64_t discovery_session_t::webrtc_last_attempt_time_ms

Timestamp of last connection attempt (monotonic time).

Definition at line 182 of file src/discovery/session.h.

Referenced by discovery_session_create().

◆ webrtc_retry_attempt

int discovery_session_t::webrtc_retry_attempt

Current retry attempt number (0 = initial, 1+ = retries).

Definition at line 181 of file src/discovery/session.h.

Referenced by discovery_session_apply_handoff(), and discovery_session_create().

◆ webrtc_transport_ready

bool discovery_session_t::webrtc_transport_ready

True when DataChannel is open and transport created.

Definition at line 179 of file src/discovery/session.h.

Referenced by discovery_session_apply_handoff(), discovery_session_check_host_alive(), and discovery_session_create().


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