#ifndef __BETACORE_CLIENT_HPP__ #define __BETACORE_CLIENT_HPP__ #include #include #include #include #include #include #include #include #include #include #include #include #include "common.hpp" namespace betacore{ class Client{ private: bool _online = false; bool _running= false; char key = 'Z'; int _port; std::string _address; MODE _mode; int _client_socket; std::function _update; struct sockaddr_in _server_address; struct hostent * _server; std::string encode(const SHAPE &shape); std::string crypt(const std::string &shape); std::string raw(const SHAPE &shape); SHAPE parse(const std::string &message); SHAPE decode(const std::string &message); /** * Function for Thread for getting information from server */ void listener(); /** * Function for Thread for sending to server */ void sender(); void start(); void stop(); public: Client(MODE mode, int port, std::string address, std::function &update); void kill(); bool running(); void send(bool encrypt, SHAPE shape); }; } #endif