The Candidate Reload callback is an internal system callback that is used to clear some cached validation data when the running configuration is loaded into to candidate datastore.
The following function template definition is used for Candidate Reload callback functions:
/* Typedef of the callback */ typedef void (*cfg_reload_candidate_cb_t) (void);
There can be one callback registered to be invoked each time the candidate datastore is reloaded from the running datastore, such as the <discard-changes> operation. Or anytime the candidate is filled in from <startup>, <running>, or in line.
If the server is run with active :writable-running capability the callback will not be available since the candidate configuration datastore is not available when the capability is active.
The cfg_register_reload_candidate_cb function is used to declare the callback. The registration is done during the Initialization Phase 2 after the running configuration has been loaded from the startup file.
extern void cfg_register_reload_candidate_cb (cfg_reload_candidate_cb_t cbfn);
Initialization function with the Candidate Reload callback registration may look as follows:
/******************************************************************** * FUNCTION do_init2 * * Call the Post Running Config Set Initialization Functions * *********************************************************************/ static status_t do_init2 (boolean startup_loaded) { ... /* initialize the reload_candidate callback function */ cfg_register_reload_candidate_cb(agt_val_clean_cached_results); ... }