/* * Copyright 2024, gRPC Authors All rights reserved. * * 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 * * http://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"; // A controllable service for testing. // // The control service has one RPC of each kind, the input to each RPC controls // the output. service Control { rpc Unary(ControlInput) returns (ControlOutput) {} rpc ServerStream(ControlInput) returns (stream ControlOutput) {} rpc ClientStream(stream ControlInput) returns (ControlOutput) {} rpc BidiStream(stream ControlInput) returns (stream ControlOutput) {} } message ControlInput { // Whether metadata should be echo'd back in the initial metadata. // // Ignored if the initial metadata has already been sent back to the // client. // // Each header field name in the request headers will be prefixed with // "echo-". For example the header field name "foo" will be returned // as "echo-foo. Note that semicolons aren't valid in HTTP header field // names (apart from pseudo headers). As such all semicolons should be // removed (":path" should become "echo-path"). bool echo_metadata_in_headers = 1; // Parameters for response messages. PayloadParameters message_params = 2; // The number of response messages. int32 number_of_messages = 3; // The status code and message to use at the end of the RPC. // // If this is set then the RPC will be ended after `number_of_messages` // messages have been sent back to the client. RPCStatus status = 5; // Whether the response should be trailers only. // // Ignored unless it's set on the first message on the stream. When set // the RPC will be completed with a trailers-only response using the // status code and message from 'status'. The request metadata will be // included if 'echo_metadata_in_trailers' is set. // // If this is set then 'number_of_messages', 'message_params', and // 'echo_metadata_in_headers' are ignored. bool is_trailers_only = 6; // Whether metadata should be echo'd back in the trailing metadata. // // Ignored unless 'status' is set. // // Each header field name in the request headers will be prefixed with // "echo-". For example the header field name "foo" will be returned // as "echo-foo. Note that semicolons aren't valid in HTTP header field // names (apart from pseudo headers). As such all semicolons should be // removed (":path" should become "echo-path"). bool echo_metadata_in_trailers = 4; } message RPCStatus { // Status code indicating the outcome of the RPC. StatusCode code = 1; // The message to include with the 'code' at the end of the RPC. string message = 2; } enum StatusCode { OK = 0; CANCELLED = 1; UNKNOWN = 2; INVALID_ARGUMENT = 3; DEADLINE_EXCEEDED = 4; NOT_FOUND = 5; ALREADY_EXISTS = 6; PERMISSION_DENIED = 7; RESOURCE_EXHAUSTED = 8; FAILED_PRECONDITION = 9; ABORTED = 10; OUT_OF_RANGE = 11; UNIMPLEMENTED = 12; INTERNAL = 13; UNAVAILABLE = 14; DATA_LOSS = 15; UNAUTHENTICATED = 16; } message PayloadParameters { // The number of bytes to put into the output payload. int32 size = 1; // The content to use in the payload. The value is truncated to an octet. uint32 content = 2; } message ControlOutput { bytes payload = 1; }