Configuration tree access operations

Overview

// global functions

te_errno cfg_add_instance(const cfg_oid* oid, cfg_handle* handle, cfg_val_type type, ...);
te_errno cfg_add_instance_str(const char* oid, cfg_handle* p_handle, cfg_val_type type, ...);
te_errno cfg_add_instance_fmt(cfg_handle* p_handle, cfg_val_type type, const void* val, const char* oid_fmt, ...);
te_errno cfg_add_instance_local(const cfg_oid* oid, cfg_handle* handle, cfg_val_type type, ...);
te_errno cfg_add_instance_local_str(const char* oid, cfg_handle* p_handle, cfg_val_type type, ...);
te_errno cfg_add_instance_local_fmt(cfg_handle* p_handle, cfg_val_type type, const void* val, const char* oid_fmt, ...);
te_errno cfg_add_instance_child_fmt(cfg_handle* p_handle, cfg_val_type type, const void* val, cfg_handle parent, const char* suboid_fmt, ...);
te_errno cfg_del_instance(cfg_handle handle, te_bool with_children);
te_errno cfg_del_instance_fmt(te_bool with_children, const char* oid_fmt, ...);
te_errno cfg_del_instance_local(cfg_handle handle, te_bool with_children);
te_errno cfg_del_instance_local_fmt(te_bool with_children, const char* oid_fmt, ...);
te_errno cfg_set_instance(cfg_handle handle, cfg_val_type type, ...);
te_errno cfg_set_instance_fmt(cfg_val_type type, const void* val, const char* oid_fmt, ...);
te_errno cfg_set_instance_str(cfg_val_type type, const void* val, const char* oid);
te_errno cfg_set_instance_local(cfg_handle handle, cfg_val_type type, ...);
te_errno cfg_set_instance_local_fmt(cfg_val_type type, const void* val, const char* oid_fmt, ...);
te_errno cfg_commit(const char* oid);
te_errno cfg_commit_fmt(const char* oid_fmt, ...);
te_errno cfg_get_instance(cfg_handle handle, cfg_val_type* type, ...);
te_errno cfg_get_instance_fmt(cfg_val_type* p_type, void* val, const char* oid_fmt, ...);
te_errno cfg_get_int(int* val, const char* oid_fmt, ...);
te_errno cfg_get_bool(te_bool* val, const char* oid_fmt, ...);
te_errno cfg_get_int8(int8_t* val, const char* oid_fmt, ...);
te_errno cfg_get_uint8(uint8_t* val, const char* oid_fmt, ...);
te_errno cfg_get_int16(int16_t* val, const char* oid_fmt, ...);
te_errno cfg_get_uint16(uint16_t* val, const char* oid_fmt, ...);
te_errno cfg_get_uint32(uint32_t* val, const char* oid_fmt, ...);
te_errno cfg_get_int32(int32_t* val, const char* oid_fmt, ...);
te_errno cfg_get_int64(int64_t* val, const char* oid_fmt, ...);
te_errno cfg_get_uint64(uint64_t* val, const char* oid_fmt, ...);
te_errno cfg_get_string(char** val, const char* oid_fmt, ...);
te_errno cfg_get_addr(struct sockaddr** val, const char* oid_fmt, ...);
te_errno cfg_get_instance_str(cfg_val_type* p_type, void* val, const char* oid);
te_errno cfg_get_instance_sync(cfg_handle handle, cfg_val_type* type, ...);
te_errno cfg_get_instance_sync_fmt(cfg_val_type* type, void* val, const char* oid_fmt, ...);
te_errno cfg_get_int_sync(int* val, const char* oid_fmt, ...);
te_errno cfg_get_bool_sync(te_bool* val, const char* oid_fmt, ...);
te_errno cfg_get_int8_sync(int8_t* val, const char* oid_fmt, ...);
te_errno cfg_get_uint8_sync(uint8_t* val, const char* oid_fmt, ...);
te_errno cfg_get_int16_sync(int16_t* val, const char* oid_fmt, ...);
te_errno cfg_get_uint16_sync(uint16_t* val, const char* oid_fmt, ...);
te_errno cfg_get_int32_sync(int32_t* val, const char* oid_fmt, ...);
te_errno cfg_get_uint32_sync(uint32_t* val, const char* oid_fmt, ...);
te_errno cfg_get_int64_sync(int64_t* val, const char* oid_fmt, ...);
te_errno cfg_get_uint64_sync(uint64_t* val, const char* oid_fmt, ...);
te_errno cfg_get_string_sync(char** val, const char* oid_fmt, ...);
te_errno cfg_get_addr_sync(struct sockaddr** val, const char* oid_fmt, ...);

