prefix

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package prefix implements a Lucius table that performs packet matches using the longest prefix match and satisfies the interface fwdtable.Table. All entries in the prefix tree are maintained in network order.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Calculate

func Calculate(byteCount int) int

Calculate calculates the number of bits in the specified number of bytes.

func Count

func Count(bs []byte) int

Count counts the number of bits set in a slice of bytes.

Types

type EntryDesc

type EntryDesc []*fwdpb.PacketFieldMaskedBytes

A EntryDesc describes a table entry as a set of packet field ids and the corresponding mask and value.

type Table

type Table struct {
	fwdobject.Base
	// contains filtered or unexported fields
}

A Table is a table which is looked up using a longest prefix match. Entries in the table are described by a keyDesc. Packets match an entry if the key made from the packet is equal to the key made from the entry. The table also has a set of actions which are used to process packets that do not match any entry in the table.

func (*Table) AddEntry

func (t *Table) AddEntry(ed *fwdpb.EntryDesc, ad []*fwdpb.ActionDesc) error

AddEntry adds or updates the actions associated with the specified key.

func (*Table) Cleanup

func (t *Table) Cleanup()

Cleanup releases all references held by the table and its entries.

func (*Table) Clear

func (t *Table) Clear()

Clear removes all entries in the table and reallocating an empty root.

func (*Table) Entries

func (t *Table) Entries() []string

Entries lists all entries in a table.

func (*Table) Process

func (t *Table) Process(packet fwdpacket.Packet, counters fwdobject.Counters) (fwdaction.Actions, fwdaction.State)

Process matches the packet to the entries within the table to determine the actions to be performed. If the packet does not match any entries, the default actions are used. In case of errors, the packet is dropped.

func (*Table) RemoveEntry

func (t *Table) RemoveEntry(ed *fwdpb.EntryDesc) error

RemoveEntry removes an entry.

func (*Table) String

func (t *Table) String() string

String recurisively prints a table to a string.

Jump to

Keyboard shortcuts

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