blob: 46babb50263a58dd18bee3800002de652ed287fd [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.
library fuchsia.wlan.device.service;
using fuchsia.wlan.common;
using fuchsia.wlan.ieee80211 as ieee80211;
using fuchsia.wlan.mlme;
using fuchsia.wlan.sme;
using fuchsia.wlan.stats;
using zx;
type QueryIfaceResponse = struct {
/// The role the iface is currently operating in, e.g., client role.
role fuchsia.wlan.common.WlanMacRole;
/// The iface's global ID.
id uint16;
/// Iface's PHY ID.
phy_id uint16;
/// Local ID assigned by this iface's PHY.
phy_assigned_id uint16;
/// The iface's MAC.
sta_addr ieee80211.MacAddr;
};
type CreateIfaceRequest = struct {
phy_id uint16;
role fuchsia.wlan.common.WlanMacRole;
sta_addr ieee80211.MacAddr;
};
type CreateIfaceResponse = struct {
iface_id uint16;
};
type DestroyIfaceRequest = struct {
iface_id uint16;
};
type GetCountryResponse = struct {
alpha2 array<byte, 2>;
};
type SetCountryRequest = struct {
phy_id uint16;
alpha2 array<byte, 2>;
};
type ClearCountryRequest = struct {
phy_id uint16;
};
type SetPowerSaveModeRequest = struct {
/// Interface's PHY ID
phy_id uint16;
/// Power Save Mode bit mask
ps_mode fuchsia.wlan.common.PowerSaveType;
};
type GetPowerSaveModeResponse = struct {
/// Power Save Mode bit mask
ps_mode fuchsia.wlan.common.PowerSaveType;
};
type AddIfaceRequest = resource struct {
phy_id uint16;
assigned_iface_id uint16;
iface client_end:fuchsia.wlan.mlme.MLME;
generic_sme server_end:fuchsia.wlan.sme.GenericSme;
};
type AddIfaceResponse = struct {
iface_id uint16;
};
// TODO(https://fxbug.dev/42164319): Move this to wlan_internal.fidl after https://fxbug.dev/42166364 is fixed
type GetIfaceCounterStatsResponse = strict union {
1: stats fuchsia.wlan.stats.IfaceCounterStats;
2: error_status zx.Status;
};
// TODO(https://fxbug.dev/42164319): Move this to wlan_internal.fidl after https://fxbug.dev/42166364 is fixed
type GetIfaceHistogramStatsResponse = strict union {
1: stats fuchsia.wlan.stats.IfaceHistogramStats;
2: error_status zx.Status;
};
closed protocol DeviceWatcher {
strict -> OnPhyAdded(struct {
phy_id uint16;
});
strict -> OnPhyRemoved(struct {
phy_id uint16;
});
strict -> OnIfaceAdded(struct {
iface_id uint16;
});
strict -> OnIfaceRemoved(struct {
iface_id uint16;
});
};
@discoverable
closed protocol DeviceService {
// Iface methods
strict AddIface(resource struct {
req AddIfaceRequest;
}) -> (struct {
status int32;
iface_id box<AddIfaceResponse>;
});
};
@discoverable
closed protocol DeviceMonitor {
// Phy methods
strict ListPhys() -> (struct {
phy_list vector<uint16>:MAX;
});
strict ListIfaces() -> (struct {
iface_list vector<uint16>:MAX;
});
strict GetDevPath(struct {
phy_id uint16;
}) -> (struct {
dev_path string:optional;
});
strict GetSupportedMacRoles(struct {
phy_id uint16;
}) -> (struct {
supported_mac_roles
vector<fuchsia.wlan.common.WlanMacRole>:fuchsia.wlan.common.MAX_SUPPORTED_MAC_ROLES;
}) error zx.Status;
strict WatchDevices(resource struct {
watcher server_end:DeviceWatcher;
});
strict GetCountry(struct {
phy_id uint16;
}) -> (struct {
resp GetCountryResponse;
}) error int32;
strict SetCountry(struct {
req SetCountryRequest;
}) -> (struct {
status int32;
});
strict ClearCountry(struct {
req ClearCountryRequest;
}) -> (struct {
status int32;
});
strict SetPowerSaveMode(struct {
req SetPowerSaveModeRequest;
}) -> (struct {
status int32;
});
strict GetPowerSaveMode(struct {
phy_id uint16;
}) -> (struct {
resp GetPowerSaveModeResponse;
}) error int32;
// Iface methods
strict CreateIface(struct {
req CreateIfaceRequest;
}) -> (struct {
status int32;
resp box<CreateIfaceResponse>;
});
strict QueryIface(struct {
iface_id uint16;
}) -> (struct {
resp QueryIfaceResponse;
}) error zx.Status;
strict DestroyIface(struct {
req DestroyIfaceRequest;
}) -> (struct {
status int32;
});
// SME methods
/// Attempt to establish a new connection to a Client SME.
/// Connections may be established for the whole lifetime of the SME,
/// but concurrent connections might lead to unexpected behavior.
/// Likely errors include:
/// * NOT_FOUND: The given iface_id does not exist.
/// * NOT_SUPPORTED: The underlying SME is not a Client SME.
/// * PEER_CLOSED: The underlying SME is shutting down.
strict GetClientSme(resource struct {
iface_id uint16;
sme_server server_end:fuchsia.wlan.sme.ClientSme;
}) -> () error zx.Status;
/// Attempt to establish a new connection to an AP SME.
/// Connections may be established for the whole lifetime of the SME,
/// but concurrent connections might lead to unexpected behavior.
/// Likely errors include:
/// * NOT_FOUND: The given iface_id does not exist.
/// * NOT_SUPPORTED: The underlying SME is not a Client SME.
/// * PEER_CLOSED: The underlying SME is shutting down.
strict GetApSme(resource struct {
iface_id uint16;
sme_server server_end:fuchsia.wlan.sme.ApSme;
}) -> () error zx.Status;
/// Attempt to establish a new connection to telemetry for an SME.
/// Connections may be established for the whole lifetime of the SME, and
/// concurrent connections are safe since this is a read-only API.
/// Likely errors include:
/// * NOT_FOUND: The given iface_id does not exist.
/// * NOT_SUPPORTED: The underlying SME is not a Client SME.
/// * PEER_CLOSED: The underlying SME is shutting down.
strict GetSmeTelemetry(resource struct {
iface_id uint16;
telemetry_server server_end:fuchsia.wlan.sme.Telemetry;
}) -> () error zx.Status;
/// Attempt to establish a new connection to feature queries for an SME.
/// Connections may be established for the whole lifetime of the SME, and
/// concurrent connections are safe since this is a read-only API.
/// Likely errors include:
/// * NOT_FOUND: The given iface_id does not exist.
/// * PEER_CLOSED: The underlying SME is shutting down.
strict GetFeatureSupport(resource struct {
iface_id uint16;
feature_support_server server_end:fuchsia.wlan.sme.FeatureSupport;
}) -> () error zx.Status;
};