netstack: github.com/google/netstack/tcpip/link/fdbased Index | Files

package fdbased

import "github.com/google/netstack/tcpip/link/fdbased"

Package fdbased provides the implemention of data-link layer endpoints backed by boundary-preserving file descriptors (e.g., TUN devices, seqpacket/datagram sockets).

FD based endpoints can be used in the networking stack by calling New() to create a new endpoint, and then passing it as an argument to Stack.CreateNIC().

Index

Package Files

endpoint.go

Variables

var BufConfig = []int{128, 256, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768}

BufConfig defines the shape of the vectorised view used to read packets from the NIC.

func New Uses

func New(opts *Options) tcpip.LinkEndpointID

New creates a new fd-based endpoint.

Makes fd non-blocking, but does not take ownership of fd, which must remain open for the lifetime of the returned endpoint.

type InjectableEndpoint Uses

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

InjectableEndpoint is an injectable fd-based endpoint. The endpoint writes to the FD, but does not read from it. All reads come from injected packets.

func NewInjectable Uses

func NewInjectable(fd int, mtu uint32) (tcpip.LinkEndpointID, *InjectableEndpoint)

NewInjectable creates a new fd-based InjectableEndpoint.

func (*InjectableEndpoint) Attach Uses

func (e *InjectableEndpoint) Attach(dispatcher stack.NetworkDispatcher)

Attach saves the stack network-layer dispatcher for use later when packets are injected.

func (*InjectableEndpoint) Capabilities Uses

func (e *InjectableEndpoint) Capabilities() stack.LinkEndpointCapabilities

Capabilities implements stack.LinkEndpoint.Capabilities.

func (*InjectableEndpoint) Inject Uses

func (e *InjectableEndpoint) Inject(protocol tcpip.NetworkProtocolNumber, vv buffer.VectorisedView)

Inject injects an inbound packet.

func (*InjectableEndpoint) IsAttached Uses

func (e *InjectableEndpoint) IsAttached() bool

IsAttached implements stack.LinkEndpoint.IsAttached.

func (*InjectableEndpoint) LinkAddress Uses

func (e *InjectableEndpoint) LinkAddress() tcpip.LinkAddress

LinkAddress returns the link address of this endpoint.

func (*InjectableEndpoint) MTU Uses

func (e *InjectableEndpoint) MTU() uint32

MTU implements stack.LinkEndpoint.MTU. It returns the value initialized during construction.

func (*InjectableEndpoint) MaxHeaderLength Uses

func (e *InjectableEndpoint) MaxHeaderLength() uint16

MaxHeaderLength returns the maximum size of the link-layer header.

func (*InjectableEndpoint) WritePacket Uses

func (e *InjectableEndpoint) WritePacket(r *stack.Route, hdr buffer.Prependable, payload buffer.VectorisedView, protocol tcpip.NetworkProtocolNumber) *tcpip.Error

WritePacket writes outbound packets to the file descriptor. If it is not currently writable, the packet is dropped.

type Options Uses

type Options struct {
    FD              int
    MTU             uint32
    EthernetHeader  bool
    ChecksumOffload bool
    ClosedFunc      func(*tcpip.Error)
    Address         tcpip.LinkAddress
    SaveRestore     bool
    DisconnectOk    bool
    HandleLocal     bool
}

Options specify the details about the fd-based endpoint to be created.

Package fdbased imports 6 packages (graph) and is imported by 2 packages. Updated 2018-09-21. Refresh now. Tools for package owners.