VirtualBox Main API

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

Represents a virtual network adapter that is attached to a virtual machine. More...

Inheritance diagram for INetworkAdapter:

## Public Member Functions
void | getProperty (in wstring key, [retval] out wstring value)
| Returns the value of the network attachment property with the given name. More...
void | setProperty (in wstring key, in wstring value)
| Sets the value of the network attachment property with the given name. More...
void | getProperties (in wstring names, out wstring[] returnNames, [retval] out wstring[] returnValues)
| Returns values for a group of properties in one call. More...

## Public Attributes
attribute NetworkAdapterType | adapterType
| Type of the virtual network adapter. More...
readonly attribute unsigned long | slot
| Slot number this adapter is plugged into. More...
attribute boolean | enabled
| Flag whether the network adapter is present in the guest system. More...
attribute wstring | MACAddress
| Ethernet MAC address of the adapter, 12 hexadecimal characters. More...
attribute NetworkAttachmentType | attachmentType
| Sets/Gets network attachment type of this network adapter. More...
attribute wstring | bridgedInterface
| Name of the network interface the VM should be bridged to. More...
attribute wstring | hostOnlyInterface
| Name of the host only network interface the VM is attached to. More...
attribute wstring | internalNetwork
| Name of the internal network the VM is attached to. More...
attribute wstring | NATNetwork
| Name of the NAT network the VM is attached to. More...
attribute wstring | genericDriver
| Name of the driver to use for the "Generic" network attachment type. More...
attribute boolean | cableConnected
| Flag whether the adapter reports the cable as connected or not. More...
attribute unsigned long | lineSpeed
| Line speed reported by custom drivers, in units of 1 kbps. More...
attribute NetworkAdapterPromiscModePolicy | promiscModePolicy
| The promiscuous mode policy of the network adapter when attached to an internal network, host only network or a bridge. More...
attribute boolean | traceEnabled
| Flag whether network traffic from/to the network card should be traced. More...
attribute wstring | traceFile
| Filename where a network trace will be stored. More...
readonly attribute INATEngine | NATEngine
| Points to the NAT engine which handles the network address translation for this interface. More...
attribute unsigned long | bootPriority
| Network boot priority of the adapter. More...
attribute IBandwidthGroup | bandwidthGroup
| The bandwidth group this network adapter is assigned to. More...

## Detailed Description

Represents a virtual network adapter that is attached to a virtual machine.

Each virtual machine has a fixed number of network adapter slots with one instance of this attached to each of them. Call IMachine::getNetworkAdapter to get the network adapter that is attached to a given slot in a given machine.

Each network adapter can be in one of five attachment modes, which are represented by the NetworkAttachmentType enumeration; see the attachmentType attribute.

Interface ID:
  `{E925C2AA-4FE4-AAF6-91C5-E9B8EA4151EE}`

## Member Function Documentation

## ◆ getProperty()

void INetworkAdapter::getProperty | ( | in wstring | key,
|  | [retval] out wstring | value
| ) |  |

Returns the value of the network attachment property with the given name.

If the requested data key does not exist, this function will succeed and return an empty string in the value argument.

Parameters

  key | Name of the property to get.
  value | Current property value.

Expected result codes:

  E_INVALIDARG | name is `null` or empty.

## ◆ setProperty()

void INetworkAdapter::setProperty | ( | in wstring | key,
|  | in wstring | value
| ) |  |

Sets the value of the network attachment property with the given name.

Setting the property value to `null` or an empty string is equivalent to deleting the existing value.

Parameters

  key | Name of the property to set.
  value | Property value to set.

Expected result codes:

  E_INVALIDARG | name is `null` or empty.

## ◆ getProperties()

void INetworkAdapter::getProperties | ( | in wstring | names,
|  | out wstring [] | returnNames,
|  | [retval] out wstring [] | returnValues
| ) |  |

Returns values for a group of properties in one call.

The names of the properties to get are specified using the names argument which is a list of comma-separated property names or an empty string if all properties are to be returned.

        The method returns two arrays, the array of property names corresponding
        to the @a names argument and the current values of these properties.
        Both arrays have the same number of elements with each element at the
        given index in the first array corresponds to an element at the same
        index in the second array.

Parameters

  names | Names of properties to get.
  returnNames | Names of returned properties.
  returnValues | Values of returned properties.

Note
  Currently the value of this argument is ignored and the method always returns all existing properties.

## Member Data Documentation

## ◆ adapterType

attribute NetworkAdapterType INetworkAdapter::adapterType

Type of the virtual network adapter.

Depending on this value, VirtualBox will provide a different virtual network hardware to the guest.

## ◆ slot

readonly attribute unsigned long INetworkAdapter::slot

Slot number this adapter is plugged into.

Corresponds to the value you pass to IMachine::getNetworkAdapter to obtain this instance.

## ◆ enabled

attribute boolean INetworkAdapter::enabled

Flag whether the network adapter is present in the guest system.

If disabled, the virtual guest hardware will not contain this network adapter. Can only be changed when the VM is not running.

## ◆ MACAddress

attribute wstring INetworkAdapter::MACAddress

Ethernet MAC address of the adapter, 12 hexadecimal characters.

When setting it to `null` or an empty string for an enabled adapter, VirtualBox will generate a unique MAC address. Disabled adapters can have an empty MAC address.

## ◆ attachmentType

attribute NetworkAttachmentType INetworkAdapter::attachmentType

Sets/Gets network attachment type of this network adapter.

## ◆ bridgedInterface

attribute wstring INetworkAdapter::bridgedInterface

Name of the network interface the VM should be bridged to.

## ◆ hostOnlyInterface

attribute wstring INetworkAdapter::hostOnlyInterface

Name of the host only network interface the VM is attached to.

## ◆ internalNetwork

attribute wstring INetworkAdapter::internalNetwork

Name of the internal network the VM is attached to.

## ◆ NATNetwork

attribute wstring INetworkAdapter::NATNetwork

Name of the NAT network the VM is attached to.

## ◆ genericDriver

attribute wstring INetworkAdapter::genericDriver

Name of the driver to use for the "Generic" network attachment type.

## ◆ cableConnected

attribute boolean INetworkAdapter::cableConnected

Flag whether the adapter reports the cable as connected or not.

It can be used to report offline situations to a VM.

## ◆ lineSpeed

attribute unsigned long INetworkAdapter::lineSpeed

Line speed reported by custom drivers, in units of 1 kbps.

## ◆ promiscModePolicy

attribute NetworkAdapterPromiscModePolicy INetworkAdapter::promiscModePolicy

The promiscuous mode policy of the network adapter when attached to an internal network, host only network or a bridge.

## ◆ traceEnabled

attribute boolean INetworkAdapter::traceEnabled

Flag whether network traffic from/to the network card should be traced.

Can only be toggled when the VM is turned off.

## ◆ traceFile

attribute wstring INetworkAdapter::traceFile

Filename where a network trace will be stored.

If not set, VBox-pid.pcap will be used.

## ◆ NATEngine

readonly attribute INATEngine INetworkAdapter::NATEngine

Points to the NAT engine which handles the network address translation for this interface.

This is active only when the interface actually uses NAT.

## ◆ bootPriority

attribute unsigned long INetworkAdapter::bootPriority

Network boot priority of the adapter.

Priority 1 is highest. If not set, the priority is considered to be at the lowest possible setting.

## ◆ bandwidthGroup

attribute IBandwidthGroup INetworkAdapter::bandwidthGroup

The bandwidth group this network adapter is assigned to.