author | kergoth <kergoth> | 2002-01-25 22:14:26 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2002-01-25 22:14:26 (UTC) |
commit | 15318cad33835e4e2dc620d033e43cd930676cdd (patch) (unidiff) | |
tree | c2fa0399a2c47fda8e2cd0092c73a809d17f68eb /core/launcher/qcopbridge.h | |
download | opie-15318cad33835e4e2dc620d033e43cd930676cdd.zip opie-15318cad33835e4e2dc620d033e43cd930676cdd.tar.gz opie-15318cad33835e4e2dc620d033e43cd930676cdd.tar.bz2 |
Initial revision
-rw-r--r-- | core/launcher/qcopbridge.h | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/core/launcher/qcopbridge.h b/core/launcher/qcopbridge.h new file mode 100644 index 0000000..114b3ee --- a/dev/null +++ b/core/launcher/qcopbridge.h | |||
@@ -0,0 +1,95 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of Qtopia Environment. | ||
5 | ** | ||
6 | ** This file may be distributed and/or modified under the terms of the | ||
7 | ** GNU General Public License version 2 as published by the Free Software | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
13 | ** | ||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
15 | ** | ||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
17 | ** not clear to you. | ||
18 | ** | ||
19 | **********************************************************************/ | ||
20 | #ifndef __qcopbridge_h__ | ||
21 | #define __qcopbridge_h__ | ||
22 | |||
23 | #include <qserversocket.h> | ||
24 | #include <qsocket.h> | ||
25 | #include <qdir.h> | ||
26 | #include <qfile.h> | ||
27 | #include <qbuffer.h> | ||
28 | |||
29 | class QFileInfo; | ||
30 | class QCopBridgePI; | ||
31 | class QCopChannel; | ||
32 | |||
33 | class QCopBridge : public QServerSocket | ||
34 | { | ||
35 | Q_OBJECT | ||
36 | |||
37 | public: | ||
38 | QCopBridge( Q_UINT16 port, QObject *parent = 0, const char* name = 0 ); | ||
39 | virtual ~QCopBridge(); | ||
40 | |||
41 | void newConnection( int socket ); | ||
42 | void closeOpenConnections(); | ||
43 | |||
44 | public slots: | ||
45 | void connectionClosed( QCopBridgePI *pi ); | ||
46 | void desktopMessage( const QCString &call, const QByteArray & ); | ||
47 | |||
48 | protected: | ||
49 | void timerEvent( QTimerEvent * ); | ||
50 | |||
51 | private: | ||
52 | QCopChannel *desktopChannel; | ||
53 | QCopChannel *cardChannel; | ||
54 | QList<QCopBridgePI> openConnections; | ||
55 | bool sendSync; | ||
56 | }; | ||
57 | |||
58 | |||
59 | class QCopBridgePI : public QSocket | ||
60 | { | ||
61 | Q_OBJECT | ||
62 | |||
63 | enum State { Connected, Wait_USER, Wait_PASS, Ready, Forbidden }; | ||
64 | |||
65 | public: | ||
66 | QCopBridgePI( int socket, QObject *parent = 0, const char* name = 0 ); | ||
67 | virtual ~QCopBridgePI(); | ||
68 | |||
69 | void sendDesktopMessage( const QString &msg ); | ||
70 | void startSync() { sendSync = TRUE; } | ||
71 | |||
72 | signals: | ||
73 | void connectionClosed( QCopBridgePI *); | ||
74 | |||
75 | protected slots: | ||
76 | void read(); | ||
77 | void send( const QString& msg ); | ||
78 | void process( const QString& command ); | ||
79 | void connectionClosed(); | ||
80 | |||
81 | protected: | ||
82 | bool checkUser( const QString& user ); | ||
83 | bool checkPassword( const QString& pw ); | ||
84 | |||
85 | void timerEvent( QTimerEvent *e ); | ||
86 | |||
87 | private: | ||
88 | State state; | ||
89 | Q_UINT16 peerport; | ||
90 | QHostAddress peeraddress; | ||
91 | bool connected; | ||
92 | bool sendSync; | ||
93 | }; | ||
94 | |||
95 | #endif | ||