1 /* 2 * Copyright 2020 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 // Authors: corbin.souffrant@leviathansecurity.com 17 // dylan.katz@leviathansecurity.com 18 19 #pragma once 20 21 #include <fuzzer/FuzzedDataProvider.h> 22 23 #include "l2cap/classic/dynamic_channel_manager.h" 24 #include "l2cap/classic/l2cap_classic_module.h" 25 26 #include "fuzz_dynamic_channel_manager.h" 27 #include "fuzz_dynamic_channel_manager_impl.h" 28 29 namespace bluetooth { 30 namespace shim { 31 namespace { 32 class FuzzL2capClassicModule : public l2cap::classic::L2capClassicModule { 33 public: GetDynamicChannelManager()34 std::unique_ptr<l2cap::classic::DynamicChannelManager> GetDynamicChannelManager() override { 35 return std::make_unique<FuzzDynamicChannelManager>(*impl_); 36 } 37 ListDependencies(ModuleList *)38 void ListDependencies(ModuleList*) override {} 39 void Start() override; 40 void Stop() override; 41 42 std::unique_ptr<FuzzDynamicChannelManagerImpl> impl_; 43 }; 44 Start()45void FuzzL2capClassicModule::Start() { 46 impl_ = std::make_unique<FuzzDynamicChannelManagerImpl>(); 47 } 48 Stop()49void FuzzL2capClassicModule::Stop() { 50 impl_.reset(); 51 } 52 } // namespace 53 } // namespace shim 54 } // namespace bluetooth 55