fibcnet

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 26, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FFPACKET_ETHTYPE uint16 = 0x0a0a
)
View Source
const HEADER_LEN = 8

Variables

This section is empty.

Functions

func ReadBytes

func ReadBytes(r io.Reader, length int64) ([]byte, error)

func SockAddr

func SockAddr(ifindex int) syscall.Sockaddr

func Write

func Write(w io.Writer, t uint16, xid uint32, b []byte) error

func WriteMessage

func WriteMessage(w io.Writer, msg Message, xid uint32) error

Types

type Client added in v0.3.1

type Client struct {
	// contains filtered or unexported fields
}

Client

func NewClient added in v0.3.1

func NewClient(addr string) *Client

func (*Client) Conn added in v0.3.1

func (c *Client) Conn() <-chan bool

func (*Client) Read added in v0.3.1

func (c *Client) Read() (*Header, []byte, error)

func (*Client) SetRetyTime added in v0.3.1

func (c *Client) SetRetyTime(msec time.Duration)

func (*Client) Start added in v0.3.1

func (c *Client) Start(callback ClientConnectedCallback)

func (*Client) Stop added in v0.3.1

func (c *Client) Stop()

func (*Client) Write added in v0.3.1

func (c *Client) Write(msg Message, xid uint32) error

type ClientConnectedCallback added in v0.3.1

type ClientConnectedCallback func(client *Client)

type Connection added in v0.3.1

type Connection struct {
	// contains filtered or unexported fields
}

Connection

func NewConnection added in v0.3.1

func NewConnection(addr string) *Connection

func (*Connection) Close added in v0.3.1

func (c *Connection) Close()

func (*Connection) Connect added in v0.3.1

func (c *Connection) Connect() error

func (*Connection) Read added in v0.3.1

func (c *Connection) Read() (*Header, []byte, error)

func (*Connection) Write added in v0.3.1

func (c *Connection) Write(msg Message, xid uint32) error

type EthHdr

type EthHdr struct {
	EthDst  [6]byte
	EthSrc  [6]byte
	EthType uint16
}

type FFPacket

type FFPacket struct {
	EthHdr

	ReId   [24]byte
	Ifname [24]byte
	// contains filtered or unexported fields
}

func NewFFPacket

func NewFFPacket(reId string, hwAddr net.HardwareAddr, ifname string) *FFPacket

func (*FFPacket) Bytes

func (p *FFPacket) Bytes() ([]byte, error)
type Header struct {
	Type   uint16
	Length uint16
	Xid    uint32
}

func ParseHeader

func ParseHeader(data []byte) (*Header, error)

func Read

func Read(r io.Reader) (*Header, []byte, error)

func ReadHeader

func ReadHeader(r io.Reader) (*Header, error)

type Message

type Message interface {
	Bytes() ([]byte, error)
	Type() uint16
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL