1 | /* |
---|
2 | * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> |
---|
3 | * |
---|
4 | * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> |
---|
5 | * |
---|
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 |
---|
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
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 |
---|
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
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 | #include "zthread/Mutex.h" |
---|
37 | |
---|
38 | /// Handle login commands |
---|
39 | class AuthSocket: public TcpSocket |
---|
40 | { |
---|
41 | public: |
---|
42 | const static int s_BYTE_SIZE = 32; |
---|
43 | |
---|
44 | AuthSocket(ISocketHandler& h); |
---|
45 | ~AuthSocket(); |
---|
46 | |
---|
47 | void OnAccept(); |
---|
48 | void OnRead(); |
---|
49 | |
---|
50 | bool _HandleLogonChallenge(); |
---|
51 | bool _HandleLogonProof(); |
---|
52 | bool _HandleReconnectChallenge(); |
---|
53 | bool _HandleReconnectProof(); |
---|
54 | bool _HandleRealmList(); |
---|
55 | //data transfer handle for patch |
---|
56 | |
---|
57 | bool _HandleXferResume(); |
---|
58 | bool _HandleXferCancel(); |
---|
59 | bool _HandleXferAccept(); |
---|
60 | |
---|
61 | void _SetVSFields(std::string rI); |
---|
62 | |
---|
63 | FILE *pPatch; |
---|
64 | ZThread::Mutex patcherLock; |
---|
65 | bool IsLag(); |
---|
66 | |
---|
67 | private: |
---|
68 | |
---|
69 | BigNumber N, s, g, v; |
---|
70 | BigNumber b, B; |
---|
71 | BigNumber K; |
---|
72 | BigNumber _reconnectProof; |
---|
73 | |
---|
74 | bool _authed; |
---|
75 | |
---|
76 | std::string _login; |
---|
77 | std::string _safelogin; |
---|
78 | |
---|
79 | |
---|
80 | // Since GetLocaleByName() is _NOT_ bijective, we have to store the locale as a string. Otherwise we can't differ |
---|
81 | // between enUS and enGB, which is important for the patch system |
---|
82 | std::string _localizationName; |
---|
83 | uint16 _build; |
---|
84 | AccountTypes _accountSecurityLevel; |
---|
85 | }; |
---|
86 | #endif |
---|
87 | /// @} |
---|