yumapro  20.10-13
YumaPro SDK
Core Agent Functions
Collaboration diagram for Core Agent Functions:

Functions

status_t agt_init1 (int argc, char *argv[], boolean *showver, help_mode_t *showhelpmode)
 Initialize the Server Library: stage 1: CLI and profile. More...
 
status_t agt_init1_ex (int argc, char *argv[], boolean factory_restart, boolean *showver, help_mode_t *showhelpmode)
 Initialize the Server Library: stage 1: CLI and profile Added factory_restart parameter. More...
 
status_t agt_init1_sil_sa (void)
 Initialize the Server Library: stage 1: CLI and profile. More...
 
status_t agt_init1_ypserver (int argc, char *argv[], boolean factory_restart, boolean *showver, help_mode_t *showhelpmode)
 Initialize the Server Library: stage 1: CLI and profile Added factory_restart parameter yp-controller is running. More...
 
status_t agt_init2 (void)
 Initialize the Server Library (phase 2 init) More...
 
status_t agt_init2_ex (boolean factory_restart)
 Initialize the Server Library (phase 2 init - extended) More...
 
status_t agt_init2_sil_sa (void)
 Initialize the Server Library for SIL-SA. More...
 
void agt_cleanup (void)
 Cleanup the Server Library. More...
 
void agt_cleanup_sil_sa (void)
 Cleanup the Server Library for SIL-SA usage. More...
 
agt_profile_t * agt_get_profile (void)
 Get the server profile struct. More...
 
void agt_request_shutdown (ncx_shutdowntyp_t mode, int intnum)
 Request some sort of server shutdown. More...
 
boolean agt_shutdown_requested (void)
 Check if some sort of server shutdown is in progress. More...
 
ncx_shutdowntyp_t agt_shutdown_mode_requested (void)
 Check what shutdown mode was requested. More...
 
int agt_shutdown_term_signal (void)
 Get the shutdown termination signal if any. More...
 
const xmlChar * agt_cbtype_name (agt_cbtyp_t cbtyp)
 Get the string for the server callback phase. More...
 
boolean agt_advertise_module_needed (const xmlChar *modname)
 Check if the module should be advertised or not. More...
 
void agt_request_replay (void)
 Request replay of the running config to SIL modules because SIL hardware has reset somehow. More...
 
void agt_request_replay_ex (void *cookie)
 Request replay of the running config to SIL modules because SIL hardware has reset somehow. More...
 
void * agt_get_replay_cookie (void)
 Get the current replay cookie. More...
 
void agt_request_replay_subsys (const xmlChar *subsys_id)
 Request replay of the running config to the SIL-SA modules on the specified subsystem. More...
 
boolean agt_replay_requested (void)
 Check if config replay is pending. More...
 
void agt_start_replay (void)
 Start replay of the running config to SIL modules. More...
 
void agt_finish_replay (void)
 Finish replay of the running config to SIL modules. More...
 
status_t agt_register_local_nv_handler (agt_nvload_fn_t load_fn, agt_nvsave_fn_t store_fn)
 Register a set of nvstore and nvload callback functions to handle the non-volatile storage of the configuration. More...
 
status_t agt_check_save_external_config (ncx_display_mode_t encoding, const xmlChar *filespec)
 Check if an external NV handler needs to be used to save the config. More...
 
status_t agt_add_allowed_user (const xmlChar *username)
 Add a backptr to the string in the val_value_t containing the username that is allowed. More...
 
void agt_remove_allowed_user (const xmlChar *username)
 Remove an allowed-user name from the running system Does not change any config file allowed-user parameter. More...
 
status_t agt_check_allowed_user (const xmlChar *username)
 Check a username in the allowed-user Q. More...
 
void agt_register_replay_callback (agt_replay_fn_t cbfn)
 Register a callback function for a replay config event. More...
 
const xmlChar * agt_get_server_id (void)
 Get the server-id string. More...
 
const xmlChar * agt_get_server_key (void)
 Get the ha-server-key string. More...
 
boolean agt_is_sil_sa (void)
 Check if server running in SIL-SA mode. More...
 
dlq_hdr_t * agt_get_savedevQ (void)
 Get the agt_savedevQ pointer. More...
 
boolean agt_replay_subsys_is_active (const xmlChar *subsys_id)
 Find a subsys replay request struct in the activeQ. More...
 
boolean agt_replay_main_is_active (void)
 Check if the replay in progress is for the main server or could be for a subsystem. More...
 
const xmlChar * agt_ha_role_str (agt_ha_role_t ha_role)
 Get the string for the specified HA role enumeration. More...
 
