github.com/tumi8/quic-go@v0.37.4-tum/noninternal/ackhandler/interfaces.go (about)

     1  package ackhandler
     2  
     3  import (
     4  	"time"
     5  
     6  	"github.com/tumi8/quic-go/noninternal/protocol"
     7  	"github.com/tumi8/quic-go/noninternal/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, 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, recvTime time.Time) (bool /* 1-RTT packet acked */, error)
    17  	ReceivedBytes(protocol.ByteCount)
    18  	DropPackets(protocol.EncryptionLevel)
    19  	ResetForRetry() 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  	PeekPacketNumber(protocol.EncryptionLevel) (protocol.PacketNumber, protocol.PacketNumberLen)
    33  	PopPacketNumber(protocol.EncryptionLevel) protocol.PacketNumber
    34  
    35  	GetLossDetectionTimeout() time.Time
    36  	OnLossDetectionTimeout() error
    37  }
    38  
    39  type sentPacketTracker interface {
    40  	GetLowestPacketNotConfirmedAcked() protocol.PacketNumber
    41  	ReceivedPacket(protocol.EncryptionLevel)
    42  }
    43  
    44  // ReceivedPacketHandler handles ACKs needed to send for incoming packets
    45  type ReceivedPacketHandler interface {
    46  	IsPotentiallyDuplicate(protocol.PacketNumber, protocol.EncryptionLevel) bool
    47  	ReceivedPacket(pn protocol.PacketNumber, ecn protocol.ECN, encLevel protocol.EncryptionLevel, rcvTime time.Time, shouldInstigateAck bool) error
    48  	DropPackets(protocol.EncryptionLevel)
    49  
    50  	GetAlarmTimeout() time.Time
    51  	GetAckFrame(encLevel protocol.EncryptionLevel, onlyIfQueued bool) *wire.AckFrame
    52  }