EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
EVESession.h
Go to the documentation of this file.
1 /*
2  ------------------------------------------------------------------------------------
3  LICENSE:
4  ------------------------------------------------------------------------------------
5  This file is part of EVEmu: EVE Online Server Emulator
6  Copyright 2006 - 2021 The EVEmu Team
7  For the latest information visit https://evemu.dev
8  ------------------------------------------------------------------------------------
9  This program is free software; you can redistribute it and/or modify it under
10  the terms of the GNU Lesser General Public License as published by the Free Software
11  Foundation; either version 2 of the License, or (at your option) any later
12  version.
13 
14  This program is distributed in the hope that it will be useful, but WITHOUT
15  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public License along with
19  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
20  Place - Suite 330, Boston, MA 02111-1307, USA, or go to
21  http://www.gnu.org/copyleft/lesser.txt.
22  ------------------------------------------------------------------------------------
23  Author: Zhur
24 */
25 
26 #ifndef __EVE_SESSION_H__INCL__
27 #define __EVE_SESSION_H__INCL__
28 
30 
31 class PyPacket;
32 class PyRep;
33 
34 class VersionExchangeClient;
35 class VersionExchangeServer;
36 class CryptoRequestPacket;
37 class CryptoChallengePacket;
38 class CryptoHandshakeResult;
39 
50 {
51 public:
54 
62  virtual ~EVEClientSession();
63 
65  state_t GetState() const { return mNet->GetState(); }
67  std::string GetAddress() const { return mNet->GetAddress(); }
68 
74  void Reset();
75 
81  void QueuePacket( PyPacket* packet );
82 
89 
94 
95 
96 protected:
102  virtual void _GetVersion( VersionExchangeServer& version ) = 0;
104  //virtual uint32 GetUserCount() = 0;
106  virtual uint32 _GetQueuePosition() = 0;
107 
116  virtual bool _VerifyVersion( VersionExchangeClient& version ) = 0;
125  virtual bool _VerifyVIPKey( const std::string& vipKey ) = 0;
134  virtual bool _VerifyCrypto( CryptoRequestPacket& cr ) = 0;
143  virtual bool _VerifyLogin( CryptoChallengePacket& ccp ) = 0;
152  virtual bool _VerifyFuncResult( CryptoHandshakeResult& result ) = 0;
153 
156 
157 private:
158  // State machine facility:
160 
161  PyPacket* _HandleVersion( PyRep* rep );
162  PyPacket* _HandleCommand( PyRep* rep );
163  PyPacket* _HandleCrypto( PyRep* rep );
166  PyPacket* _HandlePacket( PyRep* rep );
167 };
168 
169 #endif /* !__EVE_SESSION_H__INCL__ */
Base Python wire object.
Definition: PyRep.h:66
PyPacket * _HandleAuthentication(PyRep *rep)
Definition: EVESession.cpp:158
void Reset()
Resets session.
Definition: EVESession.cpp:50
virtual bool _VerifyLogin(CryptoChallengePacket &ccp)=0
Verifies login.
PyPacket * _HandlePacket(PyRep *rep)
Definition: EVESession.cpp:179
PyPacket *(EVEClientSession::* mPacketHandler)(PyRep *rep)
Definition: EVESession.h:159
PyPacket * _HandleFuncResult(PyRep *rep)
Definition: EVESession.cpp:169
std::string GetAddress() const
Definition: EVESession.h:67
TCPConnection::state_t state_t
Definition: EVESession.h:53
virtual bool _VerifyFuncResult(CryptoHandshakeResult &result)=0
Verifies function result.
PyPacket * _HandleCrypto(PyRep *rep)
Definition: EVESession.cpp:147
EVE derivation of TCP connection.
virtual bool _VerifyVIPKey(const std::string &vipKey)=0
Verifies VIP key.
std::string GetAddress()
virtual bool _VerifyCrypto(CryptoRequestPacket &cr)=0
Verifies crypto.
virtual bool _VerifyVersion(VersionExchangeClient &version)=0
Verifies version.
Client session from server's side.
Definition: EVESession.h:49
unsigned __int32 uint32
Definition: eve-compat.h:50
PyPacket * _HandleVersion(PyRep *rep)
Definition: EVESession.cpp:94
void CloseClientConnection()
Disconnects client from the server.
Definition: EVESession.h:93
EVETCPConnection *const mNet
Definition: EVESession.h:155
void QueuePacket(PyPacket *packet)
Queues new packet, retaking ownership.
Definition: EVESession.cpp:66
virtual ~EVEClientSession()
Destroys contained connection.
Definition: EVESession.cpp:45
PyPacket * _HandleCommand(PyRep *rep)
Definition: EVESession.cpp:106
PyPacket * PopPacket()
Pops new packet from queue.
Definition: EVESession.cpp:80
void Disconnect()
Schedules disconnect of current connection.
virtual void _GetVersion(VersionExchangeServer &version)=0
Obtains version.
state_t GetState() const
Definition: EVESession.h:65
EVEClientSession(EVETCPConnection **n)
Definition: EVESession.cpp:38
state_t GetState() const
Definition: TCPConnection.h:77
virtual uint32 _GetQueuePosition()=0