• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
17 #include "hci/fuzz/status_vs_complete_commands.h"
18 #include <map>
19 
20 namespace bluetooth {
21 namespace hci {
22 namespace fuzz {
23 
24 using ::bluetooth::hci::OpCode;
25 
26 constexpr OpCode StatusOpCodes[] = {
27     OpCode::RESET,
28 };
29 
30 static std::map<OpCode, bool> commands_that_use_status;
31 
maybe_populate_list()32 static void maybe_populate_list() {
33   if (!commands_that_use_status.empty()) {
34     return;
35   }
36 
37   for (OpCode code : StatusOpCodes) {
38     commands_that_use_status[code] = true;
39   }
40 }
41 
uses_command_status(OpCode code)42 bool uses_command_status(OpCode code) {
43   maybe_populate_list();
44   return commands_that_use_status.find(code) != commands_that_use_status.end();
45 }
46 
47 }  // namespace fuzz
48 }  // namespace hci
49 }  // namespace bluetooth
50