Module: RCONPacket
- Includes:
- SteamPacket
- Included in:
- RCONAuthRequest, RCONAuthResponse, RCONExecRequest, RCONExecResponse, RCONTerminator
- Defined in:
- lib/steam/packets/rcon/rcon_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.
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 SteamPacket
SteamPacket::A2M_GET_SERVERS_BATCH2_HEADER, SteamPacket::A2S_INFO_HEADER, SteamPacket::A2S_PLAYER_HEADER, SteamPacket::A2S_RULES_HEADER, SteamPacket::A2S_SERVERQUERY_GETCHALLENGE_HEADER, SteamPacket::C2M_CHECKMD5_HEADER, SteamPacket::M2A_SERVER_BATCH_HEADER, SteamPacket::M2C_ISVALIDMD5_HEADER, SteamPacket::M2S_REQUESTRESTART_HEADER, SteamPacket::RCON_GOLDSRC_CHALLENGE_HEADER, SteamPacket::RCON_GOLDSRC_NO_CHALLENGE_HEADER, SteamPacket::RCON_GOLDSRC_RESPONSE_HEADER, SteamPacket::S2A_INFO2_HEADER, SteamPacket::S2A_INFO_DETAILED_HEADER, SteamPacket::S2A_LOGSTRING_HEADER, SteamPacket::S2A_PLAYER_HEADER, SteamPacket::S2A_RULES_HEADER, SteamPacket::S2C_CHALLENGE_HEADER, SteamPacket::S2C_CONNREJECT_HEADER, SteamPacket::S2M_HEARTBEAT2_HEADER
Instance Attribute Summary collapse
-
#request_id ⇒ Fixnum
readonly
Returns the request ID used to identify the RCON communication.
Instance Method Summary collapse
-
#initialize(request_id, rcon_header, rcon_data) ⇒ Object
Creates a new RCON packet object with the given request ID, type and content data.
-
#to_s ⇒ String
Returns the raw data representing this packet.
Instance Attribute Details
#request_id ⇒ Fixnum (readonly)
Returns the request ID used to identify the RCON communication
35 36 37 |
# File 'lib/steam/packets/rcon/rcon_packet.rb', line 35 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
44 45 46 47 48 |
# File 'lib/steam/packets/rcon/rcon_packet.rb', line 44 def initialize(request_id, rcon_header, rcon_data) super rcon_header, "#{rcon_data}\0\0" @request_id = request_id end |
#to_s ⇒ String
Returns the raw data representing this packet
53 54 55 |
# File 'lib/steam/packets/rcon/rcon_packet.rb', line 53 def to_s [@content_data.length + 8, @request_id, @header_data, @content_data.string].pack('V3a*') end |