summaryrefslogtreecommitdiff
path: root/telnet_connection.h
blob: 2109b05840c632b86d04b2d2f78eb00f0cc699a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifndef TELNET_CONNECTION_H
#define TELNET_CONNECTION_H

#include <boost/asio.hpp>
#include <boost/enable_shared_from_this.hpp>

#include <vector>
#include <string>

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);
			bool parse_args(std::string& line, std::vector<std::string>& args);
			tcp::socket socket;
			boost::asio::streambuf buf;

		public:
			typedef boost::shared_ptr<Connection> p;

			void start();
	};
};

#endif