mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 21:01:29 +00:00
* Remove security from servertalk connections * Remove the two hello steps before handshake that are now obsolete out * Revert "Remove the two hello steps before handshake that are now obsolete out" This reverts commit 32d61ea2381c1bddf8b08c5240899116d0fd3e80. * Keep old values for enums * Use downgrade security handshake for backwards compat * Send handshake instead of hello to fast connect * Add connect callback so it will actually work
52 lines
1.4 KiB
C++
52 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include "tcp_server.h"
|
|
#include "servertalk_server_connection.h"
|
|
#include <vector>
|
|
#include <map>
|
|
|
|
namespace EQ
|
|
{
|
|
namespace Net
|
|
{
|
|
struct ServertalkServerOptions
|
|
{
|
|
int port;
|
|
bool ipv6;
|
|
std::string credentials;
|
|
|
|
ServertalkServerOptions() {
|
|
ipv6 = false;
|
|
}
|
|
};
|
|
|
|
class ServertalkServer
|
|
{
|
|
public:
|
|
ServertalkServer();
|
|
~ServertalkServer();
|
|
|
|
void Listen(const ServertalkServerOptions& opts);
|
|
void OnConnectionIdentified(const std::string &type, std::function<void(std::shared_ptr<ServertalkServerConnection>)> cb);
|
|
void OnConnectionRemoved(const std::string &type, std::function<void(std::shared_ptr<ServertalkServerConnection>)> cb);
|
|
|
|
private:
|
|
void ConnectionDisconnected(ServertalkServerConnection *conn);
|
|
void ConnectionIdentified(ServertalkServerConnection *conn);
|
|
bool CheckCredentials(const std::string &credentials);
|
|
|
|
std::unique_ptr<EQ::Net::TCPServer> m_server;
|
|
std::vector<std::shared_ptr<ServertalkServerConnection>> m_unident_connections;
|
|
std::map<std::string, std::vector<std::shared_ptr<ServertalkServerConnection>>> m_ident_connections;
|
|
|
|
std::map<std::string, std::function<void(std::shared_ptr<ServertalkServerConnection>)>> m_on_ident;
|
|
std::map<std::string, std::function<void(std::shared_ptr<ServertalkServerConnection>)>> m_on_disc;
|
|
bool m_encrypted;
|
|
bool m_allow_downgrade;
|
|
std::string m_credentials;
|
|
|
|
friend class ServertalkServerConnection;
|
|
};
|
|
}
|
|
}
|