API: Configurator

Overview

Copyright (C) 2004-2022 OKTET Labs Ltd. More…

// typedefs

typedef uint64_t cfg_handle;

// global functions

te_errno cfg_wait_changes(void);
te_errno cfg_touch_instance(const char* oid_tmpl, ...);
te_errno cfg_tree_print(const char* filename, const unsigned int log_lvl, const char* id_fmt, ...);
void cfg_api_cleanup(void);
te_errno cfg_copy_subtree_fmt(const char* dst_oid, const char* src_oid_fmt, ...);

// macros

#define CFG_HANDLE_INVALID
#define CFG_IVP(x)
#define CFG_VAL(_t, _v)
#define CFG_WAIT_CHANGES
#define cfg_get_instance_addr_fmt
#define cfg_get_instance_addr_sync_fmt
#define cfg_get_instance_int_fmt
#define cfg_get_instance_int_sync_fmt
#define cfg_get_instance_string_fmt
#define cfg_get_instance_string_sync_fmt
#define cfg_get_instance_uint64_fmt
#define cfg_get_instance_uint64_sync_fmt

Detailed Documentation

Copyright (C) 2004-2022 OKTET Labs Ltd. All rights reserved.

Typedefs

typedef uint64_t cfg_handle

Object and object instances handle.

Object handle is an index in array of all objects.

Object instance handle consists of two parts: two most significant bytes contain unique number of the instance and two other bytes contain index in the array of all existing object instances.

Global Functions

te_errno cfg_wait_changes(void)

Wait for Configuration changes propagation.

Required delays are configured using /conf_delay subtree. Time to sleep is calculated as the maximum of required delays for configuration changes done after the previous wait (regardless how long time ago the changes are done).

Returns:

Status code (see te_errno.h)

te_errno cfg_touch_instance(const char* oid_tmpl, ...)

Notify the Configurator that instances matching OID template are touched by non-CS means (necessary for subsequent correct cfg_wait_changes() processing).

Parameters:

oid_tmpl

instance identifier format string (may contain ‘*’ symbols)

Returns:

Status code (see te_errno.h)

te_errno cfg_tree_print(const char* filename, const unsigned int log_lvl, const char* id_fmt, ...)

Starting from a given prefix, print a tree of objects or instances into a file and(or) log.

Parameters:

filename

output filename (NULL to skip)

log_lvl

TE log level (0 to skip)

id_fmt

a format string for the id of the root from which we print.

Returns:

Status code.

void cfg_api_cleanup(void)

Clean up resources allocated by Configurator API.

Usually user should not worry about calling of the function, since it is called automatically using atexit() mechanism.

te_errno cfg_copy_subtree_fmt(const char* dst_oid, const char* src_oid_fmt, ...)

Copy a subtree pointed to by its OID format string to a destination pointed to by OID of the tree to be created.

Parameters:

dst_oid

Destination tree OID

src_oid_fmt

Format string of the source tree OID

Returns:

Status code.

Macros

#define CFG_HANDLE_INVALID

Invalid Configurator object handle

#define CFG_IVP(x)

Cast to Configurator Instance Value Pointer

#define CFG_VAL(_t, _v)

Macro definition to be used in cfg_{add,set}_instance_fmp() calls. Here it is assumed that ‘intptr_t’ type has the same size as ‘void *’.

#define CFG_WAIT_CHANGES

Macro to call cfg_wait_changes() from the test without check of return value.

#define cfg_get_instance_int_fmt

The macro definitions are wrappers for backward compatibility.