From 9fc32f880295ace207bfedfcc32a86499cd31325 Mon Sep 17 00:00:00 2001 From: fanglinxu Date: Fri, 18 Mar 2022 11:07:29 +0800 Subject: [PATCH] add depend headers and build config for dsoftbus The dependency header file is provided, and make its content empty to use depend.h, depend.h defined the custom functions required for dsoftbus for embedded. The header list is as follows: ability_info.h, bundle_mgr_interface.h, common_event_data.h, common_event_manager.h, common_event_subscriber.h, common_event_support.h, device_auth.h, hilog/log.h, ipc_skeleton.h, ipc_types.h, iremote_broker.h, iremote_object.h, iremote_parcel.h, iremote_proxy.h, iremote_stub.h, message_parcel.h, ohos/aafwk/content/want.h, parameter.h, permission/permission.h, permission/permission_kit.h, sys_mgr_client.h, system_ability.h, system_ability_definition.h, wifi_msg.h This depend module was add in ohos.build: hiviewdfx_hilog_native, ces_standard, aafwk_standard, appexecfwk_standard, deviceauth_standard, permission_standard, safwk, samgr_L2 and test.c is provided for test depend modules. Signed-off-by: fanglinxu --- dsoftbus/depend/BUILD.gn | 41 +++++ dsoftbus/depend/include/ability_info.h | 1 + .../depend/include/bundle_mgr_interface.h | 1 + dsoftbus/depend/include/common_event_data.h | 1 + .../depend/include/common_event_manager.h | 1 + .../depend/include/common_event_subscriber.h | 1 + .../depend/include/common_event_support.h | 1 + dsoftbus/depend/include/depend.h | 170 ++++++++++++++++++ dsoftbus/depend/include/device_auth.h | 1 + dsoftbus/depend/include/hilog/log.h | 1 + dsoftbus/depend/include/ipc_skeleton.h | 1 + dsoftbus/depend/include/ipc_types.h | 1 + dsoftbus/depend/include/iremote_broker.h | 1 + dsoftbus/depend/include/iremote_object.h | 1 + dsoftbus/depend/include/iremote_parcel.h | 1 + dsoftbus/depend/include/iremote_proxy.h | 1 + dsoftbus/depend/include/iremote_stub.h | 1 + dsoftbus/depend/include/message_parcel.h | 1 + .../depend/include/ohos/aafwk/content/want.h | 1 + dsoftbus/depend/include/parameter.h | 1 + .../depend/include/permission/permission.h | 1 + .../include/permission/permission_kit.h | 1 + dsoftbus/depend/include/sys_mgr_client.h | 1 + dsoftbus/depend/include/system_ability.h | 1 + .../include/system_ability_definition.h | 1 + dsoftbus/depend/include/wifi_msg.h | 1 + dsoftbus/depend/ohos.build | 121 +++++++++++++ dsoftbus/depend/test.c | 37 ++++ 28 files changed, 393 insertions(+) create mode 100755 dsoftbus/depend/BUILD.gn create mode 100755 dsoftbus/depend/include/ability_info.h create mode 100755 dsoftbus/depend/include/bundle_mgr_interface.h create mode 100755 dsoftbus/depend/include/common_event_data.h create mode 100755 dsoftbus/depend/include/common_event_manager.h create mode 100755 dsoftbus/depend/include/common_event_subscriber.h create mode 100755 dsoftbus/depend/include/common_event_support.h create mode 100755 dsoftbus/depend/include/depend.h create mode 100755 dsoftbus/depend/include/device_auth.h create mode 100755 dsoftbus/depend/include/hilog/log.h create mode 100755 dsoftbus/depend/include/ipc_skeleton.h create mode 100755 dsoftbus/depend/include/ipc_types.h create mode 100755 dsoftbus/depend/include/iremote_broker.h create mode 100755 dsoftbus/depend/include/iremote_object.h create mode 100755 dsoftbus/depend/include/iremote_parcel.h create mode 100755 dsoftbus/depend/include/iremote_proxy.h create mode 100755 dsoftbus/depend/include/iremote_stub.h create mode 100755 dsoftbus/depend/include/message_parcel.h create mode 100755 dsoftbus/depend/include/ohos/aafwk/content/want.h create mode 100755 dsoftbus/depend/include/parameter.h create mode 100755 dsoftbus/depend/include/permission/permission.h create mode 100755 dsoftbus/depend/include/permission/permission_kit.h create mode 100755 dsoftbus/depend/include/sys_mgr_client.h create mode 100755 dsoftbus/depend/include/system_ability.h create mode 100755 dsoftbus/depend/include/system_ability_definition.h create mode 100755 dsoftbus/depend/include/wifi_msg.h create mode 100755 dsoftbus/depend/ohos.build create mode 100755 dsoftbus/depend/test.c diff --git a/dsoftbus/depend/BUILD.gn b/dsoftbus/depend/BUILD.gn new file mode 100755 index 00000000..1a190dc8 --- /dev/null +++ b/dsoftbus/depend/BUILD.gn @@ -0,0 +1,41 @@ +import("//build/ohos.gni") + +config("lib_public_config") { + include_dirs = [ "include", "//utils/native/base/include" ] +} + +ohos_shared_library("libhilog") { + sources = [ "test.c" ] + public_configs = [ ":lib_public_config" ] +} + +ohos_shared_library("ipc_single") { + sources = [ "test.c" ] + public_configs = [ ":lib_public_config" ] +} + +ohos_shared_library("deviceauth_sdk") { + sources = [ "test.c" ] + public_configs = [ ":lib_public_config" ] +} + +group("libpermissionsdk_standard") { +} + +group("ipc_core") { +} + +group("system_ability_fwk") { +} + +group("samgr_proxy") { +} + +group("cesfwk_innerkits") { +} + +group("want") { +} + +group("appexecfwk_core") { +} diff --git a/dsoftbus/depend/include/ability_info.h b/dsoftbus/depend/include/ability_info.h new file mode 100755 index 00000000..f2e4d534 --- /dev/null +++ b/dsoftbus/depend/include/ability_info.h @@ -0,0 +1 @@ +#include "depend.h" diff --git a/dsoftbus/depend/include/bundle_mgr_interface.h b/dsoftbus/depend/include/bundle_mgr_interface.h new file mode 100755 index 00000000..f2e4d534 --- /dev/null +++ b/dsoftbus/depend/include/bundle_mgr_interface.h @@ -0,0 +1 @@ +#include "depend.h" diff --git a/dsoftbus/depend/include/common_event_data.h b/dsoftbus/depend/include/common_event_data.h new file mode 100755 index 00000000..f2e4d534 --- /dev/null +++ b/dsoftbus/depend/include/common_event_data.h @@ -0,0 +1 @@ +#include "depend.h" diff --git a/dsoftbus/depend/include/common_event_manager.h b/dsoftbus/depend/include/common_event_manager.h new file mode 100755 index 00000000..f2e4d534 --- /dev/null +++ b/dsoftbus/depend/include/common_event_manager.h @@ -0,0 +1 @@ +#include "depend.h" diff --git a/dsoftbus/depend/include/common_event_subscriber.h b/dsoftbus/depend/include/common_event_subscriber.h new file mode 100755 index 00000000..f2e4d534 --- /dev/null +++ b/dsoftbus/depend/include/common_event_subscriber.h @@ -0,0 +1 @@ +#include "depend.h" diff --git a/dsoftbus/depend/include/common_event_support.h b/dsoftbus/depend/include/common_event_support.h new file mode 100755 index 00000000..f2e4d534 --- /dev/null +++ b/dsoftbus/depend/include/common_event_support.h @@ -0,0 +1 @@ +#include "depend.h" diff --git a/dsoftbus/depend/include/depend.h b/dsoftbus/depend/include/depend.h new file mode 100755 index 00000000..786d60ab --- /dev/null +++ b/dsoftbus/depend/include/depend.h @@ -0,0 +1,170 @@ +#ifndef _DEPEND_H +#define _DEPEND_H + +//parameter.h +const char* GetSerial(void); +int GetDevUdid(char *udid, int size); + +//hilog/log.h +#define HILOG_DEBUG(type, ...) +#define HILOG_INFO(type, ...) +#define HILOG_WARN(type, ...) +#define HILOG_ERROR(type, ...) + +#endif + +#ifndef _DEPEND_CPP_H +#define _DEPEND_CPP_H +//IRemoteBroker +#ifdef __cplusplus +#include +#include +#include +#include +#include "parcel.h" + +typedef enum TypePermissionState { + PERMISSION_NOT_GRANTED = -1, + PERMISSION_GRANTED = 0, +} PermissionState; + +#define DECLARE_SYSTEM_ABILITY(className) \ + public: \ + virtual std::string GetClassName() override { \ + return #className; \ + } + +#define DECLARE_BASE_SYSTEM_ABILITY(className) \ + public: \ + virtual std::string GetClassName() = 0; + +namespace OHOS { +namespace Security { +namespace Permission { +}; +}; + +#define REGISTER_SYSTEM_ABILITY_BY_ID(abilityClassName, systemAbilityId, runOnCreate) \ + const bool abilityClassName##_##RegisterResult = \ + SystemAbility::MakeAndRegisterAbility(new abilityClassName(systemAbilityId, runOnCreate)); + +enum { + SOFTBUS_SERVER_SA_ID = 4700, +}; + +template class BrokerDelegator { +}; + +class IRemoteObject; + +class MessageParcel : public Parcel { +public: + bool WriteFileDescriptor(int fd) {return true;} + bool WriteRawData(const void *data, size_t size) {return true;} + void *ReadRawData(size_t size) {return NULL;} + sptr ReadRemoteObject() {return NULL;} + int ReadFileDescriptor() {return 0;} +}; + +class MessageOption { +}; + +class IRemoteBroker { +#define DECLARE_INTERFACE_DESCRIPTOR(DESCRIPTOR) \ + static inline const std::u16string metaDescriptor_ = {DESCRIPTOR}; \ + static inline const std::u16string &GetDescriptor() \ + { \ + return metaDescriptor_; \ + } +}; + +class IRemoteObject : public virtual Parcelable { + public: + virtual int SendRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) {return 0;} + class DeathRecipient : public RefBase { + public: + virtual void OnRemoteDied(const wptr &object) {}; + }; + virtual bool RemoveDeathRecipient(const sptr &recipient) {return true;}; + virtual bool AddDeathRecipient(const sptr &recipient) {return true;}; + virtual bool Marshalling(Parcel &parcel) const override {return true;} +}; + +template class IRemoteProxy: public INTERFACE, public virtual RefBase { + public: + IRemoteProxy(const sptr &object) { + } + sptr Remote() {return NULL;} +}; + +class IPCObjectStub : public IRemoteObject { + public: + virtual int OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) {return 0;} +}; + +template class IRemoteStub: public IPCObjectStub, public INTERFACE { + public: + virtual int OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) {return 0;} +}; + +class IPCSkeleton { + public: + static sptr GetContextObject() {return NULL;} + static pid_t GetCallingPid() {return 0;} + static pid_t GetCallingUid() {return 0;} +}; + +class SystemAbility { + DECLARE_BASE_SYSTEM_ABILITY(SystemAbility); + public: + static bool MakeAndRegisterAbility(SystemAbility* systemAbility) {return true;} + bool Publish(sptr systemAbility) {return true;} + protected: + SystemAbility(bool runOnCreate = false) {} + SystemAbility(int32_t systemAbilityId, bool runOnCreate = false) {} + virtual void OnStart() = 0; + virtual void OnStop() = 0; +}; + +}; +#endif + +//device_auth.h +#include +#include + +#define FIELD_PEER_CONN_DEVICE_ID "peerConnDeviceId" +#define FIELD_SERVICE_PKG_NAME "servicePkgName" +#define FIELD_IS_CLIENT "isClient" +#define FIELD_KEY_LENGTH "keyLength" +#define FIELD_CONFIRMATION "confirmation" + +#define REQUEST_ACCEPTED 0x80000006 + +typedef struct { + bool (*onTransmit)(int64_t requestId, const uint8_t *data, uint32_t dataLen); + void (*onSessionKeyReturned)(int64_t requestId, const uint8_t *sessionKey, uint32_t sessionKeyLen); + void (*onFinish)(int64_t requestId, int operationCode, const char *returnData); + void (*onError)(int64_t requestId, int operationCode, int errorCode, const char *errorReturn); + char *(*onRequest)(int64_t requestId, int operationCode, const char *reqParams); +} DeviceAuthCallback; + +typedef struct { + int32_t (*processData)(int64_t authReqId, const uint8_t *data, uint32_t dataLen, const DeviceAuthCallback *gaCallback); + int32_t (*authDevice)(int64_t authReqId, const char *authParams, const DeviceAuthCallback *gaCallback); +} GroupAuthManager; + +typedef struct { + void (*onDeviceNotTrusted)(const char *peerUdid); +} DataChangeListener; + +typedef struct { + int32_t (*regDataChangeListener)(const char *appId, const DataChangeListener *listener); +} DeviceGroupManager; + +int InitDeviceAuthService(void); +void DestroyDeviceAuthService(void); +const GroupAuthManager *GetGaInstance(void); +const DeviceGroupManager *GetGmInstance(void); + +#endif diff --git a/dsoftbus/depend/include/device_auth.h b/dsoftbus/depend/include/device_auth.h new file mode 100755 index 00000000..f2e4d534 --- /dev/null +++ b/dsoftbus/depend/include/device_auth.h @@ -0,0 +1 @@ +#include "depend.h" diff --git a/dsoftbus/depend/include/hilog/log.h b/dsoftbus/depend/include/hilog/log.h new file mode 100755 index 00000000..f2e4d534 --- /dev/null +++ b/dsoftbus/depend/include/hilog/log.h @@ -0,0 +1 @@ +#include "depend.h" diff --git a/dsoftbus/depend/include/ipc_skeleton.h b/dsoftbus/depend/include/ipc_skeleton.h new file mode 100755 index 00000000..f2e4d534 --- /dev/null +++ b/dsoftbus/depend/include/ipc_skeleton.h @@ -0,0 +1 @@ +#include "depend.h" diff --git a/dsoftbus/depend/include/ipc_types.h b/dsoftbus/depend/include/ipc_types.h new file mode 100755 index 00000000..f2e4d534 --- /dev/null +++ b/dsoftbus/depend/include/ipc_types.h @@ -0,0 +1 @@ +#include "depend.h" diff --git a/dsoftbus/depend/include/iremote_broker.h b/dsoftbus/depend/include/iremote_broker.h new file mode 100755 index 00000000..f2e4d534 --- /dev/null +++ b/dsoftbus/depend/include/iremote_broker.h @@ -0,0 +1 @@ +#include "depend.h" diff --git a/dsoftbus/depend/include/iremote_object.h b/dsoftbus/depend/include/iremote_object.h new file mode 100755 index 00000000..f2e4d534 --- /dev/null +++ b/dsoftbus/depend/include/iremote_object.h @@ -0,0 +1 @@ +#include "depend.h" diff --git a/dsoftbus/depend/include/iremote_parcel.h b/dsoftbus/depend/include/iremote_parcel.h new file mode 100755 index 00000000..f2e4d534 --- /dev/null +++ b/dsoftbus/depend/include/iremote_parcel.h @@ -0,0 +1 @@ +#include "depend.h" diff --git a/dsoftbus/depend/include/iremote_proxy.h b/dsoftbus/depend/include/iremote_proxy.h new file mode 100755 index 00000000..f2e4d534 --- /dev/null +++ b/dsoftbus/depend/include/iremote_proxy.h @@ -0,0 +1 @@ +#include "depend.h" diff --git a/dsoftbus/depend/include/iremote_stub.h b/dsoftbus/depend/include/iremote_stub.h new file mode 100755 index 00000000..f2e4d534 --- /dev/null +++ b/dsoftbus/depend/include/iremote_stub.h @@ -0,0 +1 @@ +#include "depend.h" diff --git a/dsoftbus/depend/include/message_parcel.h b/dsoftbus/depend/include/message_parcel.h new file mode 100755 index 00000000..f2e4d534 --- /dev/null +++ b/dsoftbus/depend/include/message_parcel.h @@ -0,0 +1 @@ +#include "depend.h" diff --git a/dsoftbus/depend/include/ohos/aafwk/content/want.h b/dsoftbus/depend/include/ohos/aafwk/content/want.h new file mode 100755 index 00000000..f2e4d534 --- /dev/null +++ b/dsoftbus/depend/include/ohos/aafwk/content/want.h @@ -0,0 +1 @@ +#include "depend.h" diff --git a/dsoftbus/depend/include/parameter.h b/dsoftbus/depend/include/parameter.h new file mode 100755 index 00000000..f2e4d534 --- /dev/null +++ b/dsoftbus/depend/include/parameter.h @@ -0,0 +1 @@ +#include "depend.h" diff --git a/dsoftbus/depend/include/permission/permission.h b/dsoftbus/depend/include/permission/permission.h new file mode 100755 index 00000000..f2e4d534 --- /dev/null +++ b/dsoftbus/depend/include/permission/permission.h @@ -0,0 +1 @@ +#include "depend.h" diff --git a/dsoftbus/depend/include/permission/permission_kit.h b/dsoftbus/depend/include/permission/permission_kit.h new file mode 100755 index 00000000..f2e4d534 --- /dev/null +++ b/dsoftbus/depend/include/permission/permission_kit.h @@ -0,0 +1 @@ +#include "depend.h" diff --git a/dsoftbus/depend/include/sys_mgr_client.h b/dsoftbus/depend/include/sys_mgr_client.h new file mode 100755 index 00000000..f2e4d534 --- /dev/null +++ b/dsoftbus/depend/include/sys_mgr_client.h @@ -0,0 +1 @@ +#include "depend.h" diff --git a/dsoftbus/depend/include/system_ability.h b/dsoftbus/depend/include/system_ability.h new file mode 100755 index 00000000..f2e4d534 --- /dev/null +++ b/dsoftbus/depend/include/system_ability.h @@ -0,0 +1 @@ +#include "depend.h" diff --git a/dsoftbus/depend/include/system_ability_definition.h b/dsoftbus/depend/include/system_ability_definition.h new file mode 100755 index 00000000..f2e4d534 --- /dev/null +++ b/dsoftbus/depend/include/system_ability_definition.h @@ -0,0 +1 @@ +#include "depend.h" diff --git a/dsoftbus/depend/include/wifi_msg.h b/dsoftbus/depend/include/wifi_msg.h new file mode 100755 index 00000000..f2e4d534 --- /dev/null +++ b/dsoftbus/depend/include/wifi_msg.h @@ -0,0 +1 @@ +#include "depend.h" diff --git a/dsoftbus/depend/ohos.build b/dsoftbus/depend/ohos.build new file mode 100755 index 00000000..33673a31 --- /dev/null +++ b/dsoftbus/depend/ohos.build @@ -0,0 +1,121 @@ +{ + "subsystem": "depend", + "parts": { + "hiviewdfx_hilog_native": { + "module_list": [ ], + "inner_kits": [ + { + "name": "//depend:libhilog", + "header": { + "header_files": [ ], + "header_base": "//depend" + } + } + ] + }, + "ipc": { + "module_list": [ ], + "inner_kits": [ + { + "name": "//depend:ipc_single", + "header": { + "header_files": [ ], + "header_base": "//depend" + } + }, + { + "name":"//depend:ipc_core", + "header": { + "header_files": [ ], + "header_base": "//depend" + } + } + ] + }, + "ces_standard": { + "module_list": [ ], + "inner_kits": [ + { + "name": "//depend:cesfwk_innerkits", + "header": { + "header_files": [ ], + "header_base": "//depend" + } + } + ] + }, + "aafwk_standard": { + "module_list": [ ], + "inner_kits": [ + { + "name": "//depend:want", + "header": { + "header_files": [ ], + "header_base": "//depend" + } + } + ] + }, + "appexecfwk_standard": { + "module_list": [ ], + "inner_kits": [ + { + "name": "//depend:appexecfwk_core", + "header": { + "header_files": [ ], + "header_base": "//depend" + } + } + ] + }, + "deviceauth_standard": { + "module_list": [ ], + "inner_kits": [ + { + "name": "//depend:deviceauth_sdk", + "header": { + "header_files": [ ], + "header_base": "//depend" + } + } + ] + }, + "permission_standard": { + "module_list": [ ], + "inner_kits": [ + { + "name": "//depend:libpermissionsdk_standard", + "header": { + "header_files": [ ], + "header_base":"//depend" + } + } + ] + }, + "safwk": { + "module_list": [ ], + "inner_kits": [ + { + "name": "//depend:system_ability_fwk", + "header": { + "header_files": [ ], + "header_base": "//depend" + } + } + ] + }, + "samgr_L2": { + "module_list": [ ], + "inner_kits": [ + { + "name": "//depend:samgr_proxy", + "header": { + "header_files": [ ], + "header_base": "//depend" + } + } + ] + } + } +} + diff --git a/dsoftbus/depend/test.c b/dsoftbus/depend/test.c new file mode 100755 index 00000000..943f60d2 --- /dev/null +++ b/dsoftbus/depend/test.c @@ -0,0 +1,37 @@ +#include +#include "depend.h" + +void test() +{ + printf("test"); +} + +int GetDevUdid(char *udid, int size) +{ + return 0; +} + +const char* GetSerial(void) +{ + return NULL; +} + +int InitDeviceAuthService(void) +{ + return 0; +} + +void DestroyDeviceAuthService(void) +{ + return; +} + +const GroupAuthManager *GetGaInstance(void) +{ + return NULL; +} + +const DeviceGroupManager *GetGmInstance(void) +{ + return NULL; +} -- Gitee