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

Includes:
BasePacket
Included in:
RCONAuthRequest, RCONAuthResponse, RCONExecRequest, RCONExecResponse, RCONTerminator
Defined in:
lib/steam-condenser/servers/packets/rcon/base_packet.rb

Overview

This module is included by all classes representing a packet used by Source's RCON protocol

It provides a basic implementation for initializing and serializing such a packet.

See Also:

Author:

  • Sebastian Staudt

Constant Summary collapse

SERVERDATA_AUTH =

Header for authentication requests

3
SERVERDATA_AUTH_RESPONSE =

Header for replies to authentication attempts

2
SERVERDATA_EXECCOMMAND =

Header for command execution requests

2
SERVERDATA_RESPONSE_VALUE =

Header for packets with the output of a command execution

0

Constants included from BasePacket

BasePacket::A2M_GET_SERVERS_BATCH2_HEADER, BasePacket::A2S_INFO_HEADER, BasePacket::A2S_PLAYER_HEADER, BasePacket::A2S_RULES_HEADER, BasePacket::A2S_SERVERQUERY_GETCHALLENGE_HEADER, BasePacket::C2M_CHECKMD5_HEADER, BasePacket::M2A_SERVER_BATCH_HEADER, BasePacket::RCON_GOLDSRC_CHALLENGE_HEADER, BasePacket::RCON_GOLDSRC_NO_CHALLENGE_HEADER, BasePacket::RCON_GOLDSRC_RESPONSE_HEADER, BasePacket::S2A_INFO2_HEADER, BasePacket::S2A_INFO_DETAILED_HEADER, BasePacket::S2A_PLAYER_HEADER, BasePacket::S2A_RULES_HEADER, BasePacket::S2C_CHALLENGE_HEADER, BasePacket::S2C_CONNREJECT_HEADER

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#request_idFixnum (readonly)

Returns the request ID used to identify the RCON communication


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

def request_id
  @request_id
end

Instance Method Details

#initialize(request_id, rcon_header, rcon_data) ⇒ Object

Creates a new RCON packet object with the given request ID, type and content data


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

def initialize(request_id, rcon_header, rcon_data)
  super rcon_header, "#{rcon_data}\0\0"

  @request_id = request_id
end

#to_sString

Returns the raw data representing this packet


57
58
59
# File 'lib/steam-condenser/servers/packets/rcon/base_packet.rb', line 57

def to_s
  [@content_data.length + 8, @request_id, @header_data, @content_data.string].pack('V3a*')
end