summaryrefslogtreecommitdiff
path: root/telnet_connection.h
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2010-12-31 01:25:38 +0100
committerJon Bergli Heier <snakebite@jvnv.net>2010-12-31 01:25:38 +0100
commit0e7f2cef26bde782a5758b5e9a3dfe20f745df8f (patch)
tree736b53010218fba8134a1660c7a3ad5ef998f01c /telnet_connection.h
parentb439fcd1916cef267bde32f3424d8311519d3d16 (diff)
Added an echoing telnet server as a base for a telnet command interface.
Diffstat (limited to 'telnet_connection.h')
-rw-r--r--telnet_connection.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/telnet_connection.h b/telnet_connection.h
new file mode 100644
index 0000000..8ea3cad
--- /dev/null
+++ b/telnet_connection.h
@@ -0,0 +1,26 @@
+#ifndef TELNET_CONNECTION_H
+#define TELNET_CONNECTION_H
+
+#include <boost/asio.hpp>
+#include <boost/enable_shared_from_this.hpp>
+
+using boost::asio::ip::tcp;
+
+namespace telnet {
+ class Connection : public boost::enable_shared_from_this<Connection> {
+ friend class Server;
+
+ private:
+ Connection(boost::asio::io_service& io_service);
+ void handle_read(const boost::system::error_code& error, size_t bytes_transferred);
+ tcp::socket socket;
+ boost::asio::streambuf buf;
+
+ public:
+ typedef boost::shared_ptr<Connection> p;
+
+ void start();
+ };
+};
+
+#endif