diff --git a/src/client/game/demonware/servers/new/base_server.hpp b/src/client/game/demonware/servers/new/base_server.hpp new file mode 100644 index 0000000..52b4a2a --- /dev/null +++ b/src/client/game/demonware/servers/new/base_server.hpp @@ -0,0 +1,42 @@ +#pragma once +#include + +class base_server +{ +public: + base_server(std::string name) + : name_(std::move(name)) + { + this->address_ = utils::cryptography::jenkins_one_at_a_time::compute(this->name_); + } + + base_server(base_server&&) = delete; + base_server(const base_server&) = delete; + base_server& operator=(base_server&&) = delete; + base_server& operator=(const base_server&) = delete; + + virtual ~base_server() = default; + + const std::string& get_name() const + { + return this->name_; + } + + uint32_t get_address() const + { + return this->address_; + } + + virtual void frame() + { + } + + virtual bool pending_data() + { + return false; + } + +private: + std::string name_; + std::uint32_t address_ = 0; +}; diff --git a/src/client/game/demonware/servers/new/tcp_server.hpp b/src/client/game/demonware/servers/new/tcp_server.hpp new file mode 100644 index 0000000..1a12d67 --- /dev/null +++ b/src/client/game/demonware/servers/new/tcp_server.hpp @@ -0,0 +1,41 @@ +#pragma once + +#include "base_server.hpp" + +#include +#include + +class tcp_server : public base_server +{ +public: + using base_server::base_server; + + int handle_input(const char* buf, int size) + { + return 0; + } + + int handle_output(char* buf, int size) + { + return 0; + } + +protected: + virtual void handle(const std::string& data) = 0; + void send(const std::string&) + { + + } + +private: + using stream_queue = std::queue; + using data_queue = std::queue; + + utils::concurrency::container in_queue_; + utils::concurrency::container out_queue_; + + void frame() override + { + + } +}; \ No newline at end of file diff --git a/src/client/game/demonware/servers/new/udp_server.hpp b/src/client/game/demonware/servers/new/udp_server.hpp new file mode 100644 index 0000000..e69de29