mirror of
https://gitee.com/openharmony/communication_dsoftbus
synced 2024-11-23 08:49:59 +00:00
!8406 Multi user adaptation
Merge pull request !8406 from sunnyfeng/master
This commit is contained in:
commit
e9fe8ed808
@ -85,6 +85,7 @@ int32_t AuthDeviceProfileListener::OnTrustDeviceProfileActive(const TrustDeviceP
|
|||||||
{
|
{
|
||||||
AUTH_LOGI(AUTH_INIT, "dp active callback enter!");
|
AUTH_LOGI(AUTH_INIT, "dp active callback enter!");
|
||||||
DelNotTrustDevice(profile.GetDeviceId().c_str());
|
DelNotTrustDevice(profile.GetDeviceId().c_str());
|
||||||
|
LnnUpdateHeartbeatInfo(UPDATE_HB_NETWORK_INFO);
|
||||||
if (IsHeartbeatEnable()) {
|
if (IsHeartbeatEnable()) {
|
||||||
if (LnnStartHbByTypeAndStrategy(
|
if (LnnStartHbByTypeAndStrategy(
|
||||||
HEARTBEAT_TYPE_BLE_V0 | HEARTBEAT_TYPE_BLE_V3, STRATEGY_HB_SEND_SINGLE, false) != SOFTBUS_OK) {
|
HEARTBEAT_TYPE_BLE_V0 | HEARTBEAT_TYPE_BLE_V3, STRATEGY_HB_SEND_SINGLE, false) != SOFTBUS_OK) {
|
||||||
@ -100,6 +101,7 @@ int32_t AuthDeviceProfileListener::OnTrustDeviceProfileInactive(const TrustDevic
|
|||||||
{
|
{
|
||||||
AUTH_LOGI(AUTH_INIT, "dp inactive callback enter!");
|
AUTH_LOGI(AUTH_INIT, "dp inactive callback enter!");
|
||||||
LnnUpdateOhosAccount(true);
|
LnnUpdateOhosAccount(true);
|
||||||
|
LnnUpdateHeartbeatInfo(UPDATE_HB_NETWORK_INFO);
|
||||||
int32_t userId = profile.GetPeerUserId();
|
int32_t userId = profile.GetPeerUserId();
|
||||||
AUTH_LOGI(AUTH_INIT, "userId:%{public}d", userId);
|
AUTH_LOGI(AUTH_INIT, "userId:%{public}d", userId);
|
||||||
NotifyRemoteDevOffLineByUserId(userId, profile.GetDeviceId().c_str());
|
NotifyRemoteDevOffLineByUserId(userId, profile.GetDeviceId().c_str());
|
||||||
|
@ -2106,7 +2106,7 @@ static void UnpackUserIdCheckSum(JsonObj *json, NodeInfo *nodeInfo)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int32_t ret = ConvertHexStringToBytes(nodeInfo->userIdCheckSum, USERID_CHECKSUM_LEN,
|
int32_t ret = ConvertHexStringToBytes(nodeInfo->userIdCheckSum, USERID_CHECKSUM_LEN,
|
||||||
userIdCheckSumHexStr, USERID_CHECKSUM_HEXSTRING_LEN);
|
userIdCheckSumHexStr, strlen(userIdCheckSumHexStr));
|
||||||
if (ret != SOFTBUS_OK) {
|
if (ret != SOFTBUS_OK) {
|
||||||
AUTH_LOGE(AUTH_FSM, "ConvertHexStringToBytes failed! ret:%{public}d", ret);
|
AUTH_LOGE(AUTH_FSM, "ConvertHexStringToBytes failed! ret:%{public}d", ret);
|
||||||
}
|
}
|
||||||
|
@ -489,6 +489,20 @@ static void DeviceStateChangeProcess(char *udid, ConnectionAddrType type, bool i
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void NotifyUserChange(bool isChange, NodeInfo *oldInfo, NodeInfo *newInfo)
|
||||||
|
{
|
||||||
|
uint8_t defaultUserIdCheckSum[USERID_CHECKSUM_LEN] = {0};
|
||||||
|
if (memcmp(newInfo->userIdCheckSum, defaultUserIdCheckSum, USERID_CHECKSUM_LEN) == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (isChange || memcmp(oldInfo->userIdCheckSum, newInfo->userIdCheckSum, USERID_CHECKSUM_LEN) != 0) {
|
||||||
|
isChange = true;
|
||||||
|
} else {
|
||||||
|
isChange = false;
|
||||||
|
}
|
||||||
|
NotifyForegroundUseridChange(newInfo->networkId, newInfo->discoveryType, isChange);
|
||||||
|
}
|
||||||
|
|
||||||
static void SetLnnConnNodeInfo(
|
static void SetLnnConnNodeInfo(
|
||||||
LnnConntionInfo *connInfo, const char *networkId, LnnConnectionFsm *connFsm, int32_t retCode)
|
LnnConntionInfo *connInfo, const char *networkId, LnnConnectionFsm *connFsm, int32_t retCode)
|
||||||
{
|
{
|
||||||
@ -496,6 +510,9 @@ static void SetLnnConnNodeInfo(
|
|||||||
uint64_t localFeature;
|
uint64_t localFeature;
|
||||||
(void)LnnGetLocalNumU64Info(NUM_KEY_FEATURE_CAPA, &localFeature);
|
(void)LnnGetLocalNumU64Info(NUM_KEY_FEATURE_CAPA, &localFeature);
|
||||||
uint8_t relation[CONNECTION_ADDR_MAX] = { 0 };
|
uint8_t relation[CONNECTION_ADDR_MAX] = { 0 };
|
||||||
|
NodeInfo oldInfo;
|
||||||
|
(void)memset_s(&oldInfo, sizeof(NodeInfo), 0, sizeof(NodeInfo));
|
||||||
|
int32_t ret = LnnRetrieveDeviceInfoByNetworkId(networkId, &oldInfo);
|
||||||
report = LnnAddOnlineNode(connInfo->nodeInfo);
|
report = LnnAddOnlineNode(connInfo->nodeInfo);
|
||||||
LnnOfflineTimingByHeartbeat(networkId, connInfo->addr.type);
|
LnnOfflineTimingByHeartbeat(networkId, connInfo->addr.type);
|
||||||
if (LnnInsertLinkFinderInfo(networkId) != SOFTBUS_OK) {
|
if (LnnInsertLinkFinderInfo(networkId) != SOFTBUS_OK) {
|
||||||
@ -515,6 +532,9 @@ static void SetLnnConnNodeInfo(
|
|||||||
}
|
}
|
||||||
NotifyJoinResult(connFsm, networkId, retCode);
|
NotifyJoinResult(connFsm, networkId, retCode);
|
||||||
ReportResult(connInfo->nodeInfo->deviceInfo.deviceUdid, report);
|
ReportResult(connInfo->nodeInfo->deviceInfo.deviceUdid, report);
|
||||||
|
if (report == REPORT_ONLINE) {
|
||||||
|
NotifyUserChange(ret != SOFTBUS_OK, &oldInfo, connInfo->nodeInfo);
|
||||||
|
}
|
||||||
connInfo->flag |= LNN_CONN_INFO_FLAG_ONLINE;
|
connInfo->flag |= LNN_CONN_INFO_FLAG_ONLINE;
|
||||||
LnnNotifyNodeStateChanged(&connInfo->addr);
|
LnnNotifyNodeStateChanged(&connInfo->addr);
|
||||||
LnnGetLnnRelation(networkId, CATEGORY_NETWORK_ID, relation, CONNECTION_ADDR_MAX);
|
LnnGetLnnRelation(networkId, CATEGORY_NETWORK_ID, relation, CONNECTION_ADDR_MAX);
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include "bus_center_info_key.h"
|
#include "bus_center_info_key.h"
|
||||||
#include "bus_center_manager.h"
|
#include "bus_center_manager.h"
|
||||||
#include "lnn_async_callback_utils.h"
|
#include "lnn_async_callback_utils.h"
|
||||||
|
#include "lnn_ohos_account.h"
|
||||||
#include "lnn_file_utils.h"
|
#include "lnn_file_utils.h"
|
||||||
#include "lnn_heartbeat_ctrl.h"
|
#include "lnn_heartbeat_ctrl.h"
|
||||||
#include "lnn_huks_utils.h"
|
#include "lnn_huks_utils.h"
|
||||||
@ -51,6 +52,8 @@ static bool g_isDbListInit = false;
|
|||||||
static struct HksBlob g_keyAlias = { sizeof(LNN_DB_KEY_AILAS), (uint8_t *)LNN_DB_KEY_AILAS };
|
static struct HksBlob g_keyAlias = { sizeof(LNN_DB_KEY_AILAS), (uint8_t *)LNN_DB_KEY_AILAS };
|
||||||
static struct HksBlob g_ceKeyAlias = { sizeof(LNN_DB_KEY_AILAS), (uint8_t *)LNN_DB_KEY_AILAS };
|
static struct HksBlob g_ceKeyAlias = { sizeof(LNN_DB_KEY_AILAS), (uint8_t *)LNN_DB_KEY_AILAS };
|
||||||
|
|
||||||
|
static int32_t GetLocalAccountHexHash(char *accountHexHash);
|
||||||
|
|
||||||
static bool DeviceDbRecoveryInit(void)
|
static bool DeviceDbRecoveryInit(void)
|
||||||
{
|
{
|
||||||
if (SoftBusMutexInit(&g_deviceDbMutex, NULL) != SOFTBUS_OK) {
|
if (SoftBusMutexInit(&g_deviceDbMutex, NULL) != SOFTBUS_OK) {
|
||||||
@ -270,7 +273,7 @@ static int32_t BuildTrustedDevInfoRecord(const char *udid, TrustedDevInfoRecord
|
|||||||
{
|
{
|
||||||
uint8_t accountHash[SHA_256_HASH_LEN] = {0};
|
uint8_t accountHash[SHA_256_HASH_LEN] = {0};
|
||||||
char accountHexHash[SHA_256_HEX_HASH_LEN] = {0};
|
char accountHexHash[SHA_256_HEX_HASH_LEN] = {0};
|
||||||
|
int32_t userId = GetActiveOsAccountIds();
|
||||||
if (udid == NULL || record == NULL) {
|
if (udid == NULL || record == NULL) {
|
||||||
LNN_LOGE(LNN_LEDGER, "invalid param");
|
LNN_LOGE(LNN_LEDGER, "invalid param");
|
||||||
return SOFTBUS_INVALID_PARAM;
|
return SOFTBUS_INVALID_PARAM;
|
||||||
@ -287,14 +290,16 @@ static int32_t BuildTrustedDevInfoRecord(const char *udid, TrustedDevInfoRecord
|
|||||||
LNN_LOGE(LNN_LEDGER, "convert accountHash failed");
|
LNN_LOGE(LNN_LEDGER, "convert accountHash failed");
|
||||||
return SOFTBUS_ERR;
|
return SOFTBUS_ERR;
|
||||||
}
|
}
|
||||||
if (strcpy_s(record->accountHexHash, sizeof(record->accountHexHash), accountHexHash) != EOK) {
|
if (sprintf_s(record->accountHexHash, SHA_256_HEX_HASH_LEN + LNN_INT32_NUM_STR_MAX_LEN + 1,
|
||||||
LNN_LOGE(LNN_LEDGER, "memcpy_s account hash failed");
|
"%s-%d", accountHexHash, userId) < 0) {
|
||||||
return SOFTBUS_MEM_ERR;
|
LNN_LOGE(LNN_LEDGER, "sprintf_s fail");
|
||||||
|
return SOFTBUS_SPRINTF_ERR;
|
||||||
}
|
}
|
||||||
if (strcpy_s(record->udid, sizeof(record->udid), udid) != EOK) {
|
if (strcpy_s(record->udid, sizeof(record->udid), udid) != EOK) {
|
||||||
LNN_LOGE(LNN_LEDGER, "memcpy_s udid hash failed");
|
LNN_LOGE(LNN_LEDGER, "memcpy_s udid hash failed");
|
||||||
return SOFTBUS_MEM_ERR;
|
return SOFTBUS_MEM_ERR;
|
||||||
}
|
}
|
||||||
|
record->userId = userId;
|
||||||
return SOFTBUS_OK;
|
return SOFTBUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -386,6 +391,12 @@ static void RemoveTrustedDevInfoRecord(void *param)
|
|||||||
LNN_LOGE(LNN_LEDGER, "encrypt database failed");
|
LNN_LOGE(LNN_LEDGER, "encrypt database failed");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
// delete oldRecord
|
||||||
|
TrustedDevInfoRecord oldRecord = record;
|
||||||
|
(void)memset_s(oldRecord.accountHexHash, sizeof(oldRecord.accountHexHash), 0, sizeof(oldRecord.accountHexHash));
|
||||||
|
if (GetLocalAccountHexHash(oldRecord.accountHexHash) == SOFTBUS_OK) {
|
||||||
|
(void)RemoveRecordByKey(ctx, TABLE_TRUSTED_DEV_INFO, (uint8_t *)&oldRecord);
|
||||||
|
}
|
||||||
if (RemoveRecordByKey(ctx, TABLE_TRUSTED_DEV_INFO, (uint8_t *)&record) == SOFTBUS_OK) {
|
if (RemoveRecordByKey(ctx, TABLE_TRUSTED_DEV_INFO, (uint8_t *)&record) == SOFTBUS_OK) {
|
||||||
(void)LnnAsyncCallbackHelper(GetLooper(LOOP_TYPE_DEFAULT), CompleteUpdateTrustedDevInfo, NULL);
|
(void)LnnAsyncCallbackHelper(GetLooper(LOOP_TYPE_DEFAULT), CompleteUpdateTrustedDevInfo, NULL);
|
||||||
}
|
}
|
||||||
@ -411,7 +422,8 @@ static void DeleteDeviceFromList(TrustedDevInfoRecord *record)
|
|||||||
DeviceDbInfo *next = NULL;
|
DeviceDbInfo *next = NULL;
|
||||||
LIST_FOR_EACH_ENTRY_SAFE(item, next, &g_deviceInfoList, DeviceDbInfo, node) {
|
LIST_FOR_EACH_ENTRY_SAFE(item, next, &g_deviceInfoList, DeviceDbInfo, node) {
|
||||||
if (strcmp(item->infoRecord.accountHexHash, record->accountHexHash) == 0 &&
|
if (strcmp(item->infoRecord.accountHexHash, record->accountHexHash) == 0 &&
|
||||||
strcmp(item->infoRecord.udid, record->udid) == 0) {
|
strcmp(item->infoRecord.udid, record->udid) == 0 &&
|
||||||
|
item->infoRecord.userId == record->userId) {
|
||||||
char *anonyUdid = NULL;
|
char *anonyUdid = NULL;
|
||||||
Anonymize(record->udid, &anonyUdid);
|
Anonymize(record->udid, &anonyUdid);
|
||||||
LNN_LOGI(LNN_LEDGER, "delete device db from list. udid=%{public}s", AnonymizeWrapper(anonyUdid));
|
LNN_LOGI(LNN_LEDGER, "delete device db from list. udid=%{public}s", AnonymizeWrapper(anonyUdid));
|
||||||
@ -433,7 +445,8 @@ static void InsertDeviceToList(TrustedDevInfoRecord *record)
|
|||||||
DeviceDbInfo *item = NULL;
|
DeviceDbInfo *item = NULL;
|
||||||
LIST_FOR_EACH_ENTRY(item, &g_deviceInfoList, DeviceDbInfo, node) {
|
LIST_FOR_EACH_ENTRY(item, &g_deviceInfoList, DeviceDbInfo, node) {
|
||||||
if (strcmp(item->infoRecord.accountHexHash, record->accountHexHash) == 0 &&
|
if (strcmp(item->infoRecord.accountHexHash, record->accountHexHash) == 0 &&
|
||||||
strcmp(item->infoRecord.udid, record->udid) == 0) {
|
strcmp(item->infoRecord.udid, record->udid) == 0 &&
|
||||||
|
item->infoRecord.userId == record->userId) {
|
||||||
DeviceDbListUnlock();
|
DeviceDbListUnlock();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -561,32 +574,48 @@ static int32_t GetLocalAccountHexHash(char *accountHexHash)
|
|||||||
return SOFTBUS_OK;
|
return SOFTBUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t GetAllDevNums(char *accountHexHash, uint32_t *num)
|
static int32_t GetAllDevNums(char *accountHexHash, uint32_t *num, int32_t userId)
|
||||||
{
|
{
|
||||||
DeviceDbInfo *item = NULL;
|
DeviceDbInfo *item = NULL;
|
||||||
LIST_FOR_EACH_ENTRY(item, &g_deviceInfoList, DeviceDbInfo, node) {
|
LIST_FOR_EACH_ENTRY(item, &g_deviceInfoList, DeviceDbInfo, node) {
|
||||||
if (strcmp(accountHexHash, item->infoRecord.accountHexHash) == 0) {
|
if (strcmp(accountHexHash, item->infoRecord.accountHexHash) == 0 && item->infoRecord.userId == userId) {
|
||||||
(*num)++;
|
(*num)++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return SOFTBUS_OK;
|
return SOFTBUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t LnnGetTrustedDevInfoFromDb(char **udidArray, uint32_t *num)
|
static int32_t GenerateAccountHexHashWithUserId(char *accountHexHashAndUserId, int32_t *userId)
|
||||||
{
|
{
|
||||||
char accountHexHash[SHA_256_HEX_HASH_LEN] = {0};
|
char accountHexHash[SHA_256_HEX_HASH_LEN] = {0};
|
||||||
if (udidArray == NULL || num == NULL) {
|
*userId = GetActiveOsAccountIds();
|
||||||
return SOFTBUS_INVALID_PARAM;
|
|
||||||
}
|
|
||||||
if (GetLocalAccountHexHash(accountHexHash) != SOFTBUS_OK) {
|
if (GetLocalAccountHexHash(accountHexHash) != SOFTBUS_OK) {
|
||||||
LNN_LOGE(LNN_LEDGER, "get local account hash failed");
|
LNN_LOGE(LNN_LEDGER, "get local account hash failed");
|
||||||
return SOFTBUS_NETWORK_GET_NODE_INFO_ERR;
|
return SOFTBUS_NETWORK_GET_NODE_INFO_ERR;
|
||||||
}
|
}
|
||||||
|
if (sprintf_s(accountHexHashAndUserId, SHA_256_HEX_HASH_LEN + LNN_INT32_NUM_STR_MAX_LEN + 1,
|
||||||
|
"%s-%d", accountHexHash, *userId) < 0) {
|
||||||
|
LNN_LOGE(LNN_LEDGER, "sprintf_s fail");
|
||||||
|
return SOFTBUS_SPRINTF_ERR;
|
||||||
|
}
|
||||||
|
return SOFTBUS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t LnnGetTrustedDevInfoFromDb(char **udidArray, uint32_t *num)
|
||||||
|
{
|
||||||
|
char accountHexHashAndUserId[SHA_256_HEX_HASH_LEN + LNN_INT32_NUM_STR_MAX_LEN + 1] = {0};
|
||||||
|
int32_t userId = 0;
|
||||||
|
LNN_CHECK_AND_RETURN_RET_LOGE((udidArray != NULL) && (num != NULL), SOFTBUS_INVALID_PARAM, LNN_LEDGER,
|
||||||
|
"invalid param");
|
||||||
|
if (GenerateAccountHexHashWithUserId(accountHexHashAndUserId, &userId) != SOFTBUS_OK) {
|
||||||
|
return SOFTBUS_NETWORK_GET_NODE_INFO_ERR;
|
||||||
|
}
|
||||||
|
|
||||||
if (DeviceDbListLock() != SOFTBUS_OK) {
|
if (DeviceDbListLock() != SOFTBUS_OK) {
|
||||||
LNN_LOGE(LNN_LEDGER, "lock fail");
|
LNN_LOGE(LNN_LEDGER, "lock fail");
|
||||||
return SOFTBUS_LOCK_ERR;
|
return SOFTBUS_LOCK_ERR;
|
||||||
}
|
}
|
||||||
int32_t ret = GetAllDevNums(accountHexHash, num);
|
int32_t ret = GetAllDevNums(accountHexHashAndUserId, num, userId);
|
||||||
if (ret != SOFTBUS_OK) {
|
if (ret != SOFTBUS_OK) {
|
||||||
LNN_LOGE(LNN_LEDGER, "get all dev num fail");
|
LNN_LOGE(LNN_LEDGER, "get all dev num fail");
|
||||||
DeviceDbListUnlock();
|
DeviceDbListUnlock();
|
||||||
@ -611,7 +640,8 @@ int32_t LnnGetTrustedDevInfoFromDb(char **udidArray, uint32_t *num)
|
|||||||
if (cur >= *num) {
|
if (cur >= *num) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (strcmp(accountHexHash, item->infoRecord.accountHexHash) != 0) {
|
if (strcmp(accountHexHashAndUserId, item->infoRecord.accountHexHash) != 0 ||
|
||||||
|
item->infoRecord.userId != userId) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (strcpy_s(*udidArray + cur * UDID_BUF_LEN, UDID_BUF_LEN, item->infoRecord.udid) != EOK) {
|
if (strcpy_s(*udidArray + cur * UDID_BUF_LEN, UDID_BUF_LEN, item->infoRecord.udid) != EOK) {
|
||||||
@ -624,18 +654,13 @@ int32_t LnnGetTrustedDevInfoFromDb(char **udidArray, uint32_t *num)
|
|||||||
return SOFTBUS_OK;
|
return SOFTBUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t GetTrustedDevInfoFromDb(char **udidArray, uint32_t *num)
|
static int32_t GetTrustedDevInfoFromDb(char **udidArray, uint32_t *num, char *accountHexHash)
|
||||||
{
|
{
|
||||||
char accountHexHash[SHA_256_HEX_HASH_LEN] = {0};
|
|
||||||
DbContext *ctx = NULL;
|
DbContext *ctx = NULL;
|
||||||
|
|
||||||
if (udidArray == NULL || num == NULL) {
|
if (udidArray == NULL || num == NULL) {
|
||||||
return SOFTBUS_INVALID_PARAM;
|
return SOFTBUS_INVALID_PARAM;
|
||||||
}
|
}
|
||||||
if (GetLocalAccountHexHash(accountHexHash) != SOFTBUS_OK) {
|
|
||||||
LNN_LOGE(LNN_LEDGER, "get local account hash failed");
|
|
||||||
return SOFTBUS_NETWORK_GET_NODE_INFO_ERR;
|
|
||||||
}
|
|
||||||
if (DbLock() != SOFTBUS_OK) {
|
if (DbLock() != SOFTBUS_OK) {
|
||||||
LNN_LOGE(LNN_LEDGER, "lock fail");
|
LNN_LOGE(LNN_LEDGER, "lock fail");
|
||||||
return SOFTBUS_LOCK_ERR;
|
return SOFTBUS_LOCK_ERR;
|
||||||
@ -661,12 +686,11 @@ static int32_t GetTrustedDevInfoFromDb(char **udidArray, uint32_t *num)
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t RecoveryTrustedDevInfo(void)
|
static int32_t RecoveryTrustedDevInfoProcess(char *accountHexHash, int32_t activeUserId, bool oldData)
|
||||||
{
|
{
|
||||||
uint32_t num = 0;
|
uint32_t num = 0;
|
||||||
char *udidArray = NULL;
|
char *udidArray = NULL;
|
||||||
char accountHexHash[SHA_256_HEX_HASH_LEN] = {0};
|
if (GetTrustedDevInfoFromDb(&udidArray, &num, accountHexHash) != SOFTBUS_OK) {
|
||||||
if (GetTrustedDevInfoFromDb(&udidArray, &num) != SOFTBUS_OK) {
|
|
||||||
LNN_LOGE(LNN_LEDGER, "get trusted dev info fail");
|
LNN_LOGE(LNN_LEDGER, "get trusted dev info fail");
|
||||||
return SOFTBUS_NETWORK_GET_DEVICE_INFO_ERR;
|
return SOFTBUS_NETWORK_GET_DEVICE_INFO_ERR;
|
||||||
}
|
}
|
||||||
@ -675,10 +699,10 @@ static int32_t RecoveryTrustedDevInfo(void)
|
|||||||
LNN_LOGE(LNN_LEDGER, "get none trusted dev info");
|
LNN_LOGE(LNN_LEDGER, "get none trusted dev info");
|
||||||
return SOFTBUS_OK;
|
return SOFTBUS_OK;
|
||||||
}
|
}
|
||||||
if (GetLocalAccountHexHash(accountHexHash) != SOFTBUS_OK) {
|
if (oldData && sprintf_s(accountHexHash, SHA_256_HEX_HASH_LEN + LNN_INT32_NUM_STR_MAX_LEN + 1,
|
||||||
LNN_LOGE(LNN_LEDGER, "get local account hash failed");
|
"%s-%d", accountHexHash, activeUserId) < 0) {
|
||||||
SoftBusFree(udidArray);
|
LNN_LOGE(LNN_LEDGER, "sprintf_s fail");
|
||||||
return SOFTBUS_NETWORK_GET_NODE_INFO_ERR;
|
return SOFTBUS_STRCPY_ERR;
|
||||||
}
|
}
|
||||||
if (DeviceDbListLock() != SOFTBUS_OK) {
|
if (DeviceDbListLock() != SOFTBUS_OK) {
|
||||||
LNN_LOGE(LNN_LEDGER, "db lock fail");
|
LNN_LOGE(LNN_LEDGER, "db lock fail");
|
||||||
@ -694,14 +718,15 @@ static int32_t RecoveryTrustedDevInfo(void)
|
|||||||
}
|
}
|
||||||
if (memcpy_s(udidStr, UDID_BUF_LEN, udidArray + i * UDID_BUF_LEN, UDID_BUF_LEN) != EOK ||
|
if (memcpy_s(udidStr, UDID_BUF_LEN, udidArray + i * UDID_BUF_LEN, UDID_BUF_LEN) != EOK ||
|
||||||
memcpy_s(info->infoRecord.udid, UDID_BUF_LEN, udidStr, UDID_BUF_LEN) != EOK ||
|
memcpy_s(info->infoRecord.udid, UDID_BUF_LEN, udidStr, UDID_BUF_LEN) != EOK ||
|
||||||
memcpy_s(info->infoRecord.accountHexHash, SHA_256_HEX_HASH_LEN, accountHexHash,
|
memcpy_s(info->infoRecord.accountHexHash, SHA_256_HEX_HASH_LEN + LNN_INT32_NUM_STR_MAX_LEN + 1,
|
||||||
SHA_256_HEX_HASH_LEN) != EOK) {
|
accountHexHash, SHA_256_HEX_HASH_LEN + LNN_INT32_NUM_STR_MAX_LEN + 1) != EOK) {
|
||||||
LNN_LOGE(LNN_LEDGER, "udid str cpy fail.");
|
LNN_LOGE(LNN_LEDGER, "udid str cpy fail.");
|
||||||
DeviceDbListUnlock();
|
DeviceDbListUnlock();
|
||||||
SoftBusFree(info);
|
SoftBusFree(info);
|
||||||
SoftBusFree(udidArray);
|
SoftBusFree(udidArray);
|
||||||
return SOFTBUS_MEM_ERR;
|
return SOFTBUS_MEM_ERR;
|
||||||
}
|
}
|
||||||
|
info->infoRecord.userId = activeUserId;
|
||||||
ListNodeInsert(&g_deviceInfoList, &info->node);
|
ListNodeInsert(&g_deviceInfoList, &info->node);
|
||||||
}
|
}
|
||||||
DeviceDbListUnlock();
|
DeviceDbListUnlock();
|
||||||
@ -709,6 +734,33 @@ static int32_t RecoveryTrustedDevInfo(void)
|
|||||||
return SOFTBUS_OK;
|
return SOFTBUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int32_t RecoveryTrustedDevInfo(void)
|
||||||
|
{
|
||||||
|
char accountHexHash[SHA_256_HEX_HASH_LEN + LNN_INT32_NUM_STR_MAX_LEN + 1] = {0};
|
||||||
|
char tempAccountAccountHexHash[SHA_256_HEX_HASH_LEN + LNN_INT32_NUM_STR_MAX_LEN + 1] = {0};
|
||||||
|
if (GetLocalAccountHexHash(accountHexHash) != SOFTBUS_OK) {
|
||||||
|
LNN_LOGE(LNN_LEDGER, "get local account hash failed");
|
||||||
|
return SOFTBUS_NETWORK_GET_NODE_INFO_ERR;
|
||||||
|
}
|
||||||
|
if (strcpy_s(tempAccountAccountHexHash, SHA_256_HEX_HASH_LEN + LNN_INT32_NUM_STR_MAX_LEN + 1,
|
||||||
|
accountHexHash)!= EOK) {
|
||||||
|
LNN_LOGE(LNN_LEDGER, "strcpy fail");
|
||||||
|
return SOFTBUS_STRCPY_ERR;
|
||||||
|
}
|
||||||
|
RecoveryTrustedDevInfoProcess(accountHexHash, LNN_DEFAULT_USERID, true);
|
||||||
|
|
||||||
|
char accountHexHashAndUserId[SHA_256_HEX_HASH_LEN + LNN_INT32_NUM_STR_MAX_LEN + 1] = {0};
|
||||||
|
int32_t userId = GetActiveOsAccountIds();
|
||||||
|
LNN_LOGI(LNN_LEDGER, "activeUserId=%{public}d", userId);
|
||||||
|
if (sprintf_s(accountHexHashAndUserId, SHA_256_HEX_HASH_LEN + LNN_INT32_NUM_STR_MAX_LEN + 1,
|
||||||
|
"%s-%d", tempAccountAccountHexHash, userId) < 0) {
|
||||||
|
LNN_LOGE(LNN_LEDGER, "sprintf_s fail");
|
||||||
|
return SOFTBUS_SPRINTF_ERR;
|
||||||
|
}
|
||||||
|
RecoveryTrustedDevInfoProcess(accountHexHashAndUserId, userId, false);
|
||||||
|
return SOFTBUS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
static void ClearRecoveryDeviceList(void)
|
static void ClearRecoveryDeviceList(void)
|
||||||
{
|
{
|
||||||
if (DeviceDbListLock() != SOFTBUS_OK) {
|
if (DeviceDbListLock() != SOFTBUS_OK) {
|
||||||
|
@ -1221,7 +1221,6 @@ ReportCategory LnnAddOnlineNode(NodeInfo *info)
|
|||||||
SoftBusMutexUnlock(&g_distributedNetLedger.lock);
|
SoftBusMutexUnlock(&g_distributedNetLedger.lock);
|
||||||
NodeOnlineProc(info);
|
NodeOnlineProc(info);
|
||||||
UpdateDpSameAccount(info->accountId, info->deviceInfo.deviceUdid);
|
UpdateDpSameAccount(info->accountId, info->deviceInfo.deviceUdid);
|
||||||
CheckUserIdCheckSumChange(oldInfo, info);
|
|
||||||
if (infoAbility.isNetworkChanged) {
|
if (infoAbility.isNetworkChanged) {
|
||||||
UpdateNetworkInfo(info->deviceInfo.deviceUdid);
|
UpdateNetworkInfo(info->deviceInfo.deviceUdid);
|
||||||
}
|
}
|
||||||
|
@ -55,6 +55,7 @@ typedef enum {
|
|||||||
NOTIFY_NODE_STATUS_CHANGED,
|
NOTIFY_NODE_STATUS_CHANGED,
|
||||||
NOTIFY_NETWORKID_UPDATE,
|
NOTIFY_NETWORKID_UPDATE,
|
||||||
NOTIFY_LOCAL_NETWORKID_UPDATE,
|
NOTIFY_LOCAL_NETWORKID_UPDATE,
|
||||||
|
NOTIFY_DEVICE_TRUSTED_CHANGED,
|
||||||
} NotifyType;
|
} NotifyType;
|
||||||
|
|
||||||
#define NETWORK_ID_UPDATE_DELAY_TIME (60 * 60 * 1000 * 24) // 24 hour
|
#define NETWORK_ID_UPDATE_DELAY_TIME (60 * 60 * 1000 * 24) // 24 hour
|
||||||
@ -108,6 +109,17 @@ static void HandleOnlineStateChangedMessage(SoftBusMessage *msg)
|
|||||||
LnnDCProcessOnlineState(isOnline, (NodeBasicInfo *)msg->obj);
|
LnnDCProcessOnlineState(isOnline, (NodeBasicInfo *)msg->obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void HandleDeviceTrustedChangedMessage(SoftBusMessage *msg)
|
||||||
|
{
|
||||||
|
if (msg->obj == NULL) {
|
||||||
|
LNN_LOGE(LNN_EVENT, "invalid online state message");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int32_t type = (int32_t)msg->arg1;
|
||||||
|
uint32_t msgLen = (uint32_t)msg->arg2;
|
||||||
|
(void)LnnIpcNotifyDeviceTrustedChange(type, (const char*)msg->obj, msgLen);
|
||||||
|
}
|
||||||
|
|
||||||
static void HandleNodeBasicInfoChangedMessage(SoftBusMessage *msg)
|
static void HandleNodeBasicInfoChangedMessage(SoftBusMessage *msg)
|
||||||
{
|
{
|
||||||
if (msg->obj == NULL) {
|
if (msg->obj == NULL) {
|
||||||
@ -171,6 +183,9 @@ static void HandleNotifyMessage(SoftBusMessage *msg)
|
|||||||
case NOTIFY_NETWORKID_UPDATE:
|
case NOTIFY_NETWORKID_UPDATE:
|
||||||
HandleNetworkUpdateMessage(msg);
|
HandleNetworkUpdateMessage(msg);
|
||||||
break;
|
break;
|
||||||
|
case NOTIFY_DEVICE_TRUSTED_CHANGED:
|
||||||
|
HandleDeviceTrustedChangedMessage(msg);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
LNN_LOGE(LNN_EVENT, "unknown notify msgType=%{public}d", msg->what);
|
LNN_LOGE(LNN_EVENT, "unknown notify msgType=%{public}d", msg->what);
|
||||||
break;
|
break;
|
||||||
@ -267,6 +282,47 @@ static int32_t PostNotifyNodeStatusMessage(int32_t what, uint64_t arg, const Nod
|
|||||||
return PostMessageToHandlerDelay(msg, 0);
|
return PostMessageToHandlerDelay(msg, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char *DupDeviceTrustedChangeMsg(const char *msg)
|
||||||
|
{
|
||||||
|
if (msg == NULL) {
|
||||||
|
LNN_LOGW(LNN_EVENT, "msg is null");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
int32_t len = strlen(msg) + 1;
|
||||||
|
char *dupMsg = SoftBusCalloc(len);
|
||||||
|
if (dupMsg == NULL) {
|
||||||
|
LNN_LOGE(LNN_EVENT, "malloc dupMsg err");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
if (strcpy_s(dupMsg, len, msg) != EOK) {
|
||||||
|
LNN_LOGE(LNN_EVENT, "copy dupMsg fail");
|
||||||
|
SoftBusFree(dupMsg);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return dupMsg;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int32_t PostNotifyDeviceTrustedChangeMessage(int32_t what, int32_t type, const char *notifyMsg, uint32_t msgLen)
|
||||||
|
{
|
||||||
|
SoftBusMessage *msg = SoftBusCalloc(sizeof(SoftBusMessage));
|
||||||
|
if (msg == NULL) {
|
||||||
|
LNN_LOGE(LNN_EVENT, "malloc msg err");
|
||||||
|
return SOFTBUS_MALLOC_ERR;
|
||||||
|
}
|
||||||
|
msg->what = what;
|
||||||
|
msg->arg1 = (uint64_t)type;
|
||||||
|
msg->arg2 = (uint64_t)msgLen;
|
||||||
|
msg->obj = DupDeviceTrustedChangeMsg(notifyMsg);
|
||||||
|
if (msg->obj == NULL) {
|
||||||
|
LNN_LOGE(LNN_EVENT, "dup notifyMsg err");
|
||||||
|
SoftBusFree(msg);
|
||||||
|
return SOFTBUS_MEM_ERR;
|
||||||
|
}
|
||||||
|
msg->handler = &g_notifyHandler;
|
||||||
|
msg->FreeMessage = FreeNotifyMessage;
|
||||||
|
return PostMessageToHandlerDelay(msg, 0);
|
||||||
|
}
|
||||||
|
|
||||||
static int32_t PostNotifyMessageDelay(int32_t what, uint64_t delayMillis)
|
static int32_t PostNotifyMessageDelay(int32_t what, uint64_t delayMillis)
|
||||||
{
|
{
|
||||||
SoftBusMessage *msg = SoftBusCalloc(sizeof(SoftBusMessage));
|
SoftBusMessage *msg = SoftBusCalloc(sizeof(SoftBusMessage));
|
||||||
@ -452,11 +508,11 @@ void LnnNotifyLocalNetworkIdChanged(void)
|
|||||||
|
|
||||||
void LnnNotifyDeviceTrustedChange(int32_t type, const char *msg, uint32_t msgLen)
|
void LnnNotifyDeviceTrustedChange(int32_t type, const char *msg, uint32_t msgLen)
|
||||||
{
|
{
|
||||||
if (msg == NULL) {
|
if (msg == NULL || msgLen == 0) {
|
||||||
LNN_LOGE(LNN_EVENT, "msg is null");
|
LNN_LOGE(LNN_EVENT, "msg is null");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
(void)LnnIpcNotifyDeviceTrustedChange(type, msg, msgLen);
|
PostNotifyDeviceTrustedChangeMessage(NOTIFY_DEVICE_TRUSTED_CHANGED, type, msg, msgLen);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LnnNotifyHichainProofException(
|
void LnnNotifyHichainProofException(
|
||||||
|
@ -35,6 +35,8 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define DATABASE_NAME DEFAULT_STORAGE_PATH"/dsoftbus/dsoftbus.db3"
|
#define DATABASE_NAME DEFAULT_STORAGE_PATH"/dsoftbus/dsoftbus.db3"
|
||||||
|
#define LNN_DEFAULT_USERID 100
|
||||||
|
#define LNN_INT32_NUM_STR_MAX_LEN 11
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
sqlite3 *db;
|
sqlite3 *db;
|
||||||
@ -48,8 +50,9 @@ typedef enum {
|
|||||||
} TableNameID;
|
} TableNameID;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char accountHexHash[SHA_256_HEX_HASH_LEN];
|
char accountHexHash[SHA_256_HEX_HASH_LEN + LNN_INT32_NUM_STR_MAX_LEN + 1];
|
||||||
char udid[UDID_BUF_LEN];
|
char udid[UDID_BUF_LEN];
|
||||||
|
int32_t userId;
|
||||||
} TrustedDevInfoRecord;
|
} TrustedDevInfoRecord;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@ -885,6 +885,7 @@ ohos_unittest("AuthDeviceProfileListenerTest") {
|
|||||||
module_out_path = module_output_path
|
module_out_path = module_output_path
|
||||||
sources = [
|
sources = [
|
||||||
"$dsoftbus_root_path/core/authentication/bind/auth_device_profile_listener.cpp",
|
"$dsoftbus_root_path/core/authentication/bind/auth_device_profile_listener.cpp",
|
||||||
|
"$dsoftbus_root_path/core/bus_center/lnn/lane_hub/heartbeat/src/lnn_heartbeat_ctrl_virtual.c",
|
||||||
"unittest/auth_device_profile_listener_mock.cpp",
|
"unittest/auth_device_profile_listener_mock.cpp",
|
||||||
"unittest/auth_device_profile_listener_test.cpp",
|
"unittest/auth_device_profile_listener_test.cpp",
|
||||||
]
|
]
|
||||||
|
@ -41,11 +41,6 @@ void DelNotTrustDevice(const char *udid)
|
|||||||
return GetInterface()->DelNotTrustDevice(udid);
|
return GetInterface()->DelNotTrustDevice(udid);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsHeartbeatEnable(void)
|
|
||||||
{
|
|
||||||
return GetInterface()->IsHeartbeatEnable();
|
|
||||||
}
|
|
||||||
|
|
||||||
void RestartCoapDiscovery(void)
|
void RestartCoapDiscovery(void)
|
||||||
{
|
{
|
||||||
return GetInterface()->RestartCoapDiscovery();
|
return GetInterface()->RestartCoapDiscovery();
|
||||||
|
@ -26,7 +26,6 @@ public:
|
|||||||
AuthDeviceProfileListenerInterface() {};
|
AuthDeviceProfileListenerInterface() {};
|
||||||
virtual ~AuthDeviceProfileListenerInterface() {};
|
virtual ~AuthDeviceProfileListenerInterface() {};
|
||||||
virtual void DelNotTrustDevice(const char *udid) = 0;
|
virtual void DelNotTrustDevice(const char *udid) = 0;
|
||||||
virtual bool IsHeartbeatEnable(void) = 0;
|
|
||||||
virtual void RestartCoapDiscovery(void) = 0;
|
virtual void RestartCoapDiscovery(void) = 0;
|
||||||
virtual int32_t LnnStartHbByTypeAndStrategy(
|
virtual int32_t LnnStartHbByTypeAndStrategy(
|
||||||
LnnHeartbeatType hbType, LnnHeartbeatStrategyType strategyType, bool isRelay) = 0;
|
LnnHeartbeatType hbType, LnnHeartbeatStrategyType strategyType, bool isRelay) = 0;
|
||||||
@ -38,7 +37,6 @@ public:
|
|||||||
AuthDeviceProfileListenerInterfaceMock();
|
AuthDeviceProfileListenerInterfaceMock();
|
||||||
~AuthDeviceProfileListenerInterfaceMock() override;
|
~AuthDeviceProfileListenerInterfaceMock() override;
|
||||||
MOCK_METHOD1(DelNotTrustDevice, void (const char *udid));
|
MOCK_METHOD1(DelNotTrustDevice, void (const char *udid));
|
||||||
MOCK_METHOD0(IsHeartbeatEnable, bool());
|
|
||||||
MOCK_METHOD0(RestartCoapDiscovery, void(void));
|
MOCK_METHOD0(RestartCoapDiscovery, void(void));
|
||||||
MOCK_METHOD3(LnnStartHbByTypeAndStrategy, int32_t(LnnHeartbeatType, LnnHeartbeatStrategyType, bool));
|
MOCK_METHOD3(LnnStartHbByTypeAndStrategy, int32_t(LnnHeartbeatType, LnnHeartbeatStrategyType, bool));
|
||||||
MOCK_METHOD1(LnnUpdateOhosAccount, void (bool));
|
MOCK_METHOD1(LnnUpdateOhosAccount, void (bool));
|
||||||
|
@ -47,6 +47,7 @@ public:
|
|||||||
virtual int32_t LnnUpdateNetworkId(const NodeInfo *newInfo) = 0;
|
virtual int32_t LnnUpdateNetworkId(const NodeInfo *newInfo) = 0;
|
||||||
virtual int32_t AuthGetServerSide(int64_t authId, bool *isServer) = 0;
|
virtual int32_t AuthGetServerSide(int64_t authId, bool *isServer) = 0;
|
||||||
virtual int32_t LnnRetrieveDeviceInfo(const char *udid, NodeInfo *deviceInfo) = 0;
|
virtual int32_t LnnRetrieveDeviceInfo(const char *udid, NodeInfo *deviceInfo) = 0;
|
||||||
|
virtual int32_t LnnRetrieveDeviceInfoByNetworkId(const char *networkId, NodeInfo *info) = 0;
|
||||||
virtual int32_t AuthRestoreAuthManager(const char *udidHash, const AuthConnInfo *connInfo, uint32_t requestId,
|
virtual int32_t AuthRestoreAuthManager(const char *udidHash, const AuthConnInfo *connInfo, uint32_t requestId,
|
||||||
NodeInfo *nodeInfo, int64_t *authId) = 0;
|
NodeInfo *nodeInfo, int64_t *authId) = 0;
|
||||||
virtual int32_t LnnLoadLocalBroadcastCipherKey(void) = 0;
|
virtual int32_t LnnLoadLocalBroadcastCipherKey(void) = 0;
|
||||||
@ -64,6 +65,7 @@ public:
|
|||||||
virtual void LnnNotifyOOBEStateChangeEvent(SoftBusOOBEState state) = 0;
|
virtual void LnnNotifyOOBEStateChangeEvent(SoftBusOOBEState state) = 0;
|
||||||
virtual void LnnNotifyHichainProofException(
|
virtual void LnnNotifyHichainProofException(
|
||||||
const char *proofInfo, uint32_t proofLen, uint16_t deviceTypeId, int32_t errCode) = 0;
|
const char *proofInfo, uint32_t proofLen, uint16_t deviceTypeId, int32_t errCode) = 0;
|
||||||
|
virtual void LnnNotifyDeviceTrustedChange(int32_t type, const char *msg, uint32_t msgLen) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class LnnConnFsmInterfaceMock : public LnnConnFsmInterface {
|
class LnnConnFsmInterfaceMock : public LnnConnFsmInterface {
|
||||||
@ -78,6 +80,7 @@ public:
|
|||||||
MOCK_METHOD1(LnnUpdateNetworkId, int32_t (const NodeInfo *));
|
MOCK_METHOD1(LnnUpdateNetworkId, int32_t (const NodeInfo *));
|
||||||
MOCK_METHOD2(AuthGetServerSide, int32_t (int64_t, bool *));
|
MOCK_METHOD2(AuthGetServerSide, int32_t (int64_t, bool *));
|
||||||
MOCK_METHOD2(LnnRetrieveDeviceInfo, int32_t (const char *, NodeInfo *));
|
MOCK_METHOD2(LnnRetrieveDeviceInfo, int32_t (const char *, NodeInfo *));
|
||||||
|
MOCK_METHOD2(LnnRetrieveDeviceInfoByNetworkId, int32_t (const char *, NodeInfo *));
|
||||||
MOCK_METHOD5(AuthRestoreAuthManager, int32_t (const char *, const AuthConnInfo *, uint32_t, NodeInfo *,
|
MOCK_METHOD5(AuthRestoreAuthManager, int32_t (const char *, const AuthConnInfo *, uint32_t, NodeInfo *,
|
||||||
int64_t *));
|
int64_t *));
|
||||||
MOCK_METHOD0(LnnLoadLocalBroadcastCipherKey, int32_t (void));
|
MOCK_METHOD0(LnnLoadLocalBroadcastCipherKey, int32_t (void));
|
||||||
@ -94,6 +97,7 @@ public:
|
|||||||
MOCK_METHOD1(LnnConvAddrTypeToDiscType, DiscoveryType (ConnectionAddrType));
|
MOCK_METHOD1(LnnConvAddrTypeToDiscType, DiscoveryType (ConnectionAddrType));
|
||||||
MOCK_METHOD1(LnnNotifyOOBEStateChangeEvent, void (SoftBusOOBEState));
|
MOCK_METHOD1(LnnNotifyOOBEStateChangeEvent, void (SoftBusOOBEState));
|
||||||
MOCK_METHOD4(LnnNotifyHichainProofException, void(const char *, uint32_t, uint16_t, int32_t));
|
MOCK_METHOD4(LnnNotifyHichainProofException, void(const char *, uint32_t, uint16_t, int32_t));
|
||||||
|
MOCK_METHOD3(LnnNotifyDeviceTrustedChange, void(int32_t type, const char *msg, uint32_t msgLen));
|
||||||
};
|
};
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
#endif // LNN_CONNECTION_FSM_MOCK_H
|
#endif // LNN_CONNECTION_FSM_MOCK_H
|
||||||
|
@ -76,6 +76,11 @@ int32_t LnnRetrieveDeviceInfo(const char *udid, NodeInfo *deviceInfo)
|
|||||||
return GetLnnConnInterface()->LnnRetrieveDeviceInfo(udid, deviceInfo);
|
return GetLnnConnInterface()->LnnRetrieveDeviceInfo(udid, deviceInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t LnnRetrieveDeviceInfoByNetworkId(const char *networkId, NodeInfo *info)
|
||||||
|
{
|
||||||
|
return GetLnnConnInterface()->LnnRetrieveDeviceInfo(networkId, info);
|
||||||
|
}
|
||||||
|
|
||||||
int32_t AuthRestoreAuthManager(const char *udidHash, const AuthConnInfo *connInfo, uint32_t requestId,
|
int32_t AuthRestoreAuthManager(const char *udidHash, const AuthConnInfo *connInfo, uint32_t requestId,
|
||||||
NodeInfo *nodeInfo, int64_t *authId)
|
NodeInfo *nodeInfo, int64_t *authId)
|
||||||
{
|
{
|
||||||
@ -152,5 +157,10 @@ void LnnNotifyHichainProofException(
|
|||||||
{
|
{
|
||||||
return GetLnnConnInterface()->LnnNotifyHichainProofException(proofInfo, proofLen, deviceTypeId, errCode);
|
return GetLnnConnInterface()->LnnNotifyHichainProofException(proofInfo, proofLen, deviceTypeId, errCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LnnNotifyDeviceTrustedChange(int32_t type, const char *msg, uint32_t msgLen)
|
||||||
|
{
|
||||||
|
return GetLnnConnInterface()->LnnNotifyDeviceTrustedChange(type, msg, msgLen);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
|
Loading…
Reference in New Issue
Block a user