Detailed Documentation

Global Functions

te_errno cfg_add_instance(const cfg_oid* oid, cfg_handle* handle, cfg_val_type type, ...)

Create an object instance.

Parameters:

oid

object identifier of the new instance

handle

location for handle of the new instance

type

value type (necessary for fast processing)

value to be assigned to the new instance or NULL; for integer values: int for strings: char * for addresses: struct sockaddr *

Returns:

Status code (see te_errno.h)

te_errno cfg_add_instance_str(const char* oid, cfg_handle* p_handle, cfg_val_type type, ...)

Create an object instance.

Parameters:

oid

object identifier of the new instance (string representation)

p_handle

location for handle of the new instance (OUT)

type

value type (necessary for fast processing)

value to be assigned to the new instance or NULL; for integer values: int for strings: char * for addresses: struct sockaddr *

Returns:

Status code (see te_errno.h)

te_errno cfg_add_instance_fmt(cfg_handle* p_handle, cfg_val_type type, const void* val, const char* oid_fmt, ...)

The same function as cfg_add_instance_str, but OID may be format string.

Use macro CFG_VAL() to make the second and the third arguments pair. E.g. rc = cfg_add_instance_fmt(NULL, CFG_VAL(INT32, 1), “/hello:tom”);

te_errno cfg_add_instance_local(const cfg_oid* oid, cfg_handle* handle, cfg_val_type type, ...)

Create an object instance locally. Commit should be called to propagate this creation as a bulk to the Test Agent later.

Parameters:

oid

object identifier of the new instance

handle

location for handle of the new instance

type

value type (necessary for fast processing)

value to be assigned to the new instance or NULL; for integer values: int for strings: char * for addresses: struct sockaddr *

Returns:

Status code (see te_errno.h)

te_errno cfg_add_instance_local_str(const char* oid, cfg_handle* p_handle, cfg_val_type type, ...)

The same function as cfg_add_instance_local, but OID is in string format.

Parameters:

oid

object identifier of the new instance (string representation)

p_handle

location for handle of the new instance (OUT)

type

value type (necessary for fast processing)

value to be assigned to the new instance or NULL; for integer values: int for strings: char * for addresses: struct sockaddr *

Returns:

Status code (see te_errno.h)

te_errno cfg_add_instance_local_fmt(cfg_handle* p_handle, cfg_val_type type, const void* val, const char* oid_fmt, ...)

The same function as cfg_add_instance_local_str, but OID may be format string.

Use macro CFG_VAL() to make the second and the third arguments pair. E.g. rc = cfg_add_instance_local_fmt(NULL, CFG_VAL(INT32, 1), “/hello:tom”);

te_errno cfg_add_instance_child_fmt(cfg_handle* p_handle, cfg_val_type type, const void* val, cfg_handle parent, const char* suboid_fmt, ...)

Add instance with the first part of OID specified by handle and the second part specified by format string and its parameters.

Parameters:

p_handle

Location for handle of new instance

type

Type of value

val

Value

parent

Handle of the parent

suboid_fmt

Sub-identifier format string

Format string arguments

Returns:

Status code

te_errno cfg_del_instance(cfg_handle handle, te_bool with_children)

Delete an object instance.

Parameters:

handle

object instance handle

with_children

delete the children subtree, if necessary

Returns:

Status code (see te_errno.h)

te_errno cfg_del_instance_fmt(te_bool with_children, const char* oid_fmt, ...)

Set instance by the OID. OID may be format string

te_errno cfg_del_instance_local(cfg_handle handle, te_bool with_children)

Delete an object instance locally. Commit should be called to propagate this change together with other not committed local changes to TA.

Parameters:

handle

Object instance handle.

with_children

Delete the children subtree, if necessary.

Returns:

Status code (see te_errno.h).

te_errno cfg_del_instance_local_fmt(te_bool with_children, const char* oid_fmt, ...)

Same as cfg_del_instance_local(), but accepts OID string.

Parameters:

with_children

Delete the children subtree, if necessary.

oid_fmt

Format string for OID.

Format string arguments.

Returns:

Status code (see te_errno.h).

te_errno cfg_set_instance(cfg_handle handle, cfg_val_type type, ...)

Change object instance value.

Parameters:

handle

object instance handle

type

value type (necessary for fast processing)

new value to be assigned to the instance or NULL; for integer values: int for strings: char * for addresses: struct sockaddr *

Returns:

Status code (see te_errno.h)

te_errno cfg_set_instance_fmt(cfg_val_type type, const void* val, const char* oid_fmt, ...)

Set instance by the OID. OID may be format string.

Use macro CFG_VAL() to make the first and the second arguments pair. E.g. rc = cfg_set_instance_fmt(CFG_VAL(INT32, 1), “/hello:”);

te_errno cfg_set_instance_str(cfg_val_type type, const void* val, const char* oid)

Set instance by the OID string.

Use macro CFG_VAL() to make the first and the second arguments pair. E.g. rc = cfg_set_instance_str(CFG_VAL(INT32, 1), “/hello:”);

Parameters:

type

value type (necessary for fast processing)

val

value to set

oid

OID string

Returns:

Status code.

te_errno cfg_set_instance_local(cfg_handle handle, cfg_val_type type, ...)

Change object instance value locally. Commit should be called to propagate changed as a bulk to the Test Agent later.

Parameters:

handle

object instance handle

type

value type (necessary for fast processing)

new value to be assigned to the instance or NULL; for integer values: int for strings: char * for addresses: struct sockaddr *

Returns:

Status code (see te_errno.h)

te_errno cfg_set_instance_local_fmt(cfg_val_type type, const void* val, const char* oid_fmt, ...)

Set instance by the OID. OID may be format string

te_errno cfg_commit(const char* oid)

Commit Configurator database changes to the Test Agent.

Parameters:

oid

subtree object identifier or NULL if whole database should be synchronized

Returns:

Status code (see te_errno.h)

te_errno cfg_commit_fmt(const char* oid_fmt, ...)

The same function as cfg_commit, but OID may be format string

te_errno cfg_get_instance(cfg_handle handle, cfg_val_type* type, ...)

Obtain value of the object instance. Memory for strings and addresses is allocated by the routine using malloc().

Parameters:

handle

object instance handle

type

location for value type, may be NULL

OUT: location for the value for integer values: int * for strings: char ** for addresses: struct sockaddr **

Returns:

Status code (see te_errno.h)

te_errno cfg_get_instance_fmt(cfg_val_type* p_type, void* val, const char* oid_fmt, ...)

Get instance by the OID. OID may be format string

te_errno cfg_get_int(int* val, const char* oid_fmt, ...)

Type-safe version of cfg_get_instance_fmt() for values of int type.

In reality it looks for int32 values and converts it to int. It is only for backward compatibility.

te_errno cfg_get_bool(te_bool* val, const char* oid_fmt, ...)

Type-safe version of cfg_get_instance_fmt() for values of te_bool type

te_errno cfg_get_int8(int8_t* val, const char* oid_fmt, ...)

Type-safe version of cfg_get_instance_fmt() for values of int8_t type

te_errno cfg_get_uint8(uint8_t* val, const char* oid_fmt, ...)

Type-safe version of cfg_get_instance_fmt() for values of uint8_t type

te_errno cfg_get_int16(int16_t* val, const char* oid_fmt, ...)

Type-safe version of cfg_get_instance_fmt() for values of int16_t type

te_errno cfg_get_uint16(uint16_t* val, const char* oid_fmt, ...)

Type-safe version of cfg_get_instance_fmt() for values of uint16_t type

te_errno cfg_get_uint32(uint32_t* val, const char* oid_fmt, ...)

Type-safe version of cfg_get_instance_fmt() for values of uint32_t type

te_errno cfg_get_int32(int32_t* val, const char* oid_fmt, ...)

Type-safe version of cfg_get_instance_fmt() for values of int32_t type

te_errno cfg_get_int64(int64_t* val, const char* oid_fmt, ...)

Type-safe version of cfg_get_instance_fmt() for values of int64_t type

te_errno cfg_get_uint64(uint64_t* val, const char* oid_fmt, ...)

Type-safe version of cfg_get_instance_fmt() for values of uint64_t type

te_errno cfg_get_string(char** val, const char* oid_fmt, ...)

Type-safe version of cfg_get_instance_fmt() for string values

te_errno cfg_get_addr(struct sockaddr** val, const char* oid_fmt, ...)

Type-safe version of cfg_get_instance_fmt() for values of struct sockaddr type

te_errno cfg_get_instance_str(cfg_val_type* p_type, void* val, const char* oid)

Get instance by the OID string.

Parameters:

p_type

location for value type, may be NULL

val

location for value

oid

OID string

Returns:

Status code.

te_errno cfg_get_instance_sync(cfg_handle handle, cfg_val_type* type, ...)

Obtain value of the object instance with synchronization with the managed object. Memory for strings and addresses is allocated by the routine using malloc().

Parameters:

handle

object instance handle

type

location for the value type

OUT: location for the value for integer values: int * for strings: char ** for addresses: struct sockaddr **

Returns:

Status code (see te_errno.h)

te_errno cfg_get_instance_sync_fmt(cfg_val_type* type, void* val, const char* oid_fmt, ...)

Get instance by the OID. OID may be format string

te_errno cfg_get_int_sync(int* val, const char* oid_fmt, ...)

Type-safe version of cfg_get_instance_sync_fmt() for values of int type.

In reality it looks for int32 values and converts it to int. It is only for backward compatibility.

te_errno cfg_get_bool_sync(te_bool* val, const char* oid_fmt, ...)

Type-safe version of cfg_get_instance_sync_fmt() for values of te_bool type

te_errno cfg_get_int8_sync(int8_t* val, const char* oid_fmt, ...)

Type-safe version of cfg_get_instance_sync_fmt() for values of int8_t type

te_errno cfg_get_uint8_sync(uint8_t* val, const char* oid_fmt, ...)

Type-safe version of cfg_get_instance_sync_fmt() for values of uint8_t type

te_errno cfg_get_int16_sync(int16_t* val, const char* oid_fmt, ...)

Type-safe version of cfg_get_instance_sync_fmt() for values of int16_t type

te_errno cfg_get_uint16_sync(uint16_t* val, const char* oid_fmt, ...)

Type-safe version of cfg_get_instance_sync_fmt() for values of uint16_t type

te_errno cfg_get_int32_sync(int32_t* val, const char* oid_fmt, ...)

Type-safe version of cfg_get_instance_sync_fmt() for values of int32_t type

te_errno cfg_get_uint32_sync(uint32_t* val, const char* oid_fmt, ...)

Type-safe version of cfg_get_instance_sync_fmt() for values of uint32_t type

te_errno cfg_get_int64_sync(int64_t* val, const char* oid_fmt, ...)

Type-safe version of cfg_get_instance_sync_fmt() for values of int64_t type

te_errno cfg_get_uint64_sync(uint64_t* val, const char* oid_fmt, ...)

Type-safe version of cfg_get_instance_sync_fmt() for values of uint64_t type

te_errno cfg_get_string_sync(char** val, const char* oid_fmt, ...)

Type-safe version of cfg_get_instance_sync_fmt() for string values

te_errno cfg_get_addr_sync(struct sockaddr** val, const char* oid_fmt, ...)

Type-safe version of cfg_get_instance_sync_fmt() for values of struct sockaddr type