DHCPServerImpl.cpp revision a4c42fa3c0d97de156679db698091f439edb7add
/* $Id$ */
/** @file
*
* VirtualBox COM class implementation
*/
/*
* Copyright (C) 2006-2011 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 "NetworkServiceRunner.h"
#include "DHCPServerImpl.h"
#include "AutoCaller.h"
#include "Logging.h"
#include <VBox/settings.h>
#include "VirtualBoxImpl.h"
// constructor / destructor
/////////////////////////////////////////////////////////////////////////////
: mVirtualBox(NULL)
{
}
DHCPServer::~DHCPServer()
{
}
{
return BaseFinalConstruct();
}
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.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) */
m.GlobalDhcpOptions.clear();
m.VmSlot2Options.clear();
return S_OK;
}
{
AutoCaller autoCaller(this);
m.GlobalDhcpOptions.end());
m.VmSlot2Options.end());
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;
// save the global settings; for that we should hold only the VirtualBox lock
return mVirtualBox->saveSettings();
}
{
/* store global option */
AutoCaller autoCaller(this);
return mVirtualBox->saveSettings();
}
{
AutoCaller autoCaller(this);
int i = 0;
{
i++;
}
return S_OK;
}
{
AutoCaller autoCaller(this);
int i = 0;
{
i++;
}
return S_OK;
}
STDMETHODIMP DHCPServer::AddVmSlotOption(IN_BSTR aVmName, LONG aSlot, DhcpOpt_T aOption, IN_BSTR aValue)
{
AutoCaller autoCaller(this);
return mVirtualBox->saveSettings();
}
{
AutoCaller autoCaller(this);
return mVirtualBox->saveSettings();
}
/**
* this is mapping (vm, slot)
*/
{
AutoCaller autoCaller(this);
int i = 0;
{
i++;
}
return S_OK;
}
{
AutoCaller autoCaller(this);
++it)
{
continue;
continue;
break;
} /* end of for */
return hrc;
}
{
}
{
/* Silently ignore attempts to run disabled servers. */
if (!m.enabled)
return S_OK;
/* Commmon Network Settings */
/* XXX: should this MAC default initialization moved to NetworkServiceRunner? */
char strMAC[32];
/* XXX: This parameters Dhcp Server will fetch via API */
//m.dhcp.detachFromServer(); /* need to do this to avoid server shutdown on runner destruction */
}
{
}
{
aSlot)];
}