summaryrefslogtreecommitdiff
path: root/src/mint-lib/mint_api_json.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-06-22 21:18:44 +0200
committerChristian Grothoff <christian@grothoff.org>2015-06-22 21:18:44 +0200
commit59b4e1cdd81524a2b6b20d34dcdac69b7f1a385e (patch)
treea76f8e0a6e6c06f6a365c4fbf14e4b7fb4d9c3fd /src/mint-lib/mint_api_json.c
parent9fbd7967b15d85f8b524caf84f2e877cccbe949c (diff)
downloadexchange-59b4e1cdd81524a2b6b20d34dcdac69b7f1a385e.tar.gz
exchange-59b4e1cdd81524a2b6b20d34dcdac69b7f1a385e.tar.bz2
exchange-59b4e1cdd81524a2b6b20d34dcdac69b7f1a385e.zip
almost finished checking if reserve transaction history well-formedness for /withdraw/sign error checking
Diffstat (limited to 'src/mint-lib/mint_api_json.c')
-rw-r--r--src/mint-lib/mint_api_json.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/mint-lib/mint_api_json.c b/src/mint-lib/mint_api_json.c
index e2a73bdd4..a28293cfe 100644
--- a/src/mint-lib/mint_api_json.c
+++ b/src/mint-lib/mint_api_json.c
@@ -72,6 +72,20 @@ parse_json (json_t *root,
}
break;
+ case MAJ_CMD_STRING:
+ {
+ const char *str;
+
+ str = json_string_value (pos);
+ if (NULL == str)
+ {
+ GNUNET_break_op (0);
+ return i;
+ }
+ *spec[i].details.strptr = str;
+ }
+ break;
+
case MAJ_CMD_BINARY_FIXED:
{
const char *str;
@@ -274,6 +288,8 @@ parse_free (struct MAJ_Specification *spec,
break;
case MAJ_CMD_BINARY_FIXED:
break;
+ case MAJ_CMD_STRING:
+ break;
case MAJ_CMD_BINARY_VARIABLE:
GNUNET_free (*spec[i].details.variable_data.dest_p);
*spec[i].details.variable_data.dest_p = NULL;
@@ -341,6 +357,26 @@ MAJ_parse_free (struct MAJ_Specification *spec)
/**
+ * The expected field stores a string.
+ *
+ * @param name name of the JSON field
+ * @param strptr where to store a pointer to the field
+ */
+struct MAJ_Specification
+MAJ_spec_string (const char *name,
+ const char **strptr)
+{
+ struct MAJ_Specification ret =
+ {
+ .cmd = MAJ_CMD_STRING,
+ .field = name,
+ .details.strptr = strptr
+ };
+ return ret;
+}
+
+
+/**
* Specification for parsing an absolute time value.
*
* @param name name of the JSON field