protos

package
v0.0.0-...-254d333 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2015 License: MIT Imports: 9 Imported by: 0

README

GS与HUB通信协议

包结构

|LENGTH|SEQNUM|PROTO|PAYLOAD|

|16|64|16|...|

包测试:

ping:
echo "000E 0000000000000001 0000 0000000A" | xxd -r -ps |nc 127.0.0.1 8890 -q 2|hexdump -C

get state:
echo "000E 0000000000000001 0009 00000001" | xxd -r -ps |nc 127.0.0.1 8889 -q 2|hexdump -C

forward content "ABCD" to user 1 :
echo "0012 0000000000000001 0080 00000001 0002 ABCD" | xxd -r -ps |nc 127.0.0.1 8889 -q 2|hexdump -C

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Code = map[string]int16{
	"ping_req":    0,
	"login_req":   1,
	"logout_req":  2,
	"raid_req":    3,
	"protect_req": 4,
	"free_req":    5,
	"adduser_req": 6,
	"forward_req": 100,
}
View Source
var ProtoHandler map[int16]func(int32, *packet.Packet) []byte
View Source
var RCode = map[int16]string{
	0:   "ping_req",
	1:   "login_req",
	2:   "logout_req",
	3:   "raid_req",
	4:   "protect_req",
	5:   "free_req",
	6:   "adduser_req",
	100: "forward_req",
}

Functions

func AddServer

func AddServer(hostid int32, forward chan IPCObject)

func AllServers

func AllServers() []int32

func ForwardChan

func ForwardChan(hostid int32) chan IPCObject

func HandleRequest

func HandleRequest(hostid int32, reader *packet.Packet, output chan []byte)

func P_adduser_req

func P_adduser_req(hostid int32, pkt *packet.Packet) []byte

func P_forward_req

func P_forward_req(hostid int32, pkt *packet.Packet) []byte

func P_free_req

func P_free_req(hostid int32, pkt *packet.Packet) []byte

func P_login_req

func P_login_req(hostid int32, pkt *packet.Packet) []byte

func P_logout_req

func P_logout_req(hostid int32, pkt *packet.Packet) []byte

func P_ping_req

func P_ping_req(hostid int32, reader *packet.Packet) []byte

func P_protect_req

func P_protect_req(hostid int32, pkt *packet.Packet) []byte

func P_raid_req

func P_raid_req(hostid int32, pkt *packet.Packet) []byte

func RemoveServer

func RemoveServer(hostid int32)

func Syscast

func Syscast(hostid int32, obj *IPCObject)

Types

type FORWARDIPC

type FORWARDIPC struct {
	F_IPC []byte
}

func PKT_FORWARDIPC

func PKT_FORWARDIPC(reader *packet.Packet) (tbl FORWARDIPC, err error)

type ID

type ID struct {
	F_id int32
}

func PKT_ID

func PKT_ID(reader *packet.Packet) (tbl ID, err error)

type ID_SCORE

type ID_SCORE struct {
	F_id    int32
	F_score int32
}

func PKT_ID_SCORE

func PKT_ID_SCORE(reader *packet.Packet) (tbl ID_SCORE, err error)

type INT

type INT struct {
	F_v int32
}

func PKT_INT

func PKT_INT(reader *packet.Packet) (tbl INT, err error)

type LIST

type LIST struct {
	F_items []ID_SCORE
}

func PKT_LIST

func PKT_LIST(reader *packet.Packet) (tbl LIST, err error)

type LOGIN_ACK

type LOGIN_ACK struct {
	F_success int32
}

func PKT_LOGIN_ACK

func PKT_LOGIN_ACK(reader *packet.Packet) (tbl LOGIN_ACK, err error)

type LOGIN_REQ

type LOGIN_REQ struct {
	F_id int32
}

func PKT_LOGIN_REQ

func PKT_LOGIN_REQ(reader *packet.Packet) (tbl LOGIN_REQ, err error)

type LONG

type LONG struct {
	F_v int64
}

func PKT_LONG

func PKT_LONG(reader *packet.Packet) (tbl LONG, err error)

type PROTECT

type PROTECT struct {
	F_id          int32
	F_protecttime int64
}

func PKT_PROTECT

func PKT_PROTECT(reader *packet.Packet) (tbl PROTECT, err error)

type STRING

type STRING struct {
	F_v string
}

func PKT_STRING

func PKT_STRING(reader *packet.Packet) (tbl STRING, err error)

Jump to

Keyboard shortcuts

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