Public Member Functions | Public Attributes

# INetworkAdapter Interface Reference

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

List of all members.

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

## 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:
  `{EFA0F965-63C7-4C60-AFDF-B1CC9943B9C0}`

## Member Function Documentation

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.

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.

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 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

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.

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.

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.

attribute wstring INetworkAdapter::MACAddress

Ethernet MAC address of the adapter, 12 hexadecimal characters.

When setting it to `null` or an empty string, VirtualBox will generate a unique MAC address.

attribute NetworkAttachmentType INetworkAdapter::attachmentType

Sets/Gets network attachment type of this network adapter.

attribute wstring INetworkAdapter::bridgedInterface

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

attribute wstring INetworkAdapter::hostOnlyInterface

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

attribute wstring INetworkAdapter::internalNetwork

Name of the internal network the VM is attached to.

attribute wstring INetworkAdapter::NATNetwork

Name of the NAT network the VM is attached to.

attribute wstring INetworkAdapter::genericDriver

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

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.

attribute unsigned long INetworkAdapter::lineSpeed

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

attribute NetworkAdapterPromiscModePolicy INetworkAdapter::promiscModePolicy

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

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.

attribute wstring INetworkAdapter::traceFile

Filename where a network trace will be stored.

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

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.

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.

attribute IBandwidthGroup INetworkAdapter::bandwidthGroup

The bandwidth group this network adapter is assigned to.