diff options
author | Vegard Storheil Eriksen <zyp@jvnv.net> | 2010-12-25 12:54:59 +0100 |
---|---|---|
committer | Vegard Storheil Eriksen <zyp@jvnv.net> | 2010-12-25 12:54:59 +0100 |
commit | fae209a9e93400c3a2072befda9c820634cf9278 (patch) | |
tree | 2d69e2c75fff0e08468c168f773abbc939a2ff03 /server/connection.h | |
parent | 94a1189d757f0269ac081ad2d750152e30564986 (diff) |
Diffstat (limited to 'server/connection.h')
-rw-r--r-- | server/connection.h | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/server/connection.h b/server/connection.h deleted file mode 100644 index b51a67f..0000000 --- a/server/connection.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef CONNECTION_H -#define CONNECTION_H - -#include <boost/asio.hpp> -#include <boost/enable_shared_from_this.hpp> -#include <boost/function.hpp> - -#include "../common/connectionbase.h" - -class Connection : public ConnectionBase, public boost::enable_shared_from_this<Connection> { - private: - friend class TCPServer; - friend class Client; - - boost::asio::ip::tcp::socket socket; - - boost::function<void (Message::p)> recv_callback; - boost::function<void (const std::string&)> error_callback; - - Connection(boost::asio::io_service& io_service); - - //! Callback for when data is read. - void handle_read(uint8_t* data, std::size_t bytes, const boost::system::error_code& error_code); - - //! Callback for when data is written. - void handle_write(); - - protected: - //! Implements request_data(). - virtual void request_data(std::size_t bytes); - - //! Implements write_data(). - virtual void write_data(uint8_t* data, std::size_t bytes); - - //! Implements got_message(). - virtual void got_message(const Message::p& msg); - - //! Implements error(). - virtual void error(const std::string& msg); - - public: - typedef boost::shared_ptr<Connection> p; - - //! Constructs a new instance and returns a shared pointer. - static p create(boost::asio::io_service& io_service); - - //! Initiates an asynchronous message receive. - //! \param callback Callback for received message. - //! \param error Callback for error. - void recv(boost::function<void (Message::p)> callback, boost::function<void (const std::string&)> error = 0); -}; - -#endif |