frames

package
v0.0.0-...-2201134 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 11, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidAckRanges occurs when a client sends inconsistent ACK ranges
	ErrInvalidAckRanges = errors.New("AckFrame: ACK frame contains invalid ACK ranges")
	// ErrInvalidFirstAckRange occurs when the first ACK range contains no packets
	ErrInvalidFirstAckRange = errors.New("AckFrame: ACK frame has invalid first ACK range")
)

Functions

func LogFrame

func LogFrame(frame Frame, sent bool)

LogFrame logs a frame, either sent or received

Types

type AckFrame

type AckFrame struct {
	LargestAcked protocol.PacketNumber
	LowestAcked  protocol.PacketNumber
	AckRanges    []AckRange // has to be ordered. The ACK range with the highest FirstPacketNumber goes first, the ACK range with the lowest FirstPacketNumber goes last

	// time when the LargestAcked was receiveid
	// this field Will not be set for received ACKs frames
	PacketReceivedTime time.Time
	DelayTime          time.Duration
}

An AckFrame is an ACK frame in QUIC

func ParseAckFrame

func ParseAckFrame(r *bytes.Reader, version protocol.VersionNumber) (*AckFrame, error)

ParseAckFrame reads an ACK frame

func (*AckFrame) AcksPacket

func (f *AckFrame) AcksPacket(p protocol.PacketNumber) bool

AcksPacket determines if this ACK frame acks a certain packet number

func (*AckFrame) HasMissingRanges

func (f *AckFrame) HasMissingRanges() bool

HasMissingRanges returns if this frame reports any missing packets

func (*AckFrame) MinLength

func (f *AckFrame) MinLength(version protocol.VersionNumber) (protocol.ByteCount, error)

MinLength of a written frame

func (*AckFrame) Write