agt_ha_role_t agt_ha_role_enum (const xmlChar *ha_role)
 Get the enum for the specified HA role string. More...
 
boolean agt_use_notifications (void)
 Check if notifications currently enabled. More...
 
status_t agt_check_load_config (agt_ha_role_t ha_role)
 Check if the boot-time load-config should be done because it was deferred while waiting for the YP-HA role to be set. More...
 
boolean agt_init2_done (void)
 Check if the init2 phase is complete. More...
 
boolean agt_advertise_yang11_module_needed (ncx_module_t *mod)
 Check whether the NETCONF hello message should conform to the standard and leave out YANG 1.1 modules. More...
 
void agt_set_factory_restart (void)
 Set the flag so the server will restart with the factory config. More...
 
boolean agt_in_factory_restart (void)
 Check if a factory restort is in progress. More...
 
status_t agt_add_modcache (ncx_modcache_t *mc)
 Add a module to the modcache queue and hash table. More...
 
ncx_modcache_t * agt_find_modcache (const xmlChar *modname)
 Find a module to the modcache queue and hash table. More...
 
status_t agt_run_extloop (void)
 Run the agt_ncxserver in external loop mode. More...
 
status_t agt_enter_maintenance_mode (boolean read_ok, boolean operation_ok)
 Set the server to mainenance mode to block client activity. More...
 
status_t agt_exit_maintenance_mode (void)
 Exit the server from mainenance mode to unblock client activity. More...
 
boolean agt_in_maintenance_mode (void)
 Return true if in mainenance mode now. More...
 
boolean agt_maintenance_mode_read_ok (void)
 Return true if in maintenance mode reads OK;. More...
 
boolean agt_maintenance_mode_operation_ok (void)
 Return true if in maintenance mode operations OK;. More...
 
boolean agt_maintenance_mode_session_ok (void)
 Return true if in maintenance mode new sessions OK;. More...
 
void agt_set_eventlog_size (uint32 eventlog_size)
 Set the eventlog-size parameter. More...
 
void agt_set_max_burst (uint32 max_burst)
 Set the max-burst parameter. More...
 
void agt_set_max_getbulk (uint32 max_getbulk)
 Set the max-getbulk parameter. More...
 
agt_not_msg_t * agt_make_term_msg (const xmlChar *msg, status_t *res)
 Create a <term-msg> notification. More...
 
status_t agt_init_term_msg_module (void)
 Init the term-msg module and object backptr. More...
 
boolean agt_use_nmda (void)
 Check if NMDA is enabled. More...
 
boolean agt_waiting_datastore_ready (void)
 Check if client sessions are blocked until the datastore is ready. More...
 

Detailed Description

Contains Library entry points and handles init and cleanup. All server components are hard-wired intot he init and cleanup functions.

Function Documentation

◆ agt_add_allowed_user()

status_t agt_add_allowed_user ( const xmlChar *  username)

Add a backptr to the string in the val_value_t containing the username that is allowed.

Parameters
usernameuser to add to allowed-user list
Returns
status ERR_INTERNAL_MEM if malloc fails
Here is the call graph for this function:

◆ agt_add_modcache()

status_t agt_add_modcache ( ncx_modcache_t *  mc)

Add a module to the modcache queue and hash table.

Parameters
mcmodcache entry to add
Returns
status
Here is the call graph for this function:

◆ agt_advertise_module_needed()

boolean agt_advertise_module_needed ( const xmlChar *  modname)

Check if the module should be advertised or not.

There is a hard-wired list plus –hide-module parameter values that need to be hidden from clients

Parameters
modnamemodule name to check
Returns
TRUE if the module should be advertised to clients
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_advertise_yang11_module_needed()

boolean agt_advertise_yang11_module_needed ( ncx_module_t *  mod)

Check whether the NETCONF hello message should conform to the standard and leave out YANG 1.1 modules.

Parameters
modmodule to check
Returns
FALSE: leave out YANG 1.1 modules from <capability> used in <hello>. Also keep out of monitoring <capabilities> list
TRUE: ignore the standard and advertise YANG 1.1 module capabilities.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_cbtype_name()

const xmlChar* agt_cbtype_name ( agt_cbtyp_t  cbtyp)

Get the string for the server callback phase.

Parameters
cbtypcallback type enum
Returns
const string for this enum
Here is the caller graph for this function:

◆ agt_check_allowed_user()

status_t agt_check_allowed_user ( const xmlChar *  username)

Check a username in the allowed-user Q.

Parameters
usernameuser name string to check
Returns
OK if username is allowed or allowedQ is empty
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_check_load_config()

status_t agt_check_load_config ( agt_ha_role_t  ha_role)

Check if the boot-time load-config should be done because it was deferred while waiting for the YP-HA role to be set.

Parameters
ha_roleAGT_HA_ROLE_ACTIVE or AGT_HS_ROLE_STANDBY
Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_check_save_external_config()

status_t agt_check_save_external_config ( ncx_display_mode_t  encoding,
const xmlChar *  filespec 
)

Check if an external NV handler needs to be used to save the config.

Parameters
encodingencoding of the config file may be NCX_DISPLAY_MODE_NONE if filespec is NULL
filespecfilespec of config file to save to external NV-save may be NULL if external save does not need this file
Returns
status (NO_ERR if no external handler)
Here is the call graph for this function:

◆ agt_cleanup()

void agt_cleanup ( void  )

Cleanup the Server Library.

This function will call ncx_cleanup. Sets up server ready to restart.

◆ agt_cleanup_sil_sa()

void agt_cleanup_sil_sa ( void  )

Cleanup the Server Library for SIL-SA usage.

TBD – put platform-specific server cleanup here

◆ agt_enter_maintenance_mode()

status_t agt_enter_maintenance_mode ( boolean  read_ok,
boolean  operation_ok 
)

Set the server to mainenance mode to block client activity.

Parameters
read_okclient read sessions OK
operation_okclient non-datastore OPS session OK
Returns
status
Here is the call graph for this function:

◆ agt_exit_maintenance_mode()

status_t agt_exit_maintenance_mode ( void  )

Exit the server from mainenance mode to unblock client activity.

Returns
status
Here is the call graph for this function:

◆ agt_find_modcache()

ncx_modcache_t* agt_find_modcache ( const xmlChar *  modname)

Find a module to the modcache queue and hash table.

Parameters
modnamemodule name to find
Returns
module cache record if found
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_finish_replay()

void agt_finish_replay ( void  )

Finish replay of the running config to SIL modules.

Called from the server to end the replay procedure.

Here is the call graph for this function:

◆ agt_get_profile()

agt_profile_t* agt_get_profile ( void  )

Get the server profile struct.

Always returns an address. Do not need to check for NULL.

Returns
pointer to the server profile

◆ agt_get_replay_cookie()

void* agt_get_replay_cookie ( void  )

Get the current replay cookie.

Returns
cookie value

◆ agt_get_savedevQ()

dlq_hdr_t* agt_get_savedevQ ( void  )

Get the agt_savedevQ pointer.

Returns
save deviations Q
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_get_server_id()

const xmlChar* agt_get_server_id ( void  )

Get the server-id string.

Returns
pointer to the name string
Here is the caller graph for this function:

◆ agt_get_server_key()

const xmlChar* agt_get_server_key ( void  )

Get the ha-server-key string.

Returns
pointer to the server-key string

◆ agt_ha_role_enum()

agt_ha_role_t agt_ha_role_enum ( const xmlChar *  ha_role)

Get the enum for the specified HA role string.

Parameters
ha_roleHA role string
Returns
HA role enum
Here is the call graph for this function:

◆ agt_ha_role_str()

const xmlChar* agt_ha_role_str ( agt_ha_role_t  ha_role)

Get the string for the specified HA role enumeration.

Parameters
ha_roleHA role enum
Returns
HA role string

◆ agt_in_factory_restart()

boolean agt_in_factory_restart ( void  )

Check if a factory restort is in progress.

Set to TRUE when restart with factory config occurs Cleared (set to FALSE) when agt_init2 phase is complete

Returns
TRUE if factory restart is in progress
FALSE if factory restart is not in progress

◆ agt_in_maintenance_mode()

boolean agt_in_maintenance_mode ( void  )

Return true if in mainenance mode now.

Returns
T: in maintenance mode ; F: not in maintenance mode
Here is the caller graph for this function:

◆ agt_init1()

status_t agt_init1 ( int  argc,
char *  argv[],
boolean *  showver,
help_mode_t *  showhelpmode 
)

Initialize the Server Library: stage 1: CLI and profile.

TBD – put platform-specific server init here

Parameters
argccommand line argument count
argvarray of command line strings
showveraddress of version return quick-exit status
showhelpmodeaddress of help return quick-exit status
Return values
*showverTRUE if user requsted version quick-exit mode
*showhelpmodeTRUE if user requsted help quick-exit mode
Returns
status of the initialization procedure

◆ agt_init1_ex()

status_t agt_init1_ex ( int  argc,
char *  argv[],
boolean  factory_restart,
boolean *  showver,
help_mode_t *  showhelpmode 
)

