diff options
Diffstat (limited to 'server.h')
-rw-r--r-- | server.h | 33 |
1 files changed, 33 insertions, 0 deletions
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 <boost/asio.hpp> +#include <boost/bind.hpp> + +#include <list> + +class Server { + private: + boost::asio::ip::tcp::acceptor acceptor; + std::list<Connection::p> 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 |