/*
* Ascent MMORPG Server
* Copyright (C) 2005-2007 Ascent Team
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
*/
#ifndef AUTHSOCKET_H
#define AUTHSOCKET_H
#include "AccountCache.h"
#include "AuthStructs.h"
class LogonCommServerSocket;
class AuthSocket : public Socket
{
friend class LogonCommServerSocket;
public:
///////////////////////////////////////////////////
// Netcore shit
//////////////////////////
AuthSocket(SOCKET fd);
~AuthSocket();
void OnRead();
///////////////////////////////////////////////////
// Client Packet Handlers
//////////////////////////
void HandleChallenge();
void HandleProof();
void HandleRealmlist();
///////////////////////////////////////////////////
// Server Packet Builders
//////////////////////////
void SendChallengeError(uint8 Error);
void SendProofError(uint8 Error, uint8 * M2);
inline sAuthLogonChallenge_C * GetChallenge() { return &m_challenge; }
inline void SendPacket(const uint8* data, const uint16 len) { Send(data, len); }
void OnDisconnect();
inline time_t GetLastRecv() { return last_recv; }
bool removedFromSet;
inline uint32 GetAccountID() { return m_account ? m_account->AccountId : 0; }
protected:
sAuthLogonChallenge_C m_challenge;
Account * m_account;
bool m_authenticated;
//////////////////////////////////////////////////
// Authentication BigNumbers
/////////////////////////
BigNumber N, s, g, v;
BigNumber b, B;
BigNumber rs;
//////////////////////////////////////////////////
// Session Key
/////////////////////////
BigNumber m_sessionkey;
time_t last_recv;
};
#endif