# `Quic.HandshakeScheduler`
[🔗](https://github.com/gsmlg-dev/http_fetch/blob/v1.0.0-rc.9/apps/elixir_quic/lib/quic/handshake_scheduler.ex#L1)

Deterministic handshake packet scheduler.

This module is deliberately socket-free.  TLS emissions become retained
CRYPTO ranges and protected send effects; local send receipts and peer ACKs
are applied separately through `Quic.Recovery`.

# `t`

```elixir
@type t() :: %Quic.HandshakeScheduler{
  acked_stream_fins: term(),
  acked_stream_ranges: term(),
  authenticated_error: term(),
  authenticated_packets: term(),
  dcid: term(),
  effects: term(),
  key_update: term(),
  keys: term(),
  local_cid_limit: term(),
  local_cids: term(),
  local_max_datagram_frame_size: term(),
  max_packet_size: term(),
  max_queue: term(),
  max_queue_bytes: term(),
  min_initial_size: term(),
  original_dcid: term(),
  path_events: term(),
  peer_cids: term(),
  peer_disable_active_migration: term(),
  peer_idle_timeout: term(),
  peer_initial_scid: term(),
  peer_max_datagram_frame_size: term(),
  pending: term(),
  pending_acks: term(),
  pending_control: term(),
  queued: term(),
  queued_bytes: term(),
  read_keys: term(),
  receive_path: term(),
  received_dcid: term(),
  recovery: term(),
  retry_scid: term(),
  retry_token: term(),
  role: term(),
  scid: term(),
  streams: term(),
  tls: term()
}
```

# `bind_path`

Bind a migrated destination to an unused peer CID, except same-CID NAT rebinding.

# `cancel_unsent`

Settle a definitely unsent packet and retain its reliable work for scheduling.

The caller removes the corresponding effect and schedules after selecting a
usable path. Sent or uncertain writes cannot be cancelled through this API.

# `confirm_handshake`

```elixir
@spec confirm_handshake(t()) :: t()
```

Confirm QUIC and retire Handshake after role-specific confirmation.

# `consume_stream`

Consume queued stream events for a manual-delivery stream policy.

# `drop_path_binding`

Release a path binding and queue retirement of its contiguous spent CID prefix.

# `effective_datagram_frame_size`

Effective frame ceiling after peer negotiation and worst-case packet overhead.

# `feed`

```elixir
@spec feed(t(), atom(), non_neg_integer(), binary()) ::
  {:ok, t(), list()} | {:error, term(), t(), list()}
```

Fold TLS driver effects returned from a CRYPTO receive into the scheduler.

# `handshake_done`

Send HANDSHAKE_DONE after the server completes its TLS handshake.

# `install_peer_parameters`

Install the semantic values of authenticated, validated peer parameters.

# `local_send`

Apply a local writer result; this is distinct from packet admission.

# `new`

```elixir
@spec new(:client | :server, keyword()) ::
  {:ok, t(), list()} | {:error, term()} | {:error, term(), t()}
```

# `open_stream`

```elixir
@spec open_stream(t(), :bidi | :uni) ::
  {:ok, t(), non_neg_integer()} | {:blocked, map()} | {:error, term()}
```

Open a locally initiated stream without creating a process per stream.

# `path_available?`

Whether this destination has an available peer CID.

# `pending_send_valid?`

Whether an unsent effect still carries the retained, current ciphertext.

# `ping`

Admit one ack-eliciting application PING through the bounded recovery scheduler.

# `probe`

Send one PTO-authorized probe without draining unrelated queued application work.

# `queue_ack`

Queue an ACK frame for the next packet in a packet-number space.

# `queue_control`

Queue reliable control information, coalescing monotonic credit updates.

# `receive_ack`

Apply an authenticated peer ACK to Recovery.

# `receive_datagram`

```elixir
@spec receive_datagram(t(), binary(), integer()) ::
  {:ok, t(), [map()]} | {:error, term(), t()}
```

Process bounded coalesced packets in order, preserving an accepted prefix.

# `receive_datagram`

Process datagrams with authenticated arrival-path observations.

# `receive_packet`

Alias for callers that process one packet rather than a datagram batch.

# `reset_stream`

Reset only the local send direction and discard its pending data ranges.

# `retire_level`

```elixir
@spec retire_level(t(), :initial | :handshake) :: t()
```

Drop the QUIC keys, retained packets and CRYPTO storage for an obsolete level.

# `retired?`

```elixir
@spec retired?(t(), :initial | :handshake | :application) :: boolean()
```

Whether the packet-number space is permanently retired.

# `retransmit`

Return the exact retained datagram for retransmission.

# `retry_crypto`

Repacketize retained CRYPTO under a fresh packet number without calling TLS.

# `schedule`

```elixir
@spec schedule(t()) :: {:ok, t(), list()} | {:error, term(), t()}
```

Schedule all currently pending emissions and queued ACKs.

# `send_datagram`

Admit one unreliable application DATAGRAM frame; loss never requeues it.

# `send_path_frames`

Protect a bounded path probe or response without changing the selected path.

# `send_stream`

```elixir
@spec send_stream(t(), non_neg_integer(), binary(), boolean()) ::
  {:ok, t(), list()}
  | {:blocked, map() | :send_queue_limit | :send_queue_bytes_limit}
  | {:error, term()}
  | {:error, term(), t()}
```

Admit one application stream frame into the bounded scheduler queue.

# `stop_stream`

Request cancellation of the receive direction, preserving the send half.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
