aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/sc_plugins.h
diff options
context:
space:
mode:
authorjackiechen1985 <xiaobo.chen@tieto.com>2019-05-19 12:35:28 +0800
committerJunfeng Wang <drenfong.wang@intel.com>2019-05-22 04:37:38 +0000
commitce1a0daa15be4c3b7a3df64ea57ad231664e700f (patch)
treefdb1fac57156ebc6e12e8ce9cd7942a8f4023c03 /src/plugins/sc_plugins.h
parentaeb421c7219178ac464e8a2e62b35772a08a2c1c (diff)
Introduce a new registration mechanism to sweetcomb.
Sweetcomb plugins register for various [initialization] events by placing structures and __attribute__((constructor)) functions into the library. When sysrepo plugin is initializing, the framework walks constructor-generated singly-linked structure lists, calls the indicated functions. Change-Id: I0cb078391f2662e4f6dd08c1a383173f203adf2a Signed-off-by: jackiechen1985 <xiaobo.chen@tieto.com>
Diffstat (limited to 'src/plugins/sc_plugins.h')
-rw-r--r--src/plugins/sc_plugins.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/plugins/sc_plugins.h b/src/plugins/sc_plugins.h
index 4a784fb..681be6b 100644
--- a/src/plugins/sc_plugins.h
+++ b/src/plugins/sc_plugins.h
@@ -20,6 +20,23 @@
#include <sysrepo/values.h>
#include <sysrepo/plugins.h>
+#include "sc_init.h"
+#include "sys_util.h"
+
+typedef struct sc_plugin_main_t {
+ /* Session context acquired with ::sr_session_start call. */
+ sr_session_ctx_t *session;
+
+ /* Subscription context that is supposed to be released by ::sr_unsubscribe */
+ sr_subscription_ctx_t *subscription;
+
+ /* List of init/exit functions to call, setup by constructors */
+ _sc_init_function_list_elt_t *init_function_registrations;
+ _sc_exit_function_list_elt_t *exit_function_registrations;
+} sc_plugin_main_t;
+
+sc_plugin_main_t *sc_get_plugin_main();
+
//functions that sysrepo-plugin need
int sr_plugin_init_cb(sr_session_ctx_t *session, void **private_ctx);
void sr_plugin_cleanup_cb(sr_session_ctx_t *session, void *private_ctx);