"Fossies" - the Fresh Open Source Software Archive

Member "src/Driver/Fuse/FuseService.h" (10 Oct 2018, 2685 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 "FuseService.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_Driver_Fuse_FuseService
   14 #define TC_HEADER_Driver_Fuse_FuseService
   15 
   16 #include "Platform/Platform.h"
   17 #include "Platform/Unix/Pipe.h"
   18 #include "Platform/Unix/Process.h"
   19 #include "Volume/VolumeInfo.h"
   20 #include "Volume/Volume.h"
   21 
   22 namespace VeraCrypt
   23 {
   24 
   25     class FuseService
   26     {
   27     protected:
   28         struct ExecFunctor : public ProcessExecFunctor
   29         {
   30             ExecFunctor (shared_ptr <Volume> openVolume, VolumeSlotNumber slotNumber)
   31                 : MountedVolume (openVolume), SlotNumber (slotNumber)
   32             {
   33             }
   34             virtual void operator() (int argc, char *argv[]);
   35 
   36         protected:
   37             shared_ptr <Volume> MountedVolume;
   38             VolumeSlotNumber SlotNumber;
   39         };
   40 
   41         friend class ExecFunctor;
   42 
   43     public:
   44         static bool AuxDeviceInfoReceived () { return !OpenVolumeInfo.VirtualDevice.IsEmpty(); }
   45         static bool CheckAccessRights ();
   46         static void Dismount ();
   47         static int ExceptionToErrorCode ();
   48         static const char *GetControlPath () { return "/control"; }
   49         static const char *GetVolumeImagePath ();
   50         static string GetDeviceType () { return "veracrypt"; }
   51         static uid_t GetGroupId () { return GroupId; }
   52         static uid_t GetUserId () { return UserId; }
   53         static shared_ptr <Buffer> GetVolumeInfo ();
   54         static uint64 GetVolumeSize ();
   55         static uint64 GetVolumeSectorSize () { return MountedVolume->GetSectorSize(); }
   56         static void Mount (shared_ptr <Volume> openVolume, VolumeSlotNumber slotNumber, const string &fuseMountPoint);
   57         static void ReadVolumeSectors (const BufferPtr &buffer, uint64 byteOffset);
   58         static void ReceiveAuxDeviceInfo (const ConstBufferPtr &buffer);
   59         static void SendAuxDeviceInfo (const DirectoryPath &fuseMountPoint, const DevicePath &virtualDevice, const DevicePath &loopDevice = DevicePath());
   60         static void WriteVolumeSectors (const ConstBufferPtr &buffer, uint64 byteOffset);
   61 
   62     protected:
   63         FuseService ();
   64         static void CloseMountedVolume ();
   65         static void OnSignal (int signal);
   66 
   67         static VolumeInfo OpenVolumeInfo;
   68         static Mutex OpenVolumeInfoMutex;
   69         static shared_ptr <Volume> MountedVolume;
   70         static VolumeSlotNumber SlotNumber;
   71         static uid_t UserId;
   72         static gid_t GroupId;
   73         static auto_ptr <Pipe> SignalHandlerPipe;
   74     };
   75 }
   76 
   77 #endif // TC_HEADER_Driver_Fuse_FuseService