-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Expand file tree
/
Copy pathWslcsdkPrivate.h
More file actions
99 lines (81 loc) · 2.89 KB
/
WslcsdkPrivate.h
File metadata and controls
99 lines (81 loc) · 2.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/*++
Copyright (c) Microsoft. All rights reserved.
Module Name:
WslcSDKPrivate.h
Abstract:
This file contains the private WSL Container SDK definitions.
--*/
#pragma once
#include <windows.h>
#include "wslcsdk.h"
#include "wslaservice.h"
#include <stdint.h>
#include <wil/com.h> // COM helpers
// #include <wil/resource.h> // handle wrappers
// #include <wil/result.h> // error handling
// SESSION DEFINITIONS
typedef struct WSLC_SESSION_OPTIONS_INTERNAL
{
PCWSTR displayName;
PCWSTR storagePath;
uint32_t cpuCount;
uint64_t memoryMb;
uint32_t timeoutMS;
WslcVhdRequirements vhdRequirements;
WslcSessionFlags flags;
WslcSessionTerminationCallback terminationCallback;
PVOID terminationCallbackContext;
} WSLC_SESSION_OPTIONS_INTERNAL;
static_assert(sizeof(WSLC_SESSION_OPTIONS_INTERNAL) == WSLC_SESSION_OPTIONS_SIZE, "WSLC_SESSION_OPTIONS_INTERNAL size mismatch");
static_assert(
__alignof(WSLC_SESSION_OPTIONS_INTERNAL) == WSLC_SESSION_OPTIONS_ALIGNMENT,
"WSLC_SESSION_OPTIONS_INTERNAL alignment mismatch");
// PROCESS DEFINITIONS
typedef struct WSLC_CONTAINER_PROCESS_OPTIONS_INTERNAL
{
PCSTR executable; // path to executable inside container
PCSTR* commandLine;
uint32_t commandLineCount;
PCSTR* environment;
uint32_t environmentCount;
PCSTR currentDirectory;
} WSLC_CONTAINER_PROCESS_OPTIONS_INTERNAL;
static_assert(
sizeof(WSLC_CONTAINER_PROCESS_OPTIONS_INTERNAL) == WSLC_CONTAINER_PROCESS_OPTIONS_SIZE,
"WSLC_CONTAINER_PROCESS_OPTIONS_INTERNAL must be 48 bytes");
static_assert(
__alignof(WSLC_CONTAINER_PROCESS_OPTIONS_INTERNAL) == WSLC_CONTAINER_PROCESS_OPTIONS_ALIGNMENT,
"WSLC_CONTAINER_PROCESS_OPTIONS_INTERNAL must be 8-byte aligned");
// CONTAINER DEFINITIONS
typedef struct WSLC_CONTAINER_OPTIONS_INTERNAL
{
PCSTR image; // Image name (repository:tag)
PCSTR runtimeName; // Container runtime name (expected to allow DNS resolution between containers)
PCSTR HostName;
PCSTR DomainName;
const WslcContainerPortMapping* ports;
uint32_t portsCount;
const WslcContainerVolume* volumes;
uint32_t volumesCount;
const WSLC_CONTAINER_PROCESS_OPTIONS_INTERNAL* initProcessOptions;
WslcContainerNetworkingMode networking;
WslcContainerFlags containerFlags;
} WSLC_CONTAINER_OPTIONS_INTERNAL;
static_assert(
sizeof(WSLC_CONTAINER_OPTIONS_INTERNAL) == WSLC_CONTAINER_OPTIONS_SIZE, "WSLC_CONTAINER_OPTIONS_INTERNAL must be 80 bytes");
static_assert(
__alignof(WSLC_CONTAINER_OPTIONS_INTERNAL) == WSLC_CONTAINER_OPTIONS_ALIGNMENT,
"WSLC_CONTAINER_OPTIONS_INTERNAL must be 8-byte aligned");
// Use to allocate the actual objects on the heap to keep it alive.
struct WslcSessionImpl
{
wil::com_ptr<IWSLASessionManager> sessionManager;
};
struct WslcContainerImpl
{
wil::com_ptr<IWSLAContainer> container;
};
struct WslcProcessImpl
{
wil::com_ptr<IWSLAProcess> process;
};