Rate This Document
Findability
Accuracy
Completeness
Readability

setIntValue

Sets the int value of the configuration, and assigns the configuration (the node ID, the number of fractional bits, and number of enabled threads) to config through setIntValue, and then registers config with the KCAL instance.

int setIntValue ( 
    DG_Cfg config,
        const char *key,
        int value
)

Parameters

Table 1 Description

Parameter

Description

Value Range

Input/Output

config

Initialized configuration.

Key and value.

Output

key

A unique identifier for the value, used when setting the node ID.

Key values:

  • DG_CON_MPC_TEE_INT_NODEID, whose value is an integer starting from 0 and incrementing sequentially. For two-party computation, only nodes 0 and 1 are supported.
  • DG_CON_MPC_TEE_INT_FXP_BITS, whose value is an integer representing the number of fractional bits, with a range of [0, 32) and a recommended range of [8, 16].
  • DG_CON_MPC_TEE_INT_THREAD_COUNT, whose value represents the number of threads to enable. If the value is not obtained, the thread count is subject to the number of CPU cores. If set, the specified number of threads will be used, where the number is greater than 0. This is an optional configuration.

Input

value

Value in the int type.

The value is set based on the key.

Input

Return Values

  • Success: 0 is returned.
  • Failure: The error code is returned.

Error Codes

Table 2 Error code

Error Code

Value

Description

Remarks

DG_ERR_CONFIG_PARAM

62

Failed to verify the parameters.

config or key is null.

Dependency

#include "data_guard_config.h": the header file where the API declaration is stored.

Example

#include  "data_guard_config.h"
// opts is the result of the successful DG_InitConfigOpts call.
int nodeId = 0; //This is the node ID of compute node 0. For compute node 1, the value is set to 1.
int res = opts->setIntValue(teeCfg, DG_CON_MPC_TEE_INT_NODEID, nodeId);

Running result: res is 0.

  • Call the setIntValue API using the opts output of the successful DG_InitConfigOpts call.
  • Set the node ID of each node.