dcopserver.h Source File (dcop Library)

| # dcop Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# dcopserver.h

    00001 /*
    00002 Copyright (c) 1999 Preston Brown <pbrown@kde.org>
    00003 Copyright (c) 1999 Matthias Ettrich <ettrich@kde.org>
    00004
    00005 Permission is hereby granted, free of charge, to any person obtaining a copy
    00006 of this software and associated documentation files (the "Software"), to deal
    00007 in the Software without restriction, including without limitation the rights
    00008 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    00009 copies of the Software, and to permit persons to whom the Software is
    00010 furnished to do so, subject to the following conditions:
    00011
    00012 The above copyright notice and this permission notice shall be included in
    00013 all copies or substantial portions of the Software.
    00014
    00015 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    00016 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    00017 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
    00018 AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
    00019 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
    00020 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    00021 */
    00022 #ifndef DCOPSERVER_H
    00023 #define DCOPSERVER_H "$Id: dcopserver.h,v 1.33 2002/01/04 11:03:18 lunakl Exp $"
    00024
    00025 #include <qobject.h>
    00026 #include <qstring.h>
    00027 #include <qsocketnotifier.h>
    00028 #include <qptrlist.h>
    00029 #include <qvaluelist.h>
    00030 #include <qcstring.h>
    00031 #include <qdict.h>
    00032 #include <qptrdict.h>
    00033 #include <qintdict.h>
    00034 #include <qapplication.h>
    00035
    00036 #define INT32 QINT32
    00037 #ifdef Q_WS_X11
    00038 #include <X11/Xlib.h>
    00039 #include <X11/Xmd.h>
    00040 #endif
    00041 #include <KDE-ICE/ICElib.h>
    00042 extern "C" {
    00043 #include <KDE-ICE/ICEutil.h>
    00044 #include <KDE-ICE/ICEmsg.h>
    00045 #include <KDE-ICE/ICEproto.h>
    00046 }
    00047
    00048 class DCOPConnection;
    00049 class DCOPListener;
    00050 class DCOPSignalConnectionList;
    00051 class DCOPSignals;
    00052 class QTimer;
    00053
    00054 typedef QValueList<QCString> QCStringList;
    00055
    00059 class DCOPConnection : public QSocketNotifier
    00060 {
    00061 public:
    00062     DCOPConnection( IceConn conn );
    00063     ~DCOPConnection();
    00064
    00065     DCOPSignalConnectionList *signalConnectionList();
    00066
    00067     // Add the data from offset @p start in @p _data to the output
    00068     // buffer and schedule it for later transmission.
    00069     void waitForOutputReady(const QByteArray &_data, int start);
    00070
    00071     // Called from DCOPServer::slotOutputReady()
    00072     // Flush the output buffer.
    00073     void slotOutputReady();
    00074
    00075     QCString appId;
    00076     QCString plainAppId;
    00077     IceConn iceConn;
    00078     int notifyRegister;
    00090     QPtrList <_IceConn> waitingOnReply;
    00091     QPtrList <_IceConn> waitingForReply;
    00092     QPtrList <_IceConn> waitingForDelayedReply;
    00093     DCOPSignalConnectionList *_signalConnectionList;
    00094     bool daemon;
    00095     bool outputBlocked;
    00096     QValueList <QByteArray> outputBuffer;
    00097     unsigned long outputBufferStart;
    00098     QSocketNotifier *outputBufferNotifier;
    00099 };
    00100
    00101
    00105 class DCOPServer : public QObject
    00106 {
    00107     Q_OBJECT
    00108 public:
    00109     DCOPServer(bool _only_local, bool _suicide);
    00110     ~DCOPServer();
    00111
    00112     void* watchConnection( IceConn iceConn );
    00113     void removeConnection( void* data );
    00114     void processMessage( IceConn iceConn, int opcode, unsigned long length, Bool swap);
    00115     void ioError( IceConn iceConn );
    00116
    00117     bool receive(const QCString &app, const QCString &obj,
    00118                  const QCString &fun, const QByteArray& data,
    00119                  QCString& replyType, QByteArray &replyData, IceConn iceConn);
    00120
    00121     DCOPConnection *findApp(const QCString &appId);
    00122     DCOPConnection *findConn(IceConn iceConn)
    00123        { return clients.find(iceConn); }
    00124
    00125     void sendMessage(DCOPConnection *conn, const QCString &sApp,
    00126                      const QCString &rApp, const QCString &rObj,
    00127                      const QCString &rFun, const QByteArray &data);
    00128
    00129 private slots:
    00130     void newClient( int socket );
    00131     void processData( int socket );
    00132     void slotTerminate();
    00133     void slotSuicide();
    00134     void slotCleanDeadConnections();
    00135     void slotOutputReady(int socket );
    00136
    00137 private:
    00138     void broadcastApplicationRegistration( DCOPConnection* conn, const QCString type,
    00139         const QString& data );
    00140     bool suicide;
    00141     int majorOpcode;
    00142     int currentClientNumber;
    00143     CARD32 serverKey;
    00144     DCOPSignals *dcopSignals;
    00145     QTimer *m_timer;
    00146     QTimer *m_deadConnectionTimer;
    00147     QPtrList<DCOPListener> listener;
    00148     QAsciiDict<DCOPConnection> appIds; // index on app id
    00149     QPtrDict<DCOPConnection> clients; // index on iceConn
    00150     QIntDict<DCOPConnection> fd_clients; // index on fd
    00151     QPtrList<_IceConn> deadConnections;
    00152 };
    00153
    00154 extern DCOPServer* the_server;
    00155
    00156 #endif

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 12:42:41 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001