1 /* 2 * Copyright (C) 2025-2025 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 DIA_CONFIG_C_H 17 #define DIA_CONFIG_C_H 18 #include "dia_config_info.h" 19 20 #ifdef __cplusplus 21 extern "C" { 22 #endif 23 24 typedef struct DIA_String { 25 char *data; 26 unsigned dataLength; 27 } DIA_String; 28 29 typedef struct DIA_Rule { 30 char *ruleName; // 需使用上面定义的规则名称 31 bool isOpenKeywords; // 是否开启关键词 32 } DIA_Rule; 33 34 __attribute__((visibility("default"))) int DIA_InitConfig(void **config); // 创建Config对象 35 __attribute__((visibility("default"))) void DIA_ReleaseConfig(void** config); // 释放Config对象 36 // 设置int类型参数 37 __attribute__((visibility("default"))) int DIA_SetInt(void* config, const DIA_String* key, int value); 38 // 设置double类型参数 39 __attribute__((visibility("default"))) int DIA_SetDouble(void* config, const DIA_String* key, double value); 40 // 设置字符串类型参数 41 __attribute__((visibility("default"))) int DIA_SetString(void *config, const DIA_String *key, const DIA_String *value); 42 // 设置dia_rule类型参数 43 __attribute__((visibility("default"))) int DIA_SetRule(void *config, const DIA_String *key, const DIA_Rule *value); 44 45 #ifdef __cplusplus 46 } 47 #endif 48 #endif // DIA_CONFIG_C_H