VirtualBox

source: vbox/trunk/src/VBox/Main/include/DHCPServerImpl.h@ 54347

Last change on this file since 54347 was 54347, checked in by vboxsync, 10 years ago

Main/DHCPServerImpl: cosmetic - be consistent in using plural "aValues".

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.3 KB
Line 
1/* $Id: DHCPServerImpl.h 54347 2015-02-20 22:43:16Z vboxsync $ */
2
3/** @file
4 *
5 * VirtualBox COM class implementation
6 */
7
8/*
9 * Copyright (C) 2006-2013 Oracle Corporation
10 *
11 * This file is part of VirtualBox Open Source Edition (OSE), as
12 * available from http://www.215389.xyz. This file is free software;
13 * you can redistribute it and/or modify it under the terms of the GNU
14 * General Public License (GPL) as published by the Free Software
15 * Foundation, in version 2 as it comes in the "COPYING" file of the
16 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
17 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
18 */
19
20#ifndef ____H_H_DHCPSERVERIMPL
21#define ____H_H_DHCPSERVERIMPL
22
23#include <VBox/settings.h>
24#include "DHCPServerWrap.h"
25
26#ifdef VBOX_WITH_HOSTNETIF_API
27struct NETIFINFO;
28#endif
29
30#ifdef RT_OS_WINDOWS
31# define DHCP_EXECUTABLE_NAME "VBoxNetDHCP.exe"
32#else
33# define DHCP_EXECUTABLE_NAME "VBoxNetDHCP"
34#endif
35
36class DHCPServerRunner: public NetworkServiceRunner
37{
38public:
39 DHCPServerRunner():NetworkServiceRunner(DHCP_EXECUTABLE_NAME){}
40 virtual ~DHCPServerRunner(){};
41
42 static const std::string kDsrKeyGateway;
43 static const std::string kDsrKeyLowerIp;
44 static const std::string kDsrKeyUpperIp;
45};
46
47/**
48 * for server configuration needs, it's perhaps better to use (VM,slot) pair
49 * (vm-name, slot) <----> (MAC)
50 *
51 * but for client configuration, when server will have MACs at hand, it'd be
52 * easier to requiest options by MAC.
53 * (MAC) <----> (option-list)
54 *
55 * Doubts: What should be done if MAC changed for (vm-name, slot), when syncing should?
56 * XML: serialization of dependecy (DHCP options) - (VM,slot) shouldn't be done via MAC in
57 * the middle.
58 */
59
60using settings::DhcpOptValue;
61using settings::DhcpOptionMap;
62using settings::DhcpOptValuePair;
63using settings::DhcpOptConstIterator;
64using settings::DhcpOptIterator;
65
66using settings::VmSlot2OptionsMap;
67using settings::VmSlot2OptionsPair;
68using settings::VmSlot2OptionsIterator;
69
70
71class ATL_NO_VTABLE DHCPServer :
72 public DHCPServerWrap
73{
74public:
75
76 DECLARE_EMPTY_CTOR_DTOR (DHCPServer)
77
78 HRESULT FinalConstruct();
79 void FinalRelease();
80
81 HRESULT init(VirtualBox *aVirtualBox,
82 IN_BSTR aName);
83 HRESULT init(VirtualBox *aVirtualBox,
84 const settings::DHCPServer &data);
85 void uninit();
86
87 // Public internal methids.
88 HRESULT i_saveSettings(settings::DHCPServer &data);
89 DhcpOptionMap& i_findOptMapByVmNameSlot(const com::Utf8Str& aVmName,
90 LONG Slot);
91
92private:
93
94 // wrapped IDHCPServer properties
95 HRESULT getEventSource(ComPtr<IEventSource> &aEventSource);
96 HRESULT getEnabled(BOOL *aEnabled);
97 HRESULT setEnabled(BOOL aEnabled);
98 HRESULT getIPAddress(com::Utf8Str &aIPAddress);
99 HRESULT getNetworkMask(com::Utf8Str &aNetworkMask);
100 HRESULT getNetworkName(com::Utf8Str &aName);
101 HRESULT getLowerIP(com::Utf8Str &aIPAddress);
102 HRESULT getUpperIP(com::Utf8Str &aIPAddress);
103 HRESULT getGlobalOptions(std::vector<com::Utf8Str> &aGlobalOptions);
104 HRESULT getVmConfigs(std::vector<com::Utf8Str> &aVmConfigs);
105 HRESULT getMacOptions(const com::Utf8Str &aMAC, std::vector<com::Utf8Str> &aValues);
106 HRESULT setConfiguration(const com::Utf8Str &aIPAddress,
107 const com::Utf8Str &aNetworkMask,
108 const com::Utf8Str &aFromIPAddress,
109 const com::Utf8Str &aToIPAddress);
110 HRESULT getVmSlotOptions(const com::Utf8Str &aVmName,
111 LONG aSlot,
112 std::vector<com::Utf8Str> &aValues);
113
114 // Wrapped IDHCPServer Methods
115 HRESULT addGlobalOption(DhcpOpt_T aOption,
116 const com::Utf8Str &aValue);
117 HRESULT addVmSlotOption(const com::Utf8Str &aVmName,
118 LONG aSlot,
119 DhcpOpt_T aOption,
120 const com::Utf8Str &aValue);
121 HRESULT removeVmSlotOptions(const com::Utf8Str &aVmName,
122 LONG aSlot);
123 HRESULT start(const com::Utf8Str &aNetworkName,
124 const com::Utf8Str &aTrunkName,
125 const com::Utf8Str &aTrunkType);
126 HRESULT stop();
127
128 struct Data;
129 Data *m;
130 /** weak VirtualBox parent */
131 VirtualBox * const mVirtualBox;
132 const Bstr mName;
133
134};
135
136#endif // ____H_H_DHCPSERVERIMPL
Note: See TracBrowser for help on using the repository browser.

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