23 #define DCOPSERVER_H "$Id$"
28 #include <tqsocketnotifier.h>
29 #include <tqptrlist.h>
30 #include <tqvaluelist.h>
31 #include <tqcstring.h>
33 #include <tqptrdict.h>
34 #include <tqintdict.h>
35 #include <tqapplication.h>
41 #include <KDE-ICE/ICElib.h>
43 #include <KDE-ICE/ICEutil.h>
44 #include <KDE-ICE/ICEmsg.h>
45 #include <KDE-ICE/ICEproto.h>
50 class DCOPSignalConnectionList;
65 typedef TQValueList<TQCString> QCStringList;
70 class DCOPConnection :
public TQSocketNotifier
73 DCOPConnection( IceConn conn );
76 DCOPSignalConnectionList *signalConnectionList();
80 void waitForOutputReady(
const TQByteArray &_data,
int start);
84 void slotOutputReady();
101 TQPtrList <_IceConn> waitingOnReply;
102 TQPtrList <_IceConn> waitingForReply;
103 TQPtrList <_IceConn> waitingForDelayedReply;
104 DCOPSignalConnectionList *_signalConnectionList;
107 TQValueList <TQByteArray> outputBuffer;
108 unsigned long outputBufferStart;
109 TQSocketNotifier *outputBufferNotifier;
116 class DCOPServer :
public TQObject
120 DCOPServer(
bool _suicide);
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 );
128 bool receive(
const TQCString &app,
const TQCString &obj,
129 const TQCString &fun,
const TQByteArray& data,
130 TQCString& replyType, TQByteArray &replyData, IceConn iceConn);
132 DCOPConnection *findApp(
const TQCString &appId);
133 DCOPConnection *findConn(IceConn iceConn)
134 {
return clients.find(iceConn); }
136 void sendMessage(DCOPConnection *conn,
const TQCString &sApp,
137 const TQCString &rApp,
const TQCString &rObj,
138 const TQCString &rFun,
const TQByteArray &data);
141 void newClient(
int socket );
142 void processData(
int socket );
143 void slotTerminate();
147 void slotCleanDeadConnections();
148 void slotOutputReady(
int socket );
152 static BOOL WINAPI dcopServerConsoleProc(DWORD dwCtrlType);
154 static DWORD WINAPI TerminatorThread(
void * pParam);
157 void broadcastApplicationRegistration( DCOPConnection* conn,
const TQCString type,
158 const TQCString& data );
162 int currentClientNumber;
164 DCOPSignals *dcopSignals;
166 TQTimer *m_deadConnectionTimer;
167 TQPtrList<DCOPListener> listener;
168 TQAsciiDict<DCOPConnection> appIds;
169 TQPtrDict<DCOPConnection> clients;
170 TQIntDict<DCOPConnection> fd_clients;
171 TQPtrList<_IceConn> deadConnections;
174 HANDLE m_evTerminate;
175 HANDLE m_hTerminateThread;
176 DWORD m_dwTerminateThreadId;
180 TQTextStream *m_stream;
185 extern DCOPServer* the_server;