blob: a23f805419235e606940d04a40a64d223ee82c2b [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;
using zx;
/// A single message proxied from a Zircon channel over an Overnet stream.
struct ZirconChannelMessage {
/// Bytes part of the payload.
vector<uint8>:zx.CHANNEL_MAX_MSG_BYTES bytes;
/// Handles part of the payload.
vector<ZirconHandle>:zx.CHANNEL_MAX_MSG_HANDLES handles;
};
/// A single handle to be proxied.
/// Not all Zircon types are supported.
union ZirconHandle {
/// A proxied channel.
1: ChannelHandle channel;
/// A proxied socket.
2: SocketHandle socket;
};
/// A proxied channel.
struct ChannelHandle {
/// The handle rights that are given to this handle.
ChannelRights rights;
/// The Overnet proxy stream that was created to carry this channel.
/// The protocol over said stream will be a `ZirconChannel`.
StreamRef stream_ref;
};
/// The type of socket being communicated via [`fuchsia.overnet.protocol/SocketHandle`].
enum SocketType {
/// A datagram oriented socket.
DATAGRAM = 0;
/// A stream oriented socket.
STREAM = 1;
};
/// A proxied socket.
struct SocketHandle {
/// The handle rights that are given to this handle.
SocketRights rights;
/// The Overnet proxy stream that was created to carry this socket.
/// The protocol over said stream will be a `ZirconSocket`.
StreamRef stream_ref;
/// Socket options, per `zx_socket_create`.
SocketType socket_type;
};
/// Channel rights.
/// Overnet treats rights as per-object type, to reduce the space of things that can be communicated
/// over its wire format. Transfer rights are always assumed present.
bits ChannelRights : uint32 {
READ = 0x01;
WRITE = 0x02;
};
/// Socket rights.
/// Overnet treats rights as per-object type, to reduce the space of things that can be communicated
/// over its wire format. Transfer rights are always assumed present.
bits SocketRights : uint32 {
READ = 0x01;
WRITE = 0x02;
};