Documentation ¶
Overview ¶
Package testutil defines types and functions used to test Network Layer functionality such as IP fragmentation.
Index ¶
- func MakeRandPkt(transportHeaderLength int, extraHeaderReserveLength int, viewSizes []int, ...) stack.PacketBufferPtr
- type MockLinkEndpoint
- func (*MockLinkEndpoint) ARPHardwareType() header.ARPHardwareType
- func (*MockLinkEndpoint) AddHeader(stack.PacketBufferPtr)
- func (*MockLinkEndpoint) Attach(stack.NetworkDispatcher)
- func (*MockLinkEndpoint) Capabilities() stack.LinkEndpointCapabilities
- func (ep *MockLinkEndpoint) Close()
- func (*MockLinkEndpoint) IsAttached() bool
- func (*MockLinkEndpoint) LinkAddress() tcpip.LinkAddress
- func (ep *MockLinkEndpoint) MTU() uint32
- func (*MockLinkEndpoint) MaxHeaderLength() uint16
- func (*MockLinkEndpoint) Wait()
- func (ep *MockLinkEndpoint) WritePackets(pkts stack.PacketBufferList) (int, tcpip.Error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeRandPkt ¶
func MakeRandPkt(transportHeaderLength int, extraHeaderReserveLength int, viewSizes []int, proto tcpip.NetworkProtocolNumber) stack.PacketBufferPtr
MakeRandPkt generates a randomized packet. transportHeaderLength indicates how many random bytes will be copied in the Transport Header. extraHeaderReserveLength indicates how much extra space will be reserved for the other headers. The payload is made from Views of the sizes listed in viewSizes.
Types ¶
type MockLinkEndpoint ¶
type MockLinkEndpoint struct { // WrittenPackets is where packets written to the endpoint are stored. WrittenPackets []stack.PacketBufferPtr // contains filtered or unexported fields }
MockLinkEndpoint is an endpoint used for testing, it stores packets written to it and can mock errors.
func NewMockLinkEndpoint ¶
func NewMockLinkEndpoint(mtu uint32, err tcpip.Error, allowPackets int) *MockLinkEndpoint
NewMockLinkEndpoint creates a new MockLinkEndpoint.
err is the error that will be returned once allowPackets packets are written to the endpoint.
func (*MockLinkEndpoint) ARPHardwareType ¶
func (*MockLinkEndpoint) ARPHardwareType() header.ARPHardwareType
ARPHardwareType implements LinkEndpoint.ARPHardwareType.
func (*MockLinkEndpoint) AddHeader ¶
func (*MockLinkEndpoint) AddHeader(stack.PacketBufferPtr)
AddHeader implements LinkEndpoint.AddHeader.
func (*MockLinkEndpoint) Attach ¶
func (*MockLinkEndpoint) Attach(stack.NetworkDispatcher)
Attach implements LinkEndpoint.Attach.
func (*MockLinkEndpoint) Capabilities ¶
func (*MockLinkEndpoint) Capabilities() stack.LinkEndpointCapabilities
Capabilities implements LinkEndpoint.Capabilities.
func (*MockLinkEndpoint) IsAttached ¶
func (*MockLinkEndpoint) IsAttached() bool
IsAttached implements LinkEndpoint.IsAttached.
func (*MockLinkEndpoint) LinkAddress ¶
func (*MockLinkEndpoint) LinkAddress() tcpip.LinkAddress
LinkAddress implements LinkEndpoint.LinkAddress.
func (*MockLinkEndpoint) MTU ¶
func (ep *MockLinkEndpoint) MTU() uint32
MTU implements LinkEndpoint.MTU.
func (*MockLinkEndpoint) MaxHeaderLength ¶
func (*MockLinkEndpoint) MaxHeaderLength() uint16
MaxHeaderLength implements LinkEndpoint.MaxHeaderLength.
func (*MockLinkEndpoint) WritePackets ¶
func (ep *MockLinkEndpoint) WritePackets(pkts stack.PacketBufferList) (int, tcpip.Error)
WritePackets implements LinkEndpoint.WritePackets.