v0.0.0-...-55fcc16 Latest Latest

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

Go to latest
Published: Nov 23, 2019 License: Apache-2.0 Imports: 0 Imported by: 48



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.



This section is empty.


This section is empty.


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).


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