• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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_net_ledger_mock.h"
17 
18 using namespace testing;
19 using namespace testing::ext;
20 
21 namespace OHOS {
22 void *g_netLedgerinterface;
AuthNetLedgertInterfaceMock()23 AuthNetLedgertInterfaceMock::AuthNetLedgertInterfaceMock()
24 {
25     g_netLedgerinterface = reinterpret_cast<void *>(this);
26 }
27 
~AuthNetLedgertInterfaceMock()28 AuthNetLedgertInterfaceMock::~AuthNetLedgertInterfaceMock()
29 {
30     g_netLedgerinterface = nullptr;
31 }
32 
GetNetLedgerInterface()33 static AuthNetLedgerInterface *GetNetLedgerInterface()
34 {
35     return reinterpret_cast<AuthNetLedgertInterfaceMock *>(g_netLedgerinterface);
36 }
37 
38 extern "C" {
LnnGetLocalStrInfo(InfoKey key,char * info,uint32_t len)39 int32_t LnnGetLocalStrInfo(InfoKey key, char *info, uint32_t len)
40 {
41     return GetNetLedgerInterface()->LnnGetLocalStrInfo(key, info, len);
42 }
43 
LnnDeleteSpecificTrustedDevInfo(const char * udid)44 int32_t LnnDeleteSpecificTrustedDevInfo(const char *udid)
45 {
46     return GetNetLedgerInterface()->LnnDeleteSpecificTrustedDevInfo(udid);
47 }
48 
LnnGetLocalNodeInfo(void)49 const NodeInfo *LnnGetLocalNodeInfo(void)
50 {
51     return GetNetLedgerInterface()->LnnGetLocalNodeInfo();
52 }
53 
LnnGetAuthPort(const NodeInfo * info)54 int32_t LnnGetAuthPort(const NodeInfo *info)
55 {
56     return GetNetLedgerInterface()->LnnGetAuthPort(info);
57 }
58 
LnnGetSessionPort(const NodeInfo * info)59 int32_t LnnGetSessionPort(const NodeInfo *info)
60 {
61     return GetNetLedgerInterface()->LnnGetSessionPort(info);
62 }
63 
LnnGetProxyPort(const NodeInfo * info)64 int32_t LnnGetProxyPort(const NodeInfo *info)
65 {
66     return GetNetLedgerInterface()->LnnGetProxyPort(info);
67 }
68 
LnnGetBtMac(const NodeInfo * info)69 const char *LnnGetBtMac(const NodeInfo *info)
70 {
71     return GetNetLedgerInterface()->LnnGetBtMac(info);
72 }
73 
LnnGetDeviceName(const DeviceBasicInfo * info)74 const char *LnnGetDeviceName(const DeviceBasicInfo *info)
75 {
76     return GetNetLedgerInterface()->LnnGetDeviceName(info);
77 }
78 
LnnConvertIdToDeviceType(uint16_t typeId)79 char *LnnConvertIdToDeviceType(uint16_t typeId)
80 {
81     return GetNetLedgerInterface()->LnnConvertIdToDeviceType(typeId);
82 }
83 
LnnGetDeviceUdid(const NodeInfo * info)84 const char *LnnGetDeviceUdid(const NodeInfo *info)
85 {
86     return GetNetLedgerInterface()->LnnGetDeviceUdid(info);
87 }
88 
LnnGetP2pRole(const NodeInfo * info)89 int32_t LnnGetP2pRole(const NodeInfo *info)
90 {
91     return GetNetLedgerInterface()->LnnGetP2pRole(info);
92 }
93 
LnnGetP2pMac(const NodeInfo * info)94 const char *LnnGetP2pMac(const NodeInfo *info)
95 {
96     return GetNetLedgerInterface()->LnnGetP2pMac(info);
97 }
98 
LnnGetSupportedProtocols(const NodeInfo * info)99 uint64_t LnnGetSupportedProtocols(const NodeInfo *info)
100 {
101     return GetNetLedgerInterface()->LnnGetSupportedProtocols(info);
102 }
103 
LnnConvertDeviceTypeToId(const char * deviceType,uint16_t * typeId)104 int32_t LnnConvertDeviceTypeToId(const char *deviceType, uint16_t *typeId)
105 {
106     return GetNetLedgerInterface()->LnnConvertDeviceTypeToId(deviceType, typeId);
107 }
108 
LnnGetLocalNumInfo(InfoKey key,int32_t * info)109 int32_t LnnGetLocalNumInfo(InfoKey key, int32_t *info)
110 {
111     return GetNetLedgerInterface()->LnnGetLocalNumInfo(key, info);
112 }
113 }
114 }