From 927d6f2d9c8955c22b3a51aed03e41313c6d9fc8 Mon Sep 17 00:00:00 2001 From: Olof hagsand Date: Mon, 14 Mar 2022 12:14:55 +0100 Subject: [PATCH] * Documentation: plugin start function doc --- doc/startup.md | 3 +++ example/main/clixon-example@2020-12-01.yang | 2 +- example/main/example_backend.c | 21 ++++++++++++--------- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/doc/startup.md b/doc/startup.md index 82f10c6e..4985f960 100644 --- a/doc/startup.md +++ b/doc/startup.md @@ -449,8 +449,11 @@ candidate +---------------------> CANDIDATE ``` ### Invalid XML + +``` repair restart tmp/startup --------+---------+-----------------------> +``` ## Thanks Thanks matt smith and dave cornejo for input diff --git a/example/main/clixon-example@2020-12-01.yang b/example/main/clixon-example@2020-12-01.yang index f2baf3ae..c107c366 100644 --- a/example/main/clixon-example@2020-12-01.yang +++ b/example/main/clixon-example@2020-12-01.yang @@ -24,7 +24,7 @@ module clixon-example { Note, may change without updating revision, just for testing current master. "; revision 2020-12-01 { - description "Added table/paramater/value as the primary data example"; + description "Added table/parameter/value as the primary data example"; } revision 2020-03-11 { description "Added container around translation list. Released in Clixon 4.4.0"; diff --git a/example/main/example_backend.c b/example/main/example_backend.c index 527f3092..d4c234f4 100644 --- a/example/main/example_backend.c +++ b/example/main/example_backend.c @@ -1087,12 +1087,14 @@ upgrade_interfaces(clicon_handle h, } /*! Plugin state reset. Add xml or set state in backend machine. - * Called in each backend plugin. plugin_reset is called after all plugins - * have been initialized. This give the application a chance to reset - * system state back to a base state. - * This is generally done when a system boots up to - * make sure the initial system state is well defined. This can be creating - * default configuration files for various daemons, set interface flags etc. + * + * Add xml or set state in backend system. + * plugin_reset in each backend plugin after all plugins have been initialized. + * This gives the application a chance to reset system state back to a base state. + * This is generally done when a system boots up to make sure the initial system state + * is well defined. + * This involves creating default configuration files for various daemons, set interface + * flags etc. * @param[in] h Clicon handle * @param[in] db Name of database. Not may be other than "running" * In this example, a loopback interface is added @@ -1142,10 +1144,11 @@ example_reset(clicon_handle h, } /*! Plugin start. - * @param[in] h Clicon handle * - * plugin_start is called once everything has been initialized, right before - * the main event loop is entered. + * Called when application is "started", (almost) all initialization is complete + * Backend: daemon is in the background. If daemon privileges are dropped + * this callback is called *before* privileges are dropped. + * @param[in] h Clicon handle */ int example_start(clicon_handle h)