Changeset 17881 in vbox
- Timestamp:
- Mar 14, 2009 11:33:49 PM (16 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/DhcpServerImpl.cpp
r17875 r17881 25 25 #include "Logging.h" 26 26 27 #include <VBox/settings.h> 28 27 29 // constructor / destructor 28 30 ///////////////////////////////////////////////////////////////////////////// … … 40 42 } 41 43 42 HRESULT DhcpServer::init(IN_BSTR aName) 43 { 44 return E_NOTIMPL; 45 } 46 47 HRESULT DhcpServer::init(const settings::Key &aNode) 48 { 49 return E_NOTIMPL; 44 HRESULT DhcpServer::init(VirtualBox *aVirtualBox, IN_BSTR aName) 45 { 46 AssertReturn (aName != NULL, E_INVALIDARG); 47 48 AutoInitSpan autoInitSpan (this); 49 AssertReturn (autoInitSpan.isOk(), E_FAIL); 50 51 unconst(mName) = aName; 52 53 /* register with VirtualBox early, since uninit() will 54 * unconditionally unregister on failure */ 55 aVirtualBox->addDependentChild (this); 56 57 /* Confirm a successful initialization */ 58 autoInitSpan.setSucceeded(); 59 60 return S_OK; 61 } 62 63 HRESULT DhcpServer::init(VirtualBox *aVirtualBox, const settings::Key &aNode) 64 { 65 using namespace settings; 66 67 /* Enclose the state transition NotReady->InInit->Ready */ 68 AutoInitSpan autoInitSpan (this); 69 AssertReturn (autoInitSpan.isOk(), E_FAIL); 70 71 aVirtualBox->addDependentChild (this); 72 73 unconst(mName) = aNode.stringValue ("networkName"); 74 m.IPAddress = aNode.stringValue ("IPAddress"); 75 m.networkMask = aNode.stringValue ("networkMask"); 76 m.enabled = aNode.value <BOOL> ("enabled"); 77 m.FromIPAddress = aNode.stringValue ("lowerIp"); 78 m.ToIPAddress = aNode.stringValue ("upperIp"); 79 80 autoInitSpan.setSucceeded(); 81 82 return S_OK; 50 83 } 51 84 52 85 HRESULT DhcpServer::saveSettings (settings::Key &aParentNode) 53 86 { 54 return E_NOTIMPL; 87 using namespace settings; 88 89 AssertReturn (!aParentNode.isNull(), E_FAIL); 90 91 AutoCaller autoCaller (this); 92 CheckComRCReturnRC (autoCaller.rc()); 93 94 AutoReadLock alock (this); 95 96 Key aNode = aParentNode.appendKey ("DhcpServer"); 97 /* required */ 98 aNode.setValue <Bstr> ("networkName", mName); 99 aNode.setValue <Bstr> ("IPAddress", m.IPAddress); 100 aNode.setValue <Bstr> ("networkMask", m.networkMask); 101 if(!m.FromIPAddress.isNull()) 102 aNode.setValue <Bstr> ("FromIPAddress", m.FromIPAddress); 103 if(!m.ToIPAddress.isNull()) 104 aNode.setValue <Bstr> ("ToIPAddress", m.ToIPAddress); 105 106 return S_OK; 55 107 } 56 108 … … 146 198 STDMETHODIMP DhcpServer::SetConfiguration (IN_BSTR aIPAddress, IN_BSTR aNetworkMask, IN_BSTR aFromIPAddress, IN_BSTR aToIPAddress) 147 199 { 148 return E_NOTIMPL; 149 } 200 AssertReturn (aIPAddress != NULL, E_INVALIDARG); 201 AssertReturn (aNetworkMask != NULL, E_INVALIDARG); 202 AssertReturn (aFromIPAddress != NULL, E_INVALIDARG); 203 AssertReturn (aToIPAddress != NULL, E_INVALIDARG); 204 205 m.IPAddress = aIPAddress; 206 m.networkMask = aNetworkMask; 207 m.FromIPAddress = aFromIPAddress; 208 m.ToIPAddress = aToIPAddress; 209 210 return S_OK; 211 } -
trunk/src/VBox/Main/VirtualBoxImpl.cpp
r17876 r17881 3156 3156 ComObjPtr<DhcpServer> dhcpServer; 3157 3157 dhcpServer.createObject(); 3158 rc = dhcpServer->init ( *it);3158 rc = dhcpServer->init (this, *it); 3159 3159 CheckComRCBreakRC (rc); 3160 3160 … … 4663 4663 ComObjPtr<DhcpServer> dhcpServer; 4664 4664 dhcpServer.createObject(); 4665 HRESULT rc = dhcpServer->init ( aName);4665 HRESULT rc = dhcpServer->init (this, aName); 4666 4666 CheckComRCReturnRC (rc); 4667 4667 … … 4765 4765 if(SUCCEEDED(rc)) 4766 4766 { 4767 return E_ FAIL;4767 return E_INVALIDARG; 4768 4768 } 4769 4769 -
trunk/src/VBox/Main/include/DhcpServerImpl.h
r17875 r17881 60 60 void FinalRelease(); 61 61 62 HRESULT init( IN_BSTR aName);63 HRESULT init( const settings::Key &aNode);62 HRESULT init(VirtualBox *aVirtualBox, IN_BSTR aName); 63 HRESULT init(VirtualBox *aVirtualBox, const settings::Key &aNode); 64 64 HRESULT saveSettings (settings::Key &aParentNode); 65 65 -
trunk/src/VBox/Main/xml/VirtualBox-settings-common.xsd
r17872 r17881 257 257 <xsd:complexType name="TDhcpServer"> 258 258 <xsd:attribute name="networkName" type="xsd:string" use="required"/> 259 <xsd:attribute name="lowerIp" type="xsd:string" use=" optional"/>260 <xsd:attribute name="upperIp" type="xsd:string" use=" optional"/>259 <xsd:attribute name="lowerIp" type="xsd:string" use="required"/> 260 <xsd:attribute name="upperIp" type="xsd:string" use="required"/> 261 261 <xsd:attribute name="IPAddress" type="xsd:string" use="required"/> 262 262 <xsd:attribute name="networkMask" type="xsd:string" use="required"/>
Note:
See TracChangeset
for help on using the changeset viewer.