--- /dev/null
+# include "sysrepo_conf.h"
+
+int sysrepo_repo_config()
+{
+ /*
+ This function will probably be called on knot-resolver
+ installation or by `kres-watcher` when something
+ wents wrong with sysrepo.
+
+ Configures sysrepo:
+ 1. install/import YANG modules
+ 2. enable features
+ 3. import json data to startup datastore
+ 4. clean up any stale connections of clients that no longer exist
+ */
+ return 0;
+}
\ No newline at end of file
--- /dev/null
+# pragma once
+
+#include <string.h>
+#include <sysrepo.h>
+#include <libyang/libyang.h>
+
+/* sysrepo globals */
+#define YM_DIR ""
+#define YM_COMMON "cznic-resolver-common"
+#define YM_KRES "cznic-resolver-knot"
+#define XPATH_BASE "/" YM_COMMON ":dns-resolver"
+
+/* Function to configure sysrepo repository */
+int sysrepo_repo_config();
\ No newline at end of file
# C module: sysrepo
sysrepo_src = files([
+ 'sysrepo.c',
])
+c_src_lint += sysrepo_src
-if enable_sysrepo
+sysrepo_common_src = files([
+ 'common/sysrepo_conf.c',
+ 'common/sysrepo_conf.h',
+])
+c_src_lint += sysrepo_common_src
+if enable_sysrepo
+ sysrepo_mod = shared_module(
+ 'sysrepo',
+ sysrepo_src,
+ sysrepo_common_src,
+ dependencies: [
+ luajit_inc,
+ libyang,
+ libsysrepo,
+ ],
+ include_directories: mod_inc_dir,
+ name_prefix: '',
+ install: true,
+ install_dir: modules_dir,
+ )
endif
\ No newline at end of file
--- /dev/null
+#include <stdio.h>
+#include <stdlib.h>
+#include <uv.h>
+#include <lua.h>
+#include <sysrepo.h>
+
+#include "lib/module.h"
+
+KR_EXPORT
+int nsid_init(struct kr_module *module) {
+
+ return kr_ok();
+}
+
+KR_EXPORT
+int nsid_deinit(struct kr_module *module) {
+
+ return kr_ok();
+}
+
+KR_MODULE_EXPORT(sysrepo)