From 9fa6460f22be5482239d0b903af985a519f77166 Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Wed, 1 Jun 2011 19:28:24 +0200 Subject: Initial commit. --- server.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 server.h (limited to 'server.h') diff --git a/server.h b/server.h new file mode 100644 index 0000000..8b0f637 --- /dev/null +++ b/server.h @@ -0,0 +1,33 @@ +#ifndef SERVER_H +#define SERVER_H + +#include "connection.h" +#include "terrain_cache.h" + +#include +#include + +#include + +class Server { + private: + boost::asio::ip::tcp::acceptor acceptor; + std::list clients; + + TerrainCache::p cache; + + public: + Server(boost::asio::io_service& io_service); + + void run(); + void start_accept(); + + void handle_connect(Connection::p connection); + void async_read(Connection::p connection); + void handle_message(const boost::system::error_code& error, size_t bytes_transferred, Connection::p connection, uint8_t *_type); + + void handle_pos(Connection::p c); + void handle_chunk(Connection::p c); +}; + +#endif -- cgit v1.2.3