VBoxManageDHCPServer.cpp revision 8dbf6109fac87f14ee3ff40fa0c9e74e40c52492
/* $Id$ */
/** @file
* VBoxManage - Implementation of hostonlyif command.
*/
/*
* Copyright (C) 2006-2009 Sun Microsystems, Inc.
*
* 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.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 USA or visit http://www.sun.com if you need
* additional information or have any questions.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#ifndef VBOX_ONLY_DOCS
#include <vector>
#include <list>
#endif /* !VBOX_ONLY_DOCS */
#include "VBoxManage.h"
#ifndef VBOX_ONLY_DOCS
using namespace com;
typedef enum enMainOpCodes
{
OP_ADD = 1000,
} OPCODE;
enum enOptionCodes
{
NETNAME = 1000,
IP,
};
static const RTGETOPTDEF g_aListOptions[]
= {
};
{
int enable = -1;
int c;
a->argc,
a->argv,
enmCode != OP_REMOVE ? RT_ELEMENTS(g_aListOptions): 2, /* we use only -netname and -ifname for remove*/
0 /* fFlags */);
{
switch (c)
{
case NETNAME:
if(pNetName)
else if (pIfName)
return errorSyntax(USAGE_DHCPSERVER, "You can either use a -netname or -ifname for identifying the dhcp server.");
else
{
}
break;
case IFNAME:
if(pIfName)
else if (pNetName)
return errorSyntax(USAGE_DHCPSERVER, "You can either use a -netname or -ipname for identifying the dhcp server.");
else
{
}
break;
case IP:
if(pIp)
else
{
}
break;
case NETMASK:
if(pNetmask)
else
{
}
break;
case LOWERIP:
if(pLowerIp)
else
{
}
break;
case UPPERIP:
if(pUpperIp)
else
{
}
break;
case ENABLE:
if(enable >= 0)
else
{
enable = 1;
}
break;
case DISABLE:
if(enable >= 0)
else
{
enable = 0;
}
break;
case VINF_GETOPT_NOT_OPTION:
break;
default:
if (c > 0)
else if (ValueUnion.pDef)
else
}
}
return errorSyntax(USAGE_DHCPSERVER, "You need to specify either -netname or -ifname to identify the dhcp server");
{
{
if(!pIp)
if(!pNetmask)
if(!pLowerIp)
if(!pUpperIp)
}
}
if(!pNetName)
{
}
else
{
}
{
return errorArgument("dhcp server already exists");
return errorArgument("failed to create server");
}
{
return errorArgument("dhcp server does not exist");
}
{
{
CHECK_ERROR(svr, SetConfiguration (Bstr(pIp).mutableRaw(), Bstr(pNetmask).mutableRaw(), Bstr(pLowerIp).mutableRaw(), Bstr(pUpperIp).mutableRaw()));
return errorArgument("failed to set configuration");
}
if(enable >= 0)
{
}
}
else
{
return errorArgument("failed to remove server");
}
return 0;
}
int handleDHCPServer(HandlerArg *a)
{
int result = 0;
if (a->argc < 1)
for (int i = 0; i < a->argc; i++)
{
{
int cProcessed;
break;
}
{
int cProcessed;
break;
}
{
int cProcessed;
break;
}
else
{
break;
}
}
return result;
}
#endif /* !VBOX_ONLY_DOCS */