Documentation
¶
Overview ¶
Package mw is a generated GoMock package.
Index ¶
- Constants
- Variables
- func Checksum(b []byte, init uint32) uint16
- func RandU16() uint16
- func RandU32() uint32
- func RandU8() uint8
- func WriteFrame(fd int, dst EthAddr, src EthAddr, typ EthType, payload []byte) psErr.E
- type AddrFamily
- type ArpRxMessage
- type ArpTxMessage
- type DevFlag
- type DevType
- type Device
- func (p *Device) Addr() EthAddr
- func (p *Device) Down()
- func (p *Device) Equal(pp IDevice) bool
- func (p *Device) Flag() DevFlag
- func (p *Device) IsUp() bool
- func (p *Device) MTU() uint16
- func (p *Device) Name() string
- func (p *Device) Priv() Privilege
- func (p *Device) Type() DevType
- func (p *Device) Up()
- type EthAddr
- type EthHdr
- type EthMessage
- type EthType
- type IDevice
- type IP
- type IcmpQueueEntry
- type IcmpRxMessage
- type IcmpTxMessage
- type Iface
- type IpHdr
- type IpMessage
- type MockIDevice
- func (m *MockIDevice) Addr() EthAddr
- func (m *MockIDevice) Close() error.E
- func (m *MockIDevice) Down()
- func (m *MockIDevice) EXPECT() *MockIDeviceMockRecorder
- func (m *MockIDevice) Equal(dev IDevice) bool
- func (m *MockIDevice) Flag() DevFlag
- func (m *MockIDevice) IsUp() bool
- func (m *MockIDevice) MTU() uint16
- func (m *MockIDevice) Name() string
- func (m *MockIDevice) Open() error.E
- func (m *MockIDevice) Poll() error.E
- func (m *MockIDevice) Priv() Privilege
- func (m *MockIDevice) Transmit(dst EthAddr, payload []byte, typ EthType) error.E
- func (m *MockIDevice) Type() DevType
- func (m *MockIDevice) Up()
- type MockIDeviceMockRecorder
- func (mr *MockIDeviceMockRecorder) Addr() *gomock.Call
- func (mr *MockIDeviceMockRecorder) Close() *gomock.Call
- func (mr *MockIDeviceMockRecorder) Down() *gomock.Call
- func (mr *MockIDeviceMockRecorder) Equal(dev interface{}) *gomock.Call
- func (mr *MockIDeviceMockRecorder) Flag() *gomock.Call
- func (mr *MockIDeviceMockRecorder) IsUp() *gomock.Call
- func (mr *MockIDeviceMockRecorder) MTU() *gomock.Call
- func (mr *MockIDeviceMockRecorder) Name() *gomock.Call
- func (mr *MockIDeviceMockRecorder) Open() *gomock.Call
- func (mr *MockIDeviceMockRecorder) Poll() *gomock.Call
- func (mr *MockIDeviceMockRecorder) Priv() *gomock.Call
- func (mr *MockIDeviceMockRecorder) Transmit(dst, payload, typ interface{}) *gomock.Call
- func (mr *MockIDeviceMockRecorder) Type() *gomock.Call
- func (mr *MockIDeviceMockRecorder) Up() *gomock.Call
- type Privilege
- type ProtocolNumber
- type TcpRxMessage
- type TcpTxMessage
- type V4Addr
Constants ¶
const ( V4AddrLen = 4 V6AddrLen = 16 )
IP address lengths (bytes).
const EthAddrLen = 6
const EthFrameLenMax = 1514
const EthFrameLenMin = 60
const EthHdrLen = 14
const EthPayloadLenMax = EthFrameLenMax - EthHdrLen
const EthPayloadLenMin = EthFrameLenMin - EthHdrLen
const LoopbackBroadcast = "127.255.255.255"
const LoopbackIpAddr = "127.0.0.1"
const LoopbackNetmask = "255.0.0.0"
const LoopbackNetwork = "127.0.0.0"
Variables ¶
var ( V4Any = V4(0, 0, 0, 0) V4Broadcast = V4(255, 255, 255, 255) )
IP address expressions
var ArpRxCh chan *ArpRxMessage
var ArpTxCh chan *ArpTxMessage
var EthAny = EthAddr{0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
var EthBroadcast = EthAddr{0xff, 0xff, 0xff, 0xff, 0xff, 0xff}
var EthRxCh chan *EthMessage // channel for receiving packets
var EthTxCh chan *EthMessage // channel for sending packets
var IcmpDeadLetterQueue chan *IcmpQueueEntry
var IcmpRxCh chan *IcmpRxMessage
var IcmpTxCh chan *IcmpTxMessage
var IpRxCh chan *EthMessage
var IpTxCh chan *IpMessage
var TcpRxCh chan *TcpRxMessage
var TcpTxCh chan *TcpTxMessage
Functions ¶
Types ¶
type AddrFamily ¶
type AddrFamily int
AddrFamily is IP address family.
const ( V4AddrFamily AddrFamily = syscall.AF_INET V6AddrFamily AddrFamily = syscall.AF_INET6 )
IP address family
func (AddrFamily) String ¶
func (v AddrFamily) String() string
type ArpRxMessage ¶
type ArpTxMessage ¶
type DevFlag ¶
type DevFlag uint16
const BroadcastFlag DevFlag = 0x0020
const LoopbackFlag DevFlag = 0x0010
const NeedArpFlag DevFlag = 0x0100
const UpFlag DevFlag = 0x0001
type Device ¶
type EthAddr ¶
type EthAddr [EthAddrLen]byte
type EthMessage ¶
type IP ¶
type IP []byte
An IP is a single IP address.
func V4FromByte ¶ added in v0.5.0
type IcmpQueueEntry ¶ added in v0.4.0
type IcmpQueueEntry struct {
Payload []byte
}
type IcmpRxMessage ¶
type IcmpTxMessage ¶
type Iface ¶
type Iface struct { Family AddrFamily Unicast IP Netmask IP Broadcast IP Dev IDevice }
An Iface is a single iface.
type IpHdr ¶
type IpHdr struct { VHL uint8 TOS uint8 TotalLen uint16 ID uint16 Offset uint16 TTL uint8 Protocol ProtocolNumber Checksum uint16 Src [V4AddrLen]byte Dst [V4AddrLen]byte Options [0]byte }
IpHdr is an internet protocol header
type MockIDevice ¶
type MockIDevice struct {
// contains filtered or unexported fields
}
MockIDevice is a mock of IDevice interface.
func NewMockIDevice ¶
func NewMockIDevice(ctrl *gomock.Controller) *MockIDevice
NewMockIDevice creates a new mock instance.
func (*MockIDevice) EXPECT ¶
func (m *MockIDevice) EXPECT() *MockIDeviceMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockIDeviceMockRecorder ¶
type MockIDeviceMockRecorder struct {
// contains filtered or unexported fields
}
MockIDeviceMockRecorder is the mock recorder for MockIDevice.
func (*MockIDeviceMockRecorder) Addr ¶
func (mr *MockIDeviceMockRecorder) Addr() *gomock.Call
Addr indicates an expected call of Addr.
func (*MockIDeviceMockRecorder) Close ¶
func (mr *MockIDeviceMockRecorder) Close() *gomock.Call
Close indicates an expected call of Close.
func (*MockIDeviceMockRecorder) Down ¶
func (mr *MockIDeviceMockRecorder) Down() *gomock.Call
Down indicates an expected call of Down.
func (*MockIDeviceMockRecorder) Equal ¶
func (mr *MockIDeviceMockRecorder) Equal(dev interface{}) *gomock.Call
Equal indicates an expected call of Equal.
func (*MockIDeviceMockRecorder) Flag ¶
func (mr *MockIDeviceMockRecorder) Flag() *gomock.Call
Flag indicates an expected call of Flag.
func (*MockIDeviceMockRecorder) IsUp ¶
func (mr *MockIDeviceMockRecorder) IsUp() *gomock.Call
IsUp indicates an expected call of IsUp.
func (*MockIDeviceMockRecorder) MTU ¶
func (mr *MockIDeviceMockRecorder) MTU() *gomock.Call
MTU indicates an expected call of MTU.
func (*MockIDeviceMockRecorder) Name ¶
func (mr *MockIDeviceMockRecorder) Name() *gomock.Call
Name indicates an expected call of Name.
func (*MockIDeviceMockRecorder) Open ¶
func (mr *MockIDeviceMockRecorder) Open() *gomock.Call
Open indicates an expected call of Open.
func (*MockIDeviceMockRecorder) Poll ¶
func (mr *MockIDeviceMockRecorder) Poll() *gomock.Call
Poll indicates an expected call of Poll.
func (*MockIDeviceMockRecorder) Priv ¶
func (mr *MockIDeviceMockRecorder) Priv() *gomock.Call
Priv indicates an expected call of Priv.
func (*MockIDeviceMockRecorder) Transmit ¶
func (mr *MockIDeviceMockRecorder) Transmit(dst, payload, typ interface{}) *gomock.Call
Transmit indicates an expected call of Transmit.
func (*MockIDeviceMockRecorder) Type ¶
func (mr *MockIDeviceMockRecorder) Type() *gomock.Call
Type indicates an expected call of Type.
func (*MockIDeviceMockRecorder) Up ¶
func (mr *MockIDeviceMockRecorder) Up() *gomock.Call
Up indicates an expected call of Up.
type ProtocolNumber ¶
type ProtocolNumber uint8
ProtocolNumber is assigned internet protocol number
const ( PnICMP ProtocolNumber = 1 PnTCP ProtocolNumber = 6 PnUDP ProtocolNumber = 17 )
func (ProtocolNumber) String ¶
func (v ProtocolNumber) String() string
type TcpRxMessage ¶ added in v0.5.0
type TcpTxMessage ¶ added in v0.5.0
type TcpTxMessage struct{}