aboutsummaryrefslogtreecommitdiff
path: root/src/exchange-lib/exchange_api_wire.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-03-19 15:54:21 +0100
committerChristian Grothoff <christian@grothoff.org>2016-03-19 15:54:21 +0100
commitae726ea31b8607eacd2896617251cc0cab253111 (patch)
tree7e5d0d57e8ab6ba4542dcb0ef111f9466889528c /src/exchange-lib/exchange_api_wire.c
parent95ca52f5557b75fc0d5343c7e719b9aa6bcb1c50 (diff)
remove duplicated JSON parsing code from exchange-lib (#4150)
Diffstat (limited to 'src/exchange-lib/exchange_api_wire.c')
-rw-r--r--src/exchange-lib/exchange_api_wire.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/exchange-lib/exchange_api_wire.c b/src/exchange-lib/exchange_api_wire.c
index 35c443ff5..27ae1dce7 100644
--- a/src/exchange-lib/exchange_api_wire.c
+++ b/src/exchange-lib/exchange_api_wire.c
@@ -25,9 +25,9 @@
#include <microhttpd.h> /* just for HTTP status codes */
#include <gnunet/gnunet_util_lib.h>
#include "taler_exchange_service.h"
+#include "taler_json_lib.h"
#include "taler_wire_plugin.h"
#include "exchange_api_common.h"
-#include "exchange_api_json.h"
#include "exchange_api_context.h"
#include "exchange_api_handle.h"
@@ -311,17 +311,18 @@ verify_wire_signature_ok (const struct TALER_EXCHANGE_WireHandle *wh,
json_t *methods;
const struct TALER_EXCHANGE_Keys *key_state;
struct GNUNET_HashContext *hc;
- struct MAJ_Specification spec[] = {
- MAJ_spec_fixed_auto ("sig", &exchange_sig),
- MAJ_spec_fixed_auto ("pub", &exchange_pub),
- MAJ_spec_json ("methods", &methods),
- MAJ_spec_end
+ struct GNUNET_JSON_Specification spec[] = {
+ GNUNET_JSON_spec_fixed_auto ("sig", &exchange_sig),
+ GNUNET_JSON_spec_fixed_auto ("pub", &exchange_pub),
+ GNUNET_JSON_spec_json ("methods", &methods),
+ GNUNET_JSON_spec_end()
};
unsigned int i;
if (GNUNET_OK !=
- MAJ_parse_json (json,
- spec))
+ GNUNET_JSON_parse (json,
+ spec,
+ NULL, NULL))
{
GNUNET_break_op (0);
return NULL;
@@ -329,7 +330,7 @@ verify_wire_signature_ok (const struct TALER_EXCHANGE_WireHandle *wh,
if (! json_is_array (methods))
{
GNUNET_break_op (0);
- MAJ_parse_free (spec);
+ GNUNET_JSON_parse_free (spec);
return NULL;
}
@@ -351,7 +352,7 @@ verify_wire_signature_ok (const struct TALER_EXCHANGE_WireHandle *wh,
{
GNUNET_CRYPTO_hash_context_abort (hc);
GNUNET_break_op (0);
- MAJ_parse_free (spec);
+ GNUNET_JSON_parse_free (spec);
return NULL;
}
method = json_string_value (element);
@@ -371,7 +372,7 @@ verify_wire_signature_ok (const struct TALER_EXCHANGE_WireHandle *wh,
&exchange_pub.eddsa_pub))
{
GNUNET_break_op (0);
- MAJ_parse_free (spec);
+ GNUNET_JSON_parse_free (spec);
return NULL;
}
return methods;