• 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 "trans_client_proxy_file_manager_mock.h"
17 
18 using namespace testing;
19 using namespace testing::ext;
20 
21 namespace OHOS {
22 void *g_transClientProxyFileManagerInterface;
TransClientProxyFileManagerInterfaceMock()23 TransClientProxyFileManagerInterfaceMock::TransClientProxyFileManagerInterfaceMock()
24 {
25     g_transClientProxyFileManagerInterface = reinterpret_cast<void *>(this);
26 }
27 
~TransClientProxyFileManagerInterfaceMock()28 TransClientProxyFileManagerInterfaceMock::~TransClientProxyFileManagerInterfaceMock()
29 {
30     g_transClientProxyFileManagerInterface = nullptr;
31 }
32 
GetTransClientProxyFileManagerInterface()33 static TransClientProxyFileManagerInterface *GetTransClientProxyFileManagerInterface()
34 {
35     return reinterpret_cast<TransClientProxyFileManagerInterface *>(g_transClientProxyFileManagerInterface);
36 }
37 
38 extern "C" {
CreateSoftBusList(void)39 SoftBusList *CreateSoftBusList(void)
40 {
41     return GetTransClientProxyFileManagerInterface()->CreateSoftBusList();
42 }
43 
RegisterTimeoutCallback(int32_t timerFunId,TimerFunCallback callback)44 int32_t RegisterTimeoutCallback(int32_t timerFunId, TimerFunCallback callback)
45 {
46     return GetTransClientProxyFileManagerInterface()->RegisterTimeoutCallback(timerFunId, callback);
47 }
48 
UnRegisterTimeoutCallback(int32_t timerFunId)49 int32_t UnRegisterTimeoutCallback(int32_t timerFunId)
50 {
51     return GetTransClientProxyFileManagerInterface()->UnRegisterTimeoutCallback(timerFunId);
52 }
53 
InitPendingPacket(void)54 int32_t InitPendingPacket(void)
55 {
56     return GetTransClientProxyFileManagerInterface()->InitPendingPacket();
57 }
58 
PendingInit(int32_t type)59 int32_t PendingInit(int32_t type)
60 {
61     return GetTransClientProxyFileManagerInterface()->PendingInit(type);
62 }
63 
TransProxyDecryptPacketData(int32_t seq,ProxyDataInfo * dataInfo,const char * sessionKey)64 int32_t TransProxyDecryptPacketData(int32_t seq, ProxyDataInfo *dataInfo, const char *sessionKey)
65 {
66     return GetTransClientProxyFileManagerInterface()->TransProxyDecryptPacketData(seq, dataInfo, sessionKey);
67 }
68 
GetSupportTlvAndNeedAckById(int32_t channelId,int32_t channelType,bool * supportTlv,bool * needAck)69 int32_t GetSupportTlvAndNeedAckById(int32_t channelId, int32_t channelType, bool *supportTlv, bool *needAck)
70 {
71     return GetTransClientProxyFileManagerInterface()->GetSupportTlvAndNeedAckById(
72         channelId, channelType, supportTlv, needAck);
73 }
74 
TransProxyPackTlvBytes(ProxyDataInfo * dataInfo,const char * sessionKey,SessionPktType flag,int32_t seq,DataHeadTlvPacketHead * info)75 int32_t TransProxyPackTlvBytes(
76     ProxyDataInfo *dataInfo, const char *sessionKey, SessionPktType flag, int32_t seq, DataHeadTlvPacketHead *info)
77 {
78     return GetTransClientProxyFileManagerInterface()->TransProxyPackTlvBytes(
79         dataInfo, sessionKey, flag, seq, info);
80 }
81 
TransProxyPackBytes(int32_t channelId,ProxyDataInfo * dataInfo,const char * sessionKey,SessionPktType flag,int32_t seq)82 int32_t TransProxyPackBytes(
83     int32_t channelId, ProxyDataInfo *dataInfo, const char *sessionKey, SessionPktType flag, int32_t seq)
84 {
85     return GetTransClientProxyFileManagerInterface()->TransProxyPackBytes(channelId, dataInfo, sessionKey, flag, seq);
86 }
87 
FileUnLock(int32_t fd)88 int32_t FileUnLock(int32_t fd)
89 {
90     return GetTransClientProxyFileManagerInterface()->FileUnLock(fd);
91 }
92 
SendFileTransResult(int32_t channelId,uint32_t seq,int32_t result,uint32_t side)93 int32_t SendFileTransResult(int32_t channelId, uint32_t seq, int32_t result, uint32_t side)
94 {
95     return GetTransClientProxyFileManagerInterface()->SendFileTransResult(channelId, seq, result, side);
96 }
97 
ServerIpcSendMessage(int32_t channelId,int32_t channelType,const void * data,uint32_t len,int32_t msgType)98 int32_t ServerIpcSendMessage(int32_t channelId, int32_t channelType, const void *data, uint32_t len, int32_t msgType)
99 {
100     return GetTransClientProxyFileManagerInterface()->ServerIpcSendMessage(channelId, channelType, data, len, msgType);
101 }
102 
CreatePendingPacket(uint32_t id,uint64_t seq)103 int32_t CreatePendingPacket(uint32_t id, uint64_t seq)
104 {
105     return GetTransClientProxyFileManagerInterface()->CreatePendingPacket(id, seq);
106 }
107 
ProxyChannelSendFileStream(int32_t channelId,const char * data,uint32_t len,int32_t type)108 int32_t ProxyChannelSendFileStream(int32_t channelId, const char *data, uint32_t len, int32_t type)
109 {
110     return GetTransClientProxyFileManagerInterface()->ProxyChannelSendFileStream(channelId, data, len, type);
111 }
112 
GetPendingPacketData(uint32_t id,uint64_t seq,uint32_t waitMillis,bool isDelete,TransPendData * data)113 int32_t GetPendingPacketData(uint32_t id, uint64_t seq, uint32_t waitMillis, bool isDelete, TransPendData *data)
114 {
115     return GetTransClientProxyFileManagerInterface()->GetPendingPacketData(id, seq, waitMillis, isDelete, data);
116 }
117 
SoftBusPwriteFile(int32_t fd,const void * buf,uint64_t writeBytes,uint64_t offset)118 int64_t SoftBusPwriteFile(int32_t fd, const void *buf, uint64_t writeBytes, uint64_t offset)
119 {
120     return GetTransClientProxyFileManagerInterface()->SoftBusPwriteFile(fd, buf, writeBytes, offset);
121 }
122 
SendFileAckReqAndResData(int32_t channelId,uint32_t startSeq,uint32_t value,int32_t type)123 int32_t SendFileAckReqAndResData(int32_t channelId, uint32_t startSeq, uint32_t value, int32_t type)
124 {
125     return GetTransClientProxyFileManagerInterface()->SendFileAckReqAndResData(
126         channelId, startSeq, value, type);
127 }
128 
DeletePendingPacket(uint32_t id,uint64_t seq)129 void DeletePendingPacket(uint32_t id, uint64_t seq)
130 {
131     return GetTransClientProxyFileManagerInterface()->DeletePendingPacket(id, seq);
132 }
133 
AckResponseDataHandle(const SendListenerInfo * info,const char * data,uint32_t len)134 int32_t AckResponseDataHandle(const SendListenerInfo *info, const char *data, uint32_t len)
135 {
136     return GetTransClientProxyFileManagerInterface()->AckResponseDataHandle(info, data, len);
137 }
138 
ClientGetChannelBusinessTypeByChannelId(int32_t channelId,int32_t * businessType)139 int32_t ClientGetChannelBusinessTypeByChannelId(int32_t channelId, int32_t *businessType)
140 {
141     return GetTransClientProxyFileManagerInterface()->ClientGetChannelBusinessTypeByChannelId(channelId, businessType);
142 }
143 }
144 }
145