8 #include <boost/asio.hpp> 9 #include "protocol/protocol.h" 27 Client(boost::asio::io_service &io,
const boost::asio::ip::tcp::resolver::results_type& eps,
28 input_request_ptr request)
29 : io_service(io), sock(io), eps(eps)
31 std::cout <<
"ctor client" << std::endl;
32 do_connect(eps, request);
39 void write(
const std::string& message);
44 void write(text_request_ptr);
49 void write(join_room_request_ptr);
72 std::cout <<
"Destr client" << std::endl;
77 boost::asio::io_service &io_service;
78 boost::asio::ip::tcp::socket sock;
80 const boost::asio::ip::tcp::resolver::results_type& eps;
82 std::deque<packet_ptr> packets_to_server;
84 char login[Block::LoginName];
85 char password[Block::Password];
86 identifier_t client_id;
87 identifier_t room_id = 0;
95 input_request_ptr logon();
100 void do_connect(
const boost::asio::ip::tcp::resolver::results_type&, input_request_ptr);
106 void send_login_request(input_request_ptr request);
111 void read_response_header();
116 void read_response_data(registr_response_ptr);
122 void read_response_data(autor_response_ptr);
128 void read_response_data(text_response_ptr);
133 void send_request_header();
140 void send_request_data();
Client(boost::asio::io_service &io, const boost::asio::ip::tcp::resolver::results_type &eps, input_request_ptr request)
Construct a new Client object.
Definition: client.h:27
const char * get_login() const
Login getter.
Definition: client.h:61
void send_input_code(InputCode)
send input code
void write(const std::string &message)
Send text message.
Definition: client.cpp:26
Client class.
Definition: client.h:17
void close_connection()
Finish the communication with server.
Definition: client.cpp:3
~Client()
destructor
Definition: client.h:71
void set_login_id(identifier_t id)
Setter for client_id.
Definition: client.h:55
void send_text(const std::string &from, const std::string &text, DateTime dt)