Diffstat (limited to 'core/launcher/transferserver.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/launcher/transferserver.h | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/core/launcher/transferserver.h b/core/launcher/transferserver.h index 076e460..a3bb060 100644 --- a/core/launcher/transferserver.h +++ b/core/launcher/transferserver.h | |||
@@ -1,16 +1,16 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 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 | 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 | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 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. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
@@ -27,24 +27,38 @@ class QFileInfo; | |||
27 | class QProcess; | 27 | class QProcess; |
28 | class TransferServer : public QServerSocket | 28 | class TransferServer : public QServerSocket |
29 | { | 29 | { |
30 | Q_OBJECT | 30 | Q_OBJECT |
31 | 31 | ||
32 | public: | 32 | public: |
33 | TransferServer( Q_UINT16 port, QObject *parent = 0, const char* name = 0 ); | 33 | TransferServer( Q_UINT16 port, QObject *parent = 0, const char* name = 0 ); |
34 | virtual ~TransferServer(); | 34 | virtual ~TransferServer(); |
35 | 35 | ||
36 | void newConnection( int socket ); | 36 | void newConnection( int socket ); |
37 | }; | 37 | }; |
38 | 38 | ||
39 | class SyncAuthentication : QObject | ||
40 | { | ||
41 | Q_OBJECT | ||
42 | |||
43 | public: | ||
44 | static int isAuthorized(QHostAddress peeraddress); | ||
45 | static bool checkPassword(const QString& pw); | ||
46 | static bool checkUser(const QString& user); | ||
47 | |||
48 | static QString serverId(); | ||
49 | static QString loginName(); | ||
50 | static QString ownerName(); | ||
51 | }; | ||
52 | |||
39 | 53 | ||
40 | class ServerDTP : public QSocket | 54 | class ServerDTP : public QSocket |
41 | { | 55 | { |
42 | Q_OBJECT | 56 | Q_OBJECT |
43 | 57 | ||
44 | public: | 58 | public: |
45 | ServerDTP( QObject *parent = 0, const char* name = 0 ); | 59 | ServerDTP( QObject *parent = 0, const char* name = 0 ); |
46 | ~ServerDTP(); | 60 | ~ServerDTP(); |
47 | 61 | ||
48 | enum Mode{ Idle = 0, SendFile, SendGzipFile, SendBuffer, | 62 | enum Mode{ Idle = 0, SendFile, SendGzipFile, SendBuffer, |
49 | RetrieveFile, RetrieveGzipFile, RetrieveBuffer }; | 63 | RetrieveFile, RetrieveGzipFile, RetrieveBuffer }; |
50 | 64 | ||
@@ -56,24 +70,25 @@ public: | |||
56 | void sendByteArray( const QByteArray& array ); | 70 | void sendByteArray( const QByteArray& array ); |
57 | void sendByteArray( const QByteArray& array, const QHostAddress& host, Q_UINT16 port ); | 71 | void sendByteArray( const QByteArray& array, const QHostAddress& host, Q_UINT16 port ); |
58 | 72 | ||
59 | void retrieveFile( const QString fn ); | 73 | void retrieveFile( const QString fn ); |
60 | void retrieveFile( const QString fn, const QHostAddress& host, Q_UINT16 port ); | 74 | void retrieveFile( const QString fn, const QHostAddress& host, Q_UINT16 port ); |
61 | void retrieveGzipFile( const QString &fn ); | 75 | void retrieveGzipFile( const QString &fn ); |
62 | void retrieveGzipFile( const QString &fn, const QHostAddress& host, Q_UINT16 port ); | 76 | void retrieveGzipFile( const QString &fn, const QHostAddress& host, Q_UINT16 port ); |
63 | void retrieveByteArray(); | 77 | void retrieveByteArray(); |
64 | void retrieveByteArray( const QHostAddress& host, Q_UINT16 port ); | 78 | void retrieveByteArray( const QHostAddress& host, Q_UINT16 port ); |
65 | 79 | ||
66 | Mode dtpMode() { return mode; } | 80 | Mode dtpMode() { return mode; } |
67 | QByteArray buffer() { return buf.buffer(); } | 81 | QByteArray buffer() { return buf.buffer(); } |
82 | QString fileName() const { return file.name(); } | ||
68 | 83 | ||
69 | void setSocket( int socket ); | 84 | void setSocket( int socket ); |
70 | 85 | ||
71 | signals: | 86 | signals: |
72 | void completed(); | 87 | void completed(); |
73 | void failed(); | 88 | void failed(); |
74 | 89 | ||
75 | private slots: | 90 | private slots: |
76 | void connectionClosed(); | 91 | void connectionClosed(); |
77 | void connected(); | 92 | void connected(); |
78 | void bytesWritten( int bytes ); | 93 | void bytesWritten( int bytes ); |
79 | void readyRead(); | 94 | void readyRead(); |
@@ -122,26 +137,24 @@ public: | |||
122 | 137 | ||
123 | protected slots: | 138 | protected slots: |
124 | void read(); | 139 | void read(); |
125 | void send( const QString& msg ); | 140 | void send( const QString& msg ); |
126 | void process( const QString& command ); | 141 | void process( const QString& command ); |
127 | void connectionClosed(); | 142 | void connectionClosed(); |
128 | void dtpCompleted(); | 143 | void dtpCompleted(); |
129 | void dtpFailed(); | 144 | void dtpFailed(); |
130 | void dtpError( int ); | 145 | void dtpError( int ); |
131 | void newConnection( int socket ); | 146 | void newConnection( int socket ); |
132 | 147 | ||
133 | protected: | 148 | protected: |
134 | bool checkUser( const QString& user ); | ||
135 | bool checkPassword( const QString& pw ); | ||
136 | bool checkReadFile( const QString& file ); | 149 | bool checkReadFile( const QString& file ); |
137 | bool checkWriteFile( const QString& file ); | 150 | bool checkWriteFile( const QString& file ); |
138 | bool parsePort( const QString& pw ); | 151 | bool parsePort( const QString& pw ); |
139 | bool backupRestoreGzip( const QString &file, QStringList &targets ); | 152 | bool backupRestoreGzip( const QString &file, QStringList &targets ); |
140 | bool backupRestoreGzip( const QString &file ); | 153 | bool backupRestoreGzip( const QString &file ); |
141 | 154 | ||
142 | bool sendList( const QString& arg ); | 155 | bool sendList( const QString& arg ); |
143 | void sendFile( const QString& file ); | 156 | void sendFile( const QString& file ); |
144 | void retrieveFile( const QString& file ); | 157 | void retrieveFile( const QString& file ); |
145 | 158 | ||
146 | QString permissionString( QFileInfo *info ); | 159 | QString permissionString( QFileInfo *info ); |
147 | QString fileListing( QFileInfo *info ); | 160 | QString fileListing( QFileInfo *info ); |
@@ -155,14 +168,12 @@ private: | |||
155 | QHostAddress peeraddress; | 168 | QHostAddress peeraddress; |
156 | bool passiv; | 169 | bool passiv; |
157 | bool wait[4]; | 170 | bool wait[4]; |
158 | ServerDTP *dtp; | 171 | ServerDTP *dtp; |
159 | ServerSocket *serversocket; | 172 | ServerSocket *serversocket; |
160 | QString waitfile; | 173 | QString waitfile; |
161 | QDir directory; | 174 | QDir directory; |
162 | QByteArray waitarray; | 175 | QByteArray waitarray; |
163 | QString renameFrom; | 176 | QString renameFrom; |
164 | QString lastCommand; | 177 | QString lastCommand; |
165 | int waitsocket; | 178 | int waitsocket; |
166 | }; | 179 | }; |
167 | |||
168 | bool accessAuthorized(QHostAddress peeraddress); | ||