• 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 "client_trans_proxy_manager_mock.h"
17 
18 using namespace testing;
19 using namespace testing::ext;
20 
21 namespace OHOS {
22 void *g_clientTransProxyManagerInterface;
ClientTransProxyManagerInterfaceMock()23 ClientTransProxyManagerInterfaceMock::ClientTransProxyManagerInterfaceMock()
24 {
25     g_clientTransProxyManagerInterface = reinterpret_cast<void *>(this);
26 }
27 
~ClientTransProxyManagerInterfaceMock()28 ClientTransProxyManagerInterfaceMock::~ClientTransProxyManagerInterfaceMock()
29 {
30     g_clientTransProxyManagerInterface = nullptr;
31 }
32 
GetClientTransProxyManagerInterface()33 static ClientTransProxyManagerInterface *GetClientTransProxyManagerInterface()
34 {
35     return reinterpret_cast<ClientTransProxyManagerInterface *>(g_clientTransProxyManagerInterface);
36 }
37 
38 extern "C" {
ClinetTransProxyFileManagerInit(void)39 int32_t ClinetTransProxyFileManagerInit(void)
40 {
41     return GetClientTransProxyManagerInterface()->ClinetTransProxyFileManagerInit();
42 }
43 
CreateSoftBusList(void)44 SoftBusList *CreateSoftBusList(void)
45 {
46     return GetClientTransProxyManagerInterface()->CreateSoftBusList();
47 }
48 
PendingInit(int32_t type)49 int32_t PendingInit(int32_t type)
50 {
51     return GetClientTransProxyManagerInterface()->PendingInit(type);
52 }
SoftBusHtoLl(uint32_t value)53 uint32_t SoftBusHtoLl(uint32_t value)
54 {
55     return GetClientTransProxyManagerInterface()->SoftBusHtoLl(value);
56 }
SoftBusHtoNl(uint32_t value)57 uint32_t SoftBusHtoNl(uint32_t value)
58 {
59     return GetClientTransProxyManagerInterface()->SoftBusHtoNl(value);
60 }
61 
SoftBusNtoHl(uint32_t value)62 uint32_t SoftBusNtoHl(uint32_t value)
63 {
64     return GetClientTransProxyManagerInterface()->SoftBusNtoHl(value);
65 }
66 
ClientGetSessionIdByChannelId(int32_t channelId,int32_t channelType,int32_t * sessionId,bool isClosing)67 int32_t ClientGetSessionIdByChannelId(int32_t channelId, int32_t channelType, int32_t *sessionId, bool isClosing)
68 {
69     return GetClientTransProxyManagerInterface()->ClientGetSessionIdByChannelId(
70         channelId, channelType, sessionId, isClosing);
71 }
72 
ClientGetSessionCallbackAdapterById(int32_t sessionId,SessionListenerAdapter * callbackAdapter,bool * isServer)73 int32_t ClientGetSessionCallbackAdapterById(int32_t sessionId, SessionListenerAdapter *callbackAdapter, bool *isServer)
74 {
75     return GetClientTransProxyManagerInterface()->ClientGetSessionCallbackAdapterById(
76         sessionId, callbackAdapter, isServer);
77 }
78 
DeleteDataSeqInfoList(uint32_t dataSeq,int32_t channelId)79 int32_t DeleteDataSeqInfoList(uint32_t dataSeq, int32_t channelId)
80 {
81     return GetClientTransProxyManagerInterface()->DeleteDataSeqInfoList(dataSeq, channelId);
82 }
83 
GetSupportTlvAndNeedAckById(int32_t channelId,int32_t channelType,bool * supportTlv,bool * needAck)84 int32_t GetSupportTlvAndNeedAckById(int32_t channelId, int32_t channelType, bool *supportTlv, bool *needAck)
85 {
86     return GetClientTransProxyManagerInterface()->GetSupportTlvAndNeedAckById(
87         channelId, channelType, supportTlv, needAck);
88 }
89 
ServerIpcSendMessage(int32_t channelId,int32_t channelType,const void * data,uint32_t len,int32_t msgType)90 int32_t ServerIpcSendMessage(int32_t channelId, int32_t channelType, const void *data, uint32_t len, int32_t msgType)
91 {
92     return GetClientTransProxyManagerInterface()->ServerIpcSendMessage(channelId, channelType, data, len, msgType);
93 }
94 
TransProxySessionDataLenCheck(uint32_t dataLen,SessionPktType type)95 int32_t TransProxySessionDataLenCheck(uint32_t dataLen, SessionPktType type)
96 {
97     return GetClientTransProxyManagerInterface()->TransProxySessionDataLenCheck(dataLen, type);
98 }
99 
TransProxyPackTlvBytes(ProxyDataInfo * dataInfo,const char * sessionKey,SessionPktType flag,int32_t seq,DataHeadTlvPacketHead * info)100 int32_t TransProxyPackTlvBytes(
101     ProxyDataInfo *dataInfo, const char *sessionKey, SessionPktType flag, int32_t seq, DataHeadTlvPacketHead *info)
102 {
103     return GetClientTransProxyManagerInterface()->TransProxyPackTlvBytes(dataInfo, sessionKey, flag, seq, info);
104 }
105 
TransProxyPackData(ProxyDataInfo * dataInfo,uint32_t sliceNum,SessionPktType pktType,uint32_t cnt,uint32_t * dataLen)106 uint8_t *TransProxyPackData(
107     ProxyDataInfo *dataInfo, uint32_t sliceNum, SessionPktType pktType, uint32_t cnt, uint32_t *dataLen)
108 {
109     return GetClientTransProxyManagerInterface()->TransProxyPackData(dataInfo, sliceNum, pktType, cnt, dataLen);
110 }
111 
ProcPendingPacket(int32_t channelId,int32_t seqNum,int32_t type)112 int32_t ProcPendingPacket(int32_t channelId, int32_t seqNum, int32_t type)
113 {
114     return GetClientTransProxyManagerInterface()->ProcPendingPacket(channelId, seqNum, type);
115 }
116 
AddPendingPacket(int32_t channelId,int32_t seqNum,int32_t type)117 int32_t AddPendingPacket(int32_t channelId, int32_t seqNum, int32_t type)
118 {
119     return GetClientTransProxyManagerInterface()->AddPendingPacket(channelId, seqNum, type);
120 }
121 
TransProxyDecryptPacketData(int32_t seq,ProxyDataInfo * dataInfo,const char * sessionKey)122 int32_t TransProxyDecryptPacketData(int32_t seq, ProxyDataInfo *dataInfo, const char *sessionKey)
123 {
124     return GetClientTransProxyManagerInterface()->TransProxyDecryptPacketData(seq, dataInfo, sessionKey);
125 }
126 
DataSeqInfoListAddItem(uint32_t dataSeq,int32_t channelId,int32_t socketId,int32_t channelType)127 int32_t DataSeqInfoListAddItem(uint32_t dataSeq, int32_t channelId, int32_t socketId, int32_t channelType)
128 {
129     return GetClientTransProxyManagerInterface()->DataSeqInfoListAddItem(dataSeq, channelId, socketId, channelType);
130 }
131 
ClientGetChannelBusinessTypeByChannelId(int32_t channelId,int32_t * businessType)132 int32_t ClientGetChannelBusinessTypeByChannelId(int32_t channelId, int32_t *businessType)
133 {
134     return GetClientTransProxyManagerInterface()->ClientGetChannelBusinessTypeByChannelId(channelId, businessType);
135 }
136 }
137 }
138