blob: 7c04cafe9762884378e6b6cd7ff87bfb7beaca9e [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.protocol;
// TODO(ctiller): make this fuchsia.io.MAX_FILENAME
const uint64 MAX_SERVICE_NAME_LENGTH = 255;
/// Peer-to-peer protocol between two Overnet nodes.
/// Client quic connections send this xunion to servers over quic stream 0.
strict xunion PeerMessage {
/// Request to create a channel to a service exported by this peer.
1: ConnectToService connect_to_service;
/// Update this peers description on the server.
2: PeerDescription update_node_description;
/// Update information about a link that this peer knows about on the
/// remote peer.
3: UpdateLinkStatus update_link_status;
};
/// Overall connection configuration request
table ConfigRequest {
};
/// Overall connection configuration response - sent as the first response message
/// on the connection stream.
table ConfigResponse {
};
/// Reply messages for PeerMessage, where appropriate.
/// The ConfigResponse message must have been sent already.
strict xunion PeerReply {
/// Acknowledge an UpdateLinkStatus message
1: Empty update_link_status_ack;
};
struct Empty {
};
/// Update status of all links starting from a given node
/// By bundling all link updates together, we guarantee:
/// - a simple protocol that can deal with updates, additions, and deletions to the link set
/// - no routing decisions based on partial information from any one node
struct UpdateLinkStatus {
/// Status of all active links originating at the sending node
vector<LinkStatus>:MAX link_status;
};
/// Create a new stream, labelled `stream_id`, to communicate with the
/// advertised service `service_name`.
struct ConnectToService {
/// Which service to connect to.
string:MAX_SERVICE_NAME_LENGTH service_name;
/// On which quic stream will this service connection be formed.
uint64 stream_id;
/// Ancillary options for this connection.
ConnectToServiceOptions options;
};
/// Options for service connection formation.
table ConnectToServiceOptions {
};
/// Description of a single node.
table PeerDescription {
/// The set of services published by this node.
1: vector<string:MAX_SERVICE_NAME_LENGTH>:MAX services;
};
/// Metrics associated with a link.
/// Note that a link is a uni-directional connection between two nodes.
table LinkMetrics {
/// Current round trip time for requests across this link in microseconds.
1: uint64 round_trip_time;
};
/// Status packet for a single link. A link is a unidirectional connection between two peers,
/// and is owned by the first peer. The target node is identified by `to`.
struct LinkStatus {
/// Link target node.
NodeId to;
/// An identifier (chosen by the link owner) to label this link.
/// The link owner must guarantee that the tuple (to, local_id) is unique for each of it's held
/// links.
LinkId local_id;
/// Metrics associated with this link.
LinkMetrics metrics;
};