DHCPServerImpl.cpp revision a126a5a0d184e3245a585414758011d1d095b35f
/* $Id$ */
/** @file
*
* VirtualBox COM class implementation
*/
/*
* Copyright (C) 2006-2008 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#include "DHCPServerRunner.h"
#include "DHCPServerImpl.h"
#include "AutoCaller.h"
#include "Logging.h"
#include <VBox/settings.h>
#include "VirtualBoxImpl.h"
// constructor / destructor
/////////////////////////////////////////////////////////////////////////////
: mVirtualBox(NULL)
{
}
DHCPServer::~DHCPServer()
{
}
{
return S_OK;
}
void DHCPServer::FinalRelease()
{
uninit ();
}
void DHCPServer::uninit()
{
/* Enclose the state transition Ready->InUninit->NotReady */
AutoUninitSpan autoUninitSpan(this);
if (autoUninitSpan.uninitDone())
return;
}
{
AutoInitSpan autoInitSpan(this);
/* share VirtualBox weakly (parent remains NULL so far) */
m.IPAddress = "0.0.0.0";
m.networkMask = "0.0.0.0";
m.lowerIP = "0.0.0.0";
m.upperIP = "0.0.0.0";
/* Confirm a successful initialization */
return S_OK;
}
{
/* Enclose the state transition NotReady->InInit->Ready */
AutoInitSpan autoInitSpan(this);
/* share VirtualBox weakly (parent remains NULL so far) */
return S_OK;
}
{
AutoCaller autoCaller(this);
return S_OK;
}
{
AutoCaller autoCaller(this);
return S_OK;
}
{
AutoCaller autoCaller(this);
return S_OK;
}
{
AutoCaller autoCaller(this);
// save the global settings; for that we should hold only the VirtualBox lock
return rc;
}
{
AutoCaller autoCaller(this);
return S_OK;
}
{
AutoCaller autoCaller(this);
return S_OK;
}
{
AutoCaller autoCaller(this);
return S_OK;
}
{
AutoCaller autoCaller(this);
return S_OK;
}
STDMETHODIMP DHCPServer::SetConfiguration (IN_BSTR aIPAddress, IN_BSTR aNetworkMask, IN_BSTR aLowerIP, IN_BSTR aUpperIP)
{
AutoCaller autoCaller(this);
m.IPAddress = aIPAddress;
m.networkMask = aNetworkMask;
// save the global settings; for that we should hold only the VirtualBox lock
return mVirtualBox->saveSettings();
}
{
/* Silently ignore attepmts to run disabled servers. */
if (!m.enabled)
return S_OK;
//temporary hack for testing
// DHCPCFG_NAME
char strMAC[32];
// DHCPCFG_LEASEDB,
// DHCPCFG_VERBOSE,
// DHCPCFG_GATEWAY,
// DHCPCFG_HELP,
// DHCPCFG_VERSION,
// DHCPCFG_NOTOPT_MAXVAL
//m.dhcp.detachFromServer(); /* need to do this to avoid server shutdown on runner destruction */
}
{
}