diff --git a/0001-remove-dependence-on-access-token-and-hitrace.patch b/0001-remove-dependence-on-access-token-and-hitrace.patch new file mode 100644 index 0000000000000000000000000000000000000000..f2c39fd5e50fcca4d5f09bab0a855212d8e8d295 --- /dev/null +++ b/0001-remove-dependence-on-access-token-and-hitrace.patch @@ -0,0 +1,618 @@ +From 93f0cdc41e63859c3e67d460028a892298cb94e5 Mon Sep 17 00:00:00 2001 +From: heppen +Date: Sat, 23 Sep 2023 16:56:54 +0800 +Subject: [PATCH 1/2] Remove dependence on access token and hitrace + +--- + interfaces/innerkits/ipc_core/BUILD.gn | 4 +- + interfaces/innerkits/ipc_single/BUILD.gn | 2 +- + .../access_token/src/access_token_adapter.c | 2 +- + .../src/core/source/ipc_object_stub.cpp | 76 ++++--- + .../src/mock/include/dbinder_base_invoker.h | 12 +- + ipc/native/src/mock/include/hitrace_invoker.h | 18 +- + ipc/native/src/mock/source/binder_invoker.cpp | 12 +- + .../src/mock/source/hitrace_invoker.cpp | 212 +++++++++--------- + .../src/mock/source/invoker_factory.cpp | 2 +- + .../src/napi/src/napi_remote_object.cpp | 2 +- + ipc/native/src/napi/src/napi_remote_proxy.cpp | 2 +- + .../unittest/common/ipc_hitrace_unittest.cpp | 2 +- + .../include/dbinder_test_service_skeleton.h | 2 +- + 13 files changed, 175 insertions(+), 173 deletions(-) + +diff --git a/interfaces/innerkits/ipc_core/BUILD.gn b/interfaces/innerkits/ipc_core/BUILD.gn +index cb35083..3c4d57b 100644 +--- a/interfaces/innerkits/ipc_core/BUILD.gn ++++ b/interfaces/innerkits/ipc_core/BUILD.gn +@@ -71,10 +71,10 @@ ohos_shared_library("ipc_core") { + all_dependent_configs = [ ":ipc_all_deps_config" ] + + external_deps = [ +- "access_token:libaccesstoken_sdk", ++ # "access_token:libaccesstoken_sdk", + "c_utils:utils", + "dsoftbus:softbus_client", +- "hitrace_native:libhitracechain", ++ # "hitrace_native:libhitracechain", + "hiviewdfx_hilog_native:libhilog", + ] + +diff --git a/interfaces/innerkits/ipc_single/BUILD.gn b/interfaces/innerkits/ipc_single/BUILD.gn +index de33cdb..f61f26c 100644 +--- a/interfaces/innerkits/ipc_single/BUILD.gn ++++ b/interfaces/innerkits/ipc_single/BUILD.gn +@@ -59,7 +59,7 @@ ohos_shared_library("ipc_single") { + + external_deps = [ + "c_utils:utils", +- "hitrace_native:libhitracechain", ++ # "hitrace_native:libhitracechain", + "hiviewdfx_hilog_native:libhilog", + ] + +diff --git a/ipc/native/c/adapter/access_token/src/access_token_adapter.c b/ipc/native/c/adapter/access_token/src/access_token_adapter.c +index aece213..890ba82 100644 +--- a/ipc/native/c/adapter/access_token/src/access_token_adapter.c ++++ b/ipc/native/c/adapter/access_token/src/access_token_adapter.c +@@ -19,7 +19,7 @@ + #include + #include + +-#include "bits/ioctl.h" ++// #include "bits/ioctl.h" + + #define ACCESS_TOKEN_ID_IOCTL_BASE 'A' + +diff --git a/ipc/native/src/core/source/ipc_object_stub.cpp b/ipc/native/src/core/source/ipc_object_stub.cpp +index 28df2cd..781d600 100644 +--- a/ipc/native/src/core/source/ipc_object_stub.cpp ++++ b/ipc/native/src/core/source/ipc_object_stub.cpp +@@ -39,8 +39,8 @@ + #include "vector" + + #ifndef CONFIG_IPC_SINGLE +-#include "accesstoken_kit.h" +-#include "access_token_adapter.h" ++// #include "accesstoken_kit.h" ++// #include "access_token_adapter.h" + #include "dbinder_databus_invoker.h" + #include "dbinder_error_code.h" + #include "rpc_feature_set.h" +@@ -56,10 +56,10 @@ static constexpr int HIDUMPER_SERVICE_UID = 1212; + using namespace OHOS::HiviewDFX; + static constexpr HiLogLabel LABEL = { LOG_CORE, LOG_ID_IPC, "IPCObjectStub" }; + #ifndef CONFIG_IPC_SINGLE +-using namespace OHOS::Security; ++// using namespace OHOS::Security; + // Authentication information can be added only for processes with system permission. + static constexpr pid_t ALLOWED_UID = 10000; +-static constexpr int APL_BASIC = 2; ++// static constexpr int APL_BASIC = 2; + // Only the samgr can obtain the UID and PID. + static const std::string SAMGR_PROCESS_NAME = "samgr"; + #endif +@@ -259,7 +259,7 @@ int IPCObjectStub::SendRequest(uint32_t code, MessageParcel &data, MessageParcel + break; + } + case GRANT_DATABUS_NAME: { +- if (!IPCSkeleton::IsLocalCalling() || !IsSamgrCall((uint32_t)RpcGetSelfTokenID())) { ++ if (!IPCSkeleton::IsLocalCalling() || !IsSamgrCall((uint32_t)0)) { + ZLOGE(LABEL, "GRANT_DATABUS_NAME message is excluded in sa manager"); + result = IPC_STUB_INVALID_DATA_ERR; + break; +@@ -268,7 +268,7 @@ int IPCObjectStub::SendRequest(uint32_t code, MessageParcel &data, MessageParcel + break; + } + case TRANS_DATABUS_NAME: { +- if (!IPCSkeleton::IsLocalCalling() || !IsSamgrCall((uint32_t)RpcGetSelfTokenID())) { ++ if (!IPCSkeleton::IsLocalCalling() || !IsSamgrCall((uint32_t)0)) { + ZLOGE(LABEL, "TRANS_DATABUS_NAME message is excluded in sa manager"); + result = IPC_STUB_INVALID_DATA_ERR; + break; +@@ -611,41 +611,43 @@ std::string IPCObjectStub::CreateDatabusName(int uid, int pid, int systemAbility + + bool IPCObjectStub::IsSamgrCall(uint32_t accessToken) + { +- auto tokenType = AccessToken::AccessTokenKit::GetTokenTypeFlag(accessToken); +- if (tokenType != AccessToken::ATokenTypeEnum::TOKEN_NATIVE) { +- ZLOGE(LABEL, "not native call"); +- return false; +- } +- AccessToken::NativeTokenInfo nativeTokenInfo; +- int32_t result = AccessToken::AccessTokenKit::GetNativeTokenInfo(accessToken, nativeTokenInfo); +- if (result == ERR_NONE && nativeTokenInfo.processName == SAMGR_PROCESS_NAME) { +- return true; +- } +- ZLOGE(LABEL, "not samgr called, processName:%{private}s", nativeTokenInfo.processName.c_str()); +- return false; ++ // auto tokenType = AccessToken::AccessTokenKit::GetTokenTypeFlag(accessToken); ++ // if (tokenType != AccessToken::ATokenTypeEnum::TOKEN_NATIVE) { ++ // ZLOGE(LABEL, "not native call"); ++ // return false; ++ // } ++ // AccessToken::NativeTokenInfo nativeTokenInfo; ++ // int32_t result = AccessToken::AccessTokenKit::GetNativeTokenInfo(accessToken, nativeTokenInfo); ++ // if (result == ERR_NONE && nativeTokenInfo.processName == SAMGR_PROCESS_NAME) { ++ // return true; ++ // } ++ // ZLOGE(LABEL, "not samgr called, processName:%{private}s", nativeTokenInfo.processName.c_str()); ++ // return false; ++ return true; + } + + bool IPCObjectStub::HasDumpPermission(uint32_t accessToken) const + { +- int res = AccessToken::AccessTokenKit::VerifyAccessToken(accessToken, "ohos.permission.DUMP"); +- if (res == AccessToken::PermissionState::PERMISSION_GRANTED) { +- return true; +- } +- bool ret = false; +- auto tokenType = AccessToken::AccessTokenKit::GetTokenTypeFlag(accessToken); +- if (tokenType == AccessToken::ATokenTypeEnum::TOKEN_NATIVE) { +- AccessToken::NativeTokenInfo nativeTokenInfo; +- int32_t result = AccessToken::AccessTokenKit::GetNativeTokenInfo(accessToken, nativeTokenInfo); +- ret = (result == ERR_NONE && nativeTokenInfo.apl >= APL_BASIC); +- } else if (tokenType == AccessToken::ATokenTypeEnum::TOKEN_HAP) { +- AccessToken::HapTokenInfo hapTokenInfo; +- int32_t result = AccessToken::AccessTokenKit::GetHapTokenInfo(accessToken, hapTokenInfo); +- ret = (result == ERR_NONE && hapTokenInfo.apl >= APL_BASIC); +- } +- if (!ret) { +- ZLOGD(LABEL, "No dump permission, please check!"); +- } +- return ret; ++ // int res = AccessToken::AccessTokenKit::VerifyAccessToken(accessToken, "ohos.permission.DUMP"); ++ // if (res == AccessToken::PermissionState::PERMISSION_GRANTED) { ++ // return true; ++ // } ++ // bool ret = false; ++ // auto tokenType = AccessToken::AccessTokenKit::GetTokenTypeFlag(accessToken); ++ // if (tokenType == AccessToken::ATokenTypeEnum::TOKEN_NATIVE) { ++ // AccessToken::NativeTokenInfo nativeTokenInfo; ++ // int32_t result = AccessToken::AccessTokenKit::GetNativeTokenInfo(accessToken, nativeTokenInfo); ++ // ret = (result == ERR_NONE && nativeTokenInfo.apl >= APL_BASIC); ++ // } else if (tokenType == AccessToken::ATokenTypeEnum::TOKEN_HAP) { ++ // AccessToken::HapTokenInfo hapTokenInfo; ++ // int32_t result = AccessToken::AccessTokenKit::GetHapTokenInfo(accessToken, hapTokenInfo); ++ // ret = (result == ERR_NONE && hapTokenInfo.apl >= APL_BASIC); ++ // } ++ // if (!ret) { ++ // ZLOGD(LABEL, "No dump permission, please check!"); ++ // } ++ // return ret; ++ return true; + } + #endif + } // namespace OHOS +diff --git a/ipc/native/src/mock/include/dbinder_base_invoker.h b/ipc/native/src/mock/include/dbinder_base_invoker.h +index ca7fd8e..7d40e7d 100644 +--- a/ipc/native/src/mock/include/dbinder_base_invoker.h ++++ b/ipc/native/src/mock/include/dbinder_base_invoker.h +@@ -701,9 +701,9 @@ int DBinderBaseInvoker::SendRequest(int32_t handle, uint32_t code, MessagePar + int userWaitTime = option.GetWaitTime(); + MessageParcel &newData = const_cast(data); + size_t oldWritePosition = newData.GetWritePosition(); +- HiTraceId traceId = HiTraceChain::GetId(); ++ // HiTraceId traceId = HiTraceChain::GetId(); + // set client send trace point if trace is enabled +- HiTraceId childId = HitraceInvoker::TraceClientSend(handle, code, newData, flags, traceId); ++ // HiTraceId childId = HitraceInvoker::TraceClientSend(handle, code, newData, flags, traceId); + std::shared_ptr session = WriteTransaction(BC_TRANSACTION, flags, handle, 0, code, data, seqNumber, 0); + if (session == nullptr) { + newData.RewindWrite(oldWritePosition); +@@ -720,7 +720,7 @@ int DBinderBaseInvoker::SendRequest(int32_t handle, uint32_t code, MessagePar + } else { + ret = SendOrWaitForCompletion(userWaitTime, seqNumber, session, &reply); + } +- HitraceInvoker::TraceClientReceieve(handle, code, flags, traceId, childId); ++ // HitraceInvoker::TraceClientReceieve(handle, code, flags, traceId, childId); + // restore Parcel data + newData.RewindWrite(oldWritePosition); + return ret; +@@ -865,8 +865,8 @@ template void DBinderBaseInvoker::ProcessTransaction(dbinder_transa + data.InjectOffsets(reinterpret_cast(reinterpret_cast(tr->buffer) + tr->offsets), + tr->offsets_size / sizeof(binder_size_t)); + } +- uint32_t &newflags = const_cast(tr->flags); +- int isServerTraced = HitraceInvoker::TraceServerReceieve(tr->cookie, tr->code, data, newflags); ++ // uint32_t &newflags = const_cast(tr->flags); ++ // int isServerTraced = HitraceInvoker::TraceServerReceieve(tr->cookie, tr->code, data, newflags); + + const pid_t oldPid = GetCallerPid(); + const auto oldUid = static_cast(GetCallerUid()); +@@ -918,7 +918,7 @@ template void DBinderBaseInvoker::ProcessTransaction(dbinder_transa + ZLOGE(LOG_LABEL, "delete raw data in process skeleton"); + current->DetachRawData(listenFd); + } +- HitraceInvoker::TraceServerSend(tr->cookie, tr->code, isServerTraced, newflags); ++ // HitraceInvoker::TraceServerSend(tr->cookie, tr->code, isServerTraced, newflags); + if (!(flags & MessageOption::TF_ASYNC)) { + SetClientFd(listenFd); + SetSeqNum(senderSeqNumber); +diff --git a/ipc/native/src/mock/include/hitrace_invoker.h b/ipc/native/src/mock/include/hitrace_invoker.h +index 7da8029..785a1d2 100644 +--- a/ipc/native/src/mock/include/hitrace_invoker.h ++++ b/ipc/native/src/mock/include/hitrace_invoker.h +@@ -16,24 +16,24 @@ + #ifndef OHOS_IPC_HITRACE_INVOKER_H + #define OHOS_IPC_HITRACE_INVOKER_H + +-#include "hitrace/trace.h" ++// #include "hitrace/trace.h" + #include "iremote_object.h" + namespace OHOS { + class HitraceInvoker { + public: +- static bool IsClientTraced(int32_t handle, uint32_t flags, const HiviewDFX::HiTraceId &traceId); ++ // static bool IsClientTraced(int32_t handle, uint32_t flags, const HiviewDFX::HiTraceId &traceId); + +- static HiviewDFX::HiTraceId TraceClientSend(int32_t handle, uint32_t code, Parcel &data, uint32_t &flags, +- const HiviewDFX::HiTraceId &traceId); ++ // static HiviewDFX::HiTraceId TraceClientSend(int32_t handle, uint32_t code, Parcel &data, uint32_t &flags, ++ // const HiviewDFX::HiTraceId &traceId); + +- static void TraceClientReceieve(int32_t handle, uint32_t code, uint32_t flags, const HiviewDFX::HiTraceId &traceId, +- const HiviewDFX::HiTraceId &childId); ++ // static void TraceClientReceieve(int32_t handle, uint32_t code, uint32_t flags, const HiviewDFX::HiTraceId &traceId, ++ // const HiviewDFX::HiTraceId &childId); + +- static void RecoveryDataAndFlag(Parcel &data, uint32_t &flags, size_t oldReadPosition, uint8_t idLen); ++ // static void RecoveryDataAndFlag(Parcel &data, uint32_t &flags, size_t oldReadPosition, uint8_t idLen); + +- static bool TraceServerReceieve(int32_t handle, uint32_t code, Parcel &data, uint32_t &flags); ++ // static bool TraceServerReceieve(int32_t handle, uint32_t code, Parcel &data, uint32_t &flags); + +- static void TraceServerSend(int32_t handle, uint32_t code, bool isServerTraced, uint32_t flags); ++ // static void TraceServerSend(int32_t handle, uint32_t code, bool isServerTraced, uint32_t flags); + + private: + static const int PADDED_SIZE_OF_PARCEL = 4; +diff --git a/ipc/native/src/mock/source/binder_invoker.cpp b/ipc/native/src/mock/source/binder_invoker.cpp +index 9ce6b59..946940c 100644 +--- a/ipc/native/src/mock/source/binder_invoker.cpp ++++ b/ipc/native/src/mock/source/binder_invoker.cpp +@@ -96,9 +96,9 @@ int BinderInvoker::SendRequest(int handle, uint32_t code, MessageParcel &data, M + uint32_t flags = (uint32_t)option.GetFlags(); + MessageParcel &newData = const_cast(data); + size_t oldWritePosition = newData.GetWritePosition(); +- HiTraceId traceId = HiTraceChain::GetId(); ++ // HiTraceId traceId = HiTraceChain::GetId(); + // set client send trace point if trace is enabled +- HiTraceId childId = HitraceInvoker::TraceClientSend(handle, code, newData, flags, traceId); ++ // HiTraceId childId = HitraceInvoker::TraceClientSend(handle, code, newData, flags, traceId); + if (!WriteTransaction(BC_TRANSACTION, flags, handle, code, data, nullptr)) { + newData.RewindWrite(oldWritePosition); + ZLOGE(LABEL, "WriteTransaction ERROR"); +@@ -114,7 +114,7 @@ int BinderInvoker::SendRequest(int handle, uint32_t code, MessageParcel &data, M + } else { + error = WaitForCompletion(&reply); + } +- HitraceInvoker::TraceClientReceieve(handle, code, flags, traceId, childId); ++ // HitraceInvoker::TraceClientReceieve(handle, code, flags, traceId, childId); + // restore Parcel data + newData.RewindWrite(oldWritePosition); + if (error != ERR_NONE) { +@@ -413,8 +413,8 @@ void BinderInvoker::OnTransaction(const uint8_t *buffer) + if (tr->offsets_size > 0) { + data->InjectOffsets(tr->data.ptr.offsets, tr->offsets_size / sizeof(binder_size_t)); + } +- uint32_t &newflags = const_cast(tr->flags); +- int isServerTraced = HitraceInvoker::TraceServerReceieve(tr->target.handle, tr->code, *data, newflags); ++ // uint32_t &newflags = const_cast(tr->flags); ++ // int isServerTraced = HitraceInvoker::TraceServerReceieve(tr->target.handle, tr->code, *data, newflags); + const pid_t oldPid = callerPid_; + const auto oldUid = static_cast(callerUid_); + const uint32_t oldToken = callerTokenID_; +@@ -469,7 +469,7 @@ void BinderInvoker::OnTransaction(const uint8_t *buffer) + Str16ToStr8(targetObject->descriptor_).c_str(), tr->code, duration); + } + } +- HitraceInvoker::TraceServerSend(tr->target.handle, tr->code, isServerTraced, newflags); ++ // HitraceInvoker::TraceServerSend(tr->target.handle, tr->code, isServerTraced, newflags); + if (!(flagValue & TF_ONE_WAY)) { + SendReply(reply, 0, error); + } +diff --git a/ipc/native/src/mock/source/hitrace_invoker.cpp b/ipc/native/src/mock/source/hitrace_invoker.cpp +index 4f7f7c3..bc55772 100644 +--- a/ipc/native/src/mock/source/hitrace_invoker.cpp ++++ b/ipc/native/src/mock/source/hitrace_invoker.cpp +@@ -20,7 +20,7 @@ + + #include "hilog/log_c.h" + #include "hilog/log_cpp.h" +-#include "hitrace/trace.h" ++// #include "hitrace/trace.h" + #include "ipc_debug.h" + #include "log_tags.h" + #include "parcel.h" +@@ -29,118 +29,118 @@ + namespace OHOS { + // the value should be equal to the set of parcel + using namespace OHOS::HiviewDFX; +-static const HiLogLabel TRACE_LABEL = { LOG_CORE, LOG_ID_IPC, "BinderHiTrace" }; ++// static const HiLogLabel TRACE_LABEL = { LOG_CORE, LOG_ID_IPC, "BinderHiTrace" }; + +-bool HitraceInvoker::IsClientTraced(int32_t handle, uint32_t flags, const HiTraceId &traceId) +-{ +- return (traceId.IsValid() && (handle != 0) && +- ((flags & TF_ONE_WAY) ? traceId.IsFlagEnabled(HITRACE_FLAG_INCLUDE_ASYNC) : true)); +-} ++// bool HitraceInvoker::IsClientTraced(int32_t handle, uint32_t flags, const HiTraceId &traceId) ++// { ++// return (traceId.IsValid() && (handle != 0) && ++// ((flags & TF_ONE_WAY) ? traceId.IsFlagEnabled(HITRACE_FLAG_INCLUDE_ASYNC) : true)); ++// } + +-HiTraceId HitraceInvoker::TraceClientSend(int32_t handle, uint32_t code, Parcel &data, uint32_t &flags, +- const HiTraceId &traceId) +-{ +- HiTraceId childId = traceId; +- bool isClientTraced = IsClientTraced(handle, flags, traceId); +- if (isClientTraced) { +- childId = HiTraceChain::CreateSpan(); +- // add childid to parcel data +- uint8_t idBytes[HITRACE_ID_LEN]; +- size_t idLen = (size_t)(childId.ToBytes(idBytes, HITRACE_ID_LEN)); +- if (idLen != HITRACE_ID_LEN) { +- ZLOGE(TRACE_LABEL, "%{public}s:idLen not correct", __func__); +- return childId; +- } ++// HiTraceId HitraceInvoker::TraceClientSend(int32_t handle, uint32_t code, Parcel &data, uint32_t &flags, ++// const HiTraceId &traceId) ++// { ++// HiTraceId childId = traceId; ++// bool isClientTraced = IsClientTraced(handle, flags, traceId); ++// if (isClientTraced) { ++// childId = HiTraceChain::CreateSpan(); ++// // add childid to parcel data ++// uint8_t idBytes[HITRACE_ID_LEN]; ++// size_t idLen = (size_t)(childId.ToBytes(idBytes, HITRACE_ID_LEN)); ++// if (idLen != HITRACE_ID_LEN) { ++// ZLOGE(TRACE_LABEL, "%{public}s:idLen not correct", __func__); ++// return childId; ++// } + +- size_t oldWritePosition = data.GetWritePosition(); +- if (!data.WriteBuffer(idBytes, idLen)) { +- ZLOGE(TRACE_LABEL, "%{public}s:Write idBytes fail", __func__); +- // restore Parcel data +- data.RewindWrite(oldWritePosition); +- return childId; +- } ++// size_t oldWritePosition = data.GetWritePosition(); ++// if (!data.WriteBuffer(idBytes, idLen)) { ++// ZLOGE(TRACE_LABEL, "%{public}s:Write idBytes fail", __func__); ++// // restore Parcel data ++// data.RewindWrite(oldWritePosition); ++// return childId; ++// } + +- // padded size of traceid +- if (!data.WriteUint8(data.GetWritePosition() - oldWritePosition)) { +- ZLOGE(TRACE_LABEL, "%{public}s:Write idLen fail", __func__); +- // restore Parcel data +- data.RewindWrite(oldWritePosition); +- return childId; +- } +- // tracepoint: CS(Client Send) +- HiTraceChain::Tracepoint(HITRACE_TP_CS, childId, "%s handle=%d,code=%u", +- (flags & TF_ONE_WAY) ? "ASYNC" : "SYNC", +- handle, code); +- flags |= TF_HITRACE; +- } +- return childId; +-} ++// // padded size of traceid ++// if (!data.WriteUint8(data.GetWritePosition() - oldWritePosition)) { ++// ZLOGE(TRACE_LABEL, "%{public}s:Write idLen fail", __func__); ++// // restore Parcel data ++// data.RewindWrite(oldWritePosition); ++// return childId; ++// } ++// // tracepoint: CS(Client Send) ++// HiTraceChain::Tracepoint(HITRACE_TP_CS, childId, "%s handle=%d,code=%u", ++// (flags & TF_ONE_WAY) ? "ASYNC" : "SYNC", ++// handle, code); ++// flags |= TF_HITRACE; ++// } ++// return childId; ++// } + +-void HitraceInvoker::TraceClientReceieve(int32_t handle, uint32_t code, uint32_t flags, const HiTraceId &traceId, +- const HiTraceId &childId) +-{ +- if (!(flags & TF_HITRACE)) { +- return; +- } +- bool isClientTraced = IsClientTraced(handle, flags, traceId); +- if (isClientTraced) { +- if (!(flags & TF_ONE_WAY)) { +- // restore thread trace id +- HiTraceChain::SetId(traceId); +- // tracepoint: CR(Client Receive) +- HiTraceChain::Tracepoint(HITRACE_TP_CR, childId, "%s handle=%d,code=%u", "SYNC", handle, code); +- } +- } +-} ++// void HitraceInvoker::TraceClientReceieve(int32_t handle, uint32_t code, uint32_t flags, const HiTraceId &traceId, ++// const HiTraceId &childId) ++// { ++// if (!(flags & TF_HITRACE)) { ++// return; ++// } ++// bool isClientTraced = IsClientTraced(handle, flags, traceId); ++// if (isClientTraced) { ++// if (!(flags & TF_ONE_WAY)) { ++// // restore thread trace id ++// HiTraceChain::SetId(traceId); ++// // tracepoint: CR(Client Receive) ++// HiTraceChain::Tracepoint(HITRACE_TP_CR, childId, "%s handle=%d,code=%u", "SYNC", handle, code); ++// } ++// } ++// } + +-void HitraceInvoker::RecoveryDataAndFlag(Parcel &data, uint32_t &flags, size_t oldReadPosition, uint8_t idLen) +-{ +- // restore data +- data.RewindRead(oldReadPosition); +- // padded size(4 bytes) of uint8_t +- data.SetDataSize(data.GetDataSize() - PADDED_SIZE_OF_PARCEL - idLen); +- flags &= ~(uint32_t)TF_HITRACE; +-} ++// void HitraceInvoker::RecoveryDataAndFlag(Parcel &data, uint32_t &flags, size_t oldReadPosition, uint8_t idLen) ++// { ++// // restore data ++// data.RewindRead(oldReadPosition); ++// // padded size(4 bytes) of uint8_t ++// data.SetDataSize(data.GetDataSize() - PADDED_SIZE_OF_PARCEL - idLen); ++// flags &= ~(uint32_t)TF_HITRACE; ++// } + +-bool HitraceInvoker::TraceServerReceieve(int32_t handle, uint32_t code, Parcel &data, uint32_t &flags) +-{ +- bool isServerTraced = (flags & TF_HITRACE) != 0; +- if (isServerTraced) { +- size_t oldReadPosition = data.GetReadPosition(); +- // padded size(4 bytes) of uint8_t +- data.RewindRead(data.GetDataSize() - PADDED_SIZE_OF_PARCEL); +- // the padded size of traceid +- uint8_t idLen = data.ReadUint8(); +- if (idLen >= sizeof(HiTraceIdStruct)) { +- // padded size(4 bytes) of uint8_t +- data.RewindRead(data.GetDataSize() - PADDED_SIZE_OF_PARCEL - idLen); +- const uint8_t *idBytes = data.ReadUnpadBuffer(sizeof(HiTraceIdStruct)); +- if (idBytes == nullptr) { +- ZLOGE(TRACE_LABEL, "%{public}s:idBytes is null", __func__); +- isServerTraced = 0; +- RecoveryDataAndFlag(data, flags, oldReadPosition, idLen); +- return isServerTraced; +- } +- HiTraceId traceId(idBytes, sizeof(HiTraceIdStruct)); +- HiTraceChain::SetId(traceId); +- // tracepoint: SR(Server Receive) +- HiTraceChain::Tracepoint(HITRACE_TP_SR, traceId, +- "%s handle=%d,code=%u", (flags & TF_ONE_WAY) ? "ASYNC" : "SYNC", +- handle, code); +- } ++// bool HitraceInvoker::TraceServerReceieve(int32_t handle, uint32_t code, Parcel &data, uint32_t &flags) ++// { ++// bool isServerTraced = (flags & TF_HITRACE) != 0; ++// if (isServerTraced) { ++// size_t oldReadPosition = data.GetReadPosition(); ++// // padded size(4 bytes) of uint8_t ++// data.RewindRead(data.GetDataSize() - PADDED_SIZE_OF_PARCEL); ++// // the padded size of traceid ++// uint8_t idLen = data.ReadUint8(); ++// if (idLen >= sizeof(HiTraceIdStruct)) { ++// // padded size(4 bytes) of uint8_t ++// data.RewindRead(data.GetDataSize() - PADDED_SIZE_OF_PARCEL - idLen); ++// const uint8_t *idBytes = data.ReadUnpadBuffer(sizeof(HiTraceIdStruct)); ++// if (idBytes == nullptr) { ++// ZLOGE(TRACE_LABEL, "%{public}s:idBytes is null", __func__); ++// isServerTraced = 0; ++// RecoveryDataAndFlag(data, flags, oldReadPosition, idLen); ++// return isServerTraced; ++// } ++// HiTraceId traceId(idBytes, sizeof(HiTraceIdStruct)); ++// HiTraceChain::SetId(traceId); ++// // tracepoint: SR(Server Receive) ++// HiTraceChain::Tracepoint(HITRACE_TP_SR, traceId, ++// "%s handle=%d,code=%u", (flags & TF_ONE_WAY) ? "ASYNC" : "SYNC", ++// handle, code); ++// } + +- RecoveryDataAndFlag(data, flags, oldReadPosition, idLen); +- } +- return isServerTraced; +-} ++// RecoveryDataAndFlag(data, flags, oldReadPosition, idLen); ++// } ++// return isServerTraced; ++// } + +-void HitraceInvoker::TraceServerSend(int32_t handle, uint32_t code, bool isServerTraced, uint32_t flags) +-{ +- if (isServerTraced) { +- // tracepoint: SS(Server Send) +- HiTraceChain::Tracepoint(HITRACE_TP_SS, HiTraceChain::GetId(), "%s handle=%d,code=%u", +- (flags & TF_ONE_WAY) ? "ASYNC" : "SYNC", handle, code); +- } +- HiTraceChain::ClearId(); +-} ++// void HitraceInvoker::TraceServerSend(int32_t handle, uint32_t code, bool isServerTraced, uint32_t flags) ++// { ++// if (isServerTraced) { ++// // tracepoint: SS(Server Send) ++// HiTraceChain::Tracepoint(HITRACE_TP_SS, HiTraceChain::GetId(), "%s handle=%d,code=%u", ++// (flags & TF_ONE_WAY) ? "ASYNC" : "SYNC", handle, code); ++// } ++// HiTraceChain::ClearId(); ++// } + } // namespace OHOS +diff --git a/ipc/native/src/mock/source/invoker_factory.cpp b/ipc/native/src/mock/source/invoker_factory.cpp +index 5b2946b..e539639 100644 +--- a/ipc/native/src/mock/source/invoker_factory.cpp ++++ b/ipc/native/src/mock/source/invoker_factory.cpp +@@ -18,7 +18,7 @@ + #include + #include + +-#include "__mutex_base" ++// #include "__mutex_base" + #include "functional" + #include "iremote_invoker.h" + #include "unordered_map" +diff --git a/ipc/native/src/napi/src/napi_remote_object.cpp b/ipc/native/src/napi/src/napi_remote_object.cpp +index 1275bb3..4ff5260 100644 +--- a/ipc/native/src/napi/src/napi_remote_object.cpp ++++ b/ipc/native/src/napi/src/napi_remote_object.cpp +@@ -22,7 +22,7 @@ + #include + #include "access_token_adapter.h" + #include "hilog/log.h" +-#include "hitrace_meter.h" ++// #include "hitrace_meter.h" + #include "ipc_object_proxy.h" + #include "ipc_object_stub.h" + #include "ipc_skeleton.h" +diff --git a/ipc/native/src/napi/src/napi_remote_proxy.cpp b/ipc/native/src/napi/src/napi_remote_proxy.cpp +index 0239944..9b4c6d9 100644 +--- a/ipc/native/src/napi/src/napi_remote_proxy.cpp ++++ b/ipc/native/src/napi/src/napi_remote_proxy.cpp +@@ -21,7 +21,7 @@ + #include + #include "access_token_adapter.h" + #include "hilog/log.h" +-#include "hitrace_meter.h" ++// #include "hitrace_meter.h" + #include "ipc_object_proxy.h" + #include "ipc_object_stub.h" + #include "ipc_skeleton.h" +diff --git a/ipc/native/test/unittest/common/ipc_hitrace_unittest.cpp b/ipc/native/test/unittest/common/ipc_hitrace_unittest.cpp +index 8b008f5..77649f0 100644 +--- a/ipc/native/test/unittest/common/ipc_hitrace_unittest.cpp ++++ b/ipc/native/test/unittest/common/ipc_hitrace_unittest.cpp +@@ -23,7 +23,7 @@ + #include + #include + #include "ipc_debug.h" +-#include "hitrace/trace.h" ++// #include "hitrace/trace.h" + #include "ipc_skeleton.h" + #include "ipc_object_proxy.h" + #include "test_service_skeleton.h" +diff --git a/services/dbinder/test/distributedtest/include/dbinder_test_service_skeleton.h b/services/dbinder/test/distributedtest/include/dbinder_test_service_skeleton.h +index 41fe229..40d5177 100644 +--- a/services/dbinder/test/distributedtest/include/dbinder_test_service_skeleton.h ++++ b/services/dbinder/test/distributedtest/include/dbinder_test_service_skeleton.h +@@ -23,7 +23,7 @@ + #include "iremote_proxy.h" + #include "hilog/log.h" + #include "log_tags.h" +-#include "hitrace/trace.h" ++// #include "hitrace/trace.h" + + namespace OHOS { + class IDBinderTestService : public IRemoteBroker { +-- +2.33.0 + diff --git a/0002-fix-build-error-from-header-include.patch b/0002-fix-build-error-from-header-include.patch new file mode 100644 index 0000000000000000000000000000000000000000..e84a01740529abe020b1dc1a44974a26b728635d --- /dev/null +++ b/0002-fix-build-error-from-header-include.patch @@ -0,0 +1,93 @@ +From c4435b4448b3d8e95334528bbf0f2bdcf9ac5fa4 Mon Sep 17 00:00:00 2001 +From: heppen +Date: Sat, 23 Sep 2023 16:59:33 +0800 +Subject: [PATCH 2/2] adaption for build: remove useless headers, add some + headers + +--- + interfaces/innerkits/ipc_core/include/iremote_broker.h | 1 + + interfaces/innerkits/ipc_core/include/message_parcel.h | 1 + + ipc/native/src/core/source/ipc_object_proxy.cpp | 2 +- + ipc/native/src/core/source/iremote_broker.cpp | 2 +- + ipc/native/src/mock/include/invoker_factory.h | 1 + + ipc/native/src/mock/source/binder_connector.cpp | 2 +- + 6 files changed, 6 insertions(+), 3 deletions(-) + +diff --git a/interfaces/innerkits/ipc_core/include/iremote_broker.h b/interfaces/innerkits/ipc_core/include/iremote_broker.h +index ed2045c..7105ff7 100644 +--- a/interfaces/innerkits/ipc_core/include/iremote_broker.h ++++ b/interfaces/innerkits/ipc_core/include/iremote_broker.h +@@ -18,6 +18,7 @@ + + #include + #include ++#include + #include "iremote_object.h" + #include "refbase.h" + +diff --git a/interfaces/innerkits/ipc_core/include/message_parcel.h b/interfaces/innerkits/ipc_core/include/message_parcel.h +index 0f3302e..efa57ab 100644 +--- a/interfaces/innerkits/ipc_core/include/message_parcel.h ++++ b/interfaces/innerkits/ipc_core/include/message_parcel.h +@@ -20,6 +20,7 @@ + #include "parcel.h" + #include "refbase.h" + #include ++#include + + namespace OHOS { + class IRemoteObject; +diff --git a/ipc/native/src/core/source/ipc_object_proxy.cpp b/ipc/native/src/core/source/ipc_object_proxy.cpp +index 559c276..23f56a8 100644 +--- a/ipc/native/src/core/source/ipc_object_proxy.cpp ++++ b/ipc/native/src/core/source/ipc_object_proxy.cpp +@@ -17,7 +17,7 @@ + + #include + +-#include "__mutex_base" ++// #include "__mutex_base" + #include "algorithm" + #include "errors.h" + #include "hilog/log_c.h" +diff --git a/ipc/native/src/core/source/iremote_broker.cpp b/ipc/native/src/core/source/iremote_broker.cpp +index dcbb59c..12f498e 100644 +--- a/ipc/native/src/core/source/iremote_broker.cpp ++++ b/ipc/native/src/core/source/iremote_broker.cpp +@@ -17,7 +17,7 @@ + + #include + +-#include "__mutex_base" ++// #include "__mutex_base" + #include "functional" + #include "hilog/log_c.h" + #include "hilog/log_cpp.h" +diff --git a/ipc/native/src/mock/include/invoker_factory.h b/ipc/native/src/mock/include/invoker_factory.h +index 14bd25f..83086c5 100644 +--- a/ipc/native/src/mock/include/invoker_factory.h ++++ b/ipc/native/src/mock/include/invoker_factory.h +@@ -17,6 +17,7 @@ + #define OHOS_IPC_INVOKER_FACTORY_H + + #include ++#include + #include + #include "iremote_invoker.h" + +diff --git a/ipc/native/src/mock/source/binder_connector.cpp b/ipc/native/src/mock/source/binder_connector.cpp +index a262de6..733769d 100644 +--- a/ipc/native/src/mock/source/binder_connector.cpp ++++ b/ipc/native/src/mock/source/binder_connector.cpp +@@ -21,7 +21,7 @@ + #include + #include + +-#include "__mutex_base" ++// #include "__mutex_base" + #include "cerrno" + #include "hilog/log_c.h" + #include "hilog/log_cpp.h" +-- +2.33.0 + diff --git a/0003-adapt-binder-as-a-kernel-module.patch b/0003-adapt-binder-as-a-kernel-module.patch new file mode 100644 index 0000000000000000000000000000000000000000..b36669f4dc7dc4cce96c83b3396a696fb75072bb --- /dev/null +++ b/0003-adapt-binder-as-a-kernel-module.patch @@ -0,0 +1,197 @@ +From 94b7c10aba2a0c79b88a2b37598adefd206f3e5b Mon Sep 17 00:00:00 2001 +From: heppen +Date: Mon, 26 Jun 2023 17:11:55 +0800 +Subject: [PATCH] Adapt binder as a kernel module + +--- + Makefile | 21 ++++++++--- + binder.c | 26 +++++++++++-- + binder_alloc.c | 2 +- + external_symbols.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++ + 4 files changed, 131 insertions(+), 9 deletions(-) + create mode 100644 external_symbols.c + +diff --git a/Makefile b/Makefile +index c9d3d0c..5d07f84 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,6 +1,17 @@ +-# SPDX-License-Identifier: GPL-2.0-only +-ccflags-y += -I$(src) # needed for trace events ++CONFIG_MODULE_SIG=n ++ccflags-y += -I$(src) -Wno-int-conversion -Wno-implicit-function-declaration -DCONFIG_ANDROID_BINDER_DEVICES=\"binder\" + +-obj-$(CONFIG_ANDROID_BINDERFS) += binderfs.o +-obj-$(CONFIG_ANDROID_BINDER_IPC) += binder.o binder_alloc.o +-obj-$(CONFIG_ANDROID_BINDER_IPC_SELFTEST) += binder_alloc_selftest.o ++# only support openEuler-22.03-LTS-SP2 kernel. ++ifneq ($(KERNELRELEASE),) ++obj-m := binder_linux.o ++binder_linux-y := external_symbols.o binder.o binder_alloc.o ++else ++KERNEL_SRC ?= /lib/modules/$(shell uname -r)/build ++ ++ ++all: ++ $(MAKE) -C $(KERNEL_SRC) V=0 M=$$PWD ++ ++clean: ++ $(MAKE) -C $(KERNEL_SRC) M=$$PWD clean ++endif +diff --git a/binder.c b/binder.c +index b403c7f..35384d8 100644 +--- a/binder.c ++++ b/binder.c +@@ -2039,8 +2039,8 @@ static size_t binder_get_object(struct binder_proc *proc, + return 0; + } else { + if (binder_alloc_copy_from_buffer(&proc->alloc, object, buffer, +- offset, read_size)) +- return 0; ++ offset, read_size)) ++ return 0; + } + + /* Ok, now see if we read a complete object. */ +@@ -6531,7 +6531,27 @@ err_alloc_device_names_failed: + return ret; + } + +-device_initcall(binder_init); ++static void __exit binder_exit(void) ++{ ++ struct hlist_node *tmp; ++ struct binder_device *device; ++ ++ debugfs_remove_recursive(binder_debugfs_dir_entry_root); ++ ++ if (!IS_ENABLED(CONFIG_ANDROID_BINDERFS) && ++ strcmp(binder_devices_param, "") != 0) { ++ hlist_for_each_entry_safe (device, tmp, &binder_devices,hlist) { ++ misc_deregister(&device->miscdev); ++ hlist_del(&device->hlist); ++ kfree(device); ++ } ++ } ++ ++ pr_info("unloaded\n"); ++} ++ ++module_init(binder_init); ++module_exit(binder_exit); + + #define CREATE_TRACE_POINTS + #include "binder_trace.h" +diff --git a/binder_alloc.c b/binder_alloc.c +index a77ed66..1f5446c 100644 +--- a/binder_alloc.c ++++ b/binder_alloc.c +@@ -38,7 +38,7 @@ enum { + }; + static uint32_t binder_alloc_debug_mask = BINDER_DEBUG_USER_ERROR; + +-module_param_named(debug_mask, binder_alloc_debug_mask, ++module_param_named(alloc_debug_mask, binder_alloc_debug_mask, + uint, 0644); + + #define binder_alloc_debug(mask, x...) \ +diff --git a/external_symbols.c b/external_symbols.c +new file mode 100644 +index 0000000..4ee95e7 +--- /dev/null ++++ b/external_symbols.c +@@ -0,0 +1,91 @@ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++static struct kprobe kp = { ++ .symbol_name = "kallsyms_lookup_name" ++}; ++typedef unsigned long (*kallsyms_lookup_name_t)(const char *name); ++ ++static kallsyms_lookup_name_t kallsyms_lookup_name_ptr = NULL; ++ ++kallsyms_lookup_name_t static get_lookup(void) { ++ if (kallsyms_lookup_name_ptr == NULL) { ++ register_kprobe(&kp); ++ kallsyms_lookup_name_ptr = (kallsyms_lookup_name_t) kp.addr; ++ unregister_kprobe(&kp); ++ } ++ return kallsyms_lookup_name_ptr; ++} ++ ++static void (*zap_page_range_ptr)(struct vm_area_struct *, unsigned long, unsigned long) = NULL; ++static int (*can_nice_ptr)(const struct task_struct *, const int) = NULL; ++static int (*security_binder_set_context_mgr_ptr)(struct task_struct *mgr) = NULL; ++static int (*security_binder_transaction_ptr)(struct task_struct *from, struct task_struct *to) = NULL; ++static int (*security_binder_transfer_binder_ptr)(struct task_struct *from, struct task_struct *to) = NULL; ++static int (*security_binder_transfer_file_ptr)(struct task_struct *from, struct task_struct *to, struct file *file) = NULL; ++static int (*task_work_add_ptr)(struct task_struct *task, struct callback_head *twork, ++ enum task_work_notify_mode mode) = NULL; ++static void (*__wake_up_pollfree_ptr)(wait_queue_head_t *wq_head) = NULL; ++ ++static int (*close_fd_get_file_ptr)(unsigned int fd, struct file **res) = NULL; ++ ++void zap_page_range(struct vm_area_struct *vma, unsigned long address, unsigned long size) ++{ ++ zap_page_range_ptr = get_lookup()("zap_page_range"); ++ zap_page_range_ptr(vma, address, size); ++} ++ ++int can_nice(const struct task_struct *p, const int nice) ++{ ++ can_nice_ptr = get_lookup()("can_nice"); ++ return can_nice_ptr(p, nice); ++} ++ ++int security_binder_set_context_mgr(struct task_struct *mgr) ++{ ++ security_binder_set_context_mgr_ptr = get_lookup()("security_binder_set_context_mgr"); ++ return security_binder_set_context_mgr_ptr(mgr); ++} ++ ++int security_binder_transaction(struct task_struct *from, struct task_struct *to) ++{ ++ security_binder_transaction_ptr = get_lookup()("security_binder_transaction"); ++ return security_binder_transaction_ptr(from, to); ++} ++ ++int security_binder_transfer_binder(struct task_struct *from, struct task_struct *to) ++{ ++ security_binder_transfer_binder_ptr = get_lookup()("security_binder_transfer_binder"); ++ return security_binder_transfer_binder_ptr(from, to); ++} ++ ++int security_binder_transfer_file(struct task_struct *from, struct task_struct *to, struct file *file) ++{ ++ security_binder_transfer_file_ptr = get_lookup()("security_binder_transfer_file"); ++ return security_binder_transfer_file_ptr(from, to, file); ++} ++ ++int task_work_add(struct task_struct *task, struct callback_head *twork, ++ enum task_work_notify_mode mode) ++{ ++ task_work_add_ptr = get_lookup()("task_work_add"); ++ return task_work_add_ptr(task, twork, mode); ++} ++ ++int close_fd_get_file(unsigned int fd, struct file **res) ++{ ++ close_fd_get_file_ptr = get_lookup()("close_fd_get_file"); ++ return close_fd_get_file_ptr(fd, res); ++} ++ ++void __wake_up_pollfree(wait_queue_head_t *wq_head) ++{ ++ __wake_up_pollfree_ptr = get_lookup()("__wake_up_pollfree"); ++ return __wake_up_pollfree_ptr(wq_head); ++} +-- +2.33.0 + diff --git a/0004-adapt-compilation-for-softbus_client.patch b/0004-adapt-compilation-for-softbus_client.patch new file mode 100644 index 0000000000000000000000000000000000000000..cfb3ee240b2bfe481de3fde3b0a1793f0b52cfc4 --- /dev/null +++ b/0004-adapt-compilation-for-softbus_client.patch @@ -0,0 +1,1293 @@ +From 15e2ccf02e15fd6e9ea0e8f86b013ff49b8533e5 Mon Sep 17 00:00:00 2001 +From: heppen +Date: Tue, 26 Sep 2023 17:22:20 +0800 +Subject: [PATCH] adapt compilation for softbus_client + +--- + adapter/BUILD.gn | 2 +- + .../common/bus_center/bus_center_adapter.gni | 4 +- + .../common/dfx/softbus_adapter_hisysevent.cpp | 263 +++++++++--------- + .../kernel/posix/softbus_adapter_thread.c | 3 +- + .../feature_config/standard/config.gni | 2 +- + bundle.json | 3 - + .../src/fillp_lib/src/fillp/fillp_input.c | 26 +- + .../bus_center/src/bus_center_adapter.c | 2 +- + core/authentication/authentication.gni | 1 + + core/authentication/include/auth_config.h | 35 +++ + core/authentication/include/auth_hichain.h | 2 + + core/authentication/src/auth_config.c | 65 +++++ + core/authentication/src/auth_hichain.c | 13 +- + core/authentication/src/auth_manager.c | 2 +- + core/authentication/src/auth_session_fsm.c | 12 + + core/authentication/src/auth_session_key.c | 2 +- + .../lane_manager/src/lnn_lane_link_proc.c | 2 +- + .../lane_manager/src/lnn_select_rule.c | 2 +- + .../net_buscenter/src/lnn_network_manager.c | 2 +- + core/common/include/softbus_def.h | 4 +- + core/common/message_handler/message_handler.c | 8 - + .../standard/softbus_permission.cpp | 151 +++++----- + .../softbus_property/softbus_feature_config.c | 6 +- + .../common/src/softbus_thread_pool.c | 3 +- + core/frame/BUILD.gn | 6 +- + .../src/permission_status_change_cb.cpp | 18 +- + .../src/softbus_client_info_manager.cpp | 9 +- + .../standard/init/src/softbus_server_stub.cpp | 137 ++++----- + .../tcp_direct/src/trans_tcp_direct_manager.c | 2 +- + .../tcp_direct/src/trans_tcp_direct_wifi.c | 2 +- + 30 files changed, 458 insertions(+), 331 deletions(-) + create mode 100644 core/authentication/include/auth_config.h + create mode 100644 core/authentication/src/auth_config.c + +diff --git a/adapter/BUILD.gn b/adapter/BUILD.gn +index 20f4e60..2b7fa0f 100644 +--- a/adapter/BUILD.gn ++++ b/adapter/BUILD.gn +@@ -206,7 +206,7 @@ if (defined(ohos_lite)) { + public_configs = [ ":config_adapter_common" ] + if (is_standard_system) { + external_deps = [ +- "hisysevent_native:libhisysevent", ++ # "hisysevent_native:libhisysevent", + "hiviewdfx_hilog_native:libhilog", + ] + } +diff --git a/adapter/common/bus_center/bus_center_adapter.gni b/adapter/common/bus_center/bus_center_adapter.gni +index ebd12a0..6c8887d 100644 +--- a/adapter/common/bus_center/bus_center_adapter.gni ++++ b/adapter/common/bus_center/bus_center_adapter.gni +@@ -87,8 +87,8 @@ if (defined(ohos_lite)) { + if (has_ces_part) { + bus_center_adapter_src += + [ "$adapter_bus_center_path/common_event/lnn_common_event_monitor.cpp" ] +- bus_center_adapter_external_deps += +- [ "common_event_service:cesfwk_innerkits" ] ++ # bus_center_adapter_external_deps += ++ # [ "common_event_service:cesfwk_innerkits" ] + } else { + bus_center_adapter_src += [ "$adapter_bus_center_path/common_event/lnn_common_event_monitor_virtual.cpp" ] + } +diff --git a/adapter/common/dfx/softbus_adapter_hisysevent.cpp b/adapter/common/dfx/softbus_adapter_hisysevent.cpp +index 1c6d363..d044903 100644 +--- a/adapter/common/dfx/softbus_adapter_hisysevent.cpp ++++ b/adapter/common/dfx/softbus_adapter_hisysevent.cpp +@@ -23,127 +23,127 @@ + #include "softbus_adapter_mem.h" + #include "softbus_adapter_thread.h" + #include "message_handler.h" +-#include "hisysevent_c.h" ++// #include "hisysevent_c.h" + +-static const char *g_domain = "DSOFTBUS"; +-static bool g_init_lock = false; +-static SoftBusMutex g_dfx_lock; +-static HiSysEventParam g_dstParam[SOFTBUS_EVT_PARAM_BUTT]; ++// static const char *g_domain = "DSOFTBUS"; ++// static bool g_init_lock = false; ++// static SoftBusMutex g_dfx_lock; ++// static HiSysEventParam g_dstParam[SOFTBUS_EVT_PARAM_BUTT]; + +-static int32_t ConvertEventParam(SoftBusEvtParam *srcParam, HiSysEventParam *dstParam) +-{ +- switch (srcParam->paramType) { +- case SOFTBUS_EVT_PARAMTYPE_BOOL: +- dstParam->t = HISYSEVENT_BOOL; +- dstParam->v.b = srcParam->paramValue.b; +- break; +- case SOFTBUS_EVT_PARAMTYPE_UINT8: +- dstParam->t = HISYSEVENT_UINT8; +- dstParam->v.ui8 = srcParam->paramValue.u8v; +- break; +- case SOFTBUS_EVT_PARAMTYPE_UINT16: +- dstParam->t = HISYSEVENT_UINT16; +- dstParam->v.ui16 = srcParam->paramValue.u16v; +- break; +- case SOFTBUS_EVT_PARAMTYPE_INT32: +- dstParam->t = HISYSEVENT_INT32; +- dstParam->v.i32 = srcParam->paramValue.i32v; +- break; +- case SOFTBUS_EVT_PARAMTYPE_UINT32: +- dstParam->t = HISYSEVENT_UINT32; +- dstParam->v.ui32 = srcParam->paramValue.u32v; +- break; +- case SOFTBUS_EVT_PARAMTYPE_UINT64: +- dstParam->t = HISYSEVENT_UINT64; +- dstParam->v.ui64 = srcParam->paramValue.u64v; +- break; +- case SOFTBUS_EVT_PARAMTYPE_FLOAT: +- dstParam->t = HISYSEVENT_FLOAT; +- dstParam->v.f = srcParam->paramValue.f; +- break; +- case SOFTBUS_EVT_PARAMTYPE_DOUBLE: +- dstParam->t = HISYSEVENT_DOUBLE; +- dstParam->v.d = srcParam->paramValue.d; +- break; +- case SOFTBUS_EVT_PARAMTYPE_STRING: +- dstParam->t = HISYSEVENT_STRING; +- dstParam->v.s = (char *)SoftBusCalloc(sizeof(char) * SOFTBUS_HISYSEVT_PARAM_LEN); +- if (dstParam->v.s == NULL) { +- HILOG_ERROR(SOFTBUS_HILOG_ID, "ConvertEventParam: SoftBusMalloc fail"); +- return SOFTBUS_ERR; +- } +- if (strcpy_s(dstParam->v.s, SOFTBUS_HISYSEVT_PARAM_LEN, srcParam->paramValue.str) != EOK) { +- SoftBusFree(dstParam->v.s); +- HILOG_ERROR(SOFTBUS_HILOG_ID, "ConvertEventParam:copy string var fail"); +- return SOFTBUS_ERR; +- } +- break; +- default: +- break; +- } +- return SOFTBUS_OK; +-} ++// static int32_t ConvertEventParam(SoftBusEvtParam *srcParam, HiSysEventParam *dstParam) ++// { ++ // switch (srcParam->paramType) { ++ // case SOFTBUS_EVT_PARAMTYPE_BOOL: ++ // dstParam->t = HISYSEVENT_BOOL; ++ // dstParam->v.b = srcParam->paramValue.b; ++ // break; ++ // case SOFTBUS_EVT_PARAMTYPE_UINT8: ++ // dstParam->t = HISYSEVENT_UINT8; ++ // dstParam->v.ui8 = srcParam->paramValue.u8v; ++ // break; ++ // case SOFTBUS_EVT_PARAMTYPE_UINT16: ++ // dstParam->t = HISYSEVENT_UINT16; ++ // dstParam->v.ui16 = srcParam->paramValue.u16v; ++ // break; ++ // case SOFTBUS_EVT_PARAMTYPE_INT32: ++ // dstParam->t = HISYSEVENT_INT32; ++ // dstParam->v.i32 = srcParam->paramValue.i32v; ++ // break; ++ // case SOFTBUS_EVT_PARAMTYPE_UINT32: ++ // dstParam->t = HISYSEVENT_UINT32; ++ // dstParam->v.ui32 = srcParam->paramValue.u32v; ++ // break; ++ // case SOFTBUS_EVT_PARAMTYPE_UINT64: ++ // dstParam->t = HISYSEVENT_UINT64; ++ // dstParam->v.ui64 = srcParam->paramValue.u64v; ++ // break; ++ // case SOFTBUS_EVT_PARAMTYPE_FLOAT: ++ // dstParam->t = HISYSEVENT_FLOAT; ++ // dstParam->v.f = srcParam->paramValue.f; ++ // break; ++ // case SOFTBUS_EVT_PARAMTYPE_DOUBLE: ++ // dstParam->t = HISYSEVENT_DOUBLE; ++ // dstParam->v.d = srcParam->paramValue.d; ++ // break; ++ // case SOFTBUS_EVT_PARAMTYPE_STRING: ++ // dstParam->t = HISYSEVENT_STRING; ++ // dstParam->v.s = (char *)SoftBusCalloc(sizeof(char) * SOFTBUS_HISYSEVT_PARAM_LEN); ++ // if (dstParam->v.s == NULL) { ++ // HILOG_ERROR(SOFTBUS_HILOG_ID, "ConvertEventParam: SoftBusMalloc fail"); ++ // return SOFTBUS_ERR; ++ // } ++ // if (strcpy_s(dstParam->v.s, SOFTBUS_HISYSEVT_PARAM_LEN, srcParam->paramValue.str) != EOK) { ++ // SoftBusFree(dstParam->v.s); ++ // HILOG_ERROR(SOFTBUS_HILOG_ID, "ConvertEventParam:copy string var fail"); ++ // return SOFTBUS_ERR; ++ // } ++ // break; ++ // default: ++ // break; ++ // } ++// return SOFTBUS_OK; ++// } + +-static int32_t ConvertMsgToHiSysEvent(SoftBusEvtReportMsg *msg) +-{ +- if (memset_s(g_dstParam, sizeof(HiSysEventParam) * SOFTBUS_EVT_PARAM_BUTT, 0, +- sizeof(HiSysEventParam) * SOFTBUS_EVT_PARAM_BUTT) != EOK) { +- HILOG_ERROR(SOFTBUS_HILOG_ID, "init g_dstParam fail"); +- return SOFTBUS_ERR; +- } +- for (uint32_t i = 0; i < msg->paramNum; i++) { +- if (strcpy_s(g_dstParam[i].name, SOFTBUS_HISYSEVT_NAME_LEN, msg->paramArray[i].paramName) != EOK) { +- HILOG_ERROR(SOFTBUS_HILOG_ID, "copy param fail"); +- return SOFTBUS_ERR; +- } +- if (ConvertEventParam(&msg->paramArray[i], &g_dstParam[i]) != SOFTBUS_OK) { +- HILOG_ERROR(SOFTBUS_HILOG_ID, "ConvertMsgToHiSysEvent:convert param fail"); +- return SOFTBUS_ERR; +- } +- } +- return SOFTBUS_OK; +-} ++// static int32_t ConvertMsgToHiSysEvent(SoftBusEvtReportMsg *msg) ++// { ++// if (memset_s(g_dstParam, sizeof(HiSysEventParam) * SOFTBUS_EVT_PARAM_BUTT, 0, ++// sizeof(HiSysEventParam) * SOFTBUS_EVT_PARAM_BUTT) != EOK) { ++// HILOG_ERROR(SOFTBUS_HILOG_ID, "init g_dstParam fail"); ++// return SOFTBUS_ERR; ++// } ++// for (uint32_t i = 0; i < msg->paramNum; i++) { ++// if (strcpy_s(g_dstParam[i].name, SOFTBUS_HISYSEVT_NAME_LEN, msg->paramArray[i].paramName) != EOK) { ++// HILOG_ERROR(SOFTBUS_HILOG_ID, "copy param fail"); ++// return SOFTBUS_ERR; ++// } ++// if (ConvertEventParam(&msg->paramArray[i], &g_dstParam[i]) != SOFTBUS_OK) { ++// HILOG_ERROR(SOFTBUS_HILOG_ID, "ConvertMsgToHiSysEvent:convert param fail"); ++// return SOFTBUS_ERR; ++// } ++// } ++// return SOFTBUS_OK; ++// } + +-static void HiSysEventParamDeInit(uint32_t size) +-{ +- for (uint32_t i = 0; i < size; i++) { +- if (g_dstParam[i].t == HISYSEVENT_STRING && g_dstParam[i].v.s != NULL) { +- SoftBusFree(g_dstParam[i].v.s); +- g_dstParam[i].v.s = NULL; +- } +- } +- } ++// static void HiSysEventParamDeInit(uint32_t size) ++// { ++// for (uint32_t i = 0; i < size; i++) { ++// if (g_dstParam[i].t == HISYSEVENT_STRING && g_dstParam[i].v.s != NULL) { ++// SoftBusFree(g_dstParam[i].v.s); ++// g_dstParam[i].v.s = NULL; ++// } ++// } ++// } + +-static HiSysEventEventType ConvertMsgType(SoftBusEvtType type) +-{ +- HiSysEventEventType hiSysEvtType; +- switch (type) { +- case SOFTBUS_EVT_TYPE_FAULT: +- hiSysEvtType = HISYSEVENT_FAULT; +- break; +- case SOFTBUS_EVT_TYPE_STATISTIC: +- hiSysEvtType = HISYSEVENT_STATISTIC; +- break; +- case SOFTBUS_EVT_TYPE_SECURITY: +- hiSysEvtType = HISYSEVENT_SECURITY; +- break; +- case SOFTBUS_EVT_TYPE_BEHAVIOR: +- hiSysEvtType = HISYSEVENT_BEHAVIOR; +- break; +- default: +- hiSysEvtType = HISYSEVENT_STATISTIC; +- break; +- } +- return hiSysEvtType; +-} ++// static HiSysEventEventType ConvertMsgType(SoftBusEvtType type) ++// { ++// HiSysEventEventType hiSysEvtType; ++// switch (type) { ++// case SOFTBUS_EVT_TYPE_FAULT: ++// hiSysEvtType = HISYSEVENT_FAULT; ++// break; ++// case SOFTBUS_EVT_TYPE_STATISTIC: ++// hiSysEvtType = HISYSEVENT_STATISTIC; ++// break; ++// case SOFTBUS_EVT_TYPE_SECURITY: ++// hiSysEvtType = HISYSEVENT_SECURITY; ++// break; ++// case SOFTBUS_EVT_TYPE_BEHAVIOR: ++// hiSysEvtType = HISYSEVENT_BEHAVIOR; ++// break; ++// default: ++// hiSysEvtType = HISYSEVENT_STATISTIC; ++// break; ++// } ++// return hiSysEvtType; ++// } + +-static void InitHisEvtMutexLock() +-{ +- if (SoftBusMutexInit(&g_dfx_lock, NULL) != SOFTBUS_OK) { +- HILOG_ERROR(SOFTBUS_HILOG_ID, "init HisEvtMutexLock fail"); +- return; +- } +-} ++// static void InitHisEvtMutexLock() ++// { ++// if (SoftBusMutexInit(&g_dfx_lock, NULL) != SOFTBUS_OK) { ++// HILOG_ERROR(SOFTBUS_HILOG_ID, "init HisEvtMutexLock fail"); ++// return; ++// } ++// } + + #ifdef __cplusplus + #if __cplusplus +@@ -153,22 +153,23 @@ extern "C" { + + int32_t SoftbusWriteHisEvt(SoftBusEvtReportMsg* reportMsg) + { +- if (reportMsg == nullptr) { +- return SOFTBUS_ERR; +- } +- if (!g_init_lock) { +- InitHisEvtMutexLock(); +- g_init_lock = true; +- } +- if (SoftBusMutexLock(&g_dfx_lock) != 0) { +- HILOG_ERROR(SOFTBUS_HILOG_ID, "%s:lock failed", __func__); +- return SOFTBUS_LOCK_ERR; +- } +- ConvertMsgToHiSysEvent(reportMsg); +- OH_HiSysEvent_Write(g_domain, reportMsg->evtName, ConvertMsgType(reportMsg->evtType), +- g_dstParam, reportMsg->paramNum); +- HiSysEventParamDeInit(reportMsg->paramNum); +- (void)SoftBusMutexUnlock(&g_dfx_lock); ++ // if (reportMsg == nullptr) { ++ // return SOFTBUS_ERR; ++ // } ++ // if (!g_init_lock) { ++ // InitHisEvtMutexLock(); ++ // g_init_lock = true; ++ // } ++ // if (SoftBusMutexLock(&g_dfx_lock) != 0) { ++ // HILOG_ERROR(SOFTBUS_HILOG_ID, "%s:lock failed", __func__); ++ // return SOFTBUS_LOCK_ERR; ++ // } ++ // ConvertMsgToHiSysEvent(reportMsg); ++ // OH_HiSysEvent_Write(g_domain, reportMsg->evtName, ConvertMsgType(reportMsg->evtType), ++ // g_dstParam, reportMsg->paramNum); ++ // HiSysEventParamDeInit(reportMsg->paramNum); ++ // (void)SoftBusMutexUnlock(&g_dfx_lock); ++ (void)reportMsg; + return SOFTBUS_OK; + } + +diff --git a/adapter/common/kernel/posix/softbus_adapter_thread.c b/adapter/common/kernel/posix/softbus_adapter_thread.c +index f6c65e8..33eeaa9 100644 +--- a/adapter/common/kernel/posix/softbus_adapter_thread.c ++++ b/adapter/common/kernel/posix/softbus_adapter_thread.c +@@ -273,7 +273,8 @@ static int32_t SoftBusConfTransPthreadAttr(SoftBusThreadAttr *threadAttr, pthrea + if (stackSize != 0) { + ret = pthread_attr_setstacksize(attr, stackSize); + if (ret != 0) { +- HILOG_ERROR(SOFTBUS_HILOG_ID, "pthread_attr_setstacksize failed, ret[%{public}d]", ret); ++ HILOG_ERROR(SOFTBUS_HILOG_ID, "pthread_attr_setstacksize failed, stacksize[%{public}lu], ret[%{public}d]", ++ stackSize, ret); + return SOFTBUS_ERR; + } + } +diff --git a/adapter/default_config/feature_config/standard/config.gni b/adapter/default_config/feature_config/standard/config.gni +index 6602d7e..c9bb34f 100644 +--- a/adapter/default_config/feature_config/standard/config.gni ++++ b/adapter/default_config/feature_config/standard/config.gni +@@ -23,7 +23,7 @@ declare_args() { + dsoftbus_feature_protocol_newip = false + + dsoftbus_feature_trans_udp = true +- dsoftbus_feature_trans_udp_stream = false ++ dsoftbus_feature_trans_udp_stream = true + dsoftbus_feature_trans_udp_file = true + + dsoftbus_feature_ip_auth = true +diff --git a/bundle.json b/bundle.json +index fafbe1a..9ff4f14 100644 +--- a/bundle.json ++++ b/bundle.json +@@ -68,9 +68,6 @@ + "//foundation/communication/dsoftbus/sdk:softbus_client" + ], + "service_group":[ +- "//foundation/communication/dsoftbus/core:softbus_server", +- "//foundation/communication/dsoftbus/core/frame/standard/sa_profile:softbus_sa_profile", +- "//foundation/communication/dsoftbus/tools:tool" + ] + }, + "inner_kits": [ +diff --git a/components/nstackx/fillp/src/fillp_lib/src/fillp/fillp_input.c b/components/nstackx/fillp/src/fillp_lib/src/fillp/fillp_input.c +index 1290b8e..2c0d51f 100644 +--- a/components/nstackx/fillp/src/fillp_lib/src/fillp/fillp_input.c ++++ b/components/nstackx/fillp/src/fillp_lib/src/fillp/fillp_input.c +@@ -598,18 +598,18 @@ static FILLP_BOOL FillpCheckPackNumber(struct FillpPcb *pcb, struct FillpPktPack + return FILLP_FALSE; + } + +- FILLP_LOGDBG("fillp_sock_id:%d loss:%u,rate:%u,seq:%u,pkt:%u,flag:%u,oppRate:%u,lostSeq:%u", +- FILLP_GET_SOCKET(pcb)->index, FILLP_NTOHS(pack->pktLoss), +- FILLP_NTOHL(pack->rate), pktHdr->seqNum, pktHdr->pktNum, +- FILLP_NTOHS(pack->flag), FILLP_NTOHL(pack->oppositeSetRate), lostSeqNum); +- +- FILLP_LOGDTL("fillp_sock_id:%d, unSendList:%u,unackList:%u,unrecvList:%u, itemWaitTokenLists:%u, " +- "total:%u,curMemSize:%u,maxACKSeq:%u,ackSeqNum:%u,curSeq:%u", +- FILLP_GET_SOCKET(pcb)->index, pcb->send.unSendList.size, pcb->send.unackList.count, +- pcb->send.unrecvList.nodeNum, pcb->send.itemWaitTokenLists.nodeNum, +- (FILLP_UINT32)(pcb->send.unSendList.size + pcb->send.redunList.nodeNum + pcb->send.unackList.count + +- pcb->send.unrecvList.nodeNum + pcb->send.itemWaitTokenLists.nodeNum), +- pcb->send.curItemCount, pcb->send.maxAckNumFromReceiver, pcb->send.ackSeqNum, pcb->send.seqNum); ++ // FILLP_LOGDBG("fillp_sock_id:%d loss:%u,rate:%u,seq:%u,pkt:%u,flag:%u,oppRate:%u,lostSeq:%u", ++ // FILLP_GET_SOCKET(pcb)->index, FILLP_NTOHS(pack->pktLoss), ++ // FILLP_NTOHL(pack->rate), pktHdr->seqNum, pktHdr->pktNum, ++ // FILLP_NTOHS(pack->flag), FILLP_NTOHL(pack->oppositeSetRate), lostSeqNum); ++ ++ // FILLP_LOGDTL("fillp_sock_id:%d, unSendList:%u,unackList:%u,unrecvList:%u, itemWaitTokenLists:%u, " ++ // "total:%u,curMemSize:%u,maxACKSeq:%u,ackSeqNum:%u,curSeq:%u", ++ // FILLP_GET_SOCKET(pcb)->index, pcb->send.unSendList.size, pcb->send.unackList.count, ++ // pcb->send.unrecvList.nodeNum, pcb->send.itemWaitTokenLists.nodeNum, ++ // (FILLP_UINT32)(pcb->send.unSendList.size + pcb->send.redunList.nodeNum + pcb->send.unackList.count + ++ // pcb->send.unrecvList.nodeNum + pcb->send.itemWaitTokenLists.nodeNum), ++ // pcb->send.curItemCount, pcb->send.maxAckNumFromReceiver, pcb->send.ackSeqNum, pcb->send.seqNum); + return FILLP_TRUE; + } + +@@ -808,7 +808,7 @@ static void FillpPackInput(struct FillpPcb *pcb, FILLP_CONST struct NetBuf *p) + MoveUnackToUnrecvByPackInfo(pcb, ackSeqNum, lostSeqNum); + pcb->statistics.debugPcb.packRcv++; + +- FillpPackInputLog(pcb); ++ // FillpPackInputLog(pcb); + FillpFcPackInput(pcb, pack); + return; + } +diff --git a/core/adapter/bus_center/src/bus_center_adapter.c b/core/adapter/bus_center/src/bus_center_adapter.c +index 5cc0d50..1c96007 100644 +--- a/core/adapter/bus_center/src/bus_center_adapter.c ++++ b/core/adapter/bus_center/src/bus_center_adapter.c +@@ -27,7 +27,7 @@ + #include "softbus_errcode.h" + #include "softbus_log.h" + +-#define DEFAULT_DEVICE_NAME "OpenHarmony" ++#define DEFAULT_DEVICE_NAME "openEuler" + + int32_t GetCommonDevInfo(const CommonDeviceKey key, char *value, uint32_t len) + { +diff --git a/core/authentication/authentication.gni b/core/authentication/authentication.gni +index e835c44..9cffc27 100644 +--- a/core/authentication/authentication.gni ++++ b/core/authentication/authentication.gni +@@ -33,6 +33,7 @@ if (dsoftbus_feature_lnn_net) { + "$authentication_path/src/auth_connection.c", + "$authentication_path/src/auth_hichain.c", + "$authentication_path/src/auth_manager.c", ++ "$authentication_path/src/auth_config.c", + "$authentication_path/src/auth_request.c", + "$authentication_path/src/auth_session_fsm.c", + "$authentication_path/src/auth_session_key.c", +diff --git a/core/authentication/include/auth_config.h b/core/authentication/include/auth_config.h +new file mode 100644 +index 0000000..498b242 +--- /dev/null ++++ b/core/authentication/include/auth_config.h +@@ -0,0 +1,35 @@ ++/* ++ * Copyright (c) 2022 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/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. ++ */ ++ ++#ifndef AUTH_CONFIG_H ++#define AUTH_CONFIG_H ++#ifdef __cplusplus ++#if __cplusplus ++extern "C" { ++#endif ++#endif ++ ++int32_t AuthConfigInit(); ++ ++int32_t AuthConfigDeInit(); ++ ++bool GetHichainEnable(); ++ ++#ifdef __cplusplus ++#if __cplusplus ++} ++#endif ++#endif ++#endif /* AUTH_CONFIG_H */ +diff --git a/core/authentication/include/auth_hichain.h b/core/authentication/include/auth_hichain.h +index 8125411..dbbff1e 100644 +--- a/core/authentication/include/auth_hichain.h ++++ b/core/authentication/include/auth_hichain.h +@@ -37,6 +37,8 @@ int32_t HichainProcessData(int64_t authSeq, const uint8_t *data, uint32_t len); + + void HichainDestroy(void); + ++void OnFinish(int64_t authSeq, int operationCode, const char *returnData); ++ + #ifdef __cplusplus + #if __cplusplus + } +diff --git a/core/authentication/src/auth_config.c b/core/authentication/src/auth_config.c +new file mode 100644 +index 0000000..1c1fb5d +--- /dev/null ++++ b/core/authentication/src/auth_config.c +@@ -0,0 +1,65 @@ ++/* ++ * Copyright (c) 2022 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/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. ++ */ ++ ++#include "auth_common.h" ++#include "cJSON.h" ++#include "softbus_adapter_file.h" ++ ++#define TEST_JSON "{\"hichain\":0}" ++ ++const char *g_FileName = "/system/bin/auth_config.txt"; ++#define MAX_READ_LEN (1024) ++ ++typedef struct { ++ int32_t hichainEnable; ++} AuthConfig; ++ ++static AuthConfig g_authConfig; ++ ++int32_t AuthConfigInit() ++{ ++ g_authConfig.hichainEnable = 0; ++ ++ char readbuf[MAX_READ_LEN + 1] = {"\0"}; ++ int32_t maxLen = MAX_READ_LEN; ++ int32_t ret = SoftBusReadFullFile(g_FileName, readbuf, maxLen); ++ if (ret != SOFTBUS_OK) { ++ SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "SoftBusReadFullFile fail."); ++ return ret; ++ } ++ cJSON *data = cJSON_Parse((char *)readbuf); ++ if (data == NULL) { ++ SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "cJSON_Parse fail."); ++ return SOFTBUS_ERR; ++ } ++ if (!GetJsonObjectInt32Item(data, "hichain", &g_authConfig.hichainEnable)) { ++ SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "GetJsonObjectInt32Item fail."); ++ cJSON_Delete(data); ++ return SOFTBUS_ERR; ++ } ++ ++ SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO, "hichain: %d", g_authConfig.hichainEnable); ++ cJSON_Delete(data); ++ return SOFTBUS_OK; ++} ++ ++int32_t AuthConfigDeInit() ++{ ++ return SOFTBUS_OK; ++} ++ ++bool GetHichainEnable() { ++ return (g_authConfig.hichainEnable != 0); ++} +diff --git a/core/authentication/src/auth_hichain.c b/core/authentication/src/auth_hichain.c +index f7b362e..e371d25 100644 +--- a/core/authentication/src/auth_hichain.c ++++ b/core/authentication/src/auth_hichain.c +@@ -18,6 +18,7 @@ + #include + + #include "auth_common.h" ++#include "auth_config.h" + #include "auth_session_fsm.h" + #include "device_auth.h" + #include "device_auth_defines.h" +@@ -90,7 +91,7 @@ static void OnSessionKeyReturned(int64_t authSeq, const uint8_t *sessionKey, uin + (void)AuthSessionSaveSessionKey(authSeq, sessionKey, sessionKeyLen); + } + +-static void OnFinish(int64_t authSeq, int operationCode, const char *returnData) ++void OnFinish(int64_t authSeq, int operationCode, const char *returnData) + { + (void)operationCode; + (void)returnData; +@@ -227,6 +228,7 @@ static const GroupAuthManager *InitHichain(void) + DestroyDeviceAuthService(); + return NULL; + } ++ (void)AuthConfigInit(); + SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO, "hichain init succ."); + return gaIns; + } +@@ -297,6 +299,15 @@ int32_t HichainStartAuth(int64_t authSeq, const char *udid, const char *uid) + SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "hichain not initialized."); + return SOFTBUS_ERR; + } ++ ++ // bypass auth ++ if (!GetHichainEnable()) { ++ uint8_t tempKey[32] = {0}; ++ memset(tempKey, 1, 32); ++ g_hichainCallback.onSessionKeyReturned(authSeq, tempKey, 32); ++ return SOFTBUS_OK; ++ } ++ + char *authParams = GenDeviceLevelParam(udid, uid, true); + if (authParams == NULL) { + SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "generate auth param fail."); +diff --git a/core/authentication/src/auth_manager.c b/core/authentication/src/auth_manager.c +index e7b1ded..1066bec 100644 +--- a/core/authentication/src/auth_manager.c ++++ b/core/authentication/src/auth_manager.c +@@ -1242,7 +1242,7 @@ int32_t AuthDeviceDecrypt(int64_t authId, const uint8_t *inData, uint32_t inLen, + return SOFTBUS_AUTH_NOT_FOUND; + } + if (DecryptData(&auth->sessionKeyList, inData, inLen, outData, outLen) != SOFTBUS_OK) { +- SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "auth decrypt fail."); ++ SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "auth[%ld] decrypt fail.", authId); + DelAuthManager(auth, false); + return SOFTBUS_ENCRYPT_ERR; + } +diff --git a/core/authentication/src/auth_session_fsm.c b/core/authentication/src/auth_session_fsm.c +index eaf6844..cce230e 100644 +--- a/core/authentication/src/auth_session_fsm.c ++++ b/core/authentication/src/auth_session_fsm.c +@@ -264,6 +264,13 @@ static void HandleMsgRecvDeviceId(AuthFsm *authFsm, MessagePara *para) + ret = SOFTBUS_AUTH_SYNC_DEVID_FAIL; + break; + } ++ // bypass auth ++ if (!GetHichainEnable()) { ++ if (HichainStartAuth(authFsm->authSeq, info->udid, info->connInfo.peerUid) != SOFTBUS_OK) { ++ ret = SOFTBUS_AUTH_HICHAIN_AUTH_FAIL; ++ break; ++ } ++ } + } else { + /* just client need start authDevice. */ + if (HichainStartAuth(authFsm->authSeq, info->udid, info->connInfo.peerUid) != SOFTBUS_OK) { +@@ -275,6 +282,11 @@ static void HandleMsgRecvDeviceId(AuthFsm *authFsm, MessagePara *para) + ret = SOFTBUS_OK; + } while (false); + ++ // bypass auth ++ if (!GetHichainEnable()) { ++ OnFinish(authFsm->authSeq, 0, NULL); ++ } ++ + if (ret != SOFTBUS_OK) { + SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "handle devId msg fail, ret=%d", ret); + CompleteAuthSession(authFsm, ret); +diff --git a/core/authentication/src/auth_session_key.c b/core/authentication/src/auth_session_key.c +index 3856cbd..0e5dfcc 100644 +--- a/core/authentication/src/auth_session_key.c ++++ b/core/authentication/src/auth_session_key.c +@@ -25,7 +25,7 @@ + #include "softbus_errcode.h" + #include "softbus_log.h" + +-#define SESSION_KEY_MAX_NUM 10 ++#define SESSION_KEY_MAX_NUM 50 + #define LAST_USE_THRESHOLD_MS (30 * 1000L) /* 30s */ + + typedef struct { +diff --git a/core/bus_center/lnn/lane_hub/lane_manager/src/lnn_lane_link_proc.c b/core/bus_center/lnn/lane_hub/lane_manager/src/lnn_lane_link_proc.c +index c966df3..b37b90a 100755 +--- a/core/bus_center/lnn/lane_hub/lane_manager/src/lnn_lane_link_proc.c ++++ b/core/bus_center/lnn/lane_hub/lane_manager/src/lnn_lane_link_proc.c +@@ -34,7 +34,7 @@ + #include "softbus_network_utils.h" + #include "softbus_protocol_def.h" + #include "softbus_utils.h" +-#include "wifi_device.h" ++// #include "wifi_device.h" + + typedef int32_t (*LaneLinkByType)(uint32_t reqId, const LinkRequest *reqInfo, const LaneLinkCb *callback); + +diff --git a/core/bus_center/lnn/lane_hub/lane_manager/src/lnn_select_rule.c b/core/bus_center/lnn/lane_hub/lane_manager/src/lnn_select_rule.c +index 79712a6..ec66978 100644 +--- a/core/bus_center/lnn/lane_hub/lane_manager/src/lnn_select_rule.c ++++ b/core/bus_center/lnn/lane_hub/lane_manager/src/lnn_select_rule.c +@@ -30,7 +30,7 @@ + #include "softbus_network_utils.h" + #include "softbus_utils.h" + #include "softbus_wifi_api_adapter.h" +-#include "wifi_device.h" ++// #include "wifi_device.h" + + #define LNN_LINK_DEFAULT_SCORE 60 /* Indicates that scoring is not supported */ + +diff --git a/core/bus_center/lnn/net_buscenter/src/lnn_network_manager.c b/core/bus_center/lnn/net_buscenter/src/lnn_network_manager.c +index 91856d8..36ea248 100644 +--- a/core/bus_center/lnn/net_buscenter/src/lnn_network_manager.c ++++ b/core/bus_center/lnn/net_buscenter/src/lnn_network_manager.c +@@ -34,7 +34,7 @@ + #define LNN_DELIMITER_INSIDE ":" + + #define LNN_DEFAULT_IF_NAME_WLAN "wlan0" +-#define LNN_DEFAULT_IF_NAME_ETH "eth0" ++#define LNN_DEFAULT_IF_NAME_ETH "enp7s0" + #define LNN_DEFAULT_IF_NAME_BR "br0" + #define LNN_DEFAULT_IF_NAME_BLE "ble0" + +diff --git a/core/common/include/softbus_def.h b/core/common/include/softbus_def.h +index 2edb7f5..a34aa50 100644 +--- a/core/common/include/softbus_def.h ++++ b/core/common/include/softbus_def.h +@@ -53,8 +53,8 @@ extern "C" { + + #define MAX_SOCKET_ADDR_LEN 46 + +-#define MAX_SESSION_ID 16 +-#define MAX_SESSION_SERVER_NUMBER 10 ++#define MAX_SESSION_ID 80 ++#define MAX_SESSION_SERVER_NUMBER 50 + + #define WAIT_SERVER_READY_INTERVAL 200 + +diff --git a/core/common/message_handler/message_handler.c b/core/common/message_handler/message_handler.c +index d83ca3e..12a2be1 100644 +--- a/core/common/message_handler/message_handler.c ++++ b/core/common/message_handler/message_handler.c +@@ -196,15 +196,7 @@ static void *LoopTask(void *arg) + + static int StartNewLooperThread(SoftBusLooper *looper) + { +-#ifdef __aarch64__ + #define MAINLOOP_STACK_SIZE (2 * 1024 * 1024) +-#else +-#ifdef ASAN_BUILD +-#define MAINLOOP_STACK_SIZE 10240 +-#else +-#define MAINLOOP_STACK_SIZE 8192 +-#endif +-#endif + int ret; + SoftBusThreadAttr threadAttr; + SoftBusThread tid; +diff --git a/core/common/security/permission/standard/softbus_permission.cpp b/core/common/security/permission/standard/softbus_permission.cpp +index e2b3ac7..5016dec 100644 +--- a/core/common/security/permission/standard/softbus_permission.cpp ++++ b/core/common/security/permission/standard/softbus_permission.cpp +@@ -17,8 +17,9 @@ + + #include + #include ++#include + +-#include "accesstoken_kit.h" ++// #include "accesstoken_kit.h" + #include "ipc_skeleton.h" + #include "permission_entry.h" + #include "softbus_adapter_mem.h" +@@ -32,95 +33,100 @@ + #endif + + namespace { +- using namespace OHOS::Security; ++ // using namespace OHOS::Security; + + const std::string PERMISSION_JSON_FILE = PERMISSION_JSON_FILE_PATH; + const std::string DANGER_APP_PERMISSION = "ohos.permission.DISTRIBUTED_DATASYNC"; +- const int32_t SYSTEM_UID = 1000; +- const int32_t MULTE_USER_RADIX = 100000; +- const std::string SAMGR_PROCESS_NAME = "samgr"; ++ // const int32_t SYSTEM_UID = 1000; ++ // const int32_t MULTE_USER_RADIX = 100000; ++ // const std::string SAMGR_PROCESS_NAME = "samgr"; + } + + int32_t TransPermissionInit(void) + { +- int32_t ret = LoadPermissionJson(PERMISSION_JSON_FILE.c_str()); +- if (ret != SOFTBUS_OK) { +- return ret; +- } +- return InitDynamicPermission(); ++ // int32_t ret = LoadPermissionJson(PERMISSION_JSON_FILE.c_str()); ++ // if (ret != SOFTBUS_OK) { ++ // return ret; ++ // } ++ // return InitDynamicPermission(); ++ return SOFTBUS_OK; + } + + void TransPermissionDeinit(void) + { +- DeinitPermissionJson(); ++ // DeinitPermissionJson(); + } + + int32_t CheckTransPermission(pid_t callingUid, pid_t callingPid, + const char *pkgName, const char *sessionName, uint32_t actions) + { +- if (sessionName == nullptr || pkgName == nullptr) { +- return SOFTBUS_PERMISSION_DENIED; +- } +- SoftBusPermissionItem *pItem = CreatePermissionItem(NATIVE_APP, callingUid, callingPid, pkgName, actions); +- if (pItem == nullptr) { +- return SOFTBUS_MALLOC_ERR; +- } +- int32_t ret = CheckPermissionEntry(sessionName, pItem); +- SoftBusFree(pItem); +- if (ret >= SYSTEM_APP) { +- return SOFTBUS_OK; +- } +- return SOFTBUS_PERMISSION_DENIED; ++ // if (sessionName == nullptr || pkgName == nullptr) { ++ // return SOFTBUS_PERMISSION_DENIED; ++ // } ++ // SoftBusPermissionItem *pItem = CreatePermissionItem(NATIVE_APP, callingUid, callingPid, pkgName, actions); ++ // if (pItem == nullptr) { ++ // return SOFTBUS_MALLOC_ERR; ++ // } ++ // int32_t ret = CheckPermissionEntry(sessionName, pItem); ++ // SoftBusFree(pItem); ++ // if (ret >= SYSTEM_APP) { ++ // return SOFTBUS_OK; ++ // } ++ // return SOFTBUS_PERMISSION_DENIED; ++ return SOFTBUS_OK; + } + + int32_t CheckTransSecLevel(const char *mySessionName, const char *peerSessionName) + { +- if (mySessionName == nullptr || peerSessionName == nullptr) { +- return SOFTBUS_INVALID_PARAM; +- } +- if (strcmp(mySessionName, peerSessionName) == 0) { +- return SOFTBUS_OK; +- } +- if (!PermIsSecLevelPublic(mySessionName)) { +- return SOFTBUS_PERMISSION_DENIED; +- } +- if (!PermIsSecLevelPublic(peerSessionName)) { +- return SOFTBUS_PERMISSION_DENIED; +- } ++ // if (mySessionName == nullptr || peerSessionName == nullptr) { ++ // return SOFTBUS_INVALID_PARAM; ++ // } ++ // if (strcmp(mySessionName, peerSessionName) == 0) { ++ // return SOFTBUS_OK; ++ // } ++ // if (!PermIsSecLevelPublic(mySessionName)) { ++ // return SOFTBUS_PERMISSION_DENIED; ++ // } ++ // if (!PermIsSecLevelPublic(peerSessionName)) { ++ // return SOFTBUS_PERMISSION_DENIED; ++ // } + return SOFTBUS_OK; + } + + bool CheckDiscPermission(pid_t callingUid, const char *pkgName) + { +- std::string pkg = ""; +- if (pkgName != nullptr) { +- pkg = std::string(pkgName); +- } else { +- return false; +- } +- if (callingUid == SYSTEM_UID || callingUid % MULTE_USER_RADIX == SYSTEM_UID) { +- return true; +- } +- return false; ++ // std::string pkg = ""; ++ // if (pkgName != nullptr) { ++ // pkg = std::string(pkgName); ++ // } else { ++ // return false; ++ // } ++ // if (callingUid == SYSTEM_UID || callingUid % MULTE_USER_RADIX == SYSTEM_UID) { ++ // return true; ++ // } ++ // return false; ++ return 0; + } + + bool CheckBusCenterPermission(pid_t callingUid, const char *pkgName) + { +- std::string pkg = ""; +- if (pkgName != nullptr) { +- pkg = std::string(pkgName); +- } else { +- return false; +- } +- if (callingUid == SYSTEM_UID || callingUid % MULTE_USER_RADIX == SYSTEM_UID) { +- return true; +- } +- return false; ++ // std::string pkg = ""; ++ // if (pkgName != nullptr) { ++ // pkg = std::string(pkgName); ++ // } else { ++ // return false; ++ // } ++ // if (callingUid == SYSTEM_UID || callingUid % MULTE_USER_RADIX == SYSTEM_UID) { ++ // return true; ++ // } ++ // return false; ++ return true; + } + + int32_t GrantTransPermission(int32_t callingUid, int32_t callingPid, const char *sessionName) + { +- return AddDynamicPermission(callingUid, callingPid, sessionName); ++ // return AddDynamicPermission(callingUid, callingPid, sessionName); ++ return SOFTBUS_OK; + } + + int32_t RemoveTransPermission(const char *sessionName) +@@ -130,19 +136,20 @@ int32_t RemoveTransPermission(const char *sessionName) + + int32_t CheckDynamicPermission(void) + { +- uint32_t callingToken = OHOS::IPCSkeleton::GetCallingTokenID(); +- +- auto tokenType = AccessToken::AccessTokenKit::GetTokenTypeFlag(callingToken); +- if (tokenType != AccessToken::ATokenTypeEnum::TOKEN_NATIVE) { +- SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "not native call"); +- return SOFTBUS_ERR; +- } +- AccessToken::NativeTokenInfo nativeTokenInfo; +- int32_t result = AccessToken::AccessTokenKit::GetNativeTokenInfo(callingToken, nativeTokenInfo); +- if (result == SOFTBUS_OK && nativeTokenInfo.processName == SAMGR_PROCESS_NAME) { +- return SOFTBUS_OK; +- } +- SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, +- "check dynamic permission failed, processName:%{private}s", nativeTokenInfo.processName.c_str()); +- return SOFTBUS_ERR; ++ // uint32_t callingToken = OHOS::IPCSkeleton::GetCallingTokenID(); ++ ++ // auto tokenType = AccessToken::AccessTokenKit::GetTokenTypeFlag(callingToken); ++ // if (tokenType != AccessToken::ATokenTypeEnum::TOKEN_NATIVE) { ++ // SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "not native call"); ++ // return SOFTBUS_ERR; ++ // } ++ // AccessToken::NativeTokenInfo nativeTokenInfo; ++ // int32_t result = AccessToken::AccessTokenKit::GetNativeTokenInfo(callingToken, nativeTokenInfo); ++ // if (result == SOFTBUS_OK && nativeTokenInfo.processName == SAMGR_PROCESS_NAME) { ++ // return SOFTBUS_OK; ++ // } ++ // SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, ++ // "check dynamic permission failed, processName:%{private}s", nativeTokenInfo.processName.c_str()); ++ // return SOFTBUS_ERR; ++ return SOFTBUS_OK; + } +diff --git a/core/common/softbus_property/softbus_feature_config.c b/core/common/softbus_property/softbus_feature_config.c +index 442c8e0..6fc5cd7 100644 +--- a/core/common/softbus_property/softbus_feature_config.c ++++ b/core/common/softbus_property/softbus_feature_config.c +@@ -39,10 +39,10 @@ + #define CONN_RFCOM_SEND_MAX_LEN 990 + #define CONN_BR_RECEIVE_MAX_LEN 500 + #define CONN_TCP_MAX_LENGTH 3072 +-#define CONN_TCP_MAX_CONN_NUM 30 ++#define CONN_TCP_MAX_CONN_NUM 150 + #define CONN_TCP_TIME_OUT 100 + #define MAX_NODE_STATE_CB_CNT 10 +-#define MAX_LNN_CONNECTION_CNT 10 ++#define MAX_LNN_CONNECTION_CNT 50 + #define LNN_SUPPORT_CAPBILITY 62 + #define AUTH_ABILITY_COLLECTION 0 + #define ADAPTER_LOG_LEVEL 0 +@@ -50,7 +50,7 @@ + #define DEFAULT_STORAGE_PATH "/data/service/el1/public" + #endif + #define LNN_UDID_INIT_DELAY_LEN 1000 +-#define LNN_NET_IF_NAME "0:eth0,1:wlan0,2:br0,3:ble0" ++#define LNN_NET_IF_NAME "0:enp7s0,1:wlan0,2:br0,3:ble0" + #define LNN_MAX_CONCURENT_NUM 2 + #define DEFAULT_DISC_FREQ_LOW ((5 << 16) | 12) + #define DEFAULT_DISC_FREQ_MID ((5 << 16) | 24) +diff --git a/core/connection/common/src/softbus_thread_pool.c b/core/connection/common/src/softbus_thread_pool.c +index 854cfbb..71dad93 100644 +--- a/core/connection/common/src/softbus_thread_pool.c ++++ b/core/connection/common/src/softbus_thread_pool.c +@@ -24,7 +24,8 @@ + #include "softbus_log.h" + + #ifndef MIN_STACK_SIZE +-#define MIN_STACK_SIZE 0x8000 ++// #define MIN_STACK_SIZE 0x8000 ++#define MIN_STACK_SIZE 0x200000 + #endif + #define THREAD_POOL_NAME "SoftBusConnect" + +diff --git a/core/frame/BUILD.gn b/core/frame/BUILD.gn +index ec37fae..ad2e1cc 100644 +--- a/core/frame/BUILD.gn ++++ b/core/frame/BUILD.gn +@@ -173,7 +173,7 @@ if (defined(ohos_lite)) { + sources = dsoftbus_server_common_src + sources += [ + "$dsoftbus_root_path/sdk/frame/$os_type/src/if_softbus_client.cpp", +- "$os_type/client_manager/src/permission_status_change_cb.cpp", ++ # "$os_type/client_manager/src/permission_status_change_cb.cpp", + "$os_type/client_manager/src/softbus_client_info_manager.cpp", + "$os_type/init/src/if_softbus_server.cpp", + "$os_type/init/src/softbus_server.cpp", +@@ -195,8 +195,8 @@ if (defined(ohos_lite)) { + if (is_standard_system) { + external_deps = dsoftbus_server_common_external_deps + external_deps += [ +- "access_token:libaccesstoken_sdk", +- "access_token:libprivacy_sdk", ++ # "access_token:libaccesstoken_sdk", ++ # "access_token:libprivacy_sdk", + "device_auth:deviceauth_sdk", + "hiviewdfx_hilog_native:libhilog", + "ipc:ipc_core", +diff --git a/core/frame/standard/client_manager/src/permission_status_change_cb.cpp b/core/frame/standard/client_manager/src/permission_status_change_cb.cpp +index 6c40d49..9dc1ce5 100644 +--- a/core/frame/standard/client_manager/src/permission_status_change_cb.cpp ++++ b/core/frame/standard/client_manager/src/permission_status_change_cb.cpp +@@ -33,14 +33,14 @@ void PermissionStatusChangeCb::PermStateChangeCallback(PermStateChangeInfo& resu + void RegisterDataSyncPermission(const uint32_t callingTokenId, + const std::string permissionName, const std::string pkgName) + { +- PermStateChangeScope scopeInfo; +- scopeInfo.permList = {permissionName}; +- scopeInfo.tokenIDs = {callingTokenId}; +- std::shared_ptr callbackPtr_ = +- std::make_shared(scopeInfo, pkgName); +- SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_INFO, "after tokenId:%{public}d register", callingTokenId); +- if (AccessTokenKit::RegisterPermStateChangeCallback(callbackPtr_) != SOFTBUS_OK) { +- SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "RegisterPermStateChangeCallback failed."); +- } ++ // PermStateChangeScope scopeInfo; ++ // scopeInfo.permList = {permissionName}; ++ // scopeInfo.tokenIDs = {callingTokenId}; ++ // std::shared_ptr callbackPtr_ = ++ // std::make_shared(scopeInfo, pkgName); ++ // SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_INFO, "after tokenId:%{public}d register", callingTokenId); ++ // if (AccessTokenKit::RegisterPermStateChangeCallback(callbackPtr_) != SOFTBUS_OK) { ++ // SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "RegisterPermStateChangeCallback failed."); ++ // } + } + } // namespace OHOS +\ No newline at end of file +diff --git a/core/frame/standard/client_manager/src/softbus_client_info_manager.cpp b/core/frame/standard/client_manager/src/softbus_client_info_manager.cpp +index 566a2b8..aeba793 100644 +--- a/core/frame/standard/client_manager/src/softbus_client_info_manager.cpp ++++ b/core/frame/standard/client_manager/src/softbus_client_info_manager.cpp +@@ -14,7 +14,8 @@ + */ + + #include "softbus_client_info_manager.h" +-#include "permission_status_change_cb.h" ++#include "ipc_skeleton.h" ++// #include "permission_status_change_cb.h" + #include "softbus_server.h" + #include "softbus_errcode.h" + #include "softbus_log.h" +@@ -36,9 +37,9 @@ int32_t SoftbusClientInfoManager::SoftbusAddService(const std::string &pkgName, + std::lock_guard autoLock(clientObjectMapLock_); + std::pair, sptr> clientObject(object, abilityDeath); + clientObjectMap_.emplace(pkgName, clientObject); +- uint32_t tokenCaller = IPCSkeleton::GetCallingTokenID(); +- std::string permissionName = OHOS_PERMISSION_DISTRIBUTED_DATASYNC; +- RegisterDataSyncPermission(tokenCaller, permissionName, pkgName); ++ // uint32_t tokenCaller = IPCSkeleton::GetCallingTokenID(); ++ // std::string permissionName = OHOS_PERMISSION_DISTRIBUTED_DATASYNC; ++ // RegisterDataSyncPermission(tokenCaller, permissionName, pkgName); + return SOFTBUS_OK; + } + +diff --git a/core/frame/standard/init/src/softbus_server_stub.cpp b/core/frame/standard/init/src/softbus_server_stub.cpp +index 2103523..ee91cec 100644 +--- a/core/frame/standard/init/src/softbus_server_stub.cpp ++++ b/core/frame/standard/init/src/softbus_server_stub.cpp +@@ -30,80 +30,81 @@ + #include "softbus_server_frame.h" + #include "trans_channel_manager.h" + #include "trans_session_manager.h" +-#include "accesstoken_kit.h" +-#include "access_token.h" +-#include "privacy_kit.h" ++// #include "accesstoken_kit.h" ++// #include "access_token.h" ++// #include "privacy_kit.h" + #include "softbus_hisysevt_transreporter.h" + +-using namespace OHOS::Security::AccessToken; ++// using namespace OHOS::Security::AccessToken; + + namespace OHOS { + int32_t SoftBusServerStub::CheckOpenSessionPermission(const SessionParam *param) + { +- char pkgName[PKG_NAME_SIZE_MAX] = {0}; +- if ((param == NULL) || +- (TransGetPkgNameBySessionName(param->sessionName, pkgName, PKG_NAME_SIZE_MAX) != SOFTBUS_OK)) { +- SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "OpenSession TransGetPkgNameBySessionName failed"); +- return SOFTBUS_INVALID_PARAM; +- } +- +- pid_t callingUid = OHOS::IPCSkeleton::GetCallingUid(); +- pid_t callingPid = OHOS::IPCSkeleton::GetCallingPid(); +- if (CheckTransPermission(callingUid, callingPid, pkgName, param->sessionName, ACTION_OPEN) != SOFTBUS_OK) { +- SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "OpenSession no permission"); +- return SOFTBUS_PERMISSION_DENIED; +- } +- +- if (CheckTransSecLevel(param->sessionName, param->peerSessionName) != SOFTBUS_OK) { +- SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "OpenSession sec level invalid"); +- return SOFTBUS_PERMISSION_DENIED; +- } ++ // char pkgName[PKG_NAME_SIZE_MAX] = {0}; ++ // if ((param == NULL) || ++ // (TransGetPkgNameBySessionName(param->sessionName, pkgName, PKG_NAME_SIZE_MAX) != SOFTBUS_OK)) { ++ // SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "OpenSession TransGetPkgNameBySessionName failed"); ++ // return SOFTBUS_INVALID_PARAM; ++ // } ++ ++ // pid_t callingUid = OHOS::IPCSkeleton::GetCallingUid(); ++ // pid_t callingPid = OHOS::IPCSkeleton::GetCallingPid(); ++ // if (CheckTransPermission(callingUid, callingPid, pkgName, param->sessionName, ACTION_OPEN) != SOFTBUS_OK) { ++ // SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "OpenSession no permission"); ++ // return SOFTBUS_PERMISSION_DENIED; ++ // } ++ ++ // if (CheckTransSecLevel(param->sessionName, param->peerSessionName) != SOFTBUS_OK) { ++ // SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "OpenSession sec level invalid"); ++ // return SOFTBUS_PERMISSION_DENIED; ++ // } + return SOFTBUS_OK; + } + + int32_t SoftBusServerStub::CheckChannelPermission(int32_t channelId, int32_t channelType) + { +- char pkgName[PKG_NAME_SIZE_MAX] = {0}; +- char sessionName[SESSION_NAME_SIZE_MAX] = {0}; +- int32_t ret = SOFTBUS_OK; +- TransInfo info; +- info.channelId = channelId; +- info.channelType = channelType; +- ret = TransGetNameByChanId(&info, pkgName, sessionName, PKG_NAME_SIZE_MAX, SESSION_NAME_SIZE_MAX); +- if (ret != SOFTBUS_OK) { +- SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "ServerCloseChannel invalid channel info"); +- return ret; +- } +- +- pid_t callingUid = OHOS::IPCSkeleton::GetCallingUid(); +- pid_t callingPid = OHOS::IPCSkeleton::GetCallingPid(); +- if (CheckTransPermission(callingUid, callingPid, pkgName, sessionName, ACTION_OPEN) != SOFTBUS_OK) { +- return SOFTBUS_PERMISSION_DENIED; +- } ++ // char pkgName[PKG_NAME_SIZE_MAX] = {0}; ++ // char sessionName[SESSION_NAME_SIZE_MAX] = {0}; ++ // int32_t ret = SOFTBUS_OK; ++ // TransInfo info; ++ // info.channelId = channelId; ++ // info.channelType = channelType; ++ // ret = TransGetNameByChanId(&info, pkgName, sessionName, PKG_NAME_SIZE_MAX, SESSION_NAME_SIZE_MAX); ++ // if (ret != SOFTBUS_OK) { ++ // SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "ServerCloseChannel invalid channel info"); ++ // return ret; ++ // } ++ ++ // pid_t callingUid = OHOS::IPCSkeleton::GetCallingUid(); ++ // pid_t callingPid = OHOS::IPCSkeleton::GetCallingPid(); ++ // if (CheckTransPermission(callingUid, callingPid, pkgName, sessionName, ACTION_OPEN) != SOFTBUS_OK) { ++ // return SOFTBUS_PERMISSION_DENIED; ++ // } + return SOFTBUS_OK; + } + +-static inline int32_t CheckAndRecordAccessToken(const char* permission) +-{ +- uint32_t tokenCaller = IPCSkeleton::GetCallingTokenID(); +- int32_t ret = AccessTokenKit::VerifyAccessToken(tokenCaller, permission); +- +- ATokenTypeEnum type = AccessTokenKit::GetTokenTypeFlag(tokenCaller); +- int32_t successCnt = (int32_t)(ret == PERMISSION_GRANTED); +- int32_t failCnt = 1 - successCnt; +- if (type == TOKEN_HAP) { +- PrivacyKit::AddPermissionUsedRecord(tokenCaller, permission, successCnt, failCnt); +- } ++// static inline int32_t CheckAndRecordAccessToken(const char* permission) ++// { ++ // uint32_t tokenCaller = IPCSkeleton::GetCallingTokenID(); ++ // int32_t ret = AccessTokenKit::VerifyAccessToken(tokenCaller, permission); ++ ++ // ATokenTypeEnum type = AccessTokenKit::GetTokenTypeFlag(tokenCaller); ++ // int32_t successCnt = (int32_t)(ret == PERMISSION_GRANTED); ++ // int32_t failCnt = 1 - successCnt; ++ // if (type == TOKEN_HAP) { ++ // PrivacyKit::AddPermissionUsedRecord(tokenCaller, permission, successCnt, failCnt); ++ // } + +- return ret; +-} ++ // return ret; ++ // return SOFTBUS_OK; ++// } + +-static inline void SoftbusReportPermissionFaultEvt(uint32_t ipcCode) +-{ +- if (ipcCode == SERVER_OPEN_SESSION) { +- SoftbusReportTransErrorEvt(SOFTBUS_ACCESS_TOKEN_DENIED); +- } +-} ++// static inline void SoftbusReportPermissionFaultEvt(uint32_t ipcCode) ++// { ++// if (ipcCode == SERVER_OPEN_SESSION) { ++// SoftbusReportTransErrorEvt(SOFTBUS_ACCESS_TOKEN_DENIED); ++// } ++// } + + SoftBusServerStub::SoftBusServerStub() + { +@@ -205,16 +206,16 @@ int32_t SoftBusServerStub::OnRemoteRequest(uint32_t code, + return SOFTBUS_ERR; + } + +- auto itPerm = memberPermissionMap_.find(code); +- if (itPerm != memberPermissionMap_.end()) { +- const char *permission = itPerm->second; +- if ((permission != nullptr) && +- (CheckAndRecordAccessToken(permission) != PERMISSION_GRANTED)) { +- SoftbusReportPermissionFaultEvt(code); +- SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_INFO, "access token permission %s denied!", permission); +- return SOFTBUS_ACCESS_TOKEN_DENIED; +- } +- } ++ // auto itPerm = memberPermissionMap_.find(code); ++ // if (itPerm != memberPermissionMap_.end()) { ++ // const char *permission = itPerm->second; ++ // if ((permission != nullptr) && ++ // (CheckAndRecordAccessToken(permission) != PERMISSION_GRANTED)) { ++ // SoftbusReportPermissionFaultEvt(code); ++ // SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_INFO, "access token permission %s denied!", permission); ++ // return SOFTBUS_ACCESS_TOKEN_DENIED; ++ // } ++ // } + + auto itFunc = memberFuncMap_.find(code); + if (itFunc != memberFuncMap_.end()) { +diff --git a/core/transmission/trans_channel/tcp_direct/src/trans_tcp_direct_manager.c b/core/transmission/trans_channel/tcp_direct/src/trans_tcp_direct_manager.c +index 9b73c13..5a9ba5e 100644 +--- a/core/transmission/trans_channel/tcp_direct/src/trans_tcp_direct_manager.c ++++ b/core/transmission/trans_channel/tcp_direct/src/trans_tcp_direct_manager.c +@@ -248,7 +248,7 @@ static int32_t TransUpdAppInfo(AppInfo *appInfo, const ConnectOption *connInfo) + + int32_t TransOpenDirectChannel(const AppInfo *appInfo, const ConnectOption *connInfo, int32_t *channelId) + { +- SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "TransOpenDirectChannel"); ++ SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_INFO, "TransOpenDirectChannel"); + if (appInfo == NULL || connInfo == NULL || channelId == NULL) { + return SOFTBUS_INVALID_PARAM; + } +diff --git a/core/transmission/trans_channel/tcp_direct/src/trans_tcp_direct_wifi.c b/core/transmission/trans_channel/tcp_direct/src/trans_tcp_direct_wifi.c +index 868dfc5..c34b4de 100644 +--- a/core/transmission/trans_channel/tcp_direct/src/trans_tcp_direct_wifi.c ++++ b/core/transmission/trans_channel/tcp_direct/src/trans_tcp_direct_wifi.c +@@ -28,7 +28,7 @@ + + int32_t OpenTcpDirectChannel(const AppInfo *appInfo, const ConnectOption *connInfo, int32_t *channelId) + { +- SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "OpenTcpDirectChannel"); ++ SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_INFO, "OpenTcpDirectChannel"); + if (appInfo == NULL || connInfo == NULL || channelId == NULL) { + return SOFTBUS_INVALID_PARAM; + } +-- +2.33.0 + diff --git a/ashmem-openEuler-22.03-LTS-SP2.tar.gz b/ashmem-openEuler-22.03-LTS-SP2.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..474f8fdda7a802ec245d75ca2b4f134df20bef5d Binary files /dev/null and b/ashmem-openEuler-22.03-LTS-SP2.tar.gz differ diff --git a/binder-openEuler-22.03-LTS-SP2.tar.gz b/binder-openEuler-22.03-LTS-SP2.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..b0f84d1dccea039912d5cb6da01abb8210ebaa29 Binary files /dev/null and b/binder-openEuler-22.03-LTS-SP2.tar.gz differ diff --git a/binder.BUILD.gn b/binder.BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..dd0da82c3b875720c49dc2642edec81734c5fa1a --- /dev/null +++ b/binder.BUILD.gn @@ -0,0 +1,26 @@ +# Copyright (C) 2021 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/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("//build/ohos.gni") + +config("libdbinder_config") { + include_dirs = [ + " /usr/include/c_utils", + "/usr/include/ipc", + ] + libs = [ "dbinder.z" ] +} + +group("libdbinder") { + public_configs = [ ":libdbinder_config" ] +} diff --git a/binder.pp b/binder.pp new file mode 100644 index 0000000000000000000000000000000000000000..1b56b5b5f81cbd1c82402b2a58dba3a2481b4fb5 Binary files /dev/null and b/binder.pp differ diff --git a/communication_dsoftbus-OpenHarmony-v3.2-Release.tar.gz b/communication_dsoftbus-OpenHarmony-v3.2-Release.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..9ac4b10b7d093796292c202f2f8ca782ff4847ee Binary files /dev/null and b/communication_dsoftbus-OpenHarmony-v3.2-Release.tar.gz differ diff --git a/communication_ipc-OpenHarmony-v3.2-Release.tar.gz b/communication_ipc-OpenHarmony-v3.2-Release.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..0ccda116099a9c7e8a6a25291812505bd7d62b8f Binary files /dev/null and b/communication_ipc-OpenHarmony-v3.2-Release.tar.gz differ diff --git a/communication_ipc.spec b/communication_ipc.spec new file mode 100644 index 0000000000000000000000000000000000000000..e5af0b7cf96c590316aed57c8c45a34f0292d7f6 --- /dev/null +++ b/communication_ipc.spec @@ -0,0 +1,230 @@ +%define debug_package %{nil} +%global build_opt /opt/distributed-middleware-build +%global oh_version OpenHarmony-v3.2-Release +%global oe_version openEuler-22.03-LTS-SP2 +%global communication_path %{_builddir}/foundation/communication +%global third_party_path %{_builddir}/third_party +%global binder_dest_path /usr/lib/modules/%(uname -r)/binder +%global ashmem_dest_path /usr/lib/modules/%(uname -r)/ashmem + +%define with_ashmem 0 +%define with_install_ko 0 + +Name: communication_ipc +Version: 1.0.0 +Release: 1%{?dist} +Summary: Inter-process communication (IPC) and Remote Procedure Call (RPC) +License: Apache-2.0 and GPL-2.0 +URL: https://gitee.com/openharmony/communication_ipc +Source1: https://gitee.com/openharmony/communication_ipc/repository/archive/OpenHarmony-v3.2-Release.tar.gz #/communication_ipc-OpenHarmony-v3.2-Release.tar.gz +Source2: https://gitee.com/openharmony/communication_dsoftbus/repository/archive/OpenHarmony-v3.2-Release.tar.gz #/communication_dsoftbus-OpenHarmony-v3.2-Release.tar.gz +Source3: https://gitee.com/openharmony/third_party_sqlite/repository/archive/OpenHarmony-v3.2-Release.tar.gz #/third_party_sqlite-OpenHarmony-v3.2-Release.tar.gz +Source4: https://gitee.com/openharmony/third_party_libcoap/repository/archive/OpenHarmony-v3.2-Release.tar.gz #/third_party_libcoap-OpenHarmony-v3.2-Release.tar.gz +Source5: https://gitee.com/openharmony/third_party_mbedtls/repository/archive/OpenHarmony-v3.2-Release.tar.gz #/third_party_mbedtls-OpenHarmony-v3.2-Release.tar.gz +Source6: https://gitee.com/openeuler/kernel/binder-%{oe_version}.tar.gz +Source7: ipc.bundle.json +Source8: ipc.BUILD.gn +Source9: ipc_core.BUILD.gn +Source10: ipc_single.BUILD.gn +Source11: binder.BUILD.gn +Source12: mbedtls.BUILD.gn +Source13: dsoftbus.bundle.json +Source14: dsoftbus.BUILD.gn +Source15: sdk.BUILD.gn +Source16: https://gitee.com/openeuler/kernel/ashmem-%{oe_version}.tar.gz +Source17: binder.pp + +Patch1: 0001-remove-dependence-on-access-token-and-hitrace.patch +Patch2: 0002-fix-build-error-from-header-include.patch +Patch3: 0003-adapt-binder-as-a-kernel-module.patch +Patch4: 0004-adapt-compilation-for-softbus_client.patch + +BuildRequires: gcc, make, hilog, kernel-devel, uname-build-checks +BuildRequires: commonlibrary_c_utils +BuildRequires: distributed-build, distributed-beget +BuildRequires: notification_eventhandler +BuildRequires: cjson-devel, openssl-devel + +Requires: commonlibrary_c_utils +Requires: distributed-beget +Requires: notification_eventhandler +Requires: cjson-devel, openssl-devel + +%description +The inter-process communication (IPC) and remote procedure call (RPC) mechanisms are used to implement cross-process communication. + +# Decompress source code package, make patches to the source code. +%prep +rm -rf %{_builddir}/* + +cp -rf %{build_opt} %{_builddir}/build +[ ! -L "%{_builddir}/build.sh" ] && ln -s %{_builddir}/build/build_scripts/build.sh %{_builddir}/build.sh +[ ! -L "%{_builddir}/.gn" ] && ln -s %{_builddir}/build/core/gn/dotfile.gn %{_builddir}/.gn +[ ! -L "%{_builddir}/build.py" ] && ln -s %{_builddir}/build/lite/build.py %{_builddir}/build.py +cp -rf %{_builddir}/build/openeuler/vendor %{_builddir}/ +cp -rf %{_builddir}/build/openeuler/compiler_gn/* %{_builddir} + +%setup -q -D -T -a 1 -c -n %{communication_path} +mv %{communication_path}/%{name} %{communication_path}/ipc +%patch -P1 -p1 -d %{communication_path}/ipc +%patch -P2 -p1 -d %{communication_path}/ipc + +%setup -q -D -T -a 2 -c -n %{communication_path} +mv %{communication_path}/communication_dsoftbus-%{oh_version} %{communication_path}/dsoftbus +%patch -P4 -p1 -d %{communication_path}/dsoftbus + +%setup -q -D -T -a 3 -c -n %{third_party_path} +mv %{third_party_path}/third_party_sqlite-%{oh_version} %{third_party_path}/sqlite + +%setup -q -D -T -a 4 -c -n %{third_party_path} +mv %{third_party_path}/third_party_libcoap-%{oh_version} %{third_party_path}/libcoap + +%setup -q -D -T -a 5 -c -n %{third_party_path} +mv %{third_party_path}/third_party_mbedtls-%{oh_version} %{third_party_path}/mbedtls + +%setup -q -D -T -a 6 -c -n %{_builddir} +%patch -P3 -p1 -d %{_builddir}/binder + +%setup -q -D -T -a 16 -c -n %{_builddir} + + +%build + +%ifarch x86_64 +%{_builddir}/build.sh --product-name openeuler --target-cpu x86_64 +%endif + +%ifarch aarch64 +%{_builddir}/build.sh --product-name openeuler --target-cpu arm64 +%endif + +# build binder +cd %{_builddir}/binder +make %{?_smp_mflags} + +%if 0%{?with_ashmem} +cd %{_builddir}/ashmem/src +make %{?_smp_mflags} +%endif + +%install +install -d -m 0755 %{buildroot}/%{_includedir}/ipc +install -d -m 0755 %{buildroot}/%{_includedir}/mbedtls +install -d -m 0755 %{buildroot}/%{_includedir}/dsoftbus +install -d -m 0755 %{buildroot}/%{_libdir} +install -d -m 0755 %{buildroot}/system/lib64 +install -d -m 0755 %{buildroot}%{build_opt}/openeuler/compiler_gn/foundation/communication/ipc/interfaces/innerkits/ipc_core +install -d -m 0755 %{buildroot}%{build_opt}/openeuler/compiler_gn/foundation/communication/ipc/interfaces/innerkits/ipc_single +install -d -m 0755 %{buildroot}%{build_opt}/openeuler/compiler_gn/foundation/communication/ipc/interfaces/innerkits/libdbinder +install -d -m 0755 %{buildroot}%{build_opt}/openeuler/compiler_gn/third_party/json +install -d -m 0755 %{buildroot}%{build_opt}/openeuler/compiler_gn/third_party/mbedtls/ +install -d -m 0755 %{buildroot}%{build_opt}/openeuler/compiler_gn/foundation/communication/dsoftbus/sdk/ +install -d -m 0755 %{buildroot}%{build_opt}/openeuler/compiler_gn/foundation/communication/dsoftbus/interfaces/inner_kits +install -d -m 0755 %{buildroot}%{build_opt}/openeuler/compiler_gn/foundation/communication/dsoftbus/interfaces/kits/bus_center +install -d -m 0755 %{buildroot}%{build_opt}/openeuler/compiler_gn/foundation/communication/dsoftbus/interfaces/kits/common +install -d -m 0755 %{buildroot}%{build_opt}/openeuler/compiler_gn/foundation/communication/dsoftbus/interfaces/kits/discovery +install -d -m 0755 %{buildroot}%{build_opt}/openeuler/compiler_gn/foundation/communication/dsoftbus/interfaces/kits/transport + +%ifarch aarch64 +%define header_out_path out/openeuler/innerkits/linux-arm64/ipc +%define module_out_path out/openeuler/linux_clang_arm64 +%define dsoftbus_header_out_path out/openeuler/innerkits/linux-arm64/dsoftbus +%endif +%ifarch x86_64 +%define header_out_path out/openeuler/innerkits/linux-x86_64/ipc +%define module_out_path out/openeuler/linux_clang_x86_64 +%define dsoftbus_header_out_path out/openeuler/innerkits/linux-x86_64/dsoftbus +%endif + +# install libs and headers from ipc +install -m 0755 %{_builddir}/%{module_out_path}/communication/ipc/*.so %{buildroot}/%{_libdir} +install -m 0755 %{_builddir}/%{module_out_path}/communication/ipc/*.so %{buildroot}/system/lib64 +find %{_builddir}/%{header_out_path} -name *.h -print0 | xargs -0 -i cp -rf {} %{buildroot}%{_includedir}/ipc/ + +# install libs and headers from dsoftbus +%define dsoftbus_module_path %{module_out_path}/communication/dsoftbus +rm -f %{_builddir}/%{dsoftbus_module_path}/libsoftbus_server.z.so +install -m 0755 %{_builddir}/%{dsoftbus_module_path}/*.so %{buildroot}/%{_libdir} +install -m 0755 %{_builddir}/%{dsoftbus_module_path}/*.so %{buildroot}/system/lib64 + +# install libs and headers from third party components +%define third_party_module_path %{module_out_path}/common/common +install -m 0755 %{_builddir}/%{third_party_module_path}/*.so %{buildroot}/%{_libdir} +install -m 0755 %{_builddir}/%{third_party_module_path}/*.so %{buildroot}/system/lib64 +install -m 0755 %{_builddir}/%{module_out_path}/common/dsoftbus/*.so %{buildroot}/%{_libdir} +install -m 0755 %{_builddir}/%{module_out_path}/common/dsoftbus/*.so %{buildroot}/system/lib64 +install -m 0755 %{_builddir}/third_party/mbedtls/include/mbedtls/*.h %{buildroot}/%{_includedir}/mbedtls/ +install -m 0755 %{_builddir}/foundation/communication/ipc/interfaces/innerkits/libdbinder/include/rpc_system_ability_callback.h %{buildroot}/%{_includedir}/ipc/ +install -m 0755 %{_builddir}/foundation/communication/dsoftbus/interfaces/kits/common/softbus_error_code.h %{buildroot}/%{_includedir}/dsoftbus/ +install -m 0755 %{_builddir}/foundation/communication/dsoftbus/interfaces/inner_kits/transport/inner_session.h %{buildroot}/%{_includedir}/dsoftbus/ +install -m 0755 %{communication_path}/ipc/interfaces/innerkits/libdbinder/include/* %{buildroot}/%{_includedir}/ipc/ +install -m 0755 %{communication_path}/dsoftbus/sdk/transmission/session/cpp/include/* %{buildroot}/%{_includedir}/ipc/ + + +find %{_builddir}/%{header_out_path} -name *.h -print0 | xargs -0 -i cp -rf {} %{buildroot}/%{_includedir}/ipc/ +find %{_builddir}/%{dsoftbus_header_out_path} -name *.h -print0 | xargs -0 -i cp -rvf {} %{buildroot}/%{_includedir}/dsoftbus/ + +#copy bundle.json +install -m 0755 %{SOURCE13} %{buildroot}/%{build_opt}/openeuler/compiler_gn/foundation/communication/dsoftbus/bundle.json + +#copy BUILD.gn +install -m 0755 %{SOURCE7} %{buildroot}/%{build_opt}/openeuler/compiler_gn/foundation/communication/ipc/bundle.json +install -m 0755 %{SOURCE8} %{buildroot}/%{build_opt}/openeuler/compiler_gn/foundation/communication/ipc/BUILD.gn +install -m 0755 %{SOURCE9} %{buildroot}/%{build_opt}/openeuler/compiler_gn/foundation/communication/ipc/interfaces/innerkits/ipc_core/BUILD.gn +install -m 0755 %{SOURCE10} %{buildroot}/%{build_opt}/openeuler/compiler_gn/foundation/communication/ipc/interfaces/innerkits/ipc_single/BUILD.gn +install -m 0755 %{SOURCE11} %{buildroot}/%{build_opt}/openeuler/compiler_gn/foundation/communication/ipc/interfaces/innerkits/libdbinder/BUILD.gn +install -m 0755 %{SOURCE12} %{buildroot}/%{build_opt}/openeuler/compiler_gn/third_party/mbedtls/BUILD.gn +install -m 0755 %{SOURCE14} %{buildroot}/%{build_opt}/openeuler/compiler_gn/foundation/communication/dsoftbus/BUILD.gn +install -m 0755 %{SOURCE15} %{buildroot}/%{build_opt}/openeuler/compiler_gn/foundation/communication/dsoftbus/sdk/BUILD.gn + +# install ko file of binder +install -d %{buildroot}/%{binder_dest_path}/ +install -d %{buildroot}/%{ashmem_dest_path}/ +install -m 0755 %{_builddir}/binder/binder_linux.ko %{buildroot}/%{binder_dest_path}/ +%if 0%{?with_ashmem} +install -m 0755 %{_builddir}/ashmem/src/ashmem_linux.ko %{buildroot}/%{ashmem_dest_path}/ +%endif +mkdir -p %{buildroot}/usr/share/pp +install -m 0755 %{SOURCE17} %{buildroot}/usr/share/pp/binder.pp + +#create soft link +ln -s /usr/mbedtls/include %{buildroot}%{build_opt}/openeuler/compiler_gn/third_party/mbedtls/include +ln -s /usr/include/ipc %{buildroot}%{build_opt}/openeuler/compiler_gn/foundation/communication/ipc/interfaces/innerkits/ipc_core/include +ln -s /usr/include/ipc %{buildroot}%{build_opt}/openeuler/compiler_gn/foundation/communication/ipc/interfaces/innerkits/libdbinder/include +ln -s /usr/include/nlohmann_json %{buildroot}%{build_opt}/openeuler/compiler_gn/third_party/json/include +ln -s /usr/include/nlohmann_json/single_include %{buildroot}%{build_opt}/openeuler/compiler_gn/third_party/json/single_include +ln -s /usr/include/dsoftbus %{buildroot}%{build_opt}/openeuler/compiler_gn/foundation/communication/dsoftbus/interfaces/inner_kits/transport +ln -s /usr/include/dsoftbus %{buildroot}%{build_opt}/openeuler/compiler_gn/foundation/communication/dsoftbus/interfaces/kits/bus_center/include +ln -s /usr/include/dsoftbus %{buildroot}%{build_opt}/openeuler/compiler_gn/foundation/communication/dsoftbus/interfaces/kits/common/include +ln -s /usr/include/dsoftbus %{buildroot}%{build_opt}/openeuler/compiler_gn/foundation/communication/dsoftbus/interfaces/kits/discovery/include +ln -s /usr/include/dsoftbus %{buildroot}%{build_opt}/openeuler/compiler_gn/foundation/communication/dsoftbus/interfaces/kits/transport/include + + +%files +%{_libdir}/*.so +%{_includedir}/ipc/* +%{_includedir}/mbedtls/* +%{_includedir}/dsoftbus/* +/system/* +/%{binder_dest_path}/*.ko +%if 0%{?with_ashmem} +/%{ashmem_dest_path}/*.ko +%endif +%{build_opt}/* +/usr/share/pp + +%post +semodule -X 300 -i /usr/share/pp/binder.pp + +%if 0%{?with_install_ko} +insmod /%{binder_dest_path}/*.ko +%if 0%{?with_ashmem} +insmod /%{ashmem_dest_path}/*.ko +%endif +%endif + +%changelog +* Sun Oct 08 2023 Peng He - 1.0.0-1 +* Thu Nov 22 2023 JiaQi Zhao - 1.0.0-1 +- Init package + diff --git a/dsoftbus.BUILD.gn b/dsoftbus.BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..2faff1643b31e7b5cfafc67ac6a31a247f92ed5e --- /dev/null +++ b/dsoftbus.BUILD.gn @@ -0,0 +1,20 @@ +# Copyright (c) 2021 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/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") + +lite_component("dsoftbus") { + features = [ + "sdk:softbus_client", + ] +} \ No newline at end of file diff --git a/dsoftbus.bundle.json b/dsoftbus.bundle.json new file mode 100644 index 0000000000000000000000000000000000000000..06860b79aa455fc4145297211670d51c8507cd66 --- /dev/null +++ b/dsoftbus.bundle.json @@ -0,0 +1,86 @@ +{ + "name": "@openharmony/dsoftbus", + "version": "3.1.0", + "description": "dsoftbus", + "publishAs": "code-segment", + "scripts": { + "install": "DEST_PATH=${DEP_BUNDLE_BASE}/foundation/communication/dsoftbus && mkdir -p $DEST_PATH && cp -r ./* $DEST_PATH" + }, + "author": {}, + "repository": "", + "license": "Apache License 2.0", + "segment": { + "destPath": "foundation/communication/dsoftbus" + }, + "component": { + "name": "dsoftbus", + "subsystem": "communication", + "adapted_system_type": [ + "mini", + "small", + "standard" + ], + "syscap":[ "SystemCapability.Communication.SoftBus.Core" ], + "features": [ + "dsoftbus_feature_conn_p2p", + "dsoftbus_feature_disc_ble", + "dsoftbus_feature_conn_br", + "dsoftbus_feature_conn_ble", + "dsoftbus_feature_lnn_net", + "dsoftbus_feature_trans_udp_stream", + "dsoftbus_feature_trans_udp_file", + "dsoftbus_get_devicename", + "dsoftbus_feature_product_config_path", + "dsoftbus_feature_ifname_prefix", + "dsoftbus_feature_lnn_wifiservice_dependence", + "dsoftbus_standard_feature_dfinder_support_multi_nif", + "dsoftbus_feature_protocol_newip" + ], + "rom": "967KB", + "ram": "28MB", + "deps": { + "components": [ + "ability_base", + "ability_runtime", + "bluetooth", + "drivers_interface_wlan", + "hiviewdfx_hilog_native", + "ipc", + "os_account", + "relational_store", + "c_utils", + "wifi" + ], + "third_party": [ + "bounds_checking_function", + "cJSON", + "libcoap", + "thirdparty_mbedtls" + ] + }, + "build": { + "group_type":{ + "base_group":[], + "fwk_group":[ + "//foundation/communication/dsoftbus/sdk:softbus_client" + ], + "service_group":[ + ] + }, + "inner_kits": [ + { + "name": "//foundation/communication/dsoftbus/sdk:softbus_client", + "header": { + "header_files": [ + "bus_center/softbus_bus_center.h", + "common/softbus_common.h", + "discovery/discovery_service.h", + "transport/session.h" + ], + "header_base": "//foundation/communication/dsoftbus/interfaces/kits" + } + } + ] + } + } +} diff --git a/ipc.BUILD.gn b/ipc.BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..7b6d93d21afc958fe24e561dcab84e03b9b05781 --- /dev/null +++ b/ipc.BUILD.gn @@ -0,0 +1,29 @@ +# Copyright (C) 2021 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/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("//build/ohos.gni") +import("//build/ohos_var.gni") + +SUBSYSTEM_DIR = "//foundation/communication/ipc" +IPC_CORE_ROOT = "$SUBSYSTEM_DIR/ipc/native" + +config("ipc_util_config") { + # header file path + + include_dirs = [ + "$SUBSYSTEM_DIR/interfaces/innerkits/ipc_core/include", + "$IPC_CORE_ROOT/src/core/include", + "$IPC_CORE_ROOT/src/mock/include", + "//commonlibrary/c_utils/base/include", + ] +} diff --git a/ipc.bundle.json b/ipc.bundle.json new file mode 100644 index 0000000000000000000000000000000000000000..3110b6f50748e55a0fc275d3b0f3efafe081949e --- /dev/null +++ b/ipc.bundle.json @@ -0,0 +1,103 @@ +{ + "name": "@openharmony/ipc", + "version": "3.1.0", + "description": "ipc", + "publishAs": "code-segment", + "scripts": { + "install": "DEST_PATH=${DEP_BUNDLE_BASE}/foundation/communication/ipc && mkdir -p $DEST_PATH && cp -r ./* $DEST_PATH" + }, + "author": {}, + "repository": "", + "license": "Apache License 2.0", + "segment": { + "destPath": "foundation/communication/ipc" + }, + "component": { + "name": "ipc", + "subsystem": "communication", + "adapted_system_type": [ + "standard", + "small", + "mini" + ], + "features": [ + "ipc_feature_rpc_enabled" + ], + "syscap":[ + "SystemCapability.Communication.IPC.Core" + ], + "rom": "500KB", + "ram": "100KB", + "deps": { + "components": [ + "samgr", + "hitrace_native", + "hiviewdfx_hilog_native", + "c_utils", + "access_token", + "dsoftbus" + ], + "third_party": [ + "bounds_checking_function" + ] + }, + "build": { + "sub_component": [ + ], + "inner_kits": [ + { + "name": "//foundation/communication/ipc/interfaces/innerkits/ipc_core:ipc_core", + "header": { + "header_files": [ + "ipc_types.h", + "ipc_skeleton.h", + "iremote_object.h", + "iremote_proxy.h", + "iremote_stub.h", + "message_parcel.h", + "message_option.h", + "iremote_broker.h", + "ipc_object_proxy.h", + "ipc_object_stub.h", + "peer_holder.h", + "ipc_file_descriptor.h", + "jni_help.h" + ], + "header_base": "//foundation/communication/ipc/interfaces/innerkits/ipc_core/include" + } + }, + { + "name": "//foundation/communication/ipc/interfaces/innerkits/ipc_single:ipc_single", + "header": { + "header_files": [ + "ipc_types.h", + "ipc_skeleton.h", + "iremote_object.h", + "iremote_proxy.h", + "iremote_stub.h", + "message_parcel.h", + "message_option.h", + "iremote_broker.h", + "ipc_object_proxy.h", + "ipc_object_stub.h", + "peer_holder.h", + "ipc_file_descriptor.h", + "jni_help.h" + ], + "header_base": "//foundation/communication/ipc/interfaces/innerkits/ipc_core/include" + } + }, + { + "name": "//foundation/communication/ipc/interfaces/innerkits/libdbinder:libdbinder", + "header": { + "header_files": [ + "dbinder_service.h", + "dbinder_service_stub.h" + ], + "header_base": "//foundation/communication/ipc/interfaces/innerkits/libdbinder/include" + } + } + ] + } + } + } diff --git a/ipc_core.BUILD.gn b/ipc_core.BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..c2ecc904ea7d82ac744b05d671dd283343027f65 --- /dev/null +++ b/ipc_core.BUILD.gn @@ -0,0 +1,30 @@ +# Copyright (C) 2021 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/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("//build/ohos.gni") + +SUBSYSTEM_DIR = "//foundation/communication/ipc" + +config("ipc_all_deps_config") { + include_dirs = [ "$SUBSYSTEM_DIR/interfaces/innerkits/ipc_core/include" ] + libs = [ "ipc_core.z" ] +} + +group("ipc_core") { + public_configs = [ + "$SUBSYSTEM_DIR:ipc_util_config", + ":ipc_all_deps_config" + ] + + all_dependent_configs = [ ":ipc_all_deps_config" ] +} diff --git a/ipc_single.BUILD.gn b/ipc_single.BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..e2689e40a346637791a151d56b391e6150d6face --- /dev/null +++ b/ipc_single.BUILD.gn @@ -0,0 +1,27 @@ +# Copyright (C) 2021 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/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("//build/ohos.gni") + +SUBSYSTEM_DIR = "//foundation/communication/ipc" + +config("libipc_single_config") { + libs = [ "ipc_single.z" ] +} + +group("ipc_single") { + public_configs = [ + "$SUBSYSTEM_DIR:ipc_util_config", + ":libipc_single_config" + ] +} diff --git a/mbedtls.BUILD.gn b/mbedtls.BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..807966f4e7214317bda60090740562a08e963783 --- /dev/null +++ b/mbedtls.BUILD.gn @@ -0,0 +1,18 @@ +import("//build/ohos.gni") +config("mbedtls_config") { + include_dirs = [ + "include", + ] + libs = [ + "mbedtls.z", + ] +} + +ohos_shared_library("mbedtls_shared") { + public_configs = [ ":mbedtls_config" ] +} + +group("mbedtls") { + public_deps = [ ":mbedtls_shared" ] +} + diff --git a/sdk.BUILD.gn b/sdk.BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..73934c3ce9fae4f80b6ccd82f6168ce76fc0d5bf --- /dev/null +++ b/sdk.BUILD.gn @@ -0,0 +1,36 @@ +# Copyright (c) 2021 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/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("//build/ohos.gni") +import("//build/ohos_var.gni") + +dsoftbus_root_path = "//foundation/communication/dsoftbus" + +config("dsoftbus_sdk_interface") { + include_dirs = [ + "$dsoftbus_root_path/interfaces/kits", + "$dsoftbus_root_path/interfaces/kits/bus_center", + "$dsoftbus_root_path/interfaces/kits/common", + "$dsoftbus_root_path/interfaces/kits/discovery", + "$dsoftbus_root_path/interfaces/kits/transport", + "$dsoftbus_root_path/sdk/transmission/session/cpp/include", + "$dsoftbus_root_path/interfaces/inner_kits/transport", + "$dsoftbus_root_path/core/common/dfx/hisysevent_adapter/include", + ] + libs = [ "softbus_client.z" ] +} + +group("softbus_client") { + public_configs = [ ":dsoftbus_sdk_interface" ] + all_dependent_configs = [ ":dsoftbus_sdk_interface" ] +} diff --git a/third_party_libcoap-OpenHarmony-v3.2-Release.tar.gz b/third_party_libcoap-OpenHarmony-v3.2-Release.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..08208da2ace0c3c3da6c6e7478339f849d450f67 Binary files /dev/null and b/third_party_libcoap-OpenHarmony-v3.2-Release.tar.gz differ diff --git a/third_party_mbedtls-OpenHarmony-v3.2-Release.tar.gz b/third_party_mbedtls-OpenHarmony-v3.2-Release.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..79513c80f725cf409b3211754506ee36ca1ddfd7 Binary files /dev/null and b/third_party_mbedtls-OpenHarmony-v3.2-Release.tar.gz differ diff --git a/third_party_sqlite-OpenHarmony-v3.2-Release.tar.gz b/third_party_sqlite-OpenHarmony-v3.2-Release.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..cc99bcc3d961e08014c5b17400c0c64a7becac27 Binary files /dev/null and b/third_party_sqlite-OpenHarmony-v3.2-Release.tar.gz differ