mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-31 17:26:30 +00:00
1c8231eb9e
* 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 32d61ea238.
* 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
47 lines
1.4 KiB
C++
47 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include "tcp_connection.h"
|
|
#include "servertalk_common.h"
|
|
#include "packet.h"
|
|
#include <vector>
|
|
|
|
namespace EQ
|
|
{
|
|
namespace Net
|
|
{
|
|
class ServertalkServer;
|
|
class ServertalkServerConnection
|
|
{
|
|
public:
|
|
ServertalkServerConnection(std::shared_ptr<EQ::Net::TCPConnection> c, ServertalkServer *parent);
|
|
~ServertalkServerConnection();
|
|
|
|
void Send(uint16_t opcode, EQ::Net::Packet &p);
|
|
void SendPacket(ServerPacket *p);
|
|
void OnMessage(uint16_t opcode, std::function<void(uint16_t, EQ::Net::Packet&)> cb);
|
|
void OnMessage(std::function<void(uint16_t, EQ::Net::Packet&)> cb);
|
|
|
|
std::string GetIdentifier() const { return m_identifier; }
|
|
std::shared_ptr<EQ::Net::TCPConnection> Handle() { return m_connection; }
|
|
std::string GetUUID() const { return m_uuid; }
|
|
private:
|
|
void OnRead(TCPConnection* c, const unsigned char* data, size_t sz);
|
|
void ProcessReadBuffer();
|
|
void OnDisconnect(TCPConnection* c);
|
|
void SendHello();
|
|
void InternalSend(ServertalkPacketType type, EQ::Net::Packet &p);
|
|
void ProcessHandshake(EQ::Net::Packet &p);
|
|
void ProcessMessage(EQ::Net::Packet &p);
|
|
|
|
std::shared_ptr<EQ::Net::TCPConnection> m_connection;
|
|
ServertalkServer *m_parent;
|
|
|
|
std::vector<char> m_buffer;
|
|
std::unordered_map<uint16_t, std::function<void(uint16_t, EQ::Net::Packet&)>> m_message_callbacks;
|
|
std::function<void(uint16_t, EQ::Net::Packet&)> m_message_callback;
|
|
std::string m_identifier;
|
|
std::string m_uuid;
|
|
};
|
|
}
|
|
}
|