Documentation ¶
Overview ¶
Package network provides facilities to support tcpip.Endpoints that operate at the network layer or above.
Index ¶
- type Endpoint
- func (e *Endpoint) AcquireContextForWrite(opts tcpip.WriteOptions) (WriteContext, tcpip.Error)
- func (e *Endpoint) Bind(addr tcpip.FullAddress) tcpip.Error
- func (e *Endpoint) BindAndThen(addr tcpip.FullAddress, ...) tcpip.Error
- func (e *Endpoint) Close()
- func (e *Endpoint) Connect(addr tcpip.FullAddress) tcpip.Error
- func (e *Endpoint) ConnectAndThen(addr tcpip.FullAddress, ...) tcpip.Error
- func (e *Endpoint) Disconnect()
- func (e *Endpoint) GetLocalAddress() tcpip.FullAddress
- func (e *Endpoint) GetRemoteAddress() (tcpip.FullAddress, bool)
- func (e *Endpoint) GetSockOpt(opt tcpip.GettableSocketOption) tcpip.Error
- func (e *Endpoint) GetSockOptInt(opt tcpip.SockOptInt) (int, tcpip.Error)
- func (e *Endpoint) Info() stack.TransportEndpointInfo
- func (e *Endpoint) Init(s *stack.Stack, netProto tcpip.NetworkProtocolNumber, ...)
- func (e *Endpoint) NetProto() tcpip.NetworkProtocolNumber
- func (e *Endpoint) Resume(s *stack.Stack)
- func (e *Endpoint) SetOwner(owner tcpip.PacketOwner)
- func (e *Endpoint) SetSockOpt(opt tcpip.SettableSocketOption) tcpip.Error
- func (e *Endpoint) SetSockOptInt(opt tcpip.SockOptInt, v int) tcpip.Error
- func (e *Endpoint) Shutdown() tcpip.Error
- func (e *Endpoint) State() transport.DatagramEndpointState
- func (e *Endpoint) WasBound() bool
- type WriteContext
- type WritePacketInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Endpoint ¶
type Endpoint struct {
// contains filtered or unexported fields
}
Endpoint is a datagram-based endpoint. It only supports sending datagrams to a peer.
+stateify savable
func (*Endpoint) AcquireContextForWrite ¶
func (e *Endpoint) AcquireContextForWrite(opts tcpip.WriteOptions) (WriteContext, tcpip.Error)
AcquireContextForWrite acquires a WriteContext.
func (*Endpoint) Bind ¶
func (e *Endpoint) Bind(addr tcpip.FullAddress) tcpip.Error
Bind binds the endpoint to the address.
func (*Endpoint) BindAndThen ¶
func (e *Endpoint) BindAndThen(addr tcpip.FullAddress, f func(tcpip.NetworkProtocolNumber, tcpip.Address) tcpip.Error) tcpip.Error
BindAndThen binds the endpoint to the address and then calls the provided function.
If the function returns an error, the endpoint's state does not change. The function will be called with the bound network protocol and address.
func (*Endpoint) Close ¶
func (e *Endpoint) Close()
Close cleans the endpoint's resources and leaves the endpoint in a closed state.
func (*Endpoint) Connect ¶
func (e *Endpoint) Connect(addr tcpip.FullAddress) tcpip.Error
Connect connects the endpoint to the address.
func (*Endpoint) ConnectAndThen ¶
func (e *Endpoint) ConnectAndThen(addr tcpip.FullAddress, f func(netProto tcpip.NetworkProtocolNumber, previousID, nextID stack.TransportEndpointID) tcpip.Error) tcpip.Error
ConnectAndThen connects the endpoint to the address and then calls the provided function.
If the function returns an error, the endpoint's state does not change. The function will be called with the network protocol used to connect to the peer and the source and destination addresses that will be used to send traffic to the peer.
func (*Endpoint) Disconnect ¶
func (e *Endpoint) Disconnect()
Disconnect disconnects the endpoint from its peer.
func (*Endpoint) GetLocalAddress ¶
func (e *Endpoint) GetLocalAddress() tcpip.FullAddress
GetLocalAddress returns the address that the endpoint is bound to.
func (*Endpoint) GetRemoteAddress ¶
func (e *Endpoint) GetRemoteAddress() (tcpip.FullAddress, bool)
GetRemoteAddress returns the address that the endpoint is connected to.
func (*Endpoint) GetSockOpt ¶
func (e *Endpoint) GetSockOpt(opt tcpip.GettableSocketOption) tcpip.Error
GetSockOpt returns the socket option.
func (*Endpoint) GetSockOptInt ¶
GetSockOptInt returns the socket option.
func (*Endpoint) Info ¶
func (e *Endpoint) Info() stack.TransportEndpointInfo
Info returns a copy of the endpoint info.
func (*Endpoint) Init ¶
func (e *Endpoint) Init(s *stack.Stack, netProto tcpip.NetworkProtocolNumber, transProto tcpip.TransportProtocolNumber, ops *tcpip.SocketOptions)
Init initializes the endpoint.
func (*Endpoint) NetProto ¶
func (e *Endpoint) NetProto() tcpip.NetworkProtocolNumber
NetProto returns the network protocol the endpoint was initialized with.
func (*Endpoint) SetOwner ¶
func (e *Endpoint) SetOwner(owner tcpip.PacketOwner)
SetOwner sets the owner of transmitted packets.
func (*Endpoint) SetSockOpt ¶
func (e *Endpoint) SetSockOpt(opt tcpip.SettableSocketOption) tcpip.Error
SetSockOpt sets the socket option.
func (*Endpoint) SetSockOptInt ¶
SetSockOptInt sets the socket option.
func (*Endpoint) State ¶
func (e *Endpoint) State() transport.DatagramEndpointState
State returns the state of the endpoint.
type WriteContext ¶
type WriteContext struct {
// contains filtered or unexported fields
}
WriteContext holds the context for a write.
func (*WriteContext) PacketInfo ¶
func (c *WriteContext) PacketInfo() WritePacketInfo
PacketInfo returns the properties of a packet that will be written.
func (*WriteContext) WritePacket ¶
func (c *WriteContext) WritePacket(pkt *stack.PacketBuffer, headerIncluded bool) tcpip.Error
WritePacket attempts to write the packet.
type WritePacketInfo ¶
type WritePacketInfo struct { NetProto tcpip.NetworkProtocolNumber LocalAddress, RemoteAddress tcpip.Address MaxHeaderLength uint16 RequiresTXTransportChecksum bool }
WritePacketInfo is the properties of a packet that may be written.