1 /*
2  * Copyright (C) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef SMP_COMMON_H
17 #define SMP_COMMON_H
18 
19 #include "platform/include/list.h"
20 #include "platform/include/mutex.h"
21 #include "smp.h"
22 #include "smp_def.h"
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 void SMP_PairTimeout(void *parameter);
29 void SMP_GeneratePairResult(uint16_t handle, uint8_t status, uint8_t failedReason, Alarm *cancelTimer);
30 int SMP_EncryptCompleteJudgeException(uint8_t status, uint8_t role);
31 void SMP_GenerateSignatureStep1(const SMP_StepParam *param);
32 void SMP_GenerateSignatureStep2(const SMP_StepParam *param);
33 void SMP_GenerateSignatureStep3(const SMP_StepParam *param);
34 bool SMP_GetSecureConnOnlyMode();
35 SMP_PairMng *SMP_GetPairMng();
36 void SMP_NotifyCbAuthReq(uint16_t handle, uint8_t pairMethod, const uint8_t *displayValue);
37 void SMP_NotifyCbPairRet(uint16_t handle, uint8_t status, const SMP_PairResult *result);
38 void SMP_NotifyCbPairReq(uint16_t handle, const SMP_PairParam *param);
39 void SMP_NotifyCbPairRsp(uint16_t handle, const SMP_PairParam *param);
40 void SMP_NotifyCbSecReq(uint16_t handle, uint8_t authReq);
41 void SMP_NotifyCbLtkReq(uint16_t handle, const uint8_t *random, uint16_t ediv);
42 void SMP_NotifyCbEncComp(uint16_t handle, uint8_t status);
43 void SMP_NotifyCbGenSign(uint8_t status, const uint8_t *sign);
44 void SMP_NotifyCbGenRpa(uint8_t status, const uint8_t *addr);
45 void SMP_NotifyCbResoRpa(uint8_t status, bool result, const uint8_t *addr, const uint8_t *irk);
46 void SMP_NotifyCbGenScOobData(uint8_t status, const uint8_t *random, const uint8_t *confirm);
47 
48 int SMP_ParamIsNULL(const SMP_StepParam *param);
49 
50 #ifdef __cplusplus
51 }
52 #endif
53 
54 #endif