messages

package
v0.0.0-...-b0d4320 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2016 License: MIT Imports: 4 Imported by: 3

Documentation

Index

Constants

View Source
const (
	TypeRequestAlias uint8 = 1 + iota
	TypeAliasApproved
	TypeAliasDenied
	TypeRequestGameList
	TypeGameList
	TypeCreateGame
	TypeCreateGameApproved
	TypeCreateGameDenied
	TypeJoinGame
	TypeJoinGameDenied
	TypeLeaveGame
	TypeStartGame
	TypeStateUpdate
	TypeGameOver
	TypeMove
)

Message Types

View Source
const (
	// NullTerm represents a null terminator byte for comparrison reasons
	NullTerm byte = 0
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AliasApprovedMessage

type AliasApprovedMessage struct {
	MessageType uint8
}

AliasApprovedMessage is the struct which describes an Alias approved message

func NewAliasApprovedMessage

func NewAliasApprovedMessage() AliasApprovedMessage

NewAliasApprovedMessage returns an instance of AliasApprovedMessage

func NewAliasApprovedMessageFromBytes

func NewAliasApprovedMessageFromBytes(messageBytes []byte) AliasApprovedMessage

NewAliasApprovedMessageFromBytes returns an instance of AliasApprovedMessage Based on a given slice of bytes

func (*AliasApprovedMessage) Bytes

func (ms *AliasApprovedMessage) Bytes() []byte

Bytes returns a slice of bytes representing an AliasApprovedMessage which can be sent through a connection

type AliasDeniedMessage

type AliasDeniedMessage struct {
	MessageType uint8
	Reason      string
}

AliasDeniedMessage is the struct which represents an Alias denied message

func NewAliasDeniedMessage

func NewAliasDeniedMessage(reason string) AliasDeniedMessage

NewAliasDeniedMessage returns an instance of AliasDeniedMessage based on params

func NewAliasDeniedMessageFromBytes

func NewAliasDeniedMessageFromBytes(messageBytes []byte) AliasDeniedMessage

NewAliasDeniedMessageFromBytes returns an instance of AliasDeniedMessage based on a slice of bytes

func (*AliasDeniedMessage) Bytes

func (ms *AliasDeniedMessage) Bytes() []byte

Bytes returns a slice of bytes representing an AliasDeniedMessage which can be sent through a connection

type CreateGameApprovedMessage

type CreateGameApprovedMessage struct {
	MessageType uint8
	GameID      string
	GameName    string
}

CreateGameApprovedMessage is a structure representing a Create game approved message

func NewCreateGameApprovedMessage

func NewCreateGameApprovedMessage(gameID, gameName string) CreateGameApprovedMessage

NewCreateGameApprovedMessage returns an instance of CreateGameApprovedMessage from params

func NewCreateGameApprovedMessageFromBytes

func NewCreateGameApprovedMessageFromBytes(messageBytes []byte) CreateGameApprovedMessage

NewCreateGameApprovedMessageFromBytes returns an instance of CreateGameApprovedMessage from a slice of bytes

func (*CreateGameApprovedMessage) Bytes

func (ms *CreateGameApprovedMessage) Bytes() []byte

Bytes returns a slice of bytes representing a CreateGameApprovedMessage which can be sent through a connection

type CreateGameDeniedMessage

type CreateGameDeniedMessage struct {
	MessageType uint8
	GameName    string
	Reason      string
}

CreateGameDeniedMessage is a structure representing a Create game denied message

func NewCreateGameDeniedMessage

func NewCreateGameDeniedMessage(gameName, reason string) CreateGameDeniedMessage

NewCreateGameDeniedMessage returns an instance of CreateGameDeniedMessage from params

func NewCreateGameDeniedMessageFromBytes

func NewCreateGameDeniedMessageFromBytes(messageBytes []byte) CreateGameDeniedMessage

NewCreateGameDeniedMessageFromBytes returns an instance of CreateGameDeniedMessage from a slice of bytes

func (*CreateGameDeniedMessage) Bytes

func (ms *CreateGameDeniedMessage) Bytes() []byte

Bytes returns a slice of bytes representing an CreateGameDeniedMessage which can be sent through a connection

type CreateGameMessage

type CreateGameMessage struct {
	MessageType uint8
	GameName    string
}

CreateGameMessage is a structure representing a Create game message

func NewCreateGameMessage

func NewCreateGameMessage(gameName string) CreateGameMessage

NewCreateGameMessage returns an instance of CreateGameMessage based on params

func NewCreateGameMessageFromBytes

func NewCreateGameMessageFromBytes(messageBytes []byte) CreateGameMessage

NewCreateGameMessageFromBytes returns an instance of CreateGameMessage based on a slice of bytes

func (*CreateGameMessage) Bytes

func (ms *CreateGameMessage) Bytes() []byte

Bytes returns a slice of bytes representing a CreateGameMessage which can be sent through a connection

type GameOverMessage

type GameOverMessage struct {
	MessageType uint8
	Yscore      uint8
	Oscore      uint8
	Status      uint8
}

GameOverMessage is the struct which represents an Game over message

func NewGameOverMessage

func NewGameOverMessage(ysc, osc, stat uint8) GameOverMessage

NewGameOverMessage returns an instance of GameOverMessage based on params

func NewGameOverMessageFromBytes

func NewGameOverMessageFromBytes(messageBytes []byte) GameOverMessage

NewGameOverMessageFromBytes returns an instance of GameOverMessage based on a slice of bytes

func (*GameOverMessage) Bytes

func (ms *GameOverMessage) Bytes() []byte

Bytes returns a slice of bytes representing an GameOverMessage which can be sent through a connection

type JoinGameDeniedMessage

type JoinGameDeniedMessage struct {
	MessageType uint8
	Reason      string
}

JoinGameDeniedMessage is the struct which represents an Alias denied message

func NewJoinGameDeniedMessage

func NewJoinGameDeniedMessage(reason string) JoinGameDeniedMessage

NewJoinGameDeniedMessage returns an instance of JoinGameDeniedMessage based on params

func NewJoinGameDeniedMessageFromBytes

func NewJoinGameDeniedMessageFromBytes(messageBytes []byte) JoinGameDeniedMessage

NewJoinGameDeniedMessageFromBytes returns an instance of JoinGameDeniedMessage based on a slice of bytes

func (*JoinGameDeniedMessage) Bytes

func (ms *JoinGameDeniedMessage) Bytes() []byte

Bytes returns a slice of bytes representing an AliasDeniedMessage which can be sent through a connection

type JoinGameMessage

type JoinGameMessage struct {
	MessageType uint8
	GameID      string
}

JoinGameMessage is a structure representing a Join game message

func NewJoinGameMessage

func NewJoinGameMessage(gameID string) JoinGameMessage

NewJoinGameMessage returns an instance of JoinGameMessage based on params

func NewJoinGameMessageFromBytes

func NewJoinGameMessageFromBytes(messageBytes []byte) JoinGameMessage

NewJoinGameMessageFromBytes returns an instance of JoinGameMessage from a slice of bytes

func (*JoinGameMessage) Bytes

func (ms *JoinGameMessage) Bytes() []byte

Bytes returns a slice of bytes representing an JoinGameMessage which can be sent through a connection

type LeaveGameMessage

type LeaveGameMessage struct {
	MessageType uint8
}

LeaveGameMessage is a structure representing a Leave game message

func NewLeaveGameMessage

func NewLeaveGameMessage() LeaveGameMessage

NewLeaveGameMessage returns an instance of LeaveGameMessage

func NewLeaveGameMessageFromBytes

func NewLeaveGameMessageFromBytes(messageBytes []byte) LeaveGameMessage

NewLeaveGameMessageFromBytes returns an instance of LeaveGameMessage from a slice of bytes

func (*LeaveGameMessage) Bytes

func (ms *LeaveGameMessage) Bytes() []byte

Bytes returns a slice of bytes representing a LeaveGameMessage which can be sent through a connection

type MoveMessage

type MoveMessage struct {
	MessageType uint8
	Position    uint16
}

MoveMessage is the struct which represents an Alias denied message

func NewMoveMessage

func NewMoveMessage(pos uint16) MoveMessage

NewMoveMessage returns an instance of MoveMessage based on params

func NewMoveMessageFromBytes

func NewMoveMessageFromBytes(messageBytes []byte) MoveMessage

NewMoveMessageFromBytes returns an instance of MoveMessage based on a slice of bytes

func (*MoveMessage) Bytes

func (ms *MoveMessage) Bytes() []byte

Bytes returns a slice of bytes representing an MoveMessage which can be sent through a connection

type RequestAliasMessage

type RequestAliasMessage struct {
	MessageType uint8
	Alias       string
}

RequestAliasMessage is a structure representing a Request alias message

func NewRequestAliasMessage

func NewRequestAliasMessage(alias string) RequestAliasMessage

NewRequestAliasMessage returns an instance of RequestAliasMessage based on params

func NewRequestAliasMessageFromBytes

func NewRequestAliasMessageFromBytes(messageBytes []byte) RequestAliasMessage

NewRequestAliasMessageFromBytes returns an instance of RequestAliasMessage from a slice of bytes

func (*RequestAliasMessage) Bytes

func (ms *RequestAliasMessage) Bytes() []byte

Bytes returns a slice of bytes representing a RequestAliasMessage which can be sent through a connection

type RequestGameListMessage

type RequestGameListMessage struct {
	MessageType uint8
}

RequestGameListMessage is a structure representing a Request game list message

func NewRequestGameListMessage

func NewRequestGameListMessage() RequestGameListMessage

NewRequestGameListMessage returns an instance of RequestGameListMessage

func NewRequestGameListMessageFromBytes

func NewRequestGameListMessageFromBytes(messageBytes []byte) RequestGameListMessage

NewRequestGameListMessageFromBytes returns an instance of RequestGameListMessage based on a slice of bytes

func (*RequestGameListMessage) Bytes

func (ms *RequestGameListMessage) Bytes() []byte

Bytes returns a slice of bytes representing a RequestGameListMessage which can be sent through a connection

type StartGameMessage

type StartGameMessage struct {
	MessageType   uint8
	YourSide      bool
	YourPosition  uint16
	OtherPosition uint16
	Ballx         uint16
	Bally         uint16
	OtherAlias    string
	GameID        string
	GameName      string
}

StartGameMessage is a structure representing a start game message

func NewStartGameMessage

func NewStartGameMessage(side bool, yPos, oPos, ballx, bally uint16, oAlias, gID, gName string) StartGameMessage

NewStartGameMessage returns an instance of StartGameMessage based on params

func NewStartGameMessageFromBytes

func NewStartGameMessageFromBytes(messageBytes []byte) StartGameMessage

NewStartGameMessageFromBytes returns an instance of StartGameMessage from a slice of bytes

func (*StartGameMessage) Bytes

func (ms *StartGameMessage) Bytes() []byte

Bytes returns a slice of bytes representing an StartGameMessage which can be sent through a connection

Jump to

Keyboard shortcuts

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