xref: /aosp_15_r20/external/grpc-grpc/test/core/transport/binder/end2end/fuzzers/binder_transport_fuzzer.proto (revision cc02d7e222339f7a4f6ba5f422e6413f4bd931f2)
1// Copyright 2021 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 binder_transport_fuzzer;
18
19message Binder {}
20
21message Value {
22  oneof data_type {
23    int32 i32 = 1;
24    int64 i64 = 2;
25    bytes byte_array = 3;
26    // Strings in Parcel could also contain non UTF-8 data so we use bytes
27    // to represent string here
28    bytes str = 4;
29    Binder binder = 5;
30  }
31}
32
33message Parcel {
34  repeated Value values = 1;
35
36  // Simulates the return value of AParcel_getDataSize
37  // (The value generated by protobuf libprotobuf-mutator might not always make sense
38  // but the transport implementation should handle that)
39  int32 data_size = 2;
40}
41
42enum TransactionCode {
43  INVALID = 0;
44  SETUP_TRANSPORT = 1;
45  SHUTDOWN_TRANSPORT = 2;
46  ACKNOWLEDGE_BYTES = 3;
47  PING = 4;
48  PING_RESPONSE = 5;
49}
50
51message Transaction {
52  TransactionCode code = 1;
53  int32 uid = 2;
54  Parcel parcel = 3;
55}
56
57// Special parcel that used for setting up transport.
58// TODO(mingcl): Consider also fuzzing the setup transport code path
59message SetupTransportParcel {
60  int32 version = 1;
61
62  // Simulates the return value of AParcel_getDataSize
63  // (The value generated by protobuf libprotobuf-mutator might not always make sense
64  // but the transport implementation should handle that)
65  int32 data_size = 2;
66}
67
68message SetupTransportTransaction {
69  int32 uid = 1;
70  SetupTransportParcel parcel = 2;
71}
72
73message IncomingParcels {
74  SetupTransportTransaction setup_transport_transaction = 1;
75  repeated Transaction transactions = 2;
76}
77
78message Input {
79  IncomingParcels incoming_parcels = 1;
80}
81
82