yumapro
24.10-2
YumaPro SDK
|
@ brief NCX configuration database manager More...
#include <xmlstring.h>
#include "dlq.h"
#include "ncx.h"
#include "ncxconst.h"
#include "plock.h"
#include "ses.h"
#include "status.h"
#include "val.h"
#include "val_util.h"
#include "thd.h"
Go to the source code of this file.
Data Structures | |
struct | cfg_template_t |
struct representing 1 configuration database More... | |
Typedefs | |
typedef void(* | cfg_reload_candidate_cb_t) (void) |
support for server callback anytime the candidate config is reloaded from the running config <discard-changes> | |
Enumerations | |
enum | cfg_state_t { CFG_ST_NONE , CFG_ST_INIT , CFG_ST_READY , CFG_ST_PLOCK , CFG_ST_FLOCK , CFG_ST_CLEANUP } |
current configuration state More... | |
enum | cfg_source_t |
classify the config source | |
enum | cfg_location_t |
classify the config location | |
Functions | |
void | cfg_ypinit (void) |
Initialize the config manager. More... | |
void | cfg_clean_roots (void) |
Cleanup the cfg->root nodes before all the objects are freed. More... | |
void | cfg_cleanup (void) |
Cleanup the config manager. More... | |
status_t | cfg_rwlock_rdlock (thd_tcb_t *tcb, cfg_template_t *cfg) |
Take out the read lock associated with a cfg (datastore) RWLOCK structure May be called recursively. More... | |
status_t | cfg_rwlock_wrlock (thd_tcb_t *tcb, cfg_template_t *cfg) |
Take out a write lock associated with a cfg (datastore) RWLOCK structure. More... | |
status_t | cfg_rwlock_unlock (thd_tcb_t *tcb, cfg_template_t *cfg) |
Release a lock associated with a cfg (datastore) RWLOCK structure. More... | |
status_t | cfg_rwlock_init_req_locks (thd_tcb_t *tcb) |
Initialize TCB multiple lock structure. More... | |
status_t | cfg_rwlock_release_all_locks (thd_tcb_t *tcb) |
Release all RWLOCKs recorded in TCB lock state structure. More... | |
status_t | cfg_rwlock_acquire_locks (thd_tcb_t *tcb) |
Acquire multiple locks in order to help prevent deadlock. More... | |
status_t | cfg_rwlock_acquire_lock_pair (thd_tcb_t *tcb, cfg_template_t *cfg1, boolean wrlock1, cfg_template_t *cfg2, boolean wrlock2) |
Acquire multiple (2) locks in predetermined, repeatable in order to help prevent deadlock. More... | |
status_t | cfg_rwlock_acquire_single_lock (thd_tcb_t *tcb, cfg_template_t *cfg, boolean wrlock) |
Acquire a single RWLOCK. More... | |
status_t | cfg_rwlock_acquire_single_rdlock (thd_tcb_t *tcb, cfg_template_t *cfg) |
Acquire a single RWLOCK for read access. More... | |
status_t | cfg_rwlock_acquire_single_wrlock (thd_tcb_t *tcb, cfg_template_t *cfg) |
Acquire a single RWLOCK for write access. More... | |
status_t | cfg_init_static_db (ncx_cfg_t cfg_id) |
Initialize the specified static configuration slot. More... | |
cfg_template_t * | cfg_new_template (const xmlChar *name, ncx_cfg_t cfg_id) |
Malloc and initialize a cfg_template_t struct. More... | |
void | cfg_free_template (cfg_template_t *cfg) |
Clean and free the cfg_template_t struct. More... | |
void | cfg_set_state (ncx_cfg_t cfg_id, cfg_state_t new_state) |
Change the state of the specified static config. More... | |
cfg_state_t | cfg_get_state (ncx_cfg_t cfg_id) |
Get the state of the specified static config. More... | |
cfg_template_t * | cfg_get_config (const xmlChar *cfgname) |
Get the config struct from its name. More... | |
const xmlChar * | cfg_get_config_name (ncx_cfg_t cfgid) |
Get the config name from its ID. More... | |
cfg_template_t * | cfg_get_config_id (ncx_cfg_t cfgid) |
Get the config struct from its ID. More... | |
void | cfg_set_target (ncx_cfg_t cfg_id) |
Set the CFG_FL_TARGET flag in the specified config. More... | |
status_t | cfg_fill_candidate_from_running (ses_id_t sesid) |
Fill the <candidate> config with the config contents of the <running> config. More... | |
status_t | cfg_fill_candidate_from_startup (ses_id_t sesid) |
Fill the <candidate> config with the config contents of the <startup> config. More... | |
status_t | cfg_fill_candidate_from_inline (ses_id_t sesid, val_value_t *newroot) |
Fill the <candidate> config with the config contents of the <config> inline XML node. More... | |
void | cfg_set_dirty_flag (cfg_template_t *cfg) |
Mark the config as 'changed'. More... | |
void | cfg_clear_dirty_flag (cfg_template_t *cfg) |
Clear the cfg dirty flag upon request. More... | |
void | cfg_clear_running_dirty_flag (void) |
Clear the running dirty flag when it is saved to NV-storage or loaded into running from startup. More... | |
void | cfg_clear_candidate_dirty_flag (void) |
Clear the candidate dirty flag when it is saved to NV-storage or loaded into running from startup. More... | |
boolean | cfg_get_dirty_flag (const cfg_template_t *cfg) |
Get the config dirty flag value. More... | |
status_t | cfg_ok_to_lock (const cfg_template_t *cfg) |
Check if the specified config can be locked right now for global lock only. More... | |
status_t | cfg_ok_to_unlock (const cfg_template_t *cfg, ses_id_t sesid) |
Check if the specified config can be unlocked right now by the specified session ID; for global lock only. More... | |
status_t | cfg_ok_to_unlock2 (const cfg_template_t *cfg, ses_id_t sesid, boolean lockall) |
Check if the specified config can be unlocked right now by the specified session ID; for global lock only. More... | |
status_t | cfg_ok_to_read (const cfg_template_t *cfg) |
Check if the specified config can be read right now. More... | |
status_t | cfg_ok_to_write (const cfg_template_t *cfg, ses_id_t sesid) |
Check if the specified config can be written right now by the specified session ID. More... | |
boolean | cfg_is_global_locked (const cfg_template_t *cfg) |
Check if the specified config has ab active global lock. More... | |
boolean | cfg_is_partial_locked (const cfg_template_t *cfg) |
Check if the specified config has any active partial locks. More... | |
status_t | cfg_get_global_lock_info (const cfg_template_t *cfg, ses_id_t *sesid, const xmlChar **locktime) |
Get the current global lock info. More... | |
status_t | cfg_lock (cfg_template_t *cfg, ses_id_t locked_by, cfg_source_t lock_src) |
Lock the specified config. More... | |
status_t | cfg_lock2 (cfg_template_t *cfg, ses_id_t locked_by, cfg_source_t lock_src, boolean lockall) |
Lock the specified config (with lockall) More... | |
status_t | cfg_unlock (cfg_template_t *cfg, ses_id_t locked_by) |
Unlock the specified config. More... | |
status_t | cfg_unlock2 (cfg_template_t *cfg, ses_id_t locked_by, boolean lockall) |
Unlock the specified config (2nd rev) More... | |
status_t | cfg_unlock_ex (cfg_template_t *cfg, ses_id_t locked_by, boolean skip_reload) |
Unlock the specified config. More... | |
void | cfg_release_locks (ses_id_t sesid) |
Release any configuration locks held by the specified session. More... | |
void | cfg_release_partial_locks (ses_id_t sesid) |
Release any configuration locks held by the specified session. More... | |
void | cfg_get_lock_list (ses_id_t sesid, val_value_t *retval) |
Get a list of all the locks held by a session. More... | |
void | cfg_apply_load_root (cfg_template_t *cfg, val_value_t *newroot) |
Apply the AGT_CB_APPLY function for the OP_EDITOP_LOAD operation. More... | |
void | cfg_update_last_ch_time (cfg_template_t *cfg, time_t *timestamp) |
Update the last-modified timestamp. More... | |
void | cfg_update_last_txid (cfg_template_t *cfg, ncx_transaction_id_t txid) |
Update the last good transaction ID. More... | |
void | cfg_update_stamps (cfg_template_t *source, cfg_template_t *dest) |
Update the last-modified and last-txid stamps. More... | |
const xmlChar * | cfg_get_last_ch_time (cfg_template_t *cfg) |
Get the last-modified timestamp. More... | |
ncx_transaction_id_t | cfg_get_last_txid (cfg_template_t *cfg) |
Get the last good transaction ID. More... | |
status_t | cfg_sprintf_etag (cfg_template_t *cfg, xmlChar *buff, int32 buffsize) |
Write the Entity Tag for the datastore to the specified buffer. More... | |
status_t | cfg_sprintf_etag_id (ncx_transaction_id_t id, xmlChar *buff, int32 buffsize) |
Write the Entity Tag for the datastore to the specified buffer Use the last_id instead of the cfg template. More... | |
status_t | cfg_add_partial_lock (cfg_template_t *cfg, plock_cb_t *plcb) |
Add a partial lock the specified config. More... | |
plock_cb_t * | cfg_find_partial_lock (cfg_template_t *cfg, plock_id_t lockid) |
Find a partial lock in the specified config. More... | |
plock_cb_t * | cfg_first_partial_lock (cfg_template_t *cfg) |
Get the first partial lock in the specified config. More... | |
plock_cb_t * | cfg_next_partial_lock (plock_cb_t *curplockcb) |
Get the next partial lock in the specified config. More... | |
void | cfg_delete_partial_lock (cfg_template_t *cfg, plock_id_t lockid) |
Remove a partial lock from the specified config. More... | |
status_t | cfg_ok_to_partial_lock (const cfg_template_t *cfg) |
Check if the specified config can be locked right now for partial lock only. More... | |
val_value_t * | cfg_get_root (ncx_cfg_t cfgid) |
Get the config root for the specified config. More... | |
status_t | cfg_setup_running (void) |
Setup the running config root if load_running_config did not add anything. More... | |
void | cfg_register_reload_candidate_cb (cfg_reload_candidate_cb_t cbfn) |
Register a callback function to be called anytime the. More... | |
const xmlChar * | cfg_get_startup_filespec (void) |
Get the filespec string for the XML file to save the running database. More... | |
boolean | cfg_running_is_wrlocked (void) |
Check if the running datastore is currently pthreads write-locked. More... | |
boolean | cfg_candidate_is_wrlocked (void) |
Check if the candidate datastore is currently pthreads write-locked. More... | |
cfg_template_t * | cfg_new_fake_candidate (const xmlChar *name, ncx_cfg_t cfg_id) |
Malloc and initialize a new fake Candidate cfg_template_t struct. More... | |
void | cfg_set_defer_load (boolean val) |
Set the config defer load flag to the config. More... | |
time_t | cfg_get_lock_itime (ncx_cfg_t cfg_id) |
Get the lock_itime field. More... | |
status_t | cfg_lock_hold_timeout (ncx_cfg_t cfg_id) |
Force a cfg lock to be undone due to max-lock-hold-time. More... | |
@ brief NCX configuration database manager