From 698519e581cc5822ba68eb687e19ab8f10f5a093 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 25 Nov 2015 16:40:45 +0100 Subject: major refactoring of taler-merchant-httpd_pay, compiles but cannot yet work (uninitialized fields, some logic still broken, etc.) --- src/backend/taler-merchant-httpd_responses.h | 48 ++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'src/backend/taler-merchant-httpd_responses.h') 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 @@ -30,6 +30,16 @@ #include #include +/** + * 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. * @@ -44,6 +54,18 @@ TMH_RESPONSE_reply_json (struct MHD_Connection *connection, unsigned int response_code); +/** + * 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 -- cgit v1.2.3