Documentation ¶
Overview ¶
Package channel provides the implemention of channel-based data-link layer endpoints. Such endpoints allow injection of inbound packets and store outbound packets in a channel.
Index ¶
- type Endpoint
- func (e *Endpoint) Attach(dispatcher stack.NetworkDispatcher)
- func (*Endpoint) Capabilities() stack.LinkEndpointCapabilities
- func (e *Endpoint) Drain() int
- func (e *Endpoint) Inject(protocol tcpip.NetworkProtocolNumber, vv *buffer.VectorisedView)
- func (e *Endpoint) LinkAddress() tcpip.LinkAddress
- func (e *Endpoint) MTU() uint32
- func (*Endpoint) MaxHeaderLength() uint16
- func (e *Endpoint) WritePacket(_ *stack.Route, hdr *buffer.Prependable, payload buffer.View, ...) *tcpip.Error
- type PacketInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Endpoint ¶
type Endpoint struct { // C is where outbound packets are queued. C chan PacketInfo // contains filtered or unexported fields }
Endpoint is link layer endpoint that stores outbound packets in a channel and allows injection of inbound packets.
func New ¶
func New(size int, mtu uint32, linkAddr tcpip.LinkAddress) (tcpip.LinkEndpointID, *Endpoint)
New creates a new channel endpoint.
func (*Endpoint) Attach ¶
func (e *Endpoint) Attach(dispatcher stack.NetworkDispatcher)
Attach saves the stack network-layer dispatcher for use later when packets are injected.
func (*Endpoint) Capabilities ¶
func (*Endpoint) Capabilities() stack.LinkEndpointCapabilities
Capabilities implements stack.LinkEndpoint.Capabilities.
func (*Endpoint) Inject ¶
func (e *Endpoint) Inject(protocol tcpip.NetworkProtocolNumber, vv *buffer.VectorisedView)
Inject injects an inbound packet.
func (*Endpoint) LinkAddress ¶
func (e *Endpoint) LinkAddress() tcpip.LinkAddress
LinkAddress returns the link address of this endpoint.
func (*Endpoint) MTU ¶
MTU implements stack.LinkEndpoint.MTU. It returns the value initialized during construction.
func (*Endpoint) MaxHeaderLength ¶
MaxHeaderLength returns the maximum size of the link layer header. Given it doesn't have a header, it just returns 0.
func (*Endpoint) WritePacket ¶
func (e *Endpoint) WritePacket(_ *stack.Route, hdr *buffer.Prependable, payload buffer.View, protocol tcpip.NetworkProtocolNumber) *tcpip.Error
WritePacket stores outbound packets into the channel.
type PacketInfo ¶
PacketInfo holds all the information about an outbound packet.