Back to godoc.org

Package netdevice

v0.0.0 (1d15c6a)
Latest Go to latest
Published: Jul 31, 2020 | License: BSD-3-Clause | Module: go.fuchsia.dev/fuchsia

Index

Package Files

Constants

const DefaultBufferLength uint32 = 2048

The buffer length used by SimpleSessionConfigFactory.

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) AddHeader(_, _ tcpip.LinkAddress, _ tcpip.NetworkProtocolNumber, _ *stack.PacketBuffer)

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) Down

func (c *Client) Down() error

func (*Client) GSOMaxSize

func (c *Client) GSOMaxSize() uint32

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) 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) Up

func (c *Client) Up() error

func (*Client) Wait

func (c *Client) Wait()

func (*Client) WritePacket

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

func (*Client) WritePackets

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

func (*Client) WriteRawPacket

func (c *Client) WriteRawPacket(vv buffer.VectorisedView) *tcpip.Error

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

func NewMacAddressingClient(ctx context.Context, dev *network.DeviceWithCtxInterface, mac *network.MacAddressingWithCtxInterface, sessionConfigFactory SessionConfigFactory) (*MacAddressingClient, error)

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.

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier