• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • dcop
 

dcop

  • dcop
dcopserver.h
1 /*
2 Copyright (c) 1999 Preston Brown <pbrown@kde.org>
3 Copyright (c) 1999 Matthias Ettrich <ettrich@kde.org>
4 
5 Permission is hereby granted, free of charge, to any person obtaining a copy
6 of this software and associated documentation files (the "Software"), to deal
7 in the Software without restriction, including without limitation the rights
8 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 copies of the Software, and to permit persons to whom the Software is
10 furnished to do so, subject to the following conditions:
11 
12 The above copyright notice and this permission notice shall be included in
13 all copies or substantial portions of the Software.
14 
15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
19 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 */
22 #ifndef DCOPSERVER_H
23 #define DCOPSERVER_H "$Id$"
24 
25 #include <tqobject.h>
26 
27 #include <tqstring.h>
28 #include <tqsocketnotifier.h>
29 #include <tqptrlist.h>
30 #include <tqvaluelist.h>
31 #include <tqcstring.h>
32 #include <tqdict.h>
33 #include <tqptrdict.h>
34 #include <tqintdict.h>
35 #include <tqapplication.h>
36 
37 #define INT32 QINT32
38 #ifdef Q_WS_X11
39 #include <X11/Xlib.h>
40 #include <X11/Xmd.h>
41 #endif
42 #include <KDE-ICE/ICElib.h>
43 extern "C" {
44 #include <KDE-ICE/ICEutil.h>
45 #include <KDE-ICE/ICEmsg.h>
46 #include <KDE-ICE/ICEproto.h>
47 }
48 
49 class DCOPConnection;
50 class DCOPListener;
51 class DCOPSignalConnectionList;
52 class DCOPSignals;
53 class TQTimer;
54 
55 // If you enable the following define DCOP will create
56 // $HOME/.dcop.log file which will list all signals passing
57 // through it.
58 // #define DCOP_LOG
59 #ifdef DCOP_LOG
60 class TQTextStream;
61 class TQFile;
62 #endif
63 
64 #define NDEBUG
65 
66 typedef TQValueList<TQCString> QCStringList;
67 
71 class DCOPConnection : public TQSocketNotifier
72 {
73 public:
74  DCOPConnection( IceConn conn );
75  ~DCOPConnection();
76 
77  DCOPSignalConnectionList *signalConnectionList();
78 
79  // Add the data from offset @p start in @p _data to the output
80  // buffer and schedule it for later transmission.
81  void waitForOutputReady(const TQByteArray &_data, int start);
82 
83  // Called from DCOPServer::slotOutputReady()
84  // Flush the output buffer.
85  void slotOutputReady();
86 
87  TQCString appId;
88  TQCString plainAppId;
89  IceConn iceConn;
90  int notifyRegister;
102  TQPtrList <_IceConn> waitingOnReply;
103  TQPtrList <_IceConn> waitingForReply;
104  TQPtrList <_IceConn> waitingForDelayedReply;
105  DCOPSignalConnectionList *_signalConnectionList;
106  bool daemon;
107  bool outputBlocked;
108  TQValueList <TQByteArray> outputBuffer;
109  unsigned long outputBufferStart;
110  TQSocketNotifier *outputBufferNotifier;
111 };
112 
113 
117 class DCOPServer : public TQObject
118 {
119  Q_OBJECT
120 public:
121  DCOPServer(bool _suicide);
122  ~DCOPServer();
123 
124  void* watchConnection( IceConn iceConn );
125  void removeConnection( void* data );
126  void processMessage( IceConn iceConn, int opcode, unsigned long length, Bool swap);
127  void ioError( IceConn iceConn );
128 
129  bool receive(const TQCString &app, const TQCString &obj,
130  const TQCString &fun, const TQByteArray& data,
131  TQCString& replyType, TQByteArray &replyData, IceConn iceConn);
132 
133  DCOPConnection *findApp(const TQCString &appId);
134  DCOPConnection *findConn(IceConn iceConn)
135  { return clients.find(iceConn); }
136 
137  void sendMessage(DCOPConnection *conn, const TQCString &sApp,
138  const TQCString &rApp, const TQCString &rObj,
139  const TQCString &rFun, const TQByteArray &data);
140 
141 private slots:
142  void newClient( int socket );
143  void processData( int socket );
144  void slotTerminate();
145  void slotSuicide();
146  void slotShutdown();
147  void slotExit();
148  void slotCleanDeadConnections();
149  void slotOutputReady(int socket );
150 
151 #ifdef Q_OS_WIN
152 public:
153  static BOOL WINAPI dcopServerConsoleProc(DWORD dwCtrlType);
154 private:
155  static DWORD WINAPI TerminatorThread(void * pParam);
156 #endif
157 private:
158  void broadcastApplicationRegistration( DCOPConnection* conn, const TQCString type,
159  const TQCString& data );
160  bool suicide;
161  bool shutdown;
162  int majorOpcode;
163  int currentClientNumber;
164  CARD32 serverKey;
165  DCOPSignals *dcopSignals;
166  TQTimer *m_timer;
167  TQTimer *m_deadConnectionTimer;
168  TQPtrList<DCOPListener> listener;
169  TQAsciiDict<DCOPConnection> appIds; // index on app id
170  TQPtrDict<DCOPConnection> clients; // index on iceConn
171  TQIntDict<DCOPConnection> fd_clients; // index on fd
172  TQPtrList<_IceConn> deadConnections;
173 
174 #ifdef Q_OS_WIN
175  HANDLE m_evTerminate;
176  HANDLE m_hTerminateThread;
177  DWORD m_dwTerminateThreadId;
178 #endif
179 
180 #ifdef DCOP_LOG
181  TQTextStream *m_stream;
182  TQFile *m_logger;
183 #endif
184 };
185 
186 extern DCOPServer* the_server;
187 
188 #endif

dcop

Skip menu "dcop"
  • Main Page
  • Modules
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

dcop

Skip menu "dcop"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  •     tdecore
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  • tdeioslave
  •   http
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for dcop by doxygen 1.8.8
This website is maintained by Timothy Pearson.