forked from cooler-SAI/pandaria_5.4.8
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Core/Packets] Split SMSG_AUTH_CHALLENGE, SMSG_PONG, CMSG_PING to Aut…
…henticationPackets (#324)
- Loading branch information
Showing
5 changed files
with
159 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information | ||
* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License as published by the | ||
* Free Software Foundation; either version 2 of the License, or (at your | ||
* option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
* more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along | ||
* with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
#include "AuthenticationPackets.h" | ||
|
||
bool WorldPackets::Auth::EarlyProcessClientPacket::ReadNoThrow() | ||
{ | ||
try | ||
{ | ||
Read(); | ||
return true; | ||
} | ||
catch (ByteBufferPositionException const& /*ex*/) | ||
{ | ||
} | ||
|
||
return false; | ||
} | ||
|
||
void WorldPackets::Auth::Ping::Read() | ||
{ | ||
_worldPacket >> Latency; | ||
_worldPacket >> Serial; | ||
} | ||
|
||
WorldPacket const* WorldPackets::Auth::Pong::Write() | ||
{ | ||
_worldPacket << uint32(Serial); | ||
return &_worldPacket; | ||
} | ||
|
||
WorldPacket const* WorldPackets::Auth::AuthChallenge::Write() | ||
{ | ||
_worldPacket<< uint16(0); // header? | ||
_worldPacket.append(DosChallenge.data(), DosChallenge.size()); | ||
_worldPacket << uint8(DosZeroBits); | ||
_worldPacket.append(Challenge.data(), Challenge.size()); | ||
return &_worldPacket; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/* | ||
* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information | ||
* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License as published by the | ||
* Free Software Foundation; either version 2 of the License, or (at your | ||
* option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
* more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along | ||
* with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
#ifndef AuthenticationPacketsWorld_h__ | ||
#define AuthenticationPacketsWorld_h__ | ||
|
||
#include "Packet.h" | ||
#include "ObjectMgr.h" | ||
#include "Util.h" | ||
#include "BigNumber.h" | ||
#include <array> | ||
#include <boost/asio/ip/tcp.hpp> | ||
|
||
using boost::asio::ip::tcp; | ||
|
||
namespace WorldPackets | ||
{ | ||
namespace Auth | ||
{ | ||
class EarlyProcessClientPacket : public ClientPacket | ||
{ | ||
public: | ||
EarlyProcessClientPacket(OpcodeClient opcode, WorldPacket&& packet) : ClientPacket(opcode, std::move(packet)) { } | ||
|
||
bool ReadNoThrow(); | ||
}; | ||
|
||
class Ping final : public EarlyProcessClientPacket | ||
{ | ||
public: | ||
Ping(WorldPacket&& packet) : EarlyProcessClientPacket(CMSG_PING, std::move(packet)) { } | ||
|
||
uint32 Latency = 0; | ||
uint32 Serial = 0; | ||
|
||
private: | ||
void Read(); | ||
}; | ||
|
||
class Pong final : public ServerPacket | ||
{ | ||
public: | ||
Pong(uint32 serial) : ServerPacket(SMSG_PONG, 4), Serial(serial) { } | ||
|
||
WorldPacket const* Write() override; | ||
|
||
uint32 Serial = 0; | ||
}; | ||
|
||
class AuthChallenge final : public ServerPacket | ||
{ | ||
public: | ||
AuthChallenge() : ServerPacket(SMSG_AUTH_CHALLENGE, 32 + 4 + 1) { } | ||
|
||
WorldPacket const* Write() override; | ||
|
||
std::array<uint32, 8> DosChallenge = { }; | ||
std::array<uint8, 4> Challenge = { }; | ||
uint8 DosZeroBits = 0; | ||
}; | ||
|
||
} | ||
} | ||
|
||
#endif // AuthenticationPacketsWorld_h__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters