Documentation
¶
Overview ¶
Package stack provides the glue between networking protocols and the consumers of the networking stack.
For consumers, the only function of interest is New(), everything else is provided by the tcpip/public package.
For protocol implementers, RegisterTransportProtocol() and RegisterNetworkProtocol() are used to register protocols with the stack, which will then be instantiated when consumers interact with the stack.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NetworkEndpoint ¶
type NetworkEndpoint interface {
// MTU returns the maximum transmission unit for this endpoint. This is
// generally calculated as the MTU of the underlying data link endpoint
// minus the network endpoint max header length.
MTU() uint32
// MaxHeaderLength returns the maximum size the network (and lower
// level layers combined) headers can have. Higher levels use this
// information to reserve space in the front of the packets they're
// building.
MaxHeaderLength() uint16
// ID returns the network protocol endpoint ID.
ID() *NetworkEndpointID
// NICID returns the id of the NIC this endpoint belongs to.
NICID() tcpip.NICID
// WritePacket writes a packet to the given destination address and
// protocol.
// TODO
WritePacket(r *Route, hdr *buffer.Prependable, payload buffer.View, protocol tcpip.TransportProtocolNumber) error
// HandlePacket is the interface that needs to be implemented by network
// Protocols (e.g., IPv4, ipv6) that want to be part of the networking stack.
HandlePacket(r *Route, v buffer.View)
}
NetworkEndpoint is the interface that needs to be implemented by endpoints of network layer protocols (e.g. ipv4, ipv6).
type NetworkEndpointID ¶
NetworkEndpointID is the identifier of a network layer protocol endpoint. Currently the local address is sufficient because all supported protocols (i.e., IPv4 and IPv6) have different sizes for their addresses.
type Route ¶
type Route struct{}
Route represents a route through the networking stack to a given destination
type TransportEndpoint ¶
type TransportEndpoint interface {
// HandlePacket is called by the stack when new packets arrive to
// this transport endpoint.
HandlePacket(r *Route, id TransportEndpointID, v buffer.View)
}
TransportEndpoint is the interface that needs to be implemented by transport protocol (e.g., tcp, udp) endpoints that can handle packets.
type TransportEndpointID ¶
type TransportEndpointID struct {
// LocalPort is the local port associated with the endpoint.
LocalPort uint16
// LocalAddress is the local [network layer] address associated with
// the endpoint.
LocalAddress tcpip.Address
// RemotePort is the remote port associated with the endpoint.
RemotePort uint16
// RemoteAddress is the remote [network layer] address associated with
// the endpoint.
RemoteAddress tcpip.Address
}
TransportEndpointID is the identifier of a transport layer protocol endpoint.