#include "quiche/quic/core/quic_stream.h"
#include <algorithm>
#include <limits>
#include <optional>
#include <string>
#include <utility>
#include "absl/strings/str_cat.h"
#include "absl/strings/string_view.h"
#include "quiche/quic/core/quic_error_codes.h"
#include "quiche/quic/core/quic_flow_controller.h"
#include "quiche/quic/core/quic_session.h"
#include "quiche/quic/core/quic_types.h"
#include "quiche/quic/core/quic_utils.h"
#include "quiche/quic/core/quic_versions.h"
#include "quiche/quic/platform/api/quic_bug_tracker.h"
#include "quiche/quic/platform/api/quic_flag_utils.h"
#include "quiche/quic/platform/api/quic_flags.h"
#include "quiche/quic/platform/api/quic_logging.h"
#include "quiche/common/platform/api/quiche_logging.h"
#include "quiche/common/platform/api/quiche_mem_slice.h"
SpdyPriority;
namespace quic {
#define ENDPOINT …
namespace {
QuicByteCount DefaultFlowControlWindow(ParsedQuicVersion version) { … }
QuicByteCount GetInitialStreamFlowControlWindowToSend(QuicSession* session,
QuicStreamId stream_id) { … }
QuicByteCount GetReceivedFlowControlWindow(QuicSession* session,
QuicStreamId stream_id) { … }
}
PendingStream::PendingStream(QuicStreamId id, QuicSession* session)
: … { … }
void PendingStream::OnDataAvailable() { … }
void PendingStream::OnFinRead() { … }
void PendingStream::AddBytesConsumed(QuicByteCount bytes) { … }
void PendingStream::ResetWithError(QuicResetStreamError ) { … }
void PendingStream::OnUnrecoverableError(QuicErrorCode error,
const std::string& details) { … }
void PendingStream::OnUnrecoverableError(QuicErrorCode error,
QuicIetfTransportErrorCodes ietf_error,
const std::string& details) { … }
QuicStreamId PendingStream::id() const { … }
ParsedQuicVersion PendingStream::version() const { … }
void PendingStream::OnStreamFrame(const QuicStreamFrame& frame) { … }
void PendingStream::OnRstStreamFrame(const QuicRstStreamFrame& frame) { … }
void PendingStream::OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame) { … }
bool PendingStream::MaybeIncreaseHighestReceivedOffset(
QuicStreamOffset new_offset) { … }
void PendingStream::OnStopSending(
QuicResetStreamError stop_sending_error_code) { … }
void PendingStream::MarkConsumed(QuicByteCount num_bytes) { … }
void PendingStream::StopReading() { … }
QuicStream::QuicStream(PendingStream* pending, QuicSession* session,
bool is_static)
: … { … }
namespace {
std::optional<QuicFlowController> FlowController(QuicStreamId id,
QuicSession* session,
StreamType type) { … }
}
QuicStream::QuicStream(QuicStreamId id, QuicSession* session, bool is_static,
StreamType type)
: … { … }
QuicStream::QuicStream(QuicStreamId id, QuicSession* session,
QuicStreamSequencer sequencer, bool is_static,
StreamType type, uint64_t stream_bytes_read,
bool fin_received,
std::optional<QuicFlowController> flow_controller,
QuicFlowController* connection_flow_controller,
QuicTime::Delta pending_duration)
: … { … }
QuicStream::~QuicStream() { … }
void QuicStream::OnStreamFrame(const QuicStreamFrame& frame) { … }
bool QuicStream::OnStopSending(QuicResetStreamError error) { … }
int QuicStream::num_frames_received() const { … }
int QuicStream::num_duplicate_frames_received() const { … }
void QuicStream::OnStreamReset(const QuicRstStreamFrame& frame) { … }
void QuicStream::OnConnectionClosed(const QuicConnectionCloseFrame& frame,
ConnectionCloseSource ) { … }
void QuicStream::OnFinRead() { … }
void QuicStream::SetFinSent() { … }
void QuicStream::Reset(QuicRstStreamErrorCode error) { … }
void QuicStream::ResetWithError(QuicResetStreamError error) { … }
void QuicStream::ResetWriteSide(QuicResetStreamError error) { … }
void QuicStream::SendStopSending(QuicResetStreamError error) { … }
void QuicStream::OnUnrecoverableError(QuicErrorCode error,
const std::string& details) { … }
void QuicStream::OnUnrecoverableError(QuicErrorCode error,
QuicIetfTransportErrorCodes ietf_error,
const std::string& details) { … }
const QuicStreamPriority& QuicStream::priority() const { … }
void QuicStream::SetPriority(const QuicStreamPriority& priority) { … }
void QuicStream::WriteOrBufferData(
absl::string_view data, bool fin,
quiche::QuicheReferenceCountedPointer<QuicAckListenerInterface>
ack_listener) { … }
void QuicStream::WriteOrBufferDataAtLevel(
absl::string_view data, bool fin, EncryptionLevel level,
quiche::QuicheReferenceCountedPointer<QuicAckListenerInterface>
ack_listener) { … }
void QuicStream::OnCanWrite() { … }
void QuicStream::MaybeSendBlocked() { … }
QuicConsumedData QuicStream::WriteMemSlice(quiche::QuicheMemSlice span,
bool fin) { … }
QuicConsumedData QuicStream::WriteMemSlices(
absl::Span<quiche::QuicheMemSlice> span, bool fin,
bool buffer_unconditionally) { … }
bool QuicStream::HasPendingRetransmission() const { … }
bool QuicStream::IsStreamFrameOutstanding(QuicStreamOffset offset,
QuicByteCount data_length,
bool fin) const { … }
void QuicStream::CloseReadSide() { … }
void QuicStream::CloseWriteSide() { … }
void QuicStream::MaybeSendStopSending(QuicResetStreamError error) { … }
void QuicStream::MaybeSendRstStream(QuicResetStreamError error) { … }
bool QuicStream::HasBufferedData() const { … }
ParsedQuicVersion QuicStream::version() const { … }
QuicTransportVersion QuicStream::transport_version() const { … }
HandshakeProtocol QuicStream::handshake_protocol() const { … }
void QuicStream::StopReading() { … }
void QuicStream::OnClose() { … }
void QuicStream::OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame) { … }
bool QuicStream::MaybeIncreaseHighestReceivedOffset(
QuicStreamOffset new_offset) { … }
void QuicStream::AddBytesSent(QuicByteCount bytes) { … }
void QuicStream::AddBytesConsumed(QuicByteCount bytes) { … }
bool QuicStream::MaybeConfigSendWindowOffset(QuicStreamOffset new_offset,
bool was_zero_rtt_rejected) { … }
void QuicStream::AddRandomPaddingAfterFin() { … }
bool QuicStream::OnStreamFrameAcked(QuicStreamOffset offset,
QuicByteCount data_length, bool fin_acked,
QuicTime::Delta ,
QuicTime ,
QuicByteCount* newly_acked_length) { … }
void QuicStream::OnStreamFrameRetransmitted(QuicStreamOffset offset,
QuicByteCount data_length,
bool fin_retransmitted) { … }
void QuicStream::OnStreamFrameLost(QuicStreamOffset offset,
QuicByteCount data_length, bool fin_lost) { … }
bool QuicStream::RetransmitStreamData(QuicStreamOffset offset,
QuicByteCount data_length, bool fin,
TransmissionType type) { … }
bool QuicStream::IsWaitingForAcks() const { … }
bool QuicStream::WriteStreamData(QuicStreamOffset offset,
QuicByteCount data_length,
QuicDataWriter* writer) { … }
void QuicStream::WriteBufferedData(EncryptionLevel level) { … }
uint64_t QuicStream::BufferedDataBytes() const { … }
bool QuicStream::CanWriteNewData() const { … }
bool QuicStream::CanWriteNewDataAfterData(QuicByteCount length) const { … }
uint64_t QuicStream::stream_bytes_written() const { … }
const QuicIntervalSet<QuicStreamOffset>& QuicStream::bytes_acked() const { … }
void QuicStream::OnStreamDataConsumed(QuicByteCount bytes_consumed) { … }
void QuicStream::WritePendingRetransmission() { … }
bool QuicStream::MaybeSetTtl(QuicTime::Delta ttl) { … }
bool QuicStream::HasDeadlinePassed() const { … }
void QuicStream::OnDeadlinePassed() { … }
bool QuicStream::IsFlowControlBlocked() const { … }
QuicStreamOffset QuicStream::highest_received_byte_offset() const { … }
void QuicStream::UpdateReceiveWindowSize(QuicStreamOffset size) { … }
std::optional<QuicByteCount> QuicStream::GetSendWindow() const { … }
std::optional<QuicByteCount> QuicStream::GetReceiveWindow() const { … }
void QuicStream::OnStreamCreatedFromPendingStream() { … }
QuicByteCount QuicStream::CalculateSendWindowSize() const { … }
}