Google is committed to advancing racial equity for Black communities. See how.

fuchsia.netemul.network

PROTOCOLS

DeviceProxy

Defined in fuchsia.netemul.network/network.fidl

Simple interface to serve devices over fidl.

ServeDevice

Fulfills the device request. The fulfilled requests's protocol is defined by the Endpoint's EndpointBacking.

Request

NameType
req handle<channel>

Endpoint

Defined in fuchsia.netemul.network/network.fidl

Virtual ethernet endpoint.

GetConfig

Request

NameType

Response

NameType
config EndpointConfig

GetDevice

Opens a channel with the underlying device protocol. The resulting DeviceConnection variant is defined by this Endpoint's EndpointBacking.

Request

NameType

Response

NameType
device DeviceConnection

GetName

Gets endpoint name.

Request

NameType

Response

NameType
name string

GetProxy

Gets a proxy to open requests with zircon ethernet device.

Request

NameType
proxy request<DeviceProxy>

SetLinkUp

Sends link up or down signal

Request

NameType
up bool

Response

NameType

EndpointManager

Defined in fuchsia.netemul.network/network.fidl

Manages virtual endpoints.

CreateEndpoint

Creates endpoint with given name and config.

Request

NameType
name string
config EndpointConfig

Response

NameType
status zx/status
endpoint Endpoint?

GetEndpoint

Gets a handle to an endpoint.

Request

NameType
name string

Response

NameType
endpoint Endpoint?

ListEndpoints

Lists endpoints by name.

Request

NameType

Response

NameType
endp vector<string>

FakeEndpoint

Defined in fuchsia.netemul.network/network.fidl

Fake endpoint can be added to a network to snoop or inject packets.

Read

Reads a single frame from the network.

Blocks until new data is available to be read. FakeEndpoint will keep a limited amount of frames to be read, dropping the oldest ones if the data is not fetched fast enough. The number of dropped frames since the last call to Read is returned in dropped_frames.

Issuing a second Read request when the first one is still pending will cause the channel to be closed with ZX_ERR_BAD_STATE.

Request

NameType

Response

NameType
data vector<uint8>
dropped_frames uint64

Write

Writes a frame to the network.

Request

NameType
data vector<uint8>

Response

NameType

Network

Defined in fuchsia.netemul.network/network.fidl

Virtual network.

AttachEndpoint

Attaches endpoint with given name to network.

Request

NameType
name string

Response

NameType
status zx/status

CreateFakeEndpoint

Injects a fake endpoint.

Request

NameType
ep request<FakeEndpoint>

GetConfig

Gets network configuration.

Request

NameType

Response

NameType
config NetworkConfig

GetName

Gets network name.

Request

NameType

Response

NameType
name string

RemoveEndpoint

Removes endpoint with given name from network.

Request

NameType
name string

Response

NameType
status zx/status

SetConfig

Updates network configuration.

Request

NameType
config NetworkConfig

Response

NameType
status zx/status

NetworkContext

Defined in fuchsia.netemul.network/network.fidl

Main entry point to manage virtual networks and endpoints.

GetEndpointManager

Request

NameType
endp_manager request<EndpointManager>

GetNetworkManager

Request

NameType
net_manager request<NetworkManager>

Setup

Creates a collection of networks described by networks. status is ZX_OK for success setup_handle is a resource that references and maintains the lifecycle of the created networks and endpoints.

Request

NameType
networks vector<NetworkSetup>

Response

NameType
status zx/status
setup_handle SetupHandle?

NetworkManager

Defined in fuchsia.netemul.network/network.fidl

Manages virtual networks.

CreateNetwork

Creates a new network with given name and config.

Request

NameType
name string
config NetworkConfig

Response

NameType
status zx/status
net Network?

GetNetwork

Gets a handle to a network.

Request

NameType
name string

Response

NameType
net Network?

ListNetworks

Lists emulated networks by name.

Request

NameType

Response

NameType
nets vector<string>

SetupHandle

Defined in fuchsia.netemul.network/network.fidl

Handle returned when using NetworkContext.Setup for quick network configuration. Networks and endpoints created by Setup are tied to the lifecycle of the SetupHandle's channel.

STRUCTS

EndpointConfig

Defined in fuchsia.netemul.network/network.fidl

Configuration used to create an endpoint.

NameTypeDescriptionDefault
mtu uint16

Fake ethernet mtu.

No default
mac fuchsia.net/MacAddress?

Fake ethernet mac address, if not provided will be set to randomized local mac, using endpoint name as seed.

No default
backing EndpointBacking

Backing type of emulated endpoint.

No default

EndpointSetup

Defined in fuchsia.netemul.network/network.fidl

Convenience struct for creating endpoints along with network setup.

NameTypeDescriptionDefault
name string

Endpoint name, must be unique in network context.

No default
config EndpointConfig?

Optional endpoint config, if not provided defaults will be used. Default values are: mtu = 1500, backing = ETHERTAP, mac = randomized.

No default
link_up bool

Start endpoint with link status up.

No default

LatencyConfig

Defined in fuchsia.netemul.network/network.fidl

Provides emulated latency configuration.

NameTypeDescriptionDefault
average uint64

Average latency, in ms.

No default
std_dev uint64

Latency standard deviation, in ms.

No default

NetworkSetup

Defined in fuchsia.netemul.network/network.fidl

Convenience struct for creating entire network setups.

NameTypeDescriptionDefault
name string

Network name, must be unique in network context.

No default
config NetworkConfig

NetworkConfig to use when creating network.

No default
endpoints vector<EndpointSetup>

Collection of endpoints to create and attach to network.

No default

ReorderConfig

Defined in fuchsia.netemul.network/network.fidl

Provides emulated packet reordering configuration.

NameTypeDescriptionDefault
store_buff uint32

Size of buffer, in packets, to store and forward with randomized order.

No default
tick uint64

Tick/deadline in ms to empty buffer, regardless of full state. 0 will cause buffer to flush only when full (dangerous).

No default

ENUMS

EndpointBacking

Type: uint32

Defined in fuchsia.netemul.network/network.fidl

Backing of an emulated endpoint.

NameValueDescription
ETHERTAP 1

Endpoint backed by ethertap device.

NETWORK_DEVICE 2

Endpoint backed by a network-tun device. The created fuchsia.hardware.network.Device always acts as a virtual ethernet device.

TABLES

NetworkConfig

Defined in fuchsia.netemul.network/network.fidl

Used to configure a network with emulated adversity conditions.

OrdinalNameTypeDescription
1 latency LatencyConfig

Latency configuration.

2 packet_loss LossConfig

Packet loss configuration.

3 reorder ReorderConfig

Packet reordering configuration.

UNIONS

DeviceConnection

Defined in fuchsia.netemul.network/network.fidl

A connection to an endpoint's underlying protocol.

NameTypeDescription
ethernet fuchsia.hardware.ethernet/Device

Set if the endpoint's backing is ETHERTAP.

network_device fuchsia.hardware.network/DeviceInstance

Set if the endpoint's backing is NETWORK_DEVICE.

LossConfig

Defined in fuchsia.netemul.network/network.fidl

Provides emulated packet loss configuration.

NameTypeDescription
random_rate uint8

Rate of packet loss expressed as independent drop probability [0-100].