ccid3

package
v0.0.0-...-55a50c8 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2013 License: AGPL-3.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

View Source
const (
	NoFeedbackWeightNew               = 1
	NoFeedbackWeightOld               = 2
	NoFeedbackTimeoutWithoutRoundtrip = 2e9 // nofeedback timer expiration before RTT estimate, 2 sec
)
View Source
const (
	OptionLossEventRate = 192
	OptionLossIntervals = 193
	OptionReceiveRate   = 194
	// OptionLossDigest and OptionRoundtripReport ARE NOT part of CCID3. They are our own extension.
	OptionLossDigest      = 210
	OptionRoundtripReport = 150
)

CCID3-specific options

View Source
const (
	MaxLossIntervals = 28
	NDUPACK          = 3
)
View Source
const (
	RoundtripElapsedSample = "RTT-Elapsed"
	RoundtripReportSample  = "RTT-Report"
)
View Source
const (
	SenderRoundtripHistoryLen = 20 // How many timestamps of sent packets to remember
	SenderRoundtripWeightNew  = 1
	SenderRoundtripWeightOld  = 9
)
View Source
const (
	// Maximum value of window counter, RFC 4342 Section 10.2 and RFC 3448
	WindowCounterMod = 16

	// The maximum increase in window counter from one window to the next
	WindowCounterMaxInc = 5

	// Counter increase since last ack'd window
	WindowCounterAckInc = 4

	// A nil value for window counter variables
	WindowCounterNil = WindowCounterMod
)
View Source
const (
	X_MAX_INIT_WIN         = 4380          // Maximum size of initial window in bytes
	X_MAX_BACKOFF_INTERVAL = 64e9          // Maximum backoff interval in ns (See RFC 5348, Section 4.3)
	X_RECV_MAX             = math.MaxInt32 // Maximum receive rate, in bytes per second
	X_RECV_SET_SIZE        = 3             // Size of x_recv_set
)
View Source
const FixedSegmentSize = 2 * 1500
View Source
const (
	LossReceiverEstimateSample = "Loss-Receiver"
)
View Source
const NINTERVAL = 8
View Source
const (
	// UnknownLossEventRateInv is the maximum representable loss event rate inverse,
	// and therefore corresponds to the minimum representable loss event rate.
	// In the CCID protocol, this constant is interpreted as 'no loss events detected'.
	// Its numerical value allows it be used safely in comparison operations.
	UnknownLossEventRateInv = math.MaxUint32
)
View Source
const WindowHistoryLen = 4 * 4 * 2

Variables

View Source
var (
	ErrMissingOption = errors.New("missing option")
	ErrNoAck         = errors.New("packet is not an ack")
)

TODO: Annotate each error with the circumstances that can cause it

View Source
var (
	RoundtripElapsedCheckpoint roundtripElapsedCheckpoint
	RoundtripReportCheckpoint  roundtripReportCheckpoint
)

Functions

func BytesPerSecondToPacketsPer64Sec

func BytesPerSecondToPacketsPer64Sec(bps uint32, ss uint32) int64

BytesPerSecondToPacketsPer64Sec converts a rate in byter per second to packets of size ss per 64 seconds

func LossSample

func LossSample(series string, lossRateInv uint32) dccp.Sample

LossSample generates a log sample with loss information

func RoundtripSample

func RoundtripSample(series string, rtt int64) dccp.Sample

RoundtripSample converts a roundtrip time in nanosecond to a floating-point time in milliseconds

Types

type CCID3

type CCID3 struct{}

func (CCID3) NewReceiver

func (CCID3) NewReceiver(env *dccp.Env, amb *dccp.Amb) dccp.ReceiverCongestionControl

func (CCID3) NewSender

func (CCID3) NewSender(env *dccp.Env, amb *dccp.Amb) dccp.SenderCongestionControl

type LossDigestOption

type LossDigestOption struct {
	// RateInv is the inverse of the loss event rate, rounded UP, as calculated by the receiver.
	// A value of UnknownLossEventRateInv indicates that no loss events have been observed.
	RateInv uint32

	// NewLoss indicates how many new loss events are reported by the feedback packet carrying this option
	NewLossCount byte
}

The LossDigest option directly carries, from the receiver to the sender, the types of loss information that a CCID3 sender would have to reconstruct from the LossIntervals option. This is an extension to the RFC specification.

func DecodeLossDigestOption

func DecodeLossDigestOption(opt *dccp.Option) *LossDigestOption

func (*LossDigestOption) Encode

func (opt *LossDigestOption) Encode() (*dccp.Option, error)

type LossEventRateOption

type LossEventRateOption struct {
	// RateInv is the inverse of the loss event rate, rounded UP, as calculated by the receiver.
	// It is actually calculated as data packets per loss interval.
	RateInv uint32
}

RFC 4342, Section 8.5

func DecodeLossEventRateOption

func DecodeLossEventRateOption(opt *dccp.Option) *LossEventRateOption

func (*LossEventRateOption) Encode

func (opt *LossEventRateOption) Encode() (*dccp.Option, error)

type LossFeedback

type LossFeedback struct {
	RateInv      uint32 // Loss event rate inverse
	NewLossCount byte   // Number of loss events reported in this feedback packet
	RateInc      bool   // Has the loss rate increased since the last feedback packet
}

LossFeedback contains summary of loss information updates returned by OnRead

type LossInterval

type LossInterval struct {
	LosslessLength uint32 // Lossless Length, a 24-bit number, RFC 4342, Section 8.6.1
	LossLength     uint32 // Loss Length, a 23-bit number, RFC 4342, Section 8.6.1
	DataLength     uint32 // Data Length, a 24-bit number, RFC 4342, Section 8.6.1.
	// Specifies loss interval's data length, as defined in Section 6.1.1.
	ECNNonceEcho bool // ECN Nonce Echo, RFC 4342, Section 8.6.1
}

LossInterval describes an individual loss interval, RFC 4342, Section 8.6.2

func (*LossInterval) SeqLen

func (li *LossInterval) SeqLen() uint32

SeqLen returns the sequence length of the loss interval

type LossIntervalDetail

type LossIntervalDetail struct {
	LossInterval
	StartSeqNo int64 // The sequence number of the first packet in the loss interval
	StartTime  int64 // The reception time of the first packet in the loss interval
	StartRTT   int64 // The RTT estimate when the interval began
	Unfinished bool  // True if the loss interval is still evolving
}

LossIntervalDetail is an internal structure that contains more detailed information about a loss interval than the LossInterval structure that is transported inside a DCCP option.

type LossIntervalsOption

type LossIntervalsOption struct {
	// SkipLength indicates the number of packets up to and including the Acknowledgement Number
	// that are not part of any Loss Interval. It must be less than or equal to NDUPACK = 3
	SkipLength    byte
	LossIntervals []*LossInterval
}

LossIntervalsOption is described in RFC 4342, Section 8.6. Intervals are listed in reverse chronological order. Loss interval sequence numbers are delta encoded starting from the Acknowledgement Number. Therefore, Loss Intervals options MUST NOT be sent on packets without an Acknowledgement Number, and any Loss Intervals options received on such packets MUST be ignored.

func DecodeLossIntervalsOption

func DecodeLossIntervalsOption(opt *dccp.Option) *LossIntervalsOption

func (*LossIntervalsOption) Encode

func (opt *LossIntervalsOption) Encode() (*dccp.Option, error)

type ReceiveRateOption

type ReceiveRateOption struct {
	// The rate at which receiver has received data since it last send an Ack; in bytes per second
	Rate uint32
}

ReceiveRateOption is described in RFC 4342, Section 8.3.

func DecodeReceiveRateOption

func DecodeReceiveRateOption(opt *dccp.Option) *ReceiveRateOption

func (*ReceiveRateOption) Encode

func (opt *ReceiveRateOption) Encode() (*dccp.Option, error)

type RoundtripReportOption

type RoundtripReportOption struct {
	// The Roundtrip estimate is given in ten microsecond units, similarly to the
	// ElapsedTimeOption
	Roundtrip uint32
}

RoundtripReportOption is used by the sender to communicate its RTT estimate to the receiver.

func DecodeRoundtripReportOption

func DecodeRoundtripReportOption(opt *dccp.Option) *RoundtripReportOption

func (*RoundtripReportOption) Encode

func (opt *RoundtripReportOption) Encode() (*dccp.Option, error)

type UnencodedOption

type UnencodedOption interface {
	Encode() (*dccp.Option, error)
}

Unencoded option is a type that knows how to encode itself into a dccp.Option

type XFeedback

type XFeedback struct {
	Now          int64  // Time now
	SS           uint32 // Segment size
	XRecv        uint32 // Receive rate
	RTT          int64  // Round-trip time
	LossFeedback        // Loss-related feedback
}

XFeedback contains computed feedback variables that are used by the rate calculator to update the allowed sending rate

Jump to

Keyboard shortcuts

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