1 /* 2 * Copyright (c) 2022-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 HKS_SESSION_MANAGER_H 17 #define HKS_SESSION_MANAGER_H 18 19 #include <stdbool.h> 20 #include <stdint.h> 21 22 #include "hks_double_list.h" 23 #include "hks_type_inner.h" 24 25 struct HksOperation { 26 struct DoubleList listHead; 27 struct HksProcessInfo processInfo; 28 uint64_t handle; 29 bool abortable; 30 uint64_t accessTokenId; 31 bool isInUse; 32 uint64_t batchOperationTimestamp; 33 bool isBatchOperation; 34 bool isUserIdPassedDuringInit; 35 int userIdPassedDuringInit; 36 }; 37 38 #ifdef __cplusplus 39 extern "C" { 40 #endif 41 42 int32_t CreateOperation(const struct HksProcessInfo *processInfo, const struct HksParamSet *paramSet, 43 const struct HksBlob *operationHandle, bool abortable); 44 45 struct HksOperation *QueryOperationAndMarkInUse(const struct HksProcessInfo *processInfo, 46 const struct HksBlob *operationHandle); 47 48 void MarkOperationUnUse(struct HksOperation *operation); 49 50 void DeleteOperation(const struct HksBlob *operationHandle); 51 52 void DeleteSessionByProcessInfo(const struct HksProcessInfo *processInfo); 53 54 #ifdef __cplusplus 55 } 56 #endif 57 58 #endif 59