eqemu-server/world/login_server.h
Chris Miles d87db648c3
[Loginserver] Code Cleanup and Tweaks (#1653)
* if for whatever reason the world server is not sending an address, use the local address it sends

* Log when world is sending loginserver info

* Force legacy mode when login host is login.eqemulator.net to avoid misconfigurations at least until things change

* Add human IP translation to log messages

* Sanitize world server name

* Code cleanup and renaming member variables

* More cleanup

* Remove this->

* Validation constants

* Key worldserver lookups by both longname and shortname both

* Update allowed character list

* Fix short_name API response field; add world_id to response

* Shorten receiver verbosity

* Remove unnecessary member variables from database and rename database to m_database

* Adjust MAX_SERVER_VERSION_LENGTH

* Fix indents
2021-10-30 19:09:42 -05:00

68 lines
2.2 KiB
C++

#ifndef LOGINSERVER_H
#define LOGINSERVER_H
#include "../common/servertalk.h"
#include "../common/linked_list.h"
#include "../common/timer.h"
#include "../common/queue.h"
#include "../common/eq_packet_structs.h"
#include "../common/mutex.h"
#include "../common/net/servertalk_client_connection.h"
#include "../common/net/servertalk_legacy_client_connection.h"
#include "../common/event/timer.h"
#include <memory>
class LoginServer{
public:
LoginServer(const char*, uint16, const char*, const char*, bool legacy);
~LoginServer();
bool Connect();
void SendInfo();
void SendStatus();
void SendPacket(ServerPacket* pack);
void SendAccountUpdate(ServerPacket *pack);
bool Connected()
{
if (m_is_legacy) {
if (m_legacy_client) {
return m_legacy_client->Connected();
}
}
else {
if (m_client) {
return m_client->Connected();
}
}
return false;
}
bool CanUpdate() { return m_can_account_update; }
private:
void ProcessUsertoWorldReqLeg(uint16_t opcode, EQ::Net::Packet &p);
void ProcessUsertoWorldReq(uint16_t opcode, EQ::Net::Packet &p);
void ProcessLSClientAuth(uint16_t opcode, EQ::Net::Packet &p);
void ProcessLSClientAuthLegacy(uint16_t opcode, EQ::Net::Packet &p);
void ProcessLSFatalError(uint16_t opcode, EQ::Net::Packet &p);
void ProcessSystemwideMessage(uint16_t opcode, EQ::Net::Packet &p);
void ProcessLSRemoteAddr(uint16_t opcode, EQ::Net::Packet &p);
void ProcessLSAccountUpdate(uint16_t opcode, EQ::Net::Packet &p);
void OnKeepAlive(EQ::Timer *t);
std::unique_ptr<EQ::Timer> m_keepalive;
std::unique_ptr<EQ::Net::ServertalkClient> m_client;
std::unique_ptr<EQ::Net::ServertalkLegacyClient> m_legacy_client;
std::unique_ptr<EQ::Timer> m_statusupdate_timer;
char m_loginserver_address[256];
uint32 m_loginserver_ip;
uint16 m_loginserver_port;
std::string m_login_account;
std::string m_login_password;
bool m_can_account_update;
bool m_is_legacy;
};
#endif