xref: /aosp_15_r20/external/grpc-grpc/test/core/util/fuzzing_channel_args.h (revision cc02d7e222339f7a4f6ba5f422e6413f4bd931f2)
1 // Copyright 2023 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 
15 #ifndef GRPC_TEST_CORE_UTIL_FUZZING_CHANNEL_ARGS_H
16 #define GRPC_TEST_CORE_UTIL_FUZZING_CHANNEL_ARGS_H
17 
18 #include <memory>
19 
20 #include <grpc/support/port_platform.h>
21 
22 #include "src/core/lib/channel/channel_args.h"
23 #include "src/core/lib/gprpp/ref_counted_ptr.h"
24 #include "src/core/lib/resource_quota/resource_quota.h"
25 #include "test/core/util/fuzzing_channel_args.pb.h"
26 
27 namespace grpc_core {
28 namespace testing {
29 
30 struct FuzzingEnvironment {
31   // This resource quota is only added to ChannelArgs if the fuzzing
32   // configuration requests it.
33   RefCountedPtr<ResourceQuota> resource_quota =
34       MakeResourceQuota("fuzzing_quota");
35 };
36 
37 // Create ChannelArgs from a fuzzer configuration.
38 ChannelArgs CreateChannelArgsFromFuzzingConfiguration(
39     const grpc::testing::FuzzingChannelArgs& fuzzing_channel_args,
40     const FuzzingEnvironment& fuzzing_environment);
41 
42 }  // namespace testing
43 }  // namespace grpc_core
44 
45 #endif  // GRPC_TEST_CORE_UTIL_FUZZING_CHANNEL_ARGS_H
46