1 /* 2 * Copyright (c) 2021 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_PARAM_H 17 #define HKS_PARAM_H 18 19 #include "hks_type.h" 20 21 #define HKS_PARAM_SET_MAX_SIZE (4 * 1024 * 1024) 22 #define HKS_DEFAULT_PARAM_SET_SIZE 512 23 #define HKS_DEFAULT_PARAM_CNT ((uint32_t)(HKS_DEFAULT_PARAM_SET_SIZE / sizeof(struct HksParam))) 24 #define HKS_TAG_TYPE_MASK (0xF << 28) 25 26 #ifdef __cplusplus 27 extern "C" { 28 #endif 29 30 HKS_API_EXPORT int32_t HksInitParamSet(struct HksParamSet **paramSet); 31 32 HKS_API_EXPORT int32_t HksAddParams(struct HksParamSet *paramSet, 33 const struct HksParam *params, uint32_t paramCnt); 34 35 HKS_API_EXPORT int32_t HksBuildParamSet(struct HksParamSet **paramSet); 36 37 HKS_API_EXPORT void HksFreeParamSet(struct HksParamSet **paramSet); 38 39 HKS_API_EXPORT int32_t HksGetParamSet(const struct HksParamSet *fromParamSet, uint32_t fromParamSetSize, 40 struct HksParamSet **paramSet); 41 42 HKS_API_EXPORT int32_t HksGetParam(const struct HksParamSet *paramSet, uint32_t tag, struct HksParam **param); 43 44 HKS_API_EXPORT int32_t HksFreshParamSet(struct HksParamSet *paramSet, bool isCopy); 45 46 int32_t HksCheckParamSetTag(const struct HksParamSet *paramSet); 47 48 int32_t HksCheckParamSet(const struct HksParamSet *paramSet, uint32_t size); 49 50 int32_t HksCheckParamMatch(const struct HksParam *baseParam, const struct HksParam *param); 51 52 #ifdef __cplusplus 53 } 54 #endif 55 56 #endif /* HKS_PARAM_H */ 57