summaryrefslogtreecommitdiffstats
path: root/lib/yang.h
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2018-11-19 19:18:37 +0100
committerDavid Lamparter <equinox@opensourcerouting.org>2018-11-19 23:45:24 +0100
commit3a11599cdc2a617dd31202911de5ce3b999c9948 (patch)
tree8b49ef98e0ea8af7c1cd92693d5d2af531815762 /lib/yang.h
parentMerge pull request #3341 from donaldsharp/unneeded (diff)
downloadfrr-3a11599cdc2a617dd31202911de5ce3b999c9948.tar.xz
frr-3a11599cdc2a617dd31202911de5ce3b999c9948.zip
yang: embed models into binaries
This bakes our YANG models straight into the library/daemons, so they don't need to be loaded from /usr/share/yang. This makes the installation quite a bit more robust, as well as gets us halfway to running uninstalled. (The other half is baking in the extension type module.) The /usr/share/yang directory is still searched as a fallback, as well as for the experimental YANG model translator. This is likely to stay as is for the time being. Signed-off-by: David Lamparter <equinox@diac24.net>
Diffstat (limited to 'lib/yang.h')
-rw-r--r--lib/yang.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/yang.h b/lib/yang.h
index cd5597ff8..b0348e320 100644
--- a/lib/yang.h
+++ b/lib/yang.h
@@ -44,6 +44,13 @@ DECLARE_MTYPE(YANG_DATA)
/* Maximum string length of an YANG value. */
#define YANG_VALUE_MAXLEN 1024
+struct yang_module_embed {
+ struct yang_module_embed *next;
+ const char *mod_name, *mod_rev;
+ const char *data;
+ LYS_INFORMAT format;
+};
+
struct yang_module {
RB_ENTRY(yang_module) entry;
const char *name;
@@ -133,6 +140,16 @@ extern struct yang_module *yang_module_load(const char *module_name);
extern struct yang_module *yang_module_find(const char *module_name);
/*
+ * Register a YANG module embedded in the binary file. Should be called
+ * from a constructor function.
+ *
+ * embed
+ * YANG module embedding structure to register. (static global provided
+ * by caller.)
+ */
+extern void yang_module_embed(struct yang_module_embed *embed);
+
+/*
* Iterate over all libyang schema nodes from the given YANG module.
*
* module