• 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 #ifdef TQ_WS_X11
38 #include <X11/Xlib.h>
39 #include <X11/Xmd.h>
40 #endif
41 #include <KDE-ICE/ICElib.h>
42 extern "C" {
43 #include <KDE-ICE/ICEutil.h>
44 #include <KDE-ICE/ICEmsg.h>
45 #include <KDE-ICE/ICEproto.h>
46 }
47 
48 class DCOPConnection;
49 class DCOPListener;
50 class DCOPSignalConnectionList;
51 class DCOPSignals;
52 class TQTimer;
53 
54 // If you enable the following define DCOP will create
55 // $HOME/.dcop.log file which will list all signals passing
56 // through it.
57 // #define DCOP_LOG
58 #ifdef DCOP_LOG
59 class TQTextStream;
60 class TQFile;
61 #endif
62 
63 #define NDEBUG
64 
65 typedef TQValueList<TQCString> QCStringList;
66 
70 class DCOPConnection : public TQSocketNotifier
71 {
72 public:
73  DCOPConnection( IceConn conn );
74  ~DCOPConnection();
75 
76  DCOPSignalConnectionList *signalConnectionList();
77 
78  // Add the data from offset @p start in @p _data to the output
79  // buffer and schedule it for later transmission.
80  void waitForOutputReady(const TQByteArray &_data, int start);
81 
82  // Called from DCOPServer::slotOutputReady()
83  // Flush the output buffer.
84  void slotOutputReady();
85 
86  TQCString appId;
87  TQCString plainAppId;
88  IceConn iceConn;
89  int notifyRegister;
101  TQPtrList <_IceConn> waitingOnReply;
102  TQPtrList <_IceConn> waitingForReply;
103  TQPtrList <_IceConn> waitingForDelayedReply;
104  DCOPSignalConnectionList *_signalConnectionList;
105  bool daemon;
106  bool outputBlocked;
107  TQValueList <TQByteArray> outputBuffer;
108  unsigned long outputBufferStart;
109  TQSocketNotifier *outputBufferNotifier;
110 };
111 
112 
116 class DCOPServer : public TQObject
117 {
118  TQ_OBJECT
119 public:
120  DCOPServer(bool _suicide);
121  ~DCOPServer();
122 
123  void* watchConnection( IceConn iceConn );
124  void removeConnection( void* data );
125  void processMessage( IceConn iceConn, int opcode, unsigned long length, Bool swap);
126  void ioError( IceConn iceConn );
127 
128  bool receive(const TQCString &app, const TQCString &obj,
129  const TQCString &fun, const TQByteArray& data,
130  TQCString& replyType, TQByteArray &replyData, IceConn iceConn);
131 
132  DCOPConnection *findApp(const TQCString &appId);
133  DCOPConnection *findConn(IceConn iceConn)
134  { return clients.find(iceConn); }
135 
136  void sendMessage(DCOPConnection *conn, const TQCString &sApp,
137  const TQCString &rApp, const TQCString &rObj,
138  const TQCString &rFun, const TQByteArray &data);
139 
140 private slots:
141  void newClient( int socket );
142  void processData( int socket );
143  void slotTerminate();
144  void slotSuicide();
145  void slotShutdown();
146  void slotExit();
147  void slotCleanDeadConnections();
148  void slotOutputReady(int socket );
149 
150 #ifdef Q_OS_WIN
151 public:
152  static BOOL WINAPI dcopServerConsoleProc(DWORD dwCtrlType);
153 private:
154  static DWORD WINAPI TerminatorThread(void * pParam);
155 #endif
156 private:
157  void broadcastApplicationRegistration( DCOPConnection* conn, const TQCString type,
158  const TQCString& data );
159  bool suicide;
160  bool shutdown;
161  int majorOpcode;
162  int currentClientNumber;
163  CARD32 serverKey;
164  DCOPSignals *dcopSignals;
165  TQTimer *m_timer;
166  TQTimer *m_deadConnectionTimer;
167  TQPtrList<DCOPListener> listener;
168  TQAsciiDict<DCOPConnection> appIds; // index on app id
169  TQPtrDict<DCOPConnection> clients; // index on iceConn
170  TQIntDict<DCOPConnection> fd_clients; // index on fd
171  TQPtrList<_IceConn> deadConnections;
172 
173 #ifdef Q_OS_WIN
174  HANDLE m_evTerminate;
175  HANDLE m_hTerminateThread;
176  DWORD m_dwTerminateThreadId;
177 #endif
178 
179 #ifdef DCOP_LOG
180  TQTextStream *m_stream;
181  TQFile *m_logger;
182 #endif
183 };
184 
185 extern DCOPServer* the_server;
186 
187 #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
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for dcop by doxygen 1.9.1
This website is maintained by Timothy Pearson.