features

package
v0.0.0-...-0606ef9 Latest Latest
Warning

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

Go to latest
Published: May 24, 2020 License: LGPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package features contains feature implementations and utility functions.

Features are split according to

And inside those directories into the layer or general.

Index

Constants

View Source
const InvalidSequence = -1

InvalidSequence represents an invalid sequence number

Variables

This section is empty.

Functions

func BoolInt

func BoolInt(b bool) uint64

BoolInt returns 1 if b is true, otherwise 0

func GetTCP

func GetTCP(new interface{}) *layers.TCP

GetTCP returns the TCP layer of the packet or nil

func Less

func Less(a, b interface{}) bool

Less returns a < b

Types

type Sequence

type Sequence int64

Sequence is a TCP sequence number. It provides a few convenience functions for handling TCP wrap-around. The sequence should always be in the range [0,0xFFFFFFFF]... its other bits are simply used in wrap-around calculations and should never be set.

func (Sequence) Add

func (s Sequence) Add(t int) Sequence

Add adds an integer to a sequence and returns the resulting sequence.

func (Sequence) Difference

func (s Sequence) Difference(t Sequence) int

Difference defines an ordering for comparing TCP sequences that's safe for roll-overs. It returns:

> 0 : if t comes after s
< 0 : if t comes before s
  0 : if t == s

The number returned is the sequence difference, so 4.Difference(8) will return 4.

It handles rollovers by considering any sequence in the first quarter of the uint32 space to be after any sequence in the last quarter of that space, thus wrapping the uint32 space.

type TypedSlice

type TypedSlice interface {
	Append(interface{})
	Get(i int) interface{}
	GetFloat(i int) float64
	Len() int
	Less(i, j int) bool
	Equal(i, j int) bool
	Swap(i, j int)
	IsNumeric() bool
	Select(left, right, k int)
	Max(left, right int) int
}

TypedSlice is a slice that can hold uint64, int64, bool, string, or []slice

func NewTypedSlice

func NewTypedSlice(val interface{}) TypedSlice

NewTypedSlice returns a new TypedSlice with a backing implementation depending on val type. The returned slice already contains val

Directories

Path Synopsis
Package custom contains custom features.
Package custom contains custom features.
Package iana contains features as specified in the iana ipfix assignments.
Package iana contains features as specified in the iana ipfix assignments.
Package operations contains operations (features that use featureoutput, e.g., min).
Package operations contains operations (features that use featureoutput, e.g., min).
Package staging contains custom features that are subject to change.
Package staging contains custom features that are subject to change.

Jump to

Keyboard shortcuts

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