protocol

package
v3.0.0-...-97d5e6f Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2022 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

This package includes some basics for the Steam protocol. It defines basic interfaces that are used throughout go-steam: There is IMsg, which is extended by IClientMsg (sent after logging in) and abstracts over the outgoing message types. Both interfaces are implemented by ClientMsgProtobuf and ClientMsg. Msg is like ClientMsg, but it is used for sending messages before logging in.

There is also the concept of a Packet: This is a type for incoming messages where only the header is deserialized. It therefore only contains EMsg data, job information and the remaining data. Its contents can then be read via the Read* methods which read data into a MessageBody - a type which is Serializable and has an EMsg.

In addition, there are extra types for communication with the Game Coordinator (GC) included in the gamecoordinator sub-package. For outgoing messages the IGCMsg interface is used which is implemented by GCMsgProtobuf and GCMsg. Incoming messages are of the GCPacket type and are read like regular Packets.

The actual messages and enums are in the sub-packages steamlang and protobuf, generated from the SteamKit data.

Index

Constants

View Source
const DefaultAvatar = "fef49e7fa7e1997310d705b2a6158ff8dc1cdfeb"

the default details to request in most situations

Variables

This section is empty.

Functions

func ValidAvatar

func ValidAvatar(avatar []byte) bool

Types

type ClientMsg

type ClientMsg struct {
	Header  *steamlang.ExtendedClientMsgHdr
	Body    MessageBody
	Payload []byte
}

Represents a struct backed client message.

func NewClientMsg

func NewClientMsg(body MessageBody, payload []byte) *ClientMsg

func (*ClientMsg) GetMsgType

func (c *ClientMsg) GetMsgType() steamlang.EMsg

func (*ClientMsg) GetSessionId

func (c *ClientMsg) GetSessionId() int32

func (*ClientMsg) GetSourceJobId

func (c *ClientMsg) GetSourceJobId() JobId

func (*ClientMsg) GetSteamId

func (c *ClientMsg) GetSteamId() steamlang.SteamId

func (*ClientMsg) GetTargetJobId

func (c *ClientMsg) GetTargetJobId() JobId

func (*ClientMsg) IsProto

func (c *ClientMsg) IsProto() bool

func (*ClientMsg) Serialize

func (c *ClientMsg) Serialize(w io.Writer) error

func (*ClientMsg) SetSessionId

func (c *ClientMsg) SetSessionId(session int32)

func (*ClientMsg) SetSourceJobId

func (c *ClientMsg) SetSourceJobId(job JobId)

func (*ClientMsg) SetSteamId

func (c *ClientMsg) SetSteamId(s steamlang.SteamId)

func (*ClientMsg) SetTargetJobId

func (c *ClientMsg) SetTargetJobId(job JobId)

type ClientMsgProtobuf

type ClientMsgProtobuf struct {
	Header *steamlang.MsgHdrProtoBuf
	Body   proto.Message
}

Represents a protobuf backed client message with session data.

func NewClientMsgProtobuf

func NewClientMsgProtobuf(eMsg steamlang.EMsg, body proto.Message) *ClientMsgProtobuf

func (*ClientMsgProtobuf) GetMsgType

func (c *ClientMsgProtobuf) GetMsgType() steamlang.EMsg

func (*ClientMsgProtobuf) GetSessionId

func (c *ClientMsgProtobuf) GetSessionId() int32

func (*ClientMsgProtobuf) GetSourceJobId

func (c *ClientMsgProtobuf) GetSourceJobId() JobId

func (*ClientMsgProtobuf) GetSteamId

func (c *ClientMsgProtobuf) GetSteamId() steamlang.SteamId

func (*ClientMsgProtobuf) GetTargetJobId

func (c *ClientMsgProtobuf) GetTargetJobId() JobId

func (*ClientMsgProtobuf) IsProto

func (c *ClientMsgProtobuf) IsProto() bool

func (*ClientMsgProtobuf) Serialize

func (c *ClientMsgProtobuf) Serialize(w io.Writer) error

func (*ClientMsgProtobuf) SetSessionId

func (c *ClientMsgProtobuf) SetSessionId(session int32)

func (*ClientMsgProtobuf) SetSourceJobId

func (c *ClientMsgProtobuf) SetSourceJobId(job JobId)

func (*ClientMsgProtobuf) SetSteamId

func (c *ClientMsgProtobuf) SetSteamId(s steamlang.SteamId)

func (*ClientMsgProtobuf) SetTargetJobId

func (c *ClientMsgProtobuf) SetTargetJobId(job JobId)

type Deserializer

type Deserializer interface {
	Deserialize(r io.Reader) error
}

type IClientMsg

type IClientMsg interface {
	IMsg
	GetSessionId() int32
	SetSessionId(int32)
	GetSteamId() steamlang.SteamId
	SetSteamId(steamlang.SteamId)
}

Interface for client messages, i.e. messages that are sent after logging in. ClientMsgProtobuf and ClientMsg implement this.

type IMsg

type IMsg interface {
	Serializer
	IsProto() bool
	GetMsgType() steamlang.EMsg
	GetTargetJobId() JobId
	SetTargetJobId(JobId)
	GetSourceJobId() JobId
	SetSourceJobId(JobId)
}

Interface for all messages, typically outgoing. They can also be created by using the Read* methods in a PacketMsg.

type JobId

type JobId uint64

func (JobId) String

func (j JobId) String() string

type MessageBody

type MessageBody interface {
	Serializable
	GetEMsg() steamlang.EMsg
}

type Msg

type Msg struct {
	Header  *steamlang.MsgHdr
	Body    MessageBody
	Payload []byte
}

func NewMsg

func NewMsg(body MessageBody, payload []byte) *Msg

func (*Msg) GetMsgType

func (m *Msg) GetMsgType() steamlang.EMsg

func (*Msg) GetSourceJobId

func (m *Msg) GetSourceJobId() JobId

func (*Msg) GetTargetJobId

func (m *Msg) GetTargetJobId() JobId

func (*Msg) IsProto

func (m *Msg) IsProto() bool

func (*Msg) Serialize

func (m *Msg) Serialize(w io.Writer) error

func (*Msg) SetSourceJobId

func (m *Msg) SetSourceJobId(job JobId)

func (*Msg) SetTargetJobId

func (m *Msg) SetTargetJobId(job JobId)

type Packet

type Packet struct {
	EMsg        steamlang.EMsg
	IsProto     bool
	TargetJobId JobId
	SourceJobId JobId
	Data        []byte
}

Represents an incoming, partially unread message.

func NewPacket

func NewPacket(data []byte) (*Packet, error)

func (*Packet) ReadClientMsg

func (p *Packet) ReadClientMsg(body MessageBody) *ClientMsg

func (*Packet) ReadMsg

func (p *Packet) ReadMsg(body MessageBody) *Msg

func (*Packet) ReadProtoMsg

func (p *Packet) ReadProtoMsg(body proto.Message) *ClientMsgProtobuf

func (*Packet) String

func (p *Packet) String() string

type Serializable

type Serializable interface {
	Serializer
	Deserializer
}

type Serializer

type Serializer interface {
	Serialize(w io.Writer) error
}

Directories

Path Synopsis
Contains code generated from SteamKit's SteamLanguage data.
Contains code generated from SteamKit's SteamLanguage data.

Jump to

Keyboard shortcuts

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