signal

package
v0.0.0-...-9987061 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2017 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package signal is a generated protocol buffer package.

It is generated from these files:

signal.proto

It has these top-level messages:

Signal
Header

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

type Engine interface {
	RegisterSignal(signalCode uint32, handler Handler) error
	AddListen(name string, listen netx.ContextListen)
	Connection(addr *net.TCPAddr) error
	Bind(addr *net.TCPAddr) (netx.Server, error)
	Close()
	GetBootStrap() netx.Bootstrap
}

Engine 信令处理引擎

func NewSignalBootstrap

func NewSignalBootstrap(config *netx.Config, netSetting func(conn net.Conn), compressProtocol netx.Protocol, listens map[string]netx.ContextListen) Engine

NewSignalBootstrap create a signal bootstrap

type Handler

type Handler interface {
	//处理信令
	Handle(context netx.ConnContext, signal *Signal)
}

Handler 信令处理接口

type Header struct {
	// 头定义
	Key string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"`
	// 值
	Value string `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"`
}

Header 信令头定义

func (*Header) Descriptor

func (*Header) Descriptor() ([]byte, []int)

func (*Header) GetKey

func (m *Header) GetKey() string

func (*Header) GetValue

func (m *Header) GetValue() string

func (*Header) ProtoMessage

func (*Header) ProtoMessage()

func (*Header) Reset

func (m *Header) Reset()

func (*Header) String

func (m *Header) String() string

type Signal

type Signal struct {
	// 信令值,uint32
	Signal uint32 `protobuf:"varint,1,opt,name=signal" json:"signal,omitempty"`
	// 序列号
	Sequence int64 `protobuf:"varint,2,opt,name=sequence" json:"sequence,omitempty"`
	// 版本号
	Version uint32 `protobuf:"varint,3,opt,name=version" json:"version,omitempty"`
	// 信令头扩展
	Headers *Header `protobuf:"bytes,4,opt,name=headers" json:"headers,omitempty"`
	// 信令内容
	Data []byte `protobuf:"bytes,5,opt,name=data,proto3" json:"data,omitempty"`
}

Signal 信令结构定义

func NewSimpleSignal

func NewSimpleSignal(signal uint32, data []byte) *Signal

NewSimpleSignal 创建一个低级别的 Signal

func (*Signal) Descriptor

func (*Signal) Descriptor() ([]byte, []int)

func (*Signal) GetData

func (m *Signal) GetData() []byte

func (*Signal) GetHeaders

func (m *Signal) GetHeaders() *Header

func (*Signal) GetSequence

func (m *Signal) GetSequence() int64

func (*Signal) GetSignal

func (m *Signal) GetSignal() uint32

func (*Signal) GetVersion

func (m *Signal) GetVersion() uint32

func (*Signal) ProtoMessage

func (*Signal) ProtoMessage()

func (*Signal) Reset

func (m *Signal) Reset()

func (*Signal) String

func (m *Signal) String() string

Jump to

Keyboard shortcuts

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