blob: 7d5f99a80b1e776bf6065a610747856f00695b34 [file] [log] [blame]
// Copyright 2022 The Pigweed Authors
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy of
// the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations under
// the License.
syntax = "proto3";
package pw.transfer;
option java_package = "pw.transfer";
option java_outer_classname = "ConfigProtos";
message TransferAction {
// As transfers are always client initiated, TransferType is from the client's
// perspective.
enum TransferType {
UNKNOWN = 0;
WRITE_TO_SERVER = 1;
READ_FROM_SERVER = 2;
}
// Transfer resource ID to use for this transfer.
uint32 resource_id = 1;
// Path to the file that data should be read from or written to (depending on
// transfer_type). When reading from the server, this is the path the file
// is written to. When writing to the server, this is the path to the file
// that should be read from.
string file_path = 2;
// Whether to write to the server, or read from it.
TransferType transfer_type = 3;
}
// Configuration for the integration test client.
message ClientConfig {
// The sequence of transfer actions to perform during the lifetime of this
// client configuration.
repeated TransferAction transfer_actions = 1;
// The maximum number of times this client will attempt to send a packet
// before the transfer aborts due to a lack of response.
uint32 max_retries = 2;
// The maximum time this client will wait for a response to the first
// packet sent to the pw_transfer server before attempting to retry. Extending
// this can help work around cases where transfer initialization takes a long
// time.
//
// Note: This parameter is only supported on Java transfer clients.
// TODO(tpudlik): google.protobuf.Duration?
uint32 initial_chunk_timeout_ms = 3;
// The maximum amount of time this client will wait for a response to a sent
// packet before attempting to re-send the packet.
//
// TODO(tpudlik): google.protobuf.Duration?
uint32 chunk_timeout_ms = 4;
}
// Stacks of paths to use when doing transfers. Each new initiated transfer
// on this resource gets the next file path in the stack. Once the stack is
// exhausted, new transfers on this resource fail as though this resource is
// unregistered.
message ServerResourceLocations {
// When a client reads from this server, this stack is used to determine which
// file path to read data from.
repeated string source_paths = 3;
// When a client writes to this server, this stack is used to determine which
// file path to write data to.
repeated string destination_paths = 4;
}
// Configuration for the integration test server.
message ServerConfig {
// A mapping of transfer resource ID to files to read from or write to.
map<uint32, ServerResourceLocations> resources = 1;
// Size of the chunk buffer used by this server's transfer thread, in bytes.
uint32 chunk_size_bytes = 2;
// Window size, in bytes.
uint32 pending_bytes = 3;
// TODO(tpudlik): google.protobuf.Duration?
uint32 chunk_timeout_seconds = 4;
uint32 transfer_service_retries = 5;
uint32 extend_window_divisor = 6;
}
// Configuration for the HdlcPacketizer proxy filter.
message HdlcPacketizerConfig {}
// Configuration for the DataDropper proxy filter.
message DataDropperConfig {
// Rate at which to drop data
float rate = 1;
// Seed to use for the rand number generator used for determining
// when data is dropped.
int64 seed = 2;
}
// Configuration for the RateLimiter proxy filter.
message RateLimiterConfig {
// Rate limit, in bytes/sec.
float rate = 1;
}
// Configuration for the DataTransposer proxy filter.
message DataTransposerConfig {
// Rate at which to transpose data. Probability of transposition
// between 0.0 and 1.0.
float rate = 1;
// Maximum time a chunk of data will be held for Transposition. After this
// time has elapsed, the packet is sent in order.
float timeout = 2;
// Seed to use for the rand number generator used for determining
// when data is transposed.
int64 seed = 3;
}
// Configuration for a single stage in the proxy filter stack.
message FilterConfig {
oneof filter {
HdlcPacketizerConfig hdlc_packetizer = 1;
DataDropperConfig data_dropper = 2;
RateLimiterConfig rate_limiter = 3;
DataTransposerConfig data_transposer = 4;
}
}
message ProxyConfig {
// Filters are listed in order of execution. I.e. the first filter listed
// will get the received data first then pass it on the the second listed
// filter. That process repeats until the last filter send the data to the
// other side of the proxy.
repeated FilterConfig client_filter_stack = 1;
repeated FilterConfig server_filter_stack = 2;
}