packet

package
v0.0.0-...-0d76806 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2014 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UTIL_BUFFER_LENGTH = 8
)

Variables

This section is empty.

Functions

func NewFullReader

func NewFullReader(reader io.Reader) (this io.Reader)

func ReadBool

func ReadBool(reader io.Reader, util []byte) (val bool, err error)

func ReadInt16

func ReadInt16(reader io.Reader, util []byte) (val int16, err error)

func ReadInt32

func ReadInt32(reader io.Reader, util []byte) (val int32, err error)

func ReadInt64

func ReadInt64(reader io.Reader, util []byte) (val int64, err error)

func ReadInt8

func ReadInt8(reader io.Reader, util []byte) (val int8, err error)

func ReadString

func ReadString(reader io.Reader, util []byte) (val string, err error)

func ReadUUID

func ReadUUID(reader io.Reader, util []byte) (result uuid.UUID, err error)

func ReadUint16

func ReadUint16(reader io.Reader, util []byte) (val uint16, err error)

func ReadUint32

func ReadUint32(reader io.Reader, util []byte) (val uint32, err error)

func ReadUint64

func ReadUint64(reader io.Reader, util []byte) (val uint64, err error)

func ReadUint8

func ReadUint8(reader io.Reader, util []byte) (val uint8, err error)

func ReadVarInt

func ReadVarInt(reader io.Reader, util []byte) (result int, err error)

func WriteBool

func WriteBool(writer io.Writer, util []byte, val bool) (err error)

func WriteInt16

func WriteInt16(writer io.Writer, util []byte, val int16) (err error)

func WriteInt32

func WriteInt32(writer io.Writer, util []byte, val int32) (err error)

func WriteInt64

func WriteInt64(writer io.Writer, util []byte, val int64) (err error)

func WriteInt8

func WriteInt8(writer io.Writer, util []byte, val int8) (err error)

func WriteString

func WriteString(writer io.Writer, util []byte, val string) (err error)

func WriteUUID

func WriteUUID(writer io.Writer, util []byte, val uuid.UUID) (err error)

func WriteUint16

func WriteUint16(writer io.Writer, util []byte, val uint16) (err error)

func WriteUint32

func WriteUint32(writer io.Writer, util []byte, val uint32) (err error)

func WriteUint64

func WriteUint64(writer io.Writer, util []byte, val uint64) (err error)

func WriteUint8

func WriteUint8(writer io.Writer, util []byte, val uint8) (err error)

func WriteVarInt

func WriteVarInt(writer io.Writer, util []byte, val int) (err error)

Types

type Packet

type Packet interface {
	Id() int
}

type PacketCodec

type PacketCodec interface {
	Decode(reader io.Reader, util []byte) (packet Packet, err error)
	Encode(writer io.Writer, util []byte, packet Packet) (err error)
}

type PacketCodecRegistry

type PacketCodecRegistry struct {
	EncodeCodecs []PacketCodec
	DecodeCodecs []PacketCodec
}

func NewPacketCodecRegistry

func NewPacketCodecRegistry(codecs []PacketCodec) (this *PacketCodecRegistry)

func NewPacketCodecRegistryDual

func NewPacketCodecRegistryDual(encodeCodecs []PacketCodec, decodeCodecs []PacketCodec) (this *PacketCodecRegistry)

func (*PacketCodecRegistry) Copy

func (this *PacketCodecRegistry) Copy() (thisCopy *PacketCodecRegistry)

func (*PacketCodecRegistry) Decode

func (this *PacketCodecRegistry) Decode(reader io.Reader, util []byte) (packet Packet, err error)

func (*PacketCodecRegistry) Encode

func (this *PacketCodecRegistry) Encode(writer io.Writer, util []byte, packet Packet) (err error)

func (*PacketCodecRegistry) Flip

func (this *PacketCodecRegistry) Flip() (thisCopy *PacketCodecRegistry)

