blob: 9b759731853408b6018fedd9f4fe2bc14542f4bf [file] [log] [blame]
// Copyright 2018 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
using fuchsia.hardware.ethernet;
using zx;
/// Event for interface name update.
struct InterfaceNameUpdate {
/// The new name.
string name;
table Events {
/// InterfaceStatus event is triggered whenever an interface's status is changed.
1: status;
/// InterfaceNameUpdate event is triggered whenever an interface's name is changed.
2: InterfaceNameUpdate name;
union EthernetControllerRequest {
request<StandardInterfaceController> standard;
request<BridgeInterfaceController> bridge;
protocol BaseInterfaceController {
/// Retrieve info about an interface.
GetInterfaceInfo() -> ( info);
/// Set the administrative status for an interfance.
/// If enabled, the interface starts processing packets.
/// If disabled, the interface stops processing packets.
SetInterfaceStatus( status) -> (zx.status status);
/// Set DHCP client status for a specific interface.
/// If enabled, the interface acquires a dynamic IP address through DHCP server.
/// If disabled, the interface uses the assigned static IP address.
SetDHCPClientStatus( status) -> (zx.status status);
/// Set a name for an interface.
SetName(string name) -> (zx.status status);
-> OnChange(Events events);
/// Controller of physical and virtual interfaces.
protocol StandardInterfaceController {
compose BaseInterfaceController;
/// Controller of bridging interfaces.
protocol BridgeInterfaceController {
compose BaseInterfaceController;
// Observer receives events from all interfaces and queries interface info.
// It is used by clients like mdns which only care about interface change events
// and the first-class clients like sysUI.
protocol Observer {
/// Retrieve info of all the interfaces.
ListInterfaces() -> (vector<> infos, zx.status status);
/// Retrieve info of a specific interface.
GetInterfaceInfo(string name) -> ( info, zx.status status);
-> OnChange(string interface, Events events);
protocol BasePolicy {
/// Add virtual interfaces.
// Physical interfaces are added by watching the events in /dev/class/ethernet directory.
// The networking interface added through this API are tied to the lifetime of the fidl channel.
// If the client crashes/exits, the channel is closed,
// and then the interface created by this method over the channel will be destructed.
AddInterface(fuchsia.hardware.ethernet.Device device, request<StandardInterfaceController> interfaceCtl) -> (zx.status status);
/// Create bridging interface.
CreateBridge(vector<string> interfaces, request<BridgeInterfaceController> interfaceCtl) -> (zx.status status);
// PrivilegedPolicy provides any interface's controller.
// It is used by clients such as SysUI.
// Infrastructure team is working on capability control mechanism and details can be found:
// That said, the component infrastrastructure will block unqualified client from accessing the PrivilegedPolicy interface.
protocol PrivilegedPolicy {
GetInterfaceController(string interface, EthernetControllerRequest controller) -> (zx.status status);