31 #include "packets/Crypto.h"
40 mPacketHandler( nullptr )
57 VersionExchangeServer version;
60 PyRep* res(version.Encode());
67 if (packet ==
nullptr)
73 sLog.Error(
"QueuePacket",
"%s: Failed to encode a packet.",
GetAddress().c_str());
87 rep->Dump(NET__PRES_REP,
" ");
96 VersionExchangeClient ve;
97 if ( !ve.Decode( &rep ) )
98 sLog.Error(
"_HandleVersion",
"%s: Received invalid version exchange!",
GetAddress().c_str());
109 sLog.Error(
"_HandleCommand",
"%s: Invalid packet during waiting for command (tuple expected).",
GetAddress().c_str());
113 if ( !cmd.Decode( &rep ) )
114 sLog.Error(
"_HandleCommand",
"%s: Failed to decode 2-arg command.",
GetAddress().c_str());
116 sLog.Debug(
"_HandleCommand",
"%s: Got Queue Check command.",
GetAddress().c_str());
128 if ( !cmd.Decode( &rep ) ) {
129 sLog.Error(
"_HandleCommand",
"%s: Failed to decode 3-arg command.",
GetAddress().c_str());
131 sLog.Debug(
"_HandleCommand",
"%s: Got VK command, vipKey=%s.",
GetAddress().c_str(), cmd.vipKey.c_str());
138 _log(NET__PRES_ERROR,
"%s: Received invalid command packet:",
GetAddress().c_str());
139 rep->
Dump(NET__PRES_ERROR,
" ");
148 CryptoRequestPacket cr;
149 if ( !cr.Decode( &rep ) )
150 sLog.Error(
"_HandleCrypto",
"%s: Received invalid crypto request!",
GetAddress().c_str());
160 CryptoChallengePacket ccp;
161 if ( !ccp.Decode( &rep ) )
162 sLog.Error(
"_HandleAuthentication",
"%s: Received invalid crypto challenge!",
GetAddress().c_str());
170 CryptoHandshakeResult hr;
171 if ( !hr.Decode( &rep ) )
172 sLog.Error(
"_HandleFuncResult",
"%s: Received invalid crypto handshake result!",
GetAddress().c_str());
182 if ( !p->
Decode( &rep ) ) {
183 sLog.Error(
"_HandlePacket",
"%s: Failed to decode packet rep",
GetAddress().c_str());
PyPacket * _HandleAuthentication(PyRep *rep)
void Reset()
Resets session.
virtual bool _VerifyLogin(CryptoChallengePacket &ccp)=0
Verifies login.
#define _log(type, fmt,...)
PyPacket * _HandlePacket(PyRep *rep)
PyPacket *(EVEClientSession::* mPacketHandler)(PyRep *rep)
PyPacket * _HandleFuncResult(PyRep *rep)
std::string GetAddress() const
void QueueRep(const PyRep *rep, bool compress=true)
Queues given PyRep into send queue.
PyRep * PopRep()
Pops PyRep from receive queue.
void Dump(FILE *into, const char *pfx) const
Dumps object to file.
virtual bool _VerifyFuncResult(CryptoHandshakeResult &result)=0
Verifies function result.
void SafeDelete(T *&p)
Deletes and nullifies a pointer.
PyPacket * _HandleCrypto(PyRep *rep)
#define is_log_enabled(type)
#define sLog
Evaluates to a NewLog instance.
EVE derivation of TCP connection.
virtual bool _VerifyVIPKey(const std::string &vipKey)=0
Verifies VIP key.
virtual bool _VerifyCrypto(CryptoRequestPacket &cr)=0
Verifies crypto.
virtual bool _VerifyVersion(VersionExchangeClient &version)=0
Verifies version.
PyPacket * _HandleVersion(PyRep *rep)
EVETCPConnection *const mNet
void QueuePacket(PyPacket *packet)
Queues new packet, retaking ownership.
virtual ~EVEClientSession()
Destroys contained connection.
PyPacket * _HandleCommand(PyRep *rep)
bool Decode(PyRep **packet)
PyPacket * PopPacket()
Pops new packet from queue.
virtual void _GetVersion(VersionExchangeServer &version)=0
Obtains version.
EVEClientSession(EVETCPConnection **n)
virtual uint32 _GetQueuePosition()=0