make code compiler without warnings with latest libmicrohttpd API
This commit is contained in:
parent
84a40be0bc
commit
543fe4ae36
@ -302,7 +302,7 @@ handle_mhd_completion_callback (void *cls,
|
|||||||
* @param[in,out] upload_data_size number of bytes (left) in @a upload_data
|
* @param[in,out] upload_data_size number of bytes (left) in @a upload_data
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
static int
|
static MHD_RESULT
|
||||||
handle_version (struct TAH_RequestHandler *rh,
|
handle_version (struct TAH_RequestHandler *rh,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
void **connection_cls,
|
void **connection_cls,
|
||||||
@ -347,7 +347,7 @@ handle_version (struct TAH_RequestHandler *rh,
|
|||||||
* @param con_cls closure for request (a `struct Buffer *`)
|
* @param con_cls closure for request (a `struct Buffer *`)
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
static int
|
static MHD_RESULT
|
||||||
handle_mhd_request (void *cls,
|
handle_mhd_request (void *cls,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
const char *url,
|
const char *url,
|
||||||
|
@ -75,16 +75,16 @@ struct TAH_RequestHandler
|
|||||||
* @param[in,out] upload_data_size number of bytes (left) in @a upload_data
|
* @param[in,out] upload_data_size number of bytes (left) in @a upload_data
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int (*handler)(struct TAH_RequestHandler *rh,
|
MHD_RESULT (*handler)(struct TAH_RequestHandler *rh,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
void **connection_cls,
|
void **connection_cls,
|
||||||
const char *upload_data,
|
const char *upload_data,
|
||||||
size_t *upload_data_size);
|
size_t *upload_data_size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default response code.
|
* Default response code.
|
||||||
*/
|
*/
|
||||||
int response_code;
|
unsigned int response_code;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ static pthread_mutex_t lock;
|
|||||||
* @param es information about the exchange's signing key
|
* @param es information about the exchange's signing key
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
static int
|
static MHD_RESULT
|
||||||
verify_and_execute_deposit_confirmation (
|
verify_and_execute_deposit_confirmation (
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
const struct TALER_AUDITORDB_DepositConfirmation *dc,
|
const struct TALER_AUDITORDB_DepositConfirmation *dc,
|
||||||
@ -212,7 +212,7 @@ verify_and_execute_deposit_confirmation (
|
|||||||
* @param[in,out] upload_data_size number of bytes (left) in @a upload_data
|
* @param[in,out] upload_data_size number of bytes (left) in @a upload_data
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TAH_DEPOSIT_CONFIRMATION_handler (struct TAH_RequestHandler *rh,
|
TAH_DEPOSIT_CONFIRMATION_handler (struct TAH_RequestHandler *rh,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
void **connection_cls,
|
void **connection_cls,
|
||||||
@ -245,7 +245,7 @@ TAH_DEPOSIT_CONFIRMATION_handler (struct TAH_RequestHandler *rh,
|
|||||||
(void) upload_data_size;
|
(void) upload_data_size;
|
||||||
{
|
{
|
||||||
json_t *json;
|
json_t *json;
|
||||||
int res;
|
enum GNUNET_GenericReturnValue res;
|
||||||
|
|
||||||
res = TALER_MHD_parse_post_json (connection,
|
res = TALER_MHD_parse_post_json (connection,
|
||||||
connection_cls,
|
connection_cls,
|
||||||
@ -270,7 +270,7 @@ TAH_DEPOSIT_CONFIRMATION_handler (struct TAH_RequestHandler *rh,
|
|||||||
es.exchange_pub = dc.exchange_pub; /* used twice! */
|
es.exchange_pub = dc.exchange_pub; /* used twice! */
|
||||||
dc.master_public_key = es.master_public_key;
|
dc.master_public_key = es.master_public_key;
|
||||||
{
|
{
|
||||||
int res;
|
MHD_RESULT res;
|
||||||
|
|
||||||
res = verify_and_execute_deposit_confirmation (connection,
|
res = verify_and_execute_deposit_confirmation (connection,
|
||||||
&dc,
|
&dc,
|
||||||
|
@ -49,7 +49,7 @@ TEAH_DEPOSIT_CONFIRMATION_done (void);
|
|||||||
* @param[in,out] upload_data_size number of bytes (left) in @a upload_data
|
* @param[in,out] upload_data_size number of bytes (left) in @a upload_data
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TAH_DEPOSIT_CONFIRMATION_handler (struct TAH_RequestHandler *rh,
|
TAH_DEPOSIT_CONFIRMATION_handler (struct TAH_RequestHandler *rh,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
void **connection_cls,
|
void **connection_cls,
|
||||||
|
@ -68,7 +68,7 @@ add_exchange (void *cls,
|
|||||||
* @param[in,out] upload_data_size number of bytes (left) in @a upload_data
|
* @param[in,out] upload_data_size number of bytes (left) in @a upload_data
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TAH_EXCHANGES_handler (struct TAH_RequestHandler *rh,
|
TAH_EXCHANGES_handler (struct TAH_RequestHandler *rh,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
void **connection_cls,
|
void **connection_cls,
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
* @param[in,out] upload_data_size number of bytes (left) in @a upload_data
|
* @param[in,out] upload_data_size number of bytes (left) in @a upload_data
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TAH_EXCHANGES_handler (struct TAH_RequestHandler *rh,
|
TAH_EXCHANGES_handler (struct TAH_RequestHandler *rh,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
void **connection_cls,
|
void **connection_cls,
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
* @param[in,out] upload_data_size number of bytes (left) in @a upload_data
|
* @param[in,out] upload_data_size number of bytes (left) in @a upload_data
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TAH_MHD_handler_static_response (struct TAH_RequestHandler *rh,
|
TAH_MHD_handler_static_response (struct TAH_RequestHandler *rh,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
void **connection_cls,
|
void **connection_cls,
|
||||||
@ -77,7 +77,7 @@ TAH_MHD_handler_static_response (struct TAH_RequestHandler *rh,
|
|||||||
* @param[in,out] upload_data_size number of bytes (left) in @a upload_data
|
* @param[in,out] upload_data_size number of bytes (left) in @a upload_data
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TAH_MHD_handler_agpl_redirect (struct TAH_RequestHandler *rh,
|
TAH_MHD_handler_agpl_redirect (struct TAH_RequestHandler *rh,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
void **connection_cls,
|
void **connection_cls,
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
* @param[in,out] upload_data_size number of bytes (left) in @a upload_data
|
* @param[in,out] upload_data_size number of bytes (left) in @a upload_data
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TAH_MHD_handler_static_response (struct TAH_RequestHandler *rh,
|
TAH_MHD_handler_static_response (struct TAH_RequestHandler *rh,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
void **connection_cls,
|
void **connection_cls,
|
||||||
@ -58,7 +58,7 @@ TAH_MHD_handler_static_response (struct TAH_RequestHandler *rh,
|
|||||||
* @param[in,out] upload_data_size number of bytes (left) in @a upload_data
|
* @param[in,out] upload_data_size number of bytes (left) in @a upload_data
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TAH_MHD_handler_agpl_redirect (struct TAH_RequestHandler *rh,
|
TAH_MHD_handler_agpl_redirect (struct TAH_RequestHandler *rh,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
void **connection_cls,
|
void **connection_cls,
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include "taler_fakebank_lib.h"
|
#include "taler_fakebank_lib.h"
|
||||||
#include "taler_bank_service.h"
|
#include "taler_bank_service.h"
|
||||||
#include "taler_mhd_lib.h"
|
#include "taler_mhd_lib.h"
|
||||||
|
#include <gnunet/gnunet_mhd_compat.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maximum POST request size (for /admin/add-incoming)
|
* Maximum POST request size (for /admin/add-incoming)
|
||||||
@ -585,7 +586,7 @@ handle_mhd_completion_callback (void *cls,
|
|||||||
* @param con_cls closure for request (a `struct Buffer *`)
|
* @param con_cls closure for request (a `struct Buffer *`)
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
static int
|
static MHD_RESULT
|
||||||
handle_admin_add_incoming (struct TALER_FAKEBANK_Handle *h,
|
handle_admin_add_incoming (struct TALER_FAKEBANK_Handle *h,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
const char *account,
|
const char *account,
|
||||||
@ -680,7 +681,7 @@ handle_admin_add_incoming (struct TALER_FAKEBANK_Handle *h,
|
|||||||
* @param con_cls closure for request (a `struct Buffer *`)
|
* @param con_cls closure for request (a `struct Buffer *`)
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
static int
|
static MHD_RESULT
|
||||||
handle_transfer (struct TALER_FAKEBANK_Handle *h,
|
handle_transfer (struct TALER_FAKEBANK_Handle *h,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
const char *account,
|
const char *account,
|
||||||
@ -800,12 +801,12 @@ handle_transfer (struct TALER_FAKEBANK_Handle *h,
|
|||||||
* @param con_cls place to store state, not used
|
* @param con_cls place to store state, not used
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
static int
|
static MHD_RESULT
|
||||||
handle_home_page (struct TALER_FAKEBANK_Handle *h,
|
handle_home_page (struct TALER_FAKEBANK_Handle *h,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
void **con_cls)
|
void **con_cls)
|
||||||
{
|
{
|
||||||
int ret;
|
MHD_RESULT ret;
|
||||||
struct MHD_Response *resp;
|
struct MHD_Response *resp;
|
||||||
#define HELLOMSG "Hello, Fakebank!"
|
#define HELLOMSG "Hello, Fakebank!"
|
||||||
|
|
||||||
@ -936,7 +937,7 @@ parse_history_common_args (struct MHD_Connection *connection,
|
|||||||
* @param account which account the request is about
|
* @param account which account the request is about
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
static int
|
static MHD_RESULT
|
||||||
handle_debit_history (struct TALER_FAKEBANK_Handle *h,
|
handle_debit_history (struct TALER_FAKEBANK_Handle *h,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
const char *account)
|
const char *account)
|
||||||
@ -1051,7 +1052,7 @@ handle_debit_history (struct TALER_FAKEBANK_Handle *h,
|
|||||||
* @param account which account the request is about
|
* @param account which account the request is about
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
static int
|
static MHD_RESULT
|
||||||
handle_credit_history (struct TALER_FAKEBANK_Handle *h,
|
handle_credit_history (struct TALER_FAKEBANK_Handle *h,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
const char *account)
|
const char *account)
|
||||||
@ -1198,7 +1199,7 @@ handle_credit_history (struct TALER_FAKEBANK_Handle *h,
|
|||||||
* @param con_cls closure for request (a `struct Buffer *`)
|
* @param con_cls closure for request (a `struct Buffer *`)
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
static int
|
static MHD_RESULT
|
||||||
serve (struct TALER_FAKEBANK_Handle *h,
|
serve (struct TALER_FAKEBANK_Handle *h,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
const char *account,
|
const char *account,
|
||||||
@ -1279,7 +1280,7 @@ serve (struct TALER_FAKEBANK_Handle *h,
|
|||||||
* @param con_cls closure for request (a `struct Buffer *`)
|
* @param con_cls closure for request (a `struct Buffer *`)
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
static int
|
static MHD_RESULT
|
||||||
handle_mhd_request (void *cls,
|
handle_mhd_request (void *cls,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
const char *url,
|
const char *url,
|
||||||
@ -1292,7 +1293,7 @@ handle_mhd_request (void *cls,
|
|||||||
struct TALER_FAKEBANK_Handle *h = cls;
|
struct TALER_FAKEBANK_Handle *h = cls;
|
||||||
char *account = NULL;
|
char *account = NULL;
|
||||||
char *end;
|
char *end;
|
||||||
int ret;
|
MHD_RESULT ret;
|
||||||
|
|
||||||
(void) version;
|
(void) version;
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
#include "taler-exchange-httpd_keystate.h"
|
#include "taler-exchange-httpd_keystate.h"
|
||||||
#include "taler-exchange-httpd_wire.h"
|
#include "taler-exchange-httpd_wire.h"
|
||||||
#include "taler_exchangedb_plugin.h"
|
#include "taler_exchangedb_plugin.h"
|
||||||
|
#include <gnunet/gnunet_mhd_compat.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Backlog for listen operation on unix domain sockets.
|
* Backlog for listen operation on unix domain sockets.
|
||||||
@ -158,7 +158,7 @@ static unsigned long long req_max;
|
|||||||
* @param root uploaded JSON data
|
* @param root uploaded JSON data
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
typedef int
|
typedef MHD_RESULT
|
||||||
(*CoinOpHandler)(struct MHD_Connection *connection,
|
(*CoinOpHandler)(struct MHD_Connection *connection,
|
||||||
const struct TALER_CoinSpendPublicKeyP *coin_pub,
|
const struct TALER_CoinSpendPublicKeyP *coin_pub,
|
||||||
const json_t *root);
|
const json_t *root);
|
||||||
@ -175,7 +175,7 @@ typedef int
|
|||||||
* reserve public key, the second one should be "withdraw")
|
* reserve public key, the second one should be "withdraw")
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
static int
|
static MHD_RESULT
|
||||||
handle_post_coins (const struct TEH_RequestHandler *rh,
|
handle_post_coins (const struct TEH_RequestHandler *rh,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
const json_t *root,
|
const json_t *root,
|
||||||
@ -297,7 +297,7 @@ handle_mhd_completion_callback (void *cls,
|
|||||||
* @param[in,out] upload_data_size number of bytes in @a upload_data
|
* @param[in,out] upload_data_size number of bytes in @a upload_data
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
static int
|
static MHD_RESULT
|
||||||
proceed_with_handler (const struct TEH_RequestHandler *rh,
|
proceed_with_handler (const struct TEH_RequestHandler *rh,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
const char *url,
|
const char *url,
|
||||||
@ -308,7 +308,7 @@ proceed_with_handler (const struct TEH_RequestHandler *rh,
|
|||||||
const char *args[rh->nargs + 1];
|
const char *args[rh->nargs + 1];
|
||||||
size_t ulen = strlen (url) + 1;
|
size_t ulen = strlen (url) + 1;
|
||||||
json_t *root = NULL;
|
json_t *root = NULL;
|
||||||
int ret;
|
MHD_RESULT ret;
|
||||||
|
|
||||||
/* We do check for "ulen" here, because we'll later stack-allocate a buffer
|
/* We do check for "ulen" here, because we'll later stack-allocate a buffer
|
||||||
of that size and don't want to enable malicious clients to cause us
|
of that size and don't want to enable malicious clients to cause us
|
||||||
@ -331,7 +331,7 @@ proceed_with_handler (const struct TEH_RequestHandler *rh,
|
|||||||
if (0 == strcasecmp (rh->method,
|
if (0 == strcasecmp (rh->method,
|
||||||
MHD_HTTP_METHOD_POST))
|
MHD_HTTP_METHOD_POST))
|
||||||
{
|
{
|
||||||
int res;
|
enum GNUNET_GenericReturnValue res;
|
||||||
|
|
||||||
res = TALER_MHD_parse_post_json (connection,
|
res = TALER_MHD_parse_post_json (connection,
|
||||||
inner_cls,
|
inner_cls,
|
||||||
@ -433,7 +433,7 @@ proceed_with_handler (const struct TEH_RequestHandler *rh,
|
|||||||
* @param con_cls closure for request (a `struct Buffer *`)
|
* @param con_cls closure for request (a `struct Buffer *`)
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
static int
|
static MHD_RESULT
|
||||||
handle_mhd_request (void *cls,
|
handle_mhd_request (void *cls,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
const char *url,
|
const char *url,
|
||||||
@ -606,7 +606,7 @@ handle_mhd_request (void *cls,
|
|||||||
/* on repeated requests, check our cache first */
|
/* on repeated requests, check our cache first */
|
||||||
if (NULL != ecls->rh)
|
if (NULL != ecls->rh)
|
||||||
{
|
{
|
||||||
int ret;
|
MHD_RESULT ret;
|
||||||
const char *start;
|
const char *start;
|
||||||
|
|
||||||
if ('\0' == url[0])
|
if ('\0' == url[0])
|
||||||
@ -669,7 +669,7 @@ handle_mhd_request (void *cls,
|
|||||||
if (0 == strcasecmp (method,
|
if (0 == strcasecmp (method,
|
||||||
rh->method))
|
rh->method))
|
||||||
{
|
{
|
||||||
int ret;
|
MHD_RESULT ret;
|
||||||
|
|
||||||
/* cache to avoid the loop next time */
|
/* cache to avoid the loop next time */
|
||||||
ecls->rh = rh;
|
ecls->rh = rh;
|
||||||
@ -698,7 +698,7 @@ handle_mhd_request (void *cls,
|
|||||||
|
|
||||||
/* No handler matches, generate not found */
|
/* No handler matches, generate not found */
|
||||||
{
|
{
|
||||||
int ret;
|
MHD_RESULT ret;
|
||||||
|
|
||||||
ret = TALER_MHD_reply_with_error (connection,
|
ret = TALER_MHD_reply_with_error (connection,
|
||||||
MHD_HTTP_NOT_FOUND,
|
MHD_HTTP_NOT_FOUND,
|
||||||
@ -716,7 +716,7 @@ handle_mhd_request (void *cls,
|
|||||||
*
|
*
|
||||||
* @return #GNUNET_OK on success
|
* @return #GNUNET_OK on success
|
||||||
*/
|
*/
|
||||||
static int
|
static enum GNUNET_GenericReturnValue
|
||||||
exchange_serve_process_config (void)
|
exchange_serve_process_config (void)
|
||||||
{
|
{
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include <microhttpd.h>
|
#include <microhttpd.h>
|
||||||
#include "taler_json_lib.h"
|
#include "taler_json_lib.h"
|
||||||
#include "taler_crypto_lib.h"
|
#include "taler_crypto_lib.h"
|
||||||
|
#include <gnunet/gnunet_mhd_compat.h>
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -100,9 +101,9 @@ struct TEH_RequestHandler
|
|||||||
* @param args array of arguments, needs to be of length @e args_expected
|
* @param args array of arguments, needs to be of length @e args_expected
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int (*get)(const struct TEH_RequestHandler *rh,
|
MHD_RESULT (*get)(const struct TEH_RequestHandler *rh,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
const char *const args[]);
|
const char *const args[]);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -115,10 +116,10 @@ struct TEH_RequestHandler
|
|||||||
* @param args array of arguments, needs to be of length @e args_expected
|
* @param args array of arguments, needs to be of length @e args_expected
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int (*post)(const struct TEH_RequestHandler *rh,
|
MHD_RESULT (*post)(const struct TEH_RequestHandler *rh,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
const json_t *root,
|
const json_t *root,
|
||||||
const char *const args[]);
|
const char *const args[]);
|
||||||
|
|
||||||
} handler;
|
} handler;
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ enum GNUNET_DB_QueryStatus
|
|||||||
TEH_DB_know_coin_transaction (void *cls,
|
TEH_DB_know_coin_transaction (void *cls,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
struct TALER_EXCHANGEDB_Session *session,
|
struct TALER_EXCHANGEDB_Session *session,
|
||||||
int *mhd_ret)
|
MHD_RESULT *mhd_ret)
|
||||||
{
|
{
|
||||||
struct TEH_DB_KnowCoinContext *kcc = cls;
|
struct TEH_DB_KnowCoinContext *kcc = cls;
|
||||||
enum GNUNET_DB_QueryStatus qs;
|
enum GNUNET_DB_QueryStatus qs;
|
||||||
@ -96,10 +96,10 @@ TEH_DB_know_coin_transaction (void *cls,
|
|||||||
* @param cb_cls closure for @a cb, must be read-only!
|
* @param cb_cls closure for @a cb, must be read-only!
|
||||||
* @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
|
* @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
|
||||||
*/
|
*/
|
||||||
int
|
enum GNUNET_GenericReturnValue
|
||||||
TEH_DB_run_transaction (struct MHD_Connection *connection,
|
TEH_DB_run_transaction (struct MHD_Connection *connection,
|
||||||
const char *name,
|
const char *name,
|
||||||
int *mhd_ret,
|
MHD_RESULT *mhd_ret,
|
||||||
TEH_DB_TransactionCallback cb,
|
TEH_DB_TransactionCallback cb,
|
||||||
void *cb_cls)
|
void *cb_cls)
|
||||||
{
|
{
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include <microhttpd.h>
|
#include <microhttpd.h>
|
||||||
#include "taler_exchangedb_plugin.h"
|
#include "taler_exchangedb_plugin.h"
|
||||||
|
#include <gnunet/gnunet_mhd_compat.h>
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -60,7 +61,7 @@ enum GNUNET_DB_QueryStatus
|
|||||||
TEH_DB_know_coin_transaction (void *cls,
|
TEH_DB_know_coin_transaction (void *cls,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
struct TALER_EXCHANGEDB_Session *session,
|
struct TALER_EXCHANGEDB_Session *session,
|
||||||
int *mhd_ret);
|
MHD_RESULT *mhd_ret);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -82,7 +83,7 @@ typedef enum GNUNET_DB_QueryStatus
|
|||||||
(*TEH_DB_TransactionCallback)(void *cls,
|
(*TEH_DB_TransactionCallback)(void *cls,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
struct TALER_EXCHANGEDB_Session *session,
|
struct TALER_EXCHANGEDB_Session *session,
|
||||||
int *mhd_ret);
|
MHD_RESULT *mhd_ret);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -101,10 +102,10 @@ typedef enum GNUNET_DB_QueryStatus
|
|||||||
* @param cb_cls closure for @a cb, must be read-only!
|
* @param cb_cls closure for @a cb, must be read-only!
|
||||||
* @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
|
* @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
|
||||||
*/
|
*/
|
||||||
int
|
enum GNUNET_GenericReturnValue
|
||||||
TEH_DB_run_transaction (struct MHD_Connection *connection,
|
TEH_DB_run_transaction (struct MHD_Connection *connection,
|
||||||
const char *name,
|
const char *name,
|
||||||
int *mhd_ret,
|
MHD_RESULT *mhd_ret,
|
||||||
TEH_DB_TransactionCallback cb,
|
TEH_DB_TransactionCallback cb,
|
||||||
void *cb_cls);
|
void *cb_cls);
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
* @param amount_without_fee fraction of coin value to deposit, without the fee
|
* @param amount_without_fee fraction of coin value to deposit, without the fee
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
static int
|
static MHD_RESULT
|
||||||
reply_deposit_success (struct MHD_Connection *connection,
|
reply_deposit_success (struct MHD_Connection *connection,
|
||||||
const struct TALER_CoinSpendPublicKeyP *coin_pub,
|
const struct TALER_CoinSpendPublicKeyP *coin_pub,
|
||||||
const struct GNUNET_HashCode *h_wire,
|
const struct GNUNET_HashCode *h_wire,
|
||||||
@ -133,7 +133,7 @@ static enum GNUNET_DB_QueryStatus
|
|||||||
deposit_transaction (void *cls,
|
deposit_transaction (void *cls,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
struct TALER_EXCHANGEDB_Session *session,
|
struct TALER_EXCHANGEDB_Session *session,
|
||||||
int *mhd_ret)
|
MHD_RESULT *mhd_ret)
|
||||||
{
|
{
|
||||||
struct DepositContext *dc = cls;
|
struct DepositContext *dc = cls;
|
||||||
const struct TALER_EXCHANGEDB_Deposit *deposit = dc->deposit;
|
const struct TALER_EXCHANGEDB_Deposit *deposit = dc->deposit;
|
||||||
@ -301,7 +301,7 @@ check_timestamp_current (struct GNUNET_TIME_Absolute ts)
|
|||||||
* @param root uploaded JSON data
|
* @param root uploaded JSON data
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TEH_handler_deposit (struct MHD_Connection *connection,
|
TEH_handler_deposit (struct MHD_Connection *connection,
|
||||||
const struct TALER_CoinSpendPublicKeyP *coin_pub,
|
const struct TALER_CoinSpendPublicKeyP *coin_pub,
|
||||||
const json_t *root)
|
const json_t *root)
|
||||||
@ -471,7 +471,7 @@ TEH_handler_deposit (struct MHD_Connection *connection,
|
|||||||
|
|
||||||
/* make sure coin is 'known' in database */
|
/* make sure coin is 'known' in database */
|
||||||
{
|
{
|
||||||
int mhd_ret;
|
MHD_RESULT mhd_ret;
|
||||||
struct TEH_DB_KnowCoinContext kcc = {
|
struct TEH_DB_KnowCoinContext kcc = {
|
||||||
.coin = &deposit.coin,
|
.coin = &deposit.coin,
|
||||||
.connection = connection
|
.connection = connection
|
||||||
@ -524,7 +524,7 @@ TEH_handler_deposit (struct MHD_Connection *connection,
|
|||||||
/* execute transaction */
|
/* execute transaction */
|
||||||
dc.deposit = &deposit;
|
dc.deposit = &deposit;
|
||||||
{
|
{
|
||||||
int mhd_ret;
|
MHD_RESULT mhd_ret;
|
||||||
|
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
TEH_DB_run_transaction (connection,
|
TEH_DB_run_transaction (connection,
|
||||||
@ -541,7 +541,7 @@ TEH_handler_deposit (struct MHD_Connection *connection,
|
|||||||
/* generate regular response */
|
/* generate regular response */
|
||||||
{
|
{
|
||||||
struct TALER_Amount amount_without_fee;
|
struct TALER_Amount amount_without_fee;
|
||||||
int res;
|
MHD_RESULT res;
|
||||||
|
|
||||||
GNUNET_assert (0 <=
|
GNUNET_assert (0 <=
|
||||||
TALER_amount_subtract (&amount_without_fee,
|
TALER_amount_subtract (&amount_without_fee,
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
* @param root uploaded JSON data
|
* @param root uploaded JSON data
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TEH_handler_deposit (struct MHD_Connection *connection,
|
TEH_handler_deposit (struct MHD_Connection *connection,
|
||||||
const struct TALER_CoinSpendPublicKeyP *coin_pub,
|
const struct TALER_CoinSpendPublicKeyP *coin_pub,
|
||||||
const json_t *root);
|
const json_t *root);
|
||||||
|
@ -45,7 +45,7 @@
|
|||||||
* @param exec_time execution time of the wire transfer
|
* @param exec_time execution time of the wire transfer
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
static int
|
static MHD_RESULT
|
||||||
reply_deposit_details (struct MHD_Connection *connection,
|
reply_deposit_details (struct MHD_Connection *connection,
|
||||||
const struct GNUNET_HashCode *h_contract_terms,
|
const struct GNUNET_HashCode *h_contract_terms,
|
||||||
const struct GNUNET_HashCode *h_wire,
|
const struct GNUNET_HashCode *h_wire,
|
||||||
@ -213,7 +213,7 @@ static enum GNUNET_DB_QueryStatus
|
|||||||
deposits_get_transaction (void *cls,
|
deposits_get_transaction (void *cls,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
struct TALER_EXCHANGEDB_Session *session,
|
struct TALER_EXCHANGEDB_Session *session,
|
||||||
int *mhd_ret)
|
MHD_RESULT *mhd_ret)
|
||||||
{
|
{
|
||||||
struct DepositWtidContext *ctx = cls;
|
struct DepositWtidContext *ctx = cls;
|
||||||
enum GNUNET_DB_QueryStatus qs;
|
enum GNUNET_DB_QueryStatus qs;
|
||||||
@ -258,13 +258,13 @@ deposits_get_transaction (void *cls,
|
|||||||
* @param merchant_pub public key from the merchant
|
* @param merchant_pub public key from the merchant
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
static int
|
static MHD_RESULT
|
||||||
handle_track_transaction_request (
|
handle_track_transaction_request (
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
const struct TALER_DepositTrackPS *tps,
|
const struct TALER_DepositTrackPS *tps,
|
||||||
const struct TALER_MerchantPublicKeyP *merchant_pub)
|
const struct TALER_MerchantPublicKeyP *merchant_pub)
|
||||||
{
|
{
|
||||||
int mhd_ret;
|
MHD_RESULT mhd_ret;
|
||||||
struct DepositWtidContext ctx = {
|
struct DepositWtidContext ctx = {
|
||||||
.pending = GNUNET_NO,
|
.pending = GNUNET_NO,
|
||||||
.tps = tps,
|
.tps = tps,
|
||||||
@ -310,12 +310,12 @@ handle_track_transaction_request (
|
|||||||
* h_wire, merchant_pub, h_contract_terms and coin_pub)
|
* h_wire, merchant_pub, h_contract_terms and coin_pub)
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TEH_handler_deposits_get (const struct TEH_RequestHandler *rh,
|
TEH_handler_deposits_get (const struct TEH_RequestHandler *rh,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
const char *const args[4])
|
const char *const args[4])
|
||||||
{
|
{
|
||||||
int res;
|
enum GNUNET_GenericReturnValue res;
|
||||||
struct TALER_MerchantSignatureP merchant_sig;
|
struct TALER_MerchantSignatureP merchant_sig;
|
||||||
struct TALER_DepositTrackPS tps = {
|
struct TALER_DepositTrackPS tps = {
|
||||||
.purpose.size = htonl (sizeof (tps)),
|
.purpose.size = htonl (sizeof (tps)),
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
* h_wire, merchant_pub, h_contract_terms and coin_pub)
|
* h_wire, merchant_pub, h_contract_terms and coin_pub)
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TEH_handler_deposits_get (const struct TEH_RequestHandler *rh,
|
TEH_handler_deposits_get (const struct TEH_RequestHandler *rh,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
const char *const args[4]);
|
const char *const args[4]);
|
||||||
|
@ -669,7 +669,7 @@ static enum GNUNET_DB_QueryStatus
|
|||||||
add_revocations_transaction (void *cls,
|
add_revocations_transaction (void *cls,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
struct TALER_EXCHANGEDB_Session *session,
|
struct TALER_EXCHANGEDB_Session *session,
|
||||||
int *mhd_ret)
|
MHD_RESULT *mhd_ret)
|
||||||
{
|
{
|
||||||
struct AddRevocationContext *arc = cls;
|
struct AddRevocationContext *arc = cls;
|
||||||
enum GNUNET_DB_QueryStatus qs;
|
enum GNUNET_DB_QueryStatus qs;
|
||||||
@ -709,7 +709,7 @@ static enum GNUNET_DB_QueryStatus
|
|||||||
add_denomination_transaction (void *cls,
|
add_denomination_transaction (void *cls,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
struct TALER_EXCHANGEDB_Session *session,
|
struct TALER_EXCHANGEDB_Session *session,
|
||||||
int *mhd_ret)
|
MHD_RESULT *mhd_ret)
|
||||||
{
|
{
|
||||||
const struct TALER_EXCHANGEDB_DenominationKey *dki = cls;
|
const struct TALER_EXCHANGEDB_DenominationKey *dki = cls;
|
||||||
enum GNUNET_DB_QueryStatus qs;
|
enum GNUNET_DB_QueryStatus qs;
|
||||||
@ -2467,12 +2467,12 @@ krd_search_comparator (const void *key,
|
|||||||
* @param args array of additional options (must be empty for this function)
|
* @param args array of additional options (must be empty for this function)
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TEH_handler_keys (const struct TEH_RequestHandler *rh,
|
TEH_handler_keys (const struct TEH_RequestHandler *rh,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
const char *const args[])
|
const char *const args[])
|
||||||
{
|
{
|
||||||
int ret;
|
MHD_RESULT ret;
|
||||||
const char *have_cherrypick;
|
const char *have_cherrypick;
|
||||||
const char *have_fakenow;
|
const char *have_fakenow;
|
||||||
struct GNUNET_TIME_Absolute last_issue_date;
|
struct GNUNET_TIME_Absolute last_issue_date;
|
||||||
|
@ -220,7 +220,7 @@ TEH_KS_sign_ (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
|
|||||||
* @param args array of additional options (must be empty for this function)
|
* @param args array of additional options (must be empty for this function)
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TEH_handler_keys (const struct TEH_RequestHandler *rh,
|
TEH_handler_keys (const struct TEH_RequestHandler *rh,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
const char *const args[]);
|
const char *const args[]);
|
||||||
|
@ -142,7 +142,7 @@ static enum GNUNET_DB_QueryStatus
|
|||||||
link_transaction (void *cls,
|
link_transaction (void *cls,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
struct TALER_EXCHANGEDB_Session *session,
|
struct TALER_EXCHANGEDB_Session *session,
|
||||||
int *mhd_ret)
|
MHD_RESULT *mhd_ret)
|
||||||
{
|
{
|
||||||
struct HTD_Context *ctx = cls;
|
struct HTD_Context *ctx = cls;
|
||||||
enum GNUNET_DB_QueryStatus qs;
|
enum GNUNET_DB_QueryStatus qs;
|
||||||
@ -180,13 +180,13 @@ link_transaction (void *cls,
|
|||||||
* @param args array of additional options (length: 2, first is the coin_pub, second must be "link")
|
* @param args array of additional options (length: 2, first is the coin_pub, second must be "link")
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TEH_handler_link (const struct TEH_RequestHandler *rh,
|
TEH_handler_link (const struct TEH_RequestHandler *rh,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
const char *const args[2])
|
const char *const args[2])
|
||||||
{
|
{
|
||||||
struct HTD_Context ctx;
|
struct HTD_Context ctx;
|
||||||
int mhd_ret;
|
MHD_RESULT mhd_ret;
|
||||||
|
|
||||||
(void) rh;
|
(void) rh;
|
||||||
memset (&ctx,
|
memset (&ctx,
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
* @param args array of additional options (length: 2, first is the coin_pub, second must be "link")
|
* @param args array of additional options (length: 2, first is the coin_pub, second must be "link")
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TEH_handler_link (const struct TEH_RequestHandler *rh,
|
TEH_handler_link (const struct TEH_RequestHandler *rh,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
const char *const args[2]);
|
const char *const args[2]);
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
* @param residual remaining value of the coin (after subtracting @a tl)
|
* @param residual remaining value of the coin (after subtracting @a tl)
|
||||||
* @return a MHD result code
|
* @return a MHD result code
|
||||||
*/
|
*/
|
||||||
static int
|
static MHD_RESULT
|
||||||
reply_melt_insufficient_funds (
|
reply_melt_insufficient_funds (
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
const struct TALER_CoinSpendPublicKeyP *coin_pub,
|
const struct TALER_CoinSpendPublicKeyP *coin_pub,
|
||||||
@ -94,7 +94,7 @@ reply_melt_insufficient_funds (
|
|||||||
* @param noreveal_index which index will the client not have to reveal
|
* @param noreveal_index which index will the client not have to reveal
|
||||||
* @return a MHD status code
|
* @return a MHD status code
|
||||||
*/
|
*/
|
||||||
static int
|
static MHD_RESULT
|
||||||
reply_melt_success (struct MHD_Connection *connection,
|
reply_melt_success (struct MHD_Connection *connection,
|
||||||
const struct TALER_RefreshCommitmentP *rc,
|
const struct TALER_RefreshCommitmentP *rc,
|
||||||
uint32_t noreveal_index)
|
uint32_t noreveal_index)
|
||||||
@ -174,7 +174,7 @@ static enum GNUNET_DB_QueryStatus
|
|||||||
refresh_check_melt (struct MHD_Connection *connection,
|
refresh_check_melt (struct MHD_Connection *connection,
|
||||||
struct TALER_EXCHANGEDB_Session *session,
|
struct TALER_EXCHANGEDB_Session *session,
|
||||||
struct MeltContext *rmc,
|
struct MeltContext *rmc,
|
||||||
int *mhd_ret)
|
MHD_RESULT *mhd_ret)
|
||||||
{
|
{
|
||||||
struct TALER_EXCHANGEDB_TransactionList *tl;
|
struct TALER_EXCHANGEDB_TransactionList *tl;
|
||||||
struct TALER_Amount spent;
|
struct TALER_Amount spent;
|
||||||
@ -296,7 +296,7 @@ static enum GNUNET_DB_QueryStatus
|
|||||||
melt_transaction (void *cls,
|
melt_transaction (void *cls,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
struct TALER_EXCHANGEDB_Session *session,
|
struct TALER_EXCHANGEDB_Session *session,
|
||||||
int *mhd_ret)
|
MHD_RESULT *mhd_ret)
|
||||||
{
|
{
|
||||||
struct MeltContext *rmc = cls;
|
struct MeltContext *rmc = cls;
|
||||||
enum GNUNET_DB_QueryStatus qs;
|
enum GNUNET_DB_QueryStatus qs;
|
||||||
@ -370,7 +370,7 @@ melt_transaction (void *cls,
|
|||||||
* @param[in,out] rmc details about the melt request
|
* @param[in,out] rmc details about the melt request
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
static int
|
static MHD_RESULT
|
||||||
handle_melt (struct MHD_Connection *connection,
|
handle_melt (struct MHD_Connection *connection,
|
||||||
struct MeltContext *rmc)
|
struct MeltContext *rmc)
|
||||||
{
|
{
|
||||||
@ -405,7 +405,7 @@ handle_melt (struct MHD_Connection *connection,
|
|||||||
|
|
||||||
/* run database transaction */
|
/* run database transaction */
|
||||||
{
|
{
|
||||||
int mhd_ret;
|
MHD_RESULT mhd_ret;
|
||||||
|
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
TEH_DB_run_transaction (connection,
|
TEH_DB_run_transaction (connection,
|
||||||
@ -431,7 +431,7 @@ handle_melt (struct MHD_Connection *connection,
|
|||||||
* @param rmc parsed request information
|
* @param rmc parsed request information
|
||||||
* @return MHD status code
|
* @return MHD status code
|
||||||
*/
|
*/
|
||||||
static int
|
static MHD_RESULT
|
||||||
check_for_denomination_key (struct MHD_Connection *connection,
|
check_for_denomination_key (struct MHD_Connection *connection,
|
||||||
struct MeltContext *rmc)
|
struct MeltContext *rmc)
|
||||||
{
|
{
|
||||||
@ -572,7 +572,7 @@ check_for_denomination_key (struct MHD_Connection *connection,
|
|||||||
if (GNUNET_NO == coin_is_dirty)
|
if (GNUNET_NO == coin_is_dirty)
|
||||||
{
|
{
|
||||||
struct TEH_DB_KnowCoinContext kcc;
|
struct TEH_DB_KnowCoinContext kcc;
|
||||||
int mhd_ret;
|
MHD_RESULT mhd_ret;
|
||||||
|
|
||||||
kcc.coin = &rmc->refresh_session.coin;
|
kcc.coin = &rmc->refresh_session.coin;
|
||||||
kcc.connection = connection;
|
kcc.connection = connection;
|
||||||
@ -612,13 +612,14 @@ check_for_denomination_key (struct MHD_Connection *connection,
|
|||||||
* @param root uploaded JSON data
|
* @param root uploaded JSON data
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TEH_handler_melt (struct MHD_Connection *connection,
|
TEH_handler_melt (struct MHD_Connection *connection,
|
||||||
const struct TALER_CoinSpendPublicKeyP *coin_pub,
|
const struct TALER_CoinSpendPublicKeyP *coin_pub,
|
||||||
const json_t *root)
|
const json_t *root)
|
||||||
{
|
{
|
||||||
struct MeltContext rmc;
|
struct MeltContext rmc;
|
||||||
int res;
|
enum GNUNET_GenericReturnValue ret;
|
||||||
|
MHD_RESULT res;
|
||||||
struct GNUNET_JSON_Specification spec[] = {
|
struct GNUNET_JSON_Specification spec[] = {
|
||||||
TALER_JSON_spec_denomination_signature ("denom_sig",
|
TALER_JSON_spec_denomination_signature ("denom_sig",
|
||||||
&rmc.refresh_session.coin.denom_sig),
|
&rmc.refresh_session.coin.denom_sig),
|
||||||
@ -637,11 +638,11 @@ TEH_handler_melt (struct MHD_Connection *connection,
|
|||||||
0,
|
0,
|
||||||
sizeof (rmc));
|
sizeof (rmc));
|
||||||
rmc.refresh_session.coin.coin_pub = *coin_pub;
|
rmc.refresh_session.coin.coin_pub = *coin_pub;
|
||||||
res = TALER_MHD_parse_json_data (connection,
|
ret = TALER_MHD_parse_json_data (connection,
|
||||||
root,
|
root,
|
||||||
spec);
|
spec);
|
||||||
if (GNUNET_OK != res)
|
if (GNUNET_OK != ret)
|
||||||
return (GNUNET_SYSERR == res) ? MHD_NO : MHD_YES;
|
return (GNUNET_SYSERR == ret) ? MHD_NO : MHD_YES;
|
||||||
|
|
||||||
res = check_for_denomination_key (connection,
|
res = check_for_denomination_key (connection,
|
||||||
&rmc);
|
&rmc);
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
* @param root uploaded JSON data
|
* @param root uploaded JSON data
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TEH_handler_melt (struct MHD_Connection *connection,
|
TEH_handler_melt (struct MHD_Connection *connection,
|
||||||
const struct TALER_CoinSpendPublicKeyP *coin_pub,
|
const struct TALER_CoinSpendPublicKeyP *coin_pub,
|
||||||
const json_t *root);
|
const json_t *root);
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
* @param args array of additional options (must be empty for this function)
|
* @param args array of additional options (must be empty for this function)
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TEH_handler_static_response (const struct TEH_RequestHandler *rh,
|
TEH_handler_static_response (const struct TEH_RequestHandler *rh,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
const char *const args[])
|
const char *const args[])
|
||||||
@ -71,7 +71,7 @@ TEH_handler_static_response (const struct TEH_RequestHandler *rh,
|
|||||||
* @param args array of additional options (must be empty for this function)
|
* @param args array of additional options (must be empty for this function)
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TEH_handler_agpl_redirect (const struct TEH_RequestHandler *rh,
|
TEH_handler_agpl_redirect (const struct TEH_RequestHandler *rh,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
const char *const args[])
|
const char *const args[])
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
* @param args array of additional options (must be empty for this function)
|
* @param args array of additional options (must be empty for this function)
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TEH_handler_static_response (const struct TEH_RequestHandler *rh,
|
TEH_handler_static_response (const struct TEH_RequestHandler *rh,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
const char *const args[]);
|
const char *const args[]);
|
||||||
@ -52,7 +52,7 @@ TEH_handler_static_response (const struct TEH_RequestHandler *rh,
|
|||||||
* @param args array of additional options (must be empty for this function)
|
* @param args array of additional options (must be empty for this function)
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TEH_handler_agpl_redirect (const struct TEH_RequestHandler *rh,
|
TEH_handler_agpl_redirect (const struct TEH_RequestHandler *rh,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
const char *const args[]);
|
const char *const args[]);
|
||||||
|
@ -123,7 +123,7 @@ static enum GNUNET_DB_QueryStatus
|
|||||||
recoup_transaction (void *cls,
|
recoup_transaction (void *cls,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
struct TALER_EXCHANGEDB_Session *session,
|
struct TALER_EXCHANGEDB_Session *session,
|
||||||
int *mhd_ret)
|
MHD_RESULT *mhd_ret)
|
||||||
{
|
{
|
||||||
struct RecoupContext *pc = cls;
|
struct RecoupContext *pc = cls;
|
||||||
struct TALER_EXCHANGEDB_TransactionList *tl;
|
struct TALER_EXCHANGEDB_TransactionList *tl;
|
||||||
@ -260,7 +260,7 @@ recoup_transaction (void *cls,
|
|||||||
(0 == pc->amount.value) )
|
(0 == pc->amount.value) )
|
||||||
{
|
{
|
||||||
/* Recoup has no effect: coin fully spent! */
|
/* Recoup has no effect: coin fully spent! */
|
||||||
int ret;
|
enum GNUNET_DB_QueryStatus ret;
|
||||||
|
|
||||||
TEH_plugin->rollback (TEH_plugin->cls,
|
TEH_plugin->rollback (TEH_plugin->cls,
|
||||||
session);
|
session);
|
||||||
@ -342,7 +342,7 @@ recoup_transaction (void *cls,
|
|||||||
* @param refreshed #GNUNET_YES if the coin was refreshed
|
* @param refreshed #GNUNET_YES if the coin was refreshed
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
static int
|
static MHD_RESULT
|
||||||
verify_and_execute_recoup (struct MHD_Connection *connection,
|
verify_and_execute_recoup (struct MHD_Connection *connection,
|
||||||
const struct TALER_CoinPublicInfo *coin,
|
const struct TALER_CoinPublicInfo *coin,
|
||||||
const struct
|
const struct
|
||||||
@ -453,7 +453,7 @@ verify_and_execute_recoup (struct MHD_Connection *connection,
|
|||||||
/* make sure coin is 'known' in database */
|
/* make sure coin is 'known' in database */
|
||||||
{
|
{
|
||||||
struct TEH_DB_KnowCoinContext kcc;
|
struct TEH_DB_KnowCoinContext kcc;
|
||||||
int mhd_ret;
|
MHD_RESULT mhd_ret;
|
||||||
|
|
||||||
kcc.coin = coin;
|
kcc.coin = coin;
|
||||||
kcc.connection = connection;
|
kcc.connection = connection;
|
||||||
@ -472,7 +472,7 @@ verify_and_execute_recoup (struct MHD_Connection *connection,
|
|||||||
pc.coin = coin;
|
pc.coin = coin;
|
||||||
pc.refreshed = refreshed;
|
pc.refreshed = refreshed;
|
||||||
{
|
{
|
||||||
int mhd_ret;
|
MHD_RESULT mhd_ret;
|
||||||
|
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
TEH_DB_run_transaction (connection,
|
TEH_DB_run_transaction (connection,
|
||||||
@ -512,12 +512,12 @@ verify_and_execute_recoup (struct MHD_Connection *connection,
|
|||||||
* @param root uploaded JSON data
|
* @param root uploaded JSON data
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TEH_handler_recoup (struct MHD_Connection *connection,
|
TEH_handler_recoup (struct MHD_Connection *connection,
|
||||||
const struct TALER_CoinSpendPublicKeyP *coin_pub,
|
const struct TALER_CoinSpendPublicKeyP *coin_pub,
|
||||||
const json_t *root)
|
const json_t *root)
|
||||||
{
|
{
|
||||||
int res;
|
enum GNUNET_GenericReturnValue ret;
|
||||||
struct TALER_CoinPublicInfo coin;
|
struct TALER_CoinPublicInfo coin;
|
||||||
struct TALER_DenominationBlindingKeyP coin_bks;
|
struct TALER_DenominationBlindingKeyP coin_bks;
|
||||||
struct TALER_CoinSpendSignatureP coin_sig;
|
struct TALER_CoinSpendSignatureP coin_sig;
|
||||||
@ -538,20 +538,24 @@ TEH_handler_recoup (struct MHD_Connection *connection,
|
|||||||
};
|
};
|
||||||
|
|
||||||
coin.coin_pub = *coin_pub;
|
coin.coin_pub = *coin_pub;
|
||||||
res = TALER_MHD_parse_json_data (connection,
|
ret = TALER_MHD_parse_json_data (connection,
|
||||||
root,
|
root,
|
||||||
spec);
|
spec);
|
||||||
if (GNUNET_SYSERR == res)
|
if (GNUNET_SYSERR == ret)
|
||||||
return MHD_NO; /* hard failure */
|
return MHD_NO; /* hard failure */
|
||||||
if (GNUNET_NO == res)
|
if (GNUNET_NO == ret)
|
||||||
return MHD_YES; /* failure */
|
return MHD_YES; /* failure */
|
||||||
res = verify_and_execute_recoup (connection,
|
{
|
||||||
&coin,
|
MHD_RESULT res;
|
||||||
&coin_bks,
|
|
||||||
&coin_sig,
|
res = verify_and_execute_recoup (connection,
|
||||||
refreshed);
|
&coin,
|
||||||
GNUNET_JSON_parse_free (spec);
|
&coin_bks,
|
||||||
return res;
|
&coin_sig,
|
||||||
|
refreshed);
|
||||||
|
GNUNET_JSON_parse_free (spec);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
* @param root uploaded JSON data
|
* @param root uploaded JSON data
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TEH_handler_recoup (struct MHD_Connection *connection,
|
TEH_handler_recoup (struct MHD_Connection *connection,
|
||||||
const struct TALER_CoinSpendPublicKeyP *coin_pub,
|
const struct TALER_CoinSpendPublicKeyP *coin_pub,
|
||||||
const json_t *root);
|
const json_t *root);
|
||||||
|
@ -52,7 +52,7 @@
|
|||||||
* @param sigs array of @a num_freshcoins signatures revealed
|
* @param sigs array of @a num_freshcoins signatures revealed
|
||||||
* @return a MHD result code
|
* @return a MHD result code
|
||||||
*/
|
*/
|
||||||
static int
|
static MHD_RESULT
|
||||||
reply_refreshes_reveal_success (struct MHD_Connection *connection,
|
reply_refreshes_reveal_success (struct MHD_Connection *connection,
|
||||||
unsigned int num_freshcoins,
|
unsigned int num_freshcoins,
|
||||||
const struct TALER_DenominationSignature *sigs)
|
const struct TALER_DenominationSignature *sigs)
|
||||||
@ -235,7 +235,7 @@ static enum GNUNET_DB_QueryStatus
|
|||||||
refreshes_reveal_preflight (void *cls,
|
refreshes_reveal_preflight (void *cls,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
struct TALER_EXCHANGEDB_Session *session,
|
struct TALER_EXCHANGEDB_Session *session,
|
||||||
int *mhd_ret)
|
MHD_RESULT *mhd_ret)
|
||||||
{
|
{
|
||||||
struct RevealContext *rctx = cls;
|
struct RevealContext *rctx = cls;
|
||||||
enum GNUNET_DB_QueryStatus qs;
|
enum GNUNET_DB_QueryStatus qs;
|
||||||
@ -292,7 +292,7 @@ static enum GNUNET_DB_QueryStatus
|
|||||||
refreshes_reveal_transaction (void *cls,
|
refreshes_reveal_transaction (void *cls,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
struct TALER_EXCHANGEDB_Session *session,
|
struct TALER_EXCHANGEDB_Session *session,
|
||||||
int *mhd_ret)
|
MHD_RESULT *mhd_ret)
|
||||||
{
|
{
|
||||||
struct RevealContext *rctx = cls;
|
struct RevealContext *rctx = cls;
|
||||||
struct TALER_EXCHANGEDB_Melt melt;
|
struct TALER_EXCHANGEDB_Melt melt;
|
||||||
@ -482,7 +482,7 @@ static enum GNUNET_DB_QueryStatus
|
|||||||
refreshes_reveal_persist (void *cls,
|
refreshes_reveal_persist (void *cls,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
struct TALER_EXCHANGEDB_Session *session,
|
struct TALER_EXCHANGEDB_Session *session,
|
||||||
int *mhd_ret)
|
MHD_RESULT *mhd_ret)
|
||||||
{
|
{
|
||||||
struct RevealContext *rctx = cls;
|
struct RevealContext *rctx = cls;
|
||||||
enum GNUNET_DB_QueryStatus qs;
|
enum GNUNET_DB_QueryStatus qs;
|
||||||
@ -532,7 +532,7 @@ refreshes_reveal_persist (void *cls,
|
|||||||
* @param coin_evs envelopes of gamma-selected coins to be signed
|
* @param coin_evs envelopes of gamma-selected coins to be signed
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
static int
|
static MHD_RESULT
|
||||||
resolve_refreshes_reveal_denominations (struct TEH_KS_StateHandle *key_state,
|
resolve_refreshes_reveal_denominations (struct TEH_KS_StateHandle *key_state,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
struct RevealContext *rctx,
|
struct RevealContext *rctx,
|
||||||
@ -547,7 +547,8 @@ resolve_refreshes_reveal_denominations (struct TEH_KS_StateHandle *key_state,
|
|||||||
struct TALER_RefreshCoinData rcds[num_fresh_coins];
|
struct TALER_RefreshCoinData rcds[num_fresh_coins];
|
||||||
struct TALER_CoinSpendSignatureP link_sigs[num_fresh_coins];
|
struct TALER_CoinSpendSignatureP link_sigs[num_fresh_coins];
|
||||||
struct TALER_EXCHANGEDB_Melt melt;
|
struct TALER_EXCHANGEDB_Melt melt;
|
||||||
int res;
|
enum GNUNET_GenericReturnValue res;
|
||||||
|
MHD_RESULT ret;
|
||||||
|
|
||||||
/* Parse denomination key hashes */
|
/* Parse denomination key hashes */
|
||||||
for (unsigned int i = 0; i<num_fresh_coins; i++)
|
for (unsigned int i = 0; i<num_fresh_coins; i++)
|
||||||
@ -624,13 +625,13 @@ resolve_refreshes_reveal_denominations (struct TEH_KS_StateHandle *key_state,
|
|||||||
switch (qs)
|
switch (qs)
|
||||||
{
|
{
|
||||||
case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
|
case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
|
||||||
res = TALER_MHD_reply_with_error (connection,
|
ret = TALER_MHD_reply_with_error (connection,
|
||||||
MHD_HTTP_NOT_FOUND,
|
MHD_HTTP_NOT_FOUND,
|
||||||
TALER_EC_REVEAL_SESSION_UNKNOWN,
|
TALER_EC_REVEAL_SESSION_UNKNOWN,
|
||||||
"rc");
|
"rc");
|
||||||
break;
|
break;
|
||||||
case GNUNET_DB_STATUS_HARD_ERROR:
|
case GNUNET_DB_STATUS_HARD_ERROR:
|
||||||
res = TALER_MHD_reply_with_error (connection,
|
ret = TALER_MHD_reply_with_error (connection,
|
||||||
MHD_HTTP_INTERNAL_SERVER_ERROR,
|
MHD_HTTP_INTERNAL_SERVER_ERROR,
|
||||||
TALER_EC_REVEAL_DB_FETCH_SESSION_ERROR,
|
TALER_EC_REVEAL_DB_FETCH_SESSION_ERROR,
|
||||||
"failed to fetch session data");
|
"failed to fetch session data");
|
||||||
@ -638,7 +639,7 @@ resolve_refreshes_reveal_denominations (struct TEH_KS_StateHandle *key_state,
|
|||||||
case GNUNET_DB_STATUS_SOFT_ERROR:
|
case GNUNET_DB_STATUS_SOFT_ERROR:
|
||||||
default:
|
default:
|
||||||
GNUNET_break (0); /* should be impossible */
|
GNUNET_break (0); /* should be impossible */
|
||||||
res = TALER_MHD_reply_with_error (connection,
|
ret = TALER_MHD_reply_with_error (connection,
|
||||||
MHD_HTTP_INTERNAL_SERVER_ERROR,
|
MHD_HTTP_INTERNAL_SERVER_ERROR,
|
||||||
TALER_EC_INTERNAL_INVARIANT_FAILURE,
|
TALER_EC_INTERNAL_INVARIANT_FAILURE,
|
||||||
"assertion failed (unexpected database serialization error)");
|
"assertion failed (unexpected database serialization error)");
|
||||||
@ -683,7 +684,7 @@ resolve_refreshes_reveal_denominations (struct TEH_KS_StateHandle *key_state,
|
|||||||
&melt.session.coin.coin_pub.eddsa_pub))
|
&melt.session.coin.coin_pub.eddsa_pub))
|
||||||
{
|
{
|
||||||
GNUNET_break_op (0);
|
GNUNET_break_op (0);
|
||||||
res = TALER_MHD_reply_with_error (connection,
|
ret = TALER_MHD_reply_with_error (connection,
|
||||||
MHD_HTTP_FORBIDDEN,
|
MHD_HTTP_FORBIDDEN,
|
||||||
TALER_EC_REVEAL_LINK_SIGNATURE_INVALID,
|
TALER_EC_REVEAL_LINK_SIGNATURE_INVALID,
|
||||||
"link_sig");
|
"link_sig");
|
||||||
@ -710,7 +711,7 @@ resolve_refreshes_reveal_denominations (struct TEH_KS_StateHandle *key_state,
|
|||||||
if (NULL == rctx->ev_sigs[i].rsa_signature)
|
if (NULL == rctx->ev_sigs[i].rsa_signature)
|
||||||
{
|
{
|
||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
res = TALER_MHD_reply_with_error (connection,
|
ret = TALER_MHD_reply_with_error (connection,
|
||||||
MHD_HTTP_INTERNAL_SERVER_ERROR,
|
MHD_HTTP_INTERNAL_SERVER_ERROR,
|
||||||
TALER_EC_REVEAL_SIGNING_ERROR,
|
TALER_EC_REVEAL_SIGNING_ERROR,
|
||||||
"internal signing error");
|
"internal signing error");
|
||||||
@ -729,17 +730,17 @@ resolve_refreshes_reveal_denominations (struct TEH_KS_StateHandle *key_state,
|
|||||||
if ( (GNUNET_OK ==
|
if ( (GNUNET_OK ==
|
||||||
TEH_DB_run_transaction (connection,
|
TEH_DB_run_transaction (connection,
|
||||||
"reveal pre-check",
|
"reveal pre-check",
|
||||||
&res,
|
&ret,
|
||||||
&refreshes_reveal_preflight,
|
&refreshes_reveal_preflight,
|
||||||
rctx)) &&
|
rctx)) &&
|
||||||
(GNUNET_YES == rctx->preflight_ok) )
|
(GNUNET_YES == rctx->preflight_ok) )
|
||||||
{
|
{
|
||||||
/* Generate final (positive) response */
|
/* Generate final (positive) response */
|
||||||
GNUNET_assert (NULL != rctx->ev_sigs);
|
GNUNET_assert (NULL != rctx->ev_sigs);
|
||||||
res = reply_refreshes_reveal_success (connection,
|
ret = reply_refreshes_reveal_success (connection,
|
||||||
num_fresh_coins,
|
num_fresh_coins,
|
||||||
rctx->ev_sigs);
|
rctx->ev_sigs);
|
||||||
GNUNET_break (MHD_NO != res);
|
GNUNET_break (MHD_NO != ret);
|
||||||
goto cleanup; /* aka 'break' */
|
goto cleanup; /* aka 'break' */
|
||||||
}
|
}
|
||||||
if (GNUNET_SYSERR == rctx->preflight_ok)
|
if (GNUNET_SYSERR == rctx->preflight_ok)
|
||||||
@ -750,7 +751,7 @@ resolve_refreshes_reveal_denominations (struct TEH_KS_StateHandle *key_state,
|
|||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
TEH_DB_run_transaction (connection,
|
TEH_DB_run_transaction (connection,
|
||||||
"run reveal",
|
"run reveal",
|
||||||
&res,
|
&ret,
|
||||||
&refreshes_reveal_transaction,
|
&refreshes_reveal_transaction,
|
||||||
rctx))
|
rctx))
|
||||||
{
|
{
|
||||||
@ -761,13 +762,13 @@ resolve_refreshes_reveal_denominations (struct TEH_KS_StateHandle *key_state,
|
|||||||
if (GNUNET_OK ==
|
if (GNUNET_OK ==
|
||||||
TEH_DB_run_transaction (connection,
|
TEH_DB_run_transaction (connection,
|
||||||
"persist reveal",
|
"persist reveal",
|
||||||
&res,
|
&ret,
|
||||||
&refreshes_reveal_persist,
|
&refreshes_reveal_persist,
|
||||||
rctx))
|
rctx))
|
||||||
{
|
{
|
||||||
/* Generate final (positive) response */
|
/* Generate final (positive) response */
|
||||||
GNUNET_assert (NULL != rctx->ev_sigs);
|
GNUNET_assert (NULL != rctx->ev_sigs);
|
||||||
res = reply_refreshes_reveal_success (connection,
|
ret = reply_refreshes_reveal_success (connection,
|
||||||
num_fresh_coins,
|
num_fresh_coins,
|
||||||
rctx->ev_sigs);
|
rctx->ev_sigs);
|
||||||
break;
|
break;
|
||||||
@ -778,7 +779,7 @@ resolve_refreshes_reveal_denominations (struct TEH_KS_StateHandle *key_state,
|
|||||||
} /* end for (retries...) */
|
} /* end for (retries...) */
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
GNUNET_break (MHD_NO != res);
|
GNUNET_break (MHD_NO != ret);
|
||||||
/* free resources */
|
/* free resources */
|
||||||
if (NULL != rctx->ev_sigs)
|
if (NULL != rctx->ev_sigs)
|
||||||
{
|
{
|
||||||
@ -790,7 +791,7 @@ cleanup:
|
|||||||
}
|
}
|
||||||
for (unsigned int i = 0; i<num_fresh_coins; i++)
|
for (unsigned int i = 0; i<num_fresh_coins; i++)
|
||||||
GNUNET_free_non_null (rcds[i].coin_ev);
|
GNUNET_free_non_null (rcds[i].coin_ev);
|
||||||
return res;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -908,7 +909,7 @@ handle_refreshes_reveal_json (struct MHD_Connection *connection,
|
|||||||
* @param args array of additional options (length: 2, session hash and the string "reveal")
|
* @param args array of additional options (length: 2, session hash and the string "reveal")
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TEH_handler_reveal (const struct TEH_RequestHandler *rh,
|
TEH_handler_reveal (const struct TEH_RequestHandler *rh,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
const json_t *root,
|
const json_t *root,
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
* @param args array of additional options (length: 2, session hash and the string "reveal")
|
* @param args array of additional options (length: 2, session hash and the string "reveal")
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TEH_handler_reveal (const struct TEH_RequestHandler *rh,
|
TEH_handler_reveal (const struct TEH_RequestHandler *rh,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
const json_t *root,
|
const json_t *root,
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
* @param refund details about the successful refund
|
* @param refund details about the successful refund
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
static int
|
static MHD_RESULT
|
||||||
reply_refund_success (struct MHD_Connection *connection,
|
reply_refund_success (struct MHD_Connection *connection,
|
||||||
const struct TALER_CoinSpendPublicKeyP *coin_pub,
|
const struct TALER_CoinSpendPublicKeyP *coin_pub,
|
||||||
const struct TALER_EXCHANGEDB_RefundListEntry *refund)
|
const struct TALER_EXCHANGEDB_RefundListEntry *refund)
|
||||||
@ -104,7 +104,7 @@ static enum GNUNET_DB_QueryStatus
|
|||||||
refund_transaction (void *cls,
|
refund_transaction (void *cls,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
struct TALER_EXCHANGEDB_Session *session,
|
struct TALER_EXCHANGEDB_Session *session,
|
||||||
int *mhd_ret)
|
MHD_RESULT *mhd_ret)
|
||||||
{
|
{
|
||||||
const struct TALER_EXCHANGEDB_Refund *refund = cls;
|
const struct TALER_EXCHANGEDB_Refund *refund = cls;
|
||||||
struct TALER_EXCHANGEDB_TransactionList *tl;
|
struct TALER_EXCHANGEDB_TransactionList *tl;
|
||||||
@ -342,7 +342,7 @@ refund_transaction (void *cls,
|
|||||||
* @param refund information about the refund
|
* @param refund information about the refund
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
static int
|
static MHD_RESULT
|
||||||
verify_and_execute_refund (struct MHD_Connection *connection,
|
verify_and_execute_refund (struct MHD_Connection *connection,
|
||||||
const struct TALER_EXCHANGEDB_Refund *refund)
|
const struct TALER_EXCHANGEDB_Refund *refund)
|
||||||
{
|
{
|
||||||
@ -468,7 +468,7 @@ verify_and_execute_refund (struct MHD_Connection *connection,
|
|||||||
|
|
||||||
/* Finally run the actual transaction logic */
|
/* Finally run the actual transaction logic */
|
||||||
{
|
{
|
||||||
int mhd_ret;
|
MHD_RESULT mhd_ret;
|
||||||
|
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
TEH_DB_run_transaction (connection,
|
TEH_DB_run_transaction (connection,
|
||||||
@ -497,7 +497,7 @@ verify_and_execute_refund (struct MHD_Connection *connection,
|
|||||||
* @param root uploaded JSON data
|
* @param root uploaded JSON data
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TEH_handler_refund (struct MHD_Connection *connection,
|
TEH_handler_refund (struct MHD_Connection *connection,
|
||||||
const struct TALER_CoinSpendPublicKeyP *coin_pub,
|
const struct TALER_CoinSpendPublicKeyP *coin_pub,
|
||||||
const json_t *root)
|
const json_t *root)
|
||||||
@ -517,7 +517,7 @@ TEH_handler_refund (struct MHD_Connection *connection,
|
|||||||
|
|
||||||
refund.coin.coin_pub = *coin_pub;
|
refund.coin.coin_pub = *coin_pub;
|
||||||
{
|
{
|
||||||
int res;
|
enum GNUNET_GenericReturnValue res;
|
||||||
|
|
||||||
res = TALER_MHD_parse_json_data (connection,
|
res = TALER_MHD_parse_json_data (connection,
|
||||||
root,
|
root,
|
||||||
@ -549,7 +549,7 @@ TEH_handler_refund (struct MHD_Connection *connection,
|
|||||||
"refund_amount");
|
"refund_amount");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
int res;
|
MHD_RESULT res;
|
||||||
|
|
||||||
res = verify_and_execute_refund (connection,
|
res = verify_and_execute_refund (connection,
|
||||||
&refund);
|
&refund);
|
||||||
|
@ -38,8 +38,8 @@
|
|||||||
* @param coin_pub public key of the coin
|
* @param coin_pub public key of the coin
|
||||||
* @param root uploaded JSON data
|
* @param root uploaded JSON data
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TEH_handler_refund (struct MHD_Connection *connection,
|
TEH_handler_refund (struct MHD_Connection *connection,
|
||||||
const struct TALER_CoinSpendPublicKeyP *coin_pub,
|
const struct TALER_CoinSpendPublicKeyP *coin_pub,
|
||||||
const json_t *root);
|
const json_t *root);
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
* @param rh reserve history to return
|
* @param rh reserve history to return
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
static int
|
static MHD_RESULT
|
||||||
reply_reserve_history_success (struct MHD_Connection *connection,
|
reply_reserve_history_success (struct MHD_Connection *connection,
|
||||||
const struct TALER_EXCHANGEDB_ReserveHistory *rh)
|
const struct TALER_EXCHANGEDB_ReserveHistory *rh)
|
||||||
{
|
{
|
||||||
@ -100,7 +100,7 @@ static enum GNUNET_DB_QueryStatus
|
|||||||
reserve_history_transaction (void *cls,
|
reserve_history_transaction (void *cls,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
struct TALER_EXCHANGEDB_Session *session,
|
struct TALER_EXCHANGEDB_Session *session,
|
||||||
int *mhd_ret)
|
MHD_RESULT *mhd_ret)
|
||||||
{
|
{
|
||||||
struct ReserveHistoryContext *rsc = cls;
|
struct ReserveHistoryContext *rsc = cls;
|
||||||
|
|
||||||
@ -124,13 +124,13 @@ reserve_history_transaction (void *cls,
|
|||||||
* @param args array of additional options (length: 1, just the reserve_pub)
|
* @param args array of additional options (length: 1, just the reserve_pub)
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TEH_handler_reserves_get (const struct TEH_RequestHandler *rh,
|
TEH_handler_reserves_get (const struct TEH_RequestHandler *rh,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
const char *const args[1])
|
const char *const args[1])
|
||||||
{
|
{
|
||||||
struct ReserveHistoryContext rsc;
|
struct ReserveHistoryContext rsc;
|
||||||
int mhd_ret;
|
MHD_RESULT mhd_ret;
|
||||||
|
|
||||||
(void) rh;
|
(void) rh;
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
* @param args array of additional options (length: 1, just the reserve_pub)
|
* @param args array of additional options (length: 1, just the reserve_pub)
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TEH_handler_reserves_get (const struct TEH_RequestHandler *rh,
|
TEH_handler_reserves_get (const struct TEH_RequestHandler *rh,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
const char *const args[1]);
|
const char *const args[1]);
|
||||||
|
@ -411,7 +411,7 @@ TEH_RESPONSE_compile_transaction_history (
|
|||||||
* @param tl transaction list to use to build reply
|
* @param tl transaction list to use to build reply
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TEH_RESPONSE_reply_coin_insufficient_funds (
|
TEH_RESPONSE_reply_coin_insufficient_funds (
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
enum TALER_ErrorCode ec,
|
enum TALER_ErrorCode ec,
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#include "taler_error_codes.h"
|
#include "taler_error_codes.h"
|
||||||
#include "taler-exchange-httpd.h"
|
#include "taler-exchange-httpd.h"
|
||||||
#include "taler-exchange-httpd_db.h"
|
#include "taler-exchange-httpd_db.h"
|
||||||
|
#include <gnunet/gnunet_mhd_compat.h>
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -59,7 +60,7 @@ TEH_RESPONSE_compile_reserve_history (
|
|||||||
* @param tl transaction list to use to build reply
|
* @param tl transaction list to use to build reply
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TEH_RESPONSE_reply_coin_insufficient_funds (
|
TEH_RESPONSE_reply_coin_insufficient_funds (
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
enum TALER_ErrorCode ec,
|
enum TALER_ErrorCode ec,
|
||||||
|
@ -46,7 +46,7 @@ static struct TALER_MHD_Legal *pp;
|
|||||||
* @param args array of additional options (must be empty for this function)
|
* @param args array of additional options (must be empty for this function)
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TEH_handler_terms (const struct TEH_RequestHandler *rh,
|
TEH_handler_terms (const struct TEH_RequestHandler *rh,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
const char *const args[])
|
const char *const args[])
|
||||||
@ -66,7 +66,7 @@ TEH_handler_terms (const struct TEH_RequestHandler *rh,
|
|||||||
* @param args array of additional options (must be empty for this function)
|
* @param args array of additional options (must be empty for this function)
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TEH_handler_privacy (const struct TEH_RequestHandler *rh,
|
TEH_handler_privacy (const struct TEH_RequestHandler *rh,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
const char *const args[])
|
const char *const args[])
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
* @param args array of additional options (must be empty for this function)
|
* @param args array of additional options (must be empty for this function)
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TEH_handler_terms (const struct TEH_RequestHandler *rh,
|
TEH_handler_terms (const struct TEH_RequestHandler *rh,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
const char *const args[]);
|
const char *const args[]);
|
||||||
@ -51,7 +51,7 @@ TEH_handler_terms (const struct TEH_RequestHandler *rh,
|
|||||||
* @param args array of additional options (must be empty for this function)
|
* @param args array of additional options (must be empty for this function)
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TEH_handler_privacy (const struct TEH_RequestHandler *rh,
|
TEH_handler_privacy (const struct TEH_RequestHandler *rh,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
const char *const args[]);
|
const char *const args[]);
|
||||||
|
@ -83,7 +83,7 @@ struct AggregatedDepositDetail
|
|||||||
* @param wdd_head linked list with details about the combined deposits
|
* @param wdd_head linked list with details about the combined deposits
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
static int
|
static MHD_RESULT
|
||||||
reply_transfer_details (struct MHD_Connection *connection,
|
reply_transfer_details (struct MHD_Connection *connection,
|
||||||
const struct TALER_Amount *total,
|
const struct TALER_Amount *total,
|
||||||
const struct TALER_MerchantPublicKeyP *merchant_pub,
|
const struct TALER_MerchantPublicKeyP *merchant_pub,
|
||||||
@ -421,7 +421,7 @@ static enum GNUNET_DB_QueryStatus
|
|||||||
get_transfer_deposits (void *cls,
|
get_transfer_deposits (void *cls,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
struct TALER_EXCHANGEDB_Session *session,
|
struct TALER_EXCHANGEDB_Session *session,
|
||||||
int *mhd_ret)
|
MHD_RESULT *mhd_ret)
|
||||||
{
|
{
|
||||||
struct WtidTransactionContext *ctx = cls;
|
struct WtidTransactionContext *ctx = cls;
|
||||||
enum GNUNET_DB_QueryStatus qs;
|
enum GNUNET_DB_QueryStatus qs;
|
||||||
@ -513,13 +513,13 @@ get_transfer_deposits (void *cls,
|
|||||||
* @param args array of additional options (length: 1, just the wtid)
|
* @param args array of additional options (length: 1, just the wtid)
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TEH_handler_transfers_get (const struct TEH_RequestHandler *rh,
|
TEH_handler_transfers_get (const struct TEH_RequestHandler *rh,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
const char *const args[1])
|
const char *const args[1])
|
||||||
{
|
{
|
||||||
struct WtidTransactionContext ctx;
|
struct WtidTransactionContext ctx;
|
||||||
int mhd_ret;
|
MHD_RESULT mhd_ret;
|
||||||
|
|
||||||
(void) rh;
|
(void) rh;
|
||||||
memset (&ctx,
|
memset (&ctx,
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
* @param args array of additional options (length: 1, just the wtid)
|
* @param args array of additional options (length: 1, just the wtid)
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TEH_handler_transfers_get (const struct TEH_RequestHandler *rh,
|
TEH_handler_transfers_get (const struct TEH_RequestHandler *rh,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
const char *const args[1]);
|
const char *const args[1]);
|
||||||
|
@ -295,7 +295,7 @@ load_account (void *cls,
|
|||||||
* @param args array of additional options (must be empty for this function)
|
* @param args array of additional options (must be empty for this function)
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TEH_handler_wire (const struct TEH_RequestHandler *rh,
|
TEH_handler_wire (const struct TEH_RequestHandler *rh,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
const char *const args[])
|
const char *const args[])
|
||||||
|
@ -52,7 +52,7 @@ TEH_WIRE_done (void);
|
|||||||
* @param args array of additional options (must be empty for this function)
|
* @param args array of additional options (must be empty for this function)
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TEH_handler_wire (const struct TEH_RequestHandler *rh,
|
TEH_handler_wire (const struct TEH_RequestHandler *rh,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
const char *const args[]);
|
const char *const args[]);
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
* @param rh reserve history to return
|
* @param rh reserve history to return
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
static int
|
static MHD_RESULT
|
||||||
reply_withdraw_insufficient_funds (
|
reply_withdraw_insufficient_funds (
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
const struct TALER_Amount *ebalance,
|
const struct TALER_Amount *ebalance,
|
||||||
@ -173,7 +173,7 @@ static enum GNUNET_DB_QueryStatus
|
|||||||
withdraw_transaction (void *cls,
|
withdraw_transaction (void *cls,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
struct TALER_EXCHANGEDB_Session *session,
|
struct TALER_EXCHANGEDB_Session *session,
|
||||||
int *mhd_ret)
|
MHD_RESULT *mhd_ret)
|
||||||
{
|
{
|
||||||
struct WithdrawContext *wc = cls;
|
struct WithdrawContext *wc = cls;
|
||||||
struct TALER_EXCHANGEDB_Reserve r;
|
struct TALER_EXCHANGEDB_Reserve r;
|
||||||
@ -343,7 +343,7 @@ withdraw_transaction (void *cls,
|
|||||||
* reserve public key, the second one should be "withdraw")
|
* reserve public key, the second one should be "withdraw")
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TEH_handler_withdraw (const struct TEH_RequestHandler *rh,
|
TEH_handler_withdraw (const struct TEH_RequestHandler *rh,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
const json_t *root,
|
const json_t *root,
|
||||||
@ -376,7 +376,7 @@ TEH_handler_withdraw (const struct TEH_RequestHandler *rh,
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
int res;
|
enum GNUNET_GenericReturnValue res;
|
||||||
|
|
||||||
res = TALER_MHD_parse_json_data (connection,
|
res = TALER_MHD_parse_json_data (connection,
|
||||||
root,
|
root,
|
||||||
@ -486,7 +486,7 @@ TEH_handler_withdraw (const struct TEH_RequestHandler *rh,
|
|||||||
|
|
||||||
/* run transaction and sign (if not optimistically signed before) */
|
/* run transaction and sign (if not optimistically signed before) */
|
||||||
{
|
{
|
||||||
int mhd_ret;
|
MHD_RESULT mhd_ret;
|
||||||
|
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
TEH_DB_run_transaction (connection,
|
TEH_DB_run_transaction (connection,
|
||||||
@ -510,7 +510,7 @@ TEH_handler_withdraw (const struct TEH_RequestHandler *rh,
|
|||||||
GNUNET_JSON_parse_free (spec);
|
GNUNET_JSON_parse_free (spec);
|
||||||
|
|
||||||
{
|
{
|
||||||
int ret;
|
MHD_RESULT ret;
|
||||||
|
|
||||||
ret = TALER_MHD_reply_json_pack (
|
ret = TALER_MHD_reply_json_pack (
|
||||||
connection,
|
connection,
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
* reserve public key, the second one should be "withdraw")
|
* reserve public key, the second one should be "withdraw")
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TEH_handler_withdraw (const struct TEH_RequestHandler *rh,
|
TEH_handler_withdraw (const struct TEH_RequestHandler *rh,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
const json_t *root,
|
const json_t *root,
|
||||||
|
@ -27,6 +27,8 @@
|
|||||||
#include <jansson.h>
|
#include <jansson.h>
|
||||||
#include <microhttpd.h>
|
#include <microhttpd.h>
|
||||||
#include "taler_error_codes.h"
|
#include "taler_error_codes.h"
|
||||||
|
#include <gnunet/gnunet_mhd_compat.h>
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Global options for response generation.
|
* Global options for response generation.
|
||||||
@ -79,7 +81,7 @@ TALER_MHD_add_global_headers (struct MHD_Response *response);
|
|||||||
* @param[in,out] buf_size pointer to initial size of @a buf
|
* @param[in,out] buf_size pointer to initial size of @a buf
|
||||||
* @return #MHD_YES if @a buf was compressed
|
* @return #MHD_YES if @a buf was compressed
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TALER_MHD_body_compress (void **buf,
|
TALER_MHD_body_compress (void **buf,
|
||||||
size_t *buf_size);
|
size_t *buf_size);
|
||||||
|
|
||||||
@ -90,7 +92,7 @@ TALER_MHD_body_compress (void **buf,
|
|||||||
* @param connection connection to check
|
* @param connection connection to check
|
||||||
* @return #MHD_YES if 'deflate' compression is allowed
|
* @return #MHD_YES if 'deflate' compression is allowed
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TALER_MHD_can_compress (struct MHD_Connection *connection);
|
TALER_MHD_can_compress (struct MHD_Connection *connection);
|
||||||
|
|
||||||
|
|
||||||
@ -102,7 +104,7 @@ TALER_MHD_can_compress (struct MHD_Connection *connection);
|
|||||||
* @param response_code the http response code
|
* @param response_code the http response code
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TALER_MHD_reply_json (struct MHD_Connection *connection,
|
TALER_MHD_reply_json (struct MHD_Connection *connection,
|
||||||
const json_t *json,
|
const json_t *json,
|
||||||
unsigned int response_code);
|
unsigned int response_code);
|
||||||
@ -118,7 +120,7 @@ TALER_MHD_reply_json (struct MHD_Connection *connection,
|
|||||||
* @param ... varargs
|
* @param ... varargs
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TALER_MHD_reply_json_pack (struct MHD_Connection *connection,
|
TALER_MHD_reply_json_pack (struct MHD_Connection *connection,
|
||||||
unsigned int response_code,
|
unsigned int response_code,
|
||||||
const char *fmt,
|
const char *fmt,
|
||||||
@ -134,7 +136,7 @@ TALER_MHD_reply_json_pack (struct MHD_Connection *connection,
|
|||||||
* @param hint human readable hint about the error
|
* @param hint human readable hint about the error
|
||||||
* @return a MHD result code
|
* @return a MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TALER_MHD_reply_with_error (struct MHD_Connection *connection,
|
TALER_MHD_reply_with_error (struct MHD_Connection *connection,
|
||||||
unsigned int http_status,
|
unsigned int http_status,
|
||||||
enum TALER_ErrorCode ec,
|
enum TALER_ErrorCode ec,
|
||||||
@ -181,7 +183,7 @@ TALER_MHD_make_error (enum TALER_ErrorCode ec,
|
|||||||
* @param connection the MHD connection to use
|
* @param connection the MHD connection to use
|
||||||
* @return a MHD result code
|
* @return a MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TALER_MHD_reply_request_too_large (struct MHD_Connection *connection);
|
TALER_MHD_reply_request_too_large (struct MHD_Connection *connection);
|
||||||
|
|
||||||
|
|
||||||
@ -193,7 +195,7 @@ TALER_MHD_reply_request_too_large (struct MHD_Connection *connection);
|
|||||||
* @param url where to redirect for the sources
|
* @param url where to redirect for the sources
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TALER_MHD_reply_agpl (struct MHD_Connection *connection,
|
TALER_MHD_reply_agpl (struct MHD_Connection *connection,
|
||||||
const char *url);
|
const char *url);
|
||||||
|
|
||||||
@ -209,7 +211,7 @@ TALER_MHD_reply_agpl (struct MHD_Connection *connection,
|
|||||||
* @param body_size number of bytes in @a body
|
* @param body_size number of bytes in @a body
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TALER_MHD_reply_static (struct MHD_Connection *connection,
|
TALER_MHD_reply_static (struct MHD_Connection *connection,
|
||||||
unsigned int http_status,
|
unsigned int http_status,
|
||||||
const char *mime_type,
|
const char *mime_type,
|
||||||
@ -241,7 +243,7 @@ TALER_MHD_reply_static (struct MHD_Connection *connection,
|
|||||||
* (we could not even queue an error message,
|
* (we could not even queue an error message,
|
||||||
* close HTTP session with MHD_NO)
|
* close HTTP session with MHD_NO)
|
||||||
*/
|
*/
|
||||||
int
|
enum GNUNET_GenericReturnValue
|
||||||
TALER_MHD_parse_post_json (struct MHD_Connection *connection,
|
TALER_MHD_parse_post_json (struct MHD_Connection *connection,
|
||||||
void **con_cls,
|
void **con_cls,
|
||||||
const char *upload_data,
|
const char *upload_data,
|
||||||
@ -274,7 +276,7 @@ TALER_MHD_parse_post_cleanup_callback (void *con_cls);
|
|||||||
* #GNUNET_NO if json is malformed, error response was generated
|
* #GNUNET_NO if json is malformed, error response was generated
|
||||||
* #GNUNET_SYSERR on internal error
|
* #GNUNET_SYSERR on internal error
|
||||||
*/
|
*/
|
||||||
int
|
enum GNUNET_GenericReturnValue
|
||||||
TALER_MHD_parse_json_data (struct MHD_Connection *connection,
|
TALER_MHD_parse_json_data (struct MHD_Connection *connection,
|
||||||
const json_t *root,
|
const json_t *root,
|
||||||
struct GNUNET_JSON_Specification *spec);
|
struct GNUNET_JSON_Specification *spec);
|
||||||
@ -295,7 +297,7 @@ TALER_MHD_parse_json_data (struct MHD_Connection *connection,
|
|||||||
* #GNUNET_NO if json is malformed, error response was generated
|
* #GNUNET_NO if json is malformed, error response was generated
|
||||||
* #GNUNET_SYSERR on internal error
|
* #GNUNET_SYSERR on internal error
|
||||||
*/
|
*/
|
||||||
int
|
enum GNUNET_GenericReturnValue
|
||||||
TALER_MHD_parse_json_array (struct MHD_Connection *connection,
|
TALER_MHD_parse_json_array (struct MHD_Connection *connection,
|
||||||
const json_t *root,
|
const json_t *root,
|
||||||
struct GNUNET_JSON_Specification *spec,
|
struct GNUNET_JSON_Specification *spec,
|
||||||
@ -317,7 +319,7 @@ TALER_MHD_parse_json_array (struct MHD_Connection *connection,
|
|||||||
* #GNUNET_NO if the argument is absent or malformed
|
* #GNUNET_NO if the argument is absent or malformed
|
||||||
* #GNUNET_SYSERR on internal error (error response could not be sent)
|
* #GNUNET_SYSERR on internal error (error response could not be sent)
|
||||||
*/
|
*/
|
||||||
int
|
enum GNUNET_GenericReturnValue
|
||||||
TALER_MHD_parse_request_arg_data (struct MHD_Connection *connection,
|
TALER_MHD_parse_request_arg_data (struct MHD_Connection *connection,
|
||||||
const char *param_name,
|
const char *param_name,
|
||||||
void *out_data,
|
void *out_data,
|
||||||
@ -335,7 +337,7 @@ TALER_MHD_parse_request_arg_data (struct MHD_Connection *connection,
|
|||||||
* @param[out] unix_mode set to the mode to be used for @a unix_path
|
* @param[out] unix_mode set to the mode to be used for @a unix_path
|
||||||
* @return #GNUNET_OK on success
|
* @return #GNUNET_OK on success
|
||||||
*/
|
*/
|
||||||
int
|
enum GNUNET_GenericReturnValue
|
||||||
TALER_MHD_parse_config (const struct GNUNET_CONFIGURATION_Handle *cfg,
|
TALER_MHD_parse_config (const struct GNUNET_CONFIGURATION_Handle *cfg,
|
||||||
const char *section,
|
const char *section,
|
||||||
uint16_t *rport,
|
uint16_t *rport,
|
||||||
@ -431,7 +433,7 @@ TALER_MHD_legal_free (struct TALER_MHD_Legal *legal);
|
|||||||
* @param legal legal document to serve
|
* @param legal legal document to serve
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TALER_MHD_reply_legal (struct MHD_Connection *conn,
|
TALER_MHD_reply_legal (struct MHD_Connection *conn,
|
||||||
struct TALER_MHD_Legal *legal);
|
struct TALER_MHD_Legal *legal);
|
||||||
|
|
||||||
@ -443,7 +445,7 @@ TALER_MHD_reply_legal (struct MHD_Connection *conn,
|
|||||||
* @param connection the MHD connection
|
* @param connection the MHD connection
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TALER_MHD_reply_cors_preflight (struct MHD_Connection *connection);
|
TALER_MHD_reply_cors_preflight (struct MHD_Connection *connection);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
* @param[out] unix_mode set to the mode to be used for @a unix_path
|
* @param[out] unix_mode set to the mode to be used for @a unix_path
|
||||||
* @return #GNUNET_OK on success
|
* @return #GNUNET_OK on success
|
||||||
*/
|
*/
|
||||||
int
|
enum GNUNET_GenericReturnValue
|
||||||
TALER_MHD_parse_config (const struct GNUNET_CONFIGURATION_Handle *cfg,
|
TALER_MHD_parse_config (const struct GNUNET_CONFIGURATION_Handle *cfg,
|
||||||
const char *section,
|
const char *section,
|
||||||
uint16_t *rport,
|
uint16_t *rport,
|
||||||
|
@ -155,7 +155,7 @@ language_matches (const char *language_pattern,
|
|||||||
* @param legal legal document to serve
|
* @param legal legal document to serve
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TALER_MHD_reply_legal (struct MHD_Connection *conn,
|
TALER_MHD_reply_legal (struct MHD_Connection *conn,
|
||||||
struct TALER_MHD_Legal *legal)
|
struct TALER_MHD_Legal *legal)
|
||||||
{
|
{
|
||||||
@ -174,7 +174,7 @@ TALER_MHD_reply_legal (struct MHD_Connection *conn,
|
|||||||
(0 == strcasecmp (etag,
|
(0 == strcasecmp (etag,
|
||||||
legal->terms_etag)) )
|
legal->terms_etag)) )
|
||||||
{
|
{
|
||||||
int ret;
|
MHD_RESULT ret;
|
||||||
|
|
||||||
resp = MHD_create_response_from_buffer (0,
|
resp = MHD_create_response_from_buffer (0,
|
||||||
NULL,
|
NULL,
|
||||||
@ -292,7 +292,7 @@ TALER_MHD_reply_legal (struct MHD_Connection *conn,
|
|||||||
MHD_HTTP_HEADER_CONTENT_TYPE,
|
MHD_HTTP_HEADER_CONTENT_TYPE,
|
||||||
t->mime_type));
|
t->mime_type));
|
||||||
{
|
{
|
||||||
int ret;
|
MHD_RESULT ret;
|
||||||
|
|
||||||
ret = MHD_queue_response (conn,
|
ret = MHD_queue_response (conn,
|
||||||
MHD_HTTP_OK,
|
MHD_HTTP_OK,
|
||||||
|
@ -80,7 +80,7 @@ TALER_MHD_add_global_headers (struct MHD_Response *response)
|
|||||||
* itself. This should eventually be fixed, see also
|
* itself. This should eventually be fixed, see also
|
||||||
* https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
|
* https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TALER_MHD_can_compress (struct MHD_Connection *connection)
|
TALER_MHD_can_compress (struct MHD_Connection *connection)
|
||||||
{
|
{
|
||||||
const char *ae;
|
const char *ae;
|
||||||
@ -118,13 +118,13 @@ TALER_MHD_can_compress (struct MHD_Connection *connection)
|
|||||||
* @param[in,out] buf_size pointer to initial size of @a buf
|
* @param[in,out] buf_size pointer to initial size of @a buf
|
||||||
* @return #MHD_YES if @a buf was compressed
|
* @return #MHD_YES if @a buf was compressed
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TALER_MHD_body_compress (void **buf,
|
TALER_MHD_body_compress (void **buf,
|
||||||
size_t *buf_size)
|
size_t *buf_size)
|
||||||
{
|
{
|
||||||
Bytef *cbuf;
|
Bytef *cbuf;
|
||||||
uLongf cbuf_size;
|
uLongf cbuf_size;
|
||||||
int ret;
|
MHD_RESULT ret;
|
||||||
|
|
||||||
cbuf_size = compressBound (*buf_size);
|
cbuf_size = compressBound (*buf_size);
|
||||||
cbuf = malloc (cbuf_size);
|
cbuf = malloc (cbuf_size);
|
||||||
@ -193,7 +193,7 @@ TALER_MHD_make_json (const json_t *json)
|
|||||||
* @param response_code the http response code
|
* @param response_code the http response code
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TALER_MHD_reply_json (struct MHD_Connection *connection,
|
TALER_MHD_reply_json (struct MHD_Connection *connection,
|
||||||
const json_t *json,
|
const json_t *json,
|
||||||
unsigned int response_code)
|
unsigned int response_code)
|
||||||
@ -201,7 +201,7 @@ TALER_MHD_reply_json (struct MHD_Connection *connection,
|
|||||||
struct MHD_Response *response;
|
struct MHD_Response *response;
|
||||||
void *json_str;
|
void *json_str;
|
||||||
size_t json_len;
|
size_t json_len;
|
||||||
int is_compressed;
|
MHD_RESULT is_compressed;
|
||||||
|
|
||||||
json_str = json_dumps (json,
|
json_str = json_dumps (json,
|
||||||
JSON_INDENT (2));
|
JSON_INDENT (2));
|
||||||
@ -253,7 +253,7 @@ TALER_MHD_reply_json (struct MHD_Connection *connection,
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
int ret;
|
MHD_RESULT ret;
|
||||||
|
|
||||||
ret = MHD_queue_response (connection,
|
ret = MHD_queue_response (connection,
|
||||||
response_code,
|
response_code,
|
||||||
@ -271,7 +271,7 @@ TALER_MHD_reply_json (struct MHD_Connection *connection,
|
|||||||
* @param connection the MHD connection
|
* @param connection the MHD connection
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TALER_MHD_reply_cors_preflight (struct MHD_Connection *connection)
|
TALER_MHD_reply_cors_preflight (struct MHD_Connection *connection)
|
||||||
{
|
{
|
||||||
struct MHD_Response *response;
|
struct MHD_Response *response;
|
||||||
@ -291,7 +291,7 @@ TALER_MHD_reply_cors_preflight (struct MHD_Connection *connection)
|
|||||||
"*"));
|
"*"));
|
||||||
|
|
||||||
{
|
{
|
||||||
int ret;
|
MHD_RESULT ret;
|
||||||
|
|
||||||
ret = MHD_queue_response (connection,
|
ret = MHD_queue_response (connection,
|
||||||
MHD_HTTP_NO_CONTENT,
|
MHD_HTTP_NO_CONTENT,
|
||||||
@ -312,7 +312,7 @@ TALER_MHD_reply_cors_preflight (struct MHD_Connection *connection)
|
|||||||
* @param ... varargs
|
* @param ... varargs
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TALER_MHD_reply_json_pack (struct MHD_Connection *connection,
|
TALER_MHD_reply_json_pack (struct MHD_Connection *connection,
|
||||||
unsigned int response_code,
|
unsigned int response_code,
|
||||||
const char *fmt,
|
const char *fmt,
|
||||||
@ -344,7 +344,7 @@ TALER_MHD_reply_json_pack (struct MHD_Connection *connection,
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
int ret;
|
MHD_RESULT ret;
|
||||||
|
|
||||||
ret = TALER_MHD_reply_json (connection,
|
ret = TALER_MHD_reply_json (connection,
|
||||||
json,
|
json,
|
||||||
@ -426,7 +426,7 @@ TALER_MHD_make_error (enum TALER_ErrorCode ec,
|
|||||||
* @param hint human readable hint about the error
|
* @param hint human readable hint about the error
|
||||||
* @return a MHD result code
|
* @return a MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TALER_MHD_reply_with_error (struct MHD_Connection *connection,
|
TALER_MHD_reply_with_error (struct MHD_Connection *connection,
|
||||||
unsigned int http_status,
|
unsigned int http_status,
|
||||||
enum TALER_ErrorCode ec,
|
enum TALER_ErrorCode ec,
|
||||||
@ -446,7 +446,7 @@ TALER_MHD_reply_with_error (struct MHD_Connection *connection,
|
|||||||
* @param connection the MHD connection to use
|
* @param connection the MHD connection to use
|
||||||
* @return a MHD result code
|
* @return a MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TALER_MHD_reply_request_too_large (struct MHD_Connection *connection)
|
TALER_MHD_reply_request_too_large (struct MHD_Connection *connection)
|
||||||
{
|
{
|
||||||
struct MHD_Response *response;
|
struct MHD_Response *response;
|
||||||
@ -459,7 +459,7 @@ TALER_MHD_reply_request_too_large (struct MHD_Connection *connection)
|
|||||||
TALER_MHD_add_global_headers (response);
|
TALER_MHD_add_global_headers (response);
|
||||||
|
|
||||||
{
|
{
|
||||||
int ret;
|
MHD_RESULT ret;
|
||||||
|
|
||||||
ret = MHD_queue_response (connection,
|
ret = MHD_queue_response (connection,
|
||||||
MHD_HTTP_REQUEST_ENTITY_TOO_LARGE,
|
MHD_HTTP_REQUEST_ENTITY_TOO_LARGE,
|
||||||
@ -478,7 +478,7 @@ TALER_MHD_reply_request_too_large (struct MHD_Connection *connection)
|
|||||||
* @param url where to redirect for the sources
|
* @param url where to redirect for the sources
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TALER_MHD_reply_agpl (struct MHD_Connection *connection,
|
TALER_MHD_reply_agpl (struct MHD_Connection *connection,
|
||||||
const char *url)
|
const char *url)
|
||||||
{
|
{
|
||||||
@ -510,7 +510,7 @@ TALER_MHD_reply_agpl (struct MHD_Connection *connection,
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
int ret;
|
MHD_RESULT ret;
|
||||||
|
|
||||||
ret = MHD_queue_response (connection,
|
ret = MHD_queue_response (connection,
|
||||||
MHD_HTTP_FOUND,
|
MHD_HTTP_FOUND,
|
||||||
@ -532,7 +532,7 @@ TALER_MHD_reply_agpl (struct MHD_Connection *connection,
|
|||||||
* @param body_size number of bytes in @a body
|
* @param body_size number of bytes in @a body
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
int
|
MHD_RESULT
|
||||||
TALER_MHD_reply_static (struct MHD_Connection *connection,
|
TALER_MHD_reply_static (struct MHD_Connection *connection,
|
||||||
unsigned int http_status,
|
unsigned int http_status,
|
||||||
const char *mime_type,
|
const char *mime_type,
|
||||||
@ -556,7 +556,7 @@ TALER_MHD_reply_static (struct MHD_Connection *connection,
|
|||||||
MHD_HTTP_HEADER_CONTENT_TYPE,
|
MHD_HTTP_HEADER_CONTENT_TYPE,
|
||||||
mime_type));
|
mime_type));
|
||||||
{
|
{
|
||||||
int ret;
|
MHD_RESULT ret;
|
||||||
|
|
||||||
ret = MHD_queue_response (connection,
|
ret = MHD_queue_response (connection,
|
||||||
http_status,
|
http_status,
|
||||||
|
Loading…
Reference in New Issue
Block a user