blob: 1275fab9d9b29c198e22ecf8d2f826820b0553dd [file] [log] [blame]
// Copyright 2019 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.streamlinkfuzzer;
/// A list of packets to process on a stream link
/// For stream_link_untrusted_fuzzer
struct UntrustedInputPlan {
UntrustedLinkDescription link_description;
vector<vector<uint8>> input;
};
struct UntrustedReliableLink {};
struct UntrustedUnreliableLink {};
/// A description of a link between nodes
xunion UntrustedLinkDescription {
UntrustedReliableLink reliable;
UntrustedUnreliableLink unreliable;
};
/// A list of actions to perform on a peer to peer fixture
/// For stream_link_peer_to_peer_fuzzer
struct PeerToPeerPlan {
PeerToPeerLinkDescription link_description;
vector<PeerToPeerAction> actions;
};
/// Which node does an action apply to
enum NodeId : uint8 {
A = 1;
B = 2;
};
/// An action in a peer to peer test
struct PeerToPeerAction {
/// Which node performs the action
NodeId node;
/// The action to perform
PeerToPeerActionType type;
};
/// Helper empty type for union below
struct Void {};
xunion PeerToPeerActionType {
/// Request to send a packet from node --> the other node
vector<uint8>:32 send_packet;
/// Acknowledge a prior send_packet request on node
Void sent_packet;
/// Allow this many bytes to flow from node --> the other node
uint64 allow_bytes;
};
/// A reliable link: uses the ReliableFramer class
struct PeerToPeerReliableLink {};
/// An unreliable link: uses the UnreliableFramer class
/// and additionally has a mutation plan to modify bytes on the wire
struct PeerToPeerUnreliableLink {
vector<StreamMutation> mutation_plan_1_to_2;
vector<StreamMutation> mutation_plan_2_to_1;
};
/// A description of a link between nodes
xunion PeerToPeerLinkDescription {
PeerToPeerReliableLink reliable;
PeerToPeerUnreliableLink unreliable;
};
/// Describes a mutation to apply to a data stream
xunion StreamMutation {
/// bit[flip_bit] ^= 1
uint64 flip_bit;
};
struct InsertByte {
uint64 position;
uint8 byte;
};