VirtualBox Main API

Public Member Functions | Public Attributes | List of all members
IDHCPServer Interface Reference

The IDHCPServer interface represents the VirtualBox DHCP server configuration. More...

Inheritance diagram for IDHCPServer:

## Public Member Functions
void | setConfiguration (in wstring IPAddress, in wstring networkMask, in wstring FromIPAddress, in wstring ToIPAddress)
| configures the server
void | start (in wstring trunkName, in wstring trunkType)
| Starts DHCP server process.
void | stop ()
| Stops DHCP server process.
void | restart ()
| Restart running DHCP server process.
void | findLeaseByMAC (in wstring mac, in long type, out wstring address, out wstring state, out long long issued, out long long expire)
| Queries the persistent lease database by MAC address.
void | getConfig (in DHCPConfigScope scope, in wstring name, in unsigned long slot, in boolean mayAdd, [retval] out IDHCPConfig config)
| Gets or adds a configuration.

## Public Attributes
readonly attribute IEventSource | eventSource
attribute boolean | enabled
| specifies if the DHCP server is enabled
readonly attribute wstring | IPAddress
| specifies server IP
readonly attribute wstring | networkMask
| specifies server network mask
readonly attribute wstring | networkName
| specifies internal network name the server is used for
readonly attribute wstring | lowerIP
| specifies from IP address in server address range
readonly attribute wstring | upperIP
| specifies to IP address in server address range
readonly attribute IDHCPGlobalConfig | globalConfig
| Global configuration that applies to all clients.
readonly attribute IDHCPGroupConfig[] | groupConfigs
| Configuration groups that applies to selected clients, selection is flexible.
readonly attribute IDHCPIndividualConfig[] | individualConfigs
| Individual NIC configurations either by MAC address or VM + NIC number.

## Detailed Description

The IDHCPServer interface represents the VirtualBox DHCP server configuration.

To enumerate all the DHCP servers on the host, use the IVirtualBox::DHCPServers attribute.

Interface ID:
  `{CADEF0A2-A1A9-4AC2-8E80-C049AF69DAC8}`

## Member Function Documentation

## ◆ setConfiguration()

void IDHCPServer::setConfiguration | ( | in wstring | IPAddress,
|  | in wstring | networkMask,
|  | in wstring | FromIPAddress,
|  | in wstring | ToIPAddress
| ) |  |

configures the server

Parameters

  IPAddress | server IP address
  networkMask | server network mask
  FromIPAddress | server From IP address for address range
  ToIPAddress | server To IP address for address range

Expected result codes:

  E_INVALIDARG | invalid configuration supplied

## ◆ start()

void IDHCPServer::start | ( | in wstring | trunkName,
|  | in wstring | trunkType
| ) |  |

Starts DHCP server process.

Parameters

  trunkName | Name of internal network trunk.
  trunkType | Type of internal network trunk.

Expected result codes:

  E_FAIL | Failed to start the process.

## ◆ stop()

void IDHCPServer::stop | ( |  | ) |

Stops DHCP server process.

Expected result codes:

  E_FAIL | Failed to stop the process.

## ◆ restart()

void IDHCPServer::restart | ( |  | ) |

Restart running DHCP server process.

Expected result codes:

  E_FAIL | Failed to restart the process.

## ◆ findLeaseByMAC()

void IDHCPServer::findLeaseByMAC | ( | in wstring | mac,
|  | in long | type,
|  | out wstring | address,
|  | out wstring | state,
|  | out long long | issued,
|  | out long long | expire
| ) |  |

Queries the persistent lease database by MAC address.

This is handy if the host wants to connect to a server running inside a VM on a host only network.

Parameters

  mac | The MAC address to look up.
  type | Reserved, MBZ.
  address | The assigned address.
  state | The lease state.
  issued | Timestamp of when the lease was issued, in seconds since 1970-01-01 UTC.
  expire | Timestamp of when the lease expires/expired, in seconds since 1970-01-01 UTC.

Expected result codes:

  VBOX_E_OBJECT_NOT_FOUND | If MAC address not in the database.
  VBOX_E_FILE_ERROR | If not able to read the lease database file.

## ◆ getConfig()

void IDHCPServer::getConfig | ( | in DHCPConfigScope | scope,
|  | in wstring | name,
|  | in unsigned long | slot,
|  | in boolean | mayAdd,
|  | [retval] out IDHCPConfig | config
| ) |  |

Gets or adds a configuration.

Parameters

  scope | The kind of configuration being sought or added.
  name | Meaning depends on the scope: Ignored when the scope is DHCPConfigScope_Global. A VM name or UUID for DHCPConfigScope_MachineNIC. A MAC address for DHCPConfigScope_MAC. A group name for DHCPConfigScope_Group.
  slot | The NIC slot when scope is set to DHCPConfigScope_MachineNIC, must be zero for all other scope values.
  mayAdd | Set to `TRUE` if the configuration should be added if not found. If set to `FALSE` the method will fail with VBOX_E_OBJECT_NOT_FOUND.
  config | The requested configuration.

## Member Data Documentation

## ◆ eventSource

readonly attribute IEventSource IDHCPServer::eventSource

## ◆ enabled

attribute boolean IDHCPServer::enabled

specifies if the DHCP server is enabled

## ◆ IPAddress

readonly attribute wstring IDHCPServer::IPAddress

specifies server IP

## ◆ networkMask

readonly attribute wstring IDHCPServer::networkMask

specifies server network mask

## ◆ networkName

readonly attribute wstring IDHCPServer::networkName

specifies internal network name the server is used for

## ◆ lowerIP

readonly attribute wstring IDHCPServer::lowerIP

specifies from IP address in server address range

## ◆ upperIP

readonly attribute wstring IDHCPServer::upperIP

specifies to IP address in server address range

## ◆ globalConfig

readonly attribute IDHCPGlobalConfig IDHCPServer::globalConfig

Global configuration that applies to all clients.

## ◆ groupConfigs

readonly attribute IDHCPGroupConfig [] IDHCPServer::groupConfigs

Configuration groups that applies to selected clients, selection is flexible.

## ◆ individualConfigs

readonly attribute IDHCPIndividualConfig [] IDHCPServer::individualConfigs

Individual NIC configurations either by MAC address or VM + NIC number.