1 /* 2 * Copyright 2019 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 #pragma once 17 18 #include <memory> 19 20 #include "l2cap/le/dynamic_channel_manager.h" 21 #include "l2cap/le/fixed_channel_manager.h" 22 #include "l2cap/le/security_enforcement_interface.h" 23 #include "module.h" 24 25 namespace bluetooth { 26 27 namespace security { 28 class SecurityModule; 29 } 30 31 namespace l2cap { 32 namespace le { 33 34 class L2capLeModule : public bluetooth::Module { 35 public: 36 L2capLeModule(); 37 virtual ~L2capLeModule(); 38 39 /** 40 * Get the api to the LE fixed channel l2cap module 41 */ 42 virtual std::unique_ptr<FixedChannelManager> GetFixedChannelManager(); 43 44 /** 45 * Get the api to the LE dynamic channel l2cap module 46 */ 47 virtual std::unique_ptr<DynamicChannelManager> GetDynamicChannelManager(); 48 49 static const ModuleFactory Factory; 50 51 protected: 52 void ListDependencies(ModuleList* list) override; 53 54 void Start() override; 55 56 void Stop() override; 57 58 std::string ToString() const override; 59 60 private: 61 struct impl; 62 std::unique_ptr<impl> pimpl_; 63 64 friend security::SecurityModule; 65 /** 66 * Only for the LE security module to inject functionality to enforce security level for a connection. When LE 67 * security module is stopping, inject nullptr. Note: We expect this only to be called during stack startup. This is 68 * not synchronized. 69 */ 70 virtual void InjectSecurityEnforcementInterface(SecurityEnforcementInterface* security_enforcement_interface); 71 DISALLOW_COPY_AND_ASSIGN(L2capLeModule); 72 }; 73 74 } // namespace le 75 } // namespace l2cap 76 } // namespace bluetooth 77