// socket_driver.h #ifndef HAVE_SOCKET_DRIVER_H #define HAVE_SOCKET_DRIVER_H #include "common/config.h" #include "common/string.h" #include "socket.h" #include "client_socket.h" #include "common/mudhelp.h" class SocketDriver : public Socket { public: SocketDriver(); ~SocketDriver(); const INT get_number_of_connections() { return clientlist.size(); } void shutdown_connection(const INT& index); void new_connection(); // for multiple lines of output to client, pass 'false' as 3rd arg, otherwise just pass 2 args void write_to(const INT& fd, STRING msg, BOOL flushSocket = true); // pointers are evil.. ClientSocket *get_client_ptr(const INT& index); const INT find_client_by_name(const STRING& name); void parse_in_buffer(const INT& index); // client login procedure void process_login(const INT& index); // flush client's out_buffer BOOL flush_output(const INT& index); // broadcast function void broadcast(const STRING& omsg, const INT& index, const STRING& mmsg, BOOL includeIndex = true); const STRING get_stats(); const STRING get_client_idle_time(const INT& index); const STRING get_client_connected_time(const INT& index); private: std::vector clientlist; // ANSI color parsing void colorparse(STRING &text, BOOL colorblind); // these hold driver read/write totals DOUBLE stat_read, stat_write; }; #endif // HAVE_SOCKET_DRIVER_H