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 ¶
var CounterList = []fwdpb.CounterId{ fwdpb.CounterId_COUNTER_ID_ERROR_PACKETS, fwdpb.CounterId_COUNTER_ID_ERROR_OCTETS, fwdpb.CounterId_COUNTER_ID_DROP_PACKETS, fwdpb.CounterId_COUNTER_ID_DROP_OCTETS, fwdpb.CounterId_COUNTER_ID_RATELIMIT_PACKETS, fwdpb.CounterId_COUNTER_ID_RATELIMIT_OCTETS, fwdpb.CounterId_COUNTER_ID_MIRROR_PACKETS, fwdpb.CounterId_COUNTER_ID_MIRROR_OCTETS, fwdpb.CounterId_COUNTER_ID_MIRROR_ERROR_PACKETS, fwdpb.CounterId_COUNTER_ID_MIRROR_ERROR_OCTETS, fwdpb.CounterId_COUNTER_ID_ENCAP_ERROR_PACKETS, fwdpb.CounterId_COUNTER_ID_ENCAP_ERROR_OCTETS, fwdpb.CounterId_COUNTER_ID_DECAP_ERROR_PACKETS, fwdpb.CounterId_COUNTER_ID_DECAP_ERROR_OCTETS, }
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.
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.
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.
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. |