!13 按照ohos最新部件化要求,目录结构调整

Merge pull request !13 from Zen知仁/xzr
This commit is contained in:
openharmony_ci 2022-01-20 10:26:58 +00:00 committed by Gitee
commit 2f7d0c754e
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
55 changed files with 75 additions and 92 deletions

View File

@ -47,10 +47,10 @@ OpenHarmony系统安全架构如下图所示
.
├── baselib # 基础库
├── common # 公共头文件
├── interfaces # innerkits接口
├── interfaces # inner api接口
├── oem_property # OEM厂家适配层
├── profile # 组件配置文件
├── service # 服务代码
├── services # 服务框架代码
└── test # 测试代码
```

View File

@ -40,19 +40,19 @@
},
"build": {
"sub_component": [
"//base/security/device_security_level/interfaces:dslm_sdk",
"//base/security/device_security_level/interfaces/inner_api:dslm_sdk",
"//base/security/device_security_level/oem_property/ohos:dslm_service",
"//base/security/device_security_level/profile:dslm_service.rc"
],
"inner_kits": [
{
"name": "//base/security/device_security_level/interfaces:dslm_sdk",
"name": "//base/security/device_security_level/interfaces/inner_api:dslm_sdk",
"header": {
"header_files": [
"device_security_info.h",
"device_security_defines.h"
],
"header_base": "//base/security/device_security_level/interfaces/include"
"header_base": "//base/security/device_security_level/interfaces/inner_api/include"
}
}
],

View File

@ -26,7 +26,7 @@ ohos_shared_library("dslm_sdk") {
]
include_dirs = [
"//base/security/device_security_level/service/include",
"//base/security/device_security_level/services/include",
"//base/security/device_security_level/common/include",
]

View File

@ -28,10 +28,10 @@
using namespace OHOS::HiviewDFX;
using namespace OHOS::Security::DeviceSecurityLevel;
int32_t RequestDeviceSecurityInfoAsyncImpl(const DeviceIdentify *identify, const RequestOption *option,
static int32_t RequestDeviceSecurityInfoAsyncImpl(const DeviceIdentify *identify, const RequestOption *option,
ResultCallback callback)
{
if (identify == NULL || callback == NULL) {
if (identify == nullptr || callback == nullptr) {
HiLog::Error(LABEL, "GetDeviceSecurityInfo input error.");
return ERR_INVALID_PARA;
}
@ -39,7 +39,7 @@ int32_t RequestDeviceSecurityInfoAsyncImpl(const DeviceIdentify *identify, const
constexpr uint32_t DEAFULT_KEEP_LEN = 45;
constexpr uint32_t MAX_KEEP_LEN = 300;
static RequestOption defaultOption = {0, DEAFULT_KEEP_LEN, 0};
if (option == NULL) {
if (option == nullptr) {
option = &defaultOption;
}
if (option->timeout > MAX_KEEP_LEN) {
@ -81,7 +81,7 @@ int32_t RequestDeviceSecurityInfoAsyncImpl(const DeviceIdentify *identify, const
return success;
}
int32_t RequestDeviceSecurityInfoImpl(const DeviceIdentify *identify, const RequestOption *option,
static int32_t RequestDeviceSecurityInfoImpl(const DeviceIdentify *identify, const RequestOption *option,
DeviceSecurityInfo **info)
{
std::promise<DeviceSecurityInfo *> promise;
@ -99,16 +99,16 @@ int32_t RequestDeviceSecurityInfoImpl(const DeviceIdentify *identify, const Requ
return SUCCESS;
}
void FreeDeviceSecurityInfoImpl(DeviceSecurityInfo *info)
static void FreeDeviceSecurityInfoImpl(DeviceSecurityInfo *info)
{
if (info != NULL && info->magicNum == SECURITY_MAGIC) {
if (info != nullptr && info->magicNum == SECURITY_MAGIC) {
delete info;
}
}
int32_t GetDeviceSecurityLevelValueImpl(const DeviceSecurityInfo *info, int32_t *level)
static int32_t GetDeviceSecurityLevelValueImpl(const DeviceSecurityInfo *info, int32_t *level)
{
if (info == NULL || level == nullptr) {
if (info == nullptr || level == nullptr) {
return ERR_INVALID_PARA;
}
if (info->magicNum != SECURITY_MAGIC) {

View File

@ -15,9 +15,6 @@
#include "device_security_level_callback_helper.h"
#include <functional>
#include <iostream>
#include "timer.h"
#include "hilog/log.h"
@ -160,7 +157,6 @@ bool DeviceSecurityLevelCallbackHelper::CallbackInfoHolder::PopCallback(uint32_t
map_.erase(iter);
return true;
}
} // namespace DeviceSecurityLevel
} // namespace Security
} // namespace OHOS

View File

@ -16,15 +16,15 @@
#ifndef DEVICE_SECURITY_LEVEL_CALLBACK_STUB
#define DEVICE_SECURITY_LEVEL_CALLBACK_STUB
#include "iremote_stub.h"
#include "nocopyable.h"
#include <functional>
#include <mutex>
#include "idevice_security_level.h"
#include "iremote_stub.h"
#include "nocopyable.h"
#include "device_security_defines.h"
#include "device_security_level_defines.h"
#include "idevice_security_level.h"
namespace OHOS {
namespace Security {

View File

@ -32,13 +32,11 @@ typedef struct DeviceSecurityInfo {
namespace OHOS {
namespace Security {
namespace DeviceSecurityLevel {
constexpr uint64_t SECURITY_MAGIC = 0xABCD1234;
static constexpr uint64_t SECURITY_MAGIC = 0xABCD1234;
static constexpr OHOS::HiviewDFX::HiLogLabel LABEL = {LOG_CORE, 0xD002F00, "DSLM_SDK"};
using ResultCallback = std::function<void(const DeviceIdentify *identify, struct DeviceSecurityInfo *info)>;
} // namespace DeviceSecurityLevel
} // namespace Security
} // namespace OHOS

View File

@ -77,7 +77,6 @@ int32_t DeviceSecurityLevelProxy::RequestDeviceSecurityLevel(const DeviceIdentif
return SUCCESS;
}
} // namespace DeviceSecurityLevel
} // namespace Security
} // namespace OHOS
} // namespace OHOS

View File

@ -19,13 +19,13 @@ ohos_shared_library("dslm_service") {
include_dirs = [
"//base/security/device_security_level/common/include",
"//base/security/device_security_level/interfaces/include",
"//base/security/device_security_level/interfaces/inner_api/include",
]
deps = [
":dslm_ohos_cread_obj",
"//base/security/device_security_level/baselib/utils:utils_static",
"//base/security/device_security_level/service/sa:service_sa_static",
"//base/security/device_security_level/services/sa:service_sa_static",
]
external_deps = [
@ -45,7 +45,7 @@ ohos_source_set("dslm_ohos_cread_obj") {
include_dirs = [
"//base/security/device_security_level/common/include",
"//base/security/device_security_level/interfaces/include",
"//base/security/device_security_level/interfaces/inner_api/include",
]
deps = [ "//base/security/device_security_level/baselib/utils:utils_static" ]

View File

@ -17,7 +17,7 @@ import("//build/ohos.gni")
ohos_source_set("service_bigdata_obj") {
sources = [ "dslm_bigdata.cpp" ]
include_dirs = [ "//base/security/device_security_level/service/include" ]
include_dirs = [ "//base/security/device_security_level/services/include" ]
deps = [ "//base/security/device_security_level/baselib/utils:utils_static" ]

View File

@ -21,8 +21,8 @@ ohos_source_set("service_common_obj") {
]
include_dirs = [
"//base/security/device_security_level/interfaces/include",
"//base/security/device_security_level/service/include",
"//base/security/device_security_level/interfaces/inner_api/include",
"//base/security/device_security_level/services/include",
]
deps = [ "//base/security/device_security_level/baselib/utils:utils_static" ]

View File

@ -26,8 +26,8 @@ service_dslm_sources = [
service_dslm_include_dirs = [
"//base/security/device_security_level/common/include",
"//base/security/device_security_level/interfaces/include",
"//base/security/device_security_level/service/include",
"//base/security/device_security_level/interfaces/inner_api/include",
"//base/security/device_security_level/services/include",
]
# service_dslm object

View File

@ -57,7 +57,7 @@ typedef struct DslmDeviceInfo {
ListHead notifyList;
} DslmDeviceInfo;
static inline uint32_t GetCurrentVersion()
static inline uint32_t GetCurrentVersion(void)
{
// shift major 16 bit, shift minor 8 bit
return (VERSION_MAJOR << 16) + (VERSION_MINOR << 8) + VERSION_PATCH;

View File

@ -81,7 +81,6 @@ int32_t OnPeerMsgResponseInfoReceived(const DeviceIdentify *deviceId, const uint
}
SECURITY_LOG_DEBUG("OnPeerMsgResponseInfoReceived msg is %s", (char *)msg);
// find the device;
DslmDeviceInfo *deviceInfo = GetDslmDeviceInfo(deviceId);
if (deviceInfo == NULL) {
SECURITY_LOG_ERROR("OnPeerMsgResponseInfoReceived no existed device");
@ -181,7 +180,7 @@ int32_t OnPeerStatusReceiver(const DeviceIdentify *deviceId, uint32_t status, ui
return SUCCESS;
}
bool InitSelfDeviceSecureLevel()
bool InitSelfDeviceSecureLevel(void)
{
uint32_t devType = 0;
const DeviceIdentify *device = GetSelfDevice(&devType);
@ -212,7 +211,7 @@ bool InitSelfDeviceSecureLevel()
return true;
}
bool InitDslmProcess()
bool InitDslmProcess(void)
{
static bool isInited = false;
static Mutex initMutex = INITED_MUTEX;
@ -234,7 +233,7 @@ bool InitDslmProcess()
return isInited;
}
bool DeinitDslmProcess()
bool DeinitDslmProcess(void)
{
return true;
}

View File

@ -30,19 +30,19 @@
#define MAX_DEVICE_CNT 128
static inline Mutex *GetDeviceListMutex()
static inline Mutex *GetDeviceListMutex(void)
{
static Mutex mutex = INITED_MUTEX;
return &mutex;
}
static ListHead *GetDeviceList()
static ListHead *GetDeviceList(void)
{
static ListHead list = INIT_LIST(list);
return &list;
}
static int32_t GetDeviceListSize()
static int32_t GetDeviceListSize(void)
{
int32_t size = 0;
ListNode *node = NULL;

View File

@ -38,11 +38,11 @@ int32_t OnMsgSendResultNotifier(const DeviceIdentify *deviceId, uint64_t transNo
int32_t OnPeerStatusReceiver(const DeviceIdentify *deviceId, uint32_t status, uint32_t devType);
bool InitDslmProcess();
bool InitDslmProcess(void);
bool DeinitDslmProcess();
bool DeinitDslmProcess(void);
bool InitSelfDeviceSecureLevel();
bool InitSelfDeviceSecureLevel(void);
#ifdef __cplusplus
}

View File

@ -41,9 +41,9 @@ void SendMsgToDevice(uint64_t transNo, const DeviceIdentify *devId, const uint8_
uint32_t InitMessenger(const MessageReceiver messageReceiver, const StatusReceiver statusReceiver,
const SendResultNotifier notifier);
uint32_t DeinitMessenger();
uint32_t DeinitMessenger(void);
bool GetMessengerStatus();
bool GetMessengerStatus(void);
bool GetPeerDeviceOnlineStatus(const DeviceIdentify *devId, uint32_t *devType);

View File

@ -18,8 +18,8 @@ ohos_source_set("service_msg_obj") {
sources = [ "dslm_messenger_wrapper.c" ]
include_dirs = [
"//base/security/device_security_level/interfaces/include",
"//base/security/device_security_level/service/include",
"//base/security/device_security_level/interfaces/inner_api/include",
"//base/security/device_security_level/services/include",
]
deps = [

View File

@ -46,7 +46,7 @@ uint32_t InitMessenger(const MessageReceiver messageReceiver, const StatusReceiv
return SUCCESS;
}
uint32_t DeinitMessenger()
uint32_t DeinitMessenger(void)
{
LockMutex(&g_mutex);
if (g_messenger == NULL) {
@ -58,7 +58,7 @@ uint32_t DeinitMessenger()
return SUCCESS;
}
bool GetMessengerStatus()
bool GetMessengerStatus(void)
{
LockMutex(&g_mutex);
if (g_messenger == NULL) {
@ -102,7 +102,7 @@ const DeviceIdentify *GetSelfDevice(uint32_t *devType)
{
LockMutex(&g_mutex);
static uint32_t type = 0;
static DeviceIdentify deviceId = { 0, { 0 } };
static DeviceIdentify deviceId = {0, {0}};
if (deviceId.length == 0 || deviceId.identity[0] == 0) {
if (g_messenger != NULL) {
GetSelfDeviceIdentify(g_messenger, &deviceId, &type);

View File

@ -17,24 +17,24 @@ import("//build/ohos.gni")
ohos_static_library("service_sa_static") {
sources = [
"common/dslm_rpc_process.c",
"full/dslm_callback_proxy.cpp",
"full/dslm_ipc_process.cpp",
"full/dslm_service.cpp",
"standard/dslm_callback_proxy.cpp",
"standard/dslm_ipc_process.cpp",
"standard/dslm_service.cpp",
]
include_dirs = [
"//base/security/device_security_level/common/include",
"//base/security/device_security_level/interfaces/include",
"//base/security/device_security_level/service/include",
"//base/security/device_security_level/service/sa/common",
"//base/security/device_security_level/interfaces/inner_api/include",
"//base/security/device_security_level/services/include",
"//base/security/device_security_level/services/sa/common",
]
deps = [
"//base/security/device_security_level/baselib/utils:utils_static",
"//base/security/device_security_level/service/bigdata:service_bigdata_obj",
"//base/security/device_security_level/service/common:service_common_obj",
"//base/security/device_security_level/service/dslm:service_dslm_obj",
"//base/security/device_security_level/service/msg:service_msg_obj",
"//base/security/device_security_level/services/bigdata:service_bigdata_obj",
"//base/security/device_security_level/services/common:service_common_obj",
"//base/security/device_security_level/services/dslm:service_dslm_obj",
"//base/security/device_security_level/services/msg:service_msg_obj",
]
external_deps = [

View File

@ -32,10 +32,7 @@ int32_t OnPeerMsgReceived(const DeviceIdentify *devId, const uint8_t *msg, uint3
return ERR_INVALID_PARA;
}
const MessageBuff buff = {
.buff = (uint8_t *)msg,
.length = len
};
const MessageBuff buff = {.buff = (uint8_t *)msg, .length = len};
int32_t ret = SUCCESS;
MessagePacket *packet = ParseMessage(&buff);
if (packet == NULL) {
@ -70,7 +67,7 @@ int32_t OnSendResultNotifier(const DeviceIdentify *devId, uint64_t transNo, uint
return OnMsgSendResultNotifier(devId, transNo, result);
}
uint32_t InitService()
uint32_t InitService(void)
{
uint32_t times = 0;
uint32_t ret = InitMessenger(OnPeerMsgReceived, OnPeerStatusReceiver, OnSendResultNotifier);
@ -95,7 +92,7 @@ uint32_t InitService()
return SUCCESS;
}
void UnInitService()
void UnInitService(void)
{
DeinitDslmProcess();
DeinitMessenger();

View File

@ -23,9 +23,9 @@
extern "C" {
#endif
uint32_t InitService();
uint32_t InitService(void);
void UnInitService();
void UnInitService(void);
#ifdef __cplusplus
}

View File

@ -50,7 +50,6 @@ int32_t DslmCallbackProxy::ResponseDeviceSecurityLevel(uint32_t cookie, const Re
MessageOption ipcOption = {MessageOption::TF_ASYNC};
return Remote()->SendRequest(CMD_SET_DEVICE_SECURITY_LEVEL, data, reply, ipcOption);
}
} // namespace DeviceSecurityLevel
} // namespace Security
} // namespace OHOS

View File

@ -43,7 +43,6 @@ public:
private:
static inline BrokerDelegator<DslmCallbackProxy> delegator_;
};
} // namespace DeviceSecurityLevel
} // namespace Security
} // namespace OHOS

View File

@ -28,12 +28,11 @@ constexpr uint32_t DFT_TIMEOUT = 45;
constexpr uint32_t MAX_TIMEOUT = 60;
constexpr uint32_t MIN_TIMEOUT = 1;
constexpr uint32_t WARAING_GATE = 64;
}
} // namespace
namespace OHOS {
namespace Security {
namespace DeviceSecurityLevel {
static void ProcessCallback(uint32_t cookie, uint32_t result, const DslmCallbackInfo *info)
{
if ((cookie == 0) || (info == nullptr)) {
@ -171,7 +170,6 @@ const sptr<IRemoteObject> DslmIpcProcess::RemoteHolder::Pop(uint32_t cookie)
map_.erase(iter);
return obj;
}
} // DeviceSecurityLevel
} // Security
} // OHOS
} // namespace DeviceSecurityLevel
} // namespace Security
} // namespace OHOS

View File

@ -51,9 +51,8 @@ private:
int32_t DslmSetResponseToParcel(MessageParcel &reply, int32_t status);
};
} // DeviceSecurityLevel
} // Security
} // OHOS
} // namespace DeviceSecurityLevel
} // namespace Security
} // namespace OHOS
#endif // DSLM_IPC_PROCESS_H

View File

@ -83,7 +83,6 @@ int32_t DslmService::ProcessGetDeviceSecurityLevel(MessageParcel &data, MessageP
{
return Singleton<DslmIpcProcess>::GetInstance().DslmProcessGetDeviceSecurityLevel(data, reply);
}
} // namespace DeviceSecurityLevel
} // namespace Security
} // namespace OHOS

View File

@ -24,7 +24,7 @@ ohos_unittest("dslm_test") {
sources = [
"//base/security/device_security_level/oem_property/ohos/dslm_ohos_credential.c",
"//base/security/device_security_level/service/sa/common/dslm_rpc_process.c",
"//base/security/device_security_level/services/sa/common/dslm_rpc_process.c",
"dslm_msg_interface_mock.cpp",
"dslm_request_callback_mock.cpp",
"dslm_test.cpp",
@ -32,20 +32,20 @@ ohos_unittest("dslm_test") {
include_dirs = [
"//base/security/device_security_level/common/include",
"//base/security/device_security_level/interfaces/include",
"//base/security/device_security_level/service/include",
"//base/security/device_security_level/service/dslm",
"//base/security/device_security_level/service/sa/common",
"//base/security/device_security_level/interfaces/inner_api/include",
"//base/security/device_security_level/services/include",
"//base/security/device_security_level/services/dslm",
"//base/security/device_security_level/services/sa/common",
"//base/security/device_security_level/baselib/msglib/include/",
]
deps = [
"//base/security/device_security_level/baselib/utils:utils_static",
"//base/security/device_security_level/oem_property/ohos:dslm_ohos_cread_obj",
"//base/security/device_security_level/service/bigdata:service_bigdata_obj",
"//base/security/device_security_level/service/common:service_common_obj",
"//base/security/device_security_level/service/dslm:service_dslm_test_obj",
"//base/security/device_security_level/service/msg:service_msg_obj",
"//base/security/device_security_level/services/bigdata:service_bigdata_obj",
"//base/security/device_security_level/services/common:service_common_obj",
"//base/security/device_security_level/services/dslm:service_dslm_test_obj",
"//base/security/device_security_level/services/msg:service_msg_obj",
"//third_party/googletest:gmock",
]