xref: /aosp_15_r20/external/grpc-grpc/test/core/end2end/fuzzers/fuzzer_input.proto (revision cc02d7e222339f7a4f6ba5f422e6413f4bd931f2)
1// Copyright 2023 The gRPC authors.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15syntax = "proto3";
16
17package fuzzer_input;
18
19import "test/core/end2end/fuzzers/api_fuzzer.proto";
20import "test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.proto";
21import "test/core/util/fuzz_config_vars.proto";
22import "test/core/util/fuzzing_channel_args.proto";
23
24message Empty{};
25
26message H2DataFrame {
27    uint32 stream_id = 1;
28    bool end_of_stream = 2;
29    bytes payload = 3;
30}
31
32message SimpleHeader {
33    // If key & value are set, then a literal unencoded header is added.
34    optional string key = 1;
35    optional string value = 2;
36    // If raw_bytes is set, then after the key/value pair (if emitted) the raw bytes are emitted.
37    optional bytes raw_bytes = 3;
38}
39
40message SimpleHeaders {
41    repeated SimpleHeader headers = 1;
42
43    optional string grpc_timeout = 2;
44    optional string te = 3;
45    optional string content_type = 4;
46    optional string scheme = 5;
47    optional string method = 6;
48    optional string grpc_encoding = 7;
49    optional string grpc_internal_encoding_request = 8;
50    optional string grpc_accept_encoding = 9;
51    optional string user_agent = 10;
52    optional string grpc_message = 11;
53    optional string host = 12;
54    optional string endpoint_load_metrics_bin = 13;
55    optional string grpc_server_stats_bin = 14;
56    optional string grpc_trace_bin = 15;
57    optional string grpc_tags_bin = 16;
58    optional string x_envoy_peer_metadata = 17;
59    optional string authority = 18;
60    optional string path = 19;
61    optional string grpc_status = 20;
62    optional string grpc_previous_rpc_attempts = 21;
63    optional string grpc_retry_pushback_ms = 22;
64    optional string status = 23;
65    optional string grpclb_client_stats = 24;
66    optional string lb_token = 25;
67    optional string lb_cost_bin = 26;
68
69    optional string chaotic_good_connection_type = 27;
70    optional string chaotic_good_connection_id = 28;
71    optional string chaotic_good_alignment = 29;
72}
73
74message H2HeaderFrame {
75    uint32 stream_id = 1;
76    bool end_headers =  2;
77    bool end_stream = 3;
78    oneof payload {
79        bytes raw_bytes = 5;
80        SimpleHeaders simple_header = 6;
81    }
82}
83
84message H2ContinuationFrame {
85    uint32 stream_id = 1;
86    bool end_headers =  2;
87    oneof payload {
88        bytes raw_bytes = 5;
89        SimpleHeaders simple_header = 6;
90    }
91}
92
93message H2RstStreamFrame {
94    uint32 stream_id = 1;
95    uint32 error_code = 2;
96}
97
98message H2Setting {
99    uint32 id = 1;
100    uint32 value = 2;
101}
102
103message H2SettingsFrame {
104    bool ack = 1;
105    repeated H2Setting settings = 2;
106}
107
108message H2PingFrame {
109    bool ack = 1;
110    uint64 opaque = 2;
111}
112
113message H2GoawayFrame {
114    uint32 last_stream_id = 1;
115    uint32 error_code = 2;
116    bytes debug_data = 3;
117}
118
119message H2WindowUpdateFrame {
120    uint32 stream_id = 1;
121    uint32 increment = 2;
122}
123
124message H2ClientPrefix {}
125
126message ChaoticGoodServerFragment {
127    uint32 stream_id = 1;
128    oneof headers {
129        Empty headers_none = 11;
130        bytes headers_raw_bytes = 12;
131        SimpleHeaders headers_simple_header = 13;
132    }
133    oneof data {
134        Empty none = 21;
135        uint32 length = 22;
136    }
137    oneof trailers {
138        Empty trailers_none = 31;
139        bytes trailers_raw_bytes = 32;
140        SimpleHeaders trailers_simple_header = 33;
141    }
142}
143
144message ChaoticGoodMessageData {
145    uint32 length = 1;
146    uint32 padding = 2;
147}
148
149message ChaoticGoodFrame {
150    enum FrameType {
151        SETTINGS = 0;
152        FRAGMENT = 1;
153        CANCEL = 2;
154    };
155    uint32 stream_id = 1;
156    FrameType type = 2;
157    oneof headers {
158        Empty headers_none = 11;
159        bytes headers_raw_bytes = 12;
160        SimpleHeaders headers_simple_header = 13;
161    }
162    oneof data {
163        Empty data_none = 21;
164        ChaoticGoodMessageData data_sized = 23;
165    }
166    oneof trailers {
167        Empty trailers_none = 31;
168        bytes trailers_raw_bytes = 32;
169        SimpleHeaders trailers_simple_header = 33;
170    }
171}
172
173message ChaoticGoodSettings {}
174
175message InputSegment {
176    int32 delay_ms = 1;
177    oneof payload {
178        bytes raw_bytes = 2;
179        H2DataFrame data = 3;
180        H2HeaderFrame header = 4;
181        H2ContinuationFrame continuation = 5;
182        H2RstStreamFrame rst_stream = 6;
183        H2SettingsFrame settings = 7;
184        H2PingFrame ping = 8;
185        H2GoawayFrame goaway = 9;
186        H2WindowUpdateFrame window_update = 10;
187        H2ClientPrefix client_prefix = 11;
188        uint32 repeated_zeros = 12;
189        ChaoticGoodFrame chaotic_good = 13;
190    }
191}
192
193message InputSegments {
194    repeated InputSegment segments = 1;
195}
196
197message NetworkInput {
198    int32 connect_delay_ms = 3;
199    int32 connect_timeout_ms = 4;
200    grpc.testing.FuzzingChannelArgs endpoint_config = 5;
201    oneof value {
202        bytes single_read_bytes = 1;
203        InputSegments input_segments = 2;
204    }
205}
206
207message Msg {
208    repeated NetworkInput network_input = 1;
209    repeated api_fuzzer.Action api_actions = 2;
210    fuzzing_event_engine.Actions event_engine_actions = 3;
211    grpc.testing.FuzzConfigVars config_vars = 4;
212    grpc.testing.FuzzingChannelArgs channel_args = 5;
213}
214