Main Page | Class Hierarchy | Class List | Directories | File List | Class Members

nxsession.h

00001 /* -*-c++-*- */
00002 /***************************************************************************
00003                                  nxsession.h
00004                              -------------------
00005     begin                : Sat 22nd July 2006
00006     modifications        : July 2007
00007     copyright            : (C) 2006 by George Wright
00008     modifications        : (C) 2007 Embedded Software Foundry Ltd. (U.K.)
00009                          :     Author: Sebastian James
00010     email                : seb@esfnet.co.uk, gwright@kde.org
00011  ***************************************************************************/
00012 
00013 /***************************************************************************
00014  *                                                                         *
00015  *   This program is free software; you can redistribute it and/or modify  *
00016  *   it under the terms of the GNU General Public License as published by  *
00017  *   the Free Software Foundation; either version 2 of the License, or     *
00018  *   (at your option) any later version.                                   *
00019  *                                                                         *
00020  ***************************************************************************/
00021 
00022 #ifndef _NXSESSION_H_
00023 #define _NXSESSION_H_
00024 
00025 #include <sstream>
00026 #include <fstream>
00027 #include <fcntl.h>
00028 #include <unistd.h>
00029 #include "nxdata.h"
00030 #include <list>
00031 
00032 namespace nxcl {
00033 
00038         class NXSessionCallbacks
00039         {
00040         public:
00041                 NXSessionCallbacks() {}
00042                 virtual ~NXSessionCallbacks() {}
00043                 virtual void noSessionsSignal (void) {}
00044                 virtual void loginFailedSignal (void) {}
00045                 virtual void readyForProxySignal (void) {}
00050                 virtual void authenticatedSignal (void) {}
00051                 virtual void sessionsSignal (list<NXResumeData>) {}
00052         };
00053 
00058         class NXSession
00059         {
00060         public:
00061                 NXSession();
00062                 ~NXSession();
00063                 
00064                 string parseSSH (string);
00065                 int parseResponse (string);
00066                 void parseResumeSessions (list<string>);
00067                 void resetSession (void);
00068                 void wipeSessions (void);
00069                 bool chooseResumable (int n);
00070                 bool terminateSession (int n);
00071                 string generateCookie (void);
00072 
00077                 void setUsername (string& user) { nxUsername = user; }
00078                 void setPassword (string& pass) { nxPassword = pass; }
00079                 void setResolution (int x, int y) {
00080                         if (this->sessionDataSet) {
00081                                 this->sessionData->xRes = x;
00082                                 this->sessionData->yRes = y;
00083                         }
00084                 }
00085                 void setDepth (int d) { if (this->sessionDataSet) {this->sessionData->depth = d;} }
00086                 void setRender (bool isRender) { if (this->sessionDataSet) {this->sessionData->render = isRender;} }
00087                 void setEncryption (bool enc) { if (this->sessionDataSet) {this->sessionData->encryption = enc;} }
00088 
00089                 void setContinue (bool allow) { doSSH = allow; }
00090                 void setSessionData (NXSessionData*);
00091                 bool getSessionDataSet (void) { return this->sessionDataSet; }
00092                 void setCallbacks (NXSessionCallbacks * cb) { this->callbacks = cb; }
00094                 
00095         private:
00096                 void reset (void);
00097                 void fillRand(unsigned char *, size_t);
00098 
00105                 bool doSSH;
00110                 bool suspendedSessions;
00114                 bool sessionDataSet;
00120                 int stage;
00124                 int devurand_fd;
00128                 string nxUsername;
00132                 string nxPassword;
00136                 list<string> resumeSessions;
00141                 list<NXResumeData> runningSessions;
00145                 NXSessionData *sessionData;
00149                 NXSessionCallbacks * callbacks;
00150         };
00151 
00152 } // namespace
00153 #endif

Generated on Wed Oct 17 10:08:25 2007 for nxcl by  doxygen 1.4.2