"Fossies" - the Fresh Open Source Software Archive

Member "src/Core/Unix/CoreService.h" (10 Oct 2018, 2581 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 "CoreService.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_Unix_CoreService
   14 #define TC_HEADER_Core_Unix_CoreService
   15 
   16 #include "CoreServiceRequest.h"
   17 #include "Platform/Stream.h"
   18 #include "Platform/Unix/Pipe.h"
   19 #include "Core/Core.h"
   20 
   21 namespace VeraCrypt
   22 {
   23     // This service facilitates process forking and elevation of user privileges
   24     class CoreService
   25     {
   26     public:
   27         static void ProcessElevatedRequests ();
   28         static void ProcessRequests (int inputFD = -1, int outputFD = -1);
   29         static void RequestCheckFilesystem (shared_ptr <VolumeInfo> mountedVolume, bool repair);
   30         static void RequestDismountFilesystem (const DirectoryPath &mountPoint, bool force);
   31         static shared_ptr <VolumeInfo> RequestDismountVolume (shared_ptr <VolumeInfo> mountedVolume, bool ignoreOpenFiles = false, bool syncVolumeInfo = false);
   32         static uint32 RequestGetDeviceSectorSize (const DevicePath &devicePath);
   33         static uint64 RequestGetDeviceSize (const DevicePath &devicePath);
   34         static HostDeviceList RequestGetHostDevices (bool pathListOnly);
   35         static shared_ptr <VolumeInfo> RequestMountVolume (MountOptions &options);
   36         static void RequestSetFileOwner (const FilesystemPath &path, const UserId &owner);
   37         static void SetAdminPasswordCallback (shared_ptr <GetStringFunctor> functor) { AdminPasswordCallback = functor; }
   38         static void Start ();
   39         static void Stop ();
   40 
   41     protected:
   42         template <class T> static auto_ptr <T> GetResponse ();
   43         template <class T> static auto_ptr <T> SendRequest (CoreServiceRequest &request);
   44         static void StartElevated (const CoreServiceRequest &request);
   45 
   46         static shared_ptr <GetStringFunctor> AdminPasswordCallback;
   47 
   48         static auto_ptr <Pipe> AdminInputPipe;
   49         static auto_ptr <Pipe> AdminOutputPipe;
   50 
   51         static auto_ptr <Pipe> InputPipe;
   52         static auto_ptr <Pipe> OutputPipe;
   53         static shared_ptr <Stream> ServiceInputStream;
   54         static shared_ptr <Stream> ServiceOutputStream;
   55 
   56         static bool ElevatedPrivileges;
   57         static bool ElevatedServiceAvailable;
   58         static bool Running;
   59 
   60     private:
   61         CoreService ();
   62     };
   63 
   64 #define TC_CORE_SERVICE_CMDLINE_OPTION "--core-service"
   65 }
   66 
   67 #endif // TC_HEADER_Core_Unix_CoreService