• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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 #include "auth_common_mock.h"
17 
18 using namespace testing;
19 using namespace testing::ext;
20 
21 namespace OHOS {
22 void *g_commonInterface;
AuthCommonInterfaceMock()23 AuthCommonInterfaceMock::AuthCommonInterfaceMock()
24 {
25     g_commonInterface = reinterpret_cast<void *>(this);
26 }
27 
~AuthCommonInterfaceMock()28 AuthCommonInterfaceMock::~AuthCommonInterfaceMock()
29 {
30     g_commonInterface = nullptr;
31 }
32 
GetCommonInterface()33 static AuthCommonInterface *GetCommonInterface()
34 {
35     return reinterpret_cast<AuthCommonInterfaceMock *>(g_commonInterface);
36 }
37 
38 extern "C" {
LnnAsyncCallbackDelayHelper(SoftBusLooper * looper,LnnAsyncCallbackFunc callback,void * para,uint64_t delayMillis)39 int32_t LnnAsyncCallbackDelayHelper(SoftBusLooper *looper, LnnAsyncCallbackFunc callback,
40     void *para, uint64_t delayMillis)
41 {
42     return GetCommonInterface()->LnnAsyncCallbackDelayHelper(looper, callback, para, delayMillis);
43 }
44 
LnnGetLocalNumU64Info(InfoKey key,uint64_t * info)45 int32_t LnnGetLocalNumU64Info(InfoKey key, uint64_t *info)
46 {
47     return GetCommonInterface()->LnnGetLocalNumU64Info(key, info);
48 }
49 
SoftBusGetBtState(void)50 int SoftBusGetBtState(void)
51 {
52     return GetCommonInterface()->SoftBusGetBtState();
53 }
54 
LnnHbOnTrustedRelationReduced(void)55 void LnnHbOnTrustedRelationReduced(void)
56 {
57     return GetCommonInterface()->LnnHbOnTrustedRelationReduced();
58 }
59 
LnnInsertSpecificTrustedDevInfo(const char * udid)60 int32_t LnnInsertSpecificTrustedDevInfo(const char *udid)
61 {
62     return GetCommonInterface()->LnnInsertSpecificTrustedDevInfo(udid);
63 }
64 
LnnGetNetworkIdByUuid(const char * uuid,char * buf,uint32_t len)65 int32_t LnnGetNetworkIdByUuid(const char *uuid, char *buf, uint32_t len)
66 {
67     return GetCommonInterface()->LnnGetNetworkIdByUuid(uuid, buf, len);
68 }
69 
LnnGetStaFrequency(const NodeInfo * info)70 int32_t LnnGetStaFrequency(const NodeInfo *info)
71 {
72     return GetCommonInterface()->LnnGetStaFrequency(info);
73 }
74 
LnnEncryptAesGcm(AesGcmInputParam * in,int32_t keyIndex,uint8_t ** out,uint32_t * outLen)75 int32_t LnnEncryptAesGcm(AesGcmInputParam *in, int32_t keyIndex, uint8_t **out, uint32_t *outLen)
76 {
77     return GetCommonInterface()->LnnEncryptAesGcm(in, keyIndex, out, outLen);
78 }
79 
LnnDecryptAesGcm(AesGcmInputParam * in,uint8_t ** out,uint32_t * outLen)80 int32_t LnnDecryptAesGcm(AesGcmInputParam *in, uint8_t **out, uint32_t *outLen)
81 {
82     return GetCommonInterface()->LnnDecryptAesGcm(in, out, outLen);
83 }
84 
LnnGetTrustedDevInfoFromDb(char ** udidArray,uint32_t * num)85 int32_t LnnGetTrustedDevInfoFromDb(char **udidArray, uint32_t *num)
86 {
87     return GetCommonInterface()->LnnGetTrustedDevInfoFromDb(udidArray, num);
88 }
89 }
90 } // namespace OHOS