From 63def8aa3291d0a6e5f83b289ad12c4c8a3cebd9 Mon Sep 17 00:00:00 2001 From: Shauren Date: Tue, 6 Oct 2015 00:30:47 +0200 Subject: Core/Battle.net: * Changed packet structures to mirror client names * Simplified ToString Building * Removed deprecated structures World: Cleaned up duplicate realm info 'realm' and 'realmHandle' variables (realmHandle was removed, that data is fully contained in realm) --- .../bnetserver/Packets/ConnectionPackets.cpp | 40 +++++++++++++++------- 1 file changed, 27 insertions(+), 13 deletions(-) (limited to 'src/server/bnetserver/Packets/ConnectionPackets.cpp') diff --git a/src/server/bnetserver/Packets/ConnectionPackets.cpp b/src/server/bnetserver/Packets/ConnectionPackets.cpp index 2c23dd2fe9f..51e3954a69d 100644 --- a/src/server/bnetserver/Packets/ConnectionPackets.cpp +++ b/src/server/bnetserver/Packets/ConnectionPackets.cpp @@ -50,14 +50,16 @@ void Battlenet::Connection::LogoutRequest::CallHandler(Session* session) void Battlenet::Connection::DisconnectRequest::Read() { - Timeout = _stream.Read(16); - Tick = _stream.Read(32); + Error = _stream.Read(16); + Timeout = _stream.Read(32); } std::string Battlenet::Connection::DisconnectRequest::ToString() const { std::ostringstream str; - str << "Battlenet::Connection::DisconnectRequest Timeout: " << Timeout << ", Tick: " << Tick; + str << "Battlenet::Connection::DisconnectRequest" << std::endl; + APPEND_FIELD(str, Error); + APPEND_FIELD(str, Timeout); return str.str(); } @@ -67,11 +69,11 @@ void Battlenet::Connection::ConnectionClosing::Read() for (size_t i = 0; i < Packets.size(); ++i) { PacketInfo& info = Packets[i]; - info.CommandName = _stream.ReadFourCC(); - info.Timestamp = _stream.Read(32); + info.Command = _stream.ReadFourCC(); + info.Time = _stream.Read(32); info.Size = _stream.Read(16); - info.Channel = _stream.ReadFourCC(); - info.LayerId = _stream.Read(16); + info.Layer = _stream.ReadFourCC(); + info.Offset = _stream.Read(16); } Reason = _stream.Read(4); @@ -79,7 +81,7 @@ void Battlenet::Connection::ConnectionClosing::Read() if (_stream.Read(1)) // HasHeader { - Header.Opcode = _stream.Read(6); + Header.Command = _stream.Read(6); if (_stream.Read(1)) Header.Channel = _stream.Read(4); } @@ -87,14 +89,26 @@ void Battlenet::Connection::ConnectionClosing::Read() Now = _stream.Read(32); } -std::string Battlenet::Connection::ConnectionClosing::ToString() const +std::string Battlenet::Connection::ConnectionClosing::PacketInfo::ToString() const { std::ostringstream stream; - stream << "Battlenet::Connection::ConnectionClosing Reason: " << Reason << ", Now: " << Now << ", Packet history size: " << Packets.size(); - for (PacketInfo const& packet : Packets) - stream << std::endl << "Battlenet::Connection::ConnectionClosing::PacketInfo LayerId: " << packet.LayerId - << ", Channel: " << packet.Channel << ", CommandName: " << packet.CommandName << ", Size: " << packet.Size << ", Timestamp: " << packet.Timestamp; + stream << "Battlenet::Connection::ConnectionClosing::PacketInfo" << std::endl; + APPEND_FIELD(stream, Layer); + APPEND_FIELD(stream, Command); + APPEND_FIELD(stream, Offset); + APPEND_FIELD(stream, Size); + APPEND_FIELD(stream, Time); + return stream.str(); +} +std::string Battlenet::Connection::ConnectionClosing::ToString() const +{ + std::ostringstream stream; + stream << "Battlenet::Connection::ConnectionClosing" << std::endl; + APPEND_FIELD(stream, Header); + APPEND_FIELD(stream, Reason); + APPEND_FIELD(stream, Packets); + APPEND_FIELD(stream, Now); return stream.str(); } -- cgit v1.2.3