summaryrefslogtreecommitdiffstats
path: root/src/json.c
diff options
context:
space:
mode:
authorJavier Sánchez Parra <jsanchez@soleta.eu>2020-09-09 11:27:45 +0200
committerOpenGnSys Support Team <soporte-og@soleta.eu>2020-09-10 14:48:26 +0200
commit0efc182c9ba71cb7a8afeeaea6593c52c35cc4ae (patch)
tree537c11d1c712a9ef10714b72a1642ec12fb545f0 /src/json.c
parenta1aaad46fb480fd7bd3204d7e7f5ade15eb4d031 (diff)
#1004 Handle new fields in /image/create response
ogClient now includes more information regarding the new image. This patch modifies ogServer to support new elements sent in ogClient /image/create response and store them in the database. Example of new /image/create response: { "disk": "1", "partition": "1", "code": "131", "id": "1", "name": "ubuntu", "repository": "192.168.56.10", "software": "Ubuntu 18.04.5 LTS \naccountsservice 0.6.45\n...", "clonator": "PARTCLONE", "compressor": "LZOP", "filesystem": "EXTFS", "datasize": 2100000 } New fields are "clonator", "compressor", "filesystem" and "datasize".
Diffstat (limited to 'src/json.c')
-rw-r--r--src/json.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/json.c b/src/json.c
index 078dfb7..c9c2078 100644
--- a/src/json.c
+++ b/src/json.c
@@ -18,6 +18,15 @@ int og_json_parse_string(json_t *element, const char **str)
return 0;
}
+int og_json_parse_uint64(json_t *element, uint64_t *integer)
+{
+ if (json_typeof(element) != JSON_INTEGER)
+ return -1;
+
+ *integer = json_integer_value(element);
+ return 0;
+}
+
int og_json_parse_uint(json_t *element, uint32_t *integer)
{
if (json_typeof(element) != JSON_INTEGER)