"Fossies" - the Fresh Open Source Software Archive

Member "src/Core/Unix/CoreUnix.h" (10 Oct 2018, 4128 Bytes) of package /windows/misc/VeraCrypt_1.23-Hotfix-2_Source.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "CoreUnix.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2  Derived from source code of TrueCrypt 7.1a, which is
    3  Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
    4  by the TrueCrypt License 3.0.
    5 
    6  Modifications and additions to the original source code (contained in this file)
    7  and all other portions of this file are Copyright (c) 2013-2017 IDRIX
    8  and are governed by the Apache License 2.0 the full text of which is
    9  contained in the file License.txt included in VeraCrypt binary and source
   10  code distribution packages.
   11 */
   12 
   13 #ifndef TC_HEADER_Core_CoreUnix
   14 #define TC_HEADER_Core_CoreUnix
   15 
   16 #include "System.h"
   17 #include "Platform/Unix/Process.h"
   18 #include "Core/CoreBase.h"
   19 #include "Core/Unix/MountedFilesystem.h"
   20 
   21 namespace VeraCrypt
   22 {
   23     class CoreUnix : public CoreBase
   24     {
   25     public:
   26         CoreUnix ();
   27         virtual ~CoreUnix ();
   28 
   29         virtual void CheckFilesystem (shared_ptr <VolumeInfo> mountedVolume, bool repair = false) const;
   30         virtual void DismountFilesystem (const DirectoryPath &mountPoint, bool force) const;
   31         virtual shared_ptr <VolumeInfo> DismountVolume (shared_ptr <VolumeInfo> mountedVolume, bool ignoreOpenFiles = false, bool syncVolumeInfo = false);
   32         virtual bool FilesystemSupportsLargeFiles (const FilePath &filePath) const;
   33         virtual DirectoryPath GetDeviceMountPoint (const DevicePath &devicePath) const;
   34         virtual uint32 GetDeviceSectorSize (const DevicePath &devicePath) const;
   35         virtual uint64 GetDeviceSize (const DevicePath &devicePath) const;
   36         virtual int GetOSMajorVersion () const { throw NotApplicable (SRC_POS); }
   37         virtual int GetOSMinorVersion () const { throw NotApplicable (SRC_POS); }
   38         virtual VolumeInfoList GetMountedVolumes (const VolumePath &volumePath = VolumePath()) const;
   39         virtual bool IsDevicePresent (const DevicePath &device) const { throw NotApplicable (SRC_POS); }
   40         virtual bool IsInPortableMode () const { return false; }
   41         virtual bool IsMountPointAvailable (const DirectoryPath &mountPoint) const;
   42         virtual bool IsOSVersion (int major, int minor) const { throw NotApplicable (SRC_POS); }
   43         virtual bool IsOSVersionLower (int major, int minor) const { throw NotApplicable (SRC_POS); }
   44         virtual bool IsPasswordCacheEmpty () const { throw NotApplicable (SRC_POS); }
   45         virtual bool HasAdminPrivileges () const { return getuid() == 0 || geteuid() == 0; }
   46         virtual VolumeSlotNumber MountPointToSlotNumber (const DirectoryPath &mountPoint) const;
   47         virtual shared_ptr <VolumeInfo> MountVolume (MountOptions &options);
   48         virtual void SetFileOwner (const FilesystemPath &path, const UserId &owner) const;
   49         virtual DirectoryPath SlotNumberToMountPoint (VolumeSlotNumber slotNumber) const;
   50         virtual void WipePasswordCache () const { throw NotApplicable (SRC_POS); }
   51 
   52     protected:
   53         virtual DevicePath AttachFileToLoopDevice (const FilePath &filePath, bool readOnly) const { throw NotApplicable (SRC_POS); }
   54         virtual void DetachLoopDevice (const DevicePath &devicePath) const { throw NotApplicable (SRC_POS); }
   55         virtual void DismountNativeVolume (shared_ptr <VolumeInfo> mountedVolume) const { throw NotApplicable (SRC_POS); }
   56         virtual bool FilesystemSupportsUnixPermissions (const DevicePath &devicePath) const;
   57         virtual string GetDefaultMountPointPrefix () const;
   58         virtual string GetFuseMountDirPrefix () const { return ".veracrypt_aux_mnt"; }
   59         virtual MountedFilesystemList GetMountedFilesystems (const DevicePath &devicePath = DevicePath(), const DirectoryPath &mountPoint = DirectoryPath()) const = 0;
   60         virtual uid_t GetRealUserId () const;
   61         virtual gid_t GetRealGroupId () const;
   62         virtual string GetTempDirectory () const;
   63         virtual void MountFilesystem (const DevicePath &devicePath, const DirectoryPath &mountPoint, const string &filesystemType, bool readOnly, const string &systemMountOptions) const;
   64         virtual void MountAuxVolumeImage (const DirectoryPath &auxMountPoint, const MountOptions &options) const;
   65         virtual void MountVolumeNative (shared_ptr <Volume> volume, MountOptions &options, const DirectoryPath &auxMountPoint) const { throw NotApplicable (SRC_POS); }
   66 
   67     private:
   68         CoreUnix (const CoreUnix &);
   69         CoreUnix &operator= (const CoreUnix &);
   70     };
   71 }
   72 
   73 #endif // TC_HEADER_Core_CoreUnix