<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE rfc [
  <!ENTITY nbsp    "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">
]>
<?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>
<!-- generated by https://github.com/cabo/kramdown-rfc version 1.6.26 (Ruby 3.1.3) -->
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" ipr="trust200902" docName="draft-thomson-quic-enough-00" category="std" consensus="true" submissionType="IETF" tocInclude="true" sortRefs="true" symRefs="true" version="3">
  <!-- xml2rfc v2v3 conversion 3.17.0 -->
  <front>
    <title abbrev="QUIC Enough">Signaling That a QUIC Receiver Has Enough Stream Data</title>
    <seriesInfo name="Internet-Draft" value="draft-thomson-quic-enough-00"/>
    <author fullname="Martin Thomson">
      <organization>Mozilla</organization>
      <address>
        <email>mt@lowentropy.net</email>
      </address>
    </author>
    <date year="2023" month="March" day="31"/>
    <area>Transport</area>
    <workgroup>QUIC</workgroup>
    <keyword>next generation</keyword>
    <keyword>unicorn</keyword>
    <keyword>sparkling distributed ledger</keyword>
    <abstract>
      <t>Sending on QUIC streams can only be aborted early by the sender with a RESET_STREAM frame.
This document describes how a receiver can indicate when the data they have received is enough,
allowing the sender to reliably deliver some data, but abort sending for anything more than the indicated amount.</t>
    </abstract>
    <note removeInRFC="true">
      <name>About This Document</name>
      <t>
        The latest revision of this draft can be found at <eref target="https://martinthomson.github.io/quic-enough/draft-thomson-quic-enough.html"/>.
        Status information for this document may be found at <eref target="https://datatracker.ietf.org/doc/draft-thomson-quic-enough/"/>.
      </t>
      <t>
        Discussion of this document takes place on the
        QUIC Working Group mailing list (<eref target="mailto:quic@ietf.org"/>),
        which is archived at <eref target="https://mailarchive.ietf.org/arch/browse/quic/"/>.
        Subscribe at <eref target="https://www.ietf.org/mailman/listinfo/quic/"/>.
      </t>
      <t>Source for this draft and an issue tracker can be found at
        <eref target="https://github.com/martinthomson/quic-enough"/>.</t>
    </note>
  </front>
  <middle>
    <section anchor="introduction">
      <name>Introduction</name>
      <t>RFC 9000 <xref target="QUIC"/> describes how streams can be completed or reset.  A completed stream is delivered in its entirety, with the sender sending new STREAM frames until all data has been received and acknowledged by a receiver.  On the other hand, data on a reset stream might never be sent, or - if it is sent - it might not be retransmitted in the case of loss.</t>
      <t>The RESET_AT frame <xref target="RESET-AT"/> provides a way for a sender to split a stream into two parts: an early part that is transmitted reliably and any remainder, which is effectively reset.  This combines aspects of both completed and reset streams, even though the entire content of a stream is not delivered.</t>
      <t>This document describes the ENOUGH frame in <xref target="enough"/>, which provides an analogue of the STOP_SENDING QUIC frame (<xref section="19.11" sectionFormat="of" target="QUIC"/>).   This allows a stream receiver to indicate that it has received enough data and that any data beyond the indicated offset is not needed.  A sender that receives this ENOUGH frame can cease sending and emit a RESET_AT frame at or beyond the indicated offset.</t>
    </section>
    <section anchor="conventions-and-definitions">
      <name>Conventions and Definitions</name>
      <t>The key words "<bcp14>MUST</bcp14>", "<bcp14>MUST NOT</bcp14>", "<bcp14>REQUIRED</bcp14>", "<bcp14>SHALL</bcp14>", "<bcp14>SHALL
NOT</bcp14>", "<bcp14>SHOULD</bcp14>", "<bcp14>SHOULD NOT</bcp14>", "<bcp14>RECOMMENDED</bcp14>", "<bcp14>NOT RECOMMENDED</bcp14>",
"<bcp14>MAY</bcp14>", and "<bcp14>OPTIONAL</bcp14>" in this document are to be interpreted as
described in BCP 14 <xref target="RFC2119"/> <xref target="RFC8174"/> when, and only when, they
appear in all capitals, as shown here.</t>
    </section>
    <section anchor="enough">
      <name>QUIC ENOUGH Frame</name>
      <t>A QUIC ENOUGH frame (0xTBD) is shown in <xref target="fig-enough"/>.</t>
      <figure anchor="fig-enough">
        <name>The QUIC ENOUGH Frame Format</name>
        <artwork><![CDATA[
ENOUGH Frame {
  Type (i) = 0xTBD,
  Stream ID (i),
  Application Protocol Error Code (i),
  Offset (i),
}
]]></artwork>
      </figure>
      <t>Like STOP_SENDING, an ENOUGH frame can be sent for streams in the "Recv" or "Size Known" states; see <xref section="3.2" sectionFormat="of" target="QUIC"/>. Receiving a STOP_SENDING frame for a locally initiated stream that has not yet been created <bcp14>MUST</bcp14> be treated as a connection error of type STREAM_STATE_ERROR; see <xref section="20.1" sectionFormat="of" target="QUIC"/>. An endpoint that receives an ENOUGH  frame for a receive-only stream <bcp14>MUST</bcp14> terminate the connection with error STREAM_STATE_ERROR.</t>
      <t>ENOUGH frames contain the following fields:</t>
      <dl>
        <dt>Stream ID:</dt>
        <dd>
          <t>A variable-length integer carrying the stream ID of the stream being ignored.</t>
        </dd>
        <dt>Application Protocol Error Code:</dt>
        <dd>
          <t>A variable-length integer containing the application-specified reason the sender is ignoring the stream; see <xref section="20.2" sectionFormat="of" target="QUIC"/>.</t>
        </dd>
        <dt>Offset:</dt>
        <dd>
          <t>A variable-length offset into the stream.  Note that a value of 0 makes this frame equivalent to STOP_SENDING.  This value <bcp14>MAY</bcp14> be larger than the final size of the frame; see <xref section="4.5" sectionFormat="of" target="QUIC"/>, in which case this frame has no effect.</t>
        </dd>
      </dl>
      <t>ENOUGH frames have no direct effect on the stream state machine.</t>
    </section>
    <section anchor="negotiation">
      <name>Negotiation</name>
      <t>Endpoints advertise their support of the extension described in this document by sending the enough (0xTBD) transport parameter (<xref section="7.4" sectionFormat="of" target="QUIC"/>) with an empty value. An implementation that understands this transport parameter <bcp14>MUST</bcp14> treat the receipt of a non-empty value as a connection error of type TRANSPORT_PARAMETER_ERROR; see <xref section="20.1" sectionFormat="of" target="QUIC"/>.</t>
      <t>In order to allow reliable stream resets in 0-RTT packets, the client <bcp14>MUST</bcp14> remember the value of this transport parameter. If 0-RTT data is accepted by the server, the server <bcp14>MUST</bcp14> not disable this extension on the resumed connection.</t>
      <t>This extension <bcp14>MUST NOT</bcp14> be advertised unless support for the RESET_AT frame is also advertised; see <xref section="3" sectionFormat="of" target="RESET-AT"/>.  An endpoint <bcp14>MUST</bcp14> treat receipt of this transport parameter without the reliable_reset_stream transport parameter as a connection error of type TRANSPORT_PARAMETER_ERROR.</t>
    </section>
    <section anchor="security-considerations">
      <name>Security Considerations</name>
      <t>TODO Security</t>
    </section>
    <section anchor="iana-considerations">
      <name>IANA Considerations</name>
      <t>This document has no IANA actions.</t>
    </section>
  </middle>
  <back>
    <references>
      <name>Normative References</name>
      <reference anchor="RESET-AT">
        <front>
          <title>Reliable QUIC Stream Resets</title>
          <author fullname="Marten Seemann" initials="M." surname="Seemann">
            <organization>Protocol Labs</organization>
          </author>
          <date day="25" month="March" year="2023"/>
          <abstract>
            <t>   QUIC ([RFC9000]) defines a RESET_STREAM frame to reset a stream.
   When a sender resets a stream, it stops retransmitting STREAM frames
   for this stream.  On the receiver side, there is no guarantee that
   any of the data sent on that stream is delivered to the application.
   This document defines a new QUIC frame, the RELIABLE_RESET_STREAM
   frame, that resets a stream, while guaranteeing reliable delivery of
   stream data up to a certain byte offset.

            </t>
          </abstract>
        </front>
        <seriesInfo name="Internet-Draft" value="draft-seemann-quic-reliable-stream-reset-02"/>
      </reference>
      <reference anchor="QUIC">
        <front>
          <title>QUIC: A UDP-Based Multiplexed and Secure Transport</title>
          <author fullname="J. Iyengar" initials="J." role="editor" surname="Iyengar">
            <organization/>
          </author>
          <author fullname="M. Thomson" initials="M." role="editor" surname="Thomson">
            <organization/>
          </author>
          <date month="May" year="2021"/>
          <abstract>
            <t>This document defines the core of the QUIC transport protocol.  QUIC provides applications with flow-controlled streams for structured communication, low-latency connection establishment, and network path migration. QUIC includes security measures that ensure confidentiality, integrity, and availability in a range of deployment circumstances.  Accompanying documents describe the integration of TLS for key negotiation, loss detection, and an exemplary congestion control algorithm.</t>
          </abstract>
        </front>
        <seriesInfo name="RFC" value="9000"/>
        <seriesInfo name="DOI" value="10.17487/RFC9000"/>
      </reference>
      <reference anchor="RFC2119">
        <front>
          <title>Key words for use in RFCs to Indicate Requirement Levels</title>
          <author fullname="S. Bradner" initials="S." surname="Bradner">
            <organization/>
          </author>
          <date month="March" year="1997"/>
          <abstract>
            <t>In many standards track documents several words are used to signify the requirements in the specification.  These words are often capitalized. This document defines these words as they should be interpreted in IETF documents.  This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.</t>
          </abstract>
        </front>
        <seriesInfo name="BCP" value="14"/>
        <seriesInfo name="RFC" value="2119"/>
        <seriesInfo name="DOI" value="10.17487/RFC2119"/>
      </reference>
      <reference anchor="RFC8174">
        <front>
          <title>Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words</title>
          <author fullname="B. Leiba" initials="B." surname="Leiba">
            <organization/>
          </author>
          <date month="May" year="2017"/>
          <abstract>
            <t>RFC 2119 specifies common key words that may be used in protocol  specifications.  This document aims to reduce the ambiguity by clarifying that only UPPERCASE usage of the key words have the  defined special meanings.</t>
          </abstract>
        </front>
        <seriesInfo name="BCP" value="14"/>
        <seriesInfo name="RFC" value="8174"/>
        <seriesInfo name="DOI" value="10.17487/RFC8174"/>
      </reference>
    </references>
    <section numbered="false" anchor="acknowledgments">
      <name>Acknowledgments</name>
      <t>Martin Duke asked if this was possible.  This is the result.</t>
    </section>
  </back>
  <!-- ##markdown-source:
H4sIAAAAAAAAA51Y7XLbuhH9z6dAlT83HUu2c925jdp0rmLLiae25UrMdO50
Oh6IhCSMSYAXAKWreJJn6bP0yXp2QUqU7TSd/ohDLoHF7tmzH1C/30+CDoUa
it5ML40stFmKdCWDkOJvn67OxVRlSq+VEx+lF2Nj6+VKzIJTshQXMsheIudz
p9bYz8vjil6SyaCW1m2Hwoc8SXKbGVnilNzJReiHlS29Nf1fa531FW/pn5wk
vp6X2nttTdhWWHw1Ti+FeCVk4S0O0CZXlcIfE3pHonc1eo//rMPTNL3sJaYu
58oNkxxHD5PMGq+Mr/1QBFerBBb+mEjYDUWpk8ZX1oVesrHuYelsXTUO9JIH
tYUwHyaiL4z6LYilMsrJAKtIVBudWcePvpLugQHLtQ9Oz+ugclGofKlcslam
hhlCHGoXIrrW+zsOpq0f6DPJS6kLyAmSn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