seqnum

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2020 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package seqnum defines the types and methods for TCP sequence numbers such that they fit in 32-bit words and work properly when overflows occur.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Overlap

func Overlap(a Value, b Size, x Value, y Size) bool

Overlap checks if the window [a,a+b) overlaps with the window [x, x+y).

Types

type Size

type Size uint32

Size represents the size (length) of a sequence number window.

type Value

type Value uint32

Value represents the value of a sequence number.

func (Value) Add

func (v Value) Add(s Size) Value

Add calculates the sequence number following the [v, v+s) window.

func (Value) InRange

func (v Value) InRange(a, b Value) bool

InRange checks if v is in the range [a,b), i.e., a <= v < b.

func (Value) InWindow

func (v Value) InWindow(first Value, size Size) bool

InWindow checks if v is in the window that starts at 'first' and spans 'size' sequence numbers.

func (Value) LessThan

func (v Value) LessThan(w Value) bool

LessThan checks if v is before w, i.e., v < w.

func (Value) LessThanEq

func (v Value) LessThanEq(w Value) bool

LessThanEq returns true if v==w or v is before i.e., v < w.

func (Value) Size

func (v Value) Size(w Value) Size

Size calculates the size of the window defined by [v, w).

func (*Value) UpdateForward

func (v *Value) UpdateForward(s Size)

UpdateForward updates v such that it becomes v + s.

Jump to

Keyboard shortcuts

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