16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-22 08:09:19 +02:00
This commit is contained in:
milek7
2018-12-03 23:12:33 +01:00
parent 18ad14bc53
commit f525a77e23
13 changed files with 386 additions and 5 deletions

29
network/network.h Normal file
View File

@@ -0,0 +1,29 @@
#pragma once
#include <asio.hpp>
#include <memory>
#include <functional>
#include <optional>
#include "network/message.h"
namespace network
{
class connection : public std::enable_shared_from_this<connection>
{
private:
void message_received(message msg);
protected:
virtual void disconnect() = 0;
virtual void send_data(uint8_t *buffer, size_t len) = 0;
void data_received(uint8_t *buffer, size_t len);
public:
virtual void connected();
};
class server
{
protected:
std::vector<std::shared_ptr<connection>> clients;
};
}