nquic_packet_io (nquic v1.0.0)
View SourcePacket construction, encryption, and sending for QUIC connections.
This module handles the common logic for building and sending QUIC packets across all packet types (Initial, Handshake, 1-RTT).
Summary
Functions
Send a 1-RTT packet with the specified frame.
Send a CONNECTION_CLOSE frame.
Send a Handshake packet with the specified frames.
Send an Initial packet with the specified frames.
Functions
-spec find_highest_key_level(map()) -> application | handshake | initial.
-spec hp_sample(binary(), binary(), non_neg_integer()) -> binary().
-spec send_app_packet(nquic_socket:t(), nquic_socket:sockaddr(), nquic:connection_id(), #{key := binary(), iv := binary(), hp := binary(), atom() => term()}, {nquic_packet_number:t(), nquic_frame:t()}) -> {ok, iodata(), non_neg_integer()} | {error, term()}.
Send a 1-RTT packet with the specified frame.
-spec send_close_frame(nquic_socket:t(), nquic_socket:sockaddr(), #{dcid := nquic:connection_id(), scid := nquic:connection_id(), keys := map(), pn_spaces := map(), role := client | server, frame := #connection_close{error_code :: non_neg_integer(), frame_type :: non_neg_integer(), reason_phrase :: binary(), is_application :: boolean()}}) -> ok | {error, term()}.
Send a CONNECTION_CLOSE frame.
-spec send_handshake_packet(nquic_socket:t(), nquic_socket:sockaddr(), nquic:connection_id(), nquic:connection_id(), #{key := binary(), iv := binary(), hp := binary(), atom() => term()}, {nquic_packet_number:t(), [nquic_frame:t()]}) -> {ok, iodata(), non_neg_integer()} | {error, term()}.
Send a Handshake packet with the specified frames.
-spec send_handshake_packet(nquic_socket:t(), nquic_socket:sockaddr(), nquic:connection_id(), nquic:connection_id(), #{key := binary(), iv := binary(), hp := binary(), atom() => term()}, {nquic_packet_number:t(), [nquic_frame:t()]}, non_neg_integer()) -> {ok, iodata(), non_neg_integer()} | {error, term()}.
-spec send_initial_packet(nquic_socket:t(), nquic_socket:sockaddr(), nquic:connection_id(), nquic:connection_id(), #{key := binary(), iv := binary(), hp := binary(), atom() => term()}, {nquic_packet_number:t(), [nquic_frame:t()]}) -> {ok, iodata(), non_neg_integer()} | {error, term()}.
Send an Initial packet with the specified frames.
-spec send_initial_packet(nquic_socket:t(), nquic_socket:sockaddr(), nquic:connection_id(), nquic:connection_id(), #{key := binary(), iv := binary(), hp := binary(), atom() => term()}, {nquic_packet_number:t(), [nquic_frame:t()]}, non_neg_integer()) -> {ok, iodata(), non_neg_integer()} | {error, term()}.