// daemon/Session.hh // This file is part of Anyterm; see http://anyterm.org/ // (C) 2005-2006 Philip Endecott // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef Session_hh #define Session_hh //#define __STDC_LIMIT_MACROS //#include #include "SessionId.hh" #include #include #include #include #include #include typedef boost::mutex Mutex; typedef boost::condition Condition; #include "Screen.hh" #include "Terminal.hh" #include "Activity.hh" #include "Iconver.hh" class Session: boost::noncopyable { public: const SessionId id; const int rows; const int cols; const int scrollback; const int time_out; const std::string charset; const bool diff; private: pbe::Iconver utf8_to_charset; pbe::Iconver charset_to_ucs4; pbe::Iconver ucs4_to_utf8; public: Screen screen; Mutex screen_lock; volatile bool dirty; Condition dirty_condition; /*volatile*/ std::string error_msg; volatile bool error; ucs4_string old_html_screen; volatile time_t last_access; Terminal term; boost::scoped_ptr activity; typedef boost::function activityfactory_t; Session(int r, int c, int sb, std::string host, std::string user, std::string param, int t, activityfactory_t activityfactory, std::string charset_, bool diff_); ~Session(); void touch(void); void report_any_backend_error(void); void send(std::string k); std::string rcv(void); bool timed_out(void); private: void process_output(std::string s); void process_error(std::string s); }; #endif