fragmentation

package
v0.0.0-...-a6dae5b Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2017 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package fragmentation contains the implementation of IP fragmentation. It is based on RFC 791 and RFC 815.

Package ilist provides the implementation of intrusive linked lists.

Index

Constants

View Source
const DefaultReassembleTimeout = 5 * time.Minute

DefaultReassembleTimeout is based on the reassembling timeout suggest in RFC 791 (4.25 minutes).

View Source
const MemoryLimit = 8 * 1024 * 1024 // 8MB

MemoryLimit is a suggested value for the limit on the memory used to reassemble packets.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fragmentation

type Fragmentation struct {
	// contains filtered or unexported fields
}

Fragmentation is the main structure that other modules of the stack should use to implement IP Fragmentation.

func NewFragmentation

func NewFragmentation(memoryLimit int, reassemblingTimeout time.Duration) Fragmentation

NewFragmentation creates a new Fragmentation.

memoryLimit specifies the limit on the memory consumed by the fragments stored by Fragmentation (overhead of internal data-structures is not accounted). Fragments are dropped when the limit is reached.

reassemblingTimeout specifes the maximum time allowed to reassemble a packet. Fragments are lazily evicted only when a new a packet with an already existing fragmentation-id arrives after the timeout.

func (*Fragmentation) Process

func (f *Fragmentation) Process(id uint32, first, last uint16, more bool, vv *buffer.VectorisedView) (buffer.VectorisedView, bool)

Process processes an incoming fragment beloning to an ID and returns a complete packet when all the packets belonging to that ID have been received.

Jump to

Keyboard shortcuts

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