Documentation ¶
Overview ¶
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 ¶
- Variables
- func New(ifce *water.Interface, opts *Options) tcpip.LinkEndpointID
- type InjectableEndpoint
- func (e *InjectableEndpoint) Attach(dispatcher stack.NetworkDispatcher)
- func (e *InjectableEndpoint) Capabilities() stack.LinkEndpointCapabilities
- func (e *InjectableEndpoint) Inject(protocol tcpip.NetworkProtocolNumber, vv buffer.VectorisedView)
- func (e *InjectableEndpoint) IsAttached() bool
- func (e *InjectableEndpoint) LinkAddress() tcpip.LinkAddress
- func (e *InjectableEndpoint) MTU() uint32
- func (e *InjectableEndpoint) MaxHeaderLength() uint16
- func (e *InjectableEndpoint) WritePacket(r *stack.Route, hdr buffer.Prependable, payload buffer.VectorisedView, ...) *tcpip.Error
- type Options
Constants ¶
This section is empty.
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.
Functions ¶
Types ¶
type InjectableEndpoint ¶
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 ¶
func NewInjectable(fd int, mtu uint32) (tcpip.LinkEndpointID, *InjectableEndpoint)
NewInjectable creates a new fd-based InjectableEndpoint.
func (*InjectableEndpoint) Attach ¶
func (e *InjectableEndpoint) Attach(dispatcher stack.NetworkDispatcher)
Attach saves the stack network-layer dispatcher for use later when packets are injected.
func (*InjectableEndpoint) Capabilities ¶
func (e *InjectableEndpoint) Capabilities() stack.LinkEndpointCapabilities
Capabilities implements stack.LinkEndpoint.Capabilities.
func (*InjectableEndpoint) Inject ¶
func (e *InjectableEndpoint) Inject(protocol tcpip.NetworkProtocolNumber, vv buffer.VectorisedView)
Inject injects an inbound packet.
func (*InjectableEndpoint) IsAttached ¶
func (e *InjectableEndpoint) IsAttached() bool
IsAttached implements stack.LinkEndpoint.IsAttached.
func (*InjectableEndpoint) LinkAddress ¶
func (e *InjectableEndpoint) LinkAddress() tcpip.LinkAddress
LinkAddress returns the link address of this endpoint.
func (*InjectableEndpoint) MTU ¶
func (e *InjectableEndpoint) MTU() uint32
MTU implements stack.LinkEndpoint.MTU. It returns the value initialized during construction.
func (*InjectableEndpoint) MaxHeaderLength ¶
func (e *InjectableEndpoint) MaxHeaderLength() uint16
MaxHeaderLength returns the maximum size of the link-layer header.
func (*InjectableEndpoint) WritePacket ¶
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.