Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ByteLenOfCSPacketBody ¶
func ByteLenOfCSPacketHeader ¶
func ByteLenOfCSPacketHeader() int
func ByteLenOfSSPacketHeader ¶
func ByteLenOfSSPacketHeader() int
Types ¶
type CSPacket ¶
type CSPacket struct { Header CSPacketHeader Body []byte }
type CSPacketHeader ¶
type CSPacketHeader struct { Version uint16 PassCode uint16 Seq uint32 Uid uint64 AppVersion uint32 Cmd uint32 BodyLen uint32 }
注意这里的排列是考虑了内存对齐的情况,调整时请注意。
func (*CSPacketHeader) From ¶
func (h *CSPacketHeader) From(b []byte)
func (*CSPacketHeader) To ¶
func (h *CSPacketHeader) To(b []byte)
func (*CSPacketHeader) ToBytes ¶
func (h *CSPacketHeader) ToBytes() []byte
type SSPacket ¶
type SSPacket struct { Header SSPacketHeader Body []byte }
type SSPacketHeader ¶
type SSPacketHeader struct { SrcBusID uint32 DstBusID uint32 SrcTransID uint32 DstTransID uint32 Uid uint64 Cmd uint32 Zone uint32 Ip uint32 Flag uint32 BodyLen uint32 CmdSeq uint16 // Request时+1,Response时不变。用以标识收到的Response是对应哪个发出的Request }
经过测试,结构体是以8字节为单位对齐的,要注意一下
func (*SSPacketHeader) From ¶
func (h *SSPacketHeader) From(b []byte) error
func (*SSPacketHeader) To ¶
func (h *SSPacketHeader) To(b []byte) error
func (*SSPacketHeader) ToBytes ¶
func (h *SSPacketHeader) ToBytes() []byte
Click to show internal directories.
Click to hide internal directories.