aboutsummaryrefslogtreecommitdiff
path: root/src/server/bnetserver/Packets/AuthenticationPackets.h
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2014-10-18 17:03:30 +0200
committerShauren <shauren.trinity@gmail.com>2014-10-18 17:03:30 +0200
commit8936723291985d1759a4903901c7a29cc54fdcbf (patch)
tree2ca2331742863ef6318697075aad5ff3f8e76715 /src/server/bnetserver/Packets/AuthenticationPackets.h
parent3ee9961ecce2a745134eeefa45b29109a276e49f (diff)
parent4a0be2bffc21e30624122ec5f36d6c8479f83385 (diff)
Merge branch '4.3.4' of https://github.com/TrinityCore/TrinityCore into 6.x
Conflicts: dep/PackageList.txt src/server/bnetserver/Packets/WoWRealmPackets.cpp src/server/bnetserver/Server/Session.cpp
Diffstat (limited to 'src/server/bnetserver/Packets/AuthenticationPackets.h')
-rw-r--r--src/server/bnetserver/Packets/AuthenticationPackets.h203
1 files changed, 203 insertions, 0 deletions
diff --git a/src/server/bnetserver/Packets/AuthenticationPackets.h b/src/server/bnetserver/Packets/AuthenticationPackets.h
new file mode 100644
index 00000000000..bcaa0e72011
--- /dev/null
+++ b/src/server/bnetserver/Packets/AuthenticationPackets.h
@@ -0,0 +1,203 @@
+/*
+ * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
+ *
+ * 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 AuthenticationPackets_h__
+#define AuthenticationPackets_h__
+
+#include "PacketsBase.h"
+#include "ComponentManager.h"
+#include "ModuleManager.h"
+
+namespace Battlenet
+{
+ namespace Authentication
+ {
+ enum Opcode
+ {
+ CMSG_LOGON_REQUEST = 0x0, // Deprecated
+ CMSG_RESUME_REQUEST = 0x1,
+ CMSG_PROOF_RESPONSE = 0x2,
+ CMSG_GENERATE_SINGLE_SIGN_ON_TOKEN_REQUEST_2 = 0x8, // Not implemented
+ CMSG_LOGON_REQUEST_3 = 0x9,
+ CMSG_SINGLE_SIGN_ON_REQUEST_3 = 0xA, // Not implemented
+
+ SMSG_LOGON_RESPONSE = 0x0,
+ SMSG_RESUME_RESPONSE = 0x1,
+ SMSG_PROOF_REQUEST = 0x2,
+ SMSG_PATCH = 0x3, // Not implemented
+ SMSG_AUTHORIZED_LICENSES = 0x4, // Not implemented
+ SMSG_GENERATE_SINGLE_SIGN_ON_TOKEN_REQUEST_2 = 0x8 // Not implemented
+ };
+
+ class ResumeRequest final : public ClientPacket
+ {
+ public:
+ ResumeRequest(PacketHeader const& header, BitStream& stream) : ClientPacket(header, stream)
+ {
+ ASSERT(header == PacketHeader(CMSG_RESUME_REQUEST, AUTHENTICATION) && "Invalid packet header for ResumeRequest");
+ }
+
+ void Read() override;
+ std::string ToString() const override;
+ void CallHandler(Session* session) override;
+
+ std::string Program;
+ std::string Platform;
+ std::string Locale;
+ std::vector<Component> Components;
+ std::string Login;
+ uint8 Region;
+ std::string GameAccountName;
+ };
+
+ class ProofResponse final : public ClientPacket
+ {
+ public:
+ ProofResponse(PacketHeader const& header, BitStream& stream) : ClientPacket(header, stream)
+ {
+ ASSERT(header == PacketHeader(CMSG_PROOF_RESPONSE, AUTHENTICATION) && "Invalid packet header for ProofResponse");
+ }
+
+ ~ProofResponse();
+
+ void Read() override;
+ std::string ToString() const override;
+ void CallHandler(Session* session) override;
+
+ std::vector<BitStream*> Modules;
+ };
+
+ class LogonRequest3 final : public ClientPacket
+ {
+ public:
+ LogonRequest3(PacketHeader const& header, BitStream& stream) : ClientPacket(header, stream)
+ {
+ ASSERT(header == PacketHeader(CMSG_LOGON_REQUEST_3, AUTHENTICATION) && "Invalid packet header for LogonRequest3");
+ }
+
+ void Read() override;
+ std::string ToString() const override;
+ void CallHandler(Session* session) override;
+
+ std::string Program;
+ std::string Platform;
+ std::string Locale;
+ std::vector<Component> Components;
+ std::string Login;
+ uint64 Compatibility;
+ };
+
+ class ResponseFailure
+ {
+ public:
+ enum Result
+ {
+ UPDATE = 0,
+ FAILURE = 1,
+ VERSION_CHECK_DISCONNECT = 2
+ };
+
+ ResponseFailure() : ResultValue(UPDATE), Error(AUTH_OK), Wait(0) { }
+
+ Result ResultValue;
+ AuthResult Error;
+ int32 Wait;
+ };
+
+ class Regulator
+ {
+ public:
+ enum Info
+ {
+ NONE = 0,
+ LEAKY_BUCKET = 1
+ };
+
+ Regulator() : Type(LEAKY_BUCKET), Threshold(25000000), Rate(1000) { }
+
+ Info Type;
+ uint32 Threshold;
+ uint32 Rate;
+ };
+
+ class LogonResponse final : public ServerPacket
+ {
+ public:
+ LogonResponse() : ServerPacket(PacketHeader(SMSG_LOGON_RESPONSE, AUTHENTICATION)),
+ PingTimeout(120000), FirstName(""), LastName(""), AccountId(0), Region(2), Flags(0),
+ GameAccountRegion(2), GameAccountName(""), FailedLogins(0)
+ {
+ }
+
+ ~LogonResponse();
+
+ void Write() override;
+ std::string ToString() const override;
+
+ std::vector<ModuleInfo*> Modules;
+ void SetAuthResult(AuthResult result);
+ ResponseFailure Result;
+
+ int32 PingTimeout;
+ Regulator RegulatorRules;
+ std::string FirstName;
+ std::string LastName;
+ uint32 AccountId;
+ uint8 Region;
+ uint64 Flags;
+ uint8 GameAccountRegion;
+ std::string GameAccountName;
+ uint64 GameAccountFlags;
+
+ uint32 FailedLogins;
+ };
+
+ class ResumeResponse final : public ServerPacket
+ {
+ public:
+ ResumeResponse() : ServerPacket(PacketHeader(SMSG_RESUME_RESPONSE, AUTHENTICATION)), PingTimeout(120000)
+ {
+ }
+
+ ~ResumeResponse();
+
+ void Write() override;
+ std::string ToString() const override;
+
+ std::vector<ModuleInfo*> Modules;
+ void SetAuthResult(AuthResult result);
+ ResponseFailure Result;
+
+ int32 PingTimeout;
+ Regulator RegulatorRules;
+ };
+
+ class ProofRequest final : public ServerPacket
+ {
+ public:
+ ProofRequest() : ServerPacket(PacketHeader(SMSG_PROOF_REQUEST, AUTHENTICATION)) { }
+ ~ProofRequest();
+
+ void Write() override;
+ std::string ToString() const override;
+
+ std::vector<ModuleInfo*> Modules;
+ };
+ }
+}
+
+#endif // AuthenticationPackets_h__