1 /****************************************************************************** 2 * 3 * Copyright 2019 The Android Open Source Project 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at: 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 ******************************************************************************/ 18 19 #pragma once 20 21 #include <string> 22 23 #include "security/smp_packets.h" 24 25 namespace bluetooth { 26 namespace security { 27 28 /* This structure holds the information about the failure in case of airing failure */ 29 struct PairingFailure { 30 /* A place in code that triggered this failure. It can be modified by functions that pass the error to a location that 31 * better reflect the current state of flow. i.e. instead of generic location responsible for waiting for packet, 32 * replace it with location of receiving specific packet in a specific flow */ 33 // base::Location location; 34 35 /* This is the failure message, that will be passed, either into upper layers, 36 * or to the metrics in future */ 37 std::string message; 38 39 /* If failure is due to mismatch of received code, this contains the received opcode */ 40 Code received_code_; 41 42 /* if the failure is due to "SMP failure", this field contains the reson code 43 */ 44 PairingFailedReason reason; 45 PairingFailurePairingFailure46 PairingFailure(/*const base::Location& location, */ const std::string& message) 47 : /*location(location), */ message(message) {} 48 PairingFailurePairingFailure49 PairingFailure(/*const base::Location& location, */ const std::string& message, Code received_code) 50 : /*location(location), */ message(message), received_code_(received_code) {} 51 PairingFailurePairingFailure52 PairingFailure(/*const base::Location& location, */ const std::string& message, PairingFailedReason reason) 53 : /*location(location),*/ message(message), reason(reason) {} 54 }; 55 56 } // namespace security 57 } // namespace bluetooth