1 /* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef BMS_WRAPPER 17 #define BMS_WRAPPER 18 19 #include <stdint.h> 20 #include "asset_type.h" 21 22 #ifdef __cplusplus 23 extern "C" { 24 #endif 25 26 #define ARRAY_SIZE(arr) ((sizeof(arr)) / (sizeof((arr)[0]))) 27 28 enum OwnerType { 29 HAP = 0, 30 NATIVE = 1, 31 HAP_GROUP = 2, 32 }; 33 34 typedef struct { 35 int32_t appIndex; 36 Asset_Blob appId; 37 Asset_Blob groupId; 38 Asset_Blob developerId; 39 } HapInfo; 40 41 typedef struct { 42 uint32_t uid; 43 } NativeInfo; 44 45 typedef struct { 46 uint32_t userId; 47 OwnerType ownerType; 48 // Bundle name for hap or process name for native. 49 Asset_Blob processName; 50 HapInfo hapInfo; 51 NativeInfo nativeInfo; 52 } ProcessInfo; 53 54 int32_t GetCallingProcessInfo(uint32_t userId, uint64_t uid, ProcessInfo *processInfo); 55 56 #ifdef __cplusplus 57 } 58 #endif 59 60 #endif