8#include <boost/asio.hpp>
14namespace ip = boost::asio::ip;
29 unsigned int protocolVersion, ip::tcp::socket socket, std::shared_ptr<DummyBackend> regsiterSpace);
39 static const uint32_t
PONG = 1005;
46 static const uint32_t
HELLO = 4;
47 static const uint32_t
PING = 5;
79 void write(std::vector<uint32_t> data);
84 RebotDummyServer(
unsigned int portNumber, std::string mapFile,
unsigned int protocolVersion);
89 unsigned int port()
const {
return _connectionAcceptor.local_endpoint().port(); }
91 boost::asio::io_context&
service() {
return _io; }
92 std::shared_ptr<RebotDummySession>
session() {
return _currentSession.lock(); }
96 unsigned int _protocolVersion;
97 boost::asio::io_context _io;
98 ip::tcp::acceptor _connectionAcceptor;
99 std::weak_ptr<RebotDummySession> _currentSession;
100 ip::tcp::socket _socket;
101 std::shared_ptr<DummyBackend> _registerSpace;
unsigned int port() const
boost::asio::io_context & service()
std::shared_ptr< RebotDummySession > session()
void acceptHandler(const boost::system::error_code &error)
static const int32_t TOO_MUCH_DATA_REQUESTED
static const int32_t WRITE_SUCCESS_INDICATION
static const uint32_t INSIDE_MULTI_WORD_WRITE
std::atomic< uint32_t > _heartbeatCount
static const uint32_t MULTI_WORD_WRITE
ip::tcp::socket _currentClientConnection
void writeWordToRequestedAddress(std::vector< uint32_t > &buffer)
void processReceivedPackage(std::vector< uint32_t > &buffer)
static const uint32_t ACCEPT_NEW_COMMAND
std::vector< uint32_t > _dataBuffer
static const uint32_t HELLO
unsigned int _protocolVersion
std::atomic< uint32_t > _helloCount
void sendSingleWord(int32_t response)
void readRegisterAndSendData(std::vector< uint32_t > &buffer)
static const uint32_t PING
static const uint32_t PONG
static const uint32_t MULTI_WORD_READ
static const int32_t READ_SUCCESS_INDICATION
std::unique_ptr< DummyProtocolImplementor > _protocolImplementor
static const int BUFFER_SIZE_IN_WORDS
virtual ~RebotDummySession()
static const int32_t UNKNOWN_INSTRUCTION
static const uint32_t SINGLE_WORD_WRITE
std::shared_ptr< DummyBackend > _registerSpace
std::atomic< bool > _dont_answer
static const uint32_t REBOT_MAGIC_WORD
std::atomic< bool > stop_rebot_server