func (*PacketCodecRegistry) SetCodec

func (this *PacketCodecRegistry) SetCodec(codec PacketCodec)

type PacketCodecVarIntLength

type PacketCodecVarIntLength struct {
	// contains filtered or unexported fields
}

func NewPacketCodecVarIntLength

func NewPacketCodecVarIntLength() (this *PacketCodecVarIntLength)

func (*PacketCodecVarIntLength) Decode

func (this *PacketCodecVarIntLength) Decode(reader io.Reader, util []byte) (packet Packet, err error)

func (*PacketCodecVarIntLength) Encode

func (this *PacketCodecVarIntLength) Encode(writer io.Writer, util []byte, packet Packet) (err error)

func (*PacketCodecVarIntLength) SetCodec

func (this *PacketCodecVarIntLength) SetCodec(codec PacketCodec)

type PacketCodecZlib

type PacketCodecZlib struct {
	// contains filtered or unexported fields
}

func NewPacketCodecZlib

func NewPacketCodecZlib(threshold int) (this *PacketCodecZlib)

func NewPacketCodecZlibLevel

func NewPacketCodecZlibLevel(threshold int, level int) (this *PacketCodecZlib)

func (*PacketCodecZlib) Decode

func (this *PacketCodecZlib) Decode(reader io.Reader, util []byte) (packet Packet, err error)

func (*PacketCodecZlib) Encode

func (this *PacketCodecZlib) Encode(writer io.Writer, util []byte, packet Packet) (err error)

func (*PacketCodecZlib) SetCodec

func (this *PacketCodecZlib) SetCodec(codec PacketCodec)

type PacketConnCodec

type PacketConnCodec struct {
	Reader io.Reader
	Writer io.Writer
	// contains filtered or unexported fields
}

func NewPacketConnCodec

func NewPacketConnCodec(conn net.Conn, packetCodec PacketCodec, timeout time.Duration) (this *PacketConnCodec)

func (*PacketConnCodec) ReadConn

func (this *PacketConnCodec) ReadConn(packetHandler PacketHandler)

func (*PacketConnCodec) Write

func (this *PacketConnCodec) Write(packet Packet) (err error)

type PacketHandler

type PacketHandler interface {
	HandlePacket(packet Packet) (err error)
	ErrorCaught(err error)
}

type PacketPipeline

type PacketPipeline struct {
	// contains filtered or unexported fields
}

func NewPacketPipeline

func NewPacketPipeline() (this *PacketPipeline)

func (*PacketPipeline) AddAfter

func (this *PacketPipeline) AddAfter(name string, subject string, child PacketPipelineChild) (err error)

func (*PacketPipeline) AddBefore

func (this *PacketPipeline) AddBefore(name string, subject string, child PacketPipelineChild) (err error)

func (*PacketPipeline) AddFirst

func (this *PacketPipeline) AddFirst(name string, child PacketPipelineChild) (err error)

func (*PacketPipeline) AddLast

func (this *PacketPipeline) AddLast(name string, child PacketPipelineChild) (err error)

func (*PacketPipeline) Decode

func (this *PacketPipeline) Decode(reader io.Reader, util []byte) (packet Packet, err error)

func (*PacketPipeline) Encode

func (this *PacketPipeline) Encode(writer io.Writer, util []byte, packet Packet) (err error)

func (*PacketPipeline) Get

func (this *PacketPipeline) Get(name string) (child PacketPipelineChild)

func (*PacketPipeline) HasName

func (this *PacketPipeline) HasName(name string) (ok bool)

func (*PacketPipeline) Remove

func (this *PacketPipeline) Remove(name string) (err error)

func (*PacketPipeline) Replace

func (this *PacketPipeline) Replace(name string, child PacketPipelineChild) (err error)

type PacketPipelineChild

type PacketPipelineChild interface {
	PacketCodec
	SetCodec(codec PacketCodec)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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