Description:Meta node requirement development

Feature or Bugfix:Feature
Binary Source:No

Signed-off-by: sun-jiashun-123 <sunjiashun@huawei.com>
This commit is contained in:
sun-jiashun-123 2023-11-03 18:35:26 +08:00
parent 8ff1ebb740
commit 7dedf84e38
47 changed files with 435 additions and 156 deletions

View File

@ -147,3 +147,25 @@ if (btn_enhanced) {
bus_center_server_src += btn_src
bus_center_server_inc += btn_inc
}
meta_node_dir = "dsoftbus_enhance/core/bus_center/lnn/meta_node"
meta_node_enhanced = exec_script("$dsoftbus_root_path/check_sub_module.py",
[
"$native_source_path",
"$meta_node_dir",
],
"value")
if (meta_node_enhanced) {
import(
"//foundation/communication/dsoftbus/core/bus_center/lnn/meta_node/meta_node.gni")
bus_center_server_src += bus_center_meta_node_src
bus_center_server_inc += bus_center_meta_node_inc
} else {
import(
"//foundation/communication/dsoftbus/core/bus_center/lnn/meta_node/meta_node.gni")
bus_center_server_src += bus_center_meta_node_src
bus_center_server_inc += bus_center_meta_node_inc
}

View File

@ -48,7 +48,7 @@ int32_t LnnIpcDeactiveMetaNode(const char *metaNodeId);
int32_t LnnIpcGetAllMetaNodeInfo(MetaNodeInfo *infos, int32_t *infoNum);
int32_t LnnIpcNotifyJoinResult(void *addr, uint32_t addrTypeLen, const char *networkId, int32_t retCode);
int32_t MetaNodeIpcNotifyJoinResult(void *addr, uint32_t addrTypeLen, const char *networkId, int32_t retCode);
int32_t MetaNodeIpcNotifyJoinResult(void *addr, uint32_t addrTypeLen, MetaBasicInfo *metaInfo, int32_t retCode);
int32_t LnnIpcNotifyLeaveResult(const char *networkId, int32_t retCode);
int32_t MetaNodeIpcNotifyLeaveResult(const char *networkId, int32_t retCode);
int32_t LnnIpcNotifyOnlineState(bool isOnline, void *info, uint32_t infoTypeLen);

View File

@ -157,11 +157,11 @@ int32_t LnnIpcNotifyJoinResult(void *addr, uint32_t addrTypeLen, const char *net
return LnnOnJoinResult(addr, networkId, retCode);
}
int32_t MetaNodeIpcNotifyJoinResult(void *addr, uint32_t addrTypeLen, const char *networkId, int32_t retCode)
int32_t MetaNodeIpcNotifyJoinResult(void *addr, uint32_t addrTypeLen, MetaBasicInfo *metaInfo, int32_t retCode)
{
(void)addr;
(void)addrTypeLen;
(void)networkId;
(void)metaInfo;
(void)retCode;
return SOFTBUS_OK;
}

View File

@ -18,6 +18,7 @@
#include <stdbool.h>
#include <stdint.h>
#include "softbus_bus_center.h"
#ifdef __cplusplus
#if __cplusplus
@ -28,7 +29,7 @@ extern "C" {
int32_t ClientOnJoinLNNResult(const char *pkgName, void *addr, uint32_t addrTypeLen,
const char *networkId, int32_t retCode);
int32_t ClientOnJoinMetaNodeResult(const char *pkgName, void *addr, uint32_t addrTypeLen,
const char *networkId, int32_t retCode);
MetaBasicInfo *metaInfo, int32_t retCode);
int32_t ClientOnLeaveLNNResult(const char *pkgName, const char *networkId, int32_t retCode);
int32_t ClientOnLeaveMetaNodeResult(const char *pkgName, const char *networkId, int32_t retCode);
int32_t ClinetOnNodeOnlineStateChanged(bool isOnline, void *info, uint32_t infoTypeLen);

View File

@ -99,12 +99,12 @@ int32_t ClientOnJoinLNNResult(const char *pkgName, void *addr, uint32_t addrType
}
int32_t ClientOnJoinMetaNodeResult(const char *pkgName, void *addr, uint32_t addrTypeLen,
const char *networkId, int32_t retCode)
MetaBasicInfo *metaInfo, int32_t retCode)
{
(void)pkgName;
(void)addr;
(void)addrTypeLen;
(void)networkId;
(void)metaInfo;
(void)retCode;
return SOFTBUS_OK;
}

View File

@ -378,11 +378,11 @@ int32_t LnnIpcNotifyJoinResult(void *addr, uint32_t addrTypeLen, const char *net
return SOFTBUS_OK;
}
int32_t MetaNodeIpcNotifyJoinResult(void *addr, uint32_t addrTypeLen, const char *networkId, int32_t retCode)
int32_t MetaNodeIpcNotifyJoinResult(void *addr, uint32_t addrTypeLen, MetaBasicInfo *metaInfo, int32_t retCode)
{
(void)addr;
(void)addrTypeLen;
(void)networkId;
(void)metaInfo;
(void)retCode;
return SOFTBUS_OK;
}

View File

@ -17,6 +17,7 @@
#define BUS_CENTER_CLIENT_PROXY_H
#include <stdint.h>
#include "softbus_bus_center.h"
#ifdef __cplusplus
#if __cplusplus
@ -34,7 +35,7 @@ typedef struct {
int32_t ClientOnJoinLNNResult(PkgNameAndPidInfo *info, void *addr, uint32_t addrTypeLen,
const char *networkId, int32_t retCode);
int32_t ClientOnJoinMetaNodeResult(PkgNameAndPidInfo *info, void *addr, uint32_t addrTypeLen,
const char *networkId, int32_t retCode);
MetaBasicInfo *metaInfo, int32_t retCode);
int32_t ClientOnLeaveLNNResult(const char *pkgName, int32_t pid, const char *networkId, int32_t retCode);
int32_t ClientOnLeaveMetaNodeResult(const char *pkgName, int32_t pid, const char *networkId, int32_t retCode);
int32_t ClinetOnNodeOnlineStateChanged(bool isOnline, void *info, uint32_t infoTypeLen);

View File

@ -40,7 +40,8 @@ public:
const QosTv *tvList) override;
int32_t OnJoinLNNResult(void *addr, uint32_t addrTypeLen, const char *networkId, int retCode) override;
int32_t OnJoinMetaNodeResult(void *addr, uint32_t addrTypeLen, const char *networkId, int retCode) override;
int32_t OnJoinMetaNodeResult(void *addr, uint32_t addrTypeLen, void *metaInfo, uint32_t infoLen,
int retCode) override;
int32_t OnLeaveLNNResult(const char *networkId, int retCode) override;
int32_t OnLeaveMetaNodeResult(const char *networkId, int retCode) override;
int32_t OnNodeOnlineStateChanged(const char *pkgName, bool isOnline, void *info, uint32_t infoTypeLen) override;

View File

@ -17,6 +17,7 @@
#include "bus_center_client_proxy_standard.h"
#include "softbus_client_info_manager.h"
#include "softbus_bus_center.h"
#include "softbus_def.h"
#include "softbus_errcode.h"
#include "softbus_log.h"
@ -47,7 +48,7 @@ int32_t ClientOnJoinLNNResult(PkgNameAndPidInfo *info, void *addr, uint32_t addr
}
int32_t ClientOnJoinMetaNodeResult(PkgNameAndPidInfo *info, void *addr, uint32_t addrTypeLen,
const char *networkId, int32_t retCode)
MetaBasicInfo *metaInfo, int32_t retCode)
{
if (info == nullptr) {
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, "pkgName is null");
@ -58,7 +59,7 @@ int32_t ClientOnJoinMetaNodeResult(PkgNameAndPidInfo *info, void *addr, uint32_t
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, "bus center client proxy is nullptr!\n");
return SOFTBUS_ERR;
}
return clientProxy->OnJoinMetaNodeResult(addr, addrTypeLen, networkId, retCode);
return clientProxy->OnJoinMetaNodeResult(addr, addrTypeLen, metaInfo, sizeof(MetaBasicInfo), retCode);
}
int32_t ClientOnLeaveLNNResult(

View File

@ -114,38 +114,46 @@ int32_t BusCenterClientProxy::OnJoinLNNResult(void *addr, uint32_t addrTypeLen,
return SOFTBUS_OK;
}
int32_t BusCenterClientProxy::OnJoinMetaNodeResult(void *addr, uint32_t addrTypeLen, const char *networkId, int retCode)
int32_t BusCenterClientProxy::OnJoinMetaNodeResult(void *addr, uint32_t addrTypeLen, void *metaInfo,
uint32_t infoLen, int retCode)
{
sptr<IRemoteObject> remote = Remote();
if (remote == nullptr) {
if (remote == nullptr || metaInfo == nullptr) {
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, "remote is nullptr");
return SOFTBUS_ERR;
}
if ((retCode == 0 && networkId == nullptr) || addr == nullptr) {
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, "invalid parameters");
return SOFTBUS_ERR;
}
MessageParcel data;
if (!data.WriteInterfaceToken(GetDescriptor())) {
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, "write InterfaceToken failed!");
return SOFTBUS_ERR;
}
if (!data.WriteUint32(addrTypeLen)) {
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, "write addr type length failed");
if (addr != nullptr) {
if (!data.WriteUint32(addrTypeLen)) {
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, "write addr type length failed");
return SOFTBUS_ERR;
}
if (!data.WriteRawData(addr, addrTypeLen)) {
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, "write addr failed");
return SOFTBUS_ERR;
}
} else {
if (!data.WriteUint32(0)) {
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, "write addr type length failed");
return SOFTBUS_ERR;
}
}
if (!data.WriteUint32(infoLen)) {
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, "write infoLen failed");
return SOFTBUS_ERR;
}
if (!data.WriteRawData(addr, addrTypeLen)) {
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, "write addr failed");
if (!data.WriteRawData(metaInfo, infoLen)) {
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, "write metaInfo failed");
return SOFTBUS_ERR;
}
if (!data.WriteInt32(retCode)) {
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, "write retCode failed");
return SOFTBUS_ERR;
}
if (retCode == 0 && !data.WriteCString(networkId)) {
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, "write networkId failed");
return SOFTBUS_ERR;
}
MessageParcel reply;
MessageOption option = { MessageOption::TF_ASYNC };
if (remote->SendRequest(CLIENT_ON_JOIN_METANODE_RESULT, data, reply, option) != 0) {

View File

@ -27,6 +27,7 @@
#include "lnn_heartbeat_ctrl.h"
#include "lnn_meta_node_ledger.h"
#include "lnn_time_sync_manager.h"
#include "lnn_meta_node_interface.h"
#include "softbus_def.h"
#include "softbus_errcode.h"
#include "softbus_log.h"
@ -121,7 +122,9 @@ static int32_t AddJoinMetaNodeInfo(const char *pkgName, int32_t callingPid, cons
return SOFTBUS_MEM_ERR;
}
info->pid = callingPid;
info->addr = *addr;
if (addr != NULL) {
info->addr = *addr;
}
g_joinMetaNodeRequestInfo.push_back(info);
return SOFTBUS_OK;
}
@ -246,20 +249,27 @@ int32_t MetaNodeIpcServerJoin(const char *pkgName, int32_t callingPid, void *add
CustomData *customData, uint32_t addrTypeLen)
{
ConnectionAddr *connAddr = reinterpret_cast<ConnectionAddr *>(addr);
int32_t ret;
(void)addrTypeLen;
if (pkgName == nullptr || connAddr == nullptr) {
if (pkgName == nullptr) {
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, "parameters are nullptr!\n");
return SOFTBUS_INVALID_PARAM;
}
std::lock_guard<std::mutex> autoLock(g_lock);
if (IsRepeatJoinMetaNodeRequest(pkgName, callingPid, connAddr)) {
if (connAddr != nullptr && IsRepeatJoinMetaNodeRequest(pkgName, callingPid, connAddr)) {
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, "repeat meta join lnn request from: %s", pkgName);
return SOFTBUS_ALREADY_EXISTED;
}
int32_t ret = MetaNodeServerJoin(pkgName, callingPid, connAddr, customData);
if (ret == SOFTBUS_OK) {
ret = AddJoinMetaNodeInfo(pkgName, callingPid, connAddr);
if (customData->type <= PROXY_HEARTBEAT) {
ret = MetaNodeServerJoin(pkgName, callingPid, connAddr, customData);
if (ret == SOFTBUS_OK) {
ret = AddJoinMetaNodeInfo(pkgName, callingPid, connAddr);
}
} else {
ret = MetaNodeServerJoinExt(customData);
if (ret == SOFTBUS_OK) {
ret = AddJoinMetaNodeInfo(pkgName, callingPid, NULL);
}
}
return ret;
}
@ -288,12 +298,18 @@ int32_t MetaNodeIpcServerLeave(const char *pkgName, int32_t callingPid, const ch
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, "parameters are nullptr!\n");
return SOFTBUS_INVALID_PARAM;
}
int32_t ret;
std::lock_guard<std::mutex> autoLock(g_lock);
if (IsRepeatLeaveMetaNodeRequest(pkgName, callingPid, networkId)) {
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, "repeat leave lnn request from: %s", pkgName);
return SOFTBUS_ALREADY_EXISTED;
}
int32_t ret = MetaNodeServerLeave(networkId);
MetaNodeType type = FindMetaNodeType(networkId);
if (type != CUSTOM_UNKNOWN && type > PROXY_HEARTBEAT) {
ret = MetaNodeServerLeaveExt(networkId, type);
} else {
ret = MetaNodeServerLeave(networkId);
}
if (ret == SOFTBUS_OK) {
ret = AddLeaveMetaNodeInfo(pkgName, callingPid, networkId);
}
@ -469,17 +485,14 @@ int32_t LnnIpcNotifyJoinResult(void *addr, uint32_t addrTypeLen, const char *net
return SOFTBUS_OK;
}
int32_t MetaNodeIpcNotifyJoinResult(void *addr, uint32_t addrTypeLen, const char *networkId,
int32_t MetaNodeIpcNotifyJoinResult(void *addr, uint32_t addrTypeLen, MetaBasicInfo *metaInfo,
int32_t retCode)
{
if (addr == nullptr) {
return SOFTBUS_INVALID_PARAM;
}
ConnectionAddr *connAddr = reinterpret_cast<ConnectionAddr *>(addr);
std::lock_guard<std::mutex> autoLock(g_lock);
std::vector<JoinLnnRequestInfo *>::iterator iter;
for (iter = g_joinMetaNodeRequestInfo.begin(); iter != g_joinMetaNodeRequestInfo.end();) {
if (!LnnIsSameConnectionAddr(connAddr, &(*iter)->addr, false)) {
if ((connAddr != NULL) && !LnnIsSameConnectionAddr(connAddr, &(*iter)->addr, false)) {
++iter;
continue;
}
@ -489,7 +502,7 @@ int32_t MetaNodeIpcNotifyJoinResult(void *addr, uint32_t addrTypeLen, const char
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, "strcpy_s fail");
continue;
}
ClientOnJoinMetaNodeResult(&info, addr, addrTypeLen, networkId, retCode);
ClientOnJoinMetaNodeResult(&info, addr, addrTypeLen, metaInfo, retCode);
delete *iter;
iter = g_joinMetaNodeRequestInfo.erase(iter);
}

View File

@ -0,0 +1,39 @@
/*
* Copyright (C) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/license/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANT KIND, either express or implied.
* See the License for the specific language governing permission and
* limitations under the License.
*/
#ifndef OHOS_LNN_META_NODE_INTERFACE_H
#define OHOS_LNN_META_NODE_INTERFACE_H
#include <stdint.h>
#include "softbus_bus_center.h"
#ifdef __cplusplus
extern "C" {
#endif
int32_t LnnLoadMetaNode(const int32_t tType);
int32_t LnnUnLoadMetaNode(const int32_t tType);
int32_t MetaNodeServerLeaveExt(const char *metaNodeId, MetaNodeType tType);
int32_t MetaNodeServerJoinExt(CustomData *customData);
int32_t LnnInitMetaNode(void);
void LnnDeinitMetaNode(void);
MetaNodeType FindMetaNodeType(const char *metaNodeId);
int32_t LnnInitMetaNodeExtLedger(void);
void LnnDeinitMetaNodeExtLedger(void);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,21 @@
# Copyright (c) 2023 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//foundation/communication/dsoftbus/dsoftbus.gni")
bus_center_meta_node_inc =
[ "$dsoftbus_root_path/core/bus_center/lnn/meta_node/include" ]
bus_center_meta_node_src = [ "$dsoftbus_root_path/core/bus_center/lnn/meta_node/src/lnn_meta_node_virtual.c" ]
bus_center_meta_node_deps = []

View File

@ -0,0 +1,70 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* License under the Apache License, Version 2.0 (the "License");
* you may not use this file expect in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permission and
* limitations under the License.
*/
#include "lnn_meta_node_interface.h"
#include "softbus_common.h"
#include "softbus_errcode.h"
int32_t LnnLoadMetaNode(const int32_t tType)
{
(void)tType;
return SOFTBUS_OK;
}
int32_t LnnUnLoadMetaNode(const int32_t tType)
{
(void)tType;
return SOFTBUS_OK;
}
int32_t MetaNodeServerLeaveExt(const char *metaNodeId, MetaNodeType tType)
{
(void)metaNodeId;
(void)tType;
return SOFTBUS_NOT_IMPLEMENT;
}
int32_t MetaNodeServerJoinExt(CustomData *customData)
{
(void)customData;
return SOFTBUS_NOT_IMPLEMENT;
}
int32_t LnnInitMetaNode(void)
{
return SOFTBUS_OK;
}
void LnnDeinitMetaNode(void)
{
return;
}
MetaNodeType FindMetaNodeType(const char *metaNodeId)
{
(void)metaNodeId;
return CUSTOM_UNKNOWN;
}
int32_t LnnInitMetaNodeExtLedger(void)
{
return SOFTBUS_OK;
}
void LnnDeinitMetaNodeExtLedger(void)
{
return;
}

View File

@ -558,7 +558,9 @@ static int32_t PostJoinRequestToMetaNode(MetaJoinRequestNode *metaJoinNode, cons
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, "PostJoin Request To MetaNode failed");
rc = SOFTBUS_ERR;
if (needReportFailure) {
MetaNodeNotifyJoinResult((ConnectionAddr *)addr, NULL, SOFTBUS_ERR);
MetaBasicInfo metaInfo;
(void)memset_s(&metaInfo, sizeof(MetaBasicInfo), 0, sizeof(MetaBasicInfo));
MetaNodeNotifyJoinResult((ConnectionAddr *)addr, &metaInfo, SOFTBUS_ERR);
}
}
return rc;
@ -1067,8 +1069,9 @@ static int32_t ProcessLeaveMetaNodeRequest(const void *para)
LeaveMetaInfoToLedger(item, networkId);
ListDelete(&item->node);
SoftBusFree(item);
rc = SOFTBUS_OK;
}
MetaNodeNotifyLeaveResult(networkId, SOFTBUS_OK);
MetaNodeNotifyLeaveResult(networkId, rc);
SoftBusFree((void *)networkId);
return rc;
}
@ -1508,11 +1511,17 @@ static int32_t ProcessOnAuthMetaVerifyPassed(const void *para)
ret = LnnAddMetaInfo(newInfo);
SoftBusFree(newInfo);
} while (0);
MetaBasicInfo metaInfo;
(void)memset_s(&metaInfo, sizeof(MetaBasicInfo), 0, sizeof(MetaBasicInfo));
if (ret == SOFTBUS_OK) {
MetaNodeNotifyJoinResult(&metaNode->addr, info->networkId, SOFTBUS_OK);
if (strncpy_s(metaInfo.metaNodeId, NETWORK_ID_BUF_LEN, info->networkId, NETWORK_ID_BUF_LEN) != SOFTBUS_OK) {
LLOGE("copy meta node id fail");
return SOFTBUS_ERR;
}
MetaNodeNotifyJoinResult(&metaNode->addr, &metaInfo, SOFTBUS_OK);
} else {
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, "ProcessOnAuthMetaVerifyPassed error");
MetaNodeNotifyJoinResult(&metaNode->addr, NULL, SOFTBUS_ERR);
MetaNodeNotifyJoinResult(&metaNode->addr, &metaInfo, SOFTBUS_ERR);
ListDelete(&metaNode->node);
SoftBusFree(metaNode);
}
@ -1528,7 +1537,9 @@ static int32_t ProcessOnAuthMetaVerifyFailed(const void *para)
}
MetaReason *mataReason = (MetaReason *)para;
MetaJoinRequestNode *metaNode = mataReason->metaJoinNode;
MetaNodeNotifyJoinResult(&metaNode->addr, NULL, mataReason->reason);
MetaBasicInfo metaInfo;
(void)memset_s(&metaInfo, sizeof(MetaBasicInfo), 0, sizeof(MetaBasicInfo));
MetaNodeNotifyJoinResult(&metaNode->addr, &metaInfo, mataReason->reason);
ListDelete(&metaNode->node);
SoftBusFree(metaNode);
SoftBusFree(mataReason);

View File

@ -26,6 +26,7 @@
#include "lnn_huks_utils.h"
#include "lnn_local_net_ledger.h"
#include "lnn_meta_node_ledger.h"
#include "lnn_meta_node_interface.h"
#include "lnn_device_info_recovery.h"
#include "softbus_adapter_mem.h"
#include "softbus_def.h"
@ -51,6 +52,10 @@ int32_t LnnInitNetLedger(void)
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, "init huks interface fail!");
return SOFTBUS_ERR;
}
if (LnnInitMetaNodeExtLedger() != SOFTBUS_OK) {
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, "init meta node ext ledger fail!");
return SOFTBUS_ERR;
}
return SOFTBUS_OK;
}
@ -112,6 +117,7 @@ void LnnDeinitNetLedger(void)
LnnDeinitDistributedLedger();
LnnDeinitLocalLedger();
LnnDeinitHuksInterface();
LnnDeinitMetaNodeExtLedger();
}
static int32_t LnnGetNodeKeyInfoLocal(const char *networkId, int key, uint8_t *info, uint32_t infoLen)

View File

@ -215,7 +215,7 @@ void LnnUnregisterEventHandler(LnnEventType event, LnnEventHandler handler);
void LnnNotifyJoinResult(ConnectionAddr *addr,
const char *networkId, int32_t retCode);
void MetaNodeNotifyJoinResult(ConnectionAddr *addr,
const char *networkId, int32_t retCode);
MetaBasicInfo *metaInfo, int32_t retCode);
void LnnNotifyLeaveResult(const char *networkId, int32_t retCode);
void MetaNodeNotifyLeaveResult(const char *networkId, int32_t retCode);

View File

@ -320,14 +320,10 @@ void LnnNotifyJoinResult(ConnectionAddr *addr, const char *networkId, int32_t re
LnnIpcNotifyJoinResult(addr, sizeof(ConnectionAddr), networkId, retCode);
}
void MetaNodeNotifyJoinResult(ConnectionAddr *addr, const char *networkId, int32_t retCode)
void MetaNodeNotifyJoinResult(ConnectionAddr *addr, MetaBasicInfo *metaInfo, int32_t retCode)
{
if (addr == NULL) {
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, "para : addr or networkId = null!");
return;
}
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_INFO, "notify join MetaNode result :%d", retCode);
MetaNodeIpcNotifyJoinResult(addr, sizeof(ConnectionAddr), networkId, retCode);
MetaNodeIpcNotifyJoinResult(addr, sizeof(ConnectionAddr), metaInfo, retCode);
}
void LnnNotifyLeaveResult(const char *networkId, int32_t retCode)

View File

@ -28,6 +28,7 @@
#include "lnn_net_builder.h"
#include "lnn_net_ledger.h"
#include "lnn_decision_center.h"
#include "lnn_meta_node_interface.h"
#include "softbus_adapter_xcollie.h"
#include "softbus_def.h"
#include "softbus_errcode.h"
@ -190,6 +191,10 @@ int32_t BusCenterServerInit(void)
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, "init net builder fail!");
return SOFTBUS_ERR;
}
if (LnnInitMetaNode() != SOFTBUS_OK) {
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, "init meta node fail!");
return SOFTBUS_ERR;
}
SoftBusRunPeriodicalTask(WATCHDOG_TASK_NAME, WatchdogProcess, WATCHDOG_INTERVAL_TIME, WATCHDOG_DELAY_TIME);
if (LnnInitLaneHub() != SOFTBUS_OK) {
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, "init lane hub fail!");
@ -228,5 +233,6 @@ void BusCenterServerDeinit(void)
LnnDeinitDecisionCenter();
DeinitDecisionCenter();
LnnDeinitNetLedger();
LnnDeinitMetaNode();
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_INFO, "bus center server deinit");
}

View File

@ -725,20 +725,23 @@ int32_t SoftBusServerStub::JoinLNNInner(MessageParcel &data, MessageParcel &repl
int32_t SoftBusServerStub::JoinMetaNodeInner(MessageParcel &data, MessageParcel &reply)
{
const char *clientName = data.ReadCString();
void *addr = nullptr;
if (clientName == nullptr) {
SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "SoftbusJoinMetaNodeInner read clientName failed!");
return SOFTBUS_IPC_ERR;
}
uint32_t addrTypeLen;
if (!data.ReadUint32(addrTypeLen) || addrTypeLen != sizeof(ConnectionAddr)) {
if (!data.ReadUint32(addrTypeLen) || (addrTypeLen != 0 && addrTypeLen != sizeof(ConnectionAddr))) {
SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR,
"SoftbusJoinMetaNodeInner read addr type length:%d failed!", addrTypeLen);
return SOFTBUS_IPC_ERR;
}
void *addr = (void *)data.ReadRawData(addrTypeLen);
if (addr == nullptr) {
SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "SoftbusJoinMetaNodeInner read addr failed!");
return SOFTBUS_IPC_ERR;
if (addrTypeLen != 0) {
addr = (void *)data.ReadRawData(addrTypeLen);
if (addr == nullptr) {
SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "SoftbusJoinMetaNodeInner read addr failed!");
return SOFTBUS_IPC_ERR;
}
}
CustomData *customData = nullptr;
customData = (CustomData *)data.ReadRawData(sizeof(CustomData));

View File

@ -40,7 +40,8 @@ public:
const QosTv *tvList) override;
int32_t OnJoinLNNResult(void *addr, uint32_t addrTypeLen, const char *networkId, int retCode) override;
int32_t OnJoinMetaNodeResult(void *addr, uint32_t addrTypeLen, const char *networkId, int retCode) override;
int32_t OnJoinMetaNodeResult(void *addr, uint32_t addrTypeLen, void *metaInfo, uint32_t infoLen,
int retCode) override;
int32_t OnLeaveLNNResult(const char *networkId, int retCode) override;
int32_t OnLeaveMetaNodeResult(const char *networkId, int retCode) override;
int32_t OnNodeOnlineStateChanged(const char *pkgName, bool isOnline, void *info, uint32_t infoTypeLen) override;

View File

@ -396,11 +396,13 @@ int32_t TransClientProxy::OnJoinLNNResult(void *addr, uint32_t addrTypeLen, cons
return SOFTBUS_OK;
}
int32_t TransClientProxy::OnJoinMetaNodeResult(void *addr, uint32_t addrTypeLen, const char *networkId, int retCode)
int32_t TransClientProxy::OnJoinMetaNodeResult(void *addr, uint32_t addrTypeLen, void *metaInfo,
uint32_t infoLen, int retCode)
{
(void)addr;
(void)addrTypeLen;
(void)networkId;
(void)metaInfo;
(void)infoLen;
(void)retCode;
return SOFTBUS_OK;
}

View File

@ -250,6 +250,12 @@ typedef struct {
uint16_t deviceTypeId; /**< Device type id */
} NodeBasicInfo;
typedef struct {
MetaNodeType type;
char metaNodeId[NETWORK_ID_BUF_LEN];
uint8_t data[USER_DATA_MAX_LEN];
} MetaBasicInfo;
/**
* @brief Enumerates device information change types. For details, see {@link INodeStateCb.onNodeBasicInfoChanged}.
*
@ -512,18 +518,6 @@ typedef struct {
bool wakeupFlag; /**< Heartbeat wakeup peer device or not */
} GearMode;
/**
* @brief Enumerates secret key types.
*
* @since 1.0
* @version 1.0
*/
typedef enum {
PROXY_TRANSMISION = 0, /**< Proxy Transmision */
PROXY_HEARTBEAT = 1, /**< Proxy Heartbeat */
CUSTOM_UNKNOWN, /**< Proxy Unknown */
} CustomType;
/**
* @brief Defines parameter, see {@link CustomData}.
*
@ -531,7 +525,7 @@ typedef enum {
* @version 1.0
*/
typedef struct {
CustomType type; /**< User type */
MetaNodeType type; /**< User type */
uint8_t data[USER_DATA_MAX_LEN]; /**< User data */
} CustomData;
@ -561,7 +555,7 @@ typedef void (*OnJoinLNNResult)(ConnectionAddr *addr, const char *networkId, int
* @since 1.0
* @version 1.0
*/
typedef void (*OnJoinMetaNodeResult)(ConnectionAddr *addr, const char *networkId, int32_t retCode);
typedef void (*OnJoinMetaNodeResult)(ConnectionAddr *addr, MetaBasicInfo *metaInfo, int32_t retCode);
/**
* @brief Called when a device is removed from a LNN via {@link LeaveLNN}.

View File

@ -222,6 +222,21 @@ typedef enum {
BLE_PROTOCOL_MAX
} BleProtocolType;
/**
* @brief Enumerates secret key types.
*
* @since 1.0
* @verison 1.0
*/
typedef enum {
PROXY_TRANSMISION = 0, /**< Proxy Transmision */
PROXY_HEARTBEAT = 1, /**< Proxy Heartbeat */
PROXY_HICAR,
PROXY_WEAR,
PROXY_SHARE,
CUSTOM_UNKNOWN, /**< Proxy Unknown*/
} MetaNodeType;
/**
* @brief Defines the address of a device that is added to a LNN.
* For details, see {@link ConnectionAddr}.

View File

@ -178,7 +178,7 @@ int32_t BusCenterServerProxy::JoinLNN(const char *pkgName, void *addr, uint32_t
int32_t BusCenterServerProxy::JoinMetaNode(const char *pkgName, void *addr, CustomData *customData, uint32_t addrTypeLen)
{
if (pkgName == nullptr || addr == nullptr) {
if (pkgName == nullptr) {
return SOFTBUS_INVALID_PARAM;
}
sptr<IRemoteObject> remote = GetSystemAbility();
@ -196,13 +196,20 @@ int32_t BusCenterServerProxy::JoinMetaNode(const char *pkgName, void *addr, Cust
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, "JoinMetaNode write client name failed!");
return SOFTBUS_IPC_ERR;
}
if (!data.WriteUint32(addrTypeLen)) {
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, "JoinMetaNode write addr type length failed!");
return SOFTBUS_IPC_ERR;
}
if (!data.WriteRawData(addr, addrTypeLen)) {
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, "JoinMetaNode write addr failed!");
return SOFTBUS_IPC_ERR;
if (addr != nullptr) {
if (!data.WriteUint32(addrTypeLen)) {
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, "JoinMetaNode write addr type length failed!");
return SOFTBUS_IPC_ERR;
}
if (!data.WriteRawData(addr, addrTypeLen)) {
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, "JoinMetaNode write addr failed!");
return SOFTBUS_IPC_ERR;
}
} else {
if (!data.WriteUint32(0)) {
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, "JoinMetaNode write addr type length failed!");
return SOFTBUS_IPC_ERR;
}
}
if (!data.WriteRawData(customData, sizeof(CustomData))) {
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, "JoinMetaNode write addr failed!");

View File

@ -53,7 +53,7 @@ int32_t ShiftLNNGearInner(const char *pkgName, const char *callerId, const char
const GearMode *mode);
int32_t LnnOnJoinResult(void *addr, const char *networkId, int32_t retCode);
int32_t MetaNodeOnJoinResult(void *addr, const char *networkId, int32_t retCode);
int32_t MetaNodeOnJoinResult(void *addr, void *metaInfo, int32_t retCode);
int32_t LnnOnLeaveResult(const char *networkId, int32_t retCode);
int32_t MetaNodeOnLeaveResult(const char *networkId, int32_t retCode);
int32_t LnnOnNodeOnlineStateChanged(const char *pkgName, bool isOnline, void *info);

View File

@ -41,7 +41,7 @@ typedef struct {
typedef struct {
ListNode node;
ConnectionAddr addr;
MetaNodeType type;
OnJoinMetaNodeResult cb;
} JoinMetaNodeCbListItem;
@ -127,13 +127,12 @@ static JoinLNNCbListItem *FindJoinLNNCbItem(ConnectionAddr *addr, OnJoinLNNResul
return NULL;
}
static JoinMetaNodeCbListItem *FindJoinMetaNodeCbItem(ConnectionAddr *addr, OnJoinMetaNodeResult cb)
static JoinMetaNodeCbListItem *FindJoinMetaNodeCbItem(MetaNodeType tType, OnJoinMetaNodeResult cb)
{
JoinMetaNodeCbListItem *item = NULL;
LIST_FOR_EACH_ENTRY(item, &g_busCenterClient.joinMetaNodeCbList, JoinMetaNodeCbListItem, node) {
if (IsSameConnectionAddr(&item->addr, addr) &&
(cb == NULL || cb == item->cb)) {
if (item->type == tType && (cb == NULL || cb == item->cb)) {
return item;
}
}
@ -156,7 +155,7 @@ static int32_t AddJoinLNNCbItem(ConnectionAddr *target, OnJoinLNNResult cb)
return SOFTBUS_OK;
}
static int32_t AddJoinMetaNodeCbItem(ConnectionAddr *target, OnJoinMetaNodeResult cb)
static int32_t AddJoinMetaNodeCbItem(MetaNodeType tType, OnJoinMetaNodeResult cb)
{
JoinMetaNodeCbListItem *item = NULL;
@ -166,7 +165,7 @@ static int32_t AddJoinMetaNodeCbItem(ConnectionAddr *target, OnJoinMetaNodeResul
return SOFTBUS_MALLOC_ERR;
}
ListInit(&item->node);
item->addr = *target;
item->type = tType;
item->cb = cb;
ListAdd(&g_busCenterClient.joinMetaNodeCbList, &item->node);
return SOFTBUS_OK;
@ -496,7 +495,7 @@ int32_t JoinLNNInner(const char *pkgName, ConnectionAddr *target, OnJoinLNNResul
return rc;
}
int32_t JoinMetaNodeInner(const char *pkgName, ConnectionAddr *target, CustomData *customData, OnJoinLNNResult cb)
int32_t JoinMetaNodeInner(const char *pkgName, ConnectionAddr *target, CustomData *customData, OnJoinMetaNodeResult cb)
{
int32_t rc;
@ -509,7 +508,7 @@ int32_t JoinMetaNodeInner(const char *pkgName, ConnectionAddr *target, CustomDat
}
do {
if (FindJoinMetaNodeCbItem(target, cb) != NULL) {
if (FindJoinMetaNodeCbItem(customData->type, cb) != NULL) {
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, "fail : join request already exist");
rc = SOFTBUS_ALREADY_EXISTED;
break;
@ -518,7 +517,7 @@ int32_t JoinMetaNodeInner(const char *pkgName, ConnectionAddr *target, CustomDat
if (rc != SOFTBUS_OK) {
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, "fail : request join MetaNode");
} else {
rc = AddJoinMetaNodeCbItem(target, cb);
rc = AddJoinMetaNodeCbItem(customData->type, cb);
}
} while (false);
if (SoftBusMutexUnlock(&g_busCenterClient.lock) != 0) {
@ -833,14 +832,11 @@ int32_t LnnOnJoinResult(void *addr, const char *networkId, int32_t retCode)
return SOFTBUS_OK;
}
int32_t MetaNodeOnJoinResult(void *addr, const char *networkId, int32_t retCode)
int32_t MetaNodeOnJoinResult(void *addr, void *metaInfo, int32_t retCode)
{
JoinMetaNodeCbListItem *item = NULL;
ConnectionAddr *connAddr = (ConnectionAddr *)addr;
if (connAddr == NULL) {
return SOFTBUS_INVALID_PARAM;
}
MetaBasicInfo *metaBasicInfo = (MetaBasicInfo *)metaInfo;
if (!g_busCenterClient.isInit) {
return SOFTBUS_ERR;
}
@ -848,13 +844,13 @@ int32_t MetaNodeOnJoinResult(void *addr, const char *networkId, int32_t retCode)
if (SoftBusMutexLock(&g_busCenterClient.lock) != 0) {
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, "fail: lock join MetaNode cb list in join result");
}
while ((item = FindJoinMetaNodeCbItem((ConnectionAddr *)addr, NULL)) != NULL) {
while ((item = FindJoinMetaNodeCbItem(metaBasicInfo->type, NULL)) != NULL) {
ListDelete(&item->node);
if (SoftBusMutexUnlock(&g_busCenterClient.lock) != 0) {
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, "fail: unlock join MetaNode cb list in join result");
}
if (item->cb != NULL) {
item->cb(connAddr, networkId, retCode);
item->cb(connAddr, metaBasicInfo, retCode);
}
SoftBusFree(item);
if (SoftBusMutexLock(&g_busCenterClient.lock) != 0) {

View File

@ -220,7 +220,7 @@ int32_t JoinLNN(const char *pkgName, ConnectionAddr *target, OnJoinLNNResult cb)
int32_t JoinMetaNode(const char *pkgName, ConnectionAddr *target, CustomData *customData, OnJoinMetaNodeResult cb)
{
if (pkgName == NULL || target == NULL || customData == NULL || cb == NULL) {
if (pkgName == NULL || customData == NULL || cb == NULL) {
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, "fail : params are NULL!");
return SOFTBUS_INVALID_PARAM;
}
@ -228,7 +228,7 @@ int32_t JoinMetaNode(const char *pkgName, ConnectionAddr *target, CustomData *cu
if (ret != SOFTBUS_OK) {
return ret;
}
if (target->type == CONNECTION_ADDR_SESSION) {
if (target != NULL && target->type == CONNECTION_ADDR_SESSION) {
ret = ClientGetChannelBySessionId(target->info.session.sessionId, &target->info.session.channelId,
&target->info.session.type, NULL);
if (ret != SOFTBUS_OK) {

View File

@ -54,7 +54,8 @@ public:
virtual int32_t OnJoinLNNResult(void *addr, uint32_t addrTypeLen, const char *networkId, int retCode);
virtual int32_t OnJoinMetaNodeResult(void *addr, uint32_t addrTypeLen, const char *networkId, int retCode);
virtual int32_t OnJoinMetaNodeResult(void *addr, uint32_t addrTypeLen, void *metaInfo, uint32_t infoLen,
int retCode);
virtual int32_t OnLeaveLNNResult(const char *networkId, int retCode);

View File

@ -41,7 +41,8 @@ public:
int32_t OnChannelQosEvent(int32_t channelId, int32_t channelType, int32_t eventId, int32_t tvCount,
const QosTv *tvList) override;
int32_t OnJoinLNNResult(void *addr, uint32_t addrTypeLen, const char *networkId, int retCode) override;
int32_t OnJoinMetaNodeResult(void *addr, uint32_t addrTypeLen, const char *networkId, int retCode) override;
int32_t OnJoinMetaNodeResult(void *addr, uint32_t addrTypeLen, void *metaInfo, uint32_t infoLen,
int retCode) override;
int32_t OnLeaveLNNResult(const char *networkId, int retCode) override;
int32_t OnLeaveMetaNodeResult(const char *networkId, int retCode) override;
int32_t OnNodeOnlineStateChanged(const char *pkgName, bool isOnline, void *info, uint32_t infoTypeLen) override;

View File

@ -86,7 +86,8 @@ int32_t ISoftBusClient::OnJoinLNNResult(void *addr, uint32_t addrTypeLen, const
return SOFTBUS_OK;
}
int32_t ISoftBusClient::OnJoinMetaNodeResult(void *addr, uint32_t addrTypeLen, const char *networkId, int retCode)
int32_t ISoftBusClient::OnJoinMetaNodeResult(void *addr, uint32_t addrTypeLen, void *metaInfo, uint32_t infoLen,
int retCode)
{
MLOGI("ipc default impl");
return SOFTBUS_OK;

View File

@ -488,14 +488,28 @@ int32_t SoftBusClientStub::OnJoinLNNResultInner(MessageParcel &data, MessageParc
int32_t SoftBusClientStub::OnJoinMetaNodeResultInner(MessageParcel &data, MessageParcel &reply)
{
uint32_t addrTypeLen;
if (!data.ReadUint32(addrTypeLen) || addrTypeLen != sizeof(ConnectionAddr)) {
uint32_t infoLen;
void *addr = nullptr;
if (!data.ReadUint32(addrTypeLen) || (addrTypeLen != 0 && addrTypeLen != sizeof(ConnectionAddr))) {
SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR,
"OnJoinMetaNodeResultInner read addrTypeLen:%d failed!", addrTypeLen);
return SOFTBUS_ERR;
}
void *addr = (void *)data.ReadRawData(addrTypeLen);
if (addr == nullptr) {
SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "OnJoinMetaNodeResultInner read addr failed!");
if (addrTypeLen != 0) {
addr = (void *)data.ReadRawData(addrTypeLen);
if (addr == nullptr) {
SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "OnJoinMetaNodeResultInner read addr failed!");
return SOFTBUS_ERR;
}
}
if (!data.ReadUint32(infoLen) || (infoLen != 0 && infoLen != sizeof(MetaBasicInfo))) {
SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR,
"OnJoinMetaNodeResultInner read infoLen:%d failed!", infoLen);
return SOFTBUS_ERR;
}
void *metaInfo = (void *)data.ReadRawData(infoLen);
if (metaInfo == nullptr) {
SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "OnJoinMetaNodeResultInner read metaInfo failed!");
return SOFTBUS_ERR;
}
int32_t retCode;
@ -503,15 +517,7 @@ int32_t SoftBusClientStub::OnJoinMetaNodeResultInner(MessageParcel &data, Messag
SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "OnJoinMetaNodeResultInner read retCode failed!");
return SOFTBUS_ERR;
}
const char *networkId = nullptr;
if (retCode == 0) {
networkId = data.ReadCString();
if (networkId == nullptr) {
SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "OnJoinMetaNodeResultInner read networkId failed!");
return SOFTBUS_ERR;
}
}
int32_t retReply = OnJoinMetaNodeResult(addr, addrTypeLen, networkId, retCode);
int32_t retReply = OnJoinMetaNodeResult(addr, addrTypeLen, metaInfo, infoLen, retCode);
if (retReply != SOFTBUS_OK) {
SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "OnJoinMetaNodeResultInner notify join result failed!");
}
@ -703,10 +709,12 @@ int32_t SoftBusClientStub::OnJoinLNNResult(void *addr, uint32_t addrTypeLen, con
return LnnOnJoinResult(addr, networkId, retCode);
}
int32_t SoftBusClientStub::OnJoinMetaNodeResult(void *addr, uint32_t addrTypeLen, const char *networkId, int retCode)
int32_t SoftBusClientStub::OnJoinMetaNodeResult(void *addr, uint32_t addrTypeLen, void *metaInfo, uint32_t infoLen,
int retCode)
{
(void)addrTypeLen;
return MetaNodeOnJoinResult(addr, networkId, retCode);
(void)infoLen;
return MetaNodeOnJoinResult(addr, metaInfo, retCode);
}
int32_t SoftBusClientStub::OnLeaveLNNResult(const char *networkId, int retCode)

View File

@ -60,6 +60,7 @@ bus_center_unittest_dirs = [
"$dsoftbus_root_path/core/bus_center/lnn/net_ledger/distributed_ledger/include",
"$dsoftbus_root_path/tests/core/bus_center/lnn/net_builder/include",
"$dsoftbus_root_path/core/authentication/include",
"$dsoftbus_root_path/core/bus_center/lnn/meta_node/include",
]
bus_center_unittest_deps = [
@ -1077,6 +1078,7 @@ ohos_unittest("LNNLedgerMockTest") {
"$dsoftbus_root_path/interfaces/kits/discovery",
"$dsoftbus_root_path/core/bus_center/service/include",
"$dsoftbus_root_path/core/bus_center/lnn/net_ledger/decision_db/include",
"$dsoftbus_root_path/core/bus_center/lnn/meta_node/include",
]
deps = [

View File

@ -95,19 +95,26 @@ using namespace testing::ext;
{
void *addr = nullptr;
uint32_t addrTypeLen = 0;
void *metaInfo = nullptr;
uint32_t infoLen = 0;
ConnectionAddr addrValue;
(void)memset_s(&addrValue, sizeof(ConnectionAddr), 0, sizeof(ConnectionAddr));
char *networkId = nullptr;
char networkIdValue[] = "12345";
int32_t retCode = 0;
char pkgNameValue[] = "test";
MetaBasicInfo metaInfoValue;
(void)memset_s(&metaInfoValue, sizeof(MetaBasicInfo), 0, sizeof(MetaBasicInfo));
(void)strcpy_s(metaInfoValue.metaNodeId, NETWORK_ID_BUF_LEN, networkIdValue);
sptr<BusCenterClientProxy> clientProxy = GetClientProxy(pkgNameValue);
int32_t ret = clientProxy->BusCenterClientProxy::OnJoinMetaNodeResult(addr, addrTypeLen, networkId, retCode);
int32_t ret =
clientProxy->BusCenterClientProxy::OnJoinMetaNodeResult(addr, addrTypeLen, metaInfo, infoLen, retCode);
EXPECT_EQ(ret, SOFTBUS_ERR);
retCode = 1;
ret = clientProxy->BusCenterClientProxy::OnJoinMetaNodeResult(addr, addrTypeLen, networkIdValue, retCode);
ret = clientProxy->BusCenterClientProxy::OnJoinMetaNodeResult(addr, addrTypeLen, &metaInfoValue,
infoLen, retCode);
EXPECT_TRUE(ret == SOFTBUS_ERR);
ret = clientProxy->BusCenterClientProxy::OnJoinMetaNodeResult(&addrValue, addrTypeLen, networkIdValue, retCode);
ret = clientProxy->BusCenterClientProxy::OnJoinMetaNodeResult(&addrValue, addrTypeLen, &metaInfoValue,
infoLen, retCode);
EXPECT_TRUE(ret == SOFTBUS_ERR);
}

View File

@ -55,11 +55,11 @@ void BusCenterClientProxyTest::TearDown()
HWTEST_F(BusCenterClientProxyTest, CLIENT_ON_JOIN_META_NODE_RESULT_Test_001, TestSize.Level1)
{
void *addr = nullptr;
MetaBasicInfo *metaInfo = nullptr;
uint32_t addrTypeLen = TEST_DATA_LEN;
const char *networkId = "1234";
int32_t retCode = 0;
int32_t ret;
ret = ClientOnJoinMetaNodeResult(nullptr, addr, addrTypeLen, networkId, retCode);
ret = ClientOnJoinMetaNodeResult(nullptr, addr, addrTypeLen, metaInfo, retCode);
EXPECT_EQ(ret, SOFTBUS_ERR);
}

View File

@ -139,14 +139,17 @@ HWTEST_F(LNNBusCenterIpcTest, META_NODE_IPC_NOTIFY_JOIN_RESULT_Test_001, TestSiz
uint32_t addrTypeLen = 0;
ConnectionAddr addrValue;
(void)memset_s(&addrValue, sizeof(ConnectionAddr), 0, sizeof(ConnectionAddr));
char *networkId = nullptr;
MetaBasicInfo *metaInfo = nullptr;
char networkIdValue[DEFAULT_LEN] = "1234";
int32_t retCode = 0;
CustomData customData;
memcpy_s(customData.data, sizeof(CustomData), "test", DEFAULT_SIZE);
int32_t ret = MetaNodeIpcNotifyJoinResult(addr, addrTypeLen, networkId, retCode);
MetaBasicInfo metaInfoValue;
(void)memset_s(&metaInfoValue, sizeof(MetaBasicInfo), 0, sizeof(MetaBasicInfo));
(void)strcpy_s(metaInfoValue.metaNodeId, NETWORK_ID_BUF_LEN, networkIdValue);
int32_t ret = MetaNodeIpcNotifyJoinResult(addr, addrTypeLen, metaInfo, retCode);
EXPECT_TRUE(ret == SOFTBUS_INVALID_PARAM);
ret = MetaNodeIpcNotifyJoinResult((void *)&addrValue, addrTypeLen, networkIdValue, retCode);
ret = MetaNodeIpcNotifyJoinResult((void *)&addrValue, addrTypeLen, metaInfoValue, retCode);
EXPECT_TRUE(ret == SOFTBUS_OK);
}

View File

@ -99,10 +99,10 @@ public:
virtual int32_t SoftBusGetTime(SoftBusSysTime *sysTime);
virtual int32_t AuthGetConnInfo(int64_t authId, AuthConnInfo *connInfo);
virtual void MetaNodeNotifyJoinResult(ConnectionAddr *addr,
const char *networkId, int32_t retCode);
MetaBasicInfo *metaInfo, int32_t retCode);
virtual void LnnNotifyLeaveResult(const char *networkId, int32_t retCode);
virtual int32_t MetaNodeIpcNotifyJoinResult(void *addr, uint32_t addrTypeLen,
const char *networkId, int32_t retCode);
MetaBasicInfo *metaInfo, int32_t retCode);
virtual int32_t LnnGetAddrTypeByIfName(const char *ifName, ConnectionAddrType *type);
virtual int32_t LnnSendNotTrustedInfo(const NotTrustedDelayInfo *info, uint32_t num,
LnnSyncInfoMsgComplete complete);
@ -200,9 +200,9 @@ public:
MOCK_METHOD1(LnnNotifyAllTypeOffline, void (ConnectionAddrType));
MOCK_METHOD1(SoftBusGetTime, int32_t (SoftBusSysTime *));
MOCK_METHOD2(AuthGetConnInfo, int32_t (int64_t, AuthConnInfo *));
MOCK_METHOD3(MetaNodeNotifyJoinResult, void (ConnectionAddr *, const char *, int32_t));
MOCK_METHOD3(MetaNodeNotifyJoinResult, void (ConnectionAddr *, MetaBasicInfo *, int32_t));
MOCK_METHOD2(LnnNotifyLeaveResult, void (const char *, int32_t));
MOCK_METHOD4(MetaNodeIpcNotifyJoinResult, int32_t (void *, uint32_t, const char *, int32_t));
MOCK_METHOD4(MetaNodeIpcNotifyJoinResult, int32_t (void *, uint32_t, MetaBasicInfo *, int32_t));
MOCK_METHOD2(LnnGetAddrTypeByIfName, int32_t (const char *, ConnectionAddrType *));
MOCK_METHOD3(LnnSendNotTrustedInfo, int32_t (const NotTrustedDelayInfo *, uint32_t, LnnSyncInfoMsgComplete));
MOCK_METHOD4(LnnAsyncCallbackDelayHelper, int32_t (SoftBusLooper *, LnnAsyncCallbackFunc, void *, uint64_t));

View File

@ -250,9 +250,9 @@ int32_t AuthGetConnInfo(int64_t authId, AuthConnInfo *connInfo)
return GetNetBuilderDepsInterface()->AuthGetConnInfo(authId, connInfo);
}
void MetaNodeNotifyJoinResult(ConnectionAddr *addr, const char *networkId, int32_t retCode)
void MetaNodeNotifyJoinResult(ConnectionAddr *addr, MetaBasicInfo *metaInfo, int32_t retCode)
{
return GetNetBuilderDepsInterface()->MetaNodeNotifyJoinResult(addr, networkId, retCode);
return GetNetBuilderDepsInterface()->MetaNodeNotifyJoinResult(addr, metaInfo, retCode);
}
void LnnNotifyLeaveResult(const char *networkId, int32_t retCode)
@ -260,9 +260,9 @@ void LnnNotifyLeaveResult(const char *networkId, int32_t retCode)
return GetNetBuilderDepsInterface()->LnnNotifyLeaveResult(networkId, retCode);
}
int32_t MetaNodeIpcNotifyJoinResult(void *addr, uint32_t addrTypeLen, const char *networkId, int32_t retCode)
int32_t MetaNodeIpcNotifyJoinResult(void *addr, uint32_t addrTypeLen, MetaBasicInfo *metaInfo, int32_t retCode)
{
return GetNetBuilderDepsInterface()->MetaNodeIpcNotifyJoinResult(addr, addrTypeLen, networkId, retCode);
return GetNetBuilderDepsInterface()->MetaNodeIpcNotifyJoinResult(addr, addrTypeLen, metaInfo, retCode);
}
int32_t LnnGetAddrTypeByIfName(const char *ifName, ConnectionAddrType *type)

View File

@ -420,6 +420,7 @@ ohos_unittest("BusCenterIpcTest") {
"$dsoftbus_root_path/core/bus_center/utils/include",
"$dsoftbus_root_path/core/bus_center/ipc/standard/include",
"$dsoftbus_root_path/core/bus_center/lnn/lane_hub/lane_manager/include",
"$dsoftbus_root_path/core/bus_center/lnn/meta_node/include",
]
deps = [

View File

@ -203,14 +203,18 @@ HWTEST_F(BusCenterIpcTest, MetaNodeIpcNotifyJoinResultTest_01, TestSize.Level1)
(void)memset_s(&addr, sizeof(ConnectionAddr), 0, sizeof(ConnectionAddr));
AddJoinMetaNodeInfo(TEST_PKGNAME, 0, &addr);
AddJoinMetaNodeInfo(TEST_PKGNAME2, 0, &addr);
MetaBasicInfo metaInfo;
(void)memset_s(&metaInfo, sizeof(MetaBasicInfo), 0, sizeof(MetaBasicInfo));
(void)strcpy_s(metaInfo.metaNodeId, NETWORK_ID_BUF_LEN, TEST_NETWORK_ID);
EXPECT_CALL(busCenterIpcMock, LnnIsSameConnectionAddr)
.WillOnce(Return(true))
.WillRepeatedly(Return(false));
int32_t ret = MetaNodeIpcNotifyJoinResult(nullptr, TEST_ADDR_TYPE_LEN, TEST_NETWORK_ID, TEST_RET_CODE);
int32_t ret =
MetaNodeIpcNotifyJoinResult(nullptr, TEST_ADDR_TYPE_LEN, &metaInfo, TEST_RET_CODE);
EXPECT_TRUE(ret == SOFTBUS_INVALID_PARAM);
ret = MetaNodeIpcNotifyJoinResult(reinterpret_cast<void *>(&addr),
TEST_ADDR_TYPE_LEN, TEST_NETWORK_ID, TEST_RET_CODE);
TEST_ADDR_TYPE_LEN, &metaInfo, TEST_RET_CODE);
EXPECT_TRUE(ret == SOFTBUS_OK);
}

View File

@ -22,6 +22,7 @@
#include "iremote_object.h"
#include "iservice_registry.h"
#include "softbus_adapter_log.h"
#include "softbus_bus_center.h"
#include "softbus_error_code.h"
namespace OHOS {
@ -93,12 +94,18 @@ HWTEST_F(ClientProxyTest, OnJoinMetaNodeResultTest_01, TestSize.Level1)
sptr<BusCenterClientProxy> clientProxy = new (std::nothrow) BusCenterClientProxy(remoteObject);
ASSERT_TRUE(clientProxy != nullptr);
char *addr = const_cast<char *>(TEST_ADDR);
MetaBasicInfo metaInfo;
(void)memset_s(&metaInfo, sizeof(MetaBasicInfo), 0, sizeof(MetaBasicInfo));
(void)strcpy_s(metaInfo.metaNodeId, NETWORK_ID_BUF_LEN, TEST_NETWORK_ID);
void *addrInput = reinterpret_cast<void *>(addr);
int32_t ret = clientProxy->OnJoinMetaNodeResult(nullptr, TEST_ADDR_TYPE_LEN, TEST_NETWORK_ID, TEST_RET_CODE);
void *metaInfoInput = reinterpret_cast<void *>(&metaInfo);
int32_t ret = clientProxy->OnJoinMetaNodeResult(nullptr, TEST_ADDR_TYPE_LEN, metaInfoInput,
sizeof(MetaBasicInfo), TEST_RET_CODE);
EXPECT_TRUE(ret == SOFTBUS_ERR);
ret = clientProxy->OnJoinMetaNodeResult(addrInput, TEST_ADDR_TYPE_LEN, nullptr, TEST_RET_CODE);
ret = clientProxy->OnJoinMetaNodeResult(addrInput, TEST_ADDR_TYPE_LEN, nullptr, 0, TEST_RET_CODE);
EXPECT_TRUE(ret == SOFTBUS_ERR);
ret = clientProxy->OnJoinMetaNodeResult(addrInput, TEST_ADDR_TYPE_LEN, TEST_NETWORK_ID, TEST_RET_CODE);
ret = clientProxy->OnJoinMetaNodeResult(addrInput, TEST_ADDR_TYPE_LEN, metaInfoInput,
sizeof(MetaBasicInfo), TEST_RET_CODE);
EXPECT_TRUE(ret == SOFTBUS_OK);
}

View File

@ -32,7 +32,10 @@ public:
virtual bool LnnIsSameConnectionAddr(const ConnectionAddr *addr1, const ConnectionAddr *addr2, bool isShort) = 0;
virtual int32_t MetaNodeServerJoin(const char *pkgName, int32_t callingPid,
ConnectionAddr *addr, CustomData *customData) = 0;
virtual int32_t MetaNodeServerJoinExt(CustomData *customData) = 0;
virtual int32_t MetaNodeServerLeave(const char *networkId) = 0;
virtual int32_t MetaNodeServerLeaveExt(const char *metaNodeId, MetaNodeType type) = 0;
virtual MetaNodeType FindMetaNodeType(const char *metaNodeId) = 0;
virtual int32_t LnnServerLeave(const char *networkId, const char *pkgName) = 0;
virtual int32_t LnnGetAllOnlineNodeInfo(NodeBasicInfo **info, int32_t *infoNum) = 0;
virtual bool LnnIsLSANode(const NodeBasicInfo *info) = 0;
@ -55,7 +58,7 @@ public:
virtual int32_t ClientOnJoinLNNResult(PkgNameAndPidInfo *info, void *addr, uint32_t addrTypeLen,
const char *networkId, int32_t retCode) = 0;
virtual int32_t ClientOnJoinMetaNodeResult(PkgNameAndPidInfo *info, void *addr, uint32_t addrTypeLen,
const char *networkId, int32_t retCode) = 0;
MetaBasicInfo *metaInfo, int32_t retCode) = 0;
virtual int32_t ClientOnLeaveLNNResult(
const char *pkgName, int32_t pid, const char *networkId, int32_t retCode) = 0;
virtual int32_t ClientOnLeaveMetaNodeResult(
@ -77,8 +80,11 @@ public:
MOCK_METHOD3(LnnIsSameConnectionAddr, bool(const ConnectionAddr *, const ConnectionAddr *, bool));
MOCK_METHOD4(MetaNodeServerJoin, int32_t(const char*, int32_t, ConnectionAddr *, CustomData *));
MOCK_METHOD1(MetaNodeServerJoinExt, int32_t(CustomData *));
MOCK_METHOD2(LnnServerLeave, int32_t(const char *, const char *));
MOCK_METHOD1(MetaNodeServerLeave, int32_t(const char *));
MOCK_METHOD2(MetaNodeServerLeaveExt, int32_t(const char *, MetaNodeType));
MOCK_METHOD1(FindMetaNodeType, MetaNodeType(const char *));
MOCK_METHOD2(LnnGetAllOnlineNodeInfo, int32_t(NodeBasicInfo **, int32_t *));
MOCK_METHOD1(LnnIsLSANode, bool(const NodeBasicInfo *));
MOCK_METHOD1(LnnGetLocalDeviceInfo, int32_t(NodeBasicInfo *));
@ -95,7 +101,7 @@ public:
MOCK_METHOD2(LnnGetAllMetaNodeInfo, int32_t(MetaNodeInfo *, int32_t *));
MOCK_METHOD4(LnnShiftLNNGear, int32_t(const char *, const char *, const char *, const GearMode *));
MOCK_METHOD5(ClientOnJoinLNNResult, int32_t(PkgNameAndPidInfo *, void *, uint32_t, const char *, int32_t));
MOCK_METHOD5(ClientOnJoinMetaNodeResult, int32_t(PkgNameAndPidInfo *, void *, uint32_t, const char *, int32_t));
MOCK_METHOD5(ClientOnJoinMetaNodeResult, int32_t(PkgNameAndPidInfo *, void *, uint32_t, MetaBasicInfo *, int32_t));
MOCK_METHOD4(ClientOnLeaveLNNResult, int32_t(const char *, int32_t, const char *, int32_t));
MOCK_METHOD4(ClientOnLeaveMetaNodeResult, int32_t(const char *, int32_t, const char *, int32_t));
MOCK_METHOD3(ClinetOnNodeOnlineStateChanged, int32_t(bool, void *, uint32_t));

View File

@ -47,11 +47,26 @@ int32_t MetaNodeServerJoin(const char *pkgName, int32_t callingPid, ConnectionAd
return BusCenterIpcInterfaceInstance()->MetaNodeServerJoin(pkgName, callingPid, addr, customData);
}
int32_t MetaNodeServerJoinExt(CustomData *customData)
{
return BusCenterIpcInterfaceInstance()->MetaNodeServerJoinExt(customData);
}
int32_t LnnServerLeave(const char *networkId, const char *pkgName)
{
return BusCenterIpcInterfaceInstance()->LnnServerLeave(networkId, pkgName);
}
int32_t MetaNodeServerLeaveExt(const char *metaNodeId, MetaNodeType type)
{
return BusCenterIpcInterfaceInstance()->MetaNodeServerLeaveExt(metaNodeId, type);
}
MetaNodeType FindMetaNodeType(const char *metaNodeId)
{
return BusCenterIpcInterfaceInstance()->FindMetaNodeType(metaNodeId);
}
int32_t MetaNodeServerLeave(const char *networkId)
{
return BusCenterIpcInterfaceInstance()->MetaNodeServerLeave(networkId);
@ -139,10 +154,10 @@ int32_t ClientOnJoinLNNResult(
return BusCenterIpcInterfaceInstance()->ClientOnJoinLNNResult(info, addr, addrTypeLen, networkId, retCode);
}
int32_t ClientOnJoinMetaNodeResult(PkgNameAndPidInfo *info, void *addr, uint32_t addrTypeLen, const char *networkId,
int32_t ClientOnJoinMetaNodeResult(PkgNameAndPidInfo *info, void *addr, uint32_t addrTypeLen, MetaBasicInfo *metaInfo,
int32_t retCode)
{
return BusCenterIpcInterfaceInstance()->ClientOnJoinMetaNodeResult(info, addr, addrTypeLen, networkId, retCode);
return BusCenterIpcInterfaceInstance()->ClientOnJoinMetaNodeResult(info, addr, addrTypeLen, metaInfo, retCode);
}
int32_t ClientOnLeaveLNNResult(const char *pkgName, int32_t pid, const char *networkId, int32_t retCode)

View File

@ -82,11 +82,13 @@ HWTEST_F(TransClientProxyStandardTest, TransClientProxyStandardTest001, TestSize
void *addr = nullptr;
uint32_t addrTypeLen = TEST_INVALID;
void *metaInfo = nullptr;
uint32_t infoLen = TEST_INVALID;
const char *networkId = nullptr;
ret = clientProxy->OnJoinLNNResult(addr, addrTypeLen, networkId, tmp);
EXPECT_EQ(SOFTBUS_OK, ret);
ret = clientProxy->OnJoinMetaNodeResult(addr, addrTypeLen, networkId, tmp);
ret = clientProxy->OnJoinMetaNodeResult(addr, addrTypeLen, metaInfo, infoLen, tmp);
EXPECT_EQ(SOFTBUS_OK, ret);
ret = clientProxy->OnLeaveLNNResult(networkId, tmp);

View File

@ -22,10 +22,10 @@
#include "softbus_errcode.h"
namespace OHOS {
void JoinMetaNodeCb(ConnectionAddr *addr, const char *networkId, int32_t retCode)
void JoinMetaNodeCb(ConnectionAddr *addr, MetaBasicInfo *metaInfo, int32_t retCode)
{
(void) addr;
(void) networkId;
(void) metaInfo;
(void) retCode;
}

View File

@ -133,7 +133,7 @@ HWTEST_F(ClientBusCentManagerTest, JOIN_LNN_INNER_Test_001, TestSize.Level1)
*/
HWTEST_F(ClientBusCentManagerTest, JOIN_META_NODE_INNER_Test_001, TestSize.Level1)
{
OnJoinLNNResult cb = nullptr;
OnJoinMetaNodeResult cb = nullptr;
ConnectionAddr target;
(void)memset_s(&target, sizeof(ConnectionAddr), 0, sizeof(ConnectionAddr));
target.type = CONNECTION_ADDR_BLE;
@ -519,10 +519,10 @@ HWTEST_F(ClientBusCentManagerTest, LNN_ONJOIN_RESULT_Test_001, TestSize.Level1)
BusCenterClientDeinit();
}
static void OnJoinMetaNodeResultCb(ConnectionAddr *addr, const char *networkId, int32_t retCode)
static void OnJoinMetaNodeResultCb(ConnectionAddr *addr, MetaBasicInfo *metaInfo, int32_t retCode)
{
(void)addr;
(void)networkId;
(void)metaInfo;
(void)retCode;
printf("on call join meta node result cb\n");
}
@ -541,19 +541,26 @@ HWTEST_F(ClientBusCentManagerTest, META_NODE_ONJOIN_RESULT_Test_001, TestSize.Le
addr.type = CONNECTION_ADDR_BR;
(void)strcpy_s(addr.info.ip.ip, IP_STR_MAX_LEN, NODE1_IP);
addr.info.ip.port = NODE1_PORT;
MetaBasicInfo metaInfo;
(void)memset_s(&metaInfo, sizeof(MetaBasicInfo), 0, sizeof(MetaBasicInfo));
(void)strcpy_s(metaInfo.metaNodeId, NETWORK_ID_BUF_LEN, NODE1_NETWORK_ID);
EXPECT_TRUE(MetaNodeOnJoinResult(nullptr, nullptr, retCode) == SOFTBUS_INVALID_PARAM);
EXPECT_TRUE(MetaNodeOnJoinResult(reinterpret_cast<void *>(&addr), NODE1_NETWORK_ID, retCode) == SOFTBUS_OK);
EXPECT_TRUE(MetaNodeOnJoinResult(reinterpret_cast<void *>(&addr),
reinterpret_cast<void *>(&metaInfo), retCode) == SOFTBUS_OK);
ClientBusCenterManagerInterfaceMock busCentManagerMock;
EXPECT_CALL(busCentManagerMock, SoftbusGetConfig(_, _, _)).WillRepeatedly(Return(SOFTBUS_OK));
EXPECT_CALL(busCentManagerMock, BusCenterServerProxyInit()).WillRepeatedly(Return(SOFTBUS_OK));
EXPECT_CALL(busCentManagerMock, BusCenterServerProxyDeInit()).WillRepeatedly(Return());
EXPECT_TRUE(BusCenterClientInit() == SOFTBUS_OK);
EXPECT_TRUE(MetaNodeOnJoinResult(reinterpret_cast<void *>(&addr), NODE1_NETWORK_ID, retCode) == SOFTBUS_OK);
EXPECT_TRUE(MetaNodeOnJoinResult(reinterpret_cast<void *>(&addr),
reinterpret_cast<void *>(&metaInfo), retCode) == SOFTBUS_OK);
EXPECT_CALL(busCentManagerMock, ServerIpcJoinMetaNode(_, _, _, _)).WillRepeatedly(Return(SOFTBUS_OK));
EXPECT_TRUE(JoinMetaNodeInner(nullptr, &addr, nullptr, OnJoinMetaNodeResultCb) == SOFTBUS_OK);
EXPECT_TRUE(MetaNodeOnJoinResult(reinterpret_cast<void *>(&addr), NODE1_NETWORK_ID, retCode) == SOFTBUS_OK);
EXPECT_TRUE(MetaNodeOnJoinResult(reinterpret_cast<void *>(&addr),
reinterpret_cast<void *>(&metaInfo), retCode) == SOFTBUS_OK);
EXPECT_TRUE(JoinMetaNodeInner(nullptr, &addr, nullptr, nullptr) == SOFTBUS_OK);
EXPECT_TRUE(MetaNodeOnJoinResult(reinterpret_cast<void *>(&addr), NODE1_NETWORK_ID, retCode) == SOFTBUS_OK);
EXPECT_TRUE(MetaNodeOnJoinResult(reinterpret_cast<void *>(&addr),
reinterpret_cast<void *>(&metaInfo), retCode) == SOFTBUS_OK);
BusCenterClientDeinit();
}

View File

@ -89,7 +89,7 @@ HWTEST_F(ClientBusMangerTest, JOIN_METANODE_Test_001, TestSize.Level1)
(void)memset_s(&connAddr, sizeof(ConnectionAddr), 0, sizeof(ConnectionAddr));
CustomData customData;
(void)memset_s(&customData, sizeof(CustomData), 0, sizeof(CustomData));
OnJoinLNNResult cb = nullptr;
OnJoinMetaNodeResult cb = nullptr;
int32_t ret = JoinMetaNodeInner(pkgName, &connAddr, &customData, cb);
EXPECT_TRUE(ret == SOFTBUS_NO_INIT);
g_busCenterClient.isInit = true;