|
1 /* |
|
2 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0"" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Declaration for MMCScBkupArchiveUtils |
|
15 * |
|
16 * |
|
17 */ |
|
18 |
|
19 #ifndef __MMCSCBKUPARCHIVEUTILS_H__ |
|
20 #define __MMCSCBKUPARCHIVEUTILS_H__ |
|
21 |
|
22 // System includes |
|
23 #include <f32file.h> |
|
24 #include <s32strm.h> |
|
25 #include <babitflags.h> |
|
26 |
|
27 // User includes |
|
28 #include "TMMCScBkupArchiveVector.h" |
|
29 |
|
30 // Classes referenced |
|
31 class CMMCScBkupArchiveHeader; |
|
32 class MMMCScBkupArchiveDataInterface; |
|
33 |
|
34 // Constants |
|
35 const TInt KMMCScBkupArchiveFileFormatFirstRestorableMajorVersion = 1; |
|
36 const TInt KMMCScArchiveUidsByteCount = sizeof( TCheckedUid ); |
|
37 const TInt KMMCScArchiveVersionByteCount = sizeof( TInt8 ) + sizeof( TInt8 ) + sizeof( TInt16 ); |
|
38 const TInt KMMCScArchiveFooterLengthByteCount = sizeof( TUint32 ); |
|
39 const TInt KMMCScArchiveFlagsByteCount = sizeof( TUint32 ); |
|
40 const TInt KMMCScArchiveCrcByteCount = sizeof( TUint32 ); |
|
41 const TInt KMMCScArchiveCategoryByteCount = sizeof( TUint32 ); |
|
42 const TInt KMMCScSpareByteCount = 5 * sizeof(TInt32); |
|
43 const TInt KMMCScArchivePhoneModelStringLength = sizeof(TUint8); |
|
44 |
|
45 /** |
|
46 * |
|
47 * |
|
48 * @since 3.0 |
|
49 */ |
|
50 class MMCScBkupArchiveUtils |
|
51 { |
|
52 public: // API |
|
53 |
|
54 /** |
|
55 * |
|
56 */ |
|
57 static void ArchiveUidType( TUidType& aType ); |
|
58 |
|
59 /** |
|
60 * |
|
61 */ |
|
62 static void ArchiveCheckedUid( TCheckedUid& aCheckedUids ); |
|
63 |
|
64 /** |
|
65 * |
|
66 */ |
|
67 static HBufC8* PhoneModelFromArchiveLC( MMMCScBkupArchiveDataInterface& aADI ); |
|
68 |
|
69 /** |
|
70 * |
|
71 */ |
|
72 static void ReadPhoneValidityInformationL( RFs& aFsSession, const TDesC& aFileName, HBufC8*& aPhoneModelData, TBitFlags& aArchiveFlags, TVersion& aArchiveVersion ); |
|
73 |
|
74 /** |
|
75 * |
|
76 */ |
|
77 static TVersion ArchiveRunTimeFileFormatVersion(); |
|
78 |
|
79 /** |
|
80 * |
|
81 */ |
|
82 static const TMMCScBkupArchiveVector& WriteHeaderL( MMMCScBkupArchiveDataInterface& aADI, TBitFlags aCategory ); |
|
83 |
|
84 /** |
|
85 * |
|
86 */ |
|
87 static const TMMCScBkupArchiveVector& ReadHeaderL( MMMCScBkupArchiveDataInterface& aADI, CMMCScBkupArchiveHeader& aHeader ); |
|
88 |
|
89 /** |
|
90 * |
|
91 */ |
|
92 static void SetArchiveContentAsValidL( RFile64& aArchive ); |
|
93 |
|
94 /** |
|
95 * |
|
96 */ |
|
97 static void SetFooterLengthL( RFile64& aArchive, TInt aLength ); |
|
98 |
|
99 /** |
|
100 * |
|
101 */ |
|
102 static TBitFlags ReadBkUpCategoryInformationL( RFs& aFsSession, const TDesC& aFileName ); |
|
103 |
|
104 #ifdef RD_FILE_MANAGER_BACKUP |
|
105 /** |
|
106 * |
|
107 */ |
|
108 static void SetArchiveCrcsL( RFile64& aArchive, TUint32 aCrc ); |
|
109 |
|
110 /** |
|
111 * |
|
112 */ |
|
113 static TBool ValidateArchiveCrcsL( RFs& aFsSession, const TDesC& aFileName ); |
|
114 #endif |
|
115 |
|
116 private: // Offsets |
|
117 enum |
|
118 { |
|
119 EArchiveOffsetUids = 0, |
|
120 EArchiveOffsetFileFormatVersion = EArchiveOffsetUids + KMMCScArchiveUidsByteCount, |
|
121 EArchiveOffsetFooterLength = EArchiveOffsetFileFormatVersion + KMMCScArchiveVersionByteCount, |
|
122 EArchiveOffsetArchiveFlags = EArchiveOffsetFooterLength + KMMCScArchiveFooterLengthByteCount, |
|
123 EArchiveOffsetArchivePayloadCRC = EArchiveOffsetArchiveFlags + KMMCScArchiveFlagsByteCount, |
|
124 EArchiveOffsetArchiveCategory = EArchiveOffsetArchivePayloadCRC + KMMCScArchiveCrcByteCount, |
|
125 EArchiveOffsetArchiveHeaderCRC = EArchiveOffsetArchiveCategory + KMMCScArchiveCategoryByteCount, |
|
126 EArchiveOffsetPadding = EArchiveOffsetArchiveHeaderCRC + KMMCScArchiveCrcByteCount, |
|
127 EArchiveOffsetPhoneModelStringLength = EArchiveOffsetPadding + KMMCScSpareByteCount, |
|
128 EArchiveOffsetPhoneModelString = EArchiveOffsetPhoneModelStringLength + KMMCScArchivePhoneModelStringLength |
|
129 }; |
|
130 |
|
131 private: // Internal methods |
|
132 |
|
133 /** |
|
134 * |
|
135 */ |
|
136 static TInt OffsetOfModelInformation(); |
|
137 |
|
138 /** |
|
139 * |
|
140 */ |
|
141 static HBufC8* PhoneModelFromArchiveLC( RReadStream& aStream ); |
|
142 |
|
143 /** |
|
144 * |
|
145 */ |
|
146 static TUint32 DefaultArchiveFlags(); |
|
147 |
|
148 /** |
|
149 * |
|
150 */ |
|
151 static TBitFlags ReadArchiveFlagsL( RFile64& aFile ); |
|
152 |
|
153 /** |
|
154 * |
|
155 */ |
|
156 static void ReadArchiveVersionL( RFile64& aFile, TVersion& aVersion ); |
|
157 |
|
158 #ifdef RD_FILE_MANAGER_BACKUP |
|
159 /** |
|
160 * |
|
161 */ |
|
162 static void SetArchiveCrcL( RFile64& aArchive, TUint32 aCrc, TUint aOffset ); |
|
163 |
|
164 /** |
|
165 * |
|
166 */ |
|
167 static void CalculateCrcFromArchive( TUint32& aCrc, RFile64& aArchive, TUint32 aOffset, TUint32 aLength ); |
|
168 #endif |
|
169 }; |
|
170 |
|
171 |
|
172 |
|
173 |
|
174 #endif // __MMCSCBKUPARCHIVEUTILS_H__ |
|
175 |
|
176 //End of File |