TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
AuthenticationPackets.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License as published by the
6  * Free Software Foundation; either version 2 of the License, or (at your
7  * option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef AuthenticationPacketsWorld_h__
19 #define AuthenticationPacketsWorld_h__
20 
21 #include "Packet.h"
22 #include "ObjectMgr.h"
23 #include "Common.h"
24 #include "BigNumber.h"
25 #include "SHA1.h"
26 #include <boost/asio/ip/tcp.hpp>
27 
28 using boost::asio::ip::tcp;
29 
30 namespace WorldPackets
31 {
32  namespace Auth
33  {
34  class AuthChallenge final : public ServerPacket
35  {
36  public:
38 
39  WorldPacket const* Write() override;
40 
41  std::array<uint8, 16> Challenge;
44  };
45 
46  class AuthSession final : public ClientPacket
47  {
48  public:
49  static uint32 const DigestLength = 24;
50 
52  {
53  LocalChallenge.fill(0);
54  Digest.fill(0);
55  }
56 
57  void Read() override;
58 
64  std::array<uint8, 16> LocalChallenge;
65  std::array<uint8, DigestLength> Digest;
68  std::string RealmJoinTicket;
69  bool UseIPv6 = false;
70  };
71 
72  class AuthResponse final : public ServerPacket
73  {
74  public:
75  struct RealmInfo
76  {
77  RealmInfo(uint32 realmAddress, bool isHomeRealm, bool isInternalRealm, std::string const& realmNameActual, std::string const& realmNameNormalized) :
78  RealmAddress(realmAddress), IsLocal(isHomeRealm), IsInternalRealm(isInternalRealm), RealmNameActual(realmNameActual), RealmNameNormalized(realmNameNormalized) { }
79 
81  bool IsLocal;
83  std::string RealmNameActual;
84  std::string RealmNameNormalized;
85  };
86 
88  {
89  struct BillingInfo
90  {
93  bool InGameRoom = false;
94  };
95 
99 
103 
105 
106  std::vector<RealmInfo> VirtualRealms;
107  std::vector<CharacterTemplate> Templates;
108 
111 
112  bool IsExpansionTrial = false;
113  bool ForceCharacterTemplate = false;
116  };
117 
119  {
122  bool HasFCM = false;
123  };
124 
125  AuthResponse();
126 
127  WorldPacket const* Write() override;
128 
132  };
133 
134  enum class ConnectToSerial : uint32
135  {
136  None = 0,
137  Realm = 14,
138  WorldAttempt1 = 17,
139  WorldAttempt2 = 35,
140  WorldAttempt3 = 53,
141  WorldAttempt4 = 71,
142  WorldAttempt5 = 89
143  };
144 
145  class ConnectTo final : public ServerPacket
146  {
147  static std::string const Haiku;
148  static uint8 const PiDigits[130];
149 
151  {
152  tcp::endpoint Where;
154  uint8 XorMagic = 0x2A;
156  };
157 
158  public:
159  ConnectTo();
160 
161  WorldPacket const* Write() override;
162 
163  uint64 Key = 0;
166  uint8 Con = 0;
167 
168  private:
174  };
175 
176  class AuthContinuedSession final : public ClientPacket
177  {
178  public:
179  static uint32 const DigestLength = 24;
180 
182  {
183  LocalChallenge.fill(0);
184  Digest.fill(0);
185  }
186 
187  void Read() override;
188 
190  uint64 Key = 0;
191  std::array<uint8, 16> LocalChallenge;
192  std::array<uint8, DigestLength> Digest;
193  };
194 
195  class ResumeComms final : public ServerPacket
196  {
197  public:
198  ResumeComms(ConnectionType connection) : ServerPacket(SMSG_RESUME_COMMS, 0, connection) { }
199 
200  WorldPacket const* Write() override { return &_worldPacket; }
201  };
202 
203  class ConnectToFailed final : public ClientPacket
204  {
205  public:
207 
208  void Read() override;
209 
211  uint8 Con = 0;
212  };
213  }
214 }
215 
216 #endif // AuthenticationPacketsWorld_h__
uint32 RegionID
Definition: AuthenticationPackets.h:61
static uint32 const DigestLength
Definition: AuthenticationPackets.h:49
Definition: BigNumber.h:28
ExpansionRequirementContainer const * AvailableRaces
the minimum AccountExpansion required to select the races
Definition: AuthenticationPackets.h:110
std::string RealmJoinTicket
Definition: AuthenticationPackets.h:68
WorldPacket const * Write() override
Definition: AuthenticationPackets.cpp:305
Definition: ByteBuffer.h:70
int8_t int8
Definition: Define.h:148
ResumeComms(ConnectionType connection)
Definition: AuthenticationPackets.h:198
Optional< uint16 > NumPlayersAlliance
number of alliance players in this realm.
Definition: AuthenticationPackets.h:115
BigNumber dmp1
Definition: AuthenticationPackets.h:171
Definition: AuthenticationPackets.h:75
uint32 TimeRemain
Definition: AuthenticationPackets.h:92
std::array< uint8, DigestLength > Digest
Definition: AuthenticationPackets.h:192
Definition: AuthenticationPackets.h:72
Optional< uint16 > NumPlayersHorde
number of horde players in this realm.
Definition: AuthenticationPackets.h:114
uint16 Build
Definition: AuthenticationPackets.h:59
bool IsLocal
true if the realm is the same as the account's home realm
Definition: AuthenticationPackets.h:81
uint8 PanamaKey[32]
Definition: AuthenticationPackets.h:155
Definition: Opcodes.h:74
AuthContinuedSession(WorldPacket &&packet)
Definition: AuthenticationPackets.h:181
static std::string const Haiku
Definition: AuthenticationPackets.h:147
Definition: Realm.h:84
Definition: AuthenticationPackets.h:195
uint32 TimeRested
affects the return value of the GetBillingTimeRested() client API call, it is the number of seconds y...
Definition: AuthenticationPackets.h:98
uint32 RealmAddress
the virtual address of this realm, constructed as RealmHandle::Region << 24 | RealmHandle::Battlegrou...
Definition: AuthenticationPackets.h:80
STL namespace.
std::string RealmNameActual
the name of the realm
Definition: AuthenticationPackets.h:83
BigNumber dmq1
Definition: AuthenticationPackets.h:172
Definition: AuthenticationPackets.h:145
BigNumber iqmp
Definition: AuthenticationPackets.h:173
Definition: AuthenticationPackets.h:176
WorldPacket _worldPacket
Definition: Packet.h:43
uint32 DosChallenge[8]
Encryption seeds.
Definition: AuthenticationPackets.h:42
ConnectToSerial Serial
Definition: AuthenticationPackets.h:210
uint64 Key
Definition: AuthenticationPackets.h:163
uint32 TimeSecondsUntilPCKick
Definition: AuthenticationPackets.h:101
ByteBuffer AddonInfo
Definition: AuthenticationPackets.h:67
BigNumber p
Definition: AuthenticationPackets.h:169
ExpansionRequirementContainer const * AvailableClasses
the minimum AccountExpansion required to select the classes
Definition: AuthenticationPackets.h:109
Definition: Opcodes.h:1458
std::vector< RealmInfo > VirtualRealms
list of realms connected to this one (inclusive)
Definition: AuthenticationPackets.h:106
bool HasFCM
true if the account has a forced character migration pending.
Definition: AuthenticationPackets.h:122
uint8 ActiveExpansionLevel
the current server expansion, the possible values are in Expansions
Definition: AuthenticationPackets.h:97
ConnectToFailed(WorldPacket &&packet)
Definition: AuthenticationPackets.h:206
Definition: AuthenticationPackets.h:118
Definition: AuthenticationPackets.h:150
Optional< AuthWaitInfo > WaitInfo
contains the queue wait information in case the account is in the login queue.
Definition: AuthenticationPackets.h:130
Definition: Packet.h:59
int8 BuildType
Definition: AuthenticationPackets.h:60
uint32 WaitTime
Wait time in login queue in minutes, if sent queued and this value is 0 client displays "unknown time...
Definition: AuthenticationPackets.h:121
uint8 Con
Definition: AuthenticationPackets.h:211
std::string RealmNameNormalized
the name of the realm without spaces
Definition: AuthenticationPackets.h:84
BigNumber q
Definition: AuthenticationPackets.h:170
AuthSession(WorldPacket &&packet)
Definition: AuthenticationPackets.h:51
Definition: AuthenticationPackets.h:87
Definition: AuthenticationPackets.h:34
Definition: Packet.h:46
AuthChallenge()
Definition: AuthenticationPackets.h:37
ConnectToSerial Serial
Definition: AuthenticationPackets.h:164
uint32 VirtualRealmAddress
a special identifier made from the Index, BattleGroup and Region.
Definition: AuthenticationPackets.h:100
bool UseIPv6
Definition: AuthenticationPackets.h:69
uint32 Result
the result of the authentication process, possible values are BattlenetRpcErrorCode ...
Definition: AuthenticationPackets.h:131
Definition: AuthenticationPackets.h:203
uint64 DosResponse
Definition: AuthenticationPackets.h:189
uint32_t uint32
Definition: Define.h:150
uint64_t uint64
Definition: Define.h:149
uint8 DosZeroBits
Definition: AuthenticationPackets.h:43
uint16_t uint16
Definition: Define.h:151
static uint8 const PiDigits[130]
Definition: AuthenticationPackets.h:148
boost::optional< T > Optional
Optional helper class to wrap optional values within.
Definition: Common.h:170
uint8 Con
Definition: AuthenticationPackets.h:166
void Read() override
Definition: AuthenticationPackets.cpp:369
uint32 CurrencyID
this is probably used for the ingame shop.
Definition: AuthenticationPackets.h:102
std::array< uint8, DigestLength > Digest
Definition: AuthenticationPackets.h:65
Definition: BattlegroundMgr.h:57
ConnectTo()
Definition: AuthenticationPackets.cpp:293
void Read() override
Definition: AuthenticationPackets.cpp:29
Definition: Opcodes.h:773
uint8 AccountExpansionLevel
the current expansion of this account, the possible values are in Expansions
Definition: AuthenticationPackets.h:96
Definition: Opcodes.h:73
AuthResponse()
Definition: AuthenticationPackets.cpp:58
std::vector< CharacterTemplate > Templates
list of pre-made character templates.
Definition: AuthenticationPackets.h:107
WorldPacket const * Write() override
Definition: AuthenticationPackets.cpp:63
std::unordered_map< uint8, uint8 > ExpansionRequirementContainer
Definition: ObjectMgr.h:602
void Read() override
Definition: AuthenticationPackets.cpp:361
ConnectPayload Payload
Definition: AuthenticationPackets.h:165
uint8_t uint8
Definition: Define.h:152
RealmInfo(uint32 realmAddress, bool isHomeRealm, bool isInternalRealm, std::string const &realmNameActual, std::string const &realmNameNormalized)
Definition: AuthenticationPackets.h:77
uint32 WaitCount
position of the account in the login queue
Definition: AuthenticationPackets.h:120
Definition: Opcodes.h:229
bool IsExpansionTrial
Definition: AuthenticationPackets.h:112
uint32 BillingPlan
Definition: AuthenticationPackets.h:91
std::array< uint8, 16 > LocalChallenge
Definition: AuthenticationPackets.h:191
ConnectToSerial
Definition: AuthenticationPackets.h:134
uint64 Key
Definition: AuthenticationPackets.h:190
tcp::endpoint Where
Definition: AuthenticationPackets.h:152
bool IsInternalRealm
Definition: AuthenticationPackets.h:82
uint32 RealmID
Definition: AuthenticationPackets.h:63
WorldPacket const * Write() override
Definition: AuthenticationPackets.cpp:21
std::array< uint8, 16 > Challenge
Definition: AuthenticationPackets.h:41
BillingInfo Billing
Definition: AuthenticationPackets.h:104
uint64 DosResponse
Definition: AuthenticationPackets.h:66
uint8 XorMagic
Definition: AuthenticationPackets.h:154
uint32 Adler32
Definition: AuthenticationPackets.h:153
Definition: WorldPacket.h:26
WorldPacket const * Write() override
Definition: AuthenticationPackets.h:200
static uint32 const DigestLength
Definition: AuthenticationPackets.h:179
uint32 BattlegroupID
Definition: AuthenticationPackets.h:62
bool InGameRoom
Definition: AuthenticationPackets.h:93
Definition: AuthenticationPackets.h:46
ConnectionType
Definition: Opcodes.h:29
Optional< AuthSuccessInfo > SuccessInfo
contains the packet data in case that it has account information (It is never set when WaitInfo is se...
Definition: AuthenticationPackets.h:129
bool ForceCharacterTemplate
forces the client to always use a character template when creating a new character.
Definition: AuthenticationPackets.h:113
std::array< uint8, 16 > LocalChallenge
Definition: AuthenticationPackets.h:64