#ifndef __BETACORE_CLIENT_HPP__ #define __BETACORE_CLIENT_HPP__ #include #include #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 _url; MODE _mode; int _client_socket; std::function _update; struct sockaddr_in _server_address; struct hostent *_server; std::map lookup; std::vector explode(std::string &message); 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: /* * Create an instance of client */ Client( MODE mode, int port, std::string url, std::function &update); ~Client(); /* * Kill the server */ void kill(); /* * Running */ bool running(); /* * Send the shape encrypted or raw */ void send(bool encrypt, SHAPE shape); }; } // namespace betacore #endif