Initialize the Server Library: stage 1: CLI and profile Added factory_restart parameter.

Parameters
argccommand line argument count
argvarray of command line strings
factory_restartTRUE if forced factory restart
showveraddress of version return quick-exit status
showhelpmodeaddress of help return quick-exit status
Return values
*showverTRUE if user requsted version quick-exit mode
*showhelpmodeTRUE if user requsted help quick-exit mode
Returns
status of the initialization procedure

◆ agt_init1_sil_sa()

status_t agt_init1_sil_sa ( void  )

Initialize the Server Library: stage 1: CLI and profile.

Used when SIL-SA module initializing the agt core

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

◆ agt_init1_ypserver()

status_t agt_init1_ypserver ( int  argc,
char *  argv[],
boolean  factory_restart,
boolean *  showver,
help_mode_t *  showhelpmode 
)

Initialize the Server Library: stage 1: CLI and profile Added factory_restart parameter yp-controller is running.

The server will be run in extloop mode

Parameters
argccommand line argument count
argvarray of command line strings
factory_restartTRUE if forced factory restart
showveraddress of version return quick-exit status
showhelpmodeaddress of help return quick-exit status
Return values
*showverTRUE if user requsted version quick-exit mode
*showhelpmodeTRUE if user requsted help quick-exit mode
Returns
status of the initialization procedure

◆ agt_init2()

status_t agt_init2 ( void  )

Initialize the Server Library (phase 2 init)

The agt_profile is set and the object database is ready to have YANG modules loaded

RPC and data node callbacks should be installed after the module is loaded, and before the running config is loaded.

Returns
status
Here is the call graph for this function:

◆ agt_init2_done()

boolean agt_init2_done ( void  )

Check if the init2 phase is complete.

Returns
TRUE if init2 done or in progress; FALSE if not
Here is the caller graph for this function:

◆ agt_init2_ex()

status_t agt_init2_ex ( boolean  factory_restart)

Initialize the Server Library (phase 2 init - extended)

The agt_profile is set and the object database is ready to have YANG modules loaded

RPC and data node callbacks should be installed after the module is loaded, and before the running config is loaded.

Parameters
factory_restartTRUE if restart with factory-config in progress
Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_init2_sil_sa()

status_t agt_init2_sil_sa ( void  )

Initialize the Server Library for SIL-SA.

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

◆ agt_init_term_msg_module()

status_t agt_init_term_msg_module ( void  )

Init the term-msg module and object backptr.

Returns
status
Here is the call graph for this function:

◆ agt_is_sil_sa()

boolean agt_is_sil_sa ( void  )

Check if server running in SIL-SA mode.

Returns
TRUE if running in SIL-SA mode; FALSE if SIL mode
Here is the caller graph for this function:

◆ agt_maintenance_mode_operation_ok()

boolean agt_maintenance_mode_operation_ok ( void  )

Return true if in maintenance mode operations OK;.

Not relevant unless agt_in_mantenance_mode() return trus

Returns
T: maintenance mode read OK ; F: maintenance mode read not OK

◆ agt_maintenance_mode_read_ok()

boolean agt_maintenance_mode_read_ok ( void  )

Return true if in maintenance mode reads OK;.

Not relevant unless agt_in_mantenance_mode() return trus

Returns
T: maintenance mode read OK ; F: maintenance mode read not OK

◆ agt_maintenance_mode_session_ok()

boolean agt_maintenance_mode_session_ok ( void  )

Return true if in maintenance mode new sessions OK;.

Returns
T: maintenance mode session OK ; F: maintenance mode session not OK

◆ agt_make_term_msg()

agt_not_msg_t* agt_make_term_msg ( const xmlChar *  msg,
status_t *  res 
)

Create a <term-msg> notification.

Parameters
msgstring to send as the data field
resaddress of return status
Return values
*resreturn status
Returns
malloced agt_not_msg_t struct if OK; NULL if some error
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_register_local_nv_handler()

status_t agt_register_local_nv_handler ( agt_nvload_fn_t  load_fn,
agt_nvsave_fn_t  store_fn 
)

Register a set of nvstore and nvload callback functions to handle the non-volatile storage of the configuration.

Parameters
load_fnNV-load callback function
store_fnNV-save callback function
Returns
status
Here is the call graph for this function:

◆ agt_register_replay_callback()

void agt_register_replay_callback ( agt_replay_fn_t  cbfn)

Register a callback function for a replay config event.

Parameters
cbfnreplay function to use (==NULL to clear)

