nxcl  @VERSION@
nxcl.h
Go to the documentation of this file.
1 /* -*-c++-*- */
2 /***************************************************************************
3  nxcl: The NXCL dbus daemon.
4  -------------------
5  begin : June 2007
6  copyright : (C) 2007 Embedded Software Foundry Ltd. (U.K.)
7  : Author: Sebastian James
8  email : seb@esfnet.co.uk
9  ***************************************************************************/
10 
11 /***************************************************************************
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * *
18  ***************************************************************************/
19 
27 #ifndef _NXCL_H_
28 #define _NXCL_H_ 1
29 
30 #include "nxdata.h"
31 #include "../lib/nxclientlib.h"
32 
33 /* This define is required for slightly older versions of dbus as
34  * found, for example, in Ubuntu 6.06. */
35 #define DBUS_API_SUBJECT_TO_CHANGE 1
36 extern "C" {
37 #include <dbus/dbus.h>
38 }
39 
40 using namespace std;
41 
42 namespace nxcl
43 {
44 
45  class NxclBase
46  {
47  public:
48  NxclBase() {}
49  virtual ~NxclBase() {}
50 
51  virtual void haveResumableSessions (list<NXResumeData> resumeData) {}
52  virtual void noResumableSessions (void) {}
53  virtual void serverCapacityReached (void) {}
54  virtual void sendDbusInfoMsg (string&) {}
55  virtual void sendDbusInfoMsg (int, string&) {}
56  virtual void sendDbusErrorMsg (string&) {}
57  };
58 
60  {
61  public:
62  NxclCallbacks ();
63  ~NxclCallbacks ();
64 
71  void write (string msg);
85  void write (int num, string msg);
89  void error (string msg);
94  void debug (string msg);
103  void stdoutSignal (string msg);
108  void stderrSignal (string msg);
114  void stdinSignal (string msg);
120  void resumeSessionsSignal (list<NXResumeData> resumeData);
127  void noSessionsSignal (void);
137  void serverCapacitySignal (void);
138 
142  void setParent (NxclBase * p) { this->parent = p; }
143  private:
144  NxclBase * parent;
145 
146  };
147 
148  class Nxcl : public NxclBase
149  {
150  public:
151  Nxcl();
152  Nxcl(int n);
153  ~Nxcl();
154 
155  // Public Methods
168  void setupDbus (void);
176  void setupDbus (int id);
188  int receiveSettings (void);
192  void setSessionDefaults (void);
201  void startTheNXConnection (void);
202 
203  // Accessors
205  NXClientLib* getNXClientLib (void) { return &(this->nxclientlib); }
207 
208  // Public Slots
210 
213  void haveResumableSessions (list<NXResumeData> resumable);
217  void noResumableSessions (void);
227  void requestConfirmation (string msg);
237  void sendDbusInfoMsg (string& info);
244  void sendDbusInfoMsg (int num, string& info);
248  void sendDbusErrorMsg (string& errorMsg);
250 
255 
256  private:
262  void initiate (void);
276  void sendResumeList (list<NXResumeData>& resumable);
287  void receiveStartInstruction (void);
288 
293  NXClientLib nxclientlib;
299  NXSessionData sessionData;
303  DBusConnection *conn;
307  DBusError error;
312  int dbusNum;
316  string dbusName;
320  string dbusMatch;
324  string dbusMatchInterface;
328  string dbusSendInterface;
333  string nxuser;
338  string nxpass;
343  string nxserver;
348  int nxport;
352  int xRes;
356  int yRes;
360  int displayDepth;
361  };
362 
363 } // namespace
364 
365 #endif // ifndef _NXCL_H_
nxcl::NxclCallbacks::resumeSessionsSignal
void resumeSessionsSignal(list< NXResumeData > resumeData)
nxcl::Nxcl::startTheNXConnection
void startTheNXConnection(void)
Configure the.
nxcl::Nxcl::callbacks
NxclCallbacks callbacks
Definition: nxcl.h:254
nxcl::Nxcl::setSessionDefaults
void setSessionDefaults(void)
Set default values for.
nxcl::Nxcl::requestConfirmation
void requestConfirmation(string msg)
nxcl::NXSessionData
Definition: nxdata.h:75
nxcl::Nxcl::noResumableSessions
void noResumableSessions(void)
nxcl::Nxcl::haveResumableSessions
void haveResumableSessions(list< NXResumeData > resumable)
nxcl::NxclCallbacks::error
void error(string msg)
nxcl::Nxcl
Definition: nxcl.h:149
nxcl::NxclCallbacks::stdinSignal
void stdinSignal(string msg)
nxcl::NxclCallbacks::write
void write(string msg)
nxcl::NxclCallbacks::stderrSignal
void stderrSignal(string msg)
nxcl::NxclBase
Definition: nxcl.h:46
nxcl::NXClientLibExternalCallbacks
Definition: nxclientlib.h:53
nxcl::Nxcl::sendDbusInfoMsg
void sendDbusInfoMsg(int num, string &info)
nxcl::NxclCallbacks
Definition: nxcl.h:60
nxcl::Nxcl::sendDbusInfoMsg
void sendDbusInfoMsg(string &info)
nxcl::NxclCallbacks::setParent
void setParent(NxclBase *p)
Definition: nxcl.h:142
nxcl::NxclCallbacks::stdoutSignal
void stdoutSignal(string msg)
nxcl::Nxcl::setupDbus
void setupDbus(int id)
Sets dbusNum to be.
nxcl::NxclCallbacks::noSessionsSignal
void noSessionsSignal(void)
nxcl::Nxcl::serverCapacityReached
void serverCapacityReached(void)
nxcl::NxclCallbacks::serverCapacitySignal
void serverCapacitySignal(void)
nxcl::NxclCallbacks::write
void write(int num, string msg)
nxcl::Nxcl::receiveSettings
int receiveSettings(void)
Wait for a dbus message containing session settings.
nxcl::Nxcl::sendDbusErrorMsg
void sendDbusErrorMsg(string &errorMsg)
nxcl::NXClientLib
Definition: nxclientlib.h:150
nxcl::NxclCallbacks::debug
void debug(string msg)
nxcl::Nxcl::setupDbus
void setupDbus(void)
Sets up a connection to the dbus daemon, based on the member attribute.