github.com/quic-go/quic-go@v0.44.0/internal/ackhandler/interfaces.go (about)

     1  package ackhandler
     2  
     3  import (
     4  	"time"
     5  
     6  	"github.com/quic-go/quic-go/internal/protocol"
     7  	"github.com/quic-go/quic-go/internal/wire"
     8  )
     9  
    10  // SentPacketHandler handles ACKs received for outgoing packets
    11  type SentPacketHandler interface {
    12  	// SentPacket may modify the packet
    13  	SentPacket(t time.Time, pn, largestAcked protocol.PacketNumber, streamFrames []StreamFrame, frames []Frame, encLevel protocol.EncryptionLevel, ecn protocol.ECN, size protocol.ByteCount, isPathMTUProbePacket bool)
    14  	// ReceivedAck processes an ACK frame.
    15  	// It does not store a copy of the frame.
    16  	ReceivedAck(f *wire.AckFrame, encLevel protocol.EncryptionLevel, rcvTime time.Time) (bool /* 1-RTT packet acked */, error)
    17  	ReceivedBytes(protocol.ByteCount)
    18  	DropPackets(protocol.EncryptionLevel)
    19  	ResetForRetry(rcvTime time.Time) error
    20  	SetHandshakeConfirmed()
    21  
    22  	// The SendMode determines if and what kind of packets can be sent.
    23  	SendMode(now time.Time) SendMode
    24  	// TimeUntilSend is the time when the next packet should be sent.
    25  	// It is used for pacing packets.
    26  	TimeUntilSend() time.Time
    27  	SetMaxDatagramSize(count protocol.ByteCount)
    28  
    29  	// only to be called once the handshake is complete
    30  	QueueProbePacket(protocol.EncryptionLevel) bool /* was a packet queued */
    31  
    32  	ECNMode(isShortHeaderPacket bool) protocol.ECN // isShortHeaderPacket should only be true for non-coalesced 1-RTT packets
    33  	PeekPacketNumber(protocol.EncryptionLevel) (protocol.PacketNumber, protocol.PacketNumberLen)
    34  	PopPacketNumber(protocol.EncryptionLevel) protocol.PacketNumber
    35  
    36  	GetLossDetectionTimeout() time.Time
    37  	OnLossDetectionTimeout() error
    38  }
    39  
    40  type sentPacketTracker interface {
    41  	GetLowestPacketNotConfirmedAcked() protocol.PacketNumber
    42  	ReceivedPacket(protocol.EncryptionLevel)
    43  }
    44  
    45  // ReceivedPacketHandler handles ACKs needed to send for incoming packets
    46  type ReceivedPacketHandler interface {
    47  	IsPotentiallyDuplicate(protocol.PacketNumber, protocol.EncryptionLevel) bool
    48  	ReceivedPacket(pn protocol.PacketNumber, ecn protocol.ECN, encLevel protocol.EncryptionLevel, rcvTime time.Time, ackEliciting bool) error
    49  	DropPackets(protocol.EncryptionLevel)
    50  
    51  	GetAlarmTimeout() time.Time
    52  	GetAckFrame(encLevel protocol.EncryptionLevel, onlyIfQueued bool) *wire.AckFrame
    53  }