netdevice

package
v0.0.0-...-bbc9ce3 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const DefaultBufferLength uint32 = 2048

DefaultBufferLength is 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
}

Client is 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) Close

func (c *Client) Close() error

Close closes the client and disposes of all its resources.

func (*Client) NewPort

func (c *Client) NewPort(ctx context.Context, portId network.PortId) (*Port, error)

NewPort creates a new port client for this device.

func (*Client) Run

func (c *Client) Run(ctx context.Context)

type InvalidPortOperatingModeError

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

func (*InvalidPortOperatingModeError) Error

type Port

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

Port is the instantiation of a network interface backed by a netdevice port.

func (*Port) ARPHardwareType

func (*Port) ARPHardwareType() header.ARPHardwareType

func (*Port) AddHeader

func (*Port) Attach

func (p *Port) Attach(dispatcher stack.NetworkDispatcher)

func (*Port) Capabilities

func (*Port) Capabilities() stack.LinkEndpointCapabilities

func (*Port) Class

func (p *Port) Class() network.DeviceClass

func (*Port) Close

func (p *Port) Close() error

func (*Port) DeviceClass

func (p *Port) DeviceClass() network.DeviceClass

func (*Port) Down

func (p *Port) Down() error

func (*Port) GSOMaxSize

func (*Port) GSOMaxSize() uint32

GSOMaxSize implements stack.GSOEndpoint.

func (*Port) IsAttached

func (p *Port) IsAttached() bool

func (*Port) LinkAddress

func (p *Port) LinkAddress() tcpip.LinkAddress

func (*Port) MTU

func (p *Port) MTU() uint32

func (*Port) MaxHeaderLength

func (*Port) MaxHeaderLength() uint16

func (*Port) Mode

func (p *Port) Mode() PortMode

Mode returns the port's operating mode.

func (*Port) RxStats

func (p *Port) RxStats() *fifo.RxStats

func (*Port) SetOnLinkClosed

func (p *Port) SetOnLinkClosed(f func())

func (*Port) SetOnLinkOnlineChanged

func (p *Port) SetOnLinkOnlineChanged(f func(bool))

func (*Port) SetPromiscuousMode

func (p *Port) SetPromiscuousMode(enabled bool) error

func (*Port) SupportedGSO

func (*Port) SupportedGSO() stack.SupportedGSO

SupportedGSO implements stack.GSOEndpoint.

func (*Port) TxStats

func (p *Port) TxStats() *fifo.TxStats

func (*Port) Up

func (p *Port) Up() error

func (*Port) Wait

func (p *Port) Wait()

func (*Port) WritePacket

func (p *Port) WritePacket(_ stack.RouteInfo, proto tcpip.NetworkProtocolNumber, pkt *stack.PacketBuffer) tcpip.Error

func (*Port) WritePackets

func (p *Port) WritePackets(_ stack.RouteInfo, pkts stack.PacketBufferList, proto tcpip.NetworkProtocolNumber) (int, tcpip.Error)

func (*Port) WriteRawPacket

func (p *Port) WriteRawPacket(pkt *stack.PacketBuffer) tcpip.Error

type PortAlreadyBoundError

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

func (*PortAlreadyBoundError) Error

func (e *PortAlreadyBoundError) Error() string

type PortMode

type PortMode int
const (
	PortModeEthernet PortMode
	PortModeIp
)

type SessionConfig

type SessionConfig struct {
	// Length of each buffer.
	BufferLength uint32
	// Buffer stride on VMO.
	BufferStride uint32
	// Descriptor length, in bytes.
	DescriptorLength uint64
	// Tx header length, in bytes.
	TxHeaderLength uint16
	// Tx tail length, in bytes.
	TxTailLength uint16
	// Number of rx descriptors to allocate.
	RxDescriptorCount uint16
	// Number of tx descriptors to allocate.
	TxDescriptorCount uint16
	// Session flags.
	Options network.SessionFlags
}

SessionConfig holds configuration used to open a session with a network device.

type SessionConfigFactory

type SessionConfigFactory interface {
	MakeSessionConfig(deviceInfo network.DeviceInfo) (SessionConfig, error)
}

SessionConfigFactory creates session configurations from device information.

type SimpleSessionConfigFactory

type SimpleSessionConfigFactory struct{}

SimpleSessionConfigFactory is the default configuration factory.

func (*SimpleSessionConfigFactory) MakeSessionConfig

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

MakeSessionConfig implements SessionConfigFactory.

Jump to

Keyboard shortcuts

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