Documentation ¶
Overview ¶
Package fwdport contains routines and types to manage forwarding ports.
A Port is an entry or exit point for packets within the forwarding plane. Lucius has different types of ports (implemented by various types). All ports are created by provisioning.
This package defines the following mechanisms to manage ports
- It allows different types of ports to register builders during package initialization.
- Provisioning can create ports using the registered builders.
- It defines an interface that can be used to operate on a port.
Index ¶
- Variables
- func GetID(port Port) *fwdpb.PortId
- func Increment(port Port, octets int, packetID, octetID fwdpb.CounterId)
- func Input(port Port, packet fwdpacket.Packet, dir fwdpb.PortAction, ...) (err error)
- func MakeID(id fwdobject.ID) *fwdpb.PortId
- func Output(port Port, packet fwdpacket.Packet, dir fwdpb.PortAction, ...) (err error)
- func Process(port Port, packet fwdpacket.Packet, dir fwdpb.PortAction, ...)
- func Register(portType fwdpb.PortType, builder Builder)
- func Release(port Port) error
- func SetInputPort(packet fwdpacket.Packet, port Port)
- func SetOutputPort(packet fwdpacket.Packet, port Port)
- func Write(port Port, packet fwdpacket.Packet)
- type Builder
- type Port
- func Acquire(id *fwdpb.PortId, ctx *fwdcontext.Context) (Port, error)
- func Find(id *fwdpb.PortId, ctx *fwdcontext.Context) (Port, error)
- func InputPort(packet fwdpacket.Packet, ctx *fwdcontext.Context) (Port, error)
- func New(desc *fwdpb.PortDesc, ctx *fwdcontext.Context) (Port, error)
- func OutputPort(packet fwdpacket.Packet, ctx *fwdcontext.Context) (Port, error)
Constants ¶
This section is empty.
Variables ¶
var CounterList = []fwdpb.CounterId{ fwdpb.CounterId_COUNTER_ID_RX_PACKETS, fwdpb.CounterId_COUNTER_ID_RX_OCTETS, fwdpb.CounterId_COUNTER_ID_RX_BAD_PACKETS, fwdpb.CounterId_COUNTER_ID_RX_BAD_OCTETS, fwdpb.CounterId_COUNTER_ID_RX_ADMIN_DROP_PACKETS, fwdpb.CounterId_COUNTER_ID_RX_ADMIN_DROP_OCTETS, fwdpb.CounterId_COUNTER_ID_RX_ERROR_PACKETS, fwdpb.CounterId_COUNTER_ID_RX_ERROR_OCTETS, fwdpb.CounterId_COUNTER_ID_RX_DROP_PACKETS, fwdpb.CounterId_COUNTER_ID_RX_DROP_OCTETS, fwdpb.CounterId_COUNTER_ID_RX_DEBUG_PACKETS, fwdpb.CounterId_COUNTER_ID_RX_DEBUG_OCTETS, fwdpb.CounterId_COUNTER_ID_TX_PACKETS, fwdpb.CounterId_COUNTER_ID_TX_OCTETS, fwdpb.CounterId_COUNTER_ID_TX_ERROR_PACKETS, fwdpb.CounterId_COUNTER_ID_TX_ERROR_OCTETS, fwdpb.CounterId_COUNTER_ID_TX_DROP_PACKETS, fwdpb.CounterId_COUNTER_ID_TX_DROP_OCTETS, fwdpb.CounterId_COUNTER_ID_TX_ADMIN_DROP_PACKETS, fwdpb.CounterId_COUNTER_ID_TX_ADMIN_DROP_OCTETS, }
CounterList is a set of counters incremented by ports.
Functions ¶
func Input ¶
func Input(port Port, packet fwdpacket.Packet, dir fwdpb.PortAction, ctx *fwdcontext.Context) (err error)
Input processes an incoming packet. The specified port actions are applied to the packet, and if the packet has an output port, output actions are performed on the packet. All appropriate counters are incremented.
func Output ¶
func Output(port Port, packet fwdpacket.Packet, dir fwdpb.PortAction, _ *fwdcontext.Context) (err error)
Output processes an outgoing packet. The specified port actions are applied to the packet, and if allowed the packet is written out of the port. All appropriate counters are incremented.
func Process ¶
func Process(port Port, packet fwdpacket.Packet, dir fwdpb.PortAction, ctx *fwdcontext.Context, prefix string)
Process processes a packet on the specified port, action direction and context. If the attribute "PacketDebug" is set, then the packet debugging is enabled.
func Register ¶
Register registers a builder for a port type. Note that builders are expected to be registered during package initialization.
func SetInputPort ¶
SetInputPort initializes the input port of the packet.
func SetOutputPort ¶
SetOutputPort initializes the output port of the packet.
Types ¶
type Builder ¶
type Builder interface { // Build builds a port. Build(portDesc *fwdpb.PortDesc, ctx *fwdcontext.Context) (Port, error) }
A Builder can build Ports of the specified type.
type Port ¶
type Port interface { fwdobject.Object // Update updates a port. Update(upd *fwdpb.PortUpdateDesc) error // Write writes a packet out. If successful, the port returns // fwdaction.CONSUME. Write(packet fwdpacket.Packet) (fwdaction.State, error) // Actions returns the port actions of the specified type Actions(dir fwdpb.PortAction) fwdaction.Actions // State manages the state of the port. State(op *fwdpb.PortInfo) (*fwdpb.PortStateReply, error) }
A Port is an entry or exit point within the forwarding plane. Each port has a set of actions to apply for incoming and outgoing packets.
Ports are always created by provisioning.
func OutputPort ¶
OutputPort returns the output port of the packet.
Directories ¶
Path | Synopsis |
---|---|
Package mock_fwdpacket is a generated GoMock package.
|
Package mock_fwdpacket is a generated GoMock package. |
Package ports implements various types of ports supported within Lucius.
|
Package ports implements various types of ports supported within Lucius. |
Package porttestutil contains routines used to create and manage ports for test cases.
|
Package porttestutil contains routines used to create and manage ports for test cases. |