VirtualBox Main API

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

Interface for managing a NAT engine which is used with a virtual machine. More...

Inheritance diagram for INATEngine:

## Public Member Functions
void | setNetworkSettings (in unsigned long mtu, in unsigned long sockSnd, in unsigned long sockRcv, in unsigned long TcpWndSnd, in unsigned long TcpWndRcv)
| Sets network configuration of the NAT engine.
void | getNetworkSettings (out unsigned long mtu, out unsigned long sockSnd, out unsigned long sockRcv, out unsigned long TcpWndSnd, out unsigned long TcpWndRcv)
| Returns network configuration of NAT engine.
void | addRedirect (in wstring name, in NATProtocol proto, in wstring hostIP, in unsigned short hostPort, in wstring guestIP, in unsigned short guestPort)
| Adds a new NAT port-forwarding rule.
void | removeRedirect (in wstring name)
| Removes a port-forwarding rule that was previously registered.

## Public Attributes
attribute wstring | network
| The network attribute of the NAT engine (the same value is used with built-in DHCP server to fill corresponding fields of DHCP leases).
attribute wstring | hostIP
| IP of host interface to bind all opened sockets to.
attribute wstring | TFTPPrefix
| TFTP prefix attribute which is used with the built-in DHCP server to fill the corresponding fields of DHCP leases.
attribute wstring | TFTPBootFile
| TFTP boot file attribute which is used with the built-in DHCP server to fill the corresponding fields of DHCP leases.
attribute wstring | TFTPNextServer
| TFTP server attribute which is used with the built-in DHCP server to fill the corresponding fields of DHCP leases.
attribute unsigned long | aliasMode
attribute boolean | DNSPassDomain
| Whether the DHCP server should pass the DNS domain used by the host.
attribute boolean | DNSProxy
| Whether the DHCP server (and the DNS traffic by NAT) should pass the address of the DNS proxy and process traffic using DNS servers registered on the host.
attribute boolean | DNSUseHostResolver
| Whether the DHCP server (and the DNS traffic by NAT) should pass the address of the DNS proxy and process traffic using the host resolver mechanism.
readonly attribute wstring[] | redirects
| Array of NAT port-forwarding rules in string representation, in the following format: "name,protocol id,host ip,host port,guest ip,guest port".
attribute boolean | localhostReachable
| Whether traffic from the guest directed to 10.0.2.2 will reach the host's loopback interface, i.e.
attribute boolean | forwardBroadcast
| Forwards broadcast packets sent by the guest to the host machine as such.
attribute boolean | enableTFTP
| Enables TFTP functionality, and related configuration options.
attribute unsigned long | natMRU
| MRU (maximum receive unit) of the NAT engine in bytes.
attribute boolean | IPv6Enabled
| This attribute define whether gateway will support IPv6 or not.
attribute wstring | IPv6Prefix
| This a CIDR IPv6 defining prefix for link-local addresses autoconfiguration within network.

## Detailed Description

Interface for managing a NAT engine which is used with a virtual machine.

This allows for changing NAT behavior such as port-forwarding rules. This interface is used in the INetworkAdapter::NATEngine attribute.

Interface ID:
  `{55F6CEDB-141D-41BB-9995-EE2FC7F9101A}`

## Member Function Documentation

## ◆ setNetworkSettings()

void INATEngine::setNetworkSettings | ( | in unsigned long | mtu,
|  | in unsigned long | sockSnd,
|  | in unsigned long | sockRcv,
|  | in unsigned long | TcpWndSnd,
|  | in unsigned long | TcpWndRcv
| ) |  |

Sets network configuration of the NAT engine.

Parameters

  mtu | MTU (maximum transmission unit) of the NAT engine in bytes.
  sockSnd | Capacity of the socket send buffer in bytes when creating a new socket.
  sockRcv | Capacity of the socket receive buffer in bytes when creating a new socket.
  TcpWndSnd | Initial size of the NAT engine's sending TCP window in bytes when establishing a new TCP connection.
  TcpWndRcv | Initial size of the NAT engine's receiving TCP window in bytes when establishing a new TCP connection.

## ◆ getNetworkSettings()

void INATEngine::getNetworkSettings | ( | out unsigned long | mtu,
|  | out unsigned long | sockSnd,
|  | out unsigned long | sockRcv,
|  | out unsigned long | TcpWndSnd,
|  | out unsigned long | TcpWndRcv
| ) |  |

Returns network configuration of NAT engine.

See setNetworkSettings for parameter descriptions.

## ◆ addRedirect()

void INATEngine::addRedirect | ( | in wstring | name,
|  | in NATProtocol | proto,
|  | in wstring | hostIP,
|  | in unsigned short | hostPort,
|  | in wstring | guestIP,
|  | in unsigned short | guestPort
| ) |  |

Adds a new NAT port-forwarding rule.

Parameters

  name | The name of the rule. An empty name is acceptable, in which case the NAT engine auto-generates one using the other parameters.
  proto | Protocol handled with the rule.
  hostIP | IP of the host interface to which the rule should apply. An empty ip address is acceptable, in which case the NAT engine binds the handling socket to any interface.
  hostPort | The port number to listen on.
  guestIP | The IP address of the guest which the NAT engine will forward matching packets to. An empty IP address is acceptable, in which case the NAT engine will forward packets to the first DHCP lease (x.x.x.15).
  guestPort | The port number to forward.

## ◆ removeRedirect()

void INATEngine::removeRedirect | ( | in wstring | name | ) |

Removes a port-forwarding rule that was previously registered.

Parameters

  name | The name of the rule to delete.

## Member Data Documentation

## ◆ network

attribute wstring INATEngine::network

The network attribute of the NAT engine (the same value is used with built-in DHCP server to fill corresponding fields of DHCP leases).

## ◆ hostIP

attribute wstring INATEngine::hostIP

IP of host interface to bind all opened sockets to.

Note
  Changing this does not change binding of port forwarding.

## ◆ TFTPPrefix

attribute wstring INATEngine::TFTPPrefix

TFTP prefix attribute which is used with the built-in DHCP server to fill the corresponding fields of DHCP leases.

Note
  Ignored if TFTP is disabled.

## ◆ TFTPBootFile

attribute wstring INATEngine::TFTPBootFile

TFTP boot file attribute which is used with the built-in DHCP server to fill the corresponding fields of DHCP leases.

Note
  Ignored if TFTP is disabled.

## ◆ TFTPNextServer

attribute wstring INATEngine::TFTPNextServer

TFTP server attribute which is used with the built-in DHCP server to fill the corresponding fields of DHCP leases.

Note
  The preferred form is IPv4 addresses.
  Ignored if TFTP is disabled.

## ◆ aliasMode

attribute unsigned long INATEngine::aliasMode

## ◆ DNSPassDomain

attribute boolean INATEngine::DNSPassDomain

Whether the DHCP server should pass the DNS domain used by the host.

## ◆ DNSProxy

attribute boolean INATEngine::DNSProxy

Whether the DHCP server (and the DNS traffic by NAT) should pass the address of the DNS proxy and process traffic using DNS servers registered on the host.

## ◆ DNSUseHostResolver

attribute boolean INATEngine::DNSUseHostResolver

Whether the DHCP server (and the DNS traffic by NAT) should pass the address of the DNS proxy and process traffic using the host resolver mechanism.

## ◆ redirects

readonly attribute wstring [] INATEngine::redirects

Array of NAT port-forwarding rules in string representation, in the following format: "name,protocol id,host ip,host port,guest ip,guest port".

## ◆ localhostReachable

attribute boolean INATEngine::localhostReachable

Whether traffic from the guest directed to 10.0.2.2 will reach the host's loopback interface, i.e.

localhost or 127.0.0.1.

## ◆ forwardBroadcast

attribute boolean INATEngine::forwardBroadcast

Forwards broadcast packets sent by the guest to the host machine as such.

IP address will show to host as 255.255.255.255.

## ◆ enableTFTP

attribute boolean INATEngine::enableTFTP

Enables TFTP functionality, and related configuration options.

## ◆ natMRU

attribute unsigned long INATEngine::natMRU

MRU (maximum receive unit) of the NAT engine in bytes.

## ◆ IPv6Enabled

attribute boolean INATEngine::IPv6Enabled

This attribute define whether gateway will support IPv6 or not.

## ◆ IPv6Prefix

attribute wstring INATEngine::IPv6Prefix

This a CIDR IPv6 defining prefix for link-local addresses autoconfiguration within network.

Note: ignored if attribute IPv6Enabled is false.