• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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_session_fsm_mock.h"
17 
18 namespace OHOS {
19 void *g_authSessionFsmInterface;
AuthSessionFsmInterfaceMock()20 AuthSessionFsmInterfaceMock::AuthSessionFsmInterfaceMock()
21 {
22     g_authSessionFsmInterface = reinterpret_cast<void *>(this);
23 }
24 
~AuthSessionFsmInterfaceMock()25 AuthSessionFsmInterfaceMock::~AuthSessionFsmInterfaceMock()
26 {
27     g_authSessionFsmInterface = nullptr;
28 }
29 
GetAuthSessionFsmInterface()30 static AuthSessionFsmInterfaceMock *GetAuthSessionFsmInterface()
31 {
32     return reinterpret_cast<AuthSessionFsmInterfaceMock *>(g_authSessionFsmInterface);
33 }
34 
35 extern "C" {
SoftBusGetBrState(void)36 int32_t SoftBusGetBrState(void)
37 {
38     return GetAuthSessionFsmInterface()->SoftBusGetBrState();
39 }
40 
GetUdidShortHash(const AuthSessionInfo * info,char * udidBuf,uint32_t bufLen)41 bool GetUdidShortHash(const AuthSessionInfo *info, char *udidBuf, uint32_t bufLen)
42 {
43     return GetAuthSessionFsmInterface()->GetUdidShortHash(info, udidBuf, bufLen);
44 }
45 
LnnRetrieveDeviceInfoPacked(const char * udid,NodeInfo * deviceInfo)46 int32_t LnnRetrieveDeviceInfoPacked(const char *udid, NodeInfo *deviceInfo)
47 {
48     return GetAuthSessionFsmInterface()->LnnRetrieveDeviceInfoPacked(udid, deviceInfo);
49 }
50 
IsSupportFeatureByCapaBit(uint32_t feature,AuthCapability capaBit)51 bool IsSupportFeatureByCapaBit(uint32_t feature, AuthCapability capaBit)
52 {
53     return GetAuthSessionFsmInterface()->IsSupportFeatureByCapaBit(feature, capaBit);
54 }
55 
GetAuthRequest(uint32_t requestId,AuthRequest * request)56 int32_t GetAuthRequest(uint32_t requestId, AuthRequest *request)
57 {
58     return GetAuthSessionFsmInterface()->GetAuthRequest(requestId, request);
59 }
60 
LnnRetrieveDeviceInfoByUdidPacked(const char * udid,NodeInfo * deviceInfo)61 int32_t LnnRetrieveDeviceInfoByUdidPacked(const char *udid, NodeInfo *deviceInfo)
62 {
63     return GetAuthSessionFsmInterface()->LnnRetrieveDeviceInfoByUdidPacked(udid, deviceInfo);
64 }
LnnGetRemoteNodeInfoById(const char * id,IdCategory type,NodeInfo * info)65 int32_t LnnGetRemoteNodeInfoById(const char *id, IdCategory type, NodeInfo *info)
66 {
67     return GetAuthSessionFsmInterface()->LnnGetRemoteNodeInfoById(id, type, info);
68 }
69 
PostDeviceInfoMessage(int64_t authSeq,const AuthSessionInfo * info)70 int32_t PostDeviceInfoMessage(int64_t authSeq, const AuthSessionInfo *info)
71 {
72     return GetAuthSessionFsmInterface()->PostDeviceInfoMessage(authSeq, info);
73 }
ProcessDeviceIdMessage(AuthSessionInfo * info,const uint8_t * data,uint32_t len,int64_t authSeq)74 int32_t ProcessDeviceIdMessage(AuthSessionInfo *info, const uint8_t *data, uint32_t len,
75     int64_t authSeq)
76 {
77     return GetAuthSessionFsmInterface()->ProcessDeviceIdMessage(info, data, len, authSeq);
78 }
PostDeviceIdMessage(int64_t authSeq,const AuthSessionInfo * info)79 int32_t PostDeviceIdMessage(int64_t authSeq, const AuthSessionInfo *info)
80 {
81     return GetAuthSessionFsmInterface()->PostDeviceIdMessage(authSeq, info);
82 }
LnnIsNeedInterceptBroadcast(bool disableGlass)83 bool LnnIsNeedInterceptBroadcast(bool disableGlass)
84 {
85     return GetAuthSessionFsmInterface()->LnnIsNeedInterceptBroadcast(disableGlass);
86 }
87 }
88 }