func (f *AckFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error

Write writes an ACK frame.

type AckRange

type AckRange struct {
	FirstPacketNumber protocol.PacketNumber
	LastPacketNumber  protocol.PacketNumber
}

AckRange is an ACK range

type BlockedFrame

type BlockedFrame struct {
	StreamID protocol.StreamID
}

A BlockedFrame in QUIC

func ParseBlockedFrame

func ParseBlockedFrame(r *bytes.Reader) (*BlockedFrame, error)

ParseBlockedFrame parses a BLOCKED frame

func (*BlockedFrame) MinLength

func (f *BlockedFrame) MinLength(version protocol.VersionNumber) (protocol.ByteCount, error)

MinLength of a written frame

func (*BlockedFrame) Write

func (f *BlockedFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error

Write writes a BlockedFrame frame

type ConnectionCloseFrame

type ConnectionCloseFrame struct {
	ErrorCode    qerr.ErrorCode
	ReasonPhrase string
}

A ConnectionCloseFrame in QUIC

func ParseConnectionCloseFrame

func ParseConnectionCloseFrame(r *bytes.Reader) (*ConnectionCloseFrame, error)

ParseConnectionCloseFrame reads a CONNECTION_CLOSE frame

func (*ConnectionCloseFrame) MinLength

MinLength of a written frame

func (*ConnectionCloseFrame) Write

Write writes an CONNECTION_CLOSE frame.

type Frame

type Frame interface {
	Write(b *bytes.Buffer, version protocol.VersionNumber) error
	MinLength(version protocol.VersionNumber) (protocol.ByteCount, error)
}

A Frame in QUIC

type GoawayFrame

type GoawayFrame struct {
	ErrorCode      qerr.ErrorCode
	LastGoodStream protocol.StreamID
	ReasonPhrase   string
}

A GoawayFrame is a GOAWAY frame

func ParseGoawayFrame

func ParseGoawayFrame(r *bytes.Reader) (*GoawayFrame, error)

ParseGoawayFrame parses a GOAWAY frame

func (*GoawayFrame) MinLength

func (f *GoawayFrame) MinLength(version protocol.VersionNumber) (protocol.ByteCount, error)

MinLength of a written frame

func (*GoawayFrame) Write

func (f *GoawayFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error

type PLUSFeedbackFrame

type PLUSFeedbackFrame struct {
	Data []byte
}

A PLUSFeedbackFrame in QUIC

func ParsePLUSFeedbackFrame

func ParsePLUSFeedbackFrame(r *bytes.Reader) (*PLUSFeedbackFrame, error)

ParsePLUSFeedbackFrame reads a pcf frame

func (*PLUSFeedbackFrame) MinLength

MinLength of a written frame Returns the FULL length. Not if packet_packer/stream_framer can handle variably sized *control* frames.

func (*PLUSFeedbackFrame) Write

func (f *PLUSFeedbackFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error

Write writes a PLUSFeedbackFrame frame

type PingFrame

type PingFrame struct{}

A PingFrame is a ping frame

func ParsePingFrame

func ParsePingFrame(r *bytes.Reader) (*PingFrame, error)

ParsePingFrame parses a Ping frame

func (*PingFrame) MinLength

func (f *PingFrame) MinLength(version protocol.VersionNumber) (protocol.ByteCount, error)

MinLength of a written frame

func (*PingFrame) Write

func (f *PingFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error

type RstStreamFrame

type RstStreamFrame struct {
	StreamID   protocol.StreamID
	ErrorCode  uint32
	ByteOffset protocol.ByteCount
}

A RstStreamFrame in QUIC

func ParseRstStreamFrame

func ParseRstStreamFrame(r *bytes.Reader) (*RstStreamFrame, error)

ParseRstStreamFrame parses a RST_STREAM frame

func (*RstStreamFrame) MinLength

func (f *RstStreamFrame) MinLength(version protocol.VersionNumber) (protocol.ByteCount, error)

MinLength of a written frame

func (*RstStreamFrame) Write

func (f *RstStreamFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error

Write writes a RST_STREAM frame

type StopWaitingFrame

type StopWaitingFrame struct {
	LeastUnacked    protocol.PacketNumber
	PacketNumberLen protocol.PacketNumberLen
	PacketNumber    protocol.PacketNumber
}

A StopWaitingFrame in QUIC

func ParseStopWaitingFrame

func ParseStopWaitingFrame(r *bytes.Reader, packetNumber protocol.PacketNumber, packetNumberLen protocol.PacketNumberLen, version protocol.VersionNumber) (*StopWaitingFrame, error)

ParseStopWaitingFrame parses a StopWaiting frame

func (*StopWaitingFrame) MinLength

MinLength of a written frame

func (*StopWaitingFrame) Write

func (f *StopWaitingFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error

type StreamFrame

type StreamFrame struct {
	StreamID       protocol.StreamID
	FinBit         bool
	DataLenPresent bool
	Offset         protocol.ByteCount
	Data           []byte
}

A StreamFrame of QUIC

func ParseStreamFrame

func ParseStreamFrame(r *bytes.Reader) (*StreamFrame, error)

ParseStreamFrame reads a stream frame. The type byte must not have been read yet.

func (*StreamFrame) DataLen

func (f *StreamFrame) DataLen() protocol.ByteCount

DataLen gives the length of data in bytes

func (*StreamFrame) MinLength

MinLength returns the length of the header of a StreamFrame the total length of the StreamFrame is frame.MinLength() + frame.DataLen()

func (*StreamFrame) Write

func (f *StreamFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error

WriteStreamFrame writes a stream frame.

type WindowUpdateFrame

type WindowUpdateFrame struct {
	StreamID   protocol.StreamID
	ByteOffset protocol.ByteCount
}

A WindowUpdateFrame in QUIC

func ParseWindowUpdateFrame

func ParseWindowUpdateFrame(r *bytes.Reader) (*WindowUpdateFrame, error)

ParseWindowUpdateFrame parses a RST_STREAM frame

func (*WindowUpdateFrame) MinLength

MinLength of a written frame

func (*WindowUpdateFrame) Write

func (f *WindowUpdateFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error

Write writes a RST_STREAM frame

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL