mirror of
https://gitee.com/openharmony/communication_dsoftbus
synced 2024-11-23 16:59:54 +00:00
!8147 fix: Use the deviceList to report the event recovery
Merge pull request !8147 from xingchu/master
This commit is contained in:
commit
ce323aaad3
@ -30,15 +30,6 @@ extern "C" {
|
||||
#define GROUP_TYPE_MESH (1 << 2)
|
||||
#define GROUP_TYPE_COMPATIBLE (1 << 3)
|
||||
|
||||
#define SOFTBUS_AUTH_HICHAIN_LOCAL_IDENTITY_NOT_EXIST \
|
||||
(-(((SOFTBUS_SUB_SYSTEM) << 21) | ((AUTH_SUB_MODULE_CODE) << 16) | (0x040C)))
|
||||
#define SOFTBUS_AUTH_HICHAIN_GROUP_NOT_EXIST \
|
||||
(-(((SOFTBUS_SUB_SYSTEM) << 21) | ((AUTH_SUB_MODULE_CODE) << 16) | (0x0607)))
|
||||
#define SOFTBUS_AUTH_HICHAIN_NO_CANDIDATE_GROUP \
|
||||
(-(((SOFTBUS_SUB_SYSTEM) << 21) | ((AUTH_SUB_MODULE_CODE) << 16) | (0x0504)))
|
||||
#define SOFTBUS_AUTH_HICHAIN_PROOF_MISMATCH \
|
||||
(-(((SOFTBUS_SUB_SYSTEM) << 21) | ((AUTH_SUB_MODULE_CODE) << 16) | (0x100D)))
|
||||
|
||||
typedef struct {
|
||||
void (*onGroupCreated)(const char *groupId, int32_t groupType);
|
||||
void (*onGroupDeleted)(const char *groupId, int32_t groupType);
|
||||
|
@ -167,15 +167,30 @@ void GetSoftbusHichainAuthErrorCode(uint32_t hichainErrCode, uint32_t *softbusEr
|
||||
}
|
||||
}
|
||||
|
||||
static int32_t CheckErrReturnValidity(const char *errorReturn)
|
||||
{
|
||||
cJSON *json = cJSON_Parse(errorReturn);
|
||||
if (json == NULL || !cJSON_IsString(json)) {
|
||||
AUTH_LOGE(AUTH_HICHAIN, "parse json fail");
|
||||
cJSON_Delete(json);
|
||||
return SOFTBUS_PARSE_JSON_ERR;
|
||||
}
|
||||
cJSON_Delete(json);
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
|
||||
static void OnError(int64_t authSeq, int operationCode, int errCode, const char *errorReturn)
|
||||
{
|
||||
(void)operationCode;
|
||||
(void)errorReturn;
|
||||
DfxRecordLnnEndHichainEnd(authSeq, errCode);
|
||||
uint32_t authErrCode = 0;
|
||||
(void)GetSoftbusHichainAuthErrorCode((uint32_t)errCode, &authErrCode);
|
||||
AUTH_LOGE(AUTH_HICHAIN, "hichain OnError: authSeq=%{public}" PRId64 ", errCode=%{public}d authErrCode=%{public}d",
|
||||
authSeq, errCode, authErrCode);
|
||||
if (errorReturn != NULL && CheckErrReturnValidity(errorReturn) == SOFTBUS_OK) {
|
||||
uint32_t errorReturnLen = strlen(errorReturn);
|
||||
(void)AuthFailNotifyDeviceList(errCode, errorReturn, errorReturnLen);
|
||||
}
|
||||
(void)AuthSessionHandleAuthError(authSeq, authErrCode);
|
||||
}
|
||||
|
||||
@ -247,15 +262,14 @@ static void DeletePcRestrictNode(const char *udid)
|
||||
{
|
||||
char peerUdidHash[HB_SHORT_UDID_HASH_HEX_LEN + 1] = { 0 };
|
||||
uint32_t count = 0;
|
||||
char *anonyUdid = NULL;
|
||||
Anonymize(udid, &anonyUdid);
|
||||
|
||||
if (GetUdidHash(udid, peerUdidHash) == SOFTBUS_OK &&
|
||||
GetNodeFromPcRestrictMap(peerUdidHash, &count) == SOFTBUS_OK) {
|
||||
if (GetUdidHash(udid, peerUdidHash) == SOFTBUS_OK && GetNodeFromPcRestrictMap(peerUdidHash, &count) == SOFTBUS_OK) {
|
||||
DeleteNodeFromPcRestrictMap(peerUdidHash);
|
||||
char *anonyUdid = NULL;
|
||||
Anonymize(udid, &anonyUdid);
|
||||
AUTH_LOGI(AUTH_HICHAIN, "delete restrict node success. udid=%{public}s", AnonymizeWrapper(anonyUdid));
|
||||
AnonymizeFree(anonyUdid);
|
||||
}
|
||||
AnonymizeFree(anonyUdid);
|
||||
}
|
||||
|
||||
static int32_t ParseGroupInfo(const char *groupInfoStr, GroupInfo *groupInfo)
|
||||
|
@ -39,7 +39,6 @@
|
||||
#include "lnn_event.h"
|
||||
#include "lnn_feature_capability.h"
|
||||
#include "lnn_net_builder.h"
|
||||
#include "lnn_net_builder_process.h"
|
||||
#include "softbus_adapter_hitrace.h"
|
||||
#include "softbus_adapter_mem.h"
|
||||
#include "softbus_adapter_socket.h"
|
||||
@ -983,29 +982,12 @@ void AuthManagerSetAuthPassed(int64_t authSeq, const AuthSessionInfo *info)
|
||||
NotifyAuthResult(authHandle, info);
|
||||
}
|
||||
|
||||
static void GetPeerUdid(const AuthSessionInfo *info, int32_t reason)
|
||||
{
|
||||
if (reason == SOFTBUS_AUTH_HICHAIN_NO_CANDIDATE_GROUP || reason == SOFTBUS_AUTH_HICHAIN_PROOF_MISMATCH) {
|
||||
LnnConnectionFsm *connFsm = FindConnectionFsmByRequestId(info->requestId);
|
||||
if (connFsm == NULL || connFsm->isDead) {
|
||||
AUTH_LOGE(AUTH_FSM, "can not find connection fsm. requestId=%{public}u", info->requestId);
|
||||
return;
|
||||
}
|
||||
AUTH_LOGI(AUTH_FSM, "find connFsm success");
|
||||
if (strcpy_s(connFsm->connInfo.infoReport.peerUdid, UDID_BUF_LEN, info->udid) != EOK) {
|
||||
AUTH_LOGE(AUTH_FSM, "strcpy_s udid fail");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AuthManagerSetAuthFailed(int64_t authSeq, const AuthSessionInfo *info, int32_t reason)
|
||||
{
|
||||
AUTH_CHECK_AND_RETURN_LOGE(info != NULL, AUTH_FSM, "auth session info is null");
|
||||
AUTH_CHECK_AND_RETURN_LOGE(CheckAuthConnInfoType(&info->connInfo), AUTH_FSM, "connInfo type error");
|
||||
AUTH_LOGE(AUTH_FSM, "SetAuthFailed: authSeq=%{public}" PRId64 ", requestId=%{public}u, reason=%{public}d", authSeq,
|
||||
info->requestId, reason);
|
||||
GetPeerUdid(info, reason);
|
||||
AuthManager *auth = NULL;
|
||||
if (info->isSavedSessionKey) {
|
||||
int64_t authId = GetAuthIdByConnId(info->connId, info->isServer);
|
||||
|
@ -57,7 +57,7 @@ int32_t LnnIpcNotifyNodeStatusChanged(void *info, uint32_t infoTypeLen, int32_t
|
||||
int32_t LnnIpcLocalNetworkIdChanged(void);
|
||||
int32_t LnnIpcNotifyDeviceTrustedChange(int32_t type, const char *msg, uint32_t msgLen);
|
||||
int32_t LnnIpcNotifyHichainProofException(
|
||||
const char *deviceId, uint32_t deviceIdLen, uint16_t deviceTypeId, int32_t errCode);
|
||||
const char *deviceList, uint32_t deviceListLen, uint16_t deviceTypeId, int32_t errCode);
|
||||
int32_t LnnIpcNotifyTimeSyncResult(
|
||||
const char *pkgName, int32_t pid, const void *info, uint32_t infoTypeLen, int32_t retCode);
|
||||
|
||||
|
@ -210,10 +210,10 @@ int32_t LnnIpcNotifyDeviceTrustedChange(int32_t type, const char *msg, uint32_t
|
||||
}
|
||||
|
||||
int32_t LnnIpcNotifyHichainProofException(
|
||||
const char *deviceId, uint32_t deviceIdLen, uint16_t deviceTypeId, int32_t errCode)
|
||||
const char *deviceList, uint32_t deviceListLen, uint16_t deviceTypeId, int32_t errCode)
|
||||
{
|
||||
(void)deviceId;
|
||||
(void)deviceIdLen;
|
||||
(void)deviceList;
|
||||
(void)deviceListLen;
|
||||
(void)deviceTypeId;
|
||||
(void)errCode;
|
||||
LNN_LOGI(LNN_EVENT, "not implement");
|
||||
|
@ -469,10 +469,10 @@ int32_t LnnIpcNotifyDeviceTrustedChange(int32_t type, const char *msg, uint32_t
|
||||
}
|
||||
|
||||
int32_t LnnIpcNotifyHichainProofException(
|
||||
const char *deviceId, uint32_t deviceIdLen, uint16_t deviceTypeId, int32_t errCode)
|
||||
const char *deviceList, uint32_t deviceListLen, uint16_t deviceTypeId, int32_t errCode)
|
||||
{
|
||||
(void)deviceId;
|
||||
(void)deviceIdLen;
|
||||
(void)deviceList;
|
||||
(void)deviceListLen;
|
||||
(void)deviceTypeId;
|
||||
(void)errCode;
|
||||
LNN_LOGI(LNN_EVENT, "not implement");
|
||||
|
@ -42,7 +42,7 @@ int32_t ClientOnNodeStatusChanged(void *info, uint32_t infoTypeLen, int32_t type
|
||||
int32_t ClinetOnLocalNetworkIdChanged(void);
|
||||
int32_t ClinetNotifyDeviceTrustedChange(int32_t type, const char *msg, uint32_t msgLen);
|
||||
int32_t ClientNotifyHichainProofException(
|
||||
const char *deviceId, uint32_t deviceIdLen, uint16_t deviceTypeId, int32_t errCode);
|
||||
const char *deviceList, uint32_t deviceListLen, uint16_t deviceTypeId, int32_t errCode);
|
||||
int32_t ClientOnTimeSyncResult(
|
||||
const char *pkgName, int32_t pid, const void *info, uint32_t infoTypeLen, int32_t retCode);
|
||||
int32_t ClientOnPublishLNNResult(const char *pkgName, int32_t pid, int32_t publishId, int32_t reason);
|
||||
|
@ -44,7 +44,7 @@ public:
|
||||
int32_t OnNodeStatusChanged(const char *pkgName, void *info, uint32_t infoTypeLen, int32_t type) override;
|
||||
int32_t OnLocalNetworkIdChanged(const char *pkgName) override;
|
||||
int32_t OnNodeDeviceTrustedChange(const char *pkgName, int32_t type, const char *msg, uint32_t msgLen) override;
|
||||
int32_t OnHichainProofException(const char *pkgName, const char *deviceId, uint32_t deviceIdLen,
|
||||
int32_t OnHichainProofException(const char *pkgName, const char *deviceList, uint32_t deviceListLen,
|
||||
uint16_t deviceTypeId, int32_t errCode) override;
|
||||
int32_t OnTimeSyncResult(const void *info, uint32_t infoTypeLen, int32_t retCode) override;
|
||||
void OnPublishLNNResult(int32_t publishId, int32_t reason) override;
|
||||
|
@ -126,7 +126,7 @@ int32_t ClinetNotifyDeviceTrustedChange(int32_t type, const char *msg, uint32_t
|
||||
}
|
||||
|
||||
int32_t ClientNotifyHichainProofException(
|
||||
const char *deviceId, uint32_t deviceIdLen, uint16_t deviceTypeId, int32_t errCode)
|
||||
const char *deviceList, uint32_t deviceListLen, uint16_t deviceTypeId, int32_t errCode)
|
||||
{
|
||||
std::multimap<std::string, sptr<IRemoteObject>> proxyMap;
|
||||
SoftbusClientInfoManager::GetInstance().GetSoftbusClientProxyMap(proxyMap);
|
||||
@ -140,7 +140,7 @@ int32_t ClientNotifyHichainProofException(
|
||||
LNN_LOGE(LNN_EVENT, "bus center client proxy is nullptr");
|
||||
return SOFTBUS_ERR;
|
||||
}
|
||||
clientProxy->OnHichainProofException(proxy.first.c_str(), deviceId, deviceIdLen, deviceTypeId, errCode);
|
||||
clientProxy->OnHichainProofException(proxy.first.c_str(), deviceList, deviceListLen, deviceTypeId, errCode);
|
||||
}
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
|
@ -439,9 +439,9 @@ int32_t BusCenterClientProxy::OnNodeDeviceTrustedChange(const char *pkgName, int
|
||||
}
|
||||
|
||||
int32_t BusCenterClientProxy::OnHichainProofException(
|
||||
const char *pkgName, const char *deviceId, uint32_t deviceIdLen, uint16_t deviceTypeId, int32_t errCode)
|
||||
const char *pkgName, const char *deviceList, uint32_t deviceListLen, uint16_t deviceTypeId, int32_t errCode)
|
||||
{
|
||||
if (pkgName == nullptr || deviceId == nullptr || deviceIdLen != UDID_BUF_LEN) {
|
||||
if (pkgName == nullptr) {
|
||||
LNN_LOGE(LNN_EVENT, "invalid parameters");
|
||||
return SOFTBUS_INVALID_PARAM;
|
||||
}
|
||||
@ -459,12 +459,12 @@ int32_t BusCenterClientProxy::OnHichainProofException(
|
||||
LNN_LOGE(LNN_EVENT, "write pkgName failed");
|
||||
return SOFTBUS_IPC_ERR;
|
||||
}
|
||||
if (!data.WriteUint32(deviceIdLen)) {
|
||||
LNN_LOGE(LNN_EVENT, "write deviceId length failed");
|
||||
if (!data.WriteUint32(deviceListLen)) {
|
||||
LNN_LOGE(LNN_EVENT, "write deviceList length failed");
|
||||
return SOFTBUS_IPC_ERR;
|
||||
}
|
||||
if (!data.WriteRawData(deviceId, deviceIdLen)) {
|
||||
LNN_LOGE(LNN_EVENT, "write deviceId failed");
|
||||
if (deviceList != NULL && deviceListLen != 0 && !data.WriteRawData(deviceList, deviceListLen)) {
|
||||
LNN_LOGE(LNN_EVENT, "write deviceList failed");
|
||||
return SOFTBUS_IPC_ERR;
|
||||
}
|
||||
if (!data.WriteUint16(deviceTypeId)) {
|
||||
|
@ -508,9 +508,9 @@ int32_t LnnIpcNotifyDeviceTrustedChange(int32_t type, const char *msg, uint32_t
|
||||
}
|
||||
|
||||
int32_t LnnIpcNotifyHichainProofException(
|
||||
const char *deviceId, uint32_t deviceIdLen, uint16_t deviceTypeId, int32_t errCode)
|
||||
const char *deviceList, uint32_t deviceListLen, uint16_t deviceTypeId, int32_t errCode)
|
||||
{
|
||||
return ClientNotifyHichainProofException(deviceId, deviceIdLen, deviceTypeId, errCode);
|
||||
return ClientNotifyHichainProofException(deviceList, deviceListLen, deviceTypeId, errCode);
|
||||
}
|
||||
|
||||
int32_t LnnIpcNotifyTimeSyncResult(const char *pkgName, int32_t pid, const void *info,
|
||||
|
@ -205,6 +205,7 @@ void DeleteNodeFromPcRestrictMap(const char *udidHash);
|
||||
int32_t GetNodeFromPcRestrictMap(const char *udidHash, uint32_t *count);
|
||||
int32_t UpdateNodeFromPcRestrictMap(const char *udidHash);
|
||||
int32_t JoinLnnWithNodeInfo(ConnectionAddr *addr, NodeInfo *info);
|
||||
int32_t AuthFailNotifyDeviceList(int32_t errCode, const char *errorReturn, uint32_t listLen);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -766,19 +766,13 @@ static void GetConnectOnlineReason(LnnConntionInfo *connInfo, uint32_t *connOnli
|
||||
*connOnlineReason, connectReason, peerReason, localReason);
|
||||
}
|
||||
|
||||
static void NotifyProofExceptionEvent(const LnnConntionInfo *connInfo, int32_t reason, const char *peerDeviceType)
|
||||
static void NotifyProofExceptionEvent(DeviceType type, int32_t reason, const char *peerDeviceType)
|
||||
{
|
||||
if ((reason == SOFTBUS_AUTH_HICHAIN_NO_CANDIDATE_GROUP || reason == SOFTBUS_AUTH_HICHAIN_PROOF_MISMATCH) &&
|
||||
(strncmp(peerDeviceType, PC_DEV_TYPE, strlen(PC_DEV_TYPE)) == 0)) {
|
||||
LnnNotifyHichainProofException(
|
||||
connInfo->infoReport.peerUdid, UDID_BUF_LEN, (uint16_t)connInfo->infoReport.type, reason);
|
||||
|
||||
char *anonyUdid = NULL;
|
||||
Anonymize(connInfo->infoReport.peerUdid, &anonyUdid);
|
||||
LNN_LOGE(LNN_BUILDER,
|
||||
"notify hichain proof exception event, udid=%{public}s, reason=%{public}d, type=%{public}hu",
|
||||
AnonymizeWrapper(anonyUdid), reason, (uint16_t)connInfo->infoReport.type);
|
||||
AnonymizeFree(anonyUdid);
|
||||
LnnNotifyHichainProofException(NULL, 0, (uint16_t)type, reason);
|
||||
LNN_LOGE(LNN_BUILDER, "notify hichain proof exception event, reason=%{public}d, type=%{public}hu", reason,
|
||||
(uint16_t)type);
|
||||
}
|
||||
}
|
||||
|
||||
@ -808,7 +802,7 @@ static void DfxRecordLnnAddOnlineNodeEnd(LnnConntionInfo *connInfo, int32_t onli
|
||||
extra.localDeviceType = dfxConnectInfo.localDeviceType;
|
||||
extra.peerDeviceType = dfxConnectInfo.peerDeviceType;
|
||||
extra.connOnlineReason = connOnlineReason;
|
||||
NotifyProofExceptionEvent(connInfo, reason, extra.peerDeviceType);
|
||||
NotifyProofExceptionEvent(connInfo->infoReport.type, reason, extra.peerDeviceType);
|
||||
if (connInfo->nodeInfo == NULL) {
|
||||
DfxReportOnlineEvent(connInfo, reason, extra);
|
||||
return;
|
||||
|
@ -76,6 +76,9 @@
|
||||
#define SHORT_UDID_HASH_STR_LEN 16
|
||||
#define DEFAULT_PKG_NAME "com.huawei.nearby"
|
||||
#define WAIT_SEND_NOT_TRUST_MSG 200
|
||||
#define DEVICE_LIST_MAX_LEN (2 * 1024)
|
||||
#define PC_DEVICE_TYPE_ID 12
|
||||
#define PC_AUTH_ERRCODE 36870
|
||||
|
||||
static NetBuilder g_netBuilder;
|
||||
static bool g_watchdogFlag = true;
|
||||
@ -1569,3 +1572,14 @@ int32_t UpdateNodeFromPcRestrictMap(const char *udidHash)
|
||||
AnonymizeFree(anonyUdid);
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
|
||||
int32_t AuthFailNotifyDeviceList(int32_t errCode, const char *errorReturn, uint32_t listLen)
|
||||
{
|
||||
if (errCode == PC_AUTH_ERRCODE && listLen != 0 && listLen < DEVICE_LIST_MAX_LEN) {
|
||||
LnnNotifyHichainProofException(errorReturn, listLen + 1, PC_DEVICE_TYPE_ID, errCode);
|
||||
LNN_LOGI(LNN_BUILDER,
|
||||
"notify hichain proof exception event, devIdListLen=%{public}d, errCode=%{public}d, type=%{public}d",
|
||||
listLen + 1, errCode, PC_DEVICE_TYPE_ID);
|
||||
}
|
||||
return SOFTBUS_OK;
|
||||
}
|
@ -253,7 +253,8 @@ void LnnNotifyBasicInfoChanged(NodeBasicInfo *info, NodeBasicInfoType type);
|
||||
void LnnNotifyNodeStatusChanged(NodeStatus *info, NodeStatusType type);
|
||||
void LnnNotifyLocalNetworkIdChanged(void);
|
||||
void LnnNotifyDeviceTrustedChange(int32_t type, const char *msg, uint32_t msgLen);
|
||||
void LnnNotifyHichainProofException(const char *deviceId, uint32_t deviceIdLen, uint16_t deviceTypeId, int32_t errCode);
|
||||
void LnnNotifyHichainProofException(
|
||||
const char *deviceList, uint32_t deviceListLen, uint16_t deviceTypeId, int32_t errCode);
|
||||
void LnnNotifyMigrate(bool isOnline, NodeBasicInfo *info);
|
||||
|
||||
void LnnNotifyWlanStateChangeEvent(void *state);
|
||||
|
@ -459,13 +459,10 @@ void LnnNotifyDeviceTrustedChange(int32_t type, const char *msg, uint32_t msgLen
|
||||
(void)LnnIpcNotifyDeviceTrustedChange(type, msg, msgLen);
|
||||
}
|
||||
|
||||
void LnnNotifyHichainProofException(const char *deviceId, uint32_t deviceIdLen, uint16_t deviceTypeId, int32_t errCode)
|
||||
void LnnNotifyHichainProofException(
|
||||
const char *deviceList, uint32_t deviceListLen, uint16_t deviceTypeId, int32_t errCode)
|
||||
{
|
||||
if (deviceId == NULL || deviceIdLen != UDID_BUF_LEN) {
|
||||
LNN_LOGE(LNN_EVENT, "deviceId is invalid");
|
||||
return;
|
||||
}
|
||||
(void)LnnIpcNotifyHichainProofException(deviceId, deviceIdLen, deviceTypeId, errCode);
|
||||
(void)LnnIpcNotifyHichainProofException(deviceList, deviceListLen, deviceTypeId, errCode);
|
||||
}
|
||||
|
||||
void LnnNotifyJoinResult(ConnectionAddr *addr, const char *networkId, int32_t retCode)
|
||||
|
@ -149,7 +149,6 @@ typedef struct {
|
||||
DeviceType type;
|
||||
int32_t osType;
|
||||
ConnectOnlineReason bleConnectReason;
|
||||
char peerUdid[UDID_BUF_LEN];
|
||||
} LnnDfxDeviceInfoReport;
|
||||
|
||||
typedef enum {
|
||||
|
@ -115,6 +115,15 @@ extern "C" {
|
||||
*/
|
||||
#define EVENT_NODE_STATE_MASK 0xF
|
||||
|
||||
/**
|
||||
* @brief Indicates the mask bit for a peer device hichain proof exception event.
|
||||
* If you want to receive such events, set the mask bit in {@link INodeStateCb.events}.
|
||||
*
|
||||
* @since 1.0
|
||||
* @version 1.0
|
||||
*/
|
||||
#define EVENT_NODE_HICHAIN_PROOF_EXCEPTION 0x20
|
||||
|
||||
/**
|
||||
* @brief The maximum length of meta node bypass info {@link MetaNodeConfigInfo.bypassInfo}.
|
||||
*
|
||||
@ -497,15 +506,16 @@ typedef struct {
|
||||
/**
|
||||
* @brief Called when the devices have non-consistent group relationship.
|
||||
*
|
||||
* @param deviceId The device id.
|
||||
* @param deviceIdLen The device id length.
|
||||
* @param deviceList The device list.
|
||||
* @param deviceListLen The device list length.
|
||||
* @param deviceTypeId The device type id.
|
||||
* @param errcode Indicates the result code.
|
||||
*
|
||||
* @since 1.0
|
||||
* @version 1.0
|
||||
*/
|
||||
void (*onHichainProofException)(uint16_t deviceTypeId, int32_t errCode);
|
||||
void (*onHichainProofException)(
|
||||
const char *deviceList, uint32_t deviceListLen, uint16_t deviceTypeId, int32_t errCode);
|
||||
} INodeStateCb;
|
||||
|
||||
/**
|
||||
|
@ -480,6 +480,16 @@ enum SoftBusErrNo {
|
||||
SOFTBUS_AUTH_SAVE_SESSIONKEY_TIMEOUT,
|
||||
SOFTBUS_AUTH_SYNC_DEVICEINFO_TIMEOUT,
|
||||
|
||||
/* hichain mapping softbus errcode */
|
||||
SOFTBUS_AUTH_HICHAIN_PROOF_MISMATCH =
|
||||
(-(((SOFTBUS_SUB_SYSTEM) << 21) | ((AUTH_SUB_MODULE_CODE) << 16) | (0x100D))),
|
||||
SOFTBUS_AUTH_HICHAIN_GROUP_NOT_EXIST =
|
||||
(-(((SOFTBUS_SUB_SYSTEM) << 21) | ((AUTH_SUB_MODULE_CODE) << 16) | (0x0607))),
|
||||
SOFTBUS_AUTH_HICHAIN_NO_CANDIDATE_GROUP =
|
||||
(-(((SOFTBUS_SUB_SYSTEM) << 21) | ((AUTH_SUB_MODULE_CODE) << 16) | (0x0504))),
|
||||
SOFTBUS_AUTH_HICHAIN_LOCAL_IDENTITY_NOT_EXIST =
|
||||
(-(((SOFTBUS_SUB_SYSTEM) << 21) | ((AUTH_SUB_MODULE_CODE) << 16) | (0x040C))),
|
||||
|
||||
/* errno begin: -((203 << 21) | (4 << 16) | 0xFFFF) */
|
||||
SOFTBUS_NETWORK_ERR_BASE = SOFTBUS_ERRNO(LNN_SUB_MODULE_CODE),
|
||||
SOFTBUS_NETWORK_CONN_FSM_DEAD,
|
||||
|
@ -63,7 +63,7 @@ int32_t LnnOnNodeStatusChanged(const char *pkgName, void *info, int32_t type);
|
||||
int32_t LnnOnLocalNetworkIdChanged(const char *pkgName);
|
||||
int32_t LnnOnNodeDeviceTrustedChange(const char *pkgName, int32_t type, const char *msg, uint32_t msgLen);
|
||||
int32_t LnnOnHichainProofException(
|
||||
const char *pkgName, const char *deviceId, uint32_t deviceIdLen, uint16_t deviceTypeId, int32_t errCode);
|
||||
const char *pkgName, const char *deviceList, uint32_t deviceListLen, uint16_t deviceTypeId, int32_t errCode);
|
||||
int32_t LnnOnTimeSyncResult(const void *info, int32_t retCode);
|
||||
void LnnOnPublishLNNResult(int32_t publishId, int32_t reason);
|
||||
void LnnOnRefreshLNNResult(int32_t refreshId, int32_t reason);
|
||||
|
@ -808,6 +808,10 @@ static bool IsSameNodeStateCb(const INodeStateCb *callback1, const INodeStateCb
|
||||
callback1->onNodeStatusChanged != callback2->onNodeStatusChanged) {
|
||||
return false;
|
||||
}
|
||||
if ((callback1->events & EVENT_NODE_HICHAIN_PROOF_EXCEPTION) &&
|
||||
callback1->onHichainProofException != callback2->onHichainProofException) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1297,10 +1301,8 @@ int32_t LnnOnNodeDeviceTrustedChange(const char *pkgName, int32_t type, const ch
|
||||
}
|
||||
|
||||
int32_t LnnOnHichainProofException(
|
||||
const char *pkgName, const char *deviceId, uint32_t deviceIdLen, uint16_t deviceTypeId, int32_t errCode)
|
||||
const char *pkgName, const char *deviceList, uint32_t deviceListLen, uint16_t deviceTypeId, int32_t errCode)
|
||||
{
|
||||
(void)deviceId;
|
||||
(void)deviceIdLen;
|
||||
NodeStateCallbackItem *item = NULL;
|
||||
ListNode dupList;
|
||||
|
||||
@ -1321,22 +1323,22 @@ int32_t LnnOnHichainProofException(
|
||||
if (SoftBusMutexUnlock(&g_busCenterClient.lock) != SOFTBUS_OK) {
|
||||
LNN_LOGE(LNN_STATE, "unlock auth restrict cb list in notify");
|
||||
}
|
||||
char *anonyPkgName = NULL;
|
||||
char *anonyDeviceId = NULL;
|
||||
Anonymize(pkgName, &anonyPkgName);
|
||||
Anonymize(deviceId, &anonyDeviceId);
|
||||
LIST_FOR_EACH_ENTRY(item, &dupList, NodeStateCallbackItem, node) {
|
||||
if (((strcmp(item->pkgName, pkgName) == 0) || (strlen(pkgName) == 0)) &&
|
||||
(item->cb.onHichainProofException) != NULL) {
|
||||
item->cb.onHichainProofException(deviceTypeId, errCode);
|
||||
(item->cb.events & EVENT_NODE_HICHAIN_PROOF_EXCEPTION) != 0 && item->cb.onHichainProofException != NULL) {
|
||||
item->cb.onHichainProofException(deviceList, deviceListLen, deviceTypeId, errCode);
|
||||
char *anonyPkgName = NULL;
|
||||
char *anonyDeviceList = NULL;
|
||||
Anonymize(pkgName, &anonyPkgName);
|
||||
Anonymize(deviceList, &anonyDeviceList);
|
||||
LNN_LOGI(LNN_STATE,
|
||||
"onHichainProofException, pkgName=%{public}s, deviceId=%{public}s, errCode=%{public}d, "
|
||||
"onHichainProofException, pkgName=%{public}s, deviceList=%{public}s, errCode=%{public}d, "
|
||||
"type=%{public}hu",
|
||||
AnonymizeWrapper(anonyPkgName), AnonymizeWrapper(anonyDeviceId), errCode, deviceTypeId);
|
||||
AnonymizeWrapper(anonyPkgName), AnonymizeWrapper(anonyDeviceList), errCode, deviceTypeId);
|
||||
AnonymizeFree(anonyPkgName);
|
||||
AnonymizeFree(anonyDeviceList);
|
||||
}
|
||||
}
|
||||
AnonymizeFree(anonyPkgName);
|
||||
AnonymizeFree(anonyDeviceId);
|
||||
ClearNodeStateCbList(&dupList);
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
|
@ -69,6 +69,10 @@ static bool IsValidNodeStateCb(INodeStateCb *callback)
|
||||
callback->onNodeStatusChanged == NULL) {
|
||||
return false;
|
||||
}
|
||||
if ((callback->events & EVENT_NODE_HICHAIN_PROOF_EXCEPTION) != 0 &&
|
||||
callback->onHichainProofException == NULL) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ public:
|
||||
virtual int32_t OnNodeDeviceTrustedChange(const char *pkgName, int32_t type, const char *msg, uint32_t msgLen);
|
||||
|
||||
virtual int32_t OnHichainProofException(
|
||||
const char *pkgName, const char *deviceId, uint32_t deviceIdLen, uint16_t deviceTypeId, int32_t errCode);
|
||||
const char *pkgName, const char *deviceList, uint32_t deviceListLen, uint16_t deviceTypeId, int32_t errCode);
|
||||
|
||||
virtual int32_t OnTimeSyncResult(const void *info, uint32_t infoTypeLen, int32_t retCode);
|
||||
|
||||
|
@ -51,7 +51,7 @@ public:
|
||||
int32_t OnNodeStatusChanged(const char *pkgName, void *info, uint32_t infoTypeLen, int32_t type) override;
|
||||
int32_t OnLocalNetworkIdChanged(const char *pkgName) override;
|
||||
int32_t OnNodeDeviceTrustedChange(const char *pkgName, int32_t type, const char *msg, uint32_t msgLen) override;
|
||||
int32_t OnHichainProofException(const char *pkgName, const char *deviceId, uint32_t deviceIdLen,
|
||||
int32_t OnHichainProofException(const char *pkgName, const char *deviceList, uint32_t deviceListLen,
|
||||
uint16_t deviceTypeId, int32_t errCode) override;
|
||||
int32_t OnTimeSyncResult(const void *info, uint32_t infoTypeLen, int32_t retCode) override;
|
||||
void OnPublishLNNResult(int32_t publishId, int32_t reason) override;
|
||||
|
@ -127,11 +127,11 @@ int32_t ISoftBusClient::OnNodeDeviceTrustedChange(const char *pkgName, int32_t t
|
||||
}
|
||||
|
||||
int32_t ISoftBusClient::OnHichainProofException(
|
||||
const char *pkgName, const char *deviceId, uint32_t deviceIdLen, uint16_t deviceTypeId, int32_t errCode)
|
||||
const char *pkgName, const char *deviceList, uint32_t deviceListLen, uint16_t deviceTypeId, int32_t errCode)
|
||||
{
|
||||
(void)pkgName;
|
||||
(void)deviceId;
|
||||
(void)deviceIdLen;
|
||||
(void)deviceList;
|
||||
(void)deviceListLen;
|
||||
(void)deviceTypeId;
|
||||
(void)errCode;
|
||||
COMM_LOGI(COMM_EVENT, "ipc default impl");
|
||||
|
@ -548,15 +548,18 @@ int32_t SoftBusClientStub::OnHichainProofExceptionInner(MessageParcel &data, Mes
|
||||
COMM_LOGE(COMM_SDK, "Invalid package name, or length is zero");
|
||||
return SOFTBUS_INVALID_PARAM;
|
||||
}
|
||||
uint32_t deviceIdLen = 0;
|
||||
if (!data.ReadUint32(deviceIdLen) || deviceIdLen != UDID_BUF_LEN) {
|
||||
COMM_LOGE(COMM_SDK, "read failed! deviceIdLen=%{public}u", deviceIdLen);
|
||||
uint32_t deviceListLen = 0;
|
||||
if (!data.ReadUint32(deviceListLen)) {
|
||||
COMM_LOGE(COMM_SDK, "read failed! deviceListLen=%{public}u", deviceListLen);
|
||||
return SOFTBUS_TRANS_PROXY_READINT_FAILED;
|
||||
}
|
||||
char *deviceId = (char *)data.ReadRawData(deviceIdLen);
|
||||
if (deviceId == nullptr) {
|
||||
COMM_LOGE(COMM_SDK, "read deviceId failed!");
|
||||
return SOFTBUS_TRANS_PROXY_READRAWDATA_FAILED;
|
||||
char *deviceList = NULL;
|
||||
if (deviceListLen != 0) {
|
||||
deviceList = (char *)data.ReadRawData(deviceListLen);
|
||||
if (deviceList == nullptr) {
|
||||
COMM_LOGE(COMM_SDK, "read deviceList failed!");
|
||||
return SOFTBUS_TRANS_PROXY_READINT_FAILED;
|
||||
}
|
||||
}
|
||||
uint16_t deviceTypeId = 0;
|
||||
if (!data.ReadUint16(deviceTypeId)) {
|
||||
@ -568,7 +571,7 @@ int32_t SoftBusClientStub::OnHichainProofExceptionInner(MessageParcel &data, Mes
|
||||
COMM_LOGE(COMM_SDK, "read failed! errCode=%{public}d", errCode);
|
||||
return SOFTBUS_TRANS_PROXY_READINT_FAILED;
|
||||
}
|
||||
int32_t retReply = OnHichainProofException(pkgName, deviceId, deviceIdLen, deviceTypeId, errCode);
|
||||
int32_t retReply = OnHichainProofException(pkgName, deviceList, deviceListLen, deviceTypeId, errCode);
|
||||
if (!reply.WriteInt32(retReply)) {
|
||||
COMM_LOGE(COMM_SDK, "OnHichainProofException write reply failed!");
|
||||
return SOFTBUS_TRANS_PROXY_WRITEINT_FAILED;
|
||||
@ -732,9 +735,9 @@ int32_t SoftBusClientStub::OnNodeDeviceTrustedChange(const char *pkgName, int32_
|
||||
}
|
||||
|
||||
int32_t SoftBusClientStub::OnHichainProofException(
|
||||
const char *pkgName, const char *deviceId, uint32_t deviceIdLen, uint16_t deviceTypeId, int32_t errCode)
|
||||
const char *pkgName, const char *deviceList, uint32_t deviceListLen, uint16_t deviceTypeId, int32_t errCode)
|
||||
{
|
||||
return LnnOnHichainProofException(pkgName, deviceId, deviceIdLen, deviceTypeId, errCode);
|
||||
return LnnOnHichainProofException(pkgName, deviceList, deviceListLen, deviceTypeId, errCode);
|
||||
}
|
||||
|
||||
int32_t SoftBusClientStub::OnTimeSyncResult(const void *info, uint32_t infoTypeLen, int32_t retCode)
|
||||
|
@ -137,9 +137,9 @@ void DeleteNodeFromPcRestrictMap(const char *udidHash)
|
||||
return GetCommonInterface()->DeleteNodeFromPcRestrictMap(udidHash);
|
||||
}
|
||||
|
||||
LnnConnectionFsm *FindConnectionFsmByRequestId(uint32_t requestId)
|
||||
int32_t AuthFailNotifyDeviceList(int32_t errCode, const char *errorReturn, uint32_t listLen)
|
||||
{
|
||||
return GetCommonInterface()->FindConnectionFsmByRequestId(requestId);
|
||||
return GetCommonInterface()->AuthFailNotifyDeviceList(errCode, errorReturn, listLen);
|
||||
}
|
||||
}
|
||||
} // namespace OHOS
|
@ -26,7 +26,6 @@
|
||||
#include "lnn_feature_capability.h"
|
||||
#include "lnn_lane_interface.h"
|
||||
#include "lnn_net_builder.h"
|
||||
#include "lnn_net_builder_process.h"
|
||||
#include "lnn_ohos_account_adapter.h"
|
||||
#include "lnn_node_info.h"
|
||||
#include "softbus_adapter_bt_common.h"
|
||||
@ -58,7 +57,7 @@ public:
|
||||
virtual int32_t SoftBusGetBtMacAddr(SoftBusBtAddr *mac) = 0;
|
||||
virtual int32_t GetNodeFromPcRestrictMap(const char *udidHash, uint32_t *count) = 0;
|
||||
virtual void DeleteNodeFromPcRestrictMap(const char *udidHash) = 0;
|
||||
virtual LnnConnectionFsm *FindConnectionFsmByRequestId(uint32_t requestId) = 0;
|
||||
virtual int32_t AuthFailNotifyDeviceList(int32_t errCode, const char *errorReturn, uint32_t listLen) = 0;
|
||||
};
|
||||
class AuthCommonInterfaceMock : public AuthCommonInterface {
|
||||
public:
|
||||
@ -84,7 +83,7 @@ public:
|
||||
MOCK_METHOD1(SoftBusGetBtMacAddr, int32_t (SoftBusBtAddr *));
|
||||
MOCK_METHOD2(GetNodeFromPcRestrictMap, int32_t (const char *, uint32_t *));
|
||||
MOCK_METHOD1(DeleteNodeFromPcRestrictMap, void (const char *));
|
||||
MOCK_METHOD1(FindConnectionFsmByRequestId, LnnConnectionFsm * (uint32_t));
|
||||
MOCK_METHOD3(AuthFailNotifyDeviceList, int32_t (int32_t, const char *, uint32_t));
|
||||
};
|
||||
} // namespace OHOS
|
||||
#endif // AUTH_COMMON_MOCK_H
|
@ -63,7 +63,7 @@ public:
|
||||
virtual DiscoveryType LnnConvAddrTypeToDiscType(ConnectionAddrType type) = 0;
|
||||
virtual void LnnNotifyOOBEStateChangeEvent(SoftBusOOBEState state) = 0;
|
||||
virtual void LnnNotifyHichainProofException(
|
||||
const char *deviceId, uint32_t deviceIdLen, uint16_t deviceTypeId, int32_t errCode) = 0;
|
||||
const char *deviceList, uint32_t deviceListLen, uint16_t deviceTypeId, int32_t errCode) = 0;
|
||||
};
|
||||
|
||||
class LnnConnFsmInterfaceMock : public LnnConnFsmInterface {
|
||||
|
@ -147,9 +147,10 @@ void LnnNotifyOOBEStateChangeEvent(SoftBusOOBEState state)
|
||||
return GetLnnConnInterface()->LnnNotifyOOBEStateChangeEvent(state);
|
||||
}
|
||||
|
||||
void LnnNotifyHichainProofException(const char *deviceId, uint32_t deviceIdLen, uint16_t deviceTypeId, int32_t errCode)
|
||||
void LnnNotifyHichainProofException(
|
||||
const char *deviceList, uint32_t deviceListLen, uint16_t deviceTypeId, int32_t errCode)
|
||||
{
|
||||
return GetLnnConnInterface()->LnnNotifyHichainProofException(deviceId, deviceIdLen, deviceTypeId, errCode);
|
||||
return GetLnnConnInterface()->LnnNotifyHichainProofException(deviceList, deviceListLen, deviceTypeId, errCode);
|
||||
}
|
||||
}
|
||||
} // namespace OHOS
|
||||
|
Loading…
Reference in New Issue
Block a user