netdevice

package
v0.0.0-...-2208570 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2021 License: BSD-2-Clause Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultBufferLength uint32 = 2048

The buffer length used by SimpleSessionConfigFactory.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

A client for a network device that implements the fuchsia.hardware.network.Device protocol.

func NewClient

func NewClient(ctx context.Context, dev *network.DeviceWithCtxInterface, sessionConfigFactory SessionConfigFactory) (*Client, error)

NewClient creates a new client from a provided network device interface.

func (*Client) ARPHardwareType

func (*Client) ARPHardwareType() header.ARPHardwareType

func (*Client) AddHeader

func (*Client) Attach

func (c *Client) Attach(dispatcher stack.NetworkDispatcher)

func (*Client) Capabilities

func (c *Client) Capabilities() stack.LinkEndpointCapabilities

func (*Client) Close

func (c *Client) Close() error

Closes the client and disposes of all its resources.

func (*Client) DeviceClass

func (c *Client) DeviceClass() network.DeviceClass

func (*Client) Down

func (c *Client) Down() error

func (*Client) GSOMaxSize

func (c *Client) GSOMaxSize() uint32

func (*Client) Info

func (c *Client) Info() network.Info

Info implements InfoProvider.

func (*Client) IsAttached

func (c *Client) IsAttached() bool

func (*Client) LinkAddress

func (c *Client) LinkAddress() tcpip.LinkAddress

func (*Client) MTU

func (c *Client) MTU() uint32

func (*Client) MaxHeaderLength

func (c *Client) MaxHeaderLength() uint16

func (*Client) RxStats

func (c *Client) RxStats() *fifo.RxStats

RxStats implements InfoProvider.

func (*Client) SetOnLinkClosed

func (c *Client) SetOnLinkClosed(f func())

func (*Client) SetOnLinkOnlineChanged

func (c *Client) SetOnLinkOnlineChanged(f func(bool))

func (*Client) SetPromiscuousMode

func (c *Client) SetPromiscuousMode(bool) error

func (*Client) TxStats

func (c *Client) TxStats() *fifo.TxStats

TxStats implements InfoProvider.

func (*Client) Up

func (c *Client) Up() error

func (*Client) Wait

func (c *Client) Wait()

func (*Client) WritePacket

func (c *Client) WritePacket(_ stack.RouteInfo, _ *stack.GSO, proto tcpip.NetworkProtocolNumber, pkt *stack.PacketBuffer) tcpip.Error

func (*Client) WritePackets

func (c *Client) WritePackets(_ stack.RouteInfo, _ *stack.GSO, pkts stack.PacketBufferList, proto tcpip.NetworkProtocolNumber) (int, tcpip.Error)

type InfoProvider

type InfoProvider interface {
	RxStats() *fifo.RxStats
	TxStats() *fifo.TxStats
	Info() network.Info
}

InfoProvider abstracts a common information interface for different Clients.

type MacAddressingClient

type MacAddressingClient struct {
	*Client
	// contains filtered or unexported fields
}

A fuchsia.hardware.network/Device client with an auxiliary fuchsia.hardware.network/MacAddressing proxy that provides the link layer information.

func NewMacAddressingClient

NewMacAddressingClient creates a new Network Device client with attached link-layer MAC information.

func (*MacAddressingClient) LinkAddress

func (c *MacAddressingClient) LinkAddress() tcpip.LinkAddress

func (*MacAddressingClient) SetPromiscuousMode

func (c *MacAddressingClient) SetPromiscuousMode(b bool) error

type SessionConfig

type SessionConfig struct {
	// Length of each buffer.
	BufferLength uint32
	// Buffer stride on VMO.
	BufferStride uint32
	// Descriptor length, in bytes.
	DescriptorLength uint64
	// Number of rx descriptors to allocate.
	RxDescriptorCount uint16
	// Number of tx descriptors to allocate.
	TxDescriptorCount uint16
	// Session flags.
	Options network.SessionFlags
	// Types of rx frames to subscribe to.
	RxFrames []network.FrameType
}

Configuration used to open a session with a network device.

type SessionConfigFactory

type SessionConfigFactory interface {
	// Creates a SessionConfig for a given network device based on the provided
	// deviceInfo.
	MakeSessionConfig(deviceInfo *network.Info) (SessionConfig, error)
}

A factory of session configurations from device information. A default implementation is provided by SimpleSessionConfigFactory.

type SimpleSessionConfigFactory

type SimpleSessionConfigFactory struct {
	// The frame types to subscribe to. Will subscribe to all frame types if
	// empty.
	FrameTypes []network.FrameType
}

A simple session configuration factory.

func (*SimpleSessionConfigFactory) MakeSessionConfig

func (c *SimpleSessionConfigFactory) MakeSessionConfig(deviceInfo *network.Info) (SessionConfig, error)

MakeSessionConfig implements SessionConfigFactory.

Jump to

Keyboard shortcuts

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