◆ agt_remove_allowed_user()

void agt_remove_allowed_user ( const xmlChar *  username)

Remove an allowed-user name from the running system Does not change any config file allowed-user parameter.

Parameters
usernameuser name string to remove
Here is the call graph for this function:

◆ agt_replay_main_is_active()

boolean agt_replay_main_is_active ( void  )

Check if the replay in progress is for the main server or could be for a subsystem.

Returns
TRUE if active; FALSE if not

◆ agt_replay_requested()

boolean agt_replay_requested ( void  )

Check if config replay is pending.

Returns
TRUE if replay request is pending

◆ agt_replay_subsys_is_active()

boolean agt_replay_subsys_is_active ( const xmlChar *  subsys_id)

Find a subsys replay request struct in the activeQ.

Parameters
subsys_idsubsystem to check
Returns
TRUE if active; FALSE if not
Here is the call graph for this function:

◆ agt_request_replay()

void agt_request_replay ( void  )

Request replay of the running config to SIL modules because SIL hardware has reset somehow.

This is used by SIL code to force a complete replay attempt SIL-SA code will send a <trigger-replay> message to cause a subsystem replay.

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

◆ agt_request_replay_ex()

void agt_request_replay_ex ( void *  cookie)

Request replay of the running config to SIL modules because SIL hardware has reset somehow.

Use the function agt_get_replay_cookie() to retrieve the cookie from a SIL callback function

Parameters
cookiepointer to set as the replay_cookie.
Here is the caller graph for this function:

◆ agt_request_replay_subsys()

void agt_request_replay_subsys ( const xmlChar *  subsys_id)

Request replay of the running config to the SIL-SA modules on the specified subsystem.

Could be for subsystem reset or initial load-config

This is called when a <trigger-replay> event is received for a subsystem.

Parameters
subsys_idsubsystem ID requesting the replay
Here is the call graph for this function:

◆ agt_request_shutdown()

void agt_request_shutdown ( ncx_shutdowntyp_t  mode,
int  intnum 
)

Request some sort of server shutdown.

Parameters
moderequested shutdown mode
intnuminterrupt number if called from agt_signal_handler()
0 if not called from agt_ginal_handler()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_run_extloop()

status_t agt_run_extloop ( void  )

Run the agt_ncxserver in external loop mode.

Internal API for server IO

Here is the call graph for this function:

◆ agt_set_eventlog_size()

void agt_set_eventlog_size ( uint32  eventlog_size)

Set the eventlog-size parameter.

Parameters
eventlog_sizevalue to set
Here is the call graph for this function:

◆ agt_set_factory_restart()

void agt_set_factory_restart ( void  )

Set the flag so the server will restart with the factory config.

Internal API used during restart to support 'fallback' mode

Here is the call graph for this function:

◆ agt_set_max_burst()

void agt_set_max_burst ( uint32  max_burst)

Set the max-burst parameter.

Parameters
max_burstvalue to set
Here is the call graph for this function:

◆ agt_set_max_getbulk()

void agt_set_max_getbulk ( uint32  max_getbulk)

Set the max-getbulk parameter.

Parameters
max_getbulkvalue to set
Here is the call graph for this function:

◆ agt_shutdown_mode_requested()

ncx_shutdowntyp_t agt_shutdown_mode_requested ( void  )

Check what shutdown mode was requested.

Returns
shutdown mode

◆ agt_shutdown_requested()

boolean agt_shutdown_requested ( void  )

Check if some sort of server shutdown is in progress.

Returns
TRUE if shutdown mode has been started
Here is the caller graph for this function:

◆ agt_shutdown_term_signal()

int agt_shutdown_term_signal ( void  )

Get the shutdown termination signal if any.

Returns
shutdown signal interrupt number
0 if not shutdown by signal

◆ agt_start_replay()

void agt_start_replay ( void  )

Start replay of the running config to SIL modules.

Called from the server to begin the replay procedure.

Here is the call graph for this function:

◆ agt_use_nmda()

boolean agt_use_nmda ( void  )

Check if NMDA is enabled.

Returns
TRUE if enabled
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_use_notifications()

boolean agt_use_notifications ( void  )

Check if notifications currently enabled.

Returns
TRUE if OK to generate and queuew a notification
FALSE if notifications disabled via profile or YP-HA
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_waiting_datastore_ready()

boolean agt_waiting_datastore_ready ( void  )

Check if client sessions are blocked until the datastore is ready.

If so, check if the running datastore is no ready to use

Returns
TRUE if CLI parm set to true and need to wait; FALSE otherwise
Here is the call graph for this function: