PageRenderTime 60ms CodeModel.GetById 34ms RepoModel.GetById 0ms app.codeStats 0ms

/src/server/authserver/Server/AuthSession.h

https://gitlab.com/IlluminatiCore/IlluminatiCore
C Header | 96 lines | 59 code | 19 blank | 18 comment | 0 complexity | dd978a49c6c6be6b9fa59b9767b58034 MD5 | raw file
Possible License(s): GPL-2.0, BSD-2-Clause
  1. /*
  2. * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
  3. * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of the GNU General Public License as published by the
  7. * Free Software Foundation; either version 2 of the License, or (at your
  8. * option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful, but WITHOUT
  11. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  13. * more details.
  14. *
  15. * You should have received a copy of the GNU General Public License along
  16. * with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #ifndef __AUTHSESSION_H__
  19. #define __AUTHSESSION_H__
  20. #include "Common.h"
  21. #include "ByteBuffer.h"
  22. #include "Socket.h"
  23. #include "BigNumber.h"
  24. #include <memory>
  25. #include <boost/asio/ip/tcp.hpp>
  26. using boost::asio::ip::tcp;
  27. struct AuthHandler;
  28. class AuthSession : public Socket<AuthSession>
  29. {
  30. public:
  31. static std::unordered_map<uint8, AuthHandler> InitHandlers();
  32. AuthSession(tcp::socket&& socket) : Socket(std::move(socket)),
  33. _isAuthenticated(false), _build(0), _expversion(0), _accountSecurityLevel(SEC_PLAYER)
  34. {
  35. N.SetHexStr("894B645E89E1535BBDAD5B8B290650530801B18EBFBF5E8FAB3C82872A3E9BB7");
  36. g.SetDword(7);
  37. }
  38. void Start() override
  39. {
  40. AsyncRead();
  41. }
  42. void SendPacket(ByteBuffer& packet);
  43. protected:
  44. void ReadHandler() override;
  45. private:
  46. bool HandleLogonChallenge();
  47. bool HandleLogonProof();
  48. bool HandleReconnectChallenge();
  49. bool HandleReconnectProof();
  50. bool HandleRealmList();
  51. //data transfer handle for patch
  52. bool HandleXferResume();
  53. bool HandleXferCancel();
  54. bool HandleXferAccept();
  55. void SetVSFields(const std::string& rI);
  56. BigNumber N, s, g, v;
  57. BigNumber b, B;
  58. BigNumber K;
  59. BigNumber _reconnectProof;
  60. bool _isAuthenticated;
  61. std::string _tokenKey;
  62. std::string _login;
  63. std::string _localizationName;
  64. std::string _os;
  65. uint16 _build;
  66. uint8 _expversion;
  67. AccountTypes _accountSecurityLevel;
  68. };
  69. #pragma pack(push, 1)
  70. struct AuthHandler
  71. {
  72. uint32 status;
  73. size_t packetSize;
  74. bool (AuthSession::*handler)();
  75. };
  76. #pragma pack(pop)
  77. #endif