---
title: DG_InitConfigOpts
description: "初始化DataGuard配置类函数组。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengcctrustzone/tee/kcal/kunpeng_kcal_16_0010.html
sourcePath: /source/zh/kunpengcctrustzone/tee/kcal/kunpeng_kcal_16_0010.html
indexId: 99a5af098a08ef2200a3e5976db294e7c77c68c4c9e7c83c2bf093d55c14bcd964
---
# DG_InitConfigOpts

初始化DataGuard配置类函数组。

```
int DG_InitConfigOpts (
DG_BusinessType type,
DG_ConfigOpts **opts
）
```

#### 参数


**表1 参数说明**

| 参数名 | 描述 | 取值范围 | 输入/输出 |
| --- | --- | --- | --- |
| type | DataGuard组件类型DG\_BusinessType | 密态计算枚举为MPC | 输入 |
| opts | DataGuard配置函数集信息请参见表2。 | 一级指针不为空 | 输出 |


**表2 DG_ConfigOpts结构体**

| 名称 | 类型 | 说明 |
| --- | --- | --- |
| init | 函数指针 | int (\*init)(DG\_Cfg \*config); 初始化config对象 |
| release | 函数指针 | int (\*release)(DG\_Cfg \*config); 释放config对象 |
| setIntValue | 函数指针 | int (\*setIntValue)(DG\_Cfg config, const char\* key, int value); 以key和value的形式设置int参数值 |
| setVoidValue | 函数指针 | int (\*setVoidValue)(DG\_Cfg config, const char\* key, const DG\_Void\* value); 以key和value的形式设置Void参数值 |


#### 返回值

- 成功：返回0。
- 失败：返回错误码。


#### 错误码


**表3 错误码**

| 错误码 | 错误码值 | 描述 | 特殊说明 |
| --- | --- | --- | --- |
| DG\_ERR\_CONFIG\_PARAM | 62 | 入参校验失败 | \- |
| DG\_ERR\_CONFIG\_DG\_BUSINESS\_TYPE | 61 | type类型错误 | 密态计算枚举为MPC |


#### 依赖

#include "data_guard_config.h"：该接口声明所在的头文件。


#### 示例

```
#include "data_guard_config.h"
DG_ConfigOpts *opts = NULL;
int rv = DG_InitConfigOpts(DG_BusinessType::MPC, &opts);
if (rv != 0) {
return rv;
}
```
