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 "fuzz_dynamic_channel_manager_impl.h" 22 #include "hci/address.h" 23 #include "l2cap/classic/dynamic_channel_configuration_option.h" 24 #include "l2cap/classic/dynamic_channel_manager.h" 25 #include "l2cap/classic/security_policy.h" 26 #include "l2cap/psm.h" 27 28 namespace bluetooth { 29 namespace shim { 30 namespace { 31 class FuzzDynamicChannelManager : public l2cap::classic::DynamicChannelManager { 32 public: ConnectChannel(hci::Address device,l2cap::classic::DynamicChannelConfigurationOption configuration_option,l2cap::Psm psm,l2cap::classic::DynamicChannelManager::OnConnectionOpenCallback on_open_callback,l2cap::classic::DynamicChannelManager::OnConnectionFailureCallback on_fail_callback)33 void ConnectChannel( 34 hci::Address device, 35 l2cap::classic::DynamicChannelConfigurationOption configuration_option, 36 l2cap::Psm psm, 37 l2cap::classic::DynamicChannelManager::OnConnectionOpenCallback on_open_callback, 38 l2cap::classic::DynamicChannelManager::OnConnectionFailureCallback on_fail_callback) override { 39 impl_.ConnectChannel(device, configuration_option, psm, std::move(on_open_callback), std::move(on_fail_callback)); 40 } 41 RegisterService(l2cap::Psm psm,l2cap::classic::DynamicChannelConfigurationOption configuration_option,const l2cap::classic::SecurityPolicy & security_policy,l2cap::classic::DynamicChannelManager::OnRegistrationCompleteCallback on_registration_complete,l2cap::classic::DynamicChannelManager::OnConnectionOpenCallback on_open_callback)42 void RegisterService( 43 l2cap::Psm psm, 44 l2cap::classic::DynamicChannelConfigurationOption configuration_option, 45 const l2cap::classic::SecurityPolicy& security_policy, 46 l2cap::classic::DynamicChannelManager::OnRegistrationCompleteCallback on_registration_complete, 47 l2cap::classic::DynamicChannelManager::OnConnectionOpenCallback on_open_callback) override { 48 impl_.RegisterService( 49 psm, configuration_option, security_policy, std::move(on_registration_complete), std::move(on_open_callback)); 50 } FuzzDynamicChannelManager(FuzzDynamicChannelManagerImpl & impl)51 FuzzDynamicChannelManager(FuzzDynamicChannelManagerImpl& impl) : impl_(impl) {} 52 FuzzDynamicChannelManagerImpl& impl_; 53 }; 54 } // namespace 55 } // namespace shim 56 } // namespace bluetooth 57