blob: 7def85c5379b28628aa2ca873327066b38b47113 [file] [log] [blame]
// Copyright 2022 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.
@available(added=8)
library fuchsia.net.reachability;
/// Provides snapshots of reachability state.
@discoverable
closed protocol Monitor {
/// Controls verbosity of results returned from calls to [`Watch`]. If
/// options are set via this method, it must be in the first call made
/// over the channel.
///
/// Calling this method after either it or [`Watch`] have already been
/// invoked will result in closing the channel. If this method is not
/// called before calling [`Watch`], [`Snapshot`] responses will not be
/// modified.
//
// This table is currently empty, but is expected to provide the ability
// to filter more detailed configuration and service state.
strict SetOptions(@generated_name("MonitorOptions") table {});
/// Hanging-get API for changes in network reachability state.
///
/// `Watch` returns a snapshot of the system's most recent reachability
/// state information. The first call returns a current snapshot.
/// Subsequent calls to `Watch` block until the previously-observed state
/// changes.
///
/// While this API guarantees that any state returned was a valid network
/// state at some point, it does not guarantee observation of every
/// intermediate state.
///
/// It is not valid to call `Watch` concurrently. Calling `Watch` while
/// another call over the same server end is in flight will result in the
/// closing the channel.
///
/// - response a snapshot of current system reachability state.
strict Watch() -> (Snapshot);
};
/// Information about network configuration and apparent reachability status
/// of external networks.
type Snapshot = table {
/// Signifies whether internet reachability is available.
1: internet_available bool;
/// Indicates whether any default gateway is reachable at least via
/// link layer.
@available(added=11)
2: gateway_reachable bool;
/// Indicates whether DNS services are functional via any configured
/// network.
@available(added=11)
3: dns_active bool;
/// Indicates whether HTTP fetching is functional via any configured
/// network.
@available(added=HEAD)
4: http_active bool;
};