mirror of
https://github.com/EQEmu/Server.git
synced 2026-09-03 21:56:36 +00:00
Console initial implementation
This commit is contained in:
+2
-42
@@ -1,45 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include "../common/net/tcp_server.h"
|
||||
#include "../common/event/timer.h"
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include "../common/net/console_server.h"
|
||||
|
||||
class ConsoleServer;
|
||||
class ConsoleConnection
|
||||
{
|
||||
public:
|
||||
ConsoleConnection(ConsoleServer *parent, std::shared_ptr<EQ::Net::TCPConnection> connection);
|
||||
~ConsoleConnection();
|
||||
|
||||
std::string GetUUID() const { return m_uuid; }
|
||||
|
||||
void Clear();
|
||||
void SendLine(const std::string &line);
|
||||
void SendNewLine();
|
||||
private:
|
||||
void OnRead(EQ::Net::TCPConnection* c, const unsigned char* data, size_t sz);
|
||||
void ProcessReadBuffer();
|
||||
void ProcessCommand(const std::string& cmd);
|
||||
void OnDisconnect(EQ::Net::TCPConnection* c);
|
||||
|
||||
ConsoleServer *m_parent;
|
||||
std::shared_ptr<EQ::Net::TCPConnection> m_connection;
|
||||
std::string m_uuid;
|
||||
|
||||
std::vector<char> m_buffer;
|
||||
};
|
||||
|
||||
class ConsoleServer
|
||||
{
|
||||
public:
|
||||
ConsoleServer();
|
||||
~ConsoleServer();
|
||||
|
||||
void ConnectionDisconnected(ConsoleConnection *c);
|
||||
private:
|
||||
|
||||
std::unique_ptr<EQ::Net::TCPServer> m_server;
|
||||
std::map<std::string, std::unique_ptr<ConsoleConnection>> m_connections;
|
||||
friend class ConsoleConnection;
|
||||
};
|
||||
void RegisterConsoleFunctions(std::unique_ptr<EQ::Net::ConsoleServer> &console);
|
||||
|
||||
Reference in New Issue
Block a user