1 | /* $Id: CloudGateway.h 93312 2022-01-18 13:15:12Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * Implementation of local and cloud gateway management.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2019-2022 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | #ifndef MAIN_INCLUDED_CloudGateway_h
|
---|
19 | #define MAIN_INCLUDED_CloudGateway_h
|
---|
20 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
21 | # pragma once
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | struct GatewayInfo
|
---|
25 | {
|
---|
26 | Bstr mTargetVM;
|
---|
27 | Utf8Str mGatewayInstanceId;
|
---|
28 | Utf8Str mPublicSshKey;
|
---|
29 | Utf8Str mPrivateSshKey;
|
---|
30 | Bstr mCloudProvider;
|
---|
31 | Bstr mCloudProfile;
|
---|
32 | Utf8Str mCloudPublicIp;
|
---|
33 | Utf8Str mCloudSecondaryPublicIp;
|
---|
34 | RTMAC mCloudMacAddress;
|
---|
35 | RTMAC mLocalMacAddress;
|
---|
36 | int mAdapterSlot;
|
---|
37 |
|
---|
38 | HRESULT setCloudMacAddress(const Utf8Str& mac);
|
---|
39 | HRESULT setLocalMacAddress(const Utf8Str& mac);
|
---|
40 |
|
---|
41 | GatewayInfo() {}
|
---|
42 |
|
---|
43 | GatewayInfo(const GatewayInfo& other)
|
---|
44 | : mGatewayInstanceId(other.mGatewayInstanceId),
|
---|
45 | mPublicSshKey(other.mPublicSshKey),
|
---|
46 | mPrivateSshKey(other.mPrivateSshKey),
|
---|
47 | mCloudProvider(other.mCloudProvider),
|
---|
48 | mCloudProfile(other.mCloudProfile),
|
---|
49 | mCloudPublicIp(other.mCloudPublicIp),
|
---|
50 | mCloudSecondaryPublicIp(other.mCloudSecondaryPublicIp),
|
---|
51 | mCloudMacAddress(other.mCloudMacAddress),
|
---|
52 | mLocalMacAddress(other.mLocalMacAddress),
|
---|
53 | mAdapterSlot(other.mAdapterSlot)
|
---|
54 | {}
|
---|
55 |
|
---|
56 | GatewayInfo& operator=(const GatewayInfo& other)
|
---|
57 | {
|
---|
58 | mGatewayInstanceId = other.mGatewayInstanceId;
|
---|
59 | mPublicSshKey = other.mPublicSshKey;
|
---|
60 | mPrivateSshKey = other.mPrivateSshKey;
|
---|
61 | mCloudProvider = other.mCloudProvider;
|
---|
62 | mCloudProfile = other.mCloudProfile;
|
---|
63 | mCloudPublicIp = other.mCloudPublicIp;
|
---|
64 | mCloudSecondaryPublicIp = other.mCloudSecondaryPublicIp;
|
---|
65 | mCloudMacAddress = other.mCloudMacAddress;
|
---|
66 | mLocalMacAddress = other.mLocalMacAddress;
|
---|
67 | mAdapterSlot = other.mAdapterSlot;
|
---|
68 | return *this;
|
---|
69 | }
|
---|
70 |
|
---|
71 | void setNull()
|
---|
72 | {
|
---|
73 | mGatewayInstanceId.setNull();
|
---|
74 | mPublicSshKey.setNull();
|
---|
75 | mPrivateSshKey.setNull();
|
---|
76 | mCloudProvider.setNull();
|
---|
77 | mCloudProfile.setNull();
|
---|
78 | mCloudPublicIp.setNull();
|
---|
79 | mCloudSecondaryPublicIp.setNull();
|
---|
80 | memset(&mCloudMacAddress, 0, sizeof(mCloudMacAddress));
|
---|
81 | memset(&mLocalMacAddress, 0, sizeof(mLocalMacAddress));
|
---|
82 | mAdapterSlot = -1;
|
---|
83 | }
|
---|
84 | };
|
---|
85 |
|
---|
86 | class CloudNetwork;
|
---|
87 |
|
---|
88 | HRESULT startCloudGateway(ComPtr<IVirtualBox> virtualBox, ComPtr<ICloudNetwork> network, GatewayInfo& pGateways);
|
---|
89 | HRESULT stopCloudGateway(ComPtr<IVirtualBox> virtualBox, GatewayInfo& gateways);
|
---|
90 | HRESULT generateKeys(GatewayInfo& gateways);
|
---|
91 |
|
---|
92 | #endif /* !MAIN_INCLUDED_CloudGateway_h */
|
---|
93 |
|
---|