VirtualBox Main API

Public Member Functions | Public Attributes | List of all members
INATNetwork Interface Reference
Inheritance diagram for INATNetwork:

## Public Member Functions
void | addLocalMapping (in wstring hostid, in long offset)
void | addPortForwardRule (in boolean isIpv6, in wstring ruleName, in NATProtocol proto, in wstring hostIP, in unsigned short hostPort, in wstring guestIP, in unsigned short guestPort)
void | removePortForwardRule (in boolean isIpv6, in wstring ruleName)
void | start ()
void | stop ()

## Public Attributes
attribute wstring | networkName
| TBD: the idea, technically we can start any number of the NAT networks, but we should expect that at some point we will get collisions because of port-forwanding rules.
attribute boolean | enabled
attribute wstring | network
| This is CIDR IPv4 string.
readonly attribute wstring | gateway
| This attribute is read-only.
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.
attribute boolean | advertiseDefaultIPv6RouteEnabled
attribute boolean | needDhcpServer
readonly attribute IEventSource | eventSource
readonly attribute wstring[] | portForwardRules4
| Array of NAT port-forwarding rules in string representation, in the following format: "name:protocolid:[host ip]:host port:[guest ip]:guest port".
readonly attribute wstring[] | localMappings
| Array of mappings (address,offset),e.g.
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 unsigned long | natMTU
| MTU (maximum transmission unit) of the NAT engine in bytes.
attribute unsigned long | natMRU
| MRU (maximum receive unit) of the NAT engine in bytes.
attribute long | loopbackIp6
| Offset in ipv6 network from network id for address mapped into loopback6 interface of the host.
readonly attribute wstring[] | portForwardRules6
| Array of NAT port-forwarding rules in string representation, in the following format: "name:protocolid:[host ip]:host port:[guest ip]:guest port".

## Member Function Documentation

## ◆ addLocalMapping()

void INATNetwork::addLocalMapping | ( | in wstring | hostid,
|  | in long | offset
| ) |  |

## ◆ addPortForwardRule()

void INATNetwork::addPortForwardRule | ( | in boolean | isIpv6,
|  | in wstring | ruleName,
|  | in NATProtocol | proto,
|  | in wstring | hostIP,
|  | in unsigned short | hostPort,
|  | in wstring | guestIP,
|  | in unsigned short | guestPort
| ) |  |

## ◆ removePortForwardRule()

void INATNetwork::removePortForwardRule | ( | in boolean | isIpv6,
|  | in wstring | ruleName
| ) |  |

## ◆ start()

void INATNetwork::start | ( |  | ) |

## ◆ stop()

void INATNetwork::stop | ( |  | ) |

## Member Data Documentation

## ◆ networkName

attribute wstring INATNetwork::networkName

TBD: the idea, technically we can start any number of the NAT networks, but we should expect that at some point we will get collisions because of port-forwanding rules.

so perhaps we should support only single instance of NAT network.

## ◆ enabled

attribute boolean INATNetwork::enabled

## ◆ network

attribute wstring INATNetwork::network

This is CIDR IPv4 string.

Specifying it user defines IPv4 addresses of gateway (low address + 1) and DHCP server (= low address + 2). Note: If there are defined IPv4 port-forward rules update of network will be ignored (because new assignment could break existing rules).

## ◆ gateway

readonly attribute wstring INATNetwork::gateway

This attribute is read-only.

It's recalculated on changing network attribute (low address of network + 1).

## ◆ IPv6Enabled

attribute boolean INATNetwork::IPv6Enabled

This attribute define whether gateway will support IPv6 or not.

## ◆ IPv6Prefix

attribute wstring INATNetwork::IPv6Prefix

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

Note: ignored if attribute IPv6Enabled is false.

## ◆ advertiseDefaultIPv6RouteEnabled

attribute boolean INATNetwork::advertiseDefaultIPv6RouteEnabled

## ◆ needDhcpServer

attribute boolean INATNetwork::needDhcpServer

## ◆ eventSource

readonly attribute IEventSource INATNetwork::eventSource

## ◆ portForwardRules4

readonly attribute wstring [] INATNetwork::portForwardRules4

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

## ◆ localMappings

readonly attribute wstring [] INATNetwork::localMappings

Array of mappings (address,offset),e.g.

("127.0.1.1=4") maps 127.0.1.1 to networkid + 4.

## ◆ localhostReachable

attribute boolean INATNetwork::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 INATNetwork::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.

## ◆ natMTU

attribute unsigned long INATNetwork::natMTU

MTU (maximum transmission unit) of the NAT engine in bytes.

## ◆ natMRU

attribute unsigned long INATNetwork::natMRU

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

## ◆ loopbackIp6

attribute long INATNetwork::loopbackIp6

Offset in ipv6 network from network id for address mapped into loopback6 interface of the host.

## ◆ portForwardRules6

readonly attribute wstring [] INATNetwork::portForwardRules6

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