23 lines
550 B
Go
23 lines
550 B
Go
package protocol
|
|
|
|
type RpcPacketKind byte
|
|
|
|
const (
|
|
PacketKindUnknown RpcPacketKind = 0x00
|
|
PacketKindInvoke RpcPacketKind = 0x01
|
|
PacketKindReturn RpcPacketKind = 0x02
|
|
PacketKindNotify RpcPacketKind = 0x03
|
|
)
|
|
|
|
type RpcPacket struct {
|
|
Kind RpcPacketKind
|
|
MethodID uint32
|
|
InvokeID int32
|
|
Error int32
|
|
Body []byte
|
|
}
|
|
|
|
func (p RpcPacket) IsInvoke() bool { return p.Kind == PacketKindInvoke }
|
|
func (p RpcPacket) IsNotify() bool { return p.Kind == PacketKindNotify }
|
|
func (p RpcPacket) IsReturn() bool { return p.Kind == PacketKindReturn }
|