message

package
v0.0.0-...-e2d6eb3 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2017 License: BSD-3-Clause Imports: 4 Imported by: 1

Documentation

Index

Constants

View Source
const (
	MTypeKeepAlive           byte = 0x00
	MTypeClientHello         byte = 0x01
	MTypeProtoUnsupported    byte = 0x02
	MTypeServerHelloComplete byte = 0x03
	MTypeServerHello         byte = 0x04
	MTypeClientHelloComplete byte = 0x05
	MTypeEntryAssign         byte = 0x10
	MTypeEntryUpdate         byte = 0x11
	MTypeEntryFlagUpdate     byte = 0x12
	MTypeEntryDelete         byte = 0x13
	MTypeClearAllEntries     byte = 0x14
	MTypeRPCExecute          byte = 0x20
	MTypeRPCResponse         byte = 0x21
)

Variables

View Source
var (
	//NewEntryID is the ID of an element when a client is creating a new entry.
	NewEntryID = [2]byte{0xff, 0xff}
	//NewEntrySN is the sequence number of an element when a client is creating a new entry.
	NewEntrySN = [2]byte{0x00, 0x00}
)

Functions

This section is empty.

Types

type ClearAllEntries

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

ClearAllEntries clears all entries from the network.

func NewClearAllEntries

func NewClearAllEntries() *ClearAllEntries

NewClearAllEntries creates an instance of clear all entries.

func (*ClearAllEntries) MarshalMessage

func (cae *ClearAllEntries) MarshalMessage(writer io.Writer) error

MarshalMessage implements Marshaler for Network Table Messages.

func (ClearAllEntries) Type

func (m ClearAllEntries) Type() byte

func (*ClearAllEntries) UnmarshalMessage

func (cae *ClearAllEntries) UnmarshalMessage(reader io.Reader) error

UnmarshalMessage implements Unmarshaler for Network Table Messages and assumes the message type bit has already been read.

type ClientHello

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

ClientHello is sent when a client is first communicating to a server.

func NewClientHello

func NewClientHello(protocol [2]byte, clientName string) *ClientHello

NewClientHello creates a new instance of ClientHello with the specified Protocol and Client Name.

func (*ClientHello) GetClientName

func (ch *ClientHello) GetClientName() string

GetClientName gets the name of the client from the message.

func (*ClientHello) GetProtocol

func (ch *ClientHello) GetProtocol() [2]byte

GetProtocol gets the protocol of the message.

func (*ClientHello) MarshalMessage

func (ch *ClientHello) MarshalMessage(writer io.Writer) error

MarshalMessage implements Marshaler for Network Table Messages.

func (ClientHello) Type

func (m ClientHello) Type() byte

func (*ClientHello) UnmarshalMessage

func (ch *ClientHello) UnmarshalMessage(reader io.Reader) error

UnmarshalMessage implements Unmarshaler for Network Table Messages and assumes the message type byte has already been read.

type ClientHelloComplete

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

ClientHelloComplete is sent to the server after the client finished giving the server all of its entries that does not already exist on the server.

func NewClientHelloComplete

func NewClientHelloComplete() *ClientHelloComplete

NewClientHelloComplete creates a new instance of ClientHelloComplete

func (*ClientHelloComplete) MarshalMessage

func (chc *ClientHelloComplete) MarshalMessage(writer io.Writer) error

MarshalMessage implements Marshaler for Network Table Messages.

func (ClientHelloComplete) Type

func (m ClientHelloComplete) Type() byte

func (*ClientHelloComplete) UnmarshalMessage

func (chc *ClientHelloComplete) UnmarshalMessage(reader io.Reader) error

UnmarshalMessage implements Unmarshaler for Network Table Messages and assumes the message type byte has already been read.

type EntryAssign

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

EntryAssign is used to inform others that a new entry was introduced into the network.

func NewEntryAssign

func NewEntryAssign(entryName string, entrier entryType.Entrier, persistant bool, id, sn [2]byte) *EntryAssign

NewEntryAssign creates a new instance on EntryAssign.

func (*EntryAssign) MarshalMessage

func (ea *EntryAssign) MarshalMessage(writer io.Writer) error

MarshalMessage implements Marshaler for Network Table Messages.

func (EntryAssign) Type

func (m EntryAssign) Type() byte

func (*EntryAssign) UnmarshalMessage

func (ea *EntryAssign) UnmarshalMessage(reader io.Reader) error

UnmarshalMessage implements Unmarshaler for Network Table Messages and assumes the message type byte has already been read.

type EntryDelete

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

EntryDelete is used to delete an entry from the network.

func NewEntryDelete

func NewEntryDelete(id [2]byte) *EntryDelete

NewEntryDelete creates a new instance of EntryDelete.

func (*EntryDelete) MarshalMessage

func (ed *EntryDelete) MarshalMessage(writer io.Writer) error

MarshalMessage implements Marshaler for Network Table Messages.

func (EntryDelete) Type

func (m EntryDelete) Type() byte

func (*EntryDelete) UnmarshalMessage

func (ed *EntryDelete) UnmarshalMessage(reader io.Reader) error

UnmarshalMessage implements Unmarshaler for Network Table Messages and assumes the message type byte has already been read.

type EntryFlagUpdate

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

EntryFlagUpdate is used to update the flag of an entry.

func NewEntryFlagUpdate

func NewEntryFlagUpdate(id [2]byte, persistant bool) *EntryFlagUpdate

NewEntryFlagUpdate creates a new instance of EntryFlagUpdate.

func (*EntryFlagUpdate) MarshalMessage

func (efu *EntryFlagUpdate) MarshalMessage(writer io.Writer) error

MarshalMessage implements Marshaler for Network Table Messages.

func (EntryFlagUpdate) Type

func (m EntryFlagUpdate) Type() byte

func (*EntryFlagUpdate) UnmarshalMessage

func (efu *EntryFlagUpdate) UnmarshalMessage(reader io.Reader) error

UnmarshalMessage implements Unmarshaler for Network Table Messages and assumes the message type byte has already been read.

type EntryUpdate

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

EntryUpdate is used to tell the network that an entry has been updated.

func NewEntryUpdate

func NewEntryUpdate(id, sn [2]byte, entrier entryType.Entrier) *EntryUpdate

NewEntryUpdate creates a new instance on EntryUpdate.

func (*EntryUpdate) MarshalMessage

func (eu *EntryUpdate) MarshalMessage(writer io.Writer) error

MarshalMessage implements Marshaler for Network Table Messages.

func (EntryUpdate) Type

func (m EntryUpdate) Type() byte

func (*EntryUpdate) UnmarshalMessage

func (eu *EntryUpdate) UnmarshalMessage(reader io.Reader) error

UnmarshalMessage implements Unmarshaler for Network Table Messages and assumes the message type byte has already been read.

type KeepAlive

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

KeepAlive is a message sent from clients to server to check on the network status.

func NewKeepAlive

func NewKeepAlive() *KeepAlive

NewKeepAlive creates a new KeepAlive message.

func (*KeepAlive) MarshalMessage

func (ka *KeepAlive) MarshalMessage(writer io.Writer) error

MarshalMessage implements Marshaler for Network Table Messages.

func (KeepAlive) Type

func (m KeepAlive) Type() byte

func (*KeepAlive) UnmarshalMessage

func (ka *KeepAlive) UnmarshalMessage(reader io.Reader) error

UnmarshalMessage implements Unmarshaler for Network Table Messages and assumes the message type byte has already been read.

type Marshaler

type Marshaler interface {
	MarshalMessage(io.Writer) error
}

Marshaler is the interface implemented by types that can marshal themselves into valid Network Table Message.

type Messager

type Messager interface {
	Type() byte
	Marshaler
	Unmarshaler
}

Messager is the interface implemented by types that can communicate on the network.

func Unmarshal

func Unmarshal(t byte, reader io.Reader) (Messager, error)

Unmarshal takes the type passed in and tries to unmarshal the next bytes from reader based on the type. It returns an instance messager.

type ProtoUnsupported

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

ProtoUnsupported is sent by the server to the client if the server does not support the specified protocol version.

func NewProtoUnsupported

func NewProtoUnsupported(protocol [2]byte) *ProtoUnsupported

NewProtoUnsupported creates a new instance of ProtoUnsupported.

func (*ProtoUnsupported) MarshalMessage

func (pu *ProtoUnsupported) MarshalMessage(writer io.Writer) error

MarshalMessage implements Marshaler for Network Table Messages.

func (ProtoUnsupported) Type

func (m ProtoUnsupported) Type() byte

func (*ProtoUnsupported) UnmarshalMessage

func (pu *ProtoUnsupported) UnmarshalMessage(reader io.Reader) error

UnmarshalMessage implements Unmarshaler for Network Table Messages and assumes the message type byte has already been read.

type ServerHello

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

ServerHello is a message sent from the server immediatley after it recieves the ClientHello message.

func NewServerHello

func NewServerHello(firstTime bool, serverName string) *ServerHello

NewServerHello creates a new instance of ServerHello.

func (*ServerHello) MarshalMessage

func (sh *ServerHello) MarshalMessage(writer io.Writer) error

MarshalMessage implements Marshaler for Network Table Messages.

func (ServerHello) Type

func (m ServerHello) Type() byte

func (*ServerHello) UnmarshalMessage

func (sh *ServerHello) UnmarshalMessage(reader io.Reader) error

UnmarshalMessage implements Unmarshaler for Network Table Messages and assumes the message type byte has already been read.

type ServerHelloComplete

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

ServerHelloComplete is sent from the server after it has finished telling the new client what entries the server has.

func NewServerHelloComplete

func NewServerHelloComplete() *ServerHelloComplete

NewServerHelloComplete creates a new instance of ServerHelloComplete.

func (*ServerHelloComplete) MarshalMessage

func (shc *ServerHelloComplete) MarshalMessage(writer io.Writer) error

MarshalMessage implements Marshaler for Network Table Messages.

func (ServerHelloComplete) Type

func (m ServerHelloComplete) Type() byte

func (*ServerHelloComplete) UnmarshalMessage

func (shc *ServerHelloComplete) UnmarshalMessage(reader io.Reader) error

UnmarshalMessage implements Unmarshaler for Network Table Messages and assumes the message type byte has already been read.

type Unmarshaler

type Unmarshaler interface {
	UnmarshalMessage(io.Reader) error
}

Unmarshaler is the interface implemented by types that can unmarshal a Network Table Message of themselves.

Jump to

Keyboard shortcuts

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