source: box/trunk/lib/backupstore/BackupClientFileAttributes.h @ 3067

Last change on this file since 3067 was 3067, checked in by chris, 2 years ago

Allow constructing a BackupClientFileAttributes? from a struct EMU_STAT.

  • Property svn:eol-style set to native
File size: 2.9 KB
Line 
1// --------------------------------------------------------------------------
2//
3// File
4//              Name:    BackupClientFileAttributes.h
5//              Purpose: Storage of file attributes
6//              Created: 2003/10/07
7//
8// --------------------------------------------------------------------------
9
10#ifndef BACKUPCLIENTFILEATTRIBUTES__H
11#define BACKUPCLIENTFILEATTRIBUTES__H
12
13#include <string>
14
15#include "StreamableMemBlock.h"
16#include "BoxTime.h"
17
18EMU_STRUCT_STAT; // declaration
19
20// --------------------------------------------------------------------------
21//
22// Class
23//              Name:    BackupClientFileAttributes
24//              Purpose: Storage, streaming and application of file attributes
25//              Created: 2003/10/07
26//
27// --------------------------------------------------------------------------
28class BackupClientFileAttributes : public StreamableMemBlock
29{
30public:
31        BackupClientFileAttributes();
32        BackupClientFileAttributes(const EMU_STRUCT_STAT &st);
33        BackupClientFileAttributes(const BackupClientFileAttributes &rToCopy);
34        BackupClientFileAttributes(const StreamableMemBlock &rToCopy);
35        ~BackupClientFileAttributes();
36        BackupClientFileAttributes &operator=(const BackupClientFileAttributes &rAttr);
37        BackupClientFileAttributes &operator=(const StreamableMemBlock &rAttr);
38        bool operator==(const BackupClientFileAttributes &rAttr) const;
39//      bool operator==(const StreamableMemBlock &rAttr) const; // too dangerous?
40
41        bool Compare(const BackupClientFileAttributes &rAttr, bool IgnoreAttrModTime = false, bool IgnoreModTime = false) const;
42       
43        // Prevent access to base class members accidently
44        void Set();
45
46        void ReadAttributes(const char *Filename, bool ZeroModificationTimes = false,
47                box_time_t *pModTime = 0, box_time_t *pAttrModTime = 0, int64_t *pFileSize = 0,
48                InodeRefType *pInodeNumber = 0, bool *pHasMultipleLinks = 0);
49        void WriteAttributes(const char *Filename, 
50                bool MakeUserWritable = false) const;
51        void GetModificationTimes(box_time_t *pModificationTime,
52                box_time_t *pAttrModificationTime) const;
53       
54        bool IsSymLink() const;
55
56        static void SetBlowfishKey(const void *pKey, int KeyLength);
57        static void SetAttributeHashSecret(const void *pSecret, int SecretLength);
58       
59        static uint64_t GenerateAttributeHash(EMU_STRUCT_STAT &st, const std::string &filename, const std::string &leafname);
60        static void FillExtendedAttr(StreamableMemBlock &outputBlock, const char *Filename);
61
62private:
63        static void FillAttributes(StreamableMemBlock &outputBlock,
64                const char *Filename, const EMU_STRUCT_STAT &st,
65                bool ZeroModificationTimes);
66        static void FillAttributesLink(StreamableMemBlock &outputBlock, const char *Filename, struct stat &st);
67        void WriteExtendedAttr(const char *Filename, int xattrOffset) const;
68
69        void RemoveClear() const;
70        void EnsureClearAvailable() const;
71        static StreamableMemBlock *MakeClear(const StreamableMemBlock &rEncrypted);
72        void EncryptAttr(const StreamableMemBlock &rToEncrypt);
73
74private:
75        mutable StreamableMemBlock *mpClearAttributes;
76};
77
78#endif // BACKUPCLIENTFILEATTRIBUTES__H
79
Note: See TracBrowser for help on using the repository browser.