|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the tools applications of the Qt Toolkit. |
|
8 ** |
|
9 ** $QT_BEGIN_LICENSE:LGPL$ |
|
10 ** No Commercial Usage |
|
11 ** This file contains pre-release code and may not be distributed. |
|
12 ** You may use this file in accordance with the terms and conditions |
|
13 ** contained in the Technology Preview License Agreement accompanying |
|
14 ** this package. |
|
15 ** |
|
16 ** GNU Lesser General Public License Usage |
|
17 ** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 ** General Public License version 2.1 as published by the Free Software |
|
19 ** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 ** packaging of this file. Please review the following information to |
|
21 ** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 ** |
|
24 ** In addition, as a special exception, Nokia gives you certain additional |
|
25 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 ** |
|
28 ** If you have questions regarding the use of this file, please contact |
|
29 ** Nokia at qt-info@nokia.com. |
|
30 ** |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 #ifndef TRANSFER_GLOBAL_H |
|
42 #define TRANSFER_GLOBAL_H |
|
43 |
|
44 #include <QtCore/qglobal.h> |
|
45 #ifdef Q_OS_WIN |
|
46 #include <windows.h> |
|
47 #endif |
|
48 |
|
49 #define SERVER_PORT 12145 |
|
50 |
|
51 #define MAX_NAME_LENGTH 512 |
|
52 #define MAX_ARGUMENTS 10 |
|
53 |
|
54 // Defines for commands sent/received |
|
55 #define COMMAND_CREATE_FILE "CREATEFILE" |
|
56 #define COMMAND_CREATE_DIRECTORY "CREATEDIR" |
|
57 #define COMMAND_COPY_FILE "COPYFILE" |
|
58 #define COMMAND_COPY_DIRECTORY "COPYDIR" |
|
59 #define COMMAND_DELETE_FILE "DELETEFILE" |
|
60 #define COMMAND_DELETE_DIRECTORY "DELETEDIR" |
|
61 #define COMMAND_EXECUTE "EXECUTE" |
|
62 #define COMMAND_QUIT_SERVER "QUIT" |
|
63 #define COMMAND_FILE_TIME "FILETIME" |
|
64 #define COMMAND_TIME_STAMP "TIMESTAMP" |
|
65 |
|
66 // Report back commands |
|
67 #define COMMAND_SUCCESS "SUCCESS" |
|
68 #define COMMAND_ERROR "ERROR" |
|
69 |
|
70 // Defines for commands that send data back to requester |
|
71 #define COMMAND_READ_FILE "READFILE" |
|
72 #define COMMAND_READ_DIRECTORY "READDIR" |
|
73 |
|
74 #include <QtCore/qglobal.h> |
|
75 // Option-Structures for commands |
|
76 |
|
77 struct CreateFileOptions |
|
78 { |
|
79 char fileName[MAX_NAME_LENGTH]; |
|
80 #ifdef Q_OS_WIN |
|
81 FILETIME fileTime; |
|
82 DWORD fileAttributes; |
|
83 #endif |
|
84 int fileSize; |
|
85 bool overwriteExisting; |
|
86 }; |
|
87 |
|
88 struct CreateDirectoryOptions |
|
89 { |
|
90 char dirName[MAX_NAME_LENGTH]; |
|
91 bool recursively; // in case of \foo\bar create \foo if it does not exist |
|
92 }; |
|
93 |
|
94 struct CopyFileOptions |
|
95 { |
|
96 char from[MAX_NAME_LENGTH]; |
|
97 char to[MAX_NAME_LENGTH]; |
|
98 bool overwriteExisting; |
|
99 }; |
|
100 |
|
101 struct CopyDirectoryOptions |
|
102 { |
|
103 char from[MAX_NAME_LENGTH]; |
|
104 char to[MAX_NAME_LENGTH]; |
|
105 bool recursive; |
|
106 }; |
|
107 |
|
108 struct DeleteFileOptions |
|
109 { |
|
110 char fileName[MAX_NAME_LENGTH]; |
|
111 }; |
|
112 |
|
113 struct DeleteDirectoryOptions |
|
114 { |
|
115 char dirName[MAX_NAME_LENGTH]; |
|
116 bool recursive; |
|
117 bool failIfContentExists; |
|
118 }; |
|
119 |
|
120 struct ExecuteOptions |
|
121 { |
|
122 char appName[MAX_NAME_LENGTH]; |
|
123 int argumentsCount; |
|
124 bool waitForFinished; |
|
125 int timeout; |
|
126 }; |
|
127 |
|
128 struct ReadFileOptions |
|
129 { |
|
130 char fileName[MAX_NAME_LENGTH]; |
|
131 }; |
|
132 |
|
133 struct ReadFileReply |
|
134 { |
|
135 qint64 fileSize; |
|
136 bool fileValid; |
|
137 }; |
|
138 |
|
139 struct ReadDirectoryOptions |
|
140 { |
|
141 char dirName[MAX_NAME_LENGTH]; |
|
142 }; |
|
143 |
|
144 struct ReadDirectoryItem |
|
145 { |
|
146 char name[MAX_NAME_LENGTH]; |
|
147 qint64 size; |
|
148 bool isDirectory; |
|
149 bool hasMore; |
|
150 }; |
|
151 |
|
152 #define FileTimeOptions ReadFileOptions |
|
153 |
|
154 struct ReadDirectoryReply |
|
155 { |
|
156 bool entryValid; |
|
157 int itemCount; // might change during iteration |
|
158 }; |
|
159 #endif |