Merge branch 'fixes' into main/rendor-staging
[ryzomcore.git] / ryzom / common / src / game_share / backup_service_messages.h
blob06e268e945d871d4deefa097260d913f4c96a1f2
1 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
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.
8 //
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 //-------------------------------------------------------------------------------------------------
21 // includes
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
36 uint32 RequestId;
37 std::string FileName;
39 CBackupMsgRequestFile()
41 RequestId=0;
44 void serial(NLMISC::IStream& stream)
46 stream.serial(RequestId);
47 stream.serial(FileName);
52 //-------------------------------------------------------------------------------------------------
53 // struct CBackupMsgReceiveFile
54 //-------------------------------------------------------------------------------------------------
56 struct CBackupMsgReceiveFile
58 uint32 RequestId;
59 CFileDescription FileDescription;
60 NLMISC::CMemStream Data;
62 CBackupMsgReceiveFile()
64 RequestId=0;
67 void serial(NLMISC::IStream& stream)
69 stream.serial(RequestId);
70 stream.serial(FileDescription);
71 if (Data.isReading()!=stream.isReading())
72 Data.invert();
73 stream.serialMemStream(Data);
78 //-------------------------------------------------------------------------------------------------
79 // struct CBackupMsgReceiveFileList
80 //-------------------------------------------------------------------------------------------------
82 struct CBackupMsgReceiveFileList
84 uint32 RequestId;
85 CFileDescriptionContainer Fdc;
87 CBackupMsgReceiveFileList()
89 RequestId=0;
92 void serial(NLMISC::IStream& stream)
94 stream.serial(RequestId);
95 stream.serial(Fdc);
98 void send(const char* serviceName)
100 H_AUTO(CBackupMsgReceiveFileListSend0);
101 NLNET::CMessage msgOut("bs_file_list");
102 serial(msgOut);
103 NLNET::CUnifiedNetwork::getInstance()->send( serviceName, msgOut );
106 void send(NLNET::TServiceId serviceId)
108 H_AUTO(CBackupMsgReceiveFileListSend1);
109 NLNET::CMessage msgOut("bs_file_list");
110 serial(msgOut);
111 NLNET::CUnifiedNetwork::getInstance()->send( serviceId, msgOut );
116 //-------------------------------------------------------------------------------------------------
117 // struct CBackupMsgFileClass
118 //-------------------------------------------------------------------------------------------------
120 struct CBackupMsgFileClass
122 uint32 RequestId;
123 std::string Directory;
124 std::vector<CBackupFileClass> Classes;
126 CBackupMsgFileClass()
128 RequestId=0;
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
146 uint32 RequestId;
147 CFileDescriptionContainer Fdc;
149 CBackupMsgReceiveFileClass()
151 RequestId=0;
154 void serial(NLMISC::IStream& stream)
156 stream.serial(RequestId);
157 stream.serial(Fdc);
162 //-------------------------------------------------------------------------------------------------
163 // struct CBackupMsgAppend
164 //-------------------------------------------------------------------------------------------------
166 struct CBackupMsgAppend
168 std::string FileName;
169 std::string Append;
171 CBackupMsgAppend()
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 //-------------------------------------------------------------------------------------------------
206 #endif