aboutsummaryrefslogtreecommitdiffstats
path: root/src/wrap-json.h
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2017-07-26 20:02:13 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2017-07-27 16:54:43 +0200
commit4a3d0c568ec5ee1296f4a50f269a1eadc4898e27 (patch)
treeee383f144ed1eeb7b0b2a541157928586d496835 /src/wrap-json.h
parentfee037ca12807a45527b78ca6bcffcdc9a7afabc (diff)
wrap-json: add packing tool for json
The functions wrap_json_pack and wrap_json_vpack can be used to create json object. These functions are likely to be compatible in the format with the packing functions of the library jansson [1]. [1] http://jansson.readthedocs.io/en/2.10/apiref.html#building-values Change-Id: I2e251bdb9b590ba55707c5a9ed60528cad927fb3 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/wrap-json.h')
-rw-r--r--src/wrap-json.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/wrap-json.h b/src/wrap-json.h
new file mode 100644
index 00000000..1e95dcf2
--- /dev/null
+++ b/src/wrap-json.h
@@ -0,0 +1,29 @@
+/*
+ Copyright (C) 2016, 2017 "IoT.bzh"
+
+ author: José Bollo <jose.bollo@iot.bzh>
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+#pragma once
+
+#include <stdarg.h>
+#include <json-c/json.h>
+
+extern int wrap_json_pack_error_position(int rc);
+extern int wrap_json_pack_error_code(int rc);
+extern const char *wrap_json_pack_error_string(int rc);
+extern int wrap_json_vpack(struct json_object **result, const char *desc, va_list args);
+extern int wrap_json_pack(struct json_object **result, const char *desc, ...);
+