Module: SteamPacketFactory
- Included in:
- RCONPacketFactory
- Defined in:
- lib/steam/packets/steam_packet_factory.rb
Class Method Summary collapse
-
.packet_from_data(raw_data) ⇒ Object
Creates a new packet object based on the header byte of the given raw data.
- .reassemble_packet(split_packets, is_compressed = false, packet_checksum = 0) ⇒ Object
Class Method Details
.packet_from_data(raw_data) ⇒ Object
Creates a new packet object based on the header byte of the given raw data
.reassemble_packet(split_packets, is_compressed = false, packet_checksum = 0) ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/steam/packets/steam_packet_factory.rb', line 67 def self.reassemble_packet(split_packets, is_compressed = false, packet_checksum = 0) packet_data = split_packets.join '' if is_compressed begin require 'bz2' packet_data = BZ2.uncompress(packet_data) rescue LoadError raise SteamCondenserException.new('You need to install the libbzip2 interface for Ruby.') end unless Zlib.crc32(packet_data) == packet_checksum raise PacketFormatException.new('CRC32 checksum mismatch of uncompressed packet data.') end end packet_from_data packet_data[4..-1] end |