Sets the value of a configuration variable.
int
tpm_varset(
ade_id var_id,
char *var_name,
struct resbuf *valres);
Returns RTNORM or an error code.
var_id | Configuration variables ID. |
var_name | Variable name. |
valres | Variable value contained in a resbuf. |
Configuration variables are composed of cleanup variables, cleanup action variables, and topology variables. The variables are initialized to their default values. For a list of these variables and their default values, see Configuration Variables.
Examples of building a resbuf for the valres argument.
rb = acutBuildList(RTSHORT, 4, 0); // integer value rb = acutBuildList(RTREAL, 1.0, 0); // real value rb = acutBuildList(RTSTR, "0", 0); // string value
You must release the resbuf.
The following sample allocates a set of configuration variables using tpm_varalloc(). A resbuf is created containing the layer name that will be associated with the LINK_LAYER configuration variable. Tpm_varset() is called with all required parameters and the return code is evaluated for the appropriate display message. The resbuf is then released as required.
ade_id varId = tpm_varalloc(); char* pszConfigVarName = "LINK_LAYER"; struct resbuf* pConfigVarsRb = acutBuildList(RTSTR, "Links", 0); int returnCode = tpm_varset(varId, pszConfigVarName, pConfigVarsRb); if (RTNORM == returnCode){ acutPrintf( "\nThe specified configuration variable has been set."); } else { acutPrintf( "\nThe specified configuration variable was not set."); } acutRelRb(pConfigVarsRb);