/* * Copyright (C) 2016+ AzerothCore , released under GNU GPL v2 license, you may redistribute it and/or modify it under version 2 of the License, or (at your option), any later version. * Copyright (C) 2008-2016 TrinityCore * Copyright (C) 2005-2009 MaNGOS */ #ifndef _AUTHSOCKET_H #define _AUTHSOCKET_H #include "Common.h" #include "CryptoHash.h" #include "RealmSocket.h" #include "SRP6.h" class ACE_INET_Addr; struct Realm; enum eStatus { STATUS_CHALLENGE, STATUS_LOGON_PROOF, STATUS_RECON_PROOF, STATUS_PATCH, // unused STATUS_AUTHED, STATUS_CLOSED }; // Handle login commands class AuthSocket: public RealmSocket::Session { public: const static int s_BYTE_SIZE = 32; AuthSocket(RealmSocket& socket); ~AuthSocket() override; void OnRead() override; void OnAccept() override; void OnClose() override; static ACE_INET_Addr const& GetAddressForClient(Realm const& realm, ACE_INET_Addr const& clientAddr); bool _HandleLogonChallenge(); bool _HandleLogonProof(); bool _HandleReconnectChallenge(); bool _HandleReconnectProof(); bool _HandleRealmList(); //data transfer handle for patch bool _HandleXferResume(); bool _HandleXferCancel(); bool _HandleXferAccept(); FILE* pPatch; ACE_Thread_Mutex patcherLock; private: RealmSocket& socket_; RealmSocket& socket() { return socket_; } std::optional _srp6; SessionKey _sessionKey = {}; std::array _reconnectProof = {}; eStatus _status; std::string _login; std::string _tokenKey; // Since GetLocaleByName() is _NOT_ bijective, we have to store the locale as a string. Otherwise we can't differ // between enUS and enGB, which is important for the patch system std::string _localizationName; std::string _os; uint16 _build; uint8 _expversion; AccountTypes _accountSecurityLevel; }; #endif