VirtualBox

source: vbox/trunk/src/VBox/Main/src-server/win/svchlp.h@ 98110

Last change on this file since 98110 was 98103, checked in by vboxsync, 23 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Revision Author Id
File size: 2.8 KB
Line 
1/* $Id: svchlp.h 98103 2023-01-17 14:15:46Z vboxsync $ */
2/** @file
3 * Declaration of SVC Helper Process control routines.
4 */
5
6/*
7 * Copyright (C) 2006-2023 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * SPDX-License-Identifier: GPL-3.0-only
26 */
27
28#ifndef MAIN_INCLUDED_SRC_src_server_win_svchlp_h
29#define MAIN_INCLUDED_SRC_src_server_win_svchlp_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34#include "VBox/com/string.h"
35#include "VBox/com/guid.h"
36
37#include <VBox/err.h>
38
39#include <iprt/win/windows.h>
40
41struct SVCHlpMsg
42{
43 enum Code
44 {
45 Null = 0, /* no parameters */
46 OK, /* no parameters */
47 Error, /* Utf8Str string (may be null but must present) */
48
49 CreateHostOnlyNetworkInterface = 100, /* see usage in code */
50 CreateHostOnlyNetworkInterface_OK, /* see usage in code */
51 RemoveHostOnlyNetworkInterface, /* see usage in code */
52 EnableDynamicIpConfig, /* see usage in code */
53 EnableStaticIpConfig, /* see usage in code */
54 EnableStaticIpConfigV6, /* see usage in code */
55 DhcpRediscover, /* see usage in code */
56 };
57};
58
59class SVCHlpClient
60{
61public:
62
63 SVCHlpClient();
64 virtual ~SVCHlpClient();
65
66 int create (const char *aName);
67 int connect();
68 int open (const char *aName);
69 int close();
70
71 bool isOpen() const { return mIsOpen; }
72 bool isServer() const { return mIsServer; }
73 const com::Utf8Str &name() const { return mName; }
74
75 int write (const void *aVal, size_t aLen);
76 template <typename Scalar>
77 int write (Scalar aVal) { return write (&aVal, sizeof (aVal)); }
78 int write (const com::Utf8Str &aVal);
79 int write (const com::Guid &aGuid);
80
81 int read (void *aVal, size_t aLen);
82 template <typename Scalar>
83 int read (Scalar &aVal) { return read (&aVal, sizeof (aVal)); }
84 int read (com::Utf8Str &aVal);
85 int read (com::Guid &aGuid);
86
87private:
88
89 bool mIsOpen : 1;
90 bool mIsServer : 1;
91
92 HANDLE mReadEnd;
93 HANDLE mWriteEnd;
94 com::Utf8Str mName;
95};
96
97class SVCHlpServer : public SVCHlpClient
98{
99public:
100
101 SVCHlpServer();
102
103 int run();
104};
105
106#endif /* !MAIN_INCLUDED_SRC_src_server_win_svchlp_h */
107
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette