intface

package
v0.0.0-...-6c4fd92 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: NIST-PD-fallback Imports: 6 Imported by: 0

Documentation

Overview

Package intface implements an internal face for internal applications. It bridges a iface.Face (socket face) on DPDK side and an ndn.L3Face on application side.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collector

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

Collector accumulates packets received by ndn.Face.

func Collect

func Collect(f *IntFace) *Collector

Collect starts collecting packets received by face.

func (*Collector) Clear

func (c *Collector) Clear() (received []*ndn.Packet)

Clear returns and deletes collected packets.

func (*Collector) Count

func (c *Collector) Count() (count int)

Count returns number of collected packets.

func (*Collector) Get

func (c *Collector) Get(i int) (packet *ndn.Packet)

Get returns i-th collected packets. If negative, count from the end. If out-of-range, return nil.

func (*Collector) Peek

func (c *Collector) Peek(f func(received []*ndn.Packet))

Peek provides read-only access to the slice of collected packets.

type IntFace

type IntFace struct {
	// D is the face on DPDK side.
	// Packets sent on D are received on A.
	D iface.Face

	// ID is the ID on DPDK side.
	ID iface.ID

	// A is the face on application side.
	// Packets sent on A are received by D.
	A l3.Face

	// Rx is application side RX channel.
	// It's equivalent to A.Rx().
	Rx <-chan *ndn.Packet

	// Tx is application side TX channel.
	// It's equivalent to A.Tx().
	Tx chan<- ndn.L3Packet
}

IntFace is an iface.Face and a ndn.L3Face connected together.

func Must

func Must(f *IntFace, e error) *IntFace

Must panics on error.

func MustNew

func MustNew() *IntFace

MustNew creates an IntFace with default settings, and panics on error.

func New

func New(cfg socketface.Config) (f *IntFace, e error)

New creates an IntFace.

func (*IntFace) SetDown

func (f *IntFace) SetDown(isDown bool)

SetDown changes up/down state on the DPDK side.

Jump to

Keyboard shortcuts

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