Class: Steam::Protocol::ProtobufMessage

Inherits:
Object
  • Object
show all
Includes:
Message
Defined in:
lib/steam/protocol/protobuf_message.rb

Overview

Represents a Protobuf message. They have a protobuf header, and body. Their emsg is masked with the PROTO_MASK flag

Direct Known Subclasses

GcProtobufMessage

Constant Summary

Constants included from Message

Message::PROTO_MASK

Instance Attribute Summary

Attributes included from Message

#body, #header, #payload

Instance Method Summary collapse

Methods included from Message

#decode, #encode

Constructor Details

#initialize(header, body, emsg) ⇒ ProtobufMessage

A Protobuf Message contains a steam id and a session id. It also uses the PROTO_MASK on the EMsg.



11
12
13
# File 'lib/steam/protocol/protobuf_message.rb', line 11

def initialize(header, body, emsg)
  super(header, body, emsg | PROTO_MASK)
end

Instance Method Details

#emsgObject

Returns the masked protobuf emsg



16
17
18
# File 'lib/steam/protocol/protobuf_message.rb', line 16

def emsg
  @emsg & ~PROTO_MASK
end

#proto?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/steam/protocol/protobuf_message.rb', line 49

def proto?
  true
end

#session_idInteger

Get the steam_id associated with this message

Returns:

  • (Integer)


31
32
33
# File 'lib/steam/protocol/protobuf_message.rb', line 31

def session_id
  @header.proto.client_sessionid
end

#session_id=(sid) ⇒ Object

The session id associated with the message

Parameters:

  • sid (String)

    the Session id



45
46
47
# File 'lib/steam/protocol/protobuf_message.rb', line 45

def session_id=(sid)
  @header.proto.client_sessionid = sid
end

#steam_idInteger

Get the steam_id associated with this message

Returns:

  • (Integer)


23
24
25
# File 'lib/steam/protocol/protobuf_message.rb', line 23

def steam_id
  @header.proto.steamid
end

#steam_id=(sid) ⇒ Object

The steam id associated with the message

Parameters:

  • sid (String)

    the Steam id



38
39
40
# File 'lib/steam/protocol/protobuf_message.rb', line 38

def steam_id=(sid)
  @header.proto.steamid = sid
end