interfaces

package
v0.0.0-...-9421834 Latest Latest
Warning

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

Go to latest
Published: May 26, 2020 License: MIT Imports: 0 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IHandleMgr

type IHandleMgr interface {
	StartPool()
	StopPool()
	AddRouter(id uint32, router RouterCallback)
	SendToHandler(request IRequest)
}

type IHead

type IHead interface {
	Marshal() []byte
	UnMarshal(buf []byte) error
	Check() error
	GetHeadLen() uint32
	SetHeadLen(uint32)
	GetBodyLen() uint32
	SetBodyLen(uint32)
	PreHandle(buf []byte) ([]byte, error)
	PreSend(buf []byte) ([]byte, error)
	GetOpcode() uint32
	SetOpcode(uint32)
}

type IRequest

type IRequest interface {
	GetSessionID() string
	GetOpcode() uint32
	GetMsg() []byte
}

type IServer

type IServer interface {
	Stop()
	Serve()
	RegisterRouter(opcode uint32, router RouterCallback)
	Push(sid string, opcode uint32, msg []byte)
	RegisterOnConnect(connect NotifyCallback)
	RegisterOnDisConnect(disconnect NotifyCallback)
	CallOnConnect(sid string)
	CallOnDisConnect(sid string)
	GetHandleMgr() IHandleMgr
	GetSessionMgr() ISessionMgr
}

type ISession

type ISession interface {
	Start()
	Stop()
	GetSessionID() string
	PushMsg(opcode uint32, msg []byte)
	GetRemoteAddr() string
}

type ISessionMgr

type ISessionMgr interface {
	Size() uint32
	Len() uint32
	GetSession(sid string) ISession
	Add(s ISession)
	Remove(sid string)
	RemoveAll()
	Start()
	Stop()
}

type NotifyCallback

type NotifyCallback func(session ISession)

type RouterCallback

type RouterCallback func(request IRequest) (opcode uint32, msg []byte)

Jump to

Keyboard shortcuts

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