session

package
v0.0.0-...-8c13bb0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2024 License: MIT Imports: 1 Imported by: 27

Documentation

Overview

Package session provides sessions for the Netflow version 9 and IPFIX decoders that need to track templates bound to a session.

Index

Constants

View Source
const (
	SCOPE_SYSTEM       = 1
	SCOPE_INTERFACE    = 2
	SCOPE_LINECARD     = 3
	SCOPE_NETFLOWCACHE = 4
	SCOPE_TEMPLATE     = 5
)
View Source
const (
	OPTION_SAMPLER_ID       = 48
	OPTION_SAMPLER_MODE     = 49
	OPTION_SAMPLER_INTERVAL = 50
)

Variables

View Source
var ScopeTypes = map[uint16]string{
	SCOPE_SYSTEM:       "System",
	SCOPE_INTERFACE:    "Interface",
	SCOPE_LINECARD:     "Line card",
	SCOPE_NETFLOWCACHE: "Netflow cache",
	SCOPE_TEMPLATE:     "Template",
}

Functions

func New

func New() *basicSession

Types

type Field

type Field interface {
	GetType() uint16
	GetLength() uint16
	GetBytes() []byte
}

type Option

type Option struct {
	TemplateID       uint16
	Scope            OptionScope
	EnterpriseNumber uint32
	Type             uint16
	Value            interface{}
	Bytes            []byte
}

type OptionScope

type OptionScope struct {
	Type  uint16
	Index uint16
}

type Session

type Session interface {
	// To keep track of maximum record sizes per template
	GetRecordSize(uint16) (size int, found bool)
	SetRecordSize(uint16, int)

	// To keep track of templates
	AddTemplate(Template)
	GetTemplate(uint16) (t Template, found bool)
	SetOption(uint32, uint16, *Option)
	GetOption(uint32, uint16, uint16, uint16) *Option
}

type Template

type Template interface {
	ID() uint16
	Size() int
	GetFields() []TemplateFieldSpecifier
}

type TemplateFieldSpecifier

type TemplateFieldSpecifier interface {
	GetType() uint16
	GetLength() uint16
}

type TypeID

type TypeID struct {
	EnterpriseNumber uint32
	Type             uint16
}

Jump to

Keyboard shortcuts

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