yumapro  24.10-3
YumaPro SDK
Loading...
Searching...
No Matches
NETCONF Configuration Datastores

Configuration segments are stored in sequential order. More...

Collaboration diagram for NETCONF Configuration Datastores:

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_tcfg_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_tcfg_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_tcfg_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_tcfg_find_partial_lock (cfg_template_t *cfg, plock_id_t lockid)
 Find a partial lock in the specified config. More...
 
plock_cb_tcfg_first_partial_lock (cfg_template_t *cfg)
 Get the first partial lock in the specified config. More...
 
plock_cb_tcfg_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_tcfg_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_tcfg_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...
 

Detailed Description

Configuration segments are stored in sequential order.

NEW YANG OBJECT MODEL

    Configuration database (running, candidate, startup, etc.)
      +
      |
      +-- (root: /)
           +
           |
           +--- object X  (netconf, security, routing, etc.)
           |         |
           |         +---- object A , B, C
           |
           +--- object Y
           |         |
           |         +---- object D , E
           V


   MODULE USAGE
   ============

   1) call cfg_ypinit()

   2) call cfg_init_static_db for the various hard-wired databases
      that need to be created by the agent

   3) call cfg_apply_load_root() with the startup database contents
      to load into the running config

   4) call cfg_set_target() [NCX_CFGID_CANDIDATE or NCX_CFGID_RUNNING]

   4a) call cfg_fill_candidate_from_running if the target is candidate;
       after agt.c/load_running_config is called

   5) call cfg_set_state() to setup config db access, when ready
      for NETCONF operations

   6) Use cfg_ok_to_* functions to test config access

   7) use cfg_lock and cfg_unlock as desired to set global write locks

   8) use cfg_release_locks when a session terminates

   9) call cfg_cleanup() when program is terminating

Enumeration Type Documentation

◆ cfg_state_t

current configuration state

Enumerator
CFG_ST_NONE 

not set

CFG_ST_INIT 

init in progress

CFG_ST_READY 

ready and no locks

CFG_ST_PLOCK 

partial lock active

CFG_ST_FLOCK 

full lock active

CFG_ST_CLEANUP 

cleanup in progress

Function Documentation

◆ cfg_add_partial_lock()

status_t cfg_add_partial_lock ( cfg_template_t cfg,
plock_cb_t plcb 
)

Add a partial lock the specified config.

This will not really have an effect unless the CFG_FL_TARGET flag in the specified config is also set For global lock only

Parameters
cfgConfig template to lock
plcbpartial lock control block, already filled out, to add to this configuration
Returns
status; if NO_ERR then the memory in plcb is handed off and will be released when cfg_remove_partial_lock is called for 'plcb'
Here is the call graph for this function:

◆ cfg_apply_load_root()

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.

Parameters
cfgconfig target
newrootnew config tree
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cfg_candidate_is_wrlocked()

boolean cfg_candidate_is_wrlocked ( void  )

Check if the candidate datastore is currently pthreads write-locked.

Returns
TRUE if write locked; FALSE if not
Here is the caller graph for this function:

◆ cfg_clean_roots()

void cfg_clean_roots ( void  )

Cleanup the cfg->root nodes before all the objects are freed.

Here is the call graph for this function:

◆ cfg_cleanup()

void cfg_cleanup ( void  )

Cleanup the config manager.

Here is the caller graph for this function:

◆ cfg_clear_candidate_dirty_flag()

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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cfg_clear_dirty_flag()

void cfg_clear_dirty_flag ( cfg_template_t cfg)

Clear the cfg dirty flag upon request.

Parameters
cfgpointer to valid config template
See also
cfg_set_dirty_flag
Here is the caller graph for this function:

◆ cfg_clear_running_dirty_flag()

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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cfg_delete_partial_lock()

void cfg_delete_partial_lock ( cfg_template_t cfg,
plock_id_t  lockid 
)

Remove a partial lock from the specified config.

Parameters
cfgConfig template to use
lockidlock-id for the plcb to remove
Here is the call graph for this function:

◆ cfg_fill_candidate_from_inline()

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.

Called internally only, do not use!

Parameters
sesidcurrent session ID
newrootnew root for the candidate config
Returns
status
Here is the call graph for this function:

◆ cfg_fill_candidate_from_running()

status_t cfg_fill_candidate_from_running ( ses_id_t  sesid)

Fill the <candidate> config with the config contents of the <running> config.

Parameters
sesidsession ID setting the config
Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cfg_fill_candidate_from_startup()

status_t cfg_fill_candidate_from_startup ( ses_id_t  sesid)

Fill the <candidate> config with the config contents of the <startup> config.

Called internally only, do not use!

Parameters
sesidsession ID setting the config
Returns
status
Here is the call graph for this function:

◆ cfg_find_partial_lock()

plock_cb_t * cfg_find_partial_lock ( cfg_template_t cfg,
plock_id_t  lockid 
)

Find a partial lock in the specified config.

Parameters
cfgConfig template to use
lockidlock-id for the plcb to find
Returns
pointer to the partial lock control block found NULL if not found
Here is the call graph for this function:

◆ cfg_first_partial_lock()

plock_cb_t * cfg_first_partial_lock ( cfg_template_t cfg)

Get the first partial lock in the specified config.

Parameters
cfgConfig template to use
Returns
pointer to the first partial lock control block; NULL if none exist at this time
Here is the caller graph for this function:

◆ cfg_free_template()

void cfg_free_template ( cfg_template_t cfg)

Clean and free the cfg_template_t struct.

Parameters
cfgcfg_template_t to clean and free
See also
cfg_new_template
Here is the caller graph for this function:

◆ cfg_get_config()

cfg_template_t * cfg_get_config ( const xmlChar *  cfgname)

Get the config struct from its name.

Parameters
cfgnameConfig Name
Returns
pointer to config struct or NULL if not found
Here is the caller graph for this function:

◆ cfg_get_config_id()

cfg_template_t * cfg_get_config_id ( ncx_cfg_t  cfgid)

Get the config struct from its ID.

Parameters
cfgidconfig ID
Returns
pointer to config struct or NULL if not found
Here is the caller graph for this function:

◆ cfg_get_config_name()

const xmlChar * cfg_get_config_name ( ncx_cfg_t  cfgid)

Get the config name from its ID.

Parameters
cfgidconfig ID
Returns
pointer to config name or NULL if not found
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cfg_get_dirty_flag()

boolean cfg_get_dirty_flag ( const cfg_template_t cfg)

Get the config dirty flag value.

Parameters
cfgconfiguration template to check
Returns
TRUE if the config is flagged as dirty
Here is the caller graph for this function:

◆ cfg_get_global_lock_info()

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.

Parameters
cfgConfig template to check
[out]sesidaddress of return session ID pointer
  • *sesid session ID of lock holder
[out]locktimeaddress of return lock time
  • *locktime pointer to lock time string
Returns
status, NCX_ERR_SKIPPED if not locked

◆ cfg_get_last_ch_time()

const xmlChar * cfg_get_last_ch_time ( cfg_template_t cfg)

Get the last-modified timestamp.

Parameters
cfgconfig target
Returns
pointer to timestamp to use or NULL to get cvurrent time

◆ cfg_get_last_txid()

ncx_transaction_id_t cfg_get_last_txid ( cfg_template_t cfg)

Get the last good transaction ID.

Parameters
cfgconfig target
Returns
last transaction ID to use

◆ cfg_get_lock_itime()

time_t cfg_get_lock_itime ( ncx_cfg_t  cfg_id)

Get the lock_itime field.

Parameters
cfg_idcfg ID
Returns
lock_itime value or 0 if none

◆ cfg_get_lock_list()

void cfg_get_lock_list ( ses_id_t  sesid,
val_value_t retval 
)

Get a list of all the locks held by a session.

Parameters
sesidsession ID to check for any locks
[out]retvalpointer to malloced and initialized NCX_BT_SLIST
  • *retval is filled in with any lock entryies or left empty if none found
Here is the call graph for this function:

◆ cfg_get_root()

val_value_t * cfg_get_root ( ncx_cfg_t  cfgid)

Get the config root for the specified config.

Parameters
cfgidconfig ID to get root from
Returns
config root or NULL if none or error
Here is the caller graph for this function:

◆ cfg_get_startup_filespec()

const xmlChar * cfg_get_startup_filespec ( void  )

Get the filespec string for the XML file to save the running database.

Returns
filespec for startup-cfg.xml or NULL if none

◆ cfg_get_state()

cfg_state_t cfg_get_state ( ncx_cfg_t  cfg_id)

Get the state of the specified static config.

Parameters
cfg_idConfig ID
Returns
config state (CFG_ST_NONE if some error)

◆ cfg_init_static_db()

status_t cfg_init_static_db ( ncx_cfg_t  cfg_id)

Initialize the specified static configuration slot.

Parameters
cfg_idcfg ID to intialize
Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cfg_is_global_locked()

boolean cfg_is_global_locked ( const cfg_template_t cfg)

Check if the specified config has ab active global lock.

Parameters
cfgConfig template to check
Returns
TRUE if global lock active, FALSE if not

◆ cfg_is_partial_locked()

boolean cfg_is_partial_locked ( const cfg_template_t cfg)

Check if the specified config has any active partial locks.

Parameters
cfgConfig template to check
Returns
TRUE if partial lock active, FALSE if not

◆ cfg_lock()

status_t cfg_lock ( cfg_template_t cfg,
ses_id_t  locked_by,
cfg_source_t  lock_src 
)

Lock the specified config.

This will not really have an effect unless the CFG_FL_TARGET flag in the specified config is also set

Parameters
cfgConfig template to lock
locked_bysession ID of the lock owner
lock_srcenum classifying the lock source
Returns
status
See also
cfg_unlock
Here is the call graph for this function:

◆ cfg_lock2()

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)

This will not really have an effect unless the CFG_FL_TARGET flag in the specified config is also set

Parameters
cfgConfig template to lock
locked_bysession ID of the lock owner
lock_srcenum classifying the lock source
lockallTRUE if from "<lock-all>"; FALSE otherwise
Returns
status
See also
cfg_unlock
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cfg_lock_hold_timeout()

status_t cfg_lock_hold_timeout ( ncx_cfg_t  cfg_id)

Force a cfg lock to be undone due to max-lock-hold-time.

Parameters
cfg_idConfig ID to force global lock released
Returns
status

◆ cfg_new_fake_candidate()

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.

Parameters
namecfg name
cfg_idcfg ID
Returns
malloced struct or NULL if some error This struct needs to be freed by the caller
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cfg_new_template()

cfg_template_t * cfg_new_template ( const xmlChar *  name,
ncx_cfg_t  cfg_id 
)

Malloc and initialize a cfg_template_t struct.

Parameters
namecfg name
cfg_idcfg ID
Returns
malloced struct or NULL if some error. This struct needs to be freed by the caller
See also
cfg_free_template
Here is the call graph for this function:

◆ cfg_next_partial_lock()

plock_cb_t * cfg_next_partial_lock ( plock_cb_t curplockcb)

Get the next partial lock in the specified config.

Parameters
curplockcbcurrent lock control block; get next CB
Returns
pointer to the next partial lock control block; NULL if none exist at this time

◆ cfg_ok_to_lock()

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.

Parameters
cfgConfig template to check
Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cfg_ok_to_partial_lock()

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.

Parameters
cfgConfig template to check
Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cfg_ok_to_read()

status_t cfg_ok_to_read ( const cfg_template_t cfg)

Check if the specified config can be read right now.

Parameters
cfgConfig template to check
Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cfg_ok_to_unlock()

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.

Parameters
cfgConfig template to check
sesidsession ID requesting to unlock the config
Returns
status
Here is the call graph for this function:

◆ cfg_ok_to_unlock2()

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.

Support for lock-all added

Parameters
cfgConfig template to check
sesidsession ID requesting to unlock the config
lockallTRUE if from "<unlock-all>"; FALSE otherwise
Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cfg_ok_to_write()

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.

This is not an access control check, only locks and config state will be checked

Parameters
cfgConfig template to check
sesidsession ID requesting to write to the config
Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cfg_register_reload_candidate_cb()

void cfg_register_reload_candidate_cb ( cfg_reload_candidate_cb_t  cbfn)

Register a callback function to be called anytime the.

cfg_fill_candidate_from_ FOO function is called This is an internal server callback – not a SIL callback

Parameters
cbfncallback function to register

◆ cfg_release_locks()

void cfg_release_locks ( ses_id_t  sesid)

Release any configuration locks held by the specified session.

Parameters
sesidsession ID to check for
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cfg_release_partial_locks()

void cfg_release_partial_locks ( ses_id_t  sesid)

Release any configuration locks held by the specified session.

Parameters
sesidsession ID to check for
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cfg_running_is_wrlocked()

boolean cfg_running_is_wrlocked ( void  )

Check if the running datastore is currently pthreads write-locked.

Returns
TRUE if write locked; FALSE if not
Here is the caller graph for this function:

◆ cfg_rwlock_acquire_lock_pair()

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.

Parameters
tcbthread control block for session (caller)
cfg1config ptr 1
wrlock1TRUE => write lock ELSE read lock
cfg2config ptr 2
wrlock2TRUE => write lock ELSE read lock
Returns
res status_t indicating if any error was encountered (NO_ERR = success)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cfg_rwlock_acquire_locks()

status_t cfg_rwlock_acquire_locks ( thd_tcb_t tcb)

Acquire multiple locks in order to help prevent deadlock.

Parameters
tcbthread control block for session (caller)
Returns
res status_t indicating if an error was encountered (NO_ERR = success)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cfg_rwlock_acquire_single_lock()

status_t cfg_rwlock_acquire_single_lock ( thd_tcb_t tcb,
cfg_template_t cfg,
boolean  wrlock 
)

Acquire a single RWLOCK.

NOTE: Call once only. Do NOT use this to acquire multiple locks.

Parameters
tcbthread control block for session (caller)
cfgdata store
wrlockTRUE == write access requested
Returns
res status_t indicating if an error was encountered (NO_ERR = success)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cfg_rwlock_acquire_single_rdlock()

status_t cfg_rwlock_acquire_single_rdlock ( thd_tcb_t tcb,
cfg_template_t cfg 
)

Acquire a single RWLOCK for read access.

NOTE: Call once only per RPC. Do NOT use this to acquire multiple locks.

Parameters
tcbthread control block for session (caller)
cfgdata store
Returns
res status_t indicating if an error was encountered (NO_ERR = success)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cfg_rwlock_acquire_single_wrlock()

status_t cfg_rwlock_acquire_single_wrlock ( thd_tcb_t tcb,
cfg_template_t cfg 
)

Acquire a single RWLOCK for write access.

NOTE: Call once only per RPC. Do NOT use this to acquire multiple locks.

Parameters
tcbthread control block for session (caller)
cfgdata store
Returns
status_t indicating if an error was encountered (NO_ERR = success)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cfg_rwlock_init_req_locks()

status_t cfg_rwlock_init_req_locks ( thd_tcb_t tcb)

Initialize TCB multiple lock structure.

WARNING: Will attempt to unlock (and generate error message) but should NOT be called for this purpose.

Parameters
tcbthread control block for session (caller)
Returns
status
Here is the caller graph for this function:

◆ cfg_rwlock_rdlock()

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.

Parameters
tcbthread control block for session (caller)
cfgdatastore descriptor (e.g., running, candidate, or startup)
Returns
res status_t indicating if an error was encountered (NO_ERR = success)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cfg_rwlock_release_all_locks()

status_t cfg_rwlock_release_all_locks ( thd_tcb_t tcb)

Release all RWLOCKs recorded in TCB lock state structure.

Parameters
tcbthread control block for session (caller)
Returns
res status_t indicating if any error was encountered (NO_ERR == success)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cfg_rwlock_unlock()

status_t cfg_rwlock_unlock ( thd_tcb_t tcb,
cfg_template_t cfg 
)

Release a lock associated with a cfg (datastore) RWLOCK structure.

May be called recursively.

Parameters
tcbthread control block for session (caller)
cfgdatastore descriptor (e.g., running, candidate, or startup)
Returns
res == status_t indicating if an error was encountered (NO_ERR = success)
Here is the caller graph for this function:

◆ cfg_rwlock_wrlock()

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.

May be called recursively.

Parameters
tcbthread control block for session (caller)
cfgdatastore descriptor (e.g., running, candidate, or startup)
Returns
res status_t indicating if an error was encountered (NO_ERR = success)
Here is the caller graph for this function:

◆ cfg_set_defer_load()

void cfg_set_defer_load ( boolean  val)

Set the config defer load flag to the config.

Parameters
valTRUE if this config is in defer load mode; FALSE if not
Here is the caller graph for this function:

◆ cfg_set_dirty_flag()

void cfg_set_dirty_flag ( cfg_template_t cfg)

Mark the config as 'changed'.

Parameters
cfgconfiguration template to set
See also
cfg_clear_dirty_flag

◆ cfg_set_state()

void cfg_set_state ( ncx_cfg_t  cfg_id,
cfg_state_t  new_state 
)

Change the state of the specified static config.

Parameters
cfg_idConfig ID to change
new_statenew config state to set

◆ cfg_set_target()

void cfg_set_target ( ncx_cfg_t  cfg_id)

Set the CFG_FL_TARGET flag in the specified config.

Parameters
cfg_idConfig ID to set as a valid target

◆ cfg_setup_running()

status_t cfg_setup_running ( void  )

Setup the running config root if load_running_config did not add anything.

Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cfg_sprintf_etag()

status_t cfg_sprintf_etag ( cfg_template_t cfg,
xmlChar *  buff,
int32  buffsize 
)

Write the Entity Tag for the datastore to the specified buffer.

Parameters
cfgcfg_templatet data structure to use
[out]buffbuffer to use
  • buff filled in if big enough
buffsizebuffer size to use
Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cfg_sprintf_etag_id()

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.

Parameters
idcfg id to use
[out]buffbuffer to use
  • buff filled in if big enough
buffsizebuffer size to use
Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cfg_unlock()

status_t cfg_unlock ( cfg_template_t cfg,
ses_id_t  locked_by 
)

Unlock the specified config.

Parameters
cfgConfig template to unlock
locked_bysession ID of the lock owner
Returns
status
See also
cfg_lock

◆ cfg_unlock2()

status_t cfg_unlock2 ( cfg_template_t cfg,
ses_id_t  locked_by,
boolean  lockall 
)

Unlock the specified config (2nd rev)

Parameters
cfgConfig template to unlock
locked_bysession ID of the lock owner
lockallTRUE if called from <unlock-all>; FALSE otherwise
Returns
status
See also
cfg_lock2

◆ cfg_unlock_ex()

status_t cfg_unlock_ex ( cfg_template_t cfg,
ses_id_t  locked_by,
boolean  skip_reload 
)

Unlock the specified config.

Do not always force a remove changes. This is needed for the <unload> operation which locks the datastores while deleting data nodes and schema nodes for the module being unloaded

Parameters
cfgConfig template to unlock
locked_bysession ID of the lock owner
skip_reloadTRUE to skip cfg reload test
Returns
status

◆ cfg_update_last_ch_time()

void cfg_update_last_ch_time ( cfg_template_t cfg,
time_t *  timestamp 
)

Update the last-modified timestamp.

Parameters
cfgconfig target
timestamptimestamp to use or NULL to get cvurrent time
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cfg_update_last_txid()

void cfg_update_last_txid ( cfg_template_t cfg,
ncx_transaction_id_t  txid 
)

Update the last good transaction ID.

Parameters
cfgconfig target
txidtrnasaction ID to use
Here is the call graph for this function:

◆ cfg_update_stamps()

void cfg_update_stamps ( cfg_template_t source,
cfg_template_t dest 
)

Update the last-modified and last-txid stamps.

Parameters
sourcesource config
destdestoination config
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cfg_ypinit()

void cfg_ypinit ( void  )

Initialize the config manager.

YPW-1360: netconfd: naming issue in ncx module (cfg.c cfg_init() API) changed function name cfg_init to cfg_ypinit.

Here is the caller graph for this function: