1 | /* $Id: DHCPConfigImpl.h 79747 2019-07-12 23:00:54Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VirtualBox Main - IDHCPConfig, IDHCPConfigGlobal, IDHCPConfigGroup, IDHCPConfigIndividual header.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2019 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_DHCPConfigImpl_h
|
---|
19 | #define MAIN_INCLUDED_DHCPConfigImpl_h
|
---|
20 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
21 | # pragma once
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | #include "DHCPGlobalConfigWrap.h"
|
---|
25 | #include "DHCPGroupConditionWrap.h"
|
---|
26 | #include "DHCPGroupConfigWrap.h"
|
---|
27 | #include "DHCPIndividualConfigWrap.h"
|
---|
28 | #include <VBox/settings.h>
|
---|
29 |
|
---|
30 |
|
---|
31 | class DHCPServer;
|
---|
32 | class DHCPGroupConfig;
|
---|
33 |
|
---|
34 |
|
---|
35 | /**
|
---|
36 | * Base class for the a DHCP configration layer.
|
---|
37 | *
|
---|
38 | * This does not inherit from DHCPConfigWrap because its children need to
|
---|
39 | * inherit from children of DHCPConfigWrap, which smells like trouble and thus
|
---|
40 | * wasn't even attempted. Instead, we have a hack for passing a pointer that we
|
---|
41 | * can call setError and such on.
|
---|
42 | */
|
---|
43 | class DHCPConfig
|
---|
44 | {
|
---|
45 | protected:
|
---|
46 | /** Config scope (global, group, vm+nic, mac). */
|
---|
47 | DHCPConfigScope_T const m_enmScope;
|
---|
48 | /** Minimum lease time. */
|
---|
49 | ULONG m_secMinLeaseTime;
|
---|
50 | /** Default lease time. */
|
---|
51 | ULONG m_secDefaultLeaseTime;
|
---|
52 | /** Maximum lease time. */
|
---|
53 | ULONG m_secMaxLeaseTime;
|
---|
54 | /** DHCP option map. */
|
---|
55 | settings::DhcpOptionMap m_OptionMap;
|
---|
56 | /** The DHCP server parent (weak). */
|
---|
57 | DHCPServer * const m_pParent;
|
---|
58 | /** The DHCP server parent (weak). */
|
---|
59 | VirtualBox * const m_pVirtualBox;
|
---|
60 | private:
|
---|
61 | /** For setError and such. */
|
---|
62 | VirtualBoxBase * const m_pHack;
|
---|
63 |
|
---|
64 | protected:
|
---|
65 | /** @name Constructors and destructors.
|
---|
66 | * @{ */
|
---|
67 | DHCPConfig(DHCPConfigScope_T a_enmScope, VirtualBoxBase *a_pHack)
|
---|
68 | : m_enmScope(a_enmScope), m_secMinLeaseTime(0), m_secDefaultLeaseTime(0), m_secMaxLeaseTime(0), m_OptionMap()
|
---|
69 | , m_pParent(NULL), m_pVirtualBox(NULL), m_pHack(a_pHack)
|
---|
70 | {}
|
---|
71 | DHCPConfig();
|
---|
72 | virtual ~DHCPConfig()
|
---|
73 | {}
|
---|
74 | HRESULT i_initWithDefaults(VirtualBox *a_pVirtualBox, DHCPServer *a_pParent);
|
---|
75 | HRESULT i_initWithSettings(VirtualBox *a_pVirtualBox, DHCPServer *a_pParent, const settings::DHCPConfig &rConfig);
|
---|
76 | /** @} */
|
---|
77 |
|
---|
78 | /** @name IDHCPConfig properties
|
---|
79 | * @{ */
|
---|
80 | HRESULT i_getScope(DHCPConfigScope_T *aScope);
|
---|
81 | HRESULT i_getMinLeaseTime(ULONG *aMinLeaseTime);
|
---|
82 | HRESULT i_setMinLeaseTime(ULONG aMinLeaseTime);
|
---|
83 | HRESULT i_getDefaultLeaseTime(ULONG *aDefaultLeaseTime);
|
---|
84 | HRESULT i_setDefaultLeaseTime(ULONG aDefaultLeaseTime);
|
---|
85 | HRESULT i_getMaxLeaseTime(ULONG *aMaxLeaseTime);
|
---|
86 | HRESULT i_setMaxLeaseTime(ULONG aMaxLeaseTime);
|
---|
87 | /** @} */
|
---|
88 |
|
---|
89 | public:
|
---|
90 | /** @name IDHCPConfig methods
|
---|
91 | * @note public because the DHCPServer needs them for 6.0 interfaces.
|
---|
92 | * @todo Make protected again when IDHCPServer is cleaned up.
|
---|
93 | * @{ */
|
---|
94 | virtual HRESULT i_setOption(DhcpOpt_T aOption, DHCPOptionEncoding_T aEncoding, const com::Utf8Str &aValue);
|
---|
95 |
|
---|
96 | virtual HRESULT i_removeOption(DhcpOpt_T aOption);
|
---|
97 | virtual HRESULT i_removeAllOptions();
|
---|
98 | HRESULT i_getOption(DhcpOpt_T aOption, DHCPOptionEncoding_T *aEncoding, com::Utf8Str &aValue);
|
---|
99 | HRESULT i_getAllOptions(std::vector<DhcpOpt_T> &aOptions, std::vector<DHCPOptionEncoding_T> &aEncodings,
|
---|
100 | std::vector<com::Utf8Str> &aValues);
|
---|
101 | /** @} */
|
---|
102 |
|
---|
103 |
|
---|
104 | public:
|
---|
105 | HRESULT i_doWriteConfig();
|
---|
106 | HRESULT i_saveSettings(settings::DHCPConfig &a_rDst);
|
---|
107 | DHCPConfigScope_T i_getScope() const RT_NOEXCEPT { return m_enmScope; }
|
---|
108 | virtual void i_writeDhcpdConfig(xml::ElementNode *pElm);
|
---|
109 | };
|
---|
110 |
|
---|
111 |
|
---|
112 | /**
|
---|
113 | * Global DHCP configuration.
|
---|
114 | */
|
---|
115 | class DHCPGlobalConfig : public DHCPGlobalConfigWrap, public DHCPConfig
|
---|
116 | {
|
---|
117 | public:
|
---|
118 | /** @name Constructors and destructors.
|
---|
119 | * @{ */
|
---|
120 | DHCPGlobalConfig()
|
---|
121 | : DHCPConfig(DHCPConfigScope_Global, this)
|
---|
122 | { }
|
---|
123 | HRESULT FinalConstruct()
|
---|
124 | {
|
---|
125 | return BaseFinalConstruct();
|
---|
126 | }
|
---|
127 | void FinalRelease()
|
---|
128 | {
|
---|
129 | uninit();
|
---|
130 | BaseFinalRelease();
|
---|
131 | }
|
---|
132 | HRESULT initWithDefaults(VirtualBox *a_pVirtualBox, DHCPServer *a_pParent);
|
---|
133 | HRESULT initWithSettings(VirtualBox *a_pVirtualBox, DHCPServer *a_pParent, const settings::DHCPConfig &rConfig);
|
---|
134 | void uninit();
|
---|
135 | /** @} */
|
---|
136 |
|
---|
137 | HRESULT i_saveSettings(settings::DHCPConfig &a_rDst);
|
---|
138 | HRESULT i_getNetworkMask(com::Utf8Str &a_rDst);
|
---|
139 | HRESULT i_setNetworkMask(const com::Utf8Str &a_rSrc);
|
---|
140 |
|
---|
141 | protected:
|
---|
142 | /** @name wrapped IDHCPConfig properties
|
---|
143 | * @{ */
|
---|
144 | HRESULT getScope(DHCPConfigScope_T *aScope) RT_OVERRIDE { return i_getScope(aScope); }
|
---|
145 | HRESULT getMinLeaseTime(ULONG *aMinLeaseTime) RT_OVERRIDE { return i_getMinLeaseTime(aMinLeaseTime); }
|
---|
146 | HRESULT setMinLeaseTime(ULONG aMinLeaseTime) RT_OVERRIDE { return i_setMinLeaseTime(aMinLeaseTime); }
|
---|
147 | HRESULT getDefaultLeaseTime(ULONG *aDefaultLeaseTime) RT_OVERRIDE { return i_getDefaultLeaseTime(aDefaultLeaseTime); }
|
---|
148 | HRESULT setDefaultLeaseTime(ULONG aDefaultLeaseTime) RT_OVERRIDE { return i_setDefaultLeaseTime(aDefaultLeaseTime); }
|
---|
149 | HRESULT getMaxLeaseTime(ULONG *aMaxLeaseTime) RT_OVERRIDE { return i_getMaxLeaseTime(aMaxLeaseTime); }
|
---|
150 | HRESULT setMaxLeaseTime(ULONG aMaxLeaseTime) RT_OVERRIDE { return i_setMaxLeaseTime(aMaxLeaseTime); }
|
---|
151 | /** @} */
|
---|
152 |
|
---|
153 | /** @name wrapped IDHCPConfig methods
|
---|
154 | * @{ */
|
---|
155 | HRESULT setOption(DhcpOpt_T aOption, DHCPOptionEncoding_T aEncoding, const com::Utf8Str &aValue) RT_OVERRIDE
|
---|
156 | {
|
---|
157 | return i_setOption(aOption, aEncoding, aValue);
|
---|
158 | }
|
---|
159 |
|
---|
160 | HRESULT removeOption(DhcpOpt_T aOption) RT_OVERRIDE
|
---|
161 | {
|
---|
162 | return i_removeOption(aOption);
|
---|
163 | }
|
---|
164 |
|
---|
165 | HRESULT removeAllOptions() RT_OVERRIDE
|
---|
166 | {
|
---|
167 | return i_removeAllOptions();
|
---|
168 | }
|
---|
169 |
|
---|
170 | HRESULT getOption(DhcpOpt_T aOption, DHCPOptionEncoding_T *aEncoding, com::Utf8Str &aValue) RT_OVERRIDE
|
---|
171 | {
|
---|
172 | return i_getOption(aOption, aEncoding, aValue);
|
---|
173 | }
|
---|
174 |
|
---|
175 | HRESULT getAllOptions(std::vector<DhcpOpt_T> &aOptions, std::vector<DHCPOptionEncoding_T> &aEncodings,
|
---|
176 | std::vector<com::Utf8Str> &aValues) RT_OVERRIDE
|
---|
177 | {
|
---|
178 | return i_getAllOptions(aOptions, aEncodings, aValues);
|
---|
179 | }
|
---|
180 | /** @} */
|
---|
181 |
|
---|
182 | public:
|
---|
183 | HRESULT i_setOption(DhcpOpt_T aOption, DHCPOptionEncoding_T aEncoding, const com::Utf8Str &aValue) RT_OVERRIDE;
|
---|
184 | HRESULT i_removeOption(DhcpOpt_T aOption) RT_OVERRIDE;
|
---|
185 | HRESULT i_removeAllOptions() RT_OVERRIDE;
|
---|
186 | };
|
---|
187 |
|
---|
188 |
|
---|
189 | /**
|
---|
190 | * DHCP Group inclusion/exclusion condition.
|
---|
191 | */
|
---|
192 | class DHCPGroupCondition : public DHCPGroupConditionWrap
|
---|
193 | {
|
---|
194 | private:
|
---|
195 | /** Inclusive or exclusive condition. */
|
---|
196 | bool m_fInclusive;
|
---|
197 | /** The condition type (or how m_strValue should be interpreted). */
|
---|
198 | DHCPGroupConditionType_T m_enmType;
|
---|
199 | /** The value. Interpreted according to m_enmType. */
|
---|
200 | com::Utf8Str m_strValue;
|
---|
201 | /** Pointer to the parent (weak). */
|
---|
202 | DHCPGroupConfig *m_pParent;
|
---|
203 |
|
---|
204 | public:
|
---|
205 | /** @name Constructors and destructors.
|
---|
206 | * @{ */
|
---|
207 | DHCPGroupCondition()
|
---|
208 | : m_enmType(DHCPGroupConditionType_MAC)
|
---|
209 | , m_pParent(NULL)
|
---|
210 | {}
|
---|
211 | HRESULT FinalConstruct()
|
---|
212 | {
|
---|
213 | return BaseFinalConstruct();
|
---|
214 | }
|
---|
215 | void FinalRelease()
|
---|
216 | {
|
---|
217 | uninit();
|
---|
218 | BaseFinalRelease();
|
---|
219 | }
|
---|
220 | HRESULT initWithDefaults(DHCPGroupConfig *a_pParent, bool a_fInclusive, DHCPGroupConditionType_T a_enmType,
|
---|
221 | const com::Utf8Str a_strValue);
|
---|
222 | HRESULT initWithSettings(DHCPGroupConfig *a_pParent, const settings::DHCPGroupCondition &a_rSrc);
|
---|
223 | void uninit();
|
---|
224 | /** @} */
|
---|
225 |
|
---|
226 | HRESULT i_saveSettings(settings::DHCPGroupCondition &a_rDst);
|
---|
227 |
|
---|
228 | protected:
|
---|
229 | /** @name Wrapped IDHCPGroupCondition properties
|
---|
230 | * @{ */
|
---|
231 | HRESULT getInclusive(BOOL *aInclusive) RT_OVERRIDE;
|
---|
232 | HRESULT setInclusive(BOOL aInclusive) RT_OVERRIDE;
|
---|
233 | HRESULT getType(DHCPGroupConditionType_T *aType) RT_OVERRIDE;
|
---|
234 | HRESULT setType(DHCPGroupConditionType_T aType) RT_OVERRIDE;
|
---|
235 | HRESULT getValue(com::Utf8Str &aValue) RT_OVERRIDE;
|
---|
236 | HRESULT setValue(const com::Utf8Str &aValue) RT_OVERRIDE;
|
---|
237 | /** @} */
|
---|
238 |
|
---|
239 | /** @name Wrapped IDHCPGroupCondition methods
|
---|
240 | * @{ */
|
---|
241 | HRESULT remove() RT_OVERRIDE;
|
---|
242 | /** @} */
|
---|
243 | };
|
---|
244 |
|
---|
245 |
|
---|
246 | /**
|
---|
247 | * Group configuration.
|
---|
248 | */
|
---|
249 | class DHCPGroupConfig : public DHCPGroupConfigWrap, public DHCPConfig
|
---|
250 | {
|
---|
251 | private:
|
---|
252 | /** Group name. */
|
---|
253 | com::Utf8Str m_strName;
|
---|
254 | /** Group membership conditions. */
|
---|
255 | std::vector<ComObjPtr<DHCPGroupCondition> > m_Conditions;
|
---|
256 | /** Iterator for m_Conditions. */
|
---|
257 | typedef std::vector<ComObjPtr<DHCPGroupCondition> >::iterator ConditionsIterator;
|
---|
258 |
|
---|
259 | public:
|
---|
260 | /** @name Constructors and destructors.
|
---|
261 | * @{ */
|
---|
262 | DHCPGroupConfig()
|
---|
263 | : DHCPConfig(DHCPConfigScope_Group, this)
|
---|
264 | { }
|
---|
265 | HRESULT FinalConstruct()
|
---|
266 | {
|
---|
267 | return BaseFinalConstruct();
|
---|
268 | }
|
---|
269 | void FinalRelease()
|
---|
270 | {
|
---|
271 | uninit();
|
---|
272 | BaseFinalRelease();
|
---|
273 | }
|
---|
274 | HRESULT initWithDefaults(VirtualBox *a_pVirtualBox, DHCPServer *a_pParent, const com::Utf8Str &a_rName);
|
---|
275 | HRESULT initWithSettings(VirtualBox *a_pVirtualBox, DHCPServer *a_pParent, const settings::DHCPGroupConfig &a_rSrc);
|
---|
276 | void uninit();
|
---|
277 | /** @} */
|
---|
278 |
|
---|
279 | HRESULT i_saveSettings(settings::DHCPGroupConfig &a_rDst);
|
---|
280 | HRESULT i_removeCondition(DHCPGroupCondition *a_pCondition);
|
---|
281 |
|
---|
282 | protected:
|
---|
283 | /** @name Wrapped IDHCPConfig properties
|
---|
284 | * @{ */
|
---|
285 | HRESULT getScope(DHCPConfigScope_T *aScope) RT_OVERRIDE { return i_getScope(aScope); }
|
---|
286 | HRESULT getMinLeaseTime(ULONG *aMinLeaseTime) RT_OVERRIDE { return i_getMinLeaseTime(aMinLeaseTime); }
|
---|
287 | HRESULT setMinLeaseTime(ULONG aMinLeaseTime) RT_OVERRIDE { return i_setMinLeaseTime(aMinLeaseTime); }
|
---|
288 | HRESULT getDefaultLeaseTime(ULONG *aDefaultLeaseTime) RT_OVERRIDE { return i_getDefaultLeaseTime(aDefaultLeaseTime); }
|
---|
289 | HRESULT setDefaultLeaseTime(ULONG aDefaultLeaseTime) RT_OVERRIDE { return i_setDefaultLeaseTime(aDefaultLeaseTime); }
|
---|
290 | HRESULT getMaxLeaseTime(ULONG *aMaxLeaseTime) RT_OVERRIDE { return i_getMaxLeaseTime(aMaxLeaseTime); }
|
---|
291 | HRESULT setMaxLeaseTime(ULONG aMaxLeaseTime) RT_OVERRIDE { return i_setMaxLeaseTime(aMaxLeaseTime); }
|
---|
292 | /** @} */
|
---|
293 |
|
---|
294 | /** @name Wrapped IDHCPGroupConfig properties
|
---|
295 | * @{ */
|
---|
296 | HRESULT getName(com::Utf8Str &aName) RT_OVERRIDE;
|
---|
297 | HRESULT setName(const com::Utf8Str &aName) RT_OVERRIDE;
|
---|
298 | HRESULT getConditions(std::vector<ComPtr<IDHCPGroupCondition> > &aConditions) RT_OVERRIDE;
|
---|
299 | /** @} */
|
---|
300 |
|
---|
301 | /** @name Wrapped IDHCPConfig methods
|
---|
302 | * @{ */
|
---|
303 | HRESULT setOption(DhcpOpt_T aOption, DHCPOptionEncoding_T aEncoding, const com::Utf8Str &aValue) RT_OVERRIDE
|
---|
304 | {
|
---|
305 | return i_setOption(aOption, aEncoding, aValue);
|
---|
306 | }
|
---|
307 |
|
---|
308 | HRESULT removeOption(DhcpOpt_T aOption) RT_OVERRIDE
|
---|
309 | {
|
---|
310 | return i_removeOption(aOption);
|
---|
311 | }
|
---|
312 |
|
---|
313 | HRESULT removeAllOptions() RT_OVERRIDE
|
---|
314 | {
|
---|
315 | return i_removeAllOptions();
|
---|
316 | }
|
---|
317 |
|
---|
318 | HRESULT getOption(DhcpOpt_T aOption, DHCPOptionEncoding_T *aEncoding, com::Utf8Str &aValue) RT_OVERRIDE
|
---|
319 | {
|
---|
320 | return i_getOption(aOption, aEncoding, aValue);
|
---|
321 | }
|
---|
322 |
|
---|
323 | HRESULT getAllOptions(std::vector<DhcpOpt_T> &aOptions, std::vector<DHCPOptionEncoding_T> &aEncodings,
|
---|
324 | std::vector<com::Utf8Str> &aValues) RT_OVERRIDE
|
---|
325 | {
|
---|
326 | return i_getAllOptions(aOptions, aEncodings, aValues);
|
---|
327 | }
|
---|
328 | /** @} */
|
---|
329 |
|
---|
330 | /** @name Wrapped IDHCPGroupConfig methods
|
---|
331 | * @{ */
|
---|
332 | HRESULT addCondition(BOOL aInclusive, DHCPGroupConditionType_T aType, const com::Utf8Str &aValue,
|
---|
333 | ComPtr<IDHCPGroupCondition> &aCondition) RT_OVERRIDE;
|
---|
334 | /** @} */
|
---|
335 | };
|
---|
336 |
|
---|
337 |
|
---|
338 | /**
|
---|
339 | * Individual DHCP configuration.
|
---|
340 | */
|
---|
341 | class DHCPIndividualConfig : public DHCPIndividualConfigWrap, public DHCPConfig
|
---|
342 | {
|
---|
343 | private:
|
---|
344 | /** The MAC address or all zeros. */
|
---|
345 | RTMAC m_MACAddress;
|
---|
346 | /** The VM ID or all zeros. */
|
---|
347 | com::Guid const m_idMachine;
|
---|
348 | /** The VM NIC slot number, or ~(ULONG)0. */
|
---|
349 | ULONG const m_uSlot;
|
---|
350 | /** This is part of a hack to resolve the MAC address for
|
---|
351 | * DHCPConfigScope_MachineNIC instances. If non-zero, we m_MACAddress is valid.
|
---|
352 | * To deal with the impossibly theoretical scenario that the DHCP server is
|
---|
353 | * being started by more than one thread, this is a version number and not just
|
---|
354 | * a boolean indicator. */
|
---|
355 | uint32_t volatile m_uMACAddressResolvedVersion;
|
---|
356 |
|
---|
357 | /** The fixed IPv4 address, empty if dynamic. */
|
---|
358 | com::Utf8Str m_strFixedAddress;
|
---|
359 |
|
---|
360 | public:
|
---|
361 | /** @name Constructors and destructors.
|
---|
362 | * @{ */
|
---|
363 | DHCPIndividualConfig()
|
---|
364 | : DHCPConfig(DHCPConfigScope_MAC, this)
|
---|
365 | , m_uSlot(~(ULONG)0)
|
---|
366 | , m_uMACAddressResolvedVersion(false)
|
---|
367 | {
|
---|
368 | RT_ZERO(m_MACAddress);
|
---|
369 | }
|
---|
370 | HRESULT FinalConstruct()
|
---|
371 | {
|
---|
372 | return BaseFinalConstruct();
|
---|
373 | }
|
---|
374 | void FinalRelease()
|
---|
375 | {
|
---|
376 | uninit();
|
---|
377 | BaseFinalRelease();
|
---|
378 | }
|
---|
379 | HRESULT initWithMachineIdAndSlot(VirtualBox *a_pVirtualBox, DHCPServer *a_pParent, com::Guid const &a_idMachine,
|
---|
380 | ULONG a_uSlot, uint32_t a_uMACAddressVersion);
|
---|
381 | HRESULT initWithMACAddress(VirtualBox *a_pVirtualBox, DHCPServer *a_pParent, PCRTMAC a_pMACAddress);
|
---|
382 | HRESULT initWithSettingsAndMachineIdAndSlot(VirtualBox *a_pVirtualBox, DHCPServer *a_pParent,
|
---|
383 | const settings::DHCPIndividualConfig &rData, com::Guid const &a_idMachine,
|
---|
384 | ULONG a_uSlot, uint32_t a_uMACAddressVersion);
|
---|
385 | HRESULT initWithSettingsAndMACAddress(VirtualBox *a_pVirtualBox, DHCPServer *a_pParent,
|
---|
386 | const settings::DHCPIndividualConfig &rData, PCRTMAC a_pMACAddress);
|
---|
387 | void uninit();
|
---|
388 | /** @} */
|
---|
389 |
|
---|
390 | /** @name Internal methods that are public for various reasons
|
---|
391 | * @{ */
|
---|
392 | HRESULT i_saveSettings(settings::DHCPIndividualConfig &a_rDst);
|
---|
393 | RTMAC const &i_getMACAddress() const RT_NOEXCEPT { return m_MACAddress; }
|
---|
394 | com::Guid const &i_getMachineId() const RT_NOEXCEPT { return m_idMachine; }
|
---|
395 | ULONG i_getSlot() const RT_NOEXCEPT { return m_uSlot; }
|
---|
396 | HRESULT i_getMachineMAC(PRTMAC pMACAddress);
|
---|
397 |
|
---|
398 | HRESULT i_resolveMACAddress(uint32_t uVersion);
|
---|
399 | /** This is used to avoid producing bogus Dhcpd configuration elements. */
|
---|
400 | bool i_isMACAddressResolved(uint32_t uVersion) const
|
---|
401 | {
|
---|
402 | return m_enmScope != DHCPConfigScope_MachineNIC || (int32_t)(m_uMACAddressResolvedVersion - uVersion) >= 0;
|
---|
403 | }
|
---|
404 | void i_writeDhcpdConfig(xml::ElementNode *pElm) RT_OVERRIDE;
|
---|
405 | /** @} */
|
---|
406 |
|
---|
407 | protected:
|
---|
408 | /** @name wrapped IDHCPConfig properties
|
---|
409 | * @{ */
|
---|
410 | HRESULT getScope(DHCPConfigScope_T *aScope) RT_OVERRIDE { return i_getScope(aScope); }
|
---|
411 | HRESULT getMinLeaseTime(ULONG *aMinLeaseTime) RT_OVERRIDE { return i_getMinLeaseTime(aMinLeaseTime); }
|
---|
412 | HRESULT setMinLeaseTime(ULONG aMinLeaseTime) RT_OVERRIDE { return i_setMinLeaseTime(aMinLeaseTime); }
|
---|
413 | HRESULT getDefaultLeaseTime(ULONG *aDefaultLeaseTime) RT_OVERRIDE { return i_getDefaultLeaseTime(aDefaultLeaseTime); }
|
---|
414 | HRESULT setDefaultLeaseTime(ULONG aDefaultLeaseTime) RT_OVERRIDE { return i_setDefaultLeaseTime(aDefaultLeaseTime); }
|
---|
415 | HRESULT getMaxLeaseTime(ULONG *aMaxLeaseTime) RT_OVERRIDE { return i_getMaxLeaseTime(aMaxLeaseTime); }
|
---|
416 | HRESULT setMaxLeaseTime(ULONG aMaxLeaseTime) RT_OVERRIDE { return i_setMaxLeaseTime(aMaxLeaseTime); }
|
---|
417 | /** @} */
|
---|
418 |
|
---|
419 | /** @name wrapped IDHCPConfig methods
|
---|
420 | * @{ */
|
---|
421 | HRESULT setOption(DhcpOpt_T aOption, DHCPOptionEncoding_T aEncoding, const com::Utf8Str &aValue) RT_OVERRIDE
|
---|
422 | {
|
---|
423 | return i_setOption(aOption, aEncoding, aValue);
|
---|
424 | }
|
---|
425 |
|
---|
426 | HRESULT removeOption(DhcpOpt_T aOption) RT_OVERRIDE
|
---|
427 | {
|
---|
428 | return i_removeOption(aOption);
|
---|
429 | }
|
---|
430 |
|
---|
431 | HRESULT removeAllOptions() RT_OVERRIDE
|
---|
432 | {
|
---|
433 | return i_removeAllOptions();
|
---|
434 | }
|
---|
435 |
|
---|
436 | HRESULT getOption(DhcpOpt_T aOption, DHCPOptionEncoding_T *aEncoding, com::Utf8Str &aValue) RT_OVERRIDE
|
---|
437 | {
|
---|
438 | return i_getOption(aOption, aEncoding, aValue);
|
---|
439 | }
|
---|
440 |
|
---|
441 | HRESULT getAllOptions(std::vector<DhcpOpt_T> &aOptions, std::vector<DHCPOptionEncoding_T> &aEncodings,
|
---|
442 | std::vector<com::Utf8Str> &aValues) RT_OVERRIDE
|
---|
443 | {
|
---|
444 | return i_getAllOptions(aOptions, aEncodings, aValues);
|
---|
445 | }
|
---|
446 | /** @} */
|
---|
447 |
|
---|
448 | /** @name IDHCPIndividualConfig properties
|
---|
449 | * @{ */
|
---|
450 | HRESULT getMACAddress(com::Utf8Str &aMacAddress) RT_OVERRIDE;
|
---|
451 | HRESULT getMachineId(com::Guid &aId) RT_OVERRIDE;
|
---|
452 | HRESULT getSlot(ULONG *aSlot) RT_OVERRIDE;
|
---|
453 | HRESULT getFixedAddress(com::Utf8Str &aFixedAddress) RT_OVERRIDE;
|
---|
454 | HRESULT setFixedAddress(const com::Utf8Str &aFixedAddress) RT_OVERRIDE;
|
---|
455 | /** @} */
|
---|
456 | };
|
---|
457 |
|
---|
458 | #endif /* !MAIN_INCLUDED_DHCPConfigImpl_h */
|
---|
459 |
|
---|