proto

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2015 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MN_MAGIC   = 0x7f
	MN_VERSION = 0x01

	MN_CMD_UNKNOWN = uint16(0x0000)

	MN_CMD_REQ_CONN = uint16(0x0001)
	MN_CMD_RSP_CONN = uint16(0x0002)

	MN_CMD_REQ_SEND = uint16(0x0003)
	MN_CMD_RSP_SEND = uint16(0x0004)

	MN_CMD_REQ_RECV = uint16(0x0005)
	MN_CMD_RSP_RECV = uint16(0x0006)

	MN_CMD_REQ_CLOSE = uint16(0x0007)
	MN_CMD_RSP_CLOSE = uint16(0x0008)

	MN_CMD_REQ_RECONN = uint16(0x0009)
	MN_CMD_RSPREQCONN = uint16(0x000a)

	MN_CMD_MSG_NODE = uint16(0x000b)
	MN_CMD_MSG_KNOT = uint16(0x000c)
)
View Source
const (
	MK_MAGIC   = 0x7f
	MK_VERSION = 0x01

	MK_CMD_UNKNOWN = uint16(0x0000)

	MK_CMD_REQ_CONN = uint16(0x0001)
	MK_CMD_RSP_CONN = uint16(0x0002)

	MK_CMD_MSG_N2K = uint16(0x0003)
	MK_CMD_MSG_K2N = uint16(0x0004)

	MK_CMD_REQ_CLOSE = uint16(0x0005)
	MK_CMD_RSP_CLOSE = uint16(0x0006)

	MK_CMD_REQ_NEWAGENT = uint16(0x0007)
	MK_CMD_RSP_NEWAGENT = uint16(0x0008)
)

Variables

View Source
var (
	ELENGTH_TO_LONG = errors.New("Request's Length is Bigger than Read Buffer!")
)

Functions

This section is empty.

Types

type KnotMessage

type KnotMessage struct {
	Proto
	Magic   uint8
	Version uint8
	CMD     uint16
	Seq     uint32
	AgentID uint32
	Length  uint32

	ReadBuf []byte
	// contains filtered or unexported fields
}

func (*KnotMessage) Body

func (km *KnotMessage) Body() []byte

func (*KnotMessage) Init

func (km *KnotMessage) Init(buf []byte)

func (*KnotMessage) PackAndSend

func (km *KnotMessage) PackAndSend(data []byte, rw io.ReadWriter) (err error)

func (*KnotMessage) RecvAndUnpack

func (km *KnotMessage) RecvAndUnpack(rw io.ReadWriter) (err error)

type MagKnotCMD

type MagKnotCMD uint16

type MagNodeCMD

type MagNodeCMD uint16

type NodeProto

type NodeProto struct {
	Proto
	Magic   uint8
	Version uint8
	CMD     uint16
	Seq     uint32
	AgentID uint32
	Length  uint32
	// contains filtered or unexported fields
}

func (*NodeProto) Body

func (np *NodeProto) Body() []byte

func (*NodeProto) Init

func (np *NodeProto) Init(buf []byte)

func (*NodeProto) PackAndSend

func (np *NodeProto) PackAndSend(rw io.ReadWriter) (err error)

func (*NodeProto) RecvAndUnpack

func (np *NodeProto) RecvAndUnpack(rw io.ReadWriter) (err error)

type Proto

type Proto struct {
}

Jump to

Keyboard shortcuts

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