Post Set Hook callback - is a postponed Set Hook callback analogous function that is invoked within the transaction when an object is modified but AFTER EDIT callback is done for the same object. When the netconfd-pro server has been configured to provide a candidate configuration, Post Set Hook code will be invoked when changes are done to the <candidate> configuration if the --target=candidate parameter is used.  If --target=running then the Post Set Hook will be invoked at the start of the transaction on the <running> datastore. This callback will be invoked AFTEREDIT1 callback for the same object.  

This callback will not be invoked in case the --sil-root-check-first is set to TRUE when the server is run with --target=running. The server will ignore the callback and just skip its invocation.

Post Set Hook can be invoked during the Load; However, it  is not allowed to add new edits. So, callbacks are treated as Transaction Hook style callbacks and can perform only validation tasks  and cannot edit datastore. Any sil_sa_add_edit() API during Load will be ignored, it is not an error just skip the call and go back with NO_ERR status.

The following function template definition is used for Post Set Hook callback functions:

/* Typedef of the agt_cb_sa_hook_t callback */
typedef status_t
    (*agt_cb_sa_hook_t) (ses_cb_t *scb,
                         rpc_msg_t *msg,
                         op_editop_t editop,
                         val_value_t *newval,
                         val_value_t *curval,
                         const xmlChar *transaction_id,
                         boolean isvalidate,
                         boolean isload,
                         boolean isrunning);

scbsession control block making the request
msgincoming rpc_msg_t in progress
editopedit operation enumeration for the node being edited
newvalvalue holding the proposed changes to apply to the current config, depending on the editop value.

current values from the <running> or <candidate> configuration, if any. Could be NULL for create and other operations.

transaction ID of the transaction control block in progress

TRUE if this Transaction is for <validate> operation


TRUE if this Transaction is for a Load operation


TRUE if this Transaction is for the the running datastore

Post Set Hook callback function is hooked into the server with the agt_cb_sa_post_sethook_register function, described below. The registration is done during the Initialization Phase 1before the startup configuration is loaded into the running configuration database and before running configurations are loaded.

extern status_t
    agt_cb_sa_post_sethook_register (const xmlChar *defpath,
                                     agt_cb_sa_hook_t cbfn)

defpathAbsolute path expression string indicating which node the callback function is for.
cbfnaddress of SIL-SA callback function to use

The following example code illustrates how Post Set Hook callbacks can be  cleaned up. The callbacks cleanup is getting done during Cleanup Phase.

extern void
    agt_cb_sa_post_sethook_unregister (const xmlChar *defpath);

It is possible to register different callbacks for the same object, for instance, there can be Set Hook and Transaction Hook callbacks registered for the same object, as well as there can be EDIT or GET2 callbacks for the same object. However, in order to cleanup callbacks, unregister them, you need to run different cleanup functions. The EDIT and GET2 callbacks have their own unregister functions and hook-based callbacks have their own unregister function.


For examples, refer to Set Hook callback article How do I use Set Hook callbacks? and How do I use SIL-SA version of the Set Hook callback?