| 1 | /*++ |
| 2 | |
| 3 | Copyright (c) Microsoft. All rights reserved. |
| 4 | |
| 5 | Module Name: |
| 6 | |
| 7 | WslCoreConfigInterface.h |
| 8 | |
| 9 | Abstract: |
| 10 | |
| 11 | This file contains the WSL Core Config Interface class interface declaration. |
| 12 | |
| 13 | --*/ |
| 14 | |
| 15 | #pragma once |
| 16 | |
| 17 | #include <stdint.h> |
| 18 | #include <stdbool.h> |
| 19 | #include <basetyps.h> |
| 20 | |
| 21 | enum WslConfigEntry |
| 22 | { |
| 23 | NoEntry, |
| 24 | ProcessorCount, |
| 25 | MemorySizeBytes, |
| 26 | SwapSizeBytes, |
| 27 | SwapFilePath, |
| 28 | VhdSizeBytes, |
| 29 | Networking, |
| 30 | FirewallEnabled, |
| 31 | IgnoredPorts, |
| 32 | LocalhostForwardingEnabled, |
| 33 | HostAddressLoopbackEnabled, |
| 34 | AutoProxyEnabled, |
| 35 | InitialAutoProxyTimeout, |
| 36 | DNSProxyEnabled, |
| 37 | DNSTunnelingEnabled, |
| 38 | BestEffortDNSParsingEnabled, |
| 39 | AutoMemoryReclaim, |
| 40 | GUIApplicationsEnabled, |
| 41 | NestedVirtualizationEnabled, |
| 42 | SafeModeEnabled, |
| 43 | SparseVHDEnabled, |
| 44 | VMIdleTimeout, |
| 45 | DebugConsoleEnabled, |
| 46 | HardwarePerformanceCountersEnabled, |
| 47 | KernelPath, |
| 48 | SystemDistroPath, |
| 49 | KernelModulesPath, |
| 50 | InstanceIdleTimeout, |
| 51 | }; |
| 52 | |
| 53 | enum NetworkingConfiguration |
| 54 | { |
| 55 | None = 0, |
| 56 | Nat = 1, |
| 57 | Bridged = 2, |
| 58 | Mirrored = 3, |
| 59 | Consomme = 4 |
| 60 | }; |
| 61 | |
| 62 | enum MemoryReclaimConfiguration |
| 63 | { |
| 64 | Disabled = 0, |
| 65 | Gradual = 1, |
| 66 | DropCache = 2 |
| 67 | }; |
| 68 | |
| 69 | typedef struct WslConfig* WslConfig_t; |
| 70 | |
| 71 | struct WslConfigSetting |
| 72 | { |
| 73 | enum WslConfigEntry ConfigEntry; |
| 74 | union |
| 75 | { |
| 76 | const wchar_t* StringValue; |
| 77 | unsigned __int64 UInt64Value; |
| 78 | int Int32Value; |
| 79 | bool BoolValue; |
| 80 | enum NetworkingConfiguration NetworkingConfigurationValue; |
| 81 | enum MemoryReclaimConfiguration MemoryReclaimModeValue; |
| 82 | }; |
| 83 | }; |
| 84 | |
| 85 | STDAPI_(const wchar_t*) |
| 86 | GetWslConfigFilePath(); |
| 87 | |
| 88 | STDAPI_(WslConfig_t) |
| 89 | CreateWslConfig(const wchar_t* wslConfigFilePath); |
| 90 | |
| 91 | STDAPI_(void) |
| 92 | FreeWslConfig(WslConfig_t wslConfig); |
| 93 | |
| 94 | STDAPI_(struct WslConfigSetting) |
| 95 | GetWslConfigSetting(WslConfig_t wslConfig, enum WslConfigEntry ConfigEntry); |
| 96 | |
| 97 | STDAPI_(unsigned long) |
| 98 | SetWslConfigSetting(WslConfig_t wslConfig, struct WslConfigSetting setting); |