nxcl
1.0
|
00001 /* -*-c++-*- */ 00002 /*************************************************************************** 00003 nxcl: The NXCL dbus daemon. 00004 ------------------- 00005 begin : June 2007 00006 copyright : (C) 2007 Embedded Software Foundry Ltd. (U.K.) 00007 : Author: Sebastian James 00008 email : seb@esfnet.co.uk 00009 ***************************************************************************/ 00010 00011 /*************************************************************************** 00012 * * 00013 * This program is free software; you can redistribute it and/or modify * 00014 * it under the terms of the GNU General Public License as published by * 00015 * the Free Software Foundation; either version 2 of the License, or * 00016 * (at your option) any later version. * 00017 * * 00018 ***************************************************************************/ 00019 00027 #ifndef _NXCL_H_ 00028 #define _NXCL_H_ 1 00029 00030 #include "nxdata.h" 00031 #include "../lib/nxclientlib.h" 00032 00033 /* This define is required for slightly older versions of dbus as 00034 * found, for example, in Ubuntu 6.06. */ 00035 #define DBUS_API_SUBJECT_TO_CHANGE 1 00036 extern "C" { 00037 #include <dbus/dbus.h> 00038 } 00039 00040 using namespace std; 00041 00042 namespace nxcl 00043 { 00044 00045 class NxclBase 00046 { 00047 public: 00048 NxclBase() {} 00049 virtual ~NxclBase() {} 00050 00051 virtual void haveResumableSessions (list<NXResumeData> resumeData) {} 00052 virtual void noResumableSessions (void) {} 00053 virtual void serverCapacityReached (void) {} 00054 virtual void sendDbusInfoMsg (string&) {} 00055 virtual void sendDbusInfoMsg (int, string&) {} 00056 virtual void sendDbusErrorMsg (string&) {} 00057 }; 00058 00059 class NxclCallbacks : public NXClientLibExternalCallbacks 00060 { 00061 public: 00062 NxclCallbacks (); 00063 ~NxclCallbacks (); 00064 00071 void write (string msg); 00085 void write (int num, string msg); 00089 void error (string msg); 00094 void debug (string msg); 00103 void stdoutSignal (string msg); 00108 void stderrSignal (string msg); 00114 void stdinSignal (string msg); 00120 void resumeSessionsSignal (list<NXResumeData> resumeData); 00127 void noSessionsSignal (void); 00137 void serverCapacitySignal (void); 00138 00142 void setParent (NxclBase * p) { this->parent = p; } 00143 private: 00144 NxclBase * parent; 00145 00146 }; 00147 00148 class Nxcl : public NxclBase 00149 { 00150 public: 00151 Nxcl(); 00152 Nxcl(int n); 00153 ~Nxcl(); 00154 00155 // Public Methods 00168 void setupDbus (void); 00176 void setupDbus (int id); 00188 int receiveSettings (void); 00192 void setSessionDefaults (void); 00201 void startTheNXConnection (void); 00202 00203 // Accessors 00205 NXClientLib* getNXClientLib (void) { return &(this->nxclientlib); } 00207 00208 // Public Slots 00210 00213 void haveResumableSessions (list<NXResumeData> resumable); 00217 void noResumableSessions (void); 00227 void requestConfirmation (string msg); 00231 void serverCapacityReached (void); 00237 void sendDbusInfoMsg (string& info); 00244 void sendDbusInfoMsg (int num, string& info); 00248 void sendDbusErrorMsg (string& errorMsg); 00250 00254 NxclCallbacks callbacks; 00255 00256 private: 00262 void initiate (void); 00276 void sendResumeList (list<NXResumeData>& resumable); 00287 void receiveStartInstruction (void); 00288 00293 NXClientLib nxclientlib; 00299 NXSessionData sessionData; 00303 DBusConnection *conn; 00307 DBusError error; 00312 int dbusNum; 00316 string dbusName; 00320 string dbusMatch; 00324 string dbusMatchInterface; 00328 string dbusSendInterface; 00333 string nxuser; 00338 string nxpass; 00343 string nxserver; 00348 int nxport; 00352 int xRes; 00356 int yRes; 00360 int displayDepth; 00361 }; 00362 00363 } // namespace 00364 00365 #endif // ifndef _NXCL_H_