master
h 62 lines 1.4 KB
Raw
1 /*++
2
3 Copyright (c) Microsoft. All rights reserved.
4
5 Module Name:
6
7 Redirector.h
8
9 Abstract:
10
11 This file contains declarations for helpers for controlling the Plan 9 Redirector.
12
13 --*/
14
15 #pragma once
16
17 namespace wsl::windows::common::redirector {
18
19 class ConnectionTargetManager final
20 {
21 public:
22 ConnectionTargetManager(std::wstring_view name);
23
24 void AddConnectionTarget(
25 HANDLE userToken, std::string_view aname, LX_UID_T uid, std::wstring_view unixSocketPath = {}, const GUID& instanceId = {}, ULONG port = 0);
26
27 void RemoveAll();
28
29 void UpdateUid(LX_UID_T uid);
30
31 private:
32 struct ConnectionTarget
33 {
34 LUID logonId;
35 std::string aname;
36 LX_UID_T uid;
37 std::wstring unixSocketPath;
38 GUID instanceId;
39 ULONG port;
40 };
41
42 bool Contains(LUID luid) const;
43
44 std::wstring_view m_name;
45 std::vector<ConnectionTarget> m_targets;
46 wil::srwlock m_lock;
47 };
48
49 wil::unique_hfile OpenRedirector();
50
51 void EnsureRedirectorStarted();
52
53 bool StartRedirector();
54
55 void AddConnectionTarget(
56 std::wstring_view name, LUID logonId, std::string_view aname, LX_UID_T uid, std::wstring_view unixSocketPath, const GUID& instanceId = {}, ULONG port = 0);
57
58 void RemoveConnectionTarget(std::wstring_view name, LUID logonId);
59
60 void RegisterUserCallback(HANDLE handle, gsl::span<gsl::byte> outputBuffer, LPOVERLAPPED overlapped);
61
62 } // namespace wsl::windows::common::redirector