gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-merchant] branch master updated: begin to use libtalermhd


From: gnunet
Subject: [taler-merchant] branch master updated: begin to use libtalermhd
Date: Sat, 23 Nov 2019 22:46:15 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository merchant.

The following commit(s) were added to refs/heads/master by this push:
     new 8e7243a  begin to use libtalermhd
8e7243a is described below

commit 8e7243af8cab46ce70ef74a95ec0e4c030692f61
Author: Christian Grothoff <address@hidden>
AuthorDate: Sat Nov 23 22:46:12 2019 +0100

    begin to use libtalermhd
---
 src/backend/Makefile.am                            |   2 +-
 src/backend/taler-merchant-httpd.c                 |   1 -
 src/backend/taler-merchant-httpd.h                 |   1 +
 src/backend/taler-merchant-httpd_check-payment.c   |   1 -
 src/backend/taler-merchant-httpd_config.c          |   1 -
 src/backend/taler-merchant-httpd_order.c           |  27 ++-
 src/backend/taler-merchant-httpd_parsing.c         | 268 ---------------------
 src/backend/taler-merchant-httpd_parsing.h         |  93 -------
 src/backend/taler-merchant-httpd_pay.c             |  48 ++--
 src/backend/taler-merchant-httpd_poll-payment.c    |   1 -
 src/backend/taler-merchant-httpd_proposal.c        |   7 +-
 src/backend/taler-merchant-httpd_refund.c          |  21 +-
 src/backend/taler-merchant-httpd_tip-authorize.c   |  21 +-
 src/backend/taler-merchant-httpd_tip-pickup.c      |  27 +--
 src/backend/taler-merchant-httpd_tip-query.c       |   1 -
 .../taler-merchant-httpd_tip-reserve-helper.h      |   1 -
 .../taler-merchant-httpd_track-transaction.c       |   1 -
 src/backend/taler-merchant-httpd_track-transfer.c  |  37 ++-
 18 files changed, 94 insertions(+), 465 deletions(-)

diff --git a/src/backend/Makefile.am b/src/backend/Makefile.am
index 966d8f4..6ade68f 100644
--- a/src/backend/Makefile.am
+++ b/src/backend/Makefile.am
@@ -21,7 +21,6 @@ taler_merchant_httpd_SOURCES = \
   taler-merchant-httpd_history.c taler-merchant-httpd_history.h \
   taler-merchant-httpd_mhd.c taler-merchant-httpd_mhd.h \
   taler-merchant-httpd_order.c taler-merchant-httpd_order.h \
-  taler-merchant-httpd_parsing.c taler-merchant-httpd_parsing.h \
   taler-merchant-httpd_pay.c taler-merchant-httpd_pay.h \
   taler-merchant-httpd_poll-payment.c taler-merchant-httpd_poll-payment.h \
   taler-merchant-httpd_proposal.c taler-merchant-httpd_proposal.h \
@@ -36,6 +35,7 @@ taler_merchant_httpd_SOURCES = \
 taler_merchant_httpd_LDADD = \
   $(top_builddir)/src/backenddb/libtalermerchantdb.la \
   -ltalerexchange \
+  -ltalermhd \
   -ltalerwire \
   -ltalerjson \
   -ltalerutil \
diff --git a/src/backend/taler-merchant-httpd.c 
b/src/backend/taler-merchant-httpd.c
index 324fb73..d5dfb02 100644
--- a/src/backend/taler-merchant-httpd.c
+++ b/src/backend/taler-merchant-httpd.c
@@ -32,7 +32,6 @@
 #include "taler-merchant-httpd_responses.h"
 #include "taler_merchantdb_lib.h"
 #include "taler-merchant-httpd.h"
-#include "taler-merchant-httpd_parsing.h"
 #include "taler-merchant-httpd_mhd.h"
 #include "taler-merchant-httpd_auditors.h"
 #include "taler-merchant-httpd_exchanges.h"
diff --git a/src/backend/taler-merchant-httpd.h 
b/src/backend/taler-merchant-httpd.h
index 03999aa..82c080e 100644
--- a/src/backend/taler-merchant-httpd.h
+++ b/src/backend/taler-merchant-httpd.h
@@ -24,6 +24,7 @@
 #include "platform.h"
 #include "taler_merchantdb_lib.h"
 #include <microhttpd.h>
+#include <taler/taler_mhd_lib.h>
 
 /**
  * Shorthand for exit jumps.
diff --git a/src/backend/taler-merchant-httpd_check-payment.c 
b/src/backend/taler-merchant-httpd_check-payment.c
index 31e24d3..f988c54 100644
--- a/src/backend/taler-merchant-httpd_check-payment.c
+++ b/src/backend/taler-merchant-httpd_check-payment.c
@@ -27,7 +27,6 @@
 #include <taler/taler_signatures.h>
 #include "taler-merchant-httpd.h"
 #include "taler-merchant-httpd_mhd.h"
-#include "taler-merchant-httpd_parsing.h"
 #include "taler-merchant-httpd_exchanges.h"
 #include "taler-merchant-httpd_responses.h"
 #include "taler-merchant-httpd_check-payment.h"
diff --git a/src/backend/taler-merchant-httpd_config.c 
b/src/backend/taler-merchant-httpd_config.c
index 35b7657..bfd2abc 100644
--- a/src/backend/taler-merchant-httpd_config.c
+++ b/src/backend/taler-merchant-httpd_config.c
@@ -24,7 +24,6 @@
 #include <taler/taler_json_lib.h>
 #include "taler-merchant-httpd.h"
 #include "taler-merchant-httpd_mhd.h"
-#include "taler-merchant-httpd_parsing.h"
 #include "taler-merchant-httpd_exchanges.h"
 #include "taler-merchant-httpd_responses.h"
 #include "taler-merchant-httpd_tip-query.h"
diff --git a/src/backend/taler-merchant-httpd_order.c 
b/src/backend/taler-merchant-httpd_order.c
index 0118f15..985926a 100644
--- a/src/backend/taler-merchant-httpd_order.c
+++ b/src/backend/taler-merchant-httpd_order.c
@@ -28,7 +28,6 @@
 #include <taler/taler_signatures.h>
 #include <taler/taler_json_lib.h>
 #include "taler-merchant-httpd.h"
-#include "taler-merchant-httpd_parsing.h"
 #include "taler-merchant-httpd_auditors.h"
 #include "taler-merchant-httpd_exchanges.h"
 #include "taler-merchant-httpd_responses.h"
@@ -117,7 +116,7 @@ struct TMH_JsonParseContext
   struct TM_HandlerContext hc;
 
   /**
-   * Placeholder for #TMH_PARSE_post_json() to keep its internal state.
+   * Placeholder for #TALER_MHD_parse_post_json() to keep its internal state.
    */
   void *json_parse_context;
 };
@@ -133,7 +132,7 @@ json_parse_cleanup (struct TM_HandlerContext *hc)
 {
   struct TMH_JsonParseContext *jpc = (struct TMH_JsonParseContext *) hc;
 
-  TMH_PARSE_post_cleanup_callback (jpc->json_parse_context);
+  TALER_MHD_parse_post_cleanup_callback (jpc->json_parse_context);
   GNUNET_free (jpc);
 }
 
@@ -326,7 +325,8 @@ proposal_put (struct MHD_Connection *connection,
   {
     json_object_set_new (order,
                          "wire_transfer_deadline",
-                         GNUNET_JSON_from_time_rel 
(default_wire_transfer_delay));
+                         GNUNET_JSON_from_time_rel (
+                           default_wire_transfer_delay));
   }
 
   if (NULL == json_object_get (order,
@@ -454,9 +454,9 @@ proposal_put (struct MHD_Connection *connection,
   } /* needed to synthesize merchant info */
 
   /* extract fields we need to sign separately */
-  res = TMH_PARSE_json_data (connection,
-                             order,
-                             spec);
+  res = TALER_MHD_parse_json_data (connection,
+                                   order,
+                                   spec);
   /* json is malformed */
   if (GNUNET_NO == res)
   {
@@ -472,7 +472,8 @@ proposal_put (struct MHD_Connection *connection,
              "Impossible to parse the order");
   }
 
-  wire_transfer_deadline = GNUNET_TIME_relative_to_absolute 
(wire_transfer_deadline_rel);
+  wire_transfer_deadline = GNUNET_TIME_relative_to_absolute (
+    wire_transfer_deadline_rel);
 
   if (wire_transfer_deadline.abs_value_us <
       refund_deadline.abs_value_us)
@@ -666,11 +667,11 @@ MH_handler_order_post (struct TMH_RequestHandler *rh,
     ctx = *connection_cls;
   }
 
-  res = TMH_PARSE_post_json (connection,
-                             &ctx->json_parse_context,
-                             upload_data,
-                             upload_data_size,
-                             &root);
+  res = TALER_MHD_parse_post_json (connection,
+                                   &ctx->json_parse_context,
+                                   upload_data,
+                                   upload_data_size,
+                                   &root);
 
   if (GNUNET_SYSERR == res)
     return MHD_NO;
diff --git a/src/backend/taler-merchant-httpd_parsing.c 
b/src/backend/taler-merchant-httpd_parsing.c
deleted file mode 100644
index 497db87..0000000
--- a/src/backend/taler-merchant-httpd_parsing.c
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
-  This file is part of TALER
-  Copyright (C) 2014, 2015, 2016 GNUnet e.V.
-
-  TALER is free software; you can redistribute it and/or modify
-  it under the terms of the GNU Affero General Public License as
-  published by the Free Software Foundation; either version 3,
-  or (at your option) any later version.
-
-  TALER is distributed in the hope that it will be useful, but
-  WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU Affero General Public License for more details.
-
-  You should have received a copy of the GNU Affero General Public
-  License along with TALER; see the file COPYING.  If not,
-  see <http://www.gnu.org/licenses/>
-*/
-
-/**
- * @file taler-exchange-httpd_parsing.c
- * @brief functions to parse incoming requests
- *        (MHD arguments and JSON snippets)
- * @author Florian Dold
- * @author Benedikt Mueller
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include <gnunet/gnunet_util_lib.h>
-#include <taler/taler_json_lib.h>
-#include "taler-merchant-httpd_parsing.h"
-#include "taler-merchant-httpd_responses.h"
-
-/* FIXME: de-duplicate code with taler-exchange-httpd_parsing.c
-   and taler-exchange-httpd_response.c */
-
-/**
- * Initial size for POST request buffer.
- */
-#define REQUEST_BUFFER_INITIAL (2 * 1024)
-
-/**
- * Maximum POST request size.
- */
-#define REQUEST_BUFFER_MAX (1024 * 1024)
-
-
-/**
- * Buffer for POST requests.
- */
-struct Buffer
-{
-  /**
-   * Allocated memory
-   */
-  char *data;
-
-  /**
-   * Number of valid bytes in buffer.
-   */
-  size_t fill;
-
-  /**
-   * Number of allocated bytes in buffer.
-   */
-  size_t alloc;
-};
-
-
-/**
- * Free the data in a buffer.  Does *not* free
- * the buffer object itself.
- *
- * @param buf buffer to de-initialize
- */
-static void
-buffer_deinit (struct Buffer *buf)
-{
-  GNUNET_free_non_null (buf->data);
-  buf->data = NULL;
-}
-
-
-/**
- * Function called whenever we are done with a request
- * to clean up our state.
- *
- * @param con_cls value as it was left by
- *        #TMH_PARSE_post_json(), to be cleaned up
- */
-void
-TMH_PARSE_post_cleanup_callback (void *con_cls)
-{
-  struct Buffer *r = con_cls;
-
-  if (NULL != r)
-  {
-    buffer_deinit (r);
-    GNUNET_free (r);
-  }
-}
-
-
-/**
- * Process a POST request containing a JSON object.  This function
- * realizes an MHD POST processor that will (incrementally) process
- * JSON data uploaded to the HTTP server.  It will store the
- * required state in the @a con_cls, which must be cleaned up
- * using #TMH_PARSE_post_cleanup_callback().
- *
- * @param connection the MHD connection
- * @param con_cls the closure (points to a `struct Buffer *`)
- * @param upload_data the POST data
- * @param upload_data_size number of bytes in @a upload_data
- * @param json the JSON object for a completed request
- * @return
- *    #GNUNET_YES if json object was parsed or at least
- *               may be parsed in the future (call again);
- *               `*json` will be NULL if we need to be called again,
- *                and non-NULL if we are done.
- *    #GNUNET_NO if request is incomplete or invalid
- *               (error message was generated)
- *    #GNUNET_SYSERR on internal error
- *               (we could not even queue an error message,
- *                close HTTP session with MHD_NO)
- */
-int
-TMH_PARSE_post_json (struct MHD_Connection *connection,
-                     void **con_cls,
-                     const char *upload_data,
-                     size_t *upload_data_size,
-                     json_t **json)
-{
-  enum GNUNET_JSON_PostResult pr;
-
-  pr = GNUNET_JSON_post_parser (REQUEST_BUFFER_MAX,
-                                connection,
-                                con_cls,
-                                upload_data,
-                                upload_data_size,
-                                json);
-  switch (pr)
-  {
-
-  case GNUNET_JSON_PR_OUT_OF_MEMORY:
-    return (MHD_NO == TMH_RESPONSE_reply_internal_error
-              (connection,
-              TALER_EC_PARSER_OUT_OF_MEMORY,
-              "out of memory")) ? GNUNET_SYSERR : GNUNET_NO;
-
-  case GNUNET_JSON_PR_CONTINUE:
-    return GNUNET_YES;
-
-  case GNUNET_JSON_PR_REQUEST_TOO_LARGE:
-    return (MHD_NO == TMH_RESPONSE_reply_request_too_large
-              (connection)) ? GNUNET_SYSERR : GNUNET_NO;
-
-  case GNUNET_JSON_PR_JSON_INVALID:
-    return (MHD_YES ==
-            TMH_RESPONSE_reply_invalid_json (connection))
-           ? GNUNET_NO : GNUNET_SYSERR;
-  case GNUNET_JSON_PR_SUCCESS:
-    GNUNET_break (NULL != *json);
-    return GNUNET_YES;
-  }
-  /* this should never happen */
-  GNUNET_break (0);
-  return GNUNET_SYSERR;
-}
-
-
-/**
- * Parse JSON object into components based on the given field
- * specification.
- *
- * @param connection the connection to send an error response to
- * @param root the JSON node to start the navigation at.
- * @param spec field specification for the parser
- * @return
- *    #GNUNET_YES if navigation was successful (caller is responsible
- *                for freeing allocated variable-size data using
- *                #GNUNET_JSON_parse_free() when done)
- *    #GNUNET_NO if json is malformed, error response was generated
- *    #GNUNET_SYSERR on internal error
- */
-int
-TMH_PARSE_json_data (struct MHD_Connection *connection,
-                     const json_t *root,
-                     struct GNUNET_JSON_Specification *spec)
-{
-  int ret;
-  const char *error_json_name;
-  unsigned int error_line;
-
-  ret = GNUNET_JSON_parse (root,
-                           spec,
-                           &error_json_name,
-                           &error_line);
-  if (GNUNET_SYSERR == ret)
-  {
-    if (NULL == error_json_name)
-      error_json_name = "<no field>";
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                "Parsing failed due to field '%s'\n",
-                error_json_name);
-    ret = (MHD_YES ==
-           TMH_RESPONSE_reply_json_pack (connection,
-                                         MHD_HTTP_BAD_REQUEST,
-                                         "{s:s, s:s, s:I}",
-                                         "error", "parse error",
-                                         "field", error_json_name,
-                                         "line", (json_int_t) error_line))
-          ? GNUNET_NO : GNUNET_SYSERR;
-    return ret;
-  }
-  return GNUNET_YES;
-}
-
-
-/**
- * Extract base32crockford encoded data from request.
- *
- * Queues an error response to the connection if the parameter is
- * missing or invalid.
- *
- * @param connection the MHD connection
- * @param param_name the name of the parameter with the key
- * @param[out] out_data pointer to store the result
- * @param out_size expected size of data
- * @return
- *   #GNUNET_YES if the the argument is present
- *   #GNUNET_NO if the argument is absent or malformed
- *   #GNUNET_SYSERR on internal error (error response could not be sent)
- */
-int
-TMH_PARSE_mhd_request_arg_data (struct MHD_Connection *connection,
-                                const char *param_name,
-                                void *out_data,
-                                size_t out_size)
-{
-  const char *str;
-
-  str = MHD_lookup_connection_value (connection,
-                                     MHD_GET_ARGUMENT_KIND,
-                                     param_name);
-  if (NULL == str)
-  {
-    return (MHD_NO ==
-            TMH_RESPONSE_reply_arg_missing (connection,
-                                            TALER_EC_PARAMETER_MISSING,
-                                            param_name))
-           ? GNUNET_SYSERR : GNUNET_NO;
-  }
-  if (GNUNET_OK !=
-      GNUNET_STRINGS_string_to_data (str,
-                                     strlen (str),
-                                     out_data,
-                                     out_size))
-    return (MHD_NO ==
-            TMH_RESPONSE_reply_arg_invalid (connection,
-                                            TALER_EC_PARAMETER_MALFORMED,
-                                            param_name))
-           ? GNUNET_SYSERR : GNUNET_NO;
-  return GNUNET_OK;
-}
-
-
-/* end of taler-merchant-httpd_parsing.c */
diff --git a/src/backend/taler-merchant-httpd_parsing.h 
b/src/backend/taler-merchant-httpd_parsing.h
deleted file mode 100644
index 5ddc620..0000000
--- a/src/backend/taler-merchant-httpd_parsing.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
-  This file is part of TALER
-  Copyright (C) 2014, 2015, 2016 GNUnet e.V.
-
-  TALER is free software; you can redistribute it and/or modify it under the
-  terms of the GNU Affero General Public License as published by the Free 
Software
-  Foundation; either version 3, or (at your option) any later version.
-
-  TALER is distributed in the hope that it will be useful, but WITHOUT ANY
-  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-  A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more 
details.
-
-  You should have received a copy of the GNU Affero General Public License 
along with
-  TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
-*/
-/**
- * @file taler-exchange-httpd_parsing.h
- * @brief functions to parse incoming requests
- * @author Florian Dold
- * @author Benedikt Mueller
- * @author Christian Grothoff
- */
-#ifndef TALER_EXCHANGE_HTTPD_PARSING_H
-#define TALER_EXCHANGE_HTTPD_PARSING_H
-
-#include <microhttpd.h>
-#include <taler/taler_util.h>
-#include <taler/taler_json_lib.h>
-
-/**
- * Process a POST request containing a JSON object.  This
- * function realizes an MHD POST processor that will
- * (incrementally) process JSON data uploaded to the HTTP
- * server.  It will store the required state in the
- * "connection_cls", which must be cleaned up using
- * #TMH_PARSE_post_cleanup_callback().
- *
- * @param connection the MHD connection
- * @param con_cls the closure (points to a `struct Buffer *`)
- * @param upload_data the POST data
- * @param upload_data_size number of bytes in @a upload_data
- * @param json the JSON object for a completed request
- * @return
- *    #GNUNET_YES if json object was parsed or at least
- *               may be parsed in the future (call again);
- *               `*json` will be NULL if we need to be called again,
- *                and non-NULL if we are done.
- *    #GNUNET_NO is request incomplete or invalid
- *               (error message was generated)
- *    #GNUNET_SYSERR on internal error
- *               (we could not even queue an error message,
- *                close HTTP session with MHD_NO)
- */
-int
-TMH_PARSE_post_json (struct MHD_Connection *connection,
-                     void **con_cls,
-                     const char *upload_data,
-                     size_t *upload_data_size,
-                     json_t **json);
-
-
-/**
- * Function called whenever we are done with a request
- * to clean up our state.
- *
- * @param con_cls value as it was left by
- *        #TMH_PARSE_post_json(), to be cleaned up
- */
-void
-TMH_PARSE_post_cleanup_callback (void *con_cls);
-
-
-/**
- * Parse JSON object into components based on the given field
- * specification.
- *
- * @param connection the connection to send an error response to
- * @param root the JSON node to start the navigation at.
- * @param spec field specification for the parser
- * @return
- *    #GNUNET_YES if navigation was successful (caller is responsible
- *                for freeing allocated variable-size data using
- *                #GNUNET_JSON_parse_free() when done)
- *    #GNUNET_NO if json is malformed, error response was generated
- *    #GNUNET_SYSERR on internal error
- */
-int
-TMH_PARSE_json_data (struct MHD_Connection *connection,
-                     const json_t *root,
-                     struct GNUNET_JSON_Specification *spec);
-
-
-#endif /* TALER_MERCHANT_HTTPD_PARSING_H */
diff --git a/src/backend/taler-merchant-httpd_pay.c 
b/src/backend/taler-merchant-httpd_pay.c
index 99023b8..a3690ec 100644
--- a/src/backend/taler-merchant-httpd_pay.c
+++ b/src/backend/taler-merchant-httpd_pay.c
@@ -31,7 +31,6 @@
 #include <taler/taler_json_lib.h>
 #include <taler/taler_exchange_service.h>
 #include "taler-merchant-httpd.h"
-#include "taler-merchant-httpd_parsing.h"
 #include "taler-merchant-httpd_responses.h"
 #include "taler-merchant-httpd_auditors.h"
 #include "taler-merchant-httpd_exchanges.h"
@@ -216,7 +215,7 @@ struct PayContext
   const char *current_exchange;
 
   /**
-   * Placeholder for #TMH_PARSE_post_json() to keep its internal state.
+   * Placeholder for #TALER_MHD_parse_post_json() to keep its internal state.
    */
   void *json_parse_context;
 
@@ -612,7 +611,7 @@ pay_context_cleanup (struct TM_HandlerContext *hc)
     GNUNET_SCHEDULER_cancel (pc->timeout_task);
     pc->timeout_task = NULL;
   }
-  TMH_PARSE_post_cleanup_callback (pc->json_parse_context);
+  TALER_MHD_parse_post_cleanup_callback (pc->json_parse_context);
   for (unsigned int i = 0; i<pc->coins_cnt; i++)
   {
     struct DepositConfirmation *dc = &pc->dc[i];
@@ -1452,9 +1451,9 @@ parse_pay (struct MHD_Connection *connection,
   enum GNUNET_DB_QueryStatus qs;
   const char *session_id;
 
-  res = TMH_PARSE_json_data (connection,
-                             root,
-                             spec);
+  res = TALER_MHD_parse_json_data (connection,
+                                   root,
+                                   spec);
   if (GNUNET_YES != res)
   {
     GNUNET_break (0);
@@ -1575,9 +1574,9 @@ parse_pay (struct MHD_Connection *connection,
       GNUNET_JSON_spec_end ()
     };
 
-    res = TMH_PARSE_json_data (connection,
-                               pc->contract_terms,
-                               espec);
+    res = TALER_MHD_parse_json_data (connection,
+                                     pc->contract_terms,
+                                     espec);
     if (GNUNET_YES != res)
     {
       GNUNET_JSON_parse_free (spec);
@@ -1587,7 +1586,8 @@ parse_pay (struct MHD_Connection *connection,
 
     pc->fulfillment_url = GNUNET_strdup (fulfillment_url);
 
-    pc->wire_transfer_deadline = GNUNET_TIME_relative_to_absolute 
(wire_transfer_deadline_rel);
+    pc->wire_transfer_deadline = GNUNET_TIME_relative_to_absolute (
+      wire_transfer_deadline_rel);
 
     if (pc->wire_transfer_deadline.abs_value_us <
         pc->refund_deadline.abs_value_us)
@@ -1630,9 +1630,9 @@ parse_pay (struct MHD_Connection *connection,
       GNUNET_JSON_spec_end ()
     };
 
-    res = TMH_PARSE_json_data (connection,
-                               pc->contract_terms,
-                               espec);
+    res = TALER_MHD_parse_json_data (connection,
+                                     pc->contract_terms,
+                                     espec);
     if (GNUNET_YES != res)
     {
       GNUNET_break_op (0); /* invalid input, use default */
@@ -1658,9 +1658,9 @@ parse_pay (struct MHD_Connection *connection,
       GNUNET_JSON_spec_end ()
     };
 
-    res = TMH_PARSE_json_data (connection,
-                               pc->contract_terms,
-                               espec);
+    res = TALER_MHD_parse_json_data (connection,
+                                     pc->contract_terms,
+                                     espec);
     if ( (GNUNET_YES != res) ||
          (0 == pc->wire_fee_amortization) )
     {
@@ -1707,9 +1707,9 @@ parse_pay (struct MHD_Connection *connection,
       GNUNET_JSON_spec_end ()
     };
 
-    res = TMH_PARSE_json_data (connection,
-                               coin,
-                               ispec);
+    res = TALER_MHD_parse_json_data (connection,
+                                     coin,
+                                     ispec);
     if (GNUNET_YES != res)
     {
       GNUNET_JSON_parse_free (spec);
@@ -2245,11 +2245,11 @@ MH_handler_pay (struct TMH_RequestHandler *rh,
     return res;
   }
 
-  res = TMH_PARSE_post_json (connection,
-                             &pc->json_parse_context,
-                             upload_data,
-                             upload_data_size,
-                             &root);
+  res = TALER_MHD_parse_post_json (connection,
+                                   &pc->json_parse_context,
+                                   upload_data,
+                                   upload_data_size,
+                                   &root);
   if (GNUNET_SYSERR == res)
   {
     GNUNET_break (0);
diff --git a/src/backend/taler-merchant-httpd_poll-payment.c 
b/src/backend/taler-merchant-httpd_poll-payment.c
index 91ff4a5..ae40e91 100644
--- a/src/backend/taler-merchant-httpd_poll-payment.c
+++ b/src/backend/taler-merchant-httpd_poll-payment.c
@@ -27,7 +27,6 @@
 #include <taler/taler_signatures.h>
 #include "taler-merchant-httpd.h"
 #include "taler-merchant-httpd_mhd.h"
-#include "taler-merchant-httpd_parsing.h"
 #include "taler-merchant-httpd_exchanges.h"
 #include "taler-merchant-httpd_responses.h"
 #include "taler-merchant-httpd_poll-payment.h"
diff --git a/src/backend/taler-merchant-httpd_proposal.c 
b/src/backend/taler-merchant-httpd_proposal.c
index 7afd0f7..95c9caa 100644
--- a/src/backend/taler-merchant-httpd_proposal.c
+++ b/src/backend/taler-merchant-httpd_proposal.c
@@ -28,7 +28,6 @@
 #include <taler/taler_signatures.h>
 #include <taler/taler_json_lib.h>
 #include "taler-merchant-httpd.h"
-#include "taler-merchant-httpd_parsing.h"
 #include "taler-merchant-httpd_auditors.h"
 #include "taler-merchant-httpd_exchanges.h"
 #include "taler-merchant-httpd_responses.h"
@@ -125,9 +124,9 @@ MH_handler_proposal_lookup (struct TMH_RequestHandler *rh,
                          json_string (nonce));
 
     /* extract fields we need to sign separately */
-    res = TMH_PARSE_json_data (connection,
-                               contract_terms,
-                               spec);
+    res = TALER_MHD_parse_json_data (connection,
+                                     contract_terms,
+                                     spec);
     if (GNUNET_NO == res)
     {
       return MHD_YES;
diff --git a/src/backend/taler-merchant-httpd_refund.c 
b/src/backend/taler-merchant-httpd_refund.c
index 8fa4c13..c40644c 100644
--- a/src/backend/taler-merchant-httpd_refund.c
+++ b/src/backend/taler-merchant-httpd_refund.c
@@ -23,7 +23,6 @@
 #include <taler/taler_signatures.h>
 #include <taler/taler_json_lib.h>
 #include "taler-merchant-httpd.h"
-#include "taler-merchant-httpd_parsing.h"
 #include "taler-merchant-httpd_responses.h"
 #include "taler-merchant-httpd_refund.h"
 
@@ -71,7 +70,7 @@ struct TMH_JsonParseContext
   struct TM_HandlerContext hc;
 
   /**
-   * Placeholder for #TMH_PARSE_post_json() to keep its internal state.
+   * Placeholder for #TALER_MHD_parse_post_json() to keep its internal state.
    */
   void *json_parse_context;
 };
@@ -142,7 +141,7 @@ json_parse_cleanup (struct TM_HandlerContext *hc)
 {
   struct TMH_JsonParseContext *jpc = (struct TMH_JsonParseContext *) hc;
 
-  TMH_PARSE_post_cleanup_callback (jpc->json_parse_context);
+  TALER_MHD_parse_post_cleanup_callback (jpc->json_parse_context);
   GNUNET_free (jpc);
 }
 
@@ -196,11 +195,11 @@ MH_handler_refund_increase (struct TMH_RequestHandler *rh,
     ctx = *connection_cls;
   }
 
-  res = TMH_PARSE_post_json (connection,
-                             &ctx->json_parse_context,
-                             upload_data,
-                             upload_data_size,
-                             &root);
+  res = TALER_MHD_parse_post_json (connection,
+                                   &ctx->json_parse_context,
+                                   upload_data,
+                                   upload_data_size,
+                                   &root);
   if (GNUNET_SYSERR == res)
     return MHD_NO;
   /* the POST's body has to be further fetched */
@@ -208,9 +207,9 @@ MH_handler_refund_increase (struct TMH_RequestHandler *rh,
        (NULL == root) )
     return MHD_YES;
 
-  res = TMH_PARSE_json_data (connection,
-                             root,
-                             spec);
+  res = TALER_MHD_parse_json_data (connection,
+                                   root,
+                                   spec);
   if (GNUNET_NO == res)
   {
     GNUNET_break_op (0);
diff --git a/src/backend/taler-merchant-httpd_tip-authorize.c 
b/src/backend/taler-merchant-httpd_tip-authorize.c
index 7580f44..c02d8bd 100644
--- a/src/backend/taler-merchant-httpd_tip-authorize.c
+++ b/src/backend/taler-merchant-httpd_tip-authorize.c
@@ -24,7 +24,6 @@
 #include <taler/taler_json_lib.h>
 #include "taler-merchant-httpd.h"
 #include "taler-merchant-httpd_mhd.h"
-#include "taler-merchant-httpd_parsing.h"
 #include "taler-merchant-httpd_exchanges.h"
 #include "taler-merchant-httpd_responses.h"
 #include "taler-merchant-httpd_tip-authorize.h"
@@ -40,7 +39,7 @@ struct TipAuthContext
   struct TM_HandlerContext hc;
 
   /**
-   * Placeholder for #TMH_PARSE_post_json() to keep its internal state.
+   * Placeholder for #TALER_MHD_parse_post_json() to keep its internal state.
    */
   void *json_parse_context;
 
@@ -94,7 +93,7 @@ cleanup_tac (struct TM_HandlerContext *hc)
     tac->root = NULL;
   }
   TMH_check_tip_reserve_cleanup (&tac->ctr);
-  TMH_PARSE_post_cleanup_callback (tac->json_parse_context);
+  TALER_MHD_parse_post_cleanup_callback (tac->json_parse_context);
   GNUNET_free (tac);
 }
 
@@ -153,11 +152,11 @@ MH_handler_tip_authorize (struct TMH_RequestHandler *rh,
       GNUNET_JSON_spec_end ()
     };
 
-    res = TMH_PARSE_post_json (connection,
-                               &tac->json_parse_context,
-                               upload_data,
-                               upload_data_size,
-                               &tac->root);
+    res = TALER_MHD_parse_post_json (connection,
+                                     &tac->json_parse_context,
+                                     upload_data,
+                                     upload_data_size,
+                                     &tac->root);
     if (GNUNET_SYSERR == res)
       return MHD_NO;
     /* the POST's body has to be further fetched */
@@ -165,9 +164,9 @@ MH_handler_tip_authorize (struct TMH_RequestHandler *rh,
          (NULL == tac->root) )
       return MHD_YES;
 
-    res = TMH_PARSE_json_data (connection,
-                               tac->root,
-                               spec);
+    res = TALER_MHD_parse_json_data (connection,
+                                     tac->root,
+                                     spec);
     if (GNUNET_YES != res)
     {
       GNUNET_break_op (0);
diff --git a/src/backend/taler-merchant-httpd_tip-pickup.c 
b/src/backend/taler-merchant-httpd_tip-pickup.c
index d53596c..e54b69d 100644
--- a/src/backend/taler-merchant-httpd_tip-pickup.c
+++ b/src/backend/taler-merchant-httpd_tip-pickup.c
@@ -25,7 +25,6 @@
 #include <taler/taler_signatures.h>
 #include "taler-merchant-httpd.h"
 #include "taler-merchant-httpd_mhd.h"
-#include "taler-merchant-httpd_parsing.h"
 #include "taler-merchant-httpd_exchanges.h"
 #include "taler-merchant-httpd_responses.h"
 #include "taler-merchant-httpd_tip-pickup.h"
@@ -73,7 +72,7 @@ struct PickupContext
   struct TM_HandlerContext hc;
 
   /**
-   * Placeholder for #TMH_PARSE_post_json() to keep its internal state.
+   * Placeholder for #TALER_MHD_parse_post_json() to keep its internal state.
    */
 
   void *json_parse_context;
@@ -161,7 +160,7 @@ pickup_cleanup (struct TM_HandlerContext *hc)
     TMH_EXCHANGES_find_exchange_cancel (pc->fo);
     pc->fo = NULL;
   }
-  TMH_PARSE_post_cleanup_callback (pc->json_parse_context);
+  TALER_MHD_parse_post_cleanup_callback (pc->json_parse_context);
   GNUNET_free_non_null (pc->exchange_url);
   GNUNET_free (pc);
 }
@@ -475,9 +474,9 @@ parse_planchet (struct MHD_Connection *connection,
     GNUNET_JSON_spec_end ()
   };
 
-  ret = TMH_PARSE_json_data (connection,
-                             planchet,
-                             spec);
+  ret = TALER_MHD_parse_json_data (connection,
+                                   planchet,
+                                   spec);
   if (GNUNET_OK != ret)
     return ret;
   pd->wr.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_RESERVE_WITHDRAW);
@@ -541,11 +540,11 @@ MH_handler_tip_pickup (struct TMH_RequestHandler *rh,
     return run_pickup (connection,
                        pc);
   }
-  res = TMH_PARSE_post_json (connection,
-                             &pc->json_parse_context,
-                             upload_data,
-                             upload_data_size,
-                             &root);
+  res = TALER_MHD_parse_post_json (connection,
+                                   &pc->json_parse_context,
+                                   upload_data,
+                                   upload_data_size,
+                                   &root);
   if (GNUNET_SYSERR == res)
     return MHD_NO;
   /* the POST's body has to be further fetched */
@@ -553,9 +552,9 @@ MH_handler_tip_pickup (struct TMH_RequestHandler *rh,
        (NULL == root) )
     return MHD_YES;
 
-  res = TMH_PARSE_json_data (connection,
-                             root,
-                             spec);
+  res = TALER_MHD_parse_json_data (connection,
+                                   root,
+                                   spec);
   if (GNUNET_YES != res)
   {
     GNUNET_break_op (0);
diff --git a/src/backend/taler-merchant-httpd_tip-query.c 
b/src/backend/taler-merchant-httpd_tip-query.c
index d4a86a7..aad183a 100644
--- a/src/backend/taler-merchant-httpd_tip-query.c
+++ b/src/backend/taler-merchant-httpd_tip-query.c
@@ -25,7 +25,6 @@
 #include <taler/taler_json_lib.h>
 #include "taler-merchant-httpd.h"
 #include "taler-merchant-httpd_mhd.h"
-#include "taler-merchant-httpd_parsing.h"
 #include "taler-merchant-httpd_exchanges.h"
 #include "taler-merchant-httpd_responses.h"
 #include "taler-merchant-httpd_tip-query.h"
diff --git a/src/backend/taler-merchant-httpd_tip-reserve-helper.h 
b/src/backend/taler-merchant-httpd_tip-reserve-helper.h
index 713977d..54f81ca 100644
--- a/src/backend/taler-merchant-httpd_tip-reserve-helper.h
+++ b/src/backend/taler-merchant-httpd_tip-reserve-helper.h
@@ -25,7 +25,6 @@
 #include <taler/taler_json_lib.h>
 #include "taler-merchant-httpd.h"
 #include "taler-merchant-httpd_mhd.h"
-#include "taler-merchant-httpd_parsing.h"
 #include "taler-merchant-httpd_exchanges.h"
 #include "taler-merchant-httpd_responses.h"
 #include "taler-merchant-httpd_tip-reserve-helper.h"
diff --git a/src/backend/taler-merchant-httpd_track-transaction.c 
b/src/backend/taler-merchant-httpd_track-transaction.c
index b8fe42b..7c2c58d 100644
--- a/src/backend/taler-merchant-httpd_track-transaction.c
+++ b/src/backend/taler-merchant-httpd_track-transaction.c
@@ -25,7 +25,6 @@
 #include <taler/taler_json_lib.h>
 #include "taler-merchant-httpd.h"
 #include "taler-merchant-httpd_mhd.h"
-#include "taler-merchant-httpd_parsing.h"
 #include "taler-merchant-httpd_auditors.h"
 #include "taler-merchant-httpd_exchanges.h"
 #include "taler-merchant-httpd_responses.h"
diff --git a/src/backend/taler-merchant-httpd_track-transfer.c 
b/src/backend/taler-merchant-httpd_track-transfer.c
index b73bde9..f734866 100644
--- a/src/backend/taler-merchant-httpd_track-transfer.c
+++ b/src/backend/taler-merchant-httpd_track-transfer.c
@@ -25,7 +25,6 @@
 #include <taler/taler_json_lib.h>
 #include "taler-merchant-httpd.h"
 #include "taler-merchant-httpd_mhd.h"
-#include "taler-merchant-httpd_parsing.h"
 #include "taler-merchant-httpd_auditors.h"
 #include "taler-merchant-httpd_exchanges.h"
 #include "taler-merchant-httpd_responses.h"
@@ -472,24 +471,24 @@ check_transfer (void *cls,
     /* Build the `TrackTransferConflictDetails` */
     rctx->response
       = TMH_RESPONSE_make_json_pack (
-          "{s:I, s:s, s:o, s:I, s:o, s:o, s:s, s:o, s:o}",
-          "code",
-          (json_int_t) TALER_EC_TRACK_TRANSFER_CONFLICTING_REPORTS,
-          "hint",
-          "disagreement about deposit valuation",
-          "exchange_deposit_proof", exchange_proof,
-          "conflict_offset",
-          (json_int_t) rctx->current_offset,
-          "exchange_transfer_proof",
-          rctx->original_response,
-          "coin_pub", GNUNET_JSON_from_data_auto (
-            coin_pub),
-          "h_contract_terms",
-          GNUNET_JSON_from_data_auto (&ttd->h_contract_terms),
-          "amount_with_fee", TALER_JSON_from_amount (
-            amount_with_fee),
-          "deposit_fee", TALER_JSON_from_amount (
-            deposit_fee));
+      "{s:I, s:s, s:o, s:I, s:o, s:o, s:s, s:o, s:o}",
+      "code",
+      (json_int_t) TALER_EC_TRACK_TRANSFER_CONFLICTING_REPORTS,
+      "hint",
+      "disagreement about deposit valuation",
+      "exchange_deposit_proof", exchange_proof,
+      "conflict_offset",
+      (json_int_t) rctx->current_offset,
+      "exchange_transfer_proof",
+      rctx->original_response,
+      "coin_pub", GNUNET_JSON_from_data_auto (
+        coin_pub),
+      "h_contract_terms",
+      GNUNET_JSON_from_data_auto (&ttd->h_contract_terms),
+      "amount_with_fee", TALER_JSON_from_amount (
+        amount_with_fee),
+      "deposit_fee", TALER_JSON_from_amount (
+        deposit_fee));
     return;
   }
   rctx->check_transfer_result = GNUNET_OK;

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]