summaryrefslogtreecommitdiff
path: root/src/backend/taler-merchant-httpd_responses.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-11-25 16:40:45 +0100
committerChristian Grothoff <christian@grothoff.org>2015-11-25 16:40:45 +0100
commit698519e581cc5822ba68eb687e19ab8f10f5a093 (patch)
tree832bd06d049a87a36262b86af7dccb28e7ee6a77 /src/backend/taler-merchant-httpd_responses.h
parent85cc2554fe5537f79b3c5bb1700faeadb8bad99e (diff)
downloadmerchant-698519e581cc5822ba68eb687e19ab8f10f5a093.tar.gz
merchant-698519e581cc5822ba68eb687e19ab8f10f5a093.tar.bz2
merchant-698519e581cc5822ba68eb687e19ab8f10f5a093.zip
major refactoring of taler-merchant-httpd_pay, compiles but cannot yet work (uninitialized fields, some logic still broken, etc.)
Diffstat (limited to 'src/backend/taler-merchant-httpd_responses.h')
-rw-r--r--src/backend/taler-merchant-httpd_responses.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/backend/taler-merchant-httpd_responses.h b/src/backend/taler-merchant-httpd_responses.h
index ad063eb8..7240d601 100644
--- a/src/backend/taler-merchant-httpd_responses.h
+++ b/src/backend/taler-merchant-httpd_responses.h
@@ -31,6 +31,16 @@
#include <pthread.h>
/**
+ * Make JSON response object.
+ *
+ * @param json the json object
+ * @return MHD response object
+ */
+struct MHD_Response *
+TMH_RESPONSE_make_json (const json_t *json);
+
+
+/**
* Send JSON object as response.
*
* @param connection the MHD connection
@@ -45,6 +55,18 @@ TMH_RESPONSE_reply_json (struct MHD_Connection *connection,
/**
+ * Make JSON response object.
+ *
+ * @param fmt format string for pack
+ * @param ... varargs
+ * @return MHD response object
+ */
+struct MHD_Response *
+TMH_RESPONSE_make_json_pack (const char *fmt,
+ ...);
+
+
+/**
* Function to call to handle the request by building a JSON
* reply from a format string and varargs.
*
@@ -70,6 +92,7 @@ TMH_RESPONSE_reply_json_pack (struct MHD_Connection *connection,
int
TMH_RESPONSE_reply_invalid_json (struct MHD_Connection *connection);
+
/**
* Send a response indicating an internal error.
*
@@ -80,6 +103,18 @@ TMH_RESPONSE_reply_invalid_json (struct MHD_Connection *connection);
int
TMH_RESPONSE_reply_internal_error (struct MHD_Connection *connection,
const char *hint);
+
+
+/**
+ * Create a response indicating an internal error.
+ *
+ * @param hint hint about the internal error's nature
+ * @return a MHD response object
+ */
+struct MHD_Response *
+TMH_RESPONSE_make_internal_error (const char *hint);
+
+
/**
* Send a response indicating an external error.
*
@@ -90,6 +125,18 @@ TMH_RESPONSE_reply_internal_error (struct MHD_Connection *connection,
int
TMH_RESPONSE_reply_external_error (struct MHD_Connection *connection,
const char *hint);
+
+
+/**
+ * Create a response indicating an external error.
+ *
+ * @param hint hint about the internal error's nature
+ * @return a MHD response object
+ */
+struct MHD_Response *
+TMH_RESPONSE_make_external_error (const char *hint);
+
+
/**
* Send a response indicating that the request was too big.
*
@@ -99,6 +146,7 @@ TMH_RESPONSE_reply_external_error (struct MHD_Connection *connection,
int
TMH_RESPONSE_reply_request_too_large (struct MHD_Connection *connection);
+
/**
* Add headers we want to return in every response.
* Useful for testing, like if we want to always close