1 /*
2 * Copyright (c) 2024 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_tcp_direct_common_mock.h"
17
18 #include "auth_interface_struct.h"
19
20 using namespace testing;
21 using namespace testing::ext;
22
23 namespace OHOS {
24 void *g_transTcpDirectCommonInterface;
TransTcpDirectCommonInterfaceMock()25 TransTcpDirectCommonInterfaceMock::TransTcpDirectCommonInterfaceMock()
26 {
27 g_transTcpDirectCommonInterface = reinterpret_cast<void *>(this);
28 }
29
~TransTcpDirectCommonInterfaceMock()30 TransTcpDirectCommonInterfaceMock::~TransTcpDirectCommonInterfaceMock()
31 {
32 g_transTcpDirectCommonInterface = nullptr;
33 }
34
GetTransServerTcpDirectInterface()35 static TransTcpDirectCommonInterface *GetTransServerTcpDirectInterface()
36 {
37 return reinterpret_cast<TransTcpDirectCommonInterface *>(g_transTcpDirectCommonInterface);
38 }
39
40 extern "C" {
AuthMetaPostTransData(int64_t authId,const AuthTransData * dataInfo)41 int32_t AuthMetaPostTransData(int64_t authId, const AuthTransData *dataInfo)
42 {
43 return GetTransServerTcpDirectInterface()->AuthMetaPostTransData(authId, dataInfo);
44 }
AuthMetaGetServerSide(int64_t authId,bool * isServer)45 int32_t AuthMetaGetServerSide(int64_t authId, bool *isServer)
46 {
47 return GetTransServerTcpDirectInterface()->AuthMetaGetServerSide(authId, isServer);
48 }
49 }
50 }
51