summaryrefslogtreecommitdiff
path: root/server.h
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2011-06-01 19:28:24 +0200
committerJon Bergli Heier <snakebite@jvnv.net>2011-06-01 19:28:24 +0200
commit9fa6460f22be5482239d0b903af985a519f77166 (patch)
tree7f4be0d51977ad90b184cd01aa9300f8efd2eb4d /server.h
Initial commit.
Diffstat (limited to 'server.h')
-rw-r--r--server.h33
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