exact

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package exact implements a Lucius table that performs packet matches using an exact match match and satisfies the interface fwdtable.Table.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

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

An Entry is an entry in an exact-match table. It maps a key to Actions. An entry is a part of a hash table collision list and an optional stale entry list.

func (*Entry) String

func (e *Entry) String() string

String returns the entry as a formatted string.

type EntryDesc

type EntryDesc []*fwdpb.PacketFieldBytes

EntryDesc describes a table entry as a set of pairs of packet-field-ids and packet-field-values.

type Table

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

A Table is a table that matches packets to entries using exact-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.

The forwarding infrastructure calls the AddEntry, RemoveEntry and Entries methods while holding a write lock on the context, and calls the Process function while holding a read lock on the context. The stale list monitor goroutine calls the Remove method while holding the write lock on the context. Since the stale list can be manipulated simultaneously by the monitor and packet processing goroutines, the table has a mutex to protect stale list operations.

func New

func New(ctx *fwdcontext.Context, td *fwdpb.TableDesc) (*Table, error)

New creates a new exact-match table. The table also has a stale list if a timeout is specified for transient entries.

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 by walking all entries in the table and deleting them.

func (*Table) Entries

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

Entries lists all entries in a table. Note that the order of entries is non-deterministic.

func (*Table) Find

func (t *Table) Find(key tableutil.Key) *Entry

Find looks up a key within the table and returns the entry if it is found.

func (*Table) Process

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 returns the table as a formatted string.

Jump to

Keyboard shortcuts

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