summaryrefslogtreecommitdiff
path: root/src/shim/mkjson/mkjson.h
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2020-08-31 11:23:06 -0500
committerGitHub <noreply@github.com>2020-08-31 11:23:06 -0500
commit621fcb078abb53888e995a007fb9ea31e95e34ab (patch)
treea4dda1096a267fed41ac90121ab6233e5b8b7d39 /src/shim/mkjson/mkjson.h
parentbd076f694a763991a0b0d3a7bb0fa5d194d56d7c (diff)
parentad69fb36201ee0930b76d80f0869284e26846991 (diff)
downloadvyos-1x-621fcb078abb53888e995a007fb9ea31e95e34ab.tar.gz
vyos-1x-621fcb078abb53888e995a007fb9ea31e95e34ab.zip
Merge pull request #535 from jestabro/vyos-configd
configd: T2582: vyos config script daemon configd: T2582: add scripts to include list for daemon configd: T2808: add smoketest to ensure script consistency with daemon configd: T2582: add utility to safely add/remove items from include file configd: T2582: add shim var to node.def configd: T2582: inject shim env variable into configsession configd: T2582: add shim as config daemon client configd: T2582: add mkjson for use by shim configd: T2582: add config daemon and supporting files
Diffstat (limited to 'src/shim/mkjson/mkjson.h')
-rw-r--r--src/shim/mkjson/mkjson.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/shim/mkjson/mkjson.h b/src/shim/mkjson/mkjson.h
new file mode 100644
index 000000000..38cc07b26
--- /dev/null
+++ b/src/shim/mkjson/mkjson.h
@@ -0,0 +1,50 @@
+/* mkjson.h - a part of mkjson library
+ *
+ * Copyright (C) 2018 Jacek Wieczorek
+ *
+ * This software may be modified and distributed under the terms
+ * of the MIT license. See the LICENSE file for details.
+ */
+
+#ifndef MKJSON_H
+#define MKJSON_H
+
+// JSON container types
+enum mkjson_container_type
+{
+ MKJSON_ARR = 0, // An array
+ MKJSON_OBJ = 1 // An object (hash or whatever you call it)
+};
+
+// JSON data types
+enum mkjson_value_type
+{
+ MKJSON_STRING = (int)('s'), // const char* - String data
+ MKJSON_STRING_FREE = (int)('f'), // char* - String data, but pointer is freed
+ MKJSON_JSON = (int)('r'), // const char* - JSON data (like string, but no quotes)
+ MKJSON_JSON_FREE = (int)('j'), // char* - JSON data, but pointer is freed
+ MKJSON_INT = (int)('i'), // int - An integer
+ MKJSON_LLINT = (int)('I'), // long long int - A long integer
+ MKJSON_DOUBLE = (int)('d'), // double - A double
+ MKJSON_LDOUBLE = (int)('D'), // long double - A long double
+ MKJSON_SCI_DOUBLE = (int)('e'), // double - A double with scientific notation
+ MKJSON_SCI_LDOUBLE = (int)('E'), // long double - A long double with scientific notation
+ MKJSON_BOOL = (int)('b'), // int - A boolean value
+ MKJSON_NULL = (int)('n'), // -- - JSON null value
+
+ // These cause one argument of certain type to be ignored
+ MKJSON_IGN_STRING = (-MKJSON_STRING),
+ MKJSON_IGN_STRING_FREE = (-MKJSON_STRING_FREE),
+ MKJSON_IGN_JSON = (-MKJSON_JSON),
+ MKJSON_IGN_JSON_FREE = (-MKJSON_JSON_FREE),
+ MKJSON_IGN_INT = (-MKJSON_INT),
+ MKJSON_IGN_LLINT = (-MKJSON_LLINT),
+ MKJSON_IGN_DOUBLE = (-MKJSON_DOUBLE),
+ MKJSON_IGN_LDOUBLE = (-MKJSON_LDOUBLE),
+ MKJSON_IGN_BOOL = (-MKJSON_BOOL),
+ MKJSON_IGN_NULL = (-MKJSON_NULL)
+};
+
+extern char *mkjson( enum mkjson_container_type otype, int count, ... );
+
+#endif