blob: 187a5cab83e4d604ac5f4e17e991c85fae6411f5 [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.overnet;
// Overnet forms a mesh network of peer devices which can proxy some Zircon objects between
// said devices.
using fuchsia.overnet.protocol;
using zx;
/// Interfaces applicable to consuming services from other devices
protocol ServiceConsumer {
/// Returns a list of all peers that are connected to this Overnet.
/// If this list has not been updated since the last call to this method, it waits until
/// new data is available.
/// Concurrent calls to ListPeers will result in channel closure.
ListPeers() -> (vector<Peer>:MAX peers);
/// Connect `chan` to some external service on `node` with name `service_name`.
ConnectToService(fuchsia.overnet.protocol.NodeId node,
string:fuchsia.overnet.protocol.MAX_SERVICE_NAME_LENGTH service_name,
zx.handle:CHANNEL chan);
/// Interfaces applicable to sharing services with ServiceConsumer's
protocol ServicePublisher {
/// Register a new service to be exported by Overnet.
/// If an existing service has the same `service_name`, it's replaced by this service.
PublishService(string:fuchsia.overnet.protocol.MAX_SERVICE_NAME_LENGTH service_name,
ServiceProvider provider);
/// Interfaces applicable to controlling an Overnet mesh
protocol MeshController {
/// Attach a socket as a new link. Bad socket options will result in the channel being closed.
AttachSocketLink(zx.handle:SOCKET socket, SocketLinkOptions options);
/// A ServiceProvider is a factory for one service.
protocol ServiceProvider {
/// Connect `chan` to the service (called in response to Overnet.ConnectToService).
/// `info` provides additional data about the connection request.
ConnectToService(zx.handle:CHANNEL chan, ConnectionInfo info);
/// Protocol spoken by the host implementation to access various sub-interfaces.
protocol HostOvernet {
ConnectServiceConsumer(request<ServiceConsumer> svc);
ConnectServicePublisher(request<ServicePublisher> svc);
ConnectMeshController(request<MeshController> svc);
/// A `Peer` describes one device on the Overnet mesh.
struct Peer {
/// The address of the peer on the Overnet mesh.
fuchsia.overnet.protocol.NodeId id;
/// A special peer is returned for this device, and is marked with `is_self` true.
bool is_self;
/// A description of the peer (includes, for example, a service list).
fuchsia.overnet.protocol.PeerDescription description;
/// Extra arguments for attaching a socket link to an Overnet mesh.
table SocketLinkOptions {
/// A label that might be used for debugging purposes.
1: string:32 connection_label;
/// How many bytes per second are transferable on this link (used to tune error recovery).
/// If unset, error recovery will be disabled.
/// If set, must not be 0, or else the receiving MeshController service will close the channel
/// (as discussed in that protocol's documentation).
2: uint32 bytes_per_second;
/// Information provided to a ServiceProvider about an incoming connection.
table ConnectionInfo {
/// The peer address initiating this connection.
1: fuchsia.overnet.protocol.NodeId peer;