turn libfakebank into libtalerfakebank so we can use it for testcases in the merchant
This commit is contained in:
parent
f2b2455992
commit
a7379930d2
@ -1,3 +1,7 @@
|
|||||||
|
Wed Jun 8 11:32:41 CEST 2016
|
||||||
|
Export libtalerfakebank API so we can use it in testcases for the
|
||||||
|
merchant as well. -CG
|
||||||
|
|
||||||
Tue Jun 7 15:13:46 CEST 2016
|
Tue Jun 7 15:13:46 CEST 2016
|
||||||
Adding public key of the exchange that was used to sign replies
|
Adding public key of the exchange that was used to sign replies
|
||||||
to applicable callbacks of libtalerexchange. (This will eventually
|
to applicable callbacks of libtalerexchange. (This will eventually
|
||||||
|
@ -7,10 +7,8 @@ if USE_COVERAGE
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
lib_LTLIBRARIES = \
|
lib_LTLIBRARIES = \
|
||||||
libtalerbank.la
|
libtalerbank.la \
|
||||||
|
libtalerfakebank.la
|
||||||
noinst_LTLIBRARIES = \
|
|
||||||
libfakebank.la
|
|
||||||
|
|
||||||
libtalerbank_la_LDFLAGS = \
|
libtalerbank_la_LDFLAGS = \
|
||||||
-version-info 0:0:0 \
|
-version-info 0:0:0 \
|
||||||
@ -27,10 +25,15 @@ libtalerbank_la_LIBADD = \
|
|||||||
-ljansson \
|
-ljansson \
|
||||||
$(XLIB)
|
$(XLIB)
|
||||||
|
|
||||||
libfakebank_la_SOURCES = \
|
|
||||||
fakebank.c fakebank.h
|
|
||||||
|
|
||||||
libfakebank_la_LIBADD = \
|
libtalerfakebank_la_LDFLAGS = \
|
||||||
|
-version-info 0:0:0 \
|
||||||
|
-no-undefined
|
||||||
|
|
||||||
|
libtalerfakebank_la_SOURCES = \
|
||||||
|
fakebank.c
|
||||||
|
|
||||||
|
libtalerfakebank_la_LIBADD = \
|
||||||
$(top_builddir)/src/json/libtalerjson.la \
|
$(top_builddir)/src/json/libtalerjson.la \
|
||||||
-lgnunetjson \
|
-lgnunetjson \
|
||||||
-lgnunetutil \
|
-lgnunetutil \
|
||||||
@ -58,7 +61,7 @@ test_bank_api_SOURCES = \
|
|||||||
test_bank_api.c
|
test_bank_api.c
|
||||||
test_bank_api_LDADD = \
|
test_bank_api_LDADD = \
|
||||||
libtalerbank.la \
|
libtalerbank.la \
|
||||||
libfakebank.la \
|
libtalerfakebank.la \
|
||||||
$(top_builddir)/src/util/libtalerutil.la \
|
$(top_builddir)/src/util/libtalerutil.la \
|
||||||
-lgnunetcurl \
|
-lgnunetcurl \
|
||||||
-lgnunetutil \
|
-lgnunetutil \
|
||||||
@ -70,7 +73,7 @@ test_bank_api_with_fakebank_SOURCES = \
|
|||||||
test_bank_api_with_fakebank.c
|
test_bank_api_with_fakebank.c
|
||||||
test_bank_api_with_fakebank_LDADD = \
|
test_bank_api_with_fakebank_LDADD = \
|
||||||
libtalerbank.la \
|
libtalerbank.la \
|
||||||
libfakebank.la \
|
libtalerfakebank.la \
|
||||||
$(top_builddir)/src/util/libtalerutil.la \
|
$(top_builddir)/src/util/libtalerutil.la \
|
||||||
-lgnunetcurl \
|
-lgnunetcurl \
|
||||||
-lgnunetutil \
|
-lgnunetutil \
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
#include "fakebank.h"
|
#include "taler_fakebank_lib.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maximum POST request size (for /admin/add/incoming)
|
* Maximum POST request size (for /admin/add/incoming)
|
||||||
@ -71,7 +71,7 @@ struct Transaction
|
|||||||
/**
|
/**
|
||||||
* Handle for the fake bank.
|
* Handle for the fake bank.
|
||||||
*/
|
*/
|
||||||
struct FAKEBANK_Handle
|
struct TALER_FAKEBANK_Handle
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* We store transactions in a DLL.
|
* We store transactions in a DLL.
|
||||||
@ -109,11 +109,11 @@ struct FAKEBANK_Handle
|
|||||||
* @return #GNUNET_OK on success
|
* @return #GNUNET_OK on success
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
FAKEBANK_check (struct FAKEBANK_Handle *h,
|
TALER_FAKEBANK_check (struct TALER_FAKEBANK_Handle *h,
|
||||||
const struct TALER_Amount *want_amount,
|
const struct TALER_Amount *want_amount,
|
||||||
uint64_t want_debit,
|
uint64_t want_debit,
|
||||||
uint64_t want_credit,
|
uint64_t want_credit,
|
||||||
struct TALER_WireTransferIdentifierRawP *wtid)
|
struct TALER_WireTransferIdentifierRawP *wtid)
|
||||||
{
|
{
|
||||||
struct Transaction *t;
|
struct Transaction *t;
|
||||||
|
|
||||||
@ -152,14 +152,14 @@ FAKEBANK_check (struct FAKEBANK_Handle *h,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Check that no wire transfers were ordered (or at least none
|
* Check that no wire transfers were ordered (or at least none
|
||||||
* that have not been taken care of via #FAKEBANK_check()).
|
* that have not been taken care of via #TALER_FAKEBANK_check()).
|
||||||
* If any transactions are onrecord, return #GNUNET_SYSERR.
|
* If any transactions are onrecord, return #GNUNET_SYSERR.
|
||||||
*
|
*
|
||||||
* @param h bank instance
|
* @param h bank instance
|
||||||
* @return #GNUNET_OK on success
|
* @return #GNUNET_OK on success
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
FAKEBANK_check_empty (struct FAKEBANK_Handle *h)
|
TALER_FAKEBANK_check_empty (struct TALER_FAKEBANK_Handle *h)
|
||||||
{
|
{
|
||||||
struct Transaction *t;
|
struct Transaction *t;
|
||||||
|
|
||||||
@ -190,7 +190,7 @@ FAKEBANK_check_empty (struct FAKEBANK_Handle *h)
|
|||||||
* @param h bank to stop
|
* @param h bank to stop
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
FAKEBANK_stop (struct FAKEBANK_Handle *h)
|
TALER_FAKEBANK_stop (struct TALER_FAKEBANK_Handle *h)
|
||||||
{
|
{
|
||||||
if (NULL != h->mhd_task)
|
if (NULL != h->mhd_task)
|
||||||
{
|
{
|
||||||
@ -226,7 +226,7 @@ handle_mhd_completion_callback (void *cls,
|
|||||||
void **con_cls,
|
void **con_cls,
|
||||||
enum MHD_RequestTerminationCode toe)
|
enum MHD_RequestTerminationCode toe)
|
||||||
{
|
{
|
||||||
/* struct FAKEBANK_Handle *h = cls; */
|
/* struct TALER_FAKEBANK_Handle *h = cls; */
|
||||||
|
|
||||||
GNUNET_JSON_post_parser_cleanup (*con_cls);
|
GNUNET_JSON_post_parser_cleanup (*con_cls);
|
||||||
*con_cls = NULL;
|
*con_cls = NULL;
|
||||||
@ -256,7 +256,7 @@ handle_mhd_request (void *cls,
|
|||||||
size_t *upload_data_size,
|
size_t *upload_data_size,
|
||||||
void **con_cls)
|
void **con_cls)
|
||||||
{
|
{
|
||||||
struct FAKEBANK_Handle *h = cls;
|
struct TALER_FAKEBANK_Handle *h = cls;
|
||||||
enum GNUNET_JSON_PostResult pr;
|
enum GNUNET_JSON_PostResult pr;
|
||||||
json_t *json;
|
json_t *json;
|
||||||
struct Transaction *t;
|
struct Transaction *t;
|
||||||
@ -331,7 +331,7 @@ handle_mhd_request (void *cls,
|
|||||||
/**
|
/**
|
||||||
* Task run whenever HTTP server operations are pending.
|
* Task run whenever HTTP server operations are pending.
|
||||||
*
|
*
|
||||||
* @param cls the `struct FAKEBANK_Handle`
|
* @param cls the `struct TALER_FAKEBANK_Handle`
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
run_mhd (void *cls);
|
run_mhd (void *cls);
|
||||||
@ -343,7 +343,7 @@ run_mhd (void *cls);
|
|||||||
* always be called later whenever there is work to be done.
|
* always be called later whenever there is work to be done.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
schedule_httpd (struct FAKEBANK_Handle *h)
|
schedule_httpd (struct TALER_FAKEBANK_Handle *h)
|
||||||
{
|
{
|
||||||
fd_set rs;
|
fd_set rs;
|
||||||
fd_set ws;
|
fd_set ws;
|
||||||
@ -399,12 +399,12 @@ schedule_httpd (struct FAKEBANK_Handle *h)
|
|||||||
/**
|
/**
|
||||||
* Task run whenever HTTP server operations are pending.
|
* Task run whenever HTTP server operations are pending.
|
||||||
*
|
*
|
||||||
* @param cls the `struct FAKEBANK_Handle`
|
* @param cls the `struct TALER_FAKEBANK_Handle`
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
run_mhd (void *cls)
|
run_mhd (void *cls)
|
||||||
{
|
{
|
||||||
struct FAKEBANK_Handle *h = cls;
|
struct TALER_FAKEBANK_Handle *h = cls;
|
||||||
|
|
||||||
h->mhd_task = NULL;
|
h->mhd_task = NULL;
|
||||||
MHD_run (h->mhd_bank);
|
MHD_run (h->mhd_bank);
|
||||||
@ -418,12 +418,12 @@ run_mhd (void *cls)
|
|||||||
* @param port port to listen to
|
* @param port port to listen to
|
||||||
* @return NULL on error
|
* @return NULL on error
|
||||||
*/
|
*/
|
||||||
struct FAKEBANK_Handle *
|
struct TALER_FAKEBANK_Handle *
|
||||||
FAKEBANK_start (uint16_t port)
|
TALER_FAKEBANK_start (uint16_t port)
|
||||||
{
|
{
|
||||||
struct FAKEBANK_Handle *h;
|
struct TALER_FAKEBANK_Handle *h;
|
||||||
|
|
||||||
h = GNUNET_new (struct FAKEBANK_Handle);
|
h = GNUNET_new (struct TALER_FAKEBANK_Handle);
|
||||||
h->mhd_bank = MHD_start_daemon (MHD_USE_DEBUG,
|
h->mhd_bank = MHD_start_daemon (MHD_USE_DEBUG,
|
||||||
port,
|
port,
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
#include <gnunet/gnunet_curl_lib.h>
|
#include <gnunet/gnunet_curl_lib.h>
|
||||||
#include <microhttpd.h>
|
#include <microhttpd.h>
|
||||||
#include "test_bank_interpreter.h"
|
#include "test_bank_interpreter.h"
|
||||||
#include "fakebank.h"
|
#include "taler_fakebank_lib.h"
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -72,7 +72,7 @@ struct InterpreterState
|
|||||||
/**
|
/**
|
||||||
* Fakebank, or NULL if we are not using the fakebank.
|
* Fakebank, or NULL if we are not using the fakebank.
|
||||||
*/
|
*/
|
||||||
struct FAKEBANK_Handle *fakebank;
|
struct TALER_FAKEBANK_Handle *fakebank;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instruction pointer. Tells #interpreter_run() which
|
* Instruction pointer. Tells #interpreter_run() which
|
||||||
@ -242,7 +242,7 @@ interpreter_run (void *cls)
|
|||||||
TALER_string_to_amount (ref->details.admin_add_incoming.amount,
|
TALER_string_to_amount (ref->details.admin_add_incoming.amount,
|
||||||
&amount));
|
&amount));
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
FAKEBANK_check (is->fakebank,
|
TALER_FAKEBANK_check (is->fakebank,
|
||||||
&amount,
|
&amount,
|
||||||
ref->details.admin_add_incoming.debit_account_no,
|
ref->details.admin_add_incoming.debit_account_no,
|
||||||
ref->details.admin_add_incoming.credit_account_no,
|
ref->details.admin_add_incoming.credit_account_no,
|
||||||
@ -265,7 +265,7 @@ interpreter_run (void *cls)
|
|||||||
is);
|
is);
|
||||||
return;
|
return;
|
||||||
case TBI_OC_EXPECT_TRANSFERS_EMPTY:
|
case TBI_OC_EXPECT_TRANSFERS_EMPTY:
|
||||||
if (GNUNET_OK != FAKEBANK_check_empty (is->fakebank))
|
if (GNUNET_OK != TALER_FAKEBANK_check_empty (is->fakebank))
|
||||||
{
|
{
|
||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
fail (is);
|
fail (is);
|
||||||
@ -355,7 +355,7 @@ do_shutdown (void *cls)
|
|||||||
}
|
}
|
||||||
if (NULL != is->fakebank)
|
if (NULL != is->fakebank)
|
||||||
{
|
{
|
||||||
FAKEBANK_stop (is->fakebank);
|
TALER_FAKEBANK_stop (is->fakebank);
|
||||||
is->fakebank = NULL;
|
is->fakebank = NULL;
|
||||||
}
|
}
|
||||||
GNUNET_CURL_fini (is->ctx);
|
GNUNET_CURL_fini (is->ctx);
|
||||||
@ -381,7 +381,7 @@ TBI_run_interpreter (int *resultp,
|
|||||||
|
|
||||||
is = GNUNET_new (struct InterpreterState);
|
is = GNUNET_new (struct InterpreterState);
|
||||||
if (GNUNET_YES == run_bank)
|
if (GNUNET_YES == run_bank)
|
||||||
is->fakebank = FAKEBANK_start (8081);
|
is->fakebank = TALER_FAKEBANK_start (8081);
|
||||||
is->resultp = resultp;
|
is->resultp = resultp;
|
||||||
is->commands = commands;
|
is->commands = commands;
|
||||||
is->ctx = GNUNET_CURL_init (&GNUNET_CURL_gnunet_scheduler_reschedule,
|
is->ctx = GNUNET_CURL_init (&GNUNET_CURL_gnunet_scheduler_reschedule,
|
||||||
|
@ -56,7 +56,7 @@ test_exchange_api_SOURCES = \
|
|||||||
test_exchange_api_LDADD = \
|
test_exchange_api_LDADD = \
|
||||||
libtalerexchange.la \
|
libtalerexchange.la \
|
||||||
$(LIBGCRYPT_LIBS) \
|
$(LIBGCRYPT_LIBS) \
|
||||||
$(top_builddir)/src/bank-lib/libfakebank.la \
|
$(top_builddir)/src/bank-lib/libtalerfakebank.la \
|
||||||
$(top_builddir)/src/json/libtalerjson.la \
|
$(top_builddir)/src/json/libtalerjson.la \
|
||||||
$(top_builddir)/src/util/libtalerutil.la \
|
$(top_builddir)/src/util/libtalerutil.la \
|
||||||
-lgnunetcurl \
|
-lgnunetcurl \
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
#include "taler_json_lib.h"
|
#include "taler_json_lib.h"
|
||||||
#include <gnunet/gnunet_util_lib.h>
|
#include <gnunet/gnunet_util_lib.h>
|
||||||
#include <microhttpd.h>
|
#include <microhttpd.h>
|
||||||
#include "fakebank.h"
|
#include "taler_fakebank_lib.h"
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -62,7 +62,7 @@ static struct GNUNET_SCHEDULER_Task *timeout_task;
|
|||||||
/**
|
/**
|
||||||
* Handle to our fakebank.
|
* Handle to our fakebank.
|
||||||
*/
|
*/
|
||||||
static struct FAKEBANK_Handle *fakebank;
|
static struct TALER_FAKEBANK_Handle *fakebank;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Result of the testcases, #GNUNET_OK on success
|
* Result of the testcases, #GNUNET_OK on success
|
||||||
@ -2252,7 +2252,7 @@ interpreter_run (void *cls)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
FAKEBANK_check (fakebank,
|
TALER_FAKEBANK_check (fakebank,
|
||||||
&amount,
|
&amount,
|
||||||
cmd->details.check_bank_transfer.account_debit,
|
cmd->details.check_bank_transfer.account_debit,
|
||||||
cmd->details.check_bank_transfer.account_credit,
|
cmd->details.check_bank_transfer.account_credit,
|
||||||
@ -2268,7 +2268,7 @@ interpreter_run (void *cls)
|
|||||||
case OC_CHECK_BANK_TRANSFERS_EMPTY:
|
case OC_CHECK_BANK_TRANSFERS_EMPTY:
|
||||||
{
|
{
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
FAKEBANK_check_empty (fakebank))
|
TALER_FAKEBANK_check_empty (fakebank))
|
||||||
{
|
{
|
||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
fail (is);
|
fail (is);
|
||||||
@ -2580,7 +2580,7 @@ do_shutdown (void *cls)
|
|||||||
GNUNET_free (is);
|
GNUNET_free (is);
|
||||||
if (NULL != fakebank)
|
if (NULL != fakebank)
|
||||||
{
|
{
|
||||||
FAKEBANK_stop (fakebank);
|
TALER_FAKEBANK_stop (fakebank);
|
||||||
fakebank = NULL;
|
fakebank = NULL;
|
||||||
}
|
}
|
||||||
if (NULL != exchange)
|
if (NULL != exchange)
|
||||||
@ -3012,7 +3012,7 @@ run (void *cls)
|
|||||||
&rc);
|
&rc);
|
||||||
GNUNET_assert (NULL != ctx);
|
GNUNET_assert (NULL != ctx);
|
||||||
rc = GNUNET_CURL_gnunet_rc_create (ctx);
|
rc = GNUNET_CURL_gnunet_rc_create (ctx);
|
||||||
fakebank = FAKEBANK_start (8082);
|
fakebank = TALER_FAKEBANK_start (8082);
|
||||||
exchange = TALER_EXCHANGE_connect (ctx,
|
exchange = TALER_EXCHANGE_connect (ctx,
|
||||||
"http://localhost:8081",
|
"http://localhost:8081",
|
||||||
&cert_cb, is,
|
&cert_cb, is,
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#include "taler_json_lib.h"
|
#include "taler_json_lib.h"
|
||||||
#include "taler_exchangedb_plugin.h"
|
#include "taler_exchangedb_plugin.h"
|
||||||
#include <microhttpd.h>
|
#include <microhttpd.h>
|
||||||
#include "fakebank.h"
|
#include "taler_fakebank_lib.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -247,7 +247,7 @@ static struct GNUNET_CRYPTO_RsaPublicKey *coin_pub;
|
|||||||
/**
|
/**
|
||||||
* Handle for our fake bank.
|
* Handle for our fake bank.
|
||||||
*/
|
*/
|
||||||
static struct FAKEBANK_Handle *fb;
|
static struct TALER_FAKEBANK_Handle *fb;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -295,7 +295,7 @@ shutdown_action (void *cls)
|
|||||||
}
|
}
|
||||||
if (NULL != fb)
|
if (NULL != fb)
|
||||||
{
|
{
|
||||||
FAKEBANK_stop (fb);
|
TALER_FAKEBANK_stop (fb);
|
||||||
fb = NULL;
|
fb = NULL;
|
||||||
}
|
}
|
||||||
if (NULL != child_death_task)
|
if (NULL != child_death_task)
|
||||||
@ -532,7 +532,7 @@ interpreter (void *cls)
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case OPCODE_EXPECT_TRANSACTIONS_EMPTY:
|
case OPCODE_EXPECT_TRANSACTIONS_EMPTY:
|
||||||
if (GNUNET_OK != FAKEBANK_check_empty (fb))
|
if (GNUNET_OK != TALER_FAKEBANK_check_empty (fb))
|
||||||
{
|
{
|
||||||
fail (cmd);
|
fail (cmd);
|
||||||
return;
|
return;
|
||||||
@ -561,7 +561,7 @@ interpreter (void *cls)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
FAKEBANK_check (fb,
|
TALER_FAKEBANK_check (fb,
|
||||||
&want_amount,
|
&want_amount,
|
||||||
cmd->details.expect_transaction.debit_account,
|
cmd->details.expect_transaction.debit_account,
|
||||||
cmd->details.expect_transaction.credit_account,
|
cmd->details.expect_transaction.credit_account,
|
||||||
@ -1179,7 +1179,7 @@ run (void *cls)
|
|||||||
&timeout_action,
|
&timeout_action,
|
||||||
NULL);
|
NULL);
|
||||||
result = 1; /* test failed for undefined reason */
|
result = 1; /* test failed for undefined reason */
|
||||||
fb = FAKEBANK_start (8082);
|
fb = TALER_FAKEBANK_start (8082);
|
||||||
if (NULL == fb)
|
if (NULL == fb)
|
||||||
{
|
{
|
||||||
GNUNET_SCHEDULER_shutdown ();
|
GNUNET_SCHEDULER_shutdown ();
|
||||||
|
@ -15,11 +15,12 @@ talerinclude_HEADERS = \
|
|||||||
taler_amount_lib.h \
|
taler_amount_lib.h \
|
||||||
taler_bank_service.h \
|
taler_bank_service.h \
|
||||||
taler_crypto_lib.h \
|
taler_crypto_lib.h \
|
||||||
taler_json_lib.h \
|
|
||||||
taler_util.h \
|
|
||||||
taler_exchange_service.h \
|
taler_exchange_service.h \
|
||||||
taler_exchangedb_lib.h \
|
taler_exchangedb_lib.h \
|
||||||
taler_exchangedb_plugin.h \
|
taler_exchangedb_plugin.h \
|
||||||
|
taler_fakebank_lib.h \
|
||||||
|
taler_json_lib.h \
|
||||||
|
taler_util.h \
|
||||||
taler_pq_lib.h \
|
taler_pq_lib.h \
|
||||||
taler_signatures.h \
|
taler_signatures.h \
|
||||||
taler_wire_lib.h \
|
taler_wire_lib.h \
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
* @brief API for a library that fakes being a Taler bank
|
* @brief API for a library that fakes being a Taler bank
|
||||||
* @author Christian Grothoff <christian@grothoff.org>
|
* @author Christian Grothoff <christian@grothoff.org>
|
||||||
*/
|
*/
|
||||||
#ifndef FAKEBANK_H
|
#ifndef TALER_FAKEBANK_H
|
||||||
#define FAKEBANK_H
|
#define TALER_FAKEBANK_H
|
||||||
|
|
||||||
#include "taler_util.h"
|
#include "taler_util.h"
|
||||||
#include <gnunet/gnunet_json_lib.h>
|
#include <gnunet/gnunet_json_lib.h>
|
||||||
@ -30,14 +30,14 @@
|
|||||||
/**
|
/**
|
||||||
* Handle for the fake bank.
|
* Handle for the fake bank.
|
||||||
*/
|
*/
|
||||||
struct FAKEBANK_Handle;
|
struct TALER_FAKEBANK_Handle;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start the fake bank. The fake bank will, like the normal bank,
|
* Start the fake bank. The fake bank will, like the normal bank,
|
||||||
* listen for requests for /admin/add/incoming. However, instead of
|
* listen for requests for /admin/add/incoming. However, instead of
|
||||||
* executing or storing those requests, it will simply allow querying
|
* executing or storing those requests, it will simply allow querying
|
||||||
* whether such a request has been made via #FAKEBANK_check().
|
* whether such a request has been made via #TALER_FAKEBANK_check().
|
||||||
*
|
*
|
||||||
* This is useful for writing testcases to check whether the exchange
|
* This is useful for writing testcases to check whether the exchange
|
||||||
* would have issued the correct wire transfer orders.
|
* would have issued the correct wire transfer orders.
|
||||||
@ -45,20 +45,20 @@ struct FAKEBANK_Handle;
|
|||||||
* @param port port to listen to
|
* @param port port to listen to
|
||||||
* @return NULL on error
|
* @return NULL on error
|
||||||
*/
|
*/
|
||||||
struct FAKEBANK_Handle *
|
struct TALER_FAKEBANK_Handle *
|
||||||
FAKEBANK_start (uint16_t port);
|
TALER_FAKEBANK_start (uint16_t port);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check that no wire transfers were ordered (or at least none
|
* Check that no wire transfers were ordered (or at least none
|
||||||
* that have not been taken care of via #FAKEBANK_check()).
|
* that have not been taken care of via #TALER_FAKEBANK_check()).
|
||||||
* If any transactions are onrecord, return #GNUNET_SYSERR.
|
* If any transactions are onrecord, return #GNUNET_SYSERR.
|
||||||
*
|
*
|
||||||
* @param h bank instance
|
* @param h bank instance
|
||||||
* @return #GNUNET_OK on success
|
* @return #GNUNET_OK on success
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
FAKEBANK_check_empty (struct FAKEBANK_Handle *h);
|
TALER_FAKEBANK_check_empty (struct TALER_FAKEBANK_Handle *h);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -75,7 +75,7 @@ FAKEBANK_check_empty (struct FAKEBANK_Handle *h);
|
|||||||
* @return #GNUNET_OK on success
|
* @return #GNUNET_OK on success
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
FAKEBANK_check (struct FAKEBANK_Handle *h,
|
TALER_FAKEBANK_check (struct TALER_FAKEBANK_Handle *h,
|
||||||
const struct TALER_Amount *want_amount,
|
const struct TALER_Amount *want_amount,
|
||||||
uint64_t want_debit,
|
uint64_t want_debit,
|
||||||
uint64_t want_credit,
|
uint64_t want_credit,
|
||||||
@ -88,7 +88,7 @@ FAKEBANK_check (struct FAKEBANK_Handle *h,
|
|||||||
* @param h bank to stop
|
* @param h bank to stop
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
FAKEBANK_stop (struct FAKEBANK_Handle *h);
|
TALER_FAKEBANK_stop (struct TALER_FAKEBANK_Handle *h);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
Reference in New Issue
Block a user