Module: SteamCondenser::Servers::Packets::BasePacket

Overview

This module implements the basic functionality used by most of the packets used in communication with master, Source or GoldSrc servers.

See Also:

Author:

  • Sebastian Staudt

Constant Summary collapse

A2M_GET_SERVERS_BATCH2_HEADER =
0x31
A2S_INFO_HEADER =
0x54
A2S_PLAYER_HEADER =
0x55
A2S_RULES_HEADER =
0x56
A2S_SERVERQUERY_GETCHALLENGE_HEADER =
0x57
C2M_CHECKMD5_HEADER =
0x4D
M2A_SERVER_BATCH_HEADER =
0x66
RCON_GOLDSRC_CHALLENGE_HEADER =
0x63
RCON_GOLDSRC_NO_CHALLENGE_HEADER =
0x39
RCON_GOLDSRC_RESPONSE_HEADER =
0x6c
S2A_INFO_DETAILED_HEADER =
0x6D
S2A_INFO2_HEADER =
0x49
S2A_PLAYER_HEADER =
0x44
S2A_RULES_HEADER =
0x45
S2C_CONNREJECT_HEADER =
0x39
S2C_CHALLENGE_HEADER =
0x41

Instance Method Summary collapse

Instance Method Details

#initialize(header_data, content_data = '') ⇒ Object

Creates a new packet object based on the given data

Parameters:

  • header_data (Fixnum)

    The packet header

  • content_data (String) (defaults to: '')

    The raw data of the packet


40
41
42
43
# File 'lib/steam-condenser/servers/packets/base_packet.rb', line 40

def initialize(header_data, content_data = '')
  @content_data = StringIO.new content_data.to_s
  @header_data  = header_data
end

#to_sString

Returns the raw data representing this packet

Returns:

  • (String)

    A string containing the raw data of this request packet


48
49
50
# File 'lib/steam-condenser/servers/packets/base_packet.rb', line 48

def to_s
  [0xFF, 0xFF, 0xFF, 0xFF, @header_data, @content_data.string].pack('c5a*')
end