Documentation ¶
Index ¶
- Constants
- Variables
- func FlagGet(value uint8, flag uint8) bool
- func FlagSet(value uint8, flag uint8) uint8
- func FlagUnset(value uint8, flag uint8) uint8
- func GetCmd(CmdID uint32) (mainCmdID, subCmdID uint16)
- func MakeDWORD(mainCmdID uint16, subCmdID uint16) uint32
- type MsgHandler
- type MsgInfo
- type MsgRaw
- type Processor
- func (p *Processor) Cmd2Bytes(mainCmdID uint16, subCmdID uint16) []byte
- func (p *Processor) Marshal(recv *RecvMsg, mainCmdID uint16, subCmdID uint16, msg interface{}) ([][]byte, error)
- func (p *Processor) MarshalBody(msg interface{}) ([]byte, error)
- func (p *Processor) MarshalCmd(recv *RecvMsg, mainCmdID uint16, subCmdID uint16) ([]byte, error)
- func (p *Processor) Range(f func(id uint16, t reflect.Type))
- func (p *Processor) Register(mainCmdID uint16, subCmdID uint16, msg interface{}) uint32
- func (p *Processor) Route(msg *RecvMsg, userData interface{}) error
- func (p *Processor) SetByteOrder(littleEndian bool)
- func (p *Processor) SetHandler(mainCmdID uint16, subCmdID uint16, msgHandler MsgHandler)
- func (p *Processor) SetRawHandler(mainCmdID uint16, subCmdID uint16, msgRawHandler MsgHandler)
- func (p *Processor) SetRouter(mainCmdID uint16, subCmdID uint16, msgRouter *chanrpc.Server)
- func (p *Processor) Unmarshal(data []byte) (*RecvMsg, error)
- func (p *Processor) UnmarshalBody(mainCmdID uint16, subCmdID uint16, data []byte) (interface{}, error)
- type RecvMsg
Constants ¶
View Source
const ( MSG_TYPE_NONE uint8 = 0 // 默认的一般消息类型 MSG_TYPE_RPC uint8 = 0x01 // rpc )
Variables ¶
View Source
var DefaultRecvMsg = &RecvMsg{0, 0, nil, MSG_TYPE_NONE}
Functions ¶
Types ¶
type MsgHandler ¶
type MsgHandler func([]interface{})
type Processor ¶
type Processor struct {
// contains filtered or unexported fields
}
------------------------- | id | protobuf message | -------------------------
func NewProcessor ¶
func NewProcessor() *Processor
func (*Processor) Marshal ¶
func (p *Processor) Marshal(recv *RecvMsg, mainCmdID uint16, subCmdID uint16, msg interface{}) ([][]byte, error)
goroutine safe
func (*Processor) MarshalBody ¶
func (*Processor) MarshalCmd ¶
func (*Processor) Register ¶
It's dangerous to call the method on routing or marshaling (unmarshaling)
func (*Processor) SetByteOrder ¶
It's dangerous to call the method on routing or marshaling (unmarshaling)
func (*Processor) SetHandler ¶
func (p *Processor) SetHandler(mainCmdID uint16, subCmdID uint16, msgHandler MsgHandler)
It's dangerous to call the method on routing or marshaling (unmarshaling)
func (*Processor) SetRawHandler ¶
func (p *Processor) SetRawHandler(mainCmdID uint16, subCmdID uint16, msgRawHandler MsgHandler)
It's dangerous to call the method on routing or marshaling (unmarshaling)
func (*Processor) SetRouter ¶
It's dangerous to call the method on routing or marshaling (unmarshaling)
Click to show internal directories.
Click to hide internal directories.