fwdaction

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: 8 Imported by: 0

Documentation

Overview

Package fwdaction contains routines and types to manage forwarding actions.

An Action is an operation that can be performed on a packet.

Various forwarding behaviors within Lucius are implemented by types satisfying interface Action. Several actions may contain references to other forwarding objects. These actions must implement interface fwdobject.Composite.

Actions is a list of actions ordered in their expected order of execution. It is always embedded in another object, and hence does not implement fwdobject.Object.

Index

Constants

This section is empty.

Variables

CounterList is a set of counters incremented by various actions.

Functions

func Register

func Register(atype fwdpb.ActionType, builder builder)

Register registers a builder for the specified action type. Note that builders are expected to be registered serially during initialization.

Types

type Action

type Action interface {
	// Process processes the packet using the specified counters.
	// Process returns an updated processing state for the packet.
	// It may also return new Actions that are used to process the packet.
	// Process assumes that counters are always valid (not nil).
	Process(packet fwdpacket.Packet, counters fwdobject.Counters) (Actions, State)

	// String formats the state of the action as a string.
	String() string
}

An Action is an operation that can be performed on a packet.

func New

func New(desc *fwdpb.ActionDesc, ctx *fwdcontext.Context) (Action, error)

New creates a new action based on the descriptor.

type ActionAttr

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

An ActionAttr contains atttributes of a given action.

func NewActionAttr

func NewActionAttr(action Action, onEvaluate bool) *ActionAttr

NewActionAttr creates a type that describes attributes associated with the specified action.

func (ActionAttr) Action

func (a ActionAttr) Action() Action

Action returns the action associated with an attribute set.

func (ActionAttr) String

func (a ActionAttr) String() string

String formats an ActionAttr

type Actions

type Actions []*ActionAttr

Actions is a list of actions and their corresponding attributes.

func NewActions

func NewActions(descs []*fwdpb.ActionDesc, ctx *fwdcontext.Context) (Actions, error)

NewActions builds a list of actions from a slice of descriptors.

func (Actions) Cleanup

func (actions Actions) Cleanup()

Cleanup releases all references held by the actions.

func (Actions) IsEqual

func (actions Actions) IsEqual(arg Actions) bool

IsEqual returns true if a two series of actions are equal.

func (Actions) String

func (actions Actions) String() string

String returns the actions as a formatted string.

type State

type State int

A State is the processing state of a packet.

const (
	DROP     State = iota // Packet is being dropped.
	CONTINUE              // Packet is being processed further.
	CONSUME               // Packet is being consumed.
	OUTPUT                // Packet should be processed to the output port immediately.
	EVALUATE              // Packet is processed with all actions marked "onEvaluate"
)

Enumerate the possible states during packet processing.

func ProcessPacket

func ProcessPacket(packet fwdpacket.Packet, actions Actions, counters fwdobject.Counters) (State, error)

ProcessPacket processes a network packet with a series of actions and determines the processing state of the packet.

Directories

Path Synopsis
Package actions implements various types of actions supported within Lucius.
Package actions implements various types of actions supported within Lucius.
Package mock_fwdpacket is a generated GoMock package.
Package mock_fwdpacket is a generated GoMock package.
Package mock_fwdport is a generated GoMock package.
Package mock_fwdport is a generated GoMock package.
Package mock_fwdtable is a generated GoMock package.
Package mock_fwdtable is a generated GoMock package.

Jump to

Keyboard shortcuts

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