1 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #ifndef BACKUP_SERVICE_MESSAGES_H
18 #define BACKUP_SERVICE_MESSAGES_H
20 //-------------------------------------------------------------------------------------------------
22 //-------------------------------------------------------------------------------------------------
24 #include "nel/net/unified_network.h"
25 #include "nel/misc/hierarchical_timer.h"
26 #include "file_description_container.h"
27 #include "backup_service_interface.h"
30 //-------------------------------------------------------------------------------------------------
31 // struct CBackupMsgRequestFile
32 //-------------------------------------------------------------------------------------------------
34 struct CBackupMsgRequestFile
39 CBackupMsgRequestFile()
44 void serial(NLMISC::IStream
& stream
)
46 stream
.serial(RequestId
);
47 stream
.serial(FileName
);
52 //-------------------------------------------------------------------------------------------------
53 // struct CBackupMsgReceiveFile
54 //-------------------------------------------------------------------------------------------------
56 struct CBackupMsgReceiveFile
59 CFileDescription FileDescription
;
60 NLMISC::CMemStream Data
;
62 CBackupMsgReceiveFile()
67 void serial(NLMISC::IStream
& stream
)
69 stream
.serial(RequestId
);
70 stream
.serial(FileDescription
);
71 if (Data
.isReading()!=stream
.isReading())
73 stream
.serialMemStream(Data
);
78 //-------------------------------------------------------------------------------------------------
79 // struct CBackupMsgReceiveFileList
80 //-------------------------------------------------------------------------------------------------
82 struct CBackupMsgReceiveFileList
85 CFileDescriptionContainer Fdc
;
87 CBackupMsgReceiveFileList()
92 void serial(NLMISC::IStream
& stream
)
94 stream
.serial(RequestId
);
98 void send(const char* serviceName
)
100 H_AUTO(CBackupMsgReceiveFileListSend0
);
101 NLNET::CMessage
msgOut("bs_file_list");
103 NLNET::CUnifiedNetwork::getInstance()->send( serviceName
, msgOut
);
106 void send(NLNET::TServiceId serviceId
)
108 H_AUTO(CBackupMsgReceiveFileListSend1
);
109 NLNET::CMessage
msgOut("bs_file_list");
111 NLNET::CUnifiedNetwork::getInstance()->send( serviceId
, msgOut
);
116 //-------------------------------------------------------------------------------------------------
117 // struct CBackupMsgFileClass
118 //-------------------------------------------------------------------------------------------------
120 struct CBackupMsgFileClass
123 std::string Directory
;
124 std::vector
<CBackupFileClass
> Classes
;
126 CBackupMsgFileClass()
131 void serial(NLMISC::IStream
& stream
)
133 stream
.serial(RequestId
);
134 stream
.serial(Directory
);
135 stream
.serialCont(Classes
);
140 //-------------------------------------------------------------------------------------------------
141 // struct CBackupMsgReceiveFileClass
142 //-------------------------------------------------------------------------------------------------
144 struct CBackupMsgReceiveFileClass
147 CFileDescriptionContainer Fdc
;
149 CBackupMsgReceiveFileClass()
154 void serial(NLMISC::IStream
& stream
)
156 stream
.serial(RequestId
);
162 //-------------------------------------------------------------------------------------------------
163 // struct CBackupMsgAppend
164 //-------------------------------------------------------------------------------------------------
166 struct CBackupMsgAppend
168 std::string FileName
;
175 void serial(NLMISC::IStream
& stream
)
177 stream
.serial(FileName
);
178 stream
.serial(Append
);
182 //-------------------------------------------------------------------------------------------------
183 // struct CBackupMsgAppendCallback
184 //-------------------------------------------------------------------------------------------------
186 struct CBackupMsgAppendCallback
188 std::string FileName
;
189 std::vector
<std::string
> Appends
;
191 CBackupMsgAppendCallback()
195 void serial(NLMISC::IStream
& stream
)
197 stream
.serial(FileName
);
198 stream
.serialCont(Appends
);
202 typedef void (*TBackupAppendCallback
)(CBackupMsgAppendCallback
& append
);
205 //-------------------------------------------------------------------------------------------------