[2] | 1 | /* |
---|
[44] | 2 | * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> |
---|
[2] | 3 | * |
---|
[44] | 4 | * Thanks to the original authors: MaNGOS <http://www.mangosproject.org/> |
---|
| 5 | * |
---|
[2] | 6 | * This program is free software; you can redistribute it and/or modify |
---|
| 7 | * it under the terms of the GNU General Public License as published by |
---|
| 8 | * the Free Software Foundation; either version 2 of the License, or |
---|
| 9 | * (at your option) any later version. |
---|
| 10 | * |
---|
| 11 | * This program is distributed in the hope that it will be useful, |
---|
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
[44] | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
[2] | 14 | * GNU General Public License for more details. |
---|
| 15 | * |
---|
| 16 | * You should have received a copy of the GNU General Public License |
---|
| 17 | * along with this program; if not, write to the Free Software |
---|
[44] | 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
[2] | 19 | */ |
---|
| 20 | |
---|
| 21 | /// \addtogroup realmd |
---|
| 22 | /// @{ |
---|
| 23 | /// \file |
---|
| 24 | |
---|
| 25 | #ifndef _AUTHSOCKET_H |
---|
| 26 | #define _AUTHSOCKET_H |
---|
| 27 | |
---|
| 28 | #include "Common.h" |
---|
| 29 | #include "Auth/BigNumber.h" |
---|
| 30 | #include "sockets/TcpSocket.h" |
---|
| 31 | #include "sockets/SocketHandler.h" |
---|
| 32 | #include "sockets/ListenSocket.h" |
---|
| 33 | #include "sockets/Utility.h" |
---|
| 34 | #include "sockets/Parse.h" |
---|
| 35 | #include "sockets/Socket.h" |
---|
| 36 | |
---|
| 37 | /// Handle login commands |
---|
| 38 | class AuthSocket: public TcpSocket |
---|
| 39 | { |
---|
| 40 | public: |
---|
| 41 | const static int s_BYTE_SIZE = 32; |
---|
| 42 | |
---|
| 43 | AuthSocket(ISocketHandler& h); |
---|
| 44 | ~AuthSocket(); |
---|
| 45 | |
---|
| 46 | void OnAccept(); |
---|
| 47 | void OnRead(); |
---|
| 48 | |
---|
| 49 | bool _HandleLogonChallenge(); |
---|
| 50 | bool _HandleLogonProof(); |
---|
| 51 | bool _HandleRealmList(); |
---|
| 52 | //data transfer handle for patch |
---|
| 53 | |
---|
| 54 | bool _HandleXferResume(); |
---|
| 55 | bool _HandleXferCancel(); |
---|
| 56 | bool _HandleXferAccept(); |
---|
| 57 | |
---|
| 58 | void _SetVSFields(std::string rI); |
---|
| 59 | |
---|
| 60 | FILE *pPatch; |
---|
| 61 | bool IsLag(); |
---|
| 62 | |
---|
| 63 | private: |
---|
| 64 | |
---|
| 65 | BigNumber N, s, g, v; |
---|
| 66 | BigNumber b, B; |
---|
| 67 | BigNumber K; |
---|
| 68 | |
---|
| 69 | bool _authed; |
---|
| 70 | |
---|
| 71 | std::string _login; |
---|
| 72 | std::string _safelogin; |
---|
| 73 | uint8 _localization; |
---|
| 74 | AccountTypes _accountSecurityLevel; |
---|
| 75 | }; |
---|
| 76 | #endif |
---|
| 77 | /// @} |
---|