#ifndef CHAT_H #define CHAT_H #ifndef _GLIBCXX_STRING #include #endif #ifndef _NETINET_IN_H #include #endif typedef enum { NO_MODE = 0, SERVER_MODE = 1, CLIENT_MODE = 2 } chatmode_t; typedef struct { sockaddr_in new_addr; socklen_t new_addr_siz; int aux; }wclient_args_t; const int CURSOR_DEFAULT_POSITION_X = 2; const int CURSOR_DEFAULT_POSITION_Y = 12; const int LOG_LENGTH = 10; int line_position = 0; struct timeval time_start; struct timeval time_end; int bytes_read; int bytes_written; int listen_port = 9999; std::string listen_ip_address = "127.0.0.1"; std::string log_path; int socket_descriptor_server; int socket_descriptor_client; pthread_t client_wait_thread; void *await_client(void *a); void clear_rows(int s, int e); int count_lines(std::string p); int file_disp(std::string p, int lnstart, int lncount = 10); int log_append(std::string p, std::string ln); int log_linect(std::string p); void client_start(void); void client_stop(void); void *poll_client(void); void *poll_server(void *a); void server_start(int port); void server_stop(